A Configure probe for C99 variadic macros, based on code from Jarkko.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Mon Apr 17 14:14:39 CEST 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 initialinstalllocation=''
323 installbin=''
324 userelocatableinc=''
325 byteorder=''
326 cc=''
327 ccflags=''
328 cppflags=''
329 ldflags=''
330 lkflags=''
331 locincpth=''
332 optimize=''
333 cf_email=''
334 cf_by=''
335 cf_time=''
336 charsize=''
337 contains=''
338 cpp_stuff=''
339 cpplast=''
340 cppminus=''
341 cpprun=''
342 cppstdin=''
343 d__fwalk=''
344 d_access=''
345 d_accessx=''
346 d_aintl=''
347 d_alarm=''
348 asctime_r_proto=''
349 d_asctime_r=''
350 d_attribute_format=''
351 d_attribute_malloc=''
352 d_attribute_nonnull=''
353 d_attribute_noreturn=''
354 d_attribute_pure=''
355 d_attribute_unused=''
356 d_attribute_warn_unused_result=''
357 d_bcmp=''
358 d_bcopy=''
359 d_builtin_choose_expr=''
360 d_builtin_expect=''
361 d_bzero=''
362 d_casti32=''
363 castflags=''
364 d_castneg=''
365 d_chown=''
366 d_chroot=''
367 d_chsize=''
368 d_class=''
369 d_clearenv=''
370 d_closedir=''
371 d_void_closedir=''
372 d_cmsghdr_s=''
373 d_const=''
374 d_copysignl=''
375 cryptlib=''
376 d_crypt=''
377 crypt_r_proto=''
378 d_crypt_r=''
379 d_csh=''
380 full_csh=''
381 ctermid_r_proto=''
382 d_ctermid_r=''
383 ctime_r_proto=''
384 d_ctime_r=''
385 d_cuserid=''
386 d_c99_variadic_macros=''
387 d_dbl_dig=''
388 d_dbminitproto=''
389 d_difftime=''
390 d_dirfd=''
391 d_dlerror=''
392 d_dlopen=''
393 d_dlsymun=''
394 d_dosuid=''
395 d_suidsafe=''
396 d_drand48_r=''
397 drand48_r_proto=''
398 d_drand48proto=''
399 d_dup2=''
400 d_eaccess=''
401 d_endgrent=''
402 d_endgrent_r=''
403 endgrent_r_proto=''
404 d_endhent=''
405 d_endhostent_r=''
406 endhostent_r_proto=''
407 d_endnent=''
408 d_endnetent_r=''
409 endnetent_r_proto=''
410 d_endpent=''
411 d_endprotoent_r=''
412 endprotoent_r_proto=''
413 d_endpwent=''
414 d_endpwent_r=''
415 endpwent_r_proto=''
416 d_endsent=''
417 d_endservent_r=''
418 endservent_r_proto=''
419 d_faststdio=''
420 d_fchdir=''
421 d_fchmod=''
422 d_fchown=''
423 d_fcntl=''
424 d_fcntl_can_lock=''
425 d_fd_macros=''
426 d_fd_set=''
427 d_fds_bits=''
428 d_fgetpos=''
429 d_finite=''
430 d_finitel=''
431 d_flexfnam=''
432 d_flock=''
433 d_flockproto=''
434 d_fork=''
435 d_fp_class=''
436 d_fpclass=''
437 d_fpclassify=''
438 d_fpclassl=''
439 d_fpos64_t=''
440 d_frexpl=''
441 d_fs_data_s=''
442 d_fseeko=''
443 d_fsetpos=''
444 d_fstatfs=''
445 d_fsync=''
446 d_ftello=''
447 d_ftime=''
448 d_gettimeod=''
449 d_futimes=''
450 d_Gconvert=''
451 d_getcwd=''
452 d_getespwnam=''
453 d_getfsstat=''
454 d_getgrent=''
455 d_getgrent_r=''
456 getgrent_r_proto=''
457 d_getgrgid_r=''
458 getgrgid_r_proto=''
459 d_getgrnam_r=''
460 getgrnam_r_proto=''
461 d_getgrps=''
462 d_gethbyaddr=''
463 d_gethbyname=''
464 d_gethent=''
465 aphostname=''
466 d_gethname=''
467 d_phostname=''
468 d_uname=''
469 d_gethostbyaddr_r=''
470 gethostbyaddr_r_proto=''
471 d_gethostbyname_r=''
472 gethostbyname_r_proto=''
473 d_gethostent_r=''
474 gethostent_r_proto=''
475 d_gethostprotos=''
476 d_getitimer=''
477 d_getlogin=''
478 d_getlogin_r=''
479 getlogin_r_proto=''
480 d_getmnt=''
481 d_getmntent=''
482 d_getnbyaddr=''
483 d_getnbyname=''
484 d_getnent=''
485 d_getnetbyaddr_r=''
486 getnetbyaddr_r_proto=''
487 d_getnetbyname_r=''
488 getnetbyname_r_proto=''
489 d_getnetent_r=''
490 getnetent_r_proto=''
491 d_getnetprotos=''
492 d_getpagsz=''
493 d_getpent=''
494 d_getpgid=''
495 d_getpgrp2=''
496 d_bsdgetpgrp=''
497 d_getpgrp=''
498 d_getppid=''
499 d_getprior=''
500 d_getpbyname=''
501 d_getpbynumber=''
502 d_getprotobyname_r=''
503 getprotobyname_r_proto=''
504 d_getprotobynumber_r=''
505 getprotobynumber_r_proto=''
506 d_getprotoent_r=''
507 getprotoent_r_proto=''
508 d_getprotoprotos=''
509 d_getprpwnam=''
510 d_getpwent=''
511 d_getpwent_r=''
512 getpwent_r_proto=''
513 d_getpwnam_r=''
514 getpwnam_r_proto=''
515 d_getpwuid_r=''
516 getpwuid_r_proto=''
517 d_getsent=''
518 d_getservbyname_r=''
519 getservbyname_r_proto=''
520 d_getservbyport_r=''
521 getservbyport_r_proto=''
522 d_getservent_r=''
523 getservent_r_proto=''
524 d_getservprotos=''
525 d_getspnam=''
526 d_getspnam_r=''
527 getspnam_r_proto=''
528 d_getsbyname=''
529 d_getsbyport=''
530 d_gmtime_r=''
531 gmtime_r_proto=''
532 d_gnulibc=''
533 gnulibc_version=''
534 d_hasmntopt=''
535 d_htonl=''
536 d_ilogbl=''
537 d_inetaton=''
538 d_int64_t=''
539 d_isascii=''
540 d_isfinite=''
541 d_isinf=''
542 d_isnan=''
543 d_isnanl=''
544 d_killpg=''
545 d_lchown=''
546 d_ldbl_dig=''
547 d_libm_lib_version=''
548 d_link=''
549 d_localtime_r=''
550 localtime_r_proto=''
551 d_locconv=''
552 d_lockf=''
553 d_longdbl=''
554 longdblsize=''
555 d_longlong=''
556 longlongsize=''
557 d_lseekproto=''
558 d_lstat=''
559 d_madvise=''
560 d_malloc_good_size=''
561 d_malloc_size=''
562 d_mblen=''
563 d_mbstowcs=''
564 d_mbtowc=''
565 d_memchr=''
566 d_memcmp=''
567 d_memcpy=''
568 d_memmove=''
569 d_memset=''
570 d_mkdir=''
571 d_mkdtemp=''
572 d_mkfifo=''
573 d_mkstemp=''
574 d_mkstemps=''
575 d_mktime=''
576 d_mmap=''
577 mmaptype=''
578 d_modfl=''
579 d_modfl_pow32_bug=''
580 d_modflproto=''
581 d_mprotect=''
582 d_msg=''
583 d_msgctl=''
584 d_msgget=''
585 d_msghdr_s=''
586 d_msgrcv=''
587 d_msgsnd=''
588 d_msync=''
589 d_munmap=''
590 d_nice=''
591 d_nl_langinfo=''
592 d_off64_t=''
593 d_open3=''
594 d_fpathconf=''
595 d_pathconf=''
596 d_pause=''
597 d_pipe=''
598 d_poll=''
599 d_portable=''
600 d_procselfexe=''
601 procselfexe=''
602 d_old_pthread_create_joinable=''
603 old_pthread_create_joinable=''
604 d_pthread_atfork=''
605 d_pthread_attr_setscope=''
606 d_pthread_yield=''
607 d_sched_yield=''
608 sched_yield=''
609 d_qgcvt=''
610 d_random_r=''
611 random_r_proto=''
612 d_readdir64_r=''
613 readdir64_r_proto=''
614 d_readdir=''
615 d_rewinddir=''
616 d_seekdir=''
617 d_telldir=''
618 d_readdir_r=''
619 readdir_r_proto=''
620 d_readlink=''
621 d_readv=''
622 d_recvmsg=''
623 d_rename=''
624 d_rmdir=''
625 d_safebcpy=''
626 d_safemcpy=''
627 d_sanemcmp=''
628 d_sbrkproto=''
629 d_scalbnl=''
630 d_select=''
631 d_sem=''
632 d_semctl=''
633 d_semget=''
634 d_semop=''
635 d_sendmsg=''
636 d_setegid=''
637 d_seteuid=''
638 d_setgrent=''
639 d_setgrent_r=''
640 setgrent_r_proto=''
641 d_setgrps=''
642 d_sethent=''
643 d_sethostent_r=''
644 sethostent_r_proto=''
645 d_setitimer=''
646 d_setlinebuf=''
647 d_setlocale=''
648 d_setlocale_r=''
649 setlocale_r_proto=''
650 d_setnent=''
651 d_setnetent_r=''
652 setnetent_r_proto=''
653 d_setpent=''
654 d_setpgid=''
655 d_setpgrp2=''
656 d_bsdsetpgrp=''
657 d_setpgrp=''
658 d_setprior=''
659 d_setproctitle=''
660 d_setprotoent_r=''
661 setprotoent_r_proto=''
662 d_setpwent=''
663 d_setpwent_r=''
664 setpwent_r_proto=''
665 d_setregid=''
666 d_setresgid=''
667 d_setresuid=''
668 d_setreuid=''
669 d_setrgid=''
670 d_setruid=''
671 d_setsent=''
672 d_setservent_r=''
673 setservent_r_proto=''
674 d_setsid=''
675 d_setvbuf=''
676 d_sfio=''
677 usesfio=''
678 d_shm=''
679 d_shmat=''
680 d_shmatprototype=''
681 shmattype=''
682 d_shmctl=''
683 d_shmdt=''
684 d_shmget=''
685 d_sigaction=''
686 d_sigprocmask=''
687 d_sigsetjmp=''
688 usesitecustomize=''
689 d_snprintf=''
690 d_vsnprintf=''
691 d_sockatmark=''
692 d_sockatmarkproto=''
693 d_msg_ctrunc=''
694 d_msg_dontroute=''
695 d_msg_oob=''
696 d_msg_peek=''
697 d_msg_proxy=''
698 d_oldsock=''
699 d_scm_rights=''
700 d_socket=''
701 d_sockpair=''
702 sockethdr=''
703 socketlib=''
704 d_socklen_t=''
705 d_socks5_init=''
706 d_sprintf_returns_strlen=''
707 d_sqrtl=''
708 d_srand48_r=''
709 srand48_r_proto=''
710 d_srandom_r=''
711 srandom_r_proto=''
712 d_sresgproto=''
713 d_sresuproto=''
714 d_statblks=''
715 d_statfs_f_flags=''
716 d_statfs_s=''
717 d_fstatvfs=''
718 d_statvfs=''
719 d_stdio_cnt_lval=''
720 d_stdio_ptr_lval=''
721 d_stdio_ptr_lval_nochange_cnt=''
722 d_stdio_ptr_lval_sets_cnt=''
723 d_stdiobase=''
724 d_stdstdio=''
725 stdio_base=''
726 stdio_bufsiz=''
727 stdio_cnt=''
728 stdio_filbuf=''
729 stdio_ptr=''
730 d_index=''
731 d_strchr=''
732 d_strcoll=''
733 d_strctcpy=''
734 d_strerrm=''
735 d_strerror=''
736 d_sysernlst=''
737 d_syserrlst=''
738 d_strerror_r=''
739 strerror_r_proto=''
740 d_strftime=''
741 d_strlcat=''
742 d_strlcpy=''
743 d_strtod=''
744 d_strtol=''
745 d_strtold=''
746 d_strtoll=''
747 d_strtoq=''
748 d_strtoul=''
749 d_strtoull=''
750 d_strtouq=''
751 d_strxfrm=''
752 d_symlink=''
753 d_syscall=''
754 d_syscallproto=''
755 d_sysconf=''
756 d_system=''
757 d_tcgetpgrp=''
758 d_tcsetpgrp=''
759 d_telldirproto=''
760 d_time=''
761 timetype=''
762 clocktype=''
763 d_times=''
764 d_tmpnam_r=''
765 tmpnam_r_proto=''
766 d_truncate=''
767 d_ttyname_r=''
768 ttyname_r_proto=''
769 d_tzname=''
770 d_u32align=''
771 d_ualarm=''
772 d_umask=''
773 d_semctl_semid_ds=''
774 d_semctl_semun=''
775 d_union_semun=''
776 d_unordered=''
777 d_unsetenv=''
778 d_usleep=''
779 d_usleepproto=''
780 d_ustat=''
781 d_vfork=''
782 usevfork=''
783 d_voidsig=''
784 signal_t=''
785 d_volatile=''
786 d_charvspr=''
787 d_vprintf=''
788 d_wait4=''
789 d_waitpid=''
790 d_wcstombs=''
791 d_wctomb=''
792 d_writev=''
793 dlext=''
794 cccdlflags=''
795 ccdlflags=''
796 dlsrc=''
797 ld=''
798 lddlflags=''
799 usedl=''
800 doublesize=''
801 ebcdic=''
802 fflushNULL=''
803 fflushall=''
804 fpossize=''
805 fpostype=''
806 gccansipedantic=''
807 gccosandvers=''
808 gccversion=''
809 gidformat=''
810 gidsign=''
811 gidsize=''
812 gidtype=''
813 groupstype=''
814 h_fcntl=''
815 h_sysfile=''
816 html1dir=''
817 html1direxp=''
818 installhtml1dir=''
819 html3dir=''
820 html3direxp=''
821 installhtml3dir=''
822 i_arpainet=''
823 i_crypt=''
824 db_hashtype=''
825 db_prefixtype=''
826 db_version_major=''
827 db_version_minor=''
828 db_version_patch=''
829 i_db=''
830 i_dbm=''
831 i_rpcsvcdbm=''
832 d_dirnamlen=''
833 direntrytype=''
834 i_dirent=''
835 i_dld=''
836 i_dlfcn=''
837 i_fcntl=''
838 i_float=''
839 i_fp=''
840 i_fp_class=''
841 i_gdbm=''
842 d_grpasswd=''
843 i_grp=''
844 i_ieeefp=''
845 i_inttypes=''
846 i_langinfo=''
847 i_libutil=''
848 i_limits=''
849 i_locale=''
850 i_machcthr=''
851 i_malloc=''
852 i_math=''
853 i_memory=''
854 i_mntent=''
855 i_ndbm=''
856 i_netdb=''
857 i_neterrno=''
858 i_netinettcp=''
859 i_niin=''
860 i_sysin=''
861 i_poll=''
862 i_prot=''
863 i_pthread=''
864 d_pwage=''
865 d_pwchange=''
866 d_pwclass=''
867 d_pwcomment=''
868 d_pwexpire=''
869 d_pwgecos=''
870 d_pwpasswd=''
871 d_pwquota=''
872 i_pwd=''
873 i_sfio=''
874 i_shadow=''
875 i_socks=''
876 i_stddef=''
877 i_stdlib=''
878 i_string=''
879 strings=''
880 i_sunmath=''
881 i_sysaccess=''
882 i_sysdir=''
883 i_sysfile=''
884 d_voidtty=''
885 i_bsdioctl=''
886 i_sysfilio=''
887 i_sysioctl=''
888 i_syssockio=''
889 i_syslog=''
890 i_sysmman=''
891 i_sysmode=''
892 i_sysmount=''
893 i_sysndir=''
894 i_sysparam=''
895 i_sysresrc=''
896 i_syssecrt=''
897 i_sysselct=''
898 i_sysstat=''
899 i_sysstatfs=''
900 i_sysstatvfs=''
901 i_systimes=''
902 i_systypes=''
903 i_sysuio=''
904 i_sysun=''
905 i_sysutsname=''
906 i_sysvfs=''
907 i_syswait=''
908 i_sgtty=''
909 i_termio=''
910 i_termios=''
911 d_tm_tm_gmtoff=''
912 d_tm_tm_zone=''
913 i_systime=''
914 i_systimek=''
915 i_time=''
916 timeincl=''
917 i_unistd=''
918 i_ustat=''
919 i_utime=''
920 i_values=''
921 i_stdarg=''
922 i_varargs=''
923 i_varhdr=''
924 i_vfork=''
925 d_inc_version_list=''
926 inc_version_list=''
927 inc_version_list_init=''
928 installprefix=''
929 installprefixexp=''
930 installstyle=''
931 installusrbinperl=''
932 intsize=''
933 longsize=''
934 shortsize=''
935 issymlink=''
936 libc=''
937 ldlibpthname=''
938 libperl=''
939 shrpenv=''
940 useshrplib=''
941 glibpth=''
942 libpth=''
943 loclibpth=''
944 plibpth=''
945 xlibpth=''
946 ignore_versioned_solibs=''
947 libs=''
948 libsdirs=''
949 libsfiles=''
950 libsfound=''
951 libspath=''
952 lns=''
953 d_PRIEUldbl=''
954 d_PRIFUldbl=''
955 d_PRIGUldbl=''
956 d_PRIeldbl=''
957 d_PRIfldbl=''
958 d_PRIgldbl=''
959 d_SCNfldbl=''
960 sPRIEUldbl=''
961 sPRIFUldbl=''
962 sPRIGUldbl=''
963 sPRIeldbl=''
964 sPRIfldbl=''
965 sPRIgldbl=''
966 sSCNfldbl=''
967 lseeksize=''
968 lseektype=''
969 mad=''
970 madlyh=''
971 madlyobj=''
972 madlysrc=''
973 make_set_make=''
974 d_mymalloc=''
975 freetype=''
976 mallocobj=''
977 mallocsrc=''
978 malloctype=''
979 usemallocwrap=''
980 usemymalloc=''
981 installman1dir=''
982 man1dir=''
983 man1direxp=''
984 man1ext=''
985 installman3dir=''
986 man3dir=''
987 man3direxp=''
988 man3ext=''
989 modetype=''
990 multiarch=''
991 mydomain=''
992 myhostname=''
993 phostname=''
994 c=''
995 n=''
996 d_eofnblk=''
997 eagain=''
998 o_nonblock=''
999 rd_nodata=''
1000 need_va_copy=''
1001 netdb_hlen_type=''
1002 netdb_host_type=''
1003 netdb_name_type=''
1004 netdb_net_type=''
1005 groupcat=''
1006 hostcat=''
1007 passcat=''
1008 orderlib=''
1009 ranlib=''
1010 d_perl_otherlibdirs=''
1011 otherlibdirs=''
1012 package=''
1013 spackage=''
1014 pager=''
1015 api_revision=''
1016 api_subversion=''
1017 api_version=''
1018 api_versionstring=''
1019 patchlevel=''
1020 perl_patchlevel=''
1021 revision=''
1022 subversion=''
1023 version=''
1024 version_patchlevel_string=''
1025 perl5=''
1026 perladmin=''
1027 perlpath=''
1028 d_nv_preserves_uv=''
1029 d_nv_zero_is_allbits_zero=''
1030 i16size=''
1031 i16type=''
1032 i32size=''
1033 i32type=''
1034 i64size=''
1035 i64type=''
1036 i8size=''
1037 i8type=''
1038 ivsize=''
1039 ivtype=''
1040 nv_preserves_uv_bits=''
1041 nvsize=''
1042 nvtype=''
1043 u16size=''
1044 u16type=''
1045 u32size=''
1046 u32type=''
1047 u64size=''
1048 u64type=''
1049 u8size=''
1050 u8type=''
1051 uvsize=''
1052 uvtype=''
1053 ivdformat=''
1054 nvEUformat=''
1055 nvFUformat=''
1056 nvGUformat=''
1057 nveformat=''
1058 nvfformat=''
1059 nvgformat=''
1060 uvXUformat=''
1061 uvoformat=''
1062 uvuformat=''
1063 uvxformat=''
1064 pidtype=''
1065 prefix=''
1066 prefixexp=''
1067 installprivlib=''
1068 privlib=''
1069 privlibexp=''
1070 prototype=''
1071 ptrsize=''
1072 d_PRIXU64=''
1073 d_PRId64=''
1074 d_PRIi64=''
1075 d_PRIo64=''
1076 d_PRIu64=''
1077 d_PRIx64=''
1078 sPRIXU64=''
1079 sPRId64=''
1080 sPRIi64=''
1081 sPRIo64=''
1082 sPRIu64=''
1083 sPRIx64=''
1084 d_quad=''
1085 quadkind=''
1086 quadtype=''
1087 uquadtype=''
1088 drand01=''
1089 randbits=''
1090 randfunc=''
1091 randseedtype=''
1092 seedfunc=''
1093 installscript=''
1094 scriptdir=''
1095 scriptdirexp=''
1096 selectminbits=''
1097 selecttype=''
1098 sh=''
1099 sig_count=''
1100 sig_name=''
1101 sig_name_init=''
1102 sig_num=''
1103 sig_num_init=''
1104 sig_size=''
1105 d_sitearch=''
1106 installsitearch=''
1107 sitearch=''
1108 sitearchexp=''
1109 installsitebin=''
1110 sitebin=''
1111 sitebinexp=''
1112 installsitehtml1dir=''
1113 sitehtml1dir=''
1114 sitehtml1direxp=''
1115 installsitehtml3dir=''
1116 sitehtml3dir=''
1117 sitehtml3direxp=''
1118 installsitelib=''
1119 sitelib=''
1120 sitelib_stem=''
1121 sitelibexp=''
1122 installsiteman1dir=''
1123 siteman1dir=''
1124 siteman1direxp=''
1125 installsiteman3dir=''
1126 siteman3dir=''
1127 siteman3direxp=''
1128 siteprefix=''
1129 siteprefixexp=''
1130 installsitescript=''
1131 sitescript=''
1132 sitescriptexp=''
1133 sizesize=''
1134 sizetype=''
1135 so=''
1136 socksizetype=''
1137 sharpbang=''
1138 shsharp=''
1139 spitshell=''
1140 src=''
1141 ssizetype=''
1142 startperl=''
1143 startsh=''
1144 stdchar=''
1145 d_stdio_stream_array=''
1146 stdio_stream_array=''
1147 sysman=''
1148 trnl=''
1149 uidformat=''
1150 uidsign=''
1151 uidsize=''
1152 uidtype=''
1153 archname64=''
1154 use64bitall=''
1155 use64bitint=''
1156 usefaststdio=''
1157 ccflags_uselargefiles=''
1158 ldflags_uselargefiles=''
1159 libswanted_uselargefiles=''
1160 uselargefiles=''
1161 uselongdouble=''
1162 usemorebits=''
1163 usemultiplicity=''
1164 nm_opt=''
1165 nm_so_opt=''
1166 runnm=''
1167 usenm=''
1168 useperlio=''
1169 usesocks=''
1170 d_oldpthreads=''
1171 use5005threads=''
1172 useithreads=''
1173 usereentrant=''
1174 usethreads=''
1175 incpath=''
1176 mips_type=''
1177 usrinc=''
1178 d_vendorarch=''
1179 installvendorarch=''
1180 vendorarch=''
1181 vendorarchexp=''
1182 d_vendorbin=''
1183 installvendorbin=''
1184 vendorbin=''
1185 vendorbinexp=''
1186 installvendorhtml1dir=''
1187 vendorhtml1dir=''
1188 vendorhtml1direxp=''
1189 installvendorhtml3dir=''
1190 vendorhtml3dir=''
1191 vendorhtml3direxp=''
1192 d_vendorlib=''
1193 installvendorlib=''
1194 vendorlib=''
1195 vendorlib_stem=''
1196 vendorlibexp=''
1197 installvendorman1dir=''
1198 vendorman1dir=''
1199 vendorman1direxp=''
1200 installvendorman3dir=''
1201 vendorman3dir=''
1202 vendorman3direxp=''
1203 usevendorprefix=''
1204 vendorprefix=''
1205 vendorprefixexp=''
1206 d_vendorscript=''
1207 installvendorscript=''
1208 vendorscript=''
1209 vendorscriptexp=''
1210 versiononly=''
1211 defvoidused=''
1212 voidflags=''
1213 yacc=''
1214 yaccflags=''
1215 CONFIG=''
1216
1217 define='define'
1218 undef='undef'
1219 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1220 rmlist=''
1221
1222 : We must find out about Eunice early
1223 eunicefix=':'
1224 if test -f /etc/unixtovms; then
1225         eunicefix=/etc/unixtovms
1226 fi
1227 if test -f /etc/unixtovms.exe; then
1228         eunicefix=/etc/unixtovms.exe
1229 fi
1230
1231 : Set executable suffix now -- needed before hints available
1232 if test -f "/libs/version.library"; then
1233 : Amiga OS
1234     _exe=""
1235 elif test -f "/system/gnu_library/bin/ar.pm"; then
1236 : Stratus VOS
1237     _exe=".pm"
1238 elif test -n "$DJGPP"; then
1239 : DOS DJGPP
1240     _exe=".exe"
1241 elif test -d c:/. -o -n "$is_os2" ; then
1242 : OS/2 or cygwin
1243     _exe=".exe"
1244 fi
1245
1246 i_whoami=''
1247 ccname=''
1248 ccversion=''
1249 perllibs=''
1250 : set useposix=false in your hint file to disable the POSIX extension.
1251 useposix=true
1252 : set useopcode=false in your hint file to disable the Opcode extension.
1253 useopcode=true
1254 : Trailing extension.  Override this in a hint file, if needed.
1255 : Extra object files, if any, needed on this platform.
1256 archobjs=''
1257 archname=''
1258 : Possible local include directories to search.
1259 : Set locincpth to "" in a hint file to defeat local include searches.
1260 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1261 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1262 :
1263 : no include file wanted by default
1264 inclwanted=''
1265
1266 : Enable -DEBUGGING and -DDEBUGGING from the command line
1267 EBUGGING=''
1268 DEBUGGING=old
1269
1270 groupstype=''
1271 libnames=''
1272 : change the next line if compiling for Xenix/286 on Xenix/386
1273 xlibpth='/usr/lib/386 /lib/386'
1274 : Possible local library directories to search.
1275 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1276 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1277
1278 : general looking path for locating libraries
1279 glibpth="/lib /usr/lib $xlibpth"
1280 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1281 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1282 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1283
1284 : Private path used by Configure to find libraries.  Its value
1285 : is prepended to libpth. This variable takes care of special
1286 : machines, like the mips.  Usually, it should be empty.
1287 plibpth=''
1288
1289 : default library list
1290 libswanted=''
1291 : some systems want to use only the non-versioned libso:s
1292 ignore_versioned_solibs=''
1293 siteman1dir=''
1294 siteman3dir=''
1295 sitescript=''
1296 archname64=''
1297 ccflags_uselargefiles=''
1298 ldflags_uselargefiles=''
1299 libswanted_uselargefiles=''
1300 : set usemultiplicity on the Configure command line to enable multiplicity.
1301 : set usesocks on the Configure command line to enable socks.
1302 : set usethreads on the Configure command line to enable threads.
1303 usereentrant='undef'
1304 : full support for void wanted by default
1305 defvoidused=15
1306
1307 : List of libraries we want.
1308 : If anyone needs extra -lxxx, put those in a hint file.
1309 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1310 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1311 : We probably want to search /usr/shlib before most other libraries.
1312 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1313 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1314 glibpth="/usr/shlib $glibpth"
1315 : Do not use vfork unless overridden by a hint file.
1316 usevfork=false
1317
1318 : Find the basic shell for Bourne shell scripts
1319 case "$sh" in
1320 '')
1321         case "$SYSTYPE" in
1322         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1323         *) xxx='/bin/sh';;
1324         esac
1325         if test -f "$xxx"; then
1326                 sh="$xxx"
1327         else
1328                 : Build up a list and do a single loop so we can 'break' out.
1329                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1330                 for xxx in sh bash ksh pdksh ash; do
1331                         for p in $pth; do
1332                                 try="$try ${p}/${xxx}"
1333                         done
1334                 done
1335                 for xxx in $try; do
1336                         if test -f "$xxx"; then
1337                                 sh="$xxx";
1338                                 break
1339                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1340                                 sh="$xxx";
1341                                 break
1342                         elif test -f "$xxx.exe"; then
1343                                 sh="$xxx";
1344                                 break
1345                         fi
1346                 done
1347         fi
1348         ;;
1349 esac
1350
1351 case "$sh" in
1352 '')     cat >&2 <<EOM
1353 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1354
1355 Usually it's in /bin/sh.  How did you even get this far?
1356 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1357 we'll try to straighten this all out.
1358 EOM
1359         exit 1
1360         ;;
1361 esac
1362
1363 : see if sh knows # comments
1364 if `$sh -c '#' >/dev/null 2>&1`; then
1365         shsharp=true
1366         spitshell=cat
1367         xcat=/bin/cat
1368         test -f $xcat$_exe || xcat=/usr/bin/cat
1369         if test ! -f $xcat$_exe; then
1370                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1371                         if test -f $p/cat$_exe; then
1372                                 xcat=$p/cat
1373                                 break
1374                         fi
1375                 done
1376                 if test ! -f $xcat$_exe; then
1377                         echo "Can't find cat anywhere!"
1378                         exit 1
1379                 fi
1380         fi
1381         echo "#!$xcat" >sharp
1382         $eunicefix sharp
1383         chmod +x sharp
1384         ./sharp > today
1385         if test -s today; then
1386                 sharpbang='#!'
1387         else
1388                 echo "#! $xcat" > sharp
1389                 $eunicefix sharp
1390                 chmod +x sharp
1391                 ./sharp > today
1392                 if test -s today; then
1393                         sharpbang='#! '
1394                 else
1395                         sharpbang=': use '
1396                 fi
1397         fi
1398 else
1399         echo " "
1400         echo "Your $sh doesn't grok # comments--I will strip them later on."
1401         shsharp=false
1402         cd ..
1403         echo "exec grep -v '^[  ]*#'" >spitshell
1404         chmod +x spitshell
1405         $eunicefix spitshell
1406         spitshell=`pwd`/spitshell
1407         cd UU
1408         echo "I presume that if # doesn't work, #! won't work either!"
1409         sharpbang=': use '
1410 fi
1411 rm -f sharp today
1412
1413 : figure out how to guarantee sh startup
1414 case "$startsh" in
1415 '') startsh=${sharpbang}${sh} ;;
1416 *)
1417 esac
1418 cat >sharp <<EOSS
1419 $startsh
1420 set abc
1421 test "$?abc" != 1
1422 EOSS
1423
1424 chmod +x sharp
1425 $eunicefix sharp
1426 if ./sharp; then
1427         : echo "Yup, it does."
1428 else
1429         echo "Hmm... '$startsh' does not guarantee sh startup..."
1430         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1431 fi
1432 rm -f sharp
1433
1434
1435 : Save command line options in file UU/cmdline.opt for later use in
1436 : generating config.sh.
1437 cat > cmdline.opt <<EOSH
1438 # Configure command line arguments.
1439 config_arg0='$0'
1440 config_args='$*'
1441 config_argc=$#
1442 EOSH
1443 argn=1
1444 args_exp=''
1445 args_sep=''
1446 for arg in "$@"; do
1447         cat >>cmdline.opt <<EOSH
1448 config_arg$argn='$arg'
1449 EOSH
1450         # Extreme backslashitis: replace each ' by '"'"'
1451         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1452 $arg
1453 EOC
1454         arg_exp=`cat cmdl.opt`
1455         args_exp="$args_exp$args_sep'$arg_exp'"
1456         argn=`expr $argn + 1`
1457         args_sep=' '
1458 done
1459 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1460 # used by ./hints/os2.sh
1461 rm -f cmdl.opt
1462
1463 : produce awk script to parse command line options
1464 cat >options.awk <<'EOF'
1465 BEGIN {
1466         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1467
1468         len = length(optstr);
1469         for (i = 1; i <= len; i++) {
1470                 c = substr(optstr, i, 1);
1471                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1472                 if (a == ":") {
1473                         arg[c] = 1;
1474                         i++;
1475                 }
1476                 opt[c] = 1;
1477         }
1478 }
1479 {
1480         expect = 0;
1481         str = $0;
1482         if (substr(str, 1, 1) != "-") {
1483                 printf("'%s'\n", str);
1484                 next;
1485         }
1486         len = length($0);
1487         for (i = 2; i <= len; i++) {
1488                 c = substr(str, i, 1);
1489                 if (!opt[c]) {
1490                         printf("-%s\n", substr(str, i));
1491                         next;
1492                 }
1493                 printf("-%s\n", c);
1494                 if (arg[c]) {
1495                         if (i < len)
1496                                 printf("'%s'\n", substr(str, i + 1));
1497                         else
1498                                 expect = 1;
1499                         next;
1500                 }
1501         }
1502 }
1503 END {
1504         if (expect)
1505                 print "?";
1506 }
1507 EOF
1508
1509 : process the command line options
1510 set X `for arg in "$@"; do echo "X$arg"; done |
1511         sed -e s/X// | awk -f options.awk`
1512 eval "set $*"
1513 shift
1514 rm -f options.awk
1515
1516 : set up default values
1517 fastread=''
1518 reuseval=false
1519 config_sh=''
1520 alldone=''
1521 error=''
1522 silent=''
1523 extractsh=''
1524 override=''
1525 knowitall=''
1526 rm -f optdef.sh posthint.sh
1527 cat >optdef.sh <<EOS
1528 $startsh
1529 EOS
1530
1531
1532 : option parsing
1533 while test $# -gt 0; do
1534         case "$1" in
1535         -d) shift; fastread=yes;;
1536         -e) shift; alldone=cont;;
1537         -f)
1538                 shift
1539                 cd ..
1540                 if test -r "$1"; then
1541                         config_sh="$1"
1542                 else
1543                         echo "$me: cannot read config file $1." >&2
1544                         error=true
1545                 fi
1546                 cd UU
1547                 shift;;
1548         -h) shift; error=true;;
1549         -r) shift; reuseval=true;;
1550         -s) shift; silent=true; realsilent=true;;
1551         -E) shift; alldone=exit;;
1552         -K) shift; knowitall=true;;
1553         -O) shift; override=true;;
1554         -S) shift; silent=true; extractsh=true;;
1555         -D)
1556                 shift
1557                 case "$1" in
1558                 *=)
1559                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1560                         echo "$me: ignoring -D $1" >&2
1561                         ;;
1562                 *=*) echo "$1" | \
1563                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1564                 *) echo "$1='define'" >> optdef.sh;;
1565                 esac
1566                 shift
1567                 ;;
1568         -U)
1569                 shift
1570                 case "$1" in
1571                 *=) echo "$1" >> optdef.sh;;
1572                 *=*)
1573                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1574                         echo "$me: ignoring -U $1" >&2
1575                         ;;
1576                 *) echo "$1='undef'" >> optdef.sh;;
1577                 esac
1578                 shift
1579                 ;;
1580         -A)
1581             shift
1582             xxx=''
1583             yyy="$1"
1584             zzz=''
1585             uuu=undef
1586             case "$yyy" in
1587             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1588                  case "$zzz" in
1589                  *:*) zzz='' ;;
1590                  *)   xxx=append
1591                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1592                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1593                  esac
1594                  ;;
1595             esac
1596             case "$xxx" in
1597             '')  case "$yyy" in
1598                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1599                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1600                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1601                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1602                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1603                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1604                  esac
1605                  ;;       
1606             esac
1607             case "$xxx" in
1608             append)
1609                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1610             clear)
1611                 echo "$yyy=''"                  >> posthint.sh ;;
1612             define)
1613                 case "$zzz" in
1614                 '') zzz=define ;;
1615                 esac
1616                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1617             eval)
1618                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1619             prepend)
1620                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1621             undef)
1622                 case "$zzz" in
1623                 '') zzz="$uuu" ;;
1624                 esac
1625                 echo "$yyy=$zzz"                >> posthint.sh ;;
1626             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1627             esac
1628             shift
1629             ;;
1630         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1631             exit 0;;
1632         --) break;;
1633         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1634         *) break;;
1635         esac
1636 done
1637
1638 case "$error" in
1639 true)
1640         cat >&2 <<EOM
1641 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1642                  [-U symbol] [-U symbol=] [-A command:symbol...]
1643   -d : use defaults for all answers.
1644   -e : go on without questioning past the production of config.sh.
1645   -f : specify an alternate default configuration file.
1646   -h : print this help message and exit (with an error status).
1647   -r : reuse C symbols value if possible (skips costly nm extraction).
1648   -s : silent mode, only echoes questions and essential information.
1649   -D : define symbol to have some value:
1650          -D symbol         symbol gets the value 'define'
1651          -D symbol=value   symbol gets the value 'value'
1652   -E : stop at the end of questions, after having produced config.sh.
1653   -K : do not use unless you know what you are doing.
1654   -O : let -D and -U override definitions from loaded configuration file.
1655   -S : perform variable substitutions on all .SH files (can mix with -f)
1656   -U : undefine symbol:
1657          -U symbol    symbol gets the value 'undef'
1658          -U symbol=   symbol gets completely empty
1659   -A : manipulate symbol after the platform specific hints have been applied:
1660          -A symbol=value                append " "value to symbol
1661          -A append:symbol=value         append value to symbol
1662          -A define:symbol=value         define symbol to have value
1663          -A clear:symbol                define symbol to be ''
1664          -A define:symbol               define symbol to be 'define'
1665          -A eval:symbol=value           define symbol to be eval of value
1666          -A prepend:symbol=value        prepend value to symbol
1667          -A undef:symbol                define symbol to be 'undef'
1668          -A undef:symbol=               define symbol to be ''
1669   -V : print version number and exit (with a zero status).
1670 EOM
1671         exit 1
1672         ;;
1673 esac
1674
1675 : Sanity checks
1676 case "$fastread$alldone" in
1677 yescont|yesexit) ;;
1678 *)
1679         case "$extractsh" in
1680         true) ;;
1681         *)
1682                 if test ! -t 0; then
1683                         echo "Say 'sh Configure', not 'sh <Configure'"
1684                         exit 1
1685                 fi
1686                 ;;
1687         esac
1688         ;;
1689 esac
1690
1691 exec 4>&1
1692 case "$silent" in
1693 true) exec 1>/dev/null;;
1694 esac
1695
1696 : run the defines and the undefines, if any, but leave the file out there...
1697 touch optdef.sh
1698 . ./optdef.sh
1699 : create the posthint manipulation script and leave the file out there...
1700 touch posthint.sh
1701
1702 : set package name
1703 package=perl5
1704 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1705 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1706 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1707 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1708 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1709 esac
1710
1711 : Some greps do not return status, grrr.
1712 echo "grimblepritz" >grimble
1713 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1714         contains=contains
1715 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1716         contains=grep
1717 else
1718         contains=contains
1719 fi
1720 rm -f grimble
1721 : the following should work in any shell
1722 case "$contains" in
1723 contains*)
1724         echo " "
1725         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1726         cat >contains <<'EOSS'
1727 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1728 EOSS
1729 chmod +x contains
1730 esac
1731
1732 : Find the path to the source tree
1733 case "$src" in
1734 '') case "$0" in
1735     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1736          case "$src" in
1737          /*)    ;;
1738          .)     ;;
1739          *)     src=`cd ../$src && pwd` ;;
1740          esac
1741          ;;
1742     *)   src='.';;
1743     esac;;
1744 esac
1745 case "$src" in
1746 '')     src=/
1747         rsrc=/
1748         ;;
1749 /*) rsrc="$src";;
1750 *) rsrc="../$src";;
1751 esac
1752 if test -f $rsrc/Configure && \
1753         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1754 then
1755    : found it, so we are ok.
1756 else
1757         rsrc=''
1758         for src in . .. ../.. ../../.. ../../../..; do
1759                 if test -f ../$src/Configure && \
1760                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1761                 then
1762                         rsrc=../$src
1763                         break
1764                 fi
1765         done
1766 fi
1767 case "$rsrc" in
1768 '')
1769         cat <<EOM >&4
1770
1771 Sorry, I can't seem to locate the source dir for $package.  Please start
1772 Configure with an explicit path -- i.e. /some/path/Configure.
1773
1774 EOM
1775         exit 1
1776         ;;
1777 ../.)   rsrc='..';;
1778 *)
1779         echo " "
1780         echo "Sources for $package found in \"$src\"." >&4
1781         ;;
1782 esac
1783
1784 : script used to extract .SH files with variable substitutions
1785 cat >extract <<'EOS'
1786 PERL_CONFIG_SH=true
1787 echo "Doing variable substitutions on .SH files..."
1788 if test -f MANIFEST; then
1789         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1790 else
1791         echo "(Looking for .SH files under the source directory.)"
1792         set x `(cd "$src"; find . -name "*.SH" -print)`
1793 fi
1794 shift
1795 case $# in
1796 0) set x `(cd "$src"; echo *.SH)`; shift;;
1797 esac
1798 if test ! -f "$src/$1"; then
1799         shift
1800 fi
1801 mkdir_p='
1802 name=$1;
1803 create="";
1804 while test $name; do
1805         if test ! -d "$name"; then
1806                 create="$name $create";
1807                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1808                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1809         else
1810                 name="";
1811         fi;
1812 done;
1813 for file in $create; do
1814         mkdir $file;
1815 done
1816 '
1817 for file in $*; do
1818         case "$src" in
1819         ".")
1820                 case "$file" in
1821                 */*)
1822                         dir=`expr X$file : 'X\(.*\)/'`
1823                         file=`expr X$file : 'X.*/\(.*\)'`
1824                         (cd "$dir" && . ./$file)
1825                         ;;
1826                 *)
1827                         . ./$file
1828                         ;;
1829                 esac
1830                 ;;
1831         *)
1832                 case "$file" in
1833                 */*)
1834                         dir=`expr X$file : 'X\(.*\)/'`
1835                         file=`expr X$file : 'X.*/\(.*\)'`
1836                         (set x $dir; shift; eval $mkdir_p)
1837                         sh <"$src/$dir/$file"
1838                         ;;
1839                 *)
1840                         sh <"$src/$file"
1841                         ;;
1842                 esac
1843                 ;;
1844         esac
1845 done
1846 if test -f "$src/config_h.SH"; then
1847         if test ! -f config.h; then
1848         : oops, they left it out of MANIFEST, probably, so do it anyway.
1849         . "$src/config_h.SH"
1850         fi
1851 fi
1852 EOS
1853
1854 : extract files and exit if asked to do so
1855 case "$extractsh" in
1856 true)
1857         case "$realsilent" in
1858         true) ;;
1859         *) exec 1>&4;;
1860         esac
1861         case "$config_sh" in
1862         '') config_sh='config.sh';;
1863         esac
1864         echo " "
1865         echo "Fetching answers from $config_sh..."
1866         cd ..
1867         . $config_sh
1868         test "$override" && . ./optdef.sh
1869         echo " "
1870         . UU/extract
1871         rm -rf UU
1872         echo "Extraction done."
1873         exit 0
1874         ;;
1875 esac
1876
1877 : Eunice requires " " instead of "", can you believe it
1878 echo " "
1879 : Here we go...
1880 echo "Beginning of configuration questions for $package."
1881
1882 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1883
1884 : first determine how to suppress newline on echo command
1885 echo " "
1886 echo "Checking echo to see how to suppress newlines..."
1887 (echo "hi there\c" ; echo " ") >.echotmp
1888 if $contains c .echotmp >/dev/null 2>&1 ; then
1889         echo "...using -n."
1890         n='-n'
1891         c=''
1892 else
1893         cat <<'EOM'
1894 ...using \c
1895 EOM
1896         n=''
1897         c='\c'
1898 fi
1899 echo $n "The star should be here-->$c"
1900 echo '*'
1901 rm -f .echotmp
1902
1903 : Now test for existence of everything in MANIFEST
1904 echo " "
1905 if test -f "$rsrc/MANIFEST"; then
1906         echo "First let's make sure your kit is complete.  Checking..." >&4
1907         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1908         rm -f missing
1909         tmppwd=`pwd`
1910         for filelist in x??; do
1911                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1912         done
1913         if test -s missing; then
1914                 cat missing >&4
1915                 cat >&4 <<'EOM'
1916
1917 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1918
1919 You have the option of continuing the configuration process, despite the
1920 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1921 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1922 and contact the author (perlbug@perl.org).
1923
1924 EOM
1925                 echo $n "Continue? [n] $c" >&4
1926                 read ans
1927                 case "$ans" in
1928                 y*)
1929                         echo "Continuing..." >&4
1930                         rm -f missing
1931                         ;;
1932                 *)
1933                         echo "ABORTING..." >&4
1934                         kill $$
1935                         ;;
1936                 esac
1937         else
1938                 echo "Looks good..."
1939         fi
1940 else
1941         echo "There is no MANIFEST file.  I hope your kit is complete !"
1942 fi
1943 rm -f missing x??
1944
1945 echo " "
1946 : Find the appropriate value for a newline for tr
1947 if test -n "$DJGPP"; then
1948        trnl='\012'
1949 fi
1950 if test X"$trnl" = X; then
1951         case "`echo foo|tr '\n' x 2>/dev/null`" in
1952         foox) trnl='\n' ;;
1953         esac
1954 fi
1955 if test X"$trnl" = X; then
1956         case "`echo foo|tr '\012' x 2>/dev/null`" in
1957         foox) trnl='\012' ;;
1958         esac
1959 fi
1960 if test X"$trnl" = X; then
1961        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1962        fooxy) trnl='\n\r' ;;
1963        esac
1964 fi
1965 if test X"$trnl" = X; then
1966         cat <<EOM >&2
1967
1968 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1969
1970 EOM
1971         exit 1
1972 fi
1973
1974 : compute the number of columns on the terminal for proper question formatting
1975 case "$COLUMNS" in
1976 '') COLUMNS='80';;
1977 esac
1978
1979 : set up the echo used in my read
1980 myecho="case \"\$xxxm\" in
1981 '') echo $n \"\$rp $c\" >&4;;
1982 *) case \"\$rp\" in
1983         '') echo $n \"[\$xxxm] $c\";;
1984         *)
1985                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1986                         echo \"\$rp\" >&4
1987                         echo $n \"[\$xxxm] $c\" >&4
1988                 else
1989                         echo $n \"\$rp [\$xxxm] $c\" >&4
1990                 fi
1991                 ;;
1992         esac;;
1993 esac"
1994
1995 : now set up to do reads with possible shell escape and default assignment
1996 cat <<EOSC >myread
1997 $startsh
1998 xxxm=\$dflt
1999 $myecho
2000 ans='!'
2001 case "\$fastread" in
2002 yes) case "\$dflt" in
2003         '') ;;
2004         *) ans='';
2005                 case "\$silent-\$rp" in
2006                 true-) ;;
2007                 *) echo " " >&4;;
2008                 esac;;
2009         esac;;
2010 *) case "\$silent" in
2011         true) case "\$rp" in
2012                 '') ans='';;
2013                 esac;;
2014         esac;;
2015 esac
2016 while expr "X\$ans" : "X!" >/dev/null; do
2017         read answ
2018         set x \$xxxm
2019         shift
2020         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2021         case  "\$answ" in
2022         "!")
2023                 sh 1>&4
2024                 echo " "
2025                 $myecho
2026                 ;;
2027         !*)
2028                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2029                 shift
2030                 sh 1>&4 -c "\$*"
2031                 echo " "
2032                 $myecho
2033                 ;;
2034         "\$ans")
2035                 case "\$ans" in
2036                 \\&*)
2037                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2038                         shift
2039                         case "\$1" in
2040                         -d)
2041                                 fastread=yes
2042                                 echo "(OK, I'll run with -d after this question.)" >&4
2043                                 ;;
2044                         -*)
2045                                 echo "*** Sorry, \$1 not supported yet." >&4
2046                                 ;;
2047                         esac
2048                         $myecho
2049                         ans=!
2050                         ;;
2051                 esac;;
2052         *)
2053                 case "\$aok" in
2054                 y)
2055                         echo "*** Substitution done -- please confirm."
2056                         xxxm="\$ans"
2057                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2058                         xxxm="\$ans"
2059                         ans=!
2060                         ;;
2061                 *)
2062                         echo "*** Error -- try again."
2063                         ans=!
2064                         ;;
2065                 esac
2066                 $myecho
2067                 ;;
2068         esac
2069         case "\$ans\$xxxm\$nostick" in
2070         '')
2071                 ans=!
2072                 $myecho
2073                 ;;
2074         esac
2075 done
2076 case "\$ans" in
2077 '') ans="\$xxxm";;
2078 esac
2079 EOSC
2080
2081 : create .config dir to save info across Configure sessions
2082 test -d ../.config || mkdir ../.config
2083 cat >../.config/README <<EOF
2084 This directory created by Configure to save information that should
2085 persist across sessions for $package.
2086
2087 You may safely delete it if you wish.
2088 EOF
2089
2090 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2091 case "$usedevel" in
2092 $define|true|[yY]*) ;;
2093 *) case "$xversion" in
2094    *[13579])
2095         cat >&4 <<EOH
2096 *** WHOA THERE!!! ***
2097
2098     This is an UNSTABLE DEVELOPMENT release.
2099     The version of this $package distribution is $xversion, that is, odd,
2100     (as opposed to even) and that signifies a development release.
2101     If you want a maintenance release, you want an even-numbered version.
2102
2103     Do ***NOT*** install this into production use.
2104     Data corruption and crashes are possible.
2105
2106     It is most seriously suggested that you do not continue any further
2107     unless you want to help in developing and debugging Perl.
2108
2109     If you *still* want to build perl, you can answer 'y' now,
2110     or pass -Dusedevel to Configure.
2111
2112 EOH
2113         rp='Do you really want to continue?'
2114         dflt='n'
2115         . ./myread
2116         case "$ans" in
2117         [yY]) echo >&4 "Okay, continuing."
2118               usedevel="$define" ;;
2119         *) echo >&4 "Okay, bye."
2120            exit 1
2121            ;;
2122         esac
2123         ;;
2124     esac
2125     ;;
2126 esac
2127 case "$usedevel" in
2128 $define|true|[yY]*)
2129         case "$versiononly" in
2130         '') versiononly="$define" ;;
2131         esac
2132         case "$installusrbinperl" in
2133         '') installusrbinperl="$undef" ;;
2134         esac
2135         ;;
2136 esac
2137
2138 : general instructions
2139 needman=true
2140 firsttime=true
2141 user=`(logname) 2>/dev/null`
2142 case "$user" in
2143 '') user=`whoami 2>&1`;;
2144 esac
2145 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2146         firsttime=false
2147         echo " "
2148         rp='Would you like to see the instructions?'
2149         dflt=n
2150         . ./myread
2151         case "$ans" in
2152         [yY]*) ;;
2153         *) needman=false;;
2154         esac
2155 fi
2156 if $needman; then
2157         cat <<EOH
2158
2159 This installation shell script will examine your system and ask you questions
2160 to determine how the perl5 package should be installed. If you get
2161 stuck on a question, you may use a ! shell escape to start a subshell or
2162 execute a command.  Many of the questions will have default answers in square
2163 brackets; typing carriage return will give you the default.
2164
2165 On some of the questions which ask for file or directory names you are allowed
2166 to use the ~name construct to specify the login directory belonging to "name",
2167 even if you don't have a shell which knows about that.  Questions where this is
2168 allowed will be marked "(~name ok)".
2169
2170 EOH
2171         rp=''
2172         dflt='Type carriage return to continue'
2173         . ./myread
2174         cat <<'EOH'
2175
2176 The prompter used in this script allows you to use shell variables and
2177 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2178 in the default answer, as if the default line was a set of arguments given to a
2179 script shell.  This means you may also use $* to repeat the whole default line,
2180 so you do not have to re-type everything to add something to the default.
2181
2182 Everytime there is a substitution, you will have to confirm.  If there is an
2183 error (e.g. an unmatched backtick), the default answer will remain unchanged
2184 and you will be prompted again.
2185
2186 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2187 the questions and use the computed defaults (or the previous answers if there
2188 was already a config.sh file). Type 'Configure -h' for a list of options.
2189 You may also start interactively and then answer '& -d' at any prompt to turn
2190 on the non-interactive behaviour for the remainder of the execution.
2191
2192 EOH
2193         . ./myread
2194         cat <<EOH
2195
2196 Much effort has been expended to ensure that this shell script will run on any
2197 Unix system.  If despite that it blows up on yours, your best bet is to edit
2198 Configure and run it again.  If you can't run Configure for some reason,
2199 you'll have to generate a config.sh file by hand.  Whatever problems you
2200 have, let me (perlbug@perl.org) know how I blew it.
2201
2202 This installation script affects things in two ways:
2203
2204 1) it may do direct variable substitutions on some of the files included
2205    in this kit.
2206 2) it builds a config.h file for inclusion in C programs.  You may edit
2207    any of these files as the need arises after running this script.
2208
2209 If you make a mistake on a question, there is no easy way to back up to it
2210 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2211 files.  Configure will offer to let you do this before it runs the SH files.
2212
2213 EOH
2214         dflt='Type carriage return to continue'
2215         . ./myread
2216         case "$firsttime" in
2217         true) echo $user >>../.config/instruct;;
2218         esac
2219 fi
2220
2221 : find out where common programs are
2222 echo " "
2223 echo "Locating common programs..." >&4
2224 cat <<EOSC >loc
2225 $startsh
2226 case \$# in
2227 0) exit 1;;
2228 esac
2229 thing=\$1
2230 shift
2231 dflt=\$1
2232 shift
2233 for dir in \$*; do
2234         case "\$thing" in
2235         .)
2236         if test -d \$dir/\$thing; then
2237                 echo \$dir
2238                 exit 0
2239         fi
2240         ;;
2241         *)
2242         for thisthing in \$dir/\$thing; do
2243                 : just loop through to pick last item
2244         done
2245         if test -f \$thisthing; then
2246                 echo \$thisthing
2247                 exit 0
2248         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2249                 echo \$thisthing
2250                 exit 0
2251         elif test -f \$dir/\$thing.exe; then
2252                 if test -n "$DJGPP"; then
2253                         echo \$dir/\$thing.exe
2254                 elif test "$eunicefix" != ":"; then
2255                         : on Eunice apparently
2256                         echo \$dir/\$thing
2257                         exit 0
2258                 fi
2259                 exit 0
2260         fi
2261         ;;
2262         esac
2263 done
2264 echo \$dflt
2265 exit 1
2266 EOSC
2267 chmod +x loc
2268 $eunicefix loc
2269 loclist="
2270 awk
2271 cat
2272 chmod
2273 comm
2274 cp
2275 echo
2276 expr
2277 grep
2278 ls
2279 mkdir
2280 rm
2281 sed
2282 sort
2283 touch
2284 tr
2285 uniq
2286 "
2287 trylist="
2288 Mcc
2289 ar
2290 bison
2291 byacc
2292 cpp
2293 csh
2294 date
2295 egrep
2296 gmake
2297 gzip
2298 less
2299 ln
2300 make
2301 more
2302 nm
2303 nroff
2304 pg
2305 test
2306 uname
2307 zip
2308 "
2309 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2310 pth="$pth /lib /usr/lib"
2311 for file in $loclist; do
2312         eval xxx=\$$file
2313         case "$xxx" in
2314         /*|?:[\\/]*)
2315                 if test -f "$xxx"; then
2316                         : ok
2317                 else
2318                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2319                         xxx=`./loc $file $file $pth`
2320                 fi
2321                 ;;
2322         '') xxx=`./loc $file $file $pth`;;
2323         *) xxx=`./loc $xxx $xxx $pth`;;
2324         esac
2325         eval $file=$xxx$_exe
2326         eval _$file=$xxx
2327         case "$xxx" in
2328         /*)
2329                 echo $file is in $xxx.
2330                 ;;
2331         ?:[\\/]*)
2332                 echo $file is in $xxx.
2333                 ;;
2334         *)
2335                 echo "I don't know where '$file' is, and my life depends on it." >&4
2336                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2337                 exit 1
2338                 ;;
2339         esac
2340 done
2341 echo " "
2342 echo "Don't worry if any of the following aren't found..."
2343 say=offhand
2344 for file in $trylist; do
2345         eval xxx=\$$file
2346         case "$xxx" in
2347         /*|?:[\\/]*)
2348                 if test -f "$xxx"; then
2349                         : ok
2350                 else
2351                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2352                         xxx=`./loc $file $file $pth`
2353                 fi
2354                 ;;
2355         '') xxx=`./loc $file $file $pth`;;
2356         *) xxx=`./loc $xxx $xxx $pth`;;
2357         esac
2358         eval $file=$xxx$_exe
2359         eval _$file=$xxx
2360         case "$xxx" in
2361         /*)
2362                 echo $file is in $xxx.
2363                 ;;
2364         ?:[\\/]*)
2365                 echo $file is in $xxx.
2366                 ;;
2367         *)
2368                 echo "I don't see $file out there, $say."
2369                 say=either
2370                 ;;
2371         esac
2372 done
2373 case "$egrep" in
2374 egrep)
2375         echo "Substituting grep for egrep."
2376         egrep=$grep
2377         _egrep=$grep
2378         ;;
2379 esac
2380 case "$ln" in
2381 ln)
2382         echo "Substituting cp for ln."
2383         ln=$cp
2384         _ln=$cp
2385         ;;
2386 esac
2387 case "$make" in
2388 make)   
2389         case "$gmake" in
2390         gmake)
2391         echo "I can't find make or gmake, and my life depends on it." >&4
2392         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2393         exit 1
2394         ;;
2395         esac
2396         ;;
2397 esac    
2398 case "$gmake" in
2399 gmake)  ;;
2400 *)      # We can't have osname yet.
2401         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2402                 # Assume that gmake, if found, is definitely GNU make
2403                 # and prefer it over the system make.
2404                 echo "Substituting gmake for make."
2405                 make=$gmake
2406                 _make=$gmake
2407         fi
2408         ;;
2409 esac
2410 case "$test" in
2411 test)
2412         echo "Hopefully test is built into your sh."
2413         ;;
2414 *)
2415         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2416                 echo "Using the test built into your sh."
2417                 test=test
2418                 _test=test
2419         fi
2420         ;;
2421 esac
2422 case "$echo" in
2423 echo)
2424         echo "Hopefully echo is built into your sh."
2425         ;;
2426 '') ;;
2427 *)
2428         echo " "
2429 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2430         $echo $n "hi there$c" >foo1
2431         echo $n "hi there$c" >foo2
2432         if cmp foo1 foo2 >/dev/null 2>&1; then
2433                 echo "They are compatible.  In fact, they may be identical."
2434         else
2435                 case "$n" in
2436                 '-n') n='' c='\c';;
2437                 *) n='-n' c='';;
2438                 esac
2439                 cat <<FOO
2440 They are not compatible!  You are probably running ksh on a non-USG system.
2441 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2442 have echo built in and we may have to run some Bourne shell scripts.  That
2443 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2444
2445 FOO
2446                 $echo $n "The star should be here-->$c"
2447                 $echo "*"
2448         fi
2449         $rm -f foo1 foo2
2450         ;;
2451 esac
2452
2453 cat <<EOS >trygcc
2454 $startsh
2455 EOS
2456 cat <<'EOSC' >>trygcc
2457 case "$cc" in
2458 '') ;;
2459 *)  $rm -f try try.*
2460     $cat >try.c <<EOM
2461 int main(int argc, char *argv[]) {
2462   return 0;
2463 }
2464 EOM
2465     if $cc -o try $ccflags $ldflags try.c; then
2466        :
2467     else
2468         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2469         despair=yes
2470         trygcc=yes
2471         case "$cc" in
2472         *gcc*) trygcc=no ;;
2473         esac
2474         case "`$cc -v -c try.c 2>&1`" in
2475         *gcc*) trygcc=no ;;
2476         esac
2477         if $test X"$trygcc" = Xyes; then
2478             if gcc -o try -c try.c; then
2479                 echo " "
2480                 echo "You seem to have a working gcc, though." >&4
2481                 rp="Would you like to use it?"
2482                 dflt=y
2483                 if $test -f myread; then
2484                     . ./myread
2485                 else
2486                     if $test -f UU/myread; then
2487                         . ./UU/myread
2488                     else
2489                         echo "Cannot find myread, sorry.  Aborting." >&2
2490                         exit 1
2491                     fi
2492                 fi  
2493                 case "$ans" in
2494                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2495                        if $test -f usethreads.cbu; then
2496                            $cat >&4 <<EOM 
2497
2498 *** However, any setting of the C compiler flags (e.g. for thread support)
2499 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2500 *** (together with e.g. -Dusethreads).
2501
2502 EOM
2503                        fi;;
2504                 esac
2505             fi
2506         fi
2507     fi
2508     $rm -f try try.*
2509     ;;
2510 esac
2511 EOSC
2512
2513 cat <<EOS >checkcc
2514 $startsh
2515 EOS
2516 cat <<'EOSC' >>checkcc
2517 case "$cc" in        
2518 '') ;;
2519 *)  $rm -f try try.*              
2520     $cat >try.c <<EOM
2521 int main(int argc, char *argv[]) {
2522   return 0;
2523 }
2524 EOM
2525     if $cc -o try $ccflags $ldflags try.c; then
2526        :
2527     else
2528         if $test X"$despair" = Xyes; then
2529            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2530         fi
2531         $cat >&4 <<EOM         
2532 You need to find a working C compiler.
2533 Either (purchase and) install the C compiler supplied by your OS vendor,
2534 or for a free C compiler try http://gcc.gnu.org/
2535 I cannot continue any further, aborting.
2536 EOM
2537         exit 1
2538     fi
2539     $rm -f try try.*
2540     ;;
2541 esac
2542 EOSC
2543
2544 : determine whether symbolic links are supported
2545 echo " "
2546 $touch blurfl
2547 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2548         echo "Symbolic links are supported." >&4
2549         lns="$ln -s"
2550 else
2551         echo "Symbolic links are NOT supported." >&4
2552         lns="$ln"
2553 fi
2554 $rm -f blurfl sym
2555
2556 : determine whether symbolic links are supported
2557 echo " "
2558 case "$lns" in
2559 *"ln"*" -s")
2560         echo "Checking how to test for symbolic links..." >&4
2561         $lns blurfl sym
2562         if $test "X$issymlink" = X; then
2563                 case "$newsh" in
2564                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2565                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2566                 esac
2567                 if test $? = 0; then
2568                         issymlink="test -h"
2569                 else
2570                         echo "Your builtin 'test -h' may be broken." >&4
2571                         case "$test" in
2572                         /*)     ;;
2573                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2574                                 for p in $pth
2575                                 do
2576                                         if test -f "$p/$test"; then
2577                                                 test="$p/$test"
2578                                                 break
2579                                         fi
2580                                 done
2581                                 ;;
2582                         esac
2583                         case "$test" in
2584                         /*)
2585                                 echo "Trying external '$test -h'." >&4
2586                                 issymlink="$test -h"
2587                                 if $test ! -h sym >/dev/null 2>&1; then
2588                                         echo "External '$test -h' is broken, too." >&4
2589                                         issymlink=''
2590                                 fi
2591                                 ;;
2592                         *)      issymlink='' ;;
2593                         esac
2594                 fi              
2595         fi
2596         if $test "X$issymlink" = X; then
2597                 if $test -L sym 2>/dev/null; then
2598                         issymlink="$test -L"
2599                         echo "The builtin '$test -L' worked." >&4
2600                 fi
2601         fi
2602         if $test "X$issymlink" != X; then
2603                 echo "You can test for symbolic links with '$issymlink'." >&4
2604         else
2605                 echo "I do not know how you can test for symbolic links." >&4
2606         fi
2607         $rm -f blurfl sym
2608         ;;
2609 *)      echo "No symbolic links, so not testing for their testing..." >&4
2610         ;;
2611 esac
2612 echo " "
2613
2614
2615 case "$mksymlinks" in
2616 $define|true|[yY]*)
2617         case "$src" in
2618         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2619                 exit 1
2620                 ;;
2621         *)      case "$lns:$issymlink" in
2622                 *"ln"*" -s:"*"test -"?)
2623                         echo "Creating the symbolic links..." >&4
2624                         echo "(First creating the subdirectories...)" >&4
2625                         cd ..
2626                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2627                                 read directory
2628                                 test -z "$directory" && break
2629                                 mkdir -p $directory
2630                         done
2631                         # Sanity check 1.
2632                         if test ! -d t/base; then
2633                                 echo "Failed to create the subdirectories.  Aborting." >&4
2634                                 exit 1
2635                         fi
2636                         echo "(Then creating the symlinks...)" >&4
2637                         awk '{print $1}' $src/MANIFEST | while true; do
2638                                 read filename
2639                                 test -z "$filename" && break
2640                                 if test -f $filename; then
2641                                         if $issymlink $filename; then
2642                                                 rm -f $filename
2643                                         fi
2644                                 fi
2645                                 if test -f $filename; then
2646                                         echo "$filename already exists, not symlinking."
2647                                 else
2648                                         ln -s $src/$filename $filename
2649                                 fi
2650                         done
2651                         # Sanity check 2.
2652                         if test ! -f t/base/lex.t; then
2653                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2654                                 exit 1
2655                         fi
2656                         cd UU
2657                         ;;
2658                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2659                         ;;
2660                 esac
2661                 ;;
2662         esac
2663         ;;
2664 esac
2665
2666
2667 case "$usecrosscompile" in
2668 $define|true|[yY]*)
2669         $echo "Cross-compiling..."
2670         croak=''
2671         case "$cc" in
2672         *-*-gcc) # A cross-compiling gcc, probably.
2673             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2674             ar=$targetarch-ar
2675             # leave out ld, choosing it is more complex
2676             nm=$targetarch-nm
2677             ranlib=$targetarch-ranlib
2678             $echo 'extern int foo;' > try.c
2679             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2680             shift
2681             if $test $# -gt 0; then
2682                 incpth="$incpth $*"
2683                 incpth="`$echo $incpth|$sed 's/^ //'`"
2684                 echo "Guessing incpth '$incpth'." >&4
2685                 for i in $*; do
2686                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2687                     if $test -d $j; then
2688                         libpth="$libpth $j"
2689                     fi
2690                 done   
2691                 libpth="`$echo $libpth|$sed 's/^ //'`"
2692                 echo "Guessing libpth '$libpth'." >&4
2693             fi
2694             $rm -f try.c
2695             ;;
2696         esac
2697         case "$targetarch" in
2698         '') echo "Targetarch not defined." >&4; croak=y ;;
2699         *)  echo "Using targetarch $targetarch." >&4 ;;
2700         esac
2701         case "$incpth" in
2702         '') echo "Incpth not defined." >&4; croak=y ;;
2703         *)  echo "Using incpth '$incpth'." >&4 ;;
2704         esac
2705         case "$libpth" in
2706         '') echo "Libpth not defined." >&4; croak=y ;;
2707         *)  echo "Using libpth '$libpth'." >&4 ;;
2708         esac
2709         case "$usrinc" in
2710         '') for i in $incpth; do
2711                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2712                     usrinc=$i
2713                     echo "Guessing usrinc $usrinc." >&4
2714                     break
2715                 fi
2716             done
2717             case "$usrinc" in
2718             '') echo "Usrinc not defined." >&4; croak=y ;;
2719             esac
2720             ;;
2721         *)  echo "Using usrinc $usrinc." >&4 ;;
2722         esac
2723         case "$targethost" in
2724         '') echo "Targethost not defined." >&4; croak=y ;;
2725         *)  echo "Using targethost $targethost." >&4
2726         esac
2727         locincpth=' '
2728         loclibpth=' '
2729         case "$croak" in
2730         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2731         esac
2732         case "$src" in
2733         /*) run=$src/Cross/run
2734             targetmkdir=$src/Cross/mkdir
2735             to=$src/Cross/to
2736             from=$src/Cross/from
2737             ;;
2738         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2739             run=$pwd/Cross/run
2740             targetmkdir=$pwd/Cross/mkdir
2741             to=$pwd/Cross/to
2742             from=$pwd/Cross/from
2743             ;;
2744         esac
2745         case "$targetrun" in
2746         '') targetrun=ssh ;;
2747         esac
2748         case "$targetto" in
2749         '') targetto=scp ;;
2750         esac
2751         case "$targetfrom" in
2752         '') targetfrom=scp ;;
2753         esac
2754         run=$run-$targetrun
2755         to=$to-$targetto
2756         from=$from-$targetfrom
2757         case "$targetdir" in
2758         '')  targetdir=/tmp
2759              echo "Guessing targetdir $targetdir." >&4
2760              ;;
2761         esac
2762         case "$targetuser" in
2763         '')  targetuser=root
2764              echo "Guessing targetuser $targetuser." >&4
2765              ;;
2766         esac
2767         case "$targetfrom" in
2768         scp)    q=-q ;;
2769         *)      q='' ;;
2770         esac
2771         case "$targetrun" in
2772         ssh|rsh)
2773             cat >$run <<EOF
2774 #!/bin/sh
2775 case "\$1" in
2776 -cwd)
2777   shift
2778   cwd=\$1
2779   shift
2780   ;;
2781 esac
2782 case "\$cwd" in
2783 '') cwd=$targetdir ;;
2784 esac
2785 exe=\$1
2786 shift
2787 if $test ! -f \$exe.xok; then
2788   $to \$exe
2789   $touch \$exe.xok
2790 fi
2791 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2792 EOF
2793             ;;
2794         *)  echo "Unknown targetrun '$targetrun'" >&4
2795             exit 1
2796             ;;
2797         esac
2798         case "$targetmkdir" in
2799         */Cross/mkdir)
2800             cat >$targetmkdir <<EOF
2801 #!/bin/sh
2802 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2803 EOF
2804             $chmod a+rx $targetmkdir
2805             ;;
2806         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2807             exit 1
2808             ;;
2809         esac
2810         case "$targetto" in
2811         scp|rcp)
2812             cat >$to <<EOF
2813 #!/bin/sh
2814 for f in \$@
2815 do
2816   case "\$f" in
2817   /*)
2818     $targetmkdir \`dirname \$f\`
2819     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2820     ;;
2821   *)
2822     $targetmkdir $targetdir/\`dirname \$f\`
2823     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2824     ;;
2825   esac
2826 done
2827 exit 0
2828 EOF
2829             ;;
2830         cp) cat >$to <<EOF
2831 #!/bin/sh
2832 for f in \$@
2833 do
2834   case "\$f" in
2835   /*)
2836     $mkdir -p $targetdir/\`dirname \$f\`
2837     $cp \$f $targetdir/\$f || exit 1
2838     ;;
2839   *)
2840     $targetmkdir $targetdir/\`dirname \$f\`
2841     $cp \$f $targetdir/\$f || exit 1
2842     ;;
2843   esac
2844 done
2845 exit 0
2846 EOF
2847             ;;
2848         *)  echo "Unknown targetto '$targetto'" >&4
2849             exit 1
2850             ;;
2851         esac
2852         case "$targetfrom" in
2853         scp|rcp)
2854           cat >$from <<EOF
2855 #!/bin/sh
2856 for f in \$@
2857 do
2858   $rm -f \$f
2859   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2860 done
2861 exit 0
2862 EOF
2863             ;;
2864         cp) cat >$from <<EOF
2865 #!/bin/sh
2866 for f in \$@
2867 do
2868   $rm -f \$f
2869   cp $targetdir/\$f . || exit 1
2870 done
2871 exit 0
2872 EOF
2873             ;;
2874         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2875             exit 1
2876             ;;
2877         esac
2878         if $test ! -f $run; then
2879             echo "Target 'run' script '$run' not found." >&4
2880         else
2881             $chmod a+rx $run
2882         fi
2883         if $test ! -f $to; then
2884             echo "Target 'to' script '$to' not found." >&4
2885         else
2886             $chmod a+rx $to
2887         fi
2888         if $test ! -f $from; then
2889             echo "Target 'from' script '$from' not found." >&4
2890         else
2891             $chmod a+rx $from
2892         fi
2893         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2894             exit 1
2895         fi
2896         cat >&4 <<EOF
2897 Using '$run' for remote execution,
2898 and '$from' and '$to'
2899 for remote file transfer.
2900 EOF
2901         ;;
2902 *)      run=''
2903         to=:
2904         from=:
2905         usecrosscompile='undef'
2906         targetarch=''
2907         ;;
2908 esac
2909
2910 : see whether [:lower:] and [:upper:] are supported character classes
2911 echo " "
2912 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2913 ABYZ)
2914         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2915         up='[:upper:]'
2916         low='[:lower:]'
2917         ;;
2918 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2919         # (0xd9 and 0xe2), therefore that is a nice testing point.
2920         if test "X$up" = X -o "X$low" = X; then
2921             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2922             rs) up='[A-Z]'
2923                 low='[a-z]'
2924                 ;;
2925             esac
2926         fi
2927         if test "X$up" = X -o "X$low" = X; then
2928             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2929             rs) up='A-Z'
2930                 low='a-z'
2931                 ;;
2932             esac
2933         fi
2934         if test "X$up" = X -o "X$low" = X; then
2935             case "`echo RS | od -x 2>/dev/null`" in
2936             *D9E2*|*d9e2*)
2937                 echo "Hey, this might be EBCDIC." >&4
2938                 if test "X$up" = X -o "X$low" = X; then
2939                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2940                     rs) up='[A-IJ-RS-Z]'
2941                         low='[a-ij-rs-z]'
2942                         ;;
2943                     esac
2944                 fi
2945                 if test "X$up" = X -o "X$low" = X; then
2946                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2947                     rs) up='A-IJ-RS-Z'
2948                         low='a-ij-rs-z'
2949                         ;;
2950                     esac
2951                 fi
2952                 ;;
2953             esac
2954         fi
2955 esac
2956 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2957 rs)
2958     echo "Using $up and $low to convert case." >&4
2959     ;;
2960 *)
2961     echo "I don't know how to translate letters from upper to lower case." >&4
2962     echo "Your tr is not acting any way I know of." >&4
2963     exit 1
2964     ;;
2965 esac
2966 : set up the translation script tr, must be called with ./tr of course
2967 cat >tr <<EOSC
2968 $startsh
2969 case "\$1\$2" in
2970 '[A-Z][a-z]') exec $tr '$up' '$low';;
2971 '[a-z][A-Z]') exec $tr '$low' '$up';;
2972 esac
2973 exec $tr "\$@"
2974 EOSC
2975 chmod +x tr
2976 $eunicefix tr
2977
2978 : Try to determine whether config.sh was made on this system
2979 case "$config_sh" in
2980 '')
2981 myuname=`$uname -a 2>/dev/null`
2982 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2983 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2984 # because the A-Z/a-z are not consecutive.
2985 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2986         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2987 newmyuname="$myuname"
2988 dflt=n
2989 case "$knowitall" in
2990 '')
2991         if test -f ../config.sh; then
2992                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2993                         eval "`grep myuname= ../config.sh`"
2994                 fi
2995                 if test "X$myuname" = "X$newmyuname"; then
2996                         dflt=y
2997                 fi
2998         fi
2999         ;;
3000 *) dflt=y;;
3001 esac
3002
3003 : Get old answers from old config file if Configure was run on the
3004 : same system, otherwise use the hints.
3005 hint=default
3006 cd ..
3007 if test -f config.sh; then
3008         echo " "
3009         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3010         . UU/myread
3011         case "$ans" in
3012         n*|N*) echo "OK, I'll ignore it."
3013                 mv config.sh config.sh.old
3014                 myuname="$newmyuname"
3015                 ;;
3016         *)  echo "Fetching default answers from your old config.sh file..." >&4
3017                 tmp_n="$n"
3018                 tmp_c="$c"
3019                 tmp_sh="$sh"
3020                 . ./config.sh
3021                 cp config.sh UU
3022                 n="$tmp_n"
3023                 c="$tmp_c"
3024                 : Older versions did not always set $sh.  Catch re-use of such
3025                 : an old config.sh.
3026                 case "$sh" in
3027                 '') sh="$tmp_sh" ;;
3028                 esac
3029                 hint=previous
3030                 ;;
3031         esac
3032 fi
3033 . ./UU/checkcc
3034 if test ! -f config.sh; then
3035         $cat <<EOM
3036
3037 First time through, eh?  I have some defaults handy for some systems
3038 that need some extra help getting the Configure answers right:
3039
3040 EOM
3041         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3042         dflt=''
3043         : Half the following guesses are probably wrong... If you have better
3044         : tests or hints, please send them to perlbug@perl.org
3045         : The metaconfig authors would also appreciate a copy...
3046         $test -f /irix && osname=irix
3047         $test -f /xenix && osname=sco_xenix
3048         $test -f /dynix && osname=dynix
3049         $test -f /dnix && osname=dnix
3050         $test -f /lynx.os && osname=lynxos
3051         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3052         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3053         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3054         $test -f /bin/mips && /bin/mips && osname=mips
3055         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3056                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3057         $test -d /usr/apollo/bin && osname=apollo
3058         $test -f /etc/saf/_sactab && osname=svr4
3059         $test -d /usr/include/minix && osname=minix
3060         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3061         if $test -d /MachTen -o -d /MachTen_Folder; then
3062                 osname=machten
3063                 if $test -x /sbin/version; then
3064                         osvers=`/sbin/version | $awk '{print $2}' |
3065                         $sed -e 's/[A-Za-z]$//'`
3066                 elif $test -x /usr/etc/version; then
3067                         osvers=`/usr/etc/version | $awk '{print $2}' |
3068                         $sed -e 's/[A-Za-z]$//'`
3069                 else
3070                         osvers="$2.$3"
3071                 fi
3072         fi
3073
3074         $test -f /sys/posix.dll &&
3075                 $test -f /usr/bin/what &&
3076                 set X `/usr/bin/what /sys/posix.dll` &&
3077                 $test "$3" = UWIN &&
3078                 osname=uwin &&
3079                 osvers="$5"
3080
3081         if $test -f $uname; then
3082                 set X $myuname
3083                 shift
3084
3085                 case "$5" in
3086                 fps*) osname=fps ;;
3087                 mips*)
3088                         case "$4" in
3089                         umips) osname=umips ;;
3090                         *) osname=mips ;;
3091                         esac;;
3092                 [23]100) osname=mips ;;
3093                 next*) osname=next ;;
3094                 i386*)
3095                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3096                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3097                                 osname='sco'
3098                                 osvers=$tmp
3099                         elif $test -f /etc/kconfig; then
3100                                 osname=isc
3101                                 if test "$lns" = "$ln -s"; then
3102                                         osvers=4
3103                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3104                                         osvers=3
3105                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3106                                         osvers=2
3107                                 fi
3108                         fi
3109                         tmp=''
3110                         ;;
3111                 pc*)
3112                         if test -n "$DJGPP"; then
3113                                 osname=dos
3114                                 osvers=djgpp
3115                         fi
3116                         ;;
3117                 esac
3118
3119                 case "$1" in
3120                 aix) osname=aix
3121                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3122                         case "$tmp" in
3123                         # oslevel can fail with:
3124                         # oslevel: Unable to acquire lock.
3125                         *not\ found) osvers="$4"."$3" ;;
3126                         '<3240'|'<>3240') osvers=3.2.0 ;;
3127                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3128                         '=3250'|'>3250') osvers=3.2.5 ;;
3129                         *) osvers=$tmp;;
3130                         esac
3131                         ;;
3132                 bsd386) osname=bsd386
3133                         osvers=`$uname -r`
3134                         ;;
3135                 cygwin*) osname=cygwin
3136                         osvers="$3"
3137                         ;;
3138                 *dc.osx) osname=dcosx
3139                         osvers="$3"
3140                         ;;
3141                 dnix) osname=dnix
3142                         osvers="$3"
3143                         ;;
3144                 domainos) osname=apollo
3145                         osvers="$3"
3146                         ;;
3147                 dgux)   osname=dgux
3148                         osvers="$3"
3149                         ;;
3150                 dragonfly) osname=dragonfly
3151                         osvers="$3"
3152                         ;;
3153                 dynixptx*) osname=dynixptx
3154                         osvers=`echo "$4"|sed 's/^v//'`
3155                         ;;
3156                 freebsd) osname=freebsd
3157                         osvers="$3" ;;
3158                 genix)  osname=genix ;;
3159                 gnu)    osname=gnu
3160                         osvers="$3" ;;
3161                 hp*)    osname=hpux
3162                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3163                         ;;
3164                 irix*)  osname=irix
3165                         case "$3" in
3166                         4*) osvers=4 ;;
3167                         5*) osvers=5 ;;
3168                         *)      osvers="$3" ;;
3169                         esac
3170                         ;;
3171                 linux)  osname=linux
3172                         case "$3" in
3173                         *)      osvers="$3" ;;
3174                         esac
3175                         ;;
3176                 MiNT)   osname=mint
3177                         ;;
3178                 netbsd*) osname=netbsd
3179                         osvers="$3"
3180                         ;;
3181                 news-os) osvers="$3"
3182                         case "$3" in
3183                         4*) osname=newsos4 ;;
3184                         *) osname=newsos ;;
3185                         esac
3186                         ;;
3187                 next*) osname=next ;;
3188                 nonstop-ux) osname=nonstopux ;;
3189                 openbsd) osname=openbsd
3190                         osvers="$3"
3191                         ;;
3192                 os2)    osname=os2
3193                         osvers="$4"
3194                         ;;
3195                 POSIX-BC | posix-bc ) osname=posix-bc
3196                         osvers="$3"
3197                         ;;
3198                 powerux | power_ux | powermax_os | powermaxos | \
3199                 powerunix | power_unix) osname=powerux
3200                         osvers="$3"
3201                         ;;
3202                 qnx) osname=qnx
3203                         osvers="$4"
3204                         ;;
3205                 solaris) osname=solaris
3206                         case "$3" in
3207                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3208                         *)      osvers="$3" ;;
3209                         esac
3210                         ;;
3211                 sunos) osname=sunos
3212                         case "$3" in
3213                         5*) osname=solaris
3214                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3215                         *)      osvers="$3" ;;
3216                         esac
3217                         ;;
3218                 titanos) osname=titanos
3219                         case "$3" in
3220                         1*) osvers=1 ;;
3221                         2*) osvers=2 ;;
3222                         3*) osvers=3 ;;
3223                         4*) osvers=4 ;;
3224                         *)      osvers="$3" ;;
3225                         esac
3226                         ;;
3227                 ultrix) osname=ultrix
3228                         osvers="$3"
3229                         ;;
3230                 osf1|mls+)      case "$5" in
3231                                 alpha)
3232                                         osname=dec_osf
3233                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3234                                         case "$osvers" in
3235                                         [1-9].[0-9]*) ;;
3236                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3237                                         esac
3238                                         ;;
3239                         hp*)    osname=hp_osf1  ;;
3240                         mips)   osname=mips_osf1 ;;
3241                         esac
3242                         ;;
3243                 # UnixWare 7.1.2 is known as Open UNIX 8
3244                 openunix|unixware) osname=svr5
3245                         osvers="$4"
3246                         ;;
3247                 uts)    osname=uts
3248                         osvers="$3"
3249                         ;;
3250                 vos) osvers="$3"
3251                         ;;
3252                 $2) case "$osname" in
3253                         *isc*) ;;
3254                         *freebsd*) ;;
3255                         svr*)
3256                                 : svr4.x or possibly later
3257                                 case "svr$3" in
3258                                 ${osname}*)
3259                                         osname=svr$3
3260                                         osvers=$4
3261                                         ;;
3262                                 esac
3263                                 case "$osname" in
3264                                 svr4.0)
3265                                         : Check for ESIX
3266                                         if test -f /stand/boot ; then
3267                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3268                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3269                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3270                                                         if test -n "$isesix"; then
3271                                                                 osname=esix4
3272                                                         fi
3273                                                 fi
3274                                         fi
3275                                         ;;
3276                                 esac
3277                                 ;;
3278                         *)      if test -f /etc/systemid; then
3279                                         osname=sco
3280                                         set `echo $3 | $sed 's/\./ /g'` $4
3281                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3282                                                 osvers=$1.$2.$3
3283                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3284                                                 osvers=$1.$2
3285                                         elif $test -f $src/hints/sco_$1.sh; then
3286                                                 osvers=$1
3287                                         fi
3288                                 else
3289                                         case "$osname" in
3290                                         '') : Still unknown.  Probably a generic Sys V.
3291                                                 osname="sysv"
3292                                                 osvers="$3"
3293                                                 ;;
3294                                         esac
3295                                 fi
3296                                 ;;
3297                         esac
3298                         ;;
3299                 *)      case "$osname" in
3300                         '') : Still unknown.  Probably a generic BSD.
3301                                 osname="$1"
3302                                 osvers="$3"
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307         else
3308                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3309                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3310                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3311                                 osname=news_os
3312                         fi
3313                         $rm -f UU/kernel.what
3314                 elif test -d c:/. -o -n "$is_os2" ; then
3315                         set X $myuname
3316                         osname=os2
3317                         osvers="$5"
3318                 fi
3319         fi
3320
3321         case "$targetarch" in
3322         '') ;;
3323         *)  hostarch=$osname
3324             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3325             osvers=''
3326             ;;
3327         esac
3328
3329         : Now look for a hint file osname_osvers, unless one has been
3330         : specified already.
3331         case "$hintfile" in
3332         ''|' ')
3333                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3334                 : Also try without trailing minor version numbers.
3335                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3336                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3337                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3338                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3339                 case "$file" in
3340                 '') dflt=none ;;
3341                 *)  case "$osvers" in
3342                         '') dflt=$file
3343                                 ;;
3344                         *)  if $test -f $src/hints/$file.sh ; then
3345                                         dflt=$file
3346                                 elif $test -f $src/hints/$xfile.sh ; then
3347                                         dflt=$xfile
3348                                 elif $test -f $src/hints/$xxfile.sh ; then
3349                                         dflt=$xxfile
3350                                 elif $test -f $src/hints/$xxxfile.sh ; then
3351                                         dflt=$xxxfile
3352                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3353                                         dflt=$xxxxfile
3354                                 elif $test -f "$src/hints/${osname}.sh" ; then
3355                                         dflt="${osname}"
3356                                 else
3357                                         dflt=none
3358                                 fi
3359                                 ;;
3360                         esac
3361                         ;;
3362                 esac
3363                 if $test -f Policy.sh ; then
3364                         case "$dflt" in
3365                         *Policy*) ;;
3366                         none) dflt="Policy" ;;
3367                         *) dflt="Policy $dflt" ;;
3368                         esac
3369                 fi
3370                 ;;
3371         *)
3372                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3373                 ;;
3374         esac
3375
3376         if $test -f Policy.sh ; then
3377                 $cat <<EOM
3378
3379 There's also a Policy hint file available, which should make the
3380 site-specific (policy) questions easier to answer.
3381 EOM
3382
3383         fi
3384
3385         $cat <<EOM
3386
3387 You may give one or more space-separated answers, or "none" if appropriate.
3388 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3389 is a good thing.  DO NOT give a wrong version or a wrong OS.
3390
3391 EOM
3392
3393         rp="Which of these apply, if any?"
3394         . UU/myread
3395         tans=$ans
3396         for file in $tans; do
3397                 if $test X$file = XPolicy -a -f Policy.sh; then
3398                         . Policy.sh
3399                         $cat Policy.sh >> UU/config.sh
3400                 elif $test -f $src/hints/$file.sh; then
3401                         . $src/hints/$file.sh
3402                         $cat $src/hints/$file.sh >> UU/config.sh
3403                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3404                         : nothing
3405                 else
3406                         : Give one chance to correct a possible typo.
3407                         echo "$file.sh does not exist"
3408                         dflt=$file
3409                         rp="hint to use instead?"
3410                         . UU/myread
3411                         for file in $ans; do
3412                                 if $test -f "$src/hints/$file.sh"; then
3413                                         . $src/hints/$file.sh
3414                                         $cat $src/hints/$file.sh >> UU/config.sh
3415                                 elif $test X$ans = X -o X$ans = Xnone ; then
3416                                         : nothing
3417                                 else
3418                                         echo "$file.sh does not exist -- ignored."
3419                                 fi
3420                         done
3421                 fi
3422         done
3423
3424         hint=recommended
3425         : Remember our hint file for later.
3426         if $test -f "$src/hints/$file.sh" ; then
3427                 hintfile="$file"
3428         else
3429                 hintfile=''
3430         fi
3431 fi
3432 cd UU
3433 ;;
3434 *)
3435         echo " "
3436         echo "Fetching default answers from $config_sh..." >&4
3437         tmp_n="$n"
3438         tmp_c="$c"
3439         cd ..
3440         cp $config_sh config.sh 2>/dev/null
3441         chmod +w config.sh
3442         . ./config.sh
3443         cd UU
3444         cp ../config.sh .
3445         n="$tmp_n"
3446         c="$tmp_c"
3447         hint=previous
3448         ;;
3449 esac
3450 test "$override" && . ./optdef.sh
3451
3452 : Restore computed paths
3453 for file in $loclist $trylist; do
3454         eval $file="\$_$file"
3455 done
3456
3457 cat << EOM
3458
3459 Configure uses the operating system name and version to set some defaults.
3460 The default value is probably right if the name rings a bell. Otherwise,
3461 since spelling matters for me, either accept the default or answer "none"
3462 to leave it blank.
3463
3464 EOM
3465 case "$osname" in
3466         ''|' ')
3467                 case "$hintfile" in
3468                 ''|' '|none) dflt=none ;;
3469                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3470                 esac
3471                 ;;
3472         *) dflt="$osname" ;;
3473 esac
3474 rp="Operating system name?"
3475 . ./myread
3476 case "$ans" in
3477 none)  osname='' ;;
3478 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3479 esac
3480 echo " "
3481 case "$osvers" in
3482         ''|' ')
3483                 case "$hintfile" in
3484                 ''|' '|none) dflt=none ;;
3485                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3486                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3487                         case "$dflt" in
3488                         ''|' ') dflt=none ;;
3489                         esac
3490                         ;;
3491                 esac
3492                 ;;
3493         *) dflt="$osvers" ;;
3494 esac
3495 rp="Operating system version?"
3496 . ./myread
3497 case "$ans" in
3498 none)  osvers='' ;;
3499 *) osvers="$ans" ;;
3500 esac
3501
3502
3503 . ./posthint.sh
3504
3505 : who configured the system
3506 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3507 case "$cf_by" in
3508 "")
3509         cf_by=`(logname) 2>/dev/null`
3510         case "$cf_by" in
3511         "")
3512                 cf_by=`(whoami) 2>/dev/null`
3513                 case "$cf_by" in
3514                 "") cf_by=unknown ;;
3515                 esac ;;
3516         esac ;;
3517 esac
3518
3519 : decide how portable to be.  Allow command line overrides.
3520 case "$d_portable" in
3521 "$undef") ;;
3522 *)      d_portable="$define" ;;
3523 esac
3524
3525 : set up shell script to do ~ expansion
3526 cat >filexp <<EOSS
3527 $startsh
3528 : expand filename
3529 case "\$1" in
3530  ~/*|~)
3531         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3532         ;;
3533  ~*)
3534         if $test -f /bin/csh; then
3535                 /bin/csh -f -c "glob \$1"
3536                 failed=\$?
3537                 echo ""
3538                 exit \$failed
3539         else
3540                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3541                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3542                 if $test ! -d "\$dir"; then
3543                         me=\`basename \$0\`
3544                         echo "\$me: can't locate home directory for: \$name" >&2
3545                         exit 1
3546                 fi
3547                 case "\$1" in
3548                 */*)
3549                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3550                         ;;
3551                 *)
3552                         echo \$dir
3553                         ;;
3554                 esac
3555         fi
3556         ;;
3557 *)
3558         echo \$1
3559         ;;
3560 esac
3561 EOSS
3562 chmod +x filexp
3563 $eunicefix filexp
3564
3565 : now set up to get a file name
3566 cat <<EOS >getfile
3567 $startsh
3568 EOS
3569 cat <<'EOSC' >>getfile
3570 tilde=''
3571 fullpath=''
3572 already=''
3573 skip=''
3574 none_ok=''
3575 exp_file=''
3576 nopath_ok=''
3577 orig_rp="$rp"
3578 orig_dflt="$dflt"
3579 case "$gfpth" in
3580 '') gfpth='.' ;;
3581 esac
3582
3583 case "$fn" in
3584 *\(*)
3585         : getfile will accept an answer from the comma-separated list
3586         : enclosed in parentheses even if it does not meet other criteria.
3587         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3588         fn=`echo $fn | sed 's/(.*)//'`
3589         ;;
3590 esac
3591
3592 case "$fn" in
3593 *:*)
3594         loc_file=`expr $fn : '.*:\(.*\)'`
3595         fn=`expr $fn : '\(.*\):.*'`
3596         ;;
3597 esac
3598
3599 case "$fn" in
3600 *~*) tilde=true;;
3601 esac
3602 case "$fn" in
3603 */*) fullpath=true;;
3604 esac
3605 case "$fn" in
3606 *+*) skip=true;;
3607 esac
3608 case "$fn" in
3609 *n*) none_ok=true;;
3610 esac
3611 case "$fn" in
3612 *e*) exp_file=true;;
3613 esac
3614 case "$fn" in
3615 *p*) nopath_ok=true;;
3616 esac
3617
3618 case "$fn" in
3619 *f*) type='File';;
3620 *d*) type='Directory';;
3621 *l*) type='Locate';;
3622 esac
3623
3624 what="$type"
3625 case "$what" in
3626 Locate) what='File';;
3627 esac
3628
3629 case "$exp_file" in
3630 '')
3631         case "$d_portable" in
3632         "$define") ;;
3633         *) exp_file=true;;
3634         esac
3635         ;;
3636 esac
3637
3638 cd ..
3639 while test "$type"; do
3640         redo=''
3641         rp="$orig_rp"
3642         dflt="$orig_dflt"
3643         case "$tilde" in
3644         true) rp="$rp (~name ok)";;
3645         esac
3646         . UU/myread
3647         if test -f UU/getfile.ok && \
3648                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3649         then
3650                 value="$ans"
3651                 ansexp="$ans"
3652                 break
3653         fi
3654         case "$ans" in
3655         none)
3656                 value=''
3657                 ansexp=''
3658                 case "$none_ok" in
3659                 true) type='';;
3660                 esac
3661                 ;;
3662         *)
3663                 case "$tilde" in
3664                 '') value="$ans"
3665                         ansexp="$ans";;
3666                 *)
3667                         value=`UU/filexp $ans`
3668                         case $? in
3669                         0)
3670                                 if test "$ans" != "$value"; then
3671                                         echo "(That expands to $value on this system.)"
3672                                 fi
3673                                 ;;
3674                         *) value="$ans";;
3675                         esac
3676                         ansexp="$value"
3677                         case "$exp_file" in
3678                         '') value="$ans";;
3679                         esac
3680                         ;;
3681                 esac
3682                 case "$fullpath" in
3683                 true)
3684                         case "$ansexp" in
3685                         /*) value="$ansexp" ;;
3686                         [a-zA-Z]:/*) value="$ansexp" ;;
3687                         *)
3688                                 redo=true
3689                                 case "$already" in
3690                                 true)
3691                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3692                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3693                                         ;;
3694                                 *)
3695                                 echo "Please give a full path name, starting with slash." >&4
3696                                         case "$tilde" in
3697                                         true)
3698                                 echo "Note that using ~name is ok provided it expands well." >&4
3699                                                 already=true
3700                                                 ;;
3701                                         esac
3702                                 esac
3703                                 ;;
3704                         esac
3705                         ;;
3706                 esac
3707                 case "$redo" in
3708                 '')
3709                         case "$type" in
3710                         File)
3711                                 for fp in $gfpth; do
3712                                         if test "X$fp" = X.; then
3713                                             pf="$ansexp"
3714                                         else    
3715                                             pf="$fp/$ansexp"
3716                                         fi
3717                                         if test -f "$pf"; then
3718                                                 type=''
3719                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3720                                         then
3721                                                 echo "($value is not a plain file, but that's ok.)"
3722                                                 type=''
3723                                         fi
3724                                         if test X"$type" = X; then
3725                                             value="$pf"
3726                                             break
3727                                         fi
3728                                 done
3729                                 ;;
3730                         Directory)
3731                                 for fp in $gfpth; do
3732                                         if test "X$fp" = X.; then
3733                                             dir="$ans"
3734                                             direxp="$ansexp"
3735                                         else    
3736                                             dir="$fp/$ansexp"
3737                                             direxp="$fp/$ansexp"
3738                                         fi
3739                                         if test -d "$direxp"; then
3740                                                 type=''
3741                                                 value="$dir"
3742                                                 break
3743                                         fi
3744                                 done
3745                                 ;;
3746                         Locate)
3747                                 if test -d "$ansexp"; then
3748                                         echo "(Looking for $loc_file in directory $value.)"
3749                                         value="$value/$loc_file"
3750                                         ansexp="$ansexp/$loc_file"
3751                                 fi
3752                                 if test -f "$ansexp"; then
3753                                         type=''
3754                                 fi
3755                                 case "$nopath_ok" in
3756                                 true)   case "$value" in
3757                                         */*) ;;
3758                                         *)      echo "Assuming $value will be in people's path."
3759                                                 type=''
3760                                                 ;;
3761                                         esac
3762                                         ;;
3763                                 esac
3764                                 ;;
3765                         esac
3766
3767                         case "$skip" in
3768                         true) type='';
3769                         esac
3770
3771                         case "$type" in
3772                         '') ;;
3773                         *)
3774                                 if test "$fastread" = yes; then
3775                                         dflt=y
3776                                 else
3777                                         dflt=n
3778                                 fi
3779                                 rp="$what $value doesn't exist.  Use that name anyway?"
3780                                 . UU/myread
3781                                 dflt=''
3782                                 case "$ans" in
3783                                 y*) type='';;
3784                                 *) echo " ";;
3785                                 esac
3786                                 ;;
3787                         esac
3788                         ;;
3789                 esac
3790                 ;;
3791         esac
3792 done
3793 cd UU
3794 ans="$value"
3795 rp="$orig_rp"
3796 dflt="$orig_dflt"
3797 rm -f getfile.ok
3798 test "X$gfpthkeep" != Xy && gfpth=""
3799 EOSC
3800
3801 : determine root of directory hierarchy where package will be installed.
3802 case "$prefix" in
3803 '')
3804         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3805         ;;
3806 *?/)
3807         dflt=`echo "$prefix" | sed 's/.$//'`
3808         ;;
3809 *)
3810         dflt="$prefix"
3811         ;;
3812 esac
3813 $cat <<EOM
3814
3815 By default, $package will be installed in $dflt/bin, manual pages
3816 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3817 installation directories. Typically this is something like /usr/local.
3818 If you wish to have binaries under /usr/bin but other parts of the
3819 installation under /usr/local, that's ok: you will be prompted
3820 separately for each of the installation directories, the prefix being
3821 only used to set the defaults.
3822
3823 EOM
3824 fn=d~
3825 rp='Installation prefix to use?'
3826 . ./getfile
3827 oldprefix=''
3828 case "$prefix" in
3829 '') ;;
3830 *)
3831         case "$ans" in
3832         "$prefix") ;;
3833         *) oldprefix="$prefix";;
3834         esac
3835         ;;
3836 esac
3837 prefix="$ans"
3838 prefixexp="$ansexp"
3839
3840 case "$afsroot" in
3841 '')     afsroot=/afs ;;
3842 *)      afsroot=$afsroot ;;
3843 esac
3844
3845 : is AFS running?
3846 echo " "
3847 case "$afs" in
3848 $define|true)   afs=true ;;
3849 $undef|false)   afs=false ;;
3850 *)      if test -d $afsroot; then
3851                 afs=true
3852         else
3853                 afs=false
3854         fi
3855         ;;
3856 esac
3857 if $afs; then
3858         echo "AFS may be running... I'll be extra cautious then..." >&4
3859 else
3860         echo "AFS does not seem to be running..." >&4
3861 fi
3862
3863 : determine installation prefix for where package is to be installed.
3864 if $afs; then 
3865 $cat <<EOM
3866
3867 Since you are running AFS, I need to distinguish the directory in which
3868 files will reside from the directory in which they are installed (and from
3869 which they are presumably copied to the former directory by occult means).
3870
3871 EOM
3872         case "$installprefix" in
3873         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3874         *) dflt="$installprefix";;
3875         esac
3876 else
3877 $cat <<EOM
3878
3879 In some special cases, particularly when building $package for distribution,
3880 it is convenient to distinguish the directory in which files should be
3881 installed from the directory ($prefix) in which they will
3882 eventually reside.  For most users, these two directories are the same.
3883
3884 EOM
3885         case "$installprefix" in
3886         '') dflt=$prefix ;;
3887         *) dflt=$installprefix;;
3888         esac
3889 fi
3890 fn=d~
3891 rp='What installation prefix should I use for installing files?'
3892 . ./getfile
3893 installprefix="$ans"
3894 installprefixexp="$ansexp"
3895
3896 : Perform the prefixexp/installprefixexp correction if necessary
3897 cat <<EOS >installprefix
3898 $startsh
3899 EOS
3900 cat <<'EOSC' >>installprefix
3901 : Change installation prefix, if necessary.
3902 if $test X"$prefix" != X"$installprefix"; then
3903     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3904 else
3905     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3906 fi
3907 EOSC
3908 chmod +x installprefix
3909 $eunicefix installprefix
3910
3911 : Set variables such as privlib and privlibexp from the output of ./getfile
3912 : performing the prefixexp/installprefixexp correction if necessary.
3913 cat <<EOS >setprefixvar
3914 $startsh
3915 EOS
3916 cat <<'EOSC' >>setprefixvar
3917 eval "${prefixvar}=\"\$ans\""
3918 eval "${prefixvar}exp=\"\$ansexp\""
3919 . ./installprefix
3920 EOSC
3921 chmod +x setprefixvar
3922 $eunicefix setprefixvar
3923
3924 : set up the script used to warn in case of inconsistency
3925 cat <<EOS >whoa
3926 $startsh
3927 EOS
3928 cat <<'EOSC' >>whoa
3929 dflt=y
3930 echo " "
3931 echo "*** WHOA THERE!!! ***" >&4
3932 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3933 rp="    Keep the $hint value?"
3934 . ./myread
3935 case "$ans" in
3936 y) td=$was; tu=$was;;
3937 esac
3938 EOSC
3939
3940 : function used to set $1 to $val
3941 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3942 case "$val$was" in
3943 $define$undef) . ./whoa; eval "$var=\$td";;
3944 $undef$define) . ./whoa; eval "$var=\$tu";;
3945 *) eval "$var=$val";;
3946 esac'
3947
3948 case "$usesocks" in
3949 $define|true|[yY]*)     dflt='y';;
3950 *) dflt='n';;
3951 esac
3952 cat <<EOM
3953
3954 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3955 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3956 to use the PerlIO abstraction layer, this will be implicitly selected.
3957
3958 If this doesn't make any sense to you, just accept the default '$dflt'.
3959 EOM
3960 rp='Build Perl for SOCKS?'
3961 . ./myread
3962 case "$ans" in
3963 y|Y)    val="$define" ;;     
3964 *)      val="$undef" ;;
3965 esac
3966 set usesocks
3967 eval $setvar
3968
3969 case "$usesocks" in
3970 $define|true|[yY]*) useperlio="$define";;
3971 esac
3972
3973 case "$useperlio" in
3974 $define|true|[yY]*|'')  dflt='y';;
3975 *) dflt='n';;
3976 esac
3977 cat <<EOM
3978
3979 Previous version of $package used the standard IO mechanisms as
3980 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3981 alternate IO mechanisms via the PerlIO abstraction layer, but the
3982 stdio mechanism is still available if needed.  The abstraction layer
3983 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3984 Using PerlIO with sfio may cause problems with some extension modules.
3985
3986 If this doesn't make any sense to you, just accept the default '$dflt'.
3987 EOM
3988 rp='Use the PerlIO abstraction layer?'
3989 . ./myread
3990 case "$ans" in
3991 y|Y) 
3992         val="$define"
3993         ;;
3994 *)      
3995         echo "Ok, doing things the stdio way."
3996         val="$undef"
3997         ;;
3998 esac
3999 set useperlio
4000 eval $setvar 
4001
4002 case "$usesocks" in
4003 $define|true|[yY]*)
4004         case "$useperlio" in
4005         $define|true|[yY]*) ;;
4006         *)      cat >&4 <<EOM
4007
4008 You are using the SOCKS proxy protocol library which means that you
4009 should also use the PerlIO layer.  You may be headed for trouble.
4010
4011 EOM
4012                 ;;
4013         esac
4014         ;;
4015 esac
4016
4017         
4018 case "$usethreads" in
4019 $define|true|[yY]*)     dflt='y';;
4020 *)     # Catch case where user specified ithreads or 5005threads but
4021        # forgot -Dusethreads (A.D. 4/2002)
4022        case "$useithreads$use5005threads" in
4023        *$define*)      
4024                 case "$useperlio" in
4025                 "$define")      dflt='y' ;;
4026                 *)              dflt='n' ;;
4027                 esac
4028                 ;;
4029        *)       dflt='n';;
4030        esac
4031        ;;
4032 esac
4033 cat <<EOM
4034
4035 Perl can be built to take advantage of threads on some systems.
4036 To do so, Configure can be run with -Dusethreads.
4037
4038 Note that Perl built with threading support runs slightly slower
4039 and uses more memory than plain Perl. The current implementation
4040 is believed to be stable, but it is fairly new, and so should be
4041 treated with caution.
4042
4043 If this doesn't make any sense to you, just accept the default '$dflt'.
4044 EOM
4045 rp='Build a threading Perl?'
4046 . ./myread
4047 case "$ans" in
4048 y|Y)    val="$define" ;;
4049 *)      val="$undef" ;;
4050 esac
4051 set usethreads
4052 eval $setvar
4053
4054 case "$usethreads" in
4055 $define)
4056         $cat <<EOM
4057
4058 Since release 5.6, Perl has had two different threading implementations,
4059 the newer interpreter-based version (ithreads) with one interpreter per
4060 thread, and the older 5.005 version (5005threads).
4061 The 5005threads version is effectively unmaintained and will probably be
4062 removed in Perl 5.10, so there should be no need to build a Perl using it
4063 unless needed for backwards compatibility with some existing 5.005threads
4064 code.
4065
4066 EOM
4067         : Default to ithreads unless overridden on command line or with
4068         : old config.sh
4069         dflt='y'
4070         case "$use5005threads" in
4071                 $define|true|[yY]*) dflt='n';;
4072         esac
4073         case "$useithreads" in
4074                 $undef|false|[nN]*) dflt='n';;
4075         esac
4076         rp='Use the newer interpreter-based ithreads?'
4077         . ./myread
4078         case "$ans" in
4079         y|Y)    val="$define" ;;
4080         *)      val="$undef" ;;
4081         esac
4082         set useithreads
4083         eval $setvar
4084         : Now set use5005threads to the opposite value.
4085         case "$useithreads" in
4086         $define) val="$undef" ;;
4087         *) val="$define" ;;
4088         esac
4089         set use5005threads
4090         eval $setvar
4091         ;;
4092 *)
4093         useithreads="$undef"
4094         use5005threads="$undef"
4095         ;;
4096 esac
4097
4098 case "$useithreads$use5005threads" in
4099 "$define$define")
4100         $cat >&4 <<EOM
4101
4102 You cannot have both the ithreads and the 5.005 threads enabled
4103 at the same time.  Disabling the 5.005 threads since they are
4104 much less stable than the ithreads.
4105
4106 EOM
4107         use5005threads="$undef"
4108         ;;
4109 esac
4110
4111 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4112         cat >&4 <<EOF
4113 ***
4114 *** To build with ithreads you must also use the PerlIO layer.
4115 *** Cannot continue, aborting.
4116 ***
4117 EOF
4118         exit 1
4119 fi
4120
4121 case "$d_oldpthreads" in
4122 '')     : Configure tests would be welcome here.  For now, assume undef.
4123         val="$undef" ;;
4124 *)      val="$d_oldpthreads" ;;
4125 esac
4126 set d_oldpthreads
4127 eval $setvar
4128
4129
4130 : Look for a hint-file generated 'call-back-unit'.  If the
4131 : user has specified that a threading perl is to be built,
4132 : we may need to set or change some other defaults.
4133 if $test -f usethreads.cbu; then
4134     echo "Your platform has some specific hints regarding threaded builds, using them..."
4135     . ./usethreads.cbu
4136 else
4137     case "$usethreads" in
4138         "$define"|true|[yY]*)
4139                 $cat <<EOM
4140 (Your platform does not have any specific hints for threaded builds.
4141  Assuming POSIX threads, then.)
4142 EOM
4143         ;;
4144     esac
4145 fi
4146
4147 cat <<EOM
4148
4149 Perl can be built so that multiple Perl interpreters can coexist
4150 within the same Perl executable.
4151 EOM
4152
4153 case "$useithreads" in
4154 $define)
4155         cat <<EOM
4156 This multiple interpreter support is required for interpreter-based threads.
4157 EOM
4158         val="$define"
4159         ;;
4160 *)      case "$usemultiplicity" in
4161         $define|true|[yY]*)     dflt='y';;
4162         *) dflt='n';;
4163         esac
4164         echo " "
4165         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4166         rp='Build Perl for multiplicity?'
4167         . ./myread
4168         case "$ans" in
4169         y|Y)    val="$define" ;;
4170         *)      val="$undef" ;;
4171         esac
4172         ;;
4173 esac
4174 set usemultiplicity
4175 eval $setvar
4176
4177
4178 case "$usemorebits" in
4179 "$define"|true|[yY]*)
4180         use64bitint="$define"
4181         uselongdouble="$define"
4182         usemorebits="$define"
4183         ;;
4184 *)      usemorebits="$undef"
4185         ;;
4186 esac
4187
4188 : make some quick guesses about what we are up against
4189 echo " "
4190 $echo $n "Hmm...  $c"
4191 echo exit 1 >bsd
4192 echo exit 1 >usg
4193 echo exit 1 >v7
4194 echo exit 1 >osf1
4195 echo exit 1 >eunice
4196 echo exit 1 >xenix
4197 echo exit 1 >venix
4198 echo exit 1 >os2
4199 d_bsd="$undef"
4200 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4201 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4202 then
4203         echo "Looks kind of like an OSF/1 system, but we'll see..."
4204         echo exit 0 >osf1
4205 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4206         xxx=`./loc addbib blurfl $pth`
4207         if $test -f $xxx; then
4208         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4209                 echo exit 0 >bsd
4210                 echo exit 0 >usg
4211         else
4212                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4213                         echo "Looks kind of like an extended USG system, but we'll see..."
4214                 else
4215                         echo "Looks kind of like a USG system, but we'll see..."
4216                 fi
4217                 echo exit 0 >usg
4218         fi
4219 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4220         echo "Looks kind of like a BSD system, but we'll see..."
4221         d_bsd="$define"
4222         echo exit 0 >bsd
4223 else
4224         echo "Looks kind of like a Version 7 system, but we'll see..."
4225         echo exit 0 >v7
4226 fi
4227 case "$eunicefix" in
4228 *unixtovms*)
4229         $cat <<'EOI'
4230 There is, however, a strange, musty smell in the air that reminds me of
4231 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4232 EOI
4233         echo exit 0 >eunice
4234         d_eunice="$define"
4235 : it so happens the Eunice I know will not run shell scripts in Unix format
4236         ;;
4237 *)
4238         echo " "
4239         echo "Congratulations.  You aren't running Eunice."
4240         d_eunice="$undef"
4241         ;;
4242 esac
4243 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4244 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4245 : semicolon as a patch separator
4246 case "$p_" in
4247 :) ;;
4248 *)
4249         $cat <<'EOI'
4250 I have the feeling something is not exactly right, however...don't tell me...
4251 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4252 (Or you may be running DOS with DJGPP.)
4253 EOI
4254         echo exit 0 >os2
4255         ;;
4256 esac
4257 if test -f /xenix; then
4258         echo "Actually, this looks more like a XENIX system..."
4259         echo exit 0 >xenix
4260         d_xenix="$define"
4261 else
4262         echo " "
4263         echo "It's not Xenix..."
4264         d_xenix="$undef"
4265 fi
4266 chmod +x xenix
4267 $eunicefix xenix
4268 if test -f /venix; then
4269         echo "Actually, this looks more like a VENIX system..."
4270         echo exit 0 >venix
4271 else
4272         echo " "
4273         if ./xenix; then
4274                 : null
4275         else
4276                 echo "Nor is it Venix..."
4277         fi
4278 fi
4279 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4280 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4281 $rm -f foo
4282
4283 case "$cc" in
4284 '') dflt=cc;;
4285 *) dflt="$cc";;
4286 esac
4287 rp="Use which C compiler?"
4288 . ./myread
4289 cc="$ans"
4290
4291 : See if they have not cc but they do have gcc
4292 . ./trygcc
4293 : Look for a hint-file generated 'call-back-unit'.  Now that the
4294 : user has specified the compiler, we may need to set or change some
4295 : other defaults.
4296 if $test -f cc.cbu; then
4297     . ./cc.cbu
4298 fi
4299 . ./checkcc
4300
4301 echo " "
4302 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4303 $cat >try.c <<EOM
4304 #include <stdio.h>
4305 int main() {
4306 #ifdef __GNUC__
4307 #ifdef __VERSION__
4308         printf("%s\n", __VERSION__);
4309 #else
4310         printf("%s\n", "1");
4311 #endif
4312 #endif
4313         return(0);
4314 }
4315 EOM
4316 if $cc -o try $ccflags $ldflags try.c; then
4317         gccversion=`$run ./try`
4318         case "$gccversion" in
4319         '') echo "You are not using GNU cc." ;;
4320         *)  echo "You are using GNU cc $gccversion."
4321             ccname=gcc
4322             ;;
4323         esac
4324 else
4325         echo " "
4326         echo "*** WHOA THERE!!! ***" >&4
4327         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4328         case "$knowitall" in
4329         '')
4330         echo "    You'd better start hunting for one and let me know about it." >&4
4331                 exit 1
4332                 ;;
4333         esac
4334 fi
4335 $rm -f try try.*
4336 case "$gccversion" in
4337 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4338 esac
4339 case "$gccversion" in
4340 '') gccosandvers='' ;;
4341 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4342    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4343    gccshortvers=''
4344    case "$gccosandvers" in
4345    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4346    $osname$osvers) ;; # looking good
4347    $osname*) cat <<EOM >&4
4348
4349 *** WHOA THERE!!! ***
4350
4351     Your gcc has not been compiled for the exact release of
4352     your operating system ($gccosandvers versus $osname$osvers).
4353
4354     In general it is a good idea to keep gcc synchronized with
4355     the operating system because otherwise serious problems
4356     may ensue when trying to compile software, like Perl.
4357
4358     I'm trying to be optimistic here, though, and will continue.
4359     If later during the configuration and build icky compilation
4360     problems appear (headerfile conflicts being the most common
4361     manifestation), I suggest reinstalling the gcc to match
4362     your operating system release.
4363
4364 EOM
4365       ;;
4366    *) gccosandvers='' ;; # failed to parse, better be silent
4367    esac
4368    ;;
4369 esac
4370 case "$ccname" in
4371 '') ccname="$cc" ;;
4372 esac
4373
4374 # gcc 3.* complain about adding -Idirectories that they already know about,
4375 # so we will take those off from locincpth.
4376 case "$gccversion" in
4377 3*)
4378     echo "main(){}">try.c
4379     for incdir in $locincpth; do
4380        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4381              grep '^c[cp]p*[01]: warning: changing search order '`
4382        if test "X$warn" != X; then
4383            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4384        fi
4385     done
4386     $rm -f try try.*
4387 esac
4388
4389 : What should the include directory be ?
4390 echo " "
4391 $echo $n "Hmm...  $c"
4392 dflt='/usr/include'
4393 incpath=''
4394 mips_type=''
4395 if $test -f /bin/mips && /bin/mips; then
4396         echo "Looks like a MIPS system..."
4397         $cat >usr.c <<'EOCP'
4398 #ifdef SYSTYPE_BSD43
4399 /bsd43
4400 #endif
4401 EOCP
4402         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4403                 dflt='/bsd43/usr/include'
4404                 incpath='/bsd43'
4405                 mips_type='BSD 4.3'
4406         else
4407                 mips_type='System V'
4408         fi
4409         $rm -f usr.c usr.out
4410         echo "and you're compiling with the $mips_type compiler and libraries."
4411         xxx_prompt=y
4412         echo "exit 0" >mips
4413 else
4414         echo "Doesn't look like a MIPS system."
4415         xxx_prompt=n
4416         echo "exit 1" >mips
4417 fi
4418 chmod +x mips
4419 $eunicefix mips
4420 case "$usrinc" in
4421 '') ;;
4422 *) dflt="$usrinc";;
4423 esac
4424 case "$xxx_prompt" in
4425 y)      fn=d/
4426         echo " "
4427         rp='Where are the include files you want to use?'
4428         . ./getfile
4429         usrinc="$ans"
4430         ;;
4431 *)      usrinc="$dflt"
4432         ;;
4433 esac
4434
4435 : see how we invoke the C preprocessor
4436 echo " "
4437 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4438 cat <<'EOT' >testcpp.c
4439 #define ABC abc
4440 #define XYZ xyz
4441 ABC.XYZ
4442 EOT
4443 cd ..
4444 if test ! -f cppstdin; then
4445         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4446                 # AIX cc -E doesn't show the absolute headerfile
4447                 # locations but we'll cheat by using the -M flag.
4448                 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
4449         else
4450                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4451         fi
4452 else
4453         echo "Keeping your $hint cppstdin wrapper."
4454 fi
4455 chmod 755 cppstdin
4456 wrapper=`pwd`/cppstdin
4457 ok='false'
4458 cd UU
4459
4460 if $test "X$cppstdin" != "X" && \
4461         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4462         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4463 then
4464         echo "You used to use $cppstdin $cppminus so we'll use that again."
4465         case "$cpprun" in
4466         '') echo "But let's see if we can live without a wrapper..." ;;
4467         *)
4468                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4469                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4470                 then
4471                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4472                         ok='true'
4473                 else
4474                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4475                 fi
4476                 ;;
4477         esac
4478 else
4479         case "$cppstdin" in
4480         '') ;;
4481         *)
4482                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4483                 ;;
4484         esac
4485 fi
4486
4487 if $ok; then
4488         : nothing
4489 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4490         $cc -E <testcpp.c >testcpp.out 2>&1; \
4491         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4492         echo "Yup, it does."
4493         x_cpp="$cc -E"
4494         x_minus='';
4495 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4496         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4497         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4498         echo "Yup, it does."
4499         x_cpp="$cc -E"
4500         x_minus='-';
4501 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4502         $cc -P <testcpp.c >testcpp.out 2>&1; \
4503         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4504         echo "Yipee, that works!"
4505         x_cpp="$cc -P"
4506         x_minus='';
4507 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4508         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4509         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4510         echo "At long last!"
4511         x_cpp="$cc -P"
4512         x_minus='-';
4513 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4514         $cpp <testcpp.c >testcpp.out 2>&1; \
4515         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4516         echo "It works!"
4517         x_cpp="$cpp"
4518         x_minus='';
4519 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4520         $cpp - <testcpp.c >testcpp.out 2>&1; \
4521         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4522         echo "Hooray, it works!  I was beginning to wonder."
4523         x_cpp="$cpp"
4524         x_minus='-';
4525 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4526         $wrapper <testcpp.c >testcpp.out 2>&1; \
4527         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4528         x_cpp="$wrapper"
4529         x_minus=''
4530         echo "Eureka!"
4531 else
4532         dflt=''
4533         rp="No dice.  I can't find a C preprocessor.  Name one:"
4534         . ./myread
4535         x_cpp="$ans"
4536         x_minus=''
4537         $x_cpp <testcpp.c >testcpp.out 2>&1
4538         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4539                 echo "OK, that will do." >&4
4540         else
4541 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4542                 exit 1
4543         fi
4544 fi
4545
4546 case "$ok" in
4547 false)
4548         cppstdin="$x_cpp"
4549         cppminus="$x_minus"
4550         cpprun="$x_cpp"
4551         cpplast="$x_minus"
4552         set X $x_cpp
4553         shift
4554         case "$1" in
4555         "$cpp")
4556                 echo "Perhaps can we force $cc -E using a wrapper..."
4557                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4558                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4559                 then
4560                         echo "Yup, we can."
4561                         cppstdin="$wrapper"
4562                         cppminus='';
4563                 else
4564                         echo "Nope, we'll have to live without it..."
4565                 fi
4566                 ;;
4567         esac
4568         case "$cpprun" in
4569         "$wrapper")
4570                 cpprun=''
4571                 cpplast=''
4572                 ;;
4573         esac
4574         ;;
4575 esac
4576
4577 case "$cppstdin" in
4578 "$wrapper"|'cppstdin') ;;
4579 *) $rm -f $wrapper;;
4580 esac
4581 $rm -f testcpp.c testcpp.out
4582
4583 : Set private lib path
4584 case "$plibpth" in
4585 '') if ./mips; then
4586                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4587         fi;;
4588 esac
4589 case "$libpth" in
4590 ' ') dlist='';;
4591 '') dlist="$loclibpth $plibpth $glibpth";;
4592 *) dlist="$libpth";;
4593 esac
4594
4595 : Now check and see which directories actually exist, avoiding duplicates
4596 libpth=''
4597 for xxx in $dlist
4598 do
4599     if $test -d $xxx; then
4600                 case " $libpth " in
4601                 *" $xxx "*) ;;
4602                 *) libpth="$libpth $xxx";;
4603                 esac
4604     fi
4605 done
4606 $cat <<'EOM'
4607
4608 Some systems have incompatible or broken versions of libraries.  Among
4609 the directories listed in the question below, please remove any you
4610 know not to be holding relevant libraries, and add any that are needed.
4611 Say "none" for none.
4612
4613 EOM
4614 case "$libpth" in
4615 '') dflt='none';;
4616 *)
4617         set X $libpth
4618         shift
4619         dflt=${1+"$@"}
4620         ;;
4621 esac
4622 rp="Directories to use for library searches?"
4623 . ./myread
4624 case "$ans" in
4625 none) libpth=' ';;
4626 *) libpth="$ans";;
4627 esac
4628
4629 : compute shared library extension
4630 case "$so" in
4631 '')
4632         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4633                 dflt='sl'
4634         else
4635                 dflt='so'
4636         fi
4637         ;;
4638 *) dflt="$so";;
4639 esac
4640 $cat <<EOM
4641
4642 On some systems, shared libraries may be available.  Answer 'none' if
4643 you want to suppress searching of shared libraries for the remainder
4644 of this configuration.
4645
4646 EOM
4647 rp='What is the file extension used for shared libraries?'
4648 . ./myread
4649 so="$ans"
4650
4651 : Define several unixisms.
4652 : Hints files or command line option can be used to override them.
4653 : The convoluted testing is in case hints files set either the old
4654 : or the new name.
4655 case "$_exe" in
4656 '')     case "$exe_ext" in
4657         '')     ;;
4658         *)      _exe="$exe_ext" ;;
4659         esac
4660         ;;
4661 esac
4662 case "$_a" in
4663 '')     case "$lib_ext" in
4664     '') _a='.a';;
4665         *)      _a="$lib_ext" ;;
4666         esac
4667         ;;
4668 esac
4669 case "$_o" in
4670 '') case "$obj_ext" in
4671         '')     _o='.o';;
4672         *)      _o="$obj_ext";;
4673         esac
4674         ;;
4675 esac
4676 case "$p_" in
4677 '') case "$path_sep" in
4678         '')     p_=':';;
4679         *)      p_="$path_sep";;
4680         esac
4681         ;;
4682 esac
4683 exe_ext=$_exe
4684 lib_ext=$_a
4685 obj_ext=$_o
4686 path_sep=$p_
4687
4688 : Which makefile gets called first.  This is used by make depend.
4689 case "$firstmakefile" in
4690 '') firstmakefile='makefile';;
4691 esac
4692
4693 case "$ccflags" in
4694 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4695 esac
4696
4697 case "$uselongdouble" in
4698 $define|true|[yY]*)     dflt='y';;
4699 *) dflt='n';;
4700 esac
4701 cat <<EOM
4702
4703 Perl can be built to take advantage of long doubles which
4704 (if available) may give more accuracy and range for floating point numbers.
4705
4706 If this doesn't make any sense to you, just accept the default '$dflt'.
4707 EOM
4708 rp='Try to use long doubles if available?'
4709 . ./myread
4710 case "$ans" in
4711 y|Y)    val="$define"   ;;
4712 *)      val="$undef"    ;;
4713 esac
4714 set uselongdouble
4715 eval $setvar
4716
4717 case "$uselongdouble" in
4718 true|[yY]*) uselongdouble="$define" ;;
4719 esac
4720
4721 : Look for a hint-file generated 'call-back-unit'.  If the
4722 : user has specified that long doubles should be used,
4723 : we may need to set or change some other defaults.
4724 if $test -f uselongdouble.cbu; then
4725     echo "Your platform has some specific hints regarding long doubles, using them..."
4726     . ./uselongdouble.cbu
4727 else
4728     case "$uselongdouble" in
4729         $define)
4730                 $cat <<EOM
4731 (Your platform does not have any specific hints for long doubles.)
4732 EOM
4733         ;;
4734     esac
4735 fi
4736
4737 : Looking for optional libraries
4738 echo " "
4739 echo "Checking for optional libraries..." >&4
4740 case "$libs" in
4741 ' '|'') dflt='';;
4742 *) dflt="$libs";;
4743 esac
4744 case "$libswanted" in
4745 '') libswanted='c_s';;
4746 esac
4747 case "$usesocks" in
4748 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4749 esac
4750 libsfound=''
4751 libsfiles=''
4752 libsdirs=''
4753 libspath=''
4754 for thisdir in $libpth $xlibpth; do
4755   test -d $thisdir && libspath="$libspath $thisdir"
4756 done
4757 for thislib in $libswanted; do
4758         for thisdir in $libspath; do
4759             xxx=''
4760             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4761                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4762                 $test -f "$xxx" && eval $libscheck
4763                 $test -f "$xxx" && libstyle=shared
4764             fi
4765             if test ! -f "$xxx"; then
4766                 xxx=$thisdir/lib$thislib.$so
4767                 $test -f "$xxx" && eval $libscheck
4768                 $test -f "$xxx" && libstyle=shared
4769             fi  
4770             if test ! -f "$xxx"; then
4771                 xxx=$thisdir/lib$thislib$_a
4772                 $test -f "$xxx" && eval $libscheck
4773                 $test -f "$xxx" && libstyle=static
4774             fi
4775             if test ! -f "$xxx"; then
4776                 xxx=$thisdir/$thislib$_a
4777                 $test -f "$xxx" && eval $libscheck
4778                 $test -f "$xxx" && libstyle=static
4779             fi
4780             if test ! -f "$xxx"; then
4781                 xxx=$thisdir/lib${thislib}_s$_a
4782                 $test -f "$xxx" && eval $libscheck
4783                 $test -f "$xxx" && libstyle=static
4784                 $test -f "$xxx" && thislib=${thislib}_s
4785             fi
4786             if test ! -f "$xxx"; then
4787                 xxx=$thisdir/Slib$thislib$_a
4788                 $test -f "$xxx" && eval $libscheck
4789                 $test -f "$xxx" && libstyle=static
4790             fi
4791             if $test -f "$xxx"; then
4792                 case "$libstyle" in
4793                 shared) echo "Found -l$thislib (shared)." ;;
4794                 static) echo "Found -l$thislib." ;;
4795                 *)      echo "Found -l$thislib ($libstyle)." ;;
4796                 esac
4797                 case " $dflt " in
4798                 *"-l$thislib "*);;
4799                 *) dflt="$dflt -l$thislib"
4800                    libsfound="$libsfound $xxx"
4801                    yyy=`basename $xxx`
4802                    libsfiles="$libsfiles $yyy"
4803                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4804                    case " $libsdirs " in
4805                    *" $yyy "*) ;;
4806                    *) libsdirs="$libsdirs $yyy" ;;
4807                    esac
4808                    ;;
4809                 esac
4810                 break
4811             fi  
4812         done
4813         if $test ! -f "$xxx"; then
4814             echo "No -l$thislib."
4815         fi
4816 done
4817 set X $dflt
4818 shift
4819 dflt="$*"
4820 case "$libs" in
4821 '') dflt="$dflt";;
4822 *) dflt="$libs";;
4823 esac
4824 case "$dflt" in
4825 ' '|'') dflt='none';;
4826 esac
4827
4828 $cat <<EOM
4829
4830 In order to compile $package on your machine, a number of libraries
4831 are usually needed.  Include any other special libraries here as well.
4832 Say "none" for none.  The default list is almost always right.
4833 EOM
4834
4835 echo " "
4836 rp="What libraries to use?"
4837 . ./myread
4838 case "$ans" in
4839 none) libs=' ';;
4840 *) libs="$ans";;
4841 esac
4842
4843 : determine optimization, if desired, or use for debug flag also
4844 case "$optimize" in
4845 ' '|$undef) dflt='none';;
4846 '') dflt='-O';;
4847 *) dflt="$optimize";;
4848 esac
4849 $cat <<EOH
4850
4851 By default, $package compiles with the -O flag to use the optimizer.
4852 Alternately, you might want to use the symbolic debugger, which uses
4853 the -g flag (on traditional Unix systems).  Either flag can be
4854 specified here.  To use neither flag, specify the word "none".
4855
4856 EOH
4857 rp="What optimizer/debugger flag should be used?"
4858 . ./myread
4859 optimize="$ans"
4860 case "$optimize" in
4861 'none') optimize=" ";;
4862 esac
4863
4864 : Check what DEBUGGING is required from the command line
4865 : -DEBUGGING      or -DDEBUGGING or
4866 : -DEBUGGING=both                       = -g + -DDEBUGGING
4867 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4868 : -DEBUGGING=none or -UDEBUGGING        =
4869 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4870 case "$EBUGGING" in
4871 '')     ;;
4872 *)      DEBUGGING=$EBUGGING ;;
4873 esac
4874
4875 case "$DEBUGGING" in
4876 -g|$define)
4877     case "$optimize" in
4878         *-g*) ;;
4879         *)    optimize="$optimize -g" ;;
4880     esac ;;
4881 none|$undef)
4882     case "$optimize" in
4883         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
4884                 shift
4885                 optimize="$*"
4886                 ;;
4887     esac ;;
4888 esac
4889
4890 dflt=''
4891 case "$DEBUGGING" in
4892 both|$define) dflt='-DDEBUGGING'
4893 esac
4894
4895 : We will not override a previous value, but we might want to
4896 : augment a hint file
4897 case "$hint" in
4898 default|recommended)
4899         case "$gccversion" in
4900         1*) dflt="$dflt -fpcc-struct-return" ;;
4901         esac
4902         case "$optimize:$DEBUGGING" in
4903         *-g*:old) dflt="$dflt -DDEBUGGING";;
4904         esac
4905         case "$gccversion" in
4906         2*) if test -d /etc/conf/kconfig.d &&
4907                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4908                 then
4909                         # Interactive Systems (ISC) POSIX mode.
4910                         dflt="$dflt -posix"
4911                 fi
4912                 ;;
4913         esac
4914         case "$gccversion" in
4915         1*) ;;
4916         2.[0-8]*) ;;
4917         ?*)     echo " "
4918                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4919                 echo 'int main(void) { return 0; }' > gcctest.c
4920                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4921                         echo "Yes, it does." 2>&1
4922                         case "$ccflags" in
4923                         *strict-aliasing*)
4924                                 echo "Leaving current flags $ccflags alone." 2>&1
4925                                 ;;
4926                         *) dflt="$dflt -fno-strict-aliasing" ;;
4927                         esac
4928                 else
4929                         echo "Nope, it doesn't, but that's ok." 2>&1
4930                 fi
4931                 ;;
4932         esac
4933         # For gcc, adding -pipe speeds up compilations for some, but apparently
4934         # some assemblers can't read from stdin.  (It also slows down compilations
4935         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4936         case "$gccversion" in
4937         ?*)     echo " "
4938                 echo "Checking if your compiler accepts -pipe" 2>&1
4939                 echo 'int main(void) { return 0; }' > gcctest.c
4940                 if $cc -pipe -o gcctest gcctest.c; then
4941                         echo "Yes, it does." 2>&1
4942                         case "$ccflags" in
4943                         *-pipe*)
4944                                 echo "Leaving current flags $ccflags alone." 2>&1
4945                                 ;;
4946                         *) dflt="$dflt -pipe" ;;
4947                         esac
4948                 else
4949                         echo "Nope, it doesn't, but that's ok." 2>&1
4950                 fi
4951
4952                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4953                 echo 'int main(void) { return 0; }' > gcctest.c
4954                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4955                         echo "Yes, it does." 2>&1
4956                         case "$ccflags" in
4957                         *-Wdeclaration-after-statement*)
4958                                 echo "Leaving current flags $ccflags alone." 2>&1
4959                                 ;;
4960                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4961                         esac
4962                 else
4963                         echo "Nope, it doesn't, but that's ok." 2>&1
4964                 fi
4965                 ;;
4966         esac
4967         ;;
4968 esac
4969
4970 case "$mips_type" in
4971 *BSD*|'') inclwanted="$locincpth $usrinc";;
4972 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4973 esac
4974 for thisincl in $inclwanted; do
4975         if $test -d $thisincl; then
4976                 if $test x$thisincl != x$usrinc; then
4977                         case "$dflt" in
4978                         *" -I$thisincl "*);;
4979                         *) dflt="$dflt -I$thisincl ";;
4980                         esac
4981                 fi
4982         fi
4983 done
4984
4985 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4986         xxx=true;
4987 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4988         xxx=true;
4989 else
4990         xxx=false;
4991 fi;
4992 if $xxx; then
4993         case "$dflt" in
4994         *$2*);;
4995         *) dflt="$dflt -D$2";;
4996         esac;
4997 fi'
4998
4999 set signal.h LANGUAGE_C; eval $inctest
5000
5001 case "$usesocks" in
5002 $define)
5003         ccflags="$ccflags -DSOCKS"
5004         ;;
5005 esac
5006
5007 case "$hint" in
5008 default|recommended) dflt="$ccflags $dflt" ;;
5009 *) dflt="$ccflags";;
5010 esac
5011
5012 case "$dflt" in
5013 ''|' ') dflt=none;;
5014 esac
5015
5016 $cat <<EOH
5017
5018 Your C compiler may want other flags.  For this question you should include
5019 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5020 but you should NOT include libraries or ld flags like -lwhatever.  If you
5021 want $package to honor its debug switch, you should include -DDEBUGGING here.
5022 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5023
5024 To use no flags, specify the word "none".
5025
5026 EOH
5027 set X $dflt
5028 shift
5029 dflt=${1+"$@"}
5030 rp="Any additional cc flags?"
5031 . ./myread
5032 case "$ans" in
5033 none) ccflags='';;
5034 *) ccflags="$ans";;
5035 esac
5036
5037 : the following weeds options from ccflags that are of no interest to cpp
5038 case "$cppflags" in
5039 '') cppflags="$ccflags" ;;
5040 *)  cppflags="$cppflags $ccflags" ;;
5041 esac
5042 case "$gccversion" in
5043 1*) cppflags="$cppflags -D__GNUC__"
5044 esac
5045 case "$mips_type" in
5046 '');;
5047 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5048 esac
5049 case "$cppflags" in
5050 '');;
5051 *)
5052         echo " "
5053         echo "Let me guess what the preprocessor flags are..." >&4
5054         set X $cppflags
5055         shift
5056         cppflags=''
5057         $cat >cpp.c <<'EOM'
5058 #define BLURFL foo
5059
5060 BLURFL xx LFRULB
5061 EOM
5062         previous=''
5063         for flag in $*
5064         do
5065                 case "$flag" in
5066                 -*) ftry="$flag";;
5067                 *) ftry="$previous $flag";;
5068                 esac
5069                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5070                         >cpp1.out 2>/dev/null && \
5071                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5072                         >cpp2.out 2>/dev/null && \
5073                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5074                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5075                 then
5076                         cppflags="$cppflags $ftry"
5077                         previous=''
5078                 else
5079                         previous="$flag"
5080                 fi
5081         done
5082         set X $cppflags
5083         shift
5084         cppflags=${1+"$@"}
5085         case "$cppflags" in
5086         *-*)  echo "They appear to be: $cppflags";;
5087         esac
5088         $rm -f cpp.c cpp?.out
5089         ;;
5090 esac
5091
5092 : flags used in final linking phase
5093 case "$ldflags" in
5094 '') if ./venix; then
5095                 dflt='-i -z'
5096         else
5097                 dflt=''
5098         fi
5099         case "$ccflags" in
5100         *-posix*) dflt="$dflt -posix" ;;
5101         esac
5102         ;;
5103 *) dflt="$ldflags";;
5104 esac
5105
5106 : Try to guess additional flags to pick up local libraries.
5107 for thislibdir in $libpth; do
5108         case " $loclibpth " in
5109         *" $thislibdir "*)
5110                 case "$dflt " in
5111                 *"-L$thislibdir "*) ;;
5112                 *)  dflt="$dflt -L$thislibdir" ;;
5113                 esac
5114                 ;;
5115         esac
5116 done
5117
5118 case "$dflt" in
5119 '') dflt='none' ;;
5120 esac
5121
5122 $cat <<EOH
5123
5124 Your C linker may need flags.  For this question you should
5125 include -L/whatever and any other flags used by the C linker, but you
5126 should NOT include libraries like -lwhatever.
5127
5128 Make sure you include the appropriate -L/path flags if your C linker
5129 does not normally search all of the directories you specified above,
5130 namely
5131         $libpth
5132 To use no flags, specify the word "none".
5133
5134 EOH
5135
5136 rp="Any additional ld flags (NOT including libraries)?"
5137 . ./myread
5138 case "$ans" in
5139 none) ldflags='';;
5140 *) ldflags="$ans";;
5141 esac
5142 rmlist="$rmlist pdp11"
5143
5144 : coherency check
5145 echo " "
5146 echo "Checking your choice of C compiler and flags for coherency..." >&4
5147 $cat > try.c <<'EOF'
5148 #include <stdio.h>
5149 int main() { printf("Ok\n"); return(0); }
5150 EOF
5151 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5152 shift
5153 $cat >try.msg <<'EOM'
5154 I've tried to compile and run the following simple program:
5155
5156 EOM
5157 $cat try.c >> try.msg
5158
5159 $cat >> try.msg <<EOM
5160
5161 I used the command:
5162
5163         $*
5164         $run ./try
5165
5166 and I got the following output:
5167
5168 EOM
5169 dflt=y
5170 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5171         if $sh -c "$run ./try" >>try.msg 2>&1; then
5172                 xxx=`$run ./try`
5173                 case "$xxx" in
5174                 "Ok") dflt=n ;;
5175                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5176                         case " $libs " in
5177                         *" -lsfio "*)
5178                                 cat >> try.msg <<'EOQS'
5179 If $libs contains -lsfio, and sfio is mis-configured, then it
5180 sometimes (apparently) runs and exits with a 0 status, but with no
5181 output!  It may have to do with sfio's use of _exit vs. exit.
5182
5183 EOQS
5184                                 rp="You have a big problem.  Shall I abort Configure"
5185                                 dflt=y
5186                                 ;;
5187                         esac
5188                         ;;
5189                 esac
5190         else
5191                 echo "The program compiled OK, but exited with status $?." >>try.msg
5192                 rp="You have a problem.  Shall I abort Configure"
5193                 dflt=y
5194         fi
5195 else
5196         echo "I can't compile the test program." >>try.msg
5197         rp="You have a BIG problem.  Shall I abort Configure"
5198         dflt=y
5199 fi
5200 case "$dflt" in
5201 y)
5202         $cat try.msg >&4
5203         case "$knowitall" in
5204         '')
5205                 echo "(The supplied flags or libraries might be incorrect.)"
5206                 ;;
5207         *) dflt=n;;
5208         esac
5209         echo " "
5210         . ./myread
5211         case "$ans" in
5212         n*|N*) ;;
5213         *)      echo "Ok.  Stopping Configure." >&4
5214                 exit 1
5215                 ;;
5216         esac
5217         ;;
5218 n) echo "OK, that should do.";;
5219 esac
5220 $rm -f try try.* core
5221
5222 : define a shorthand compile call
5223 compile='
5224 mc_file=$1;
5225 shift;
5226 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5227 : define a shorthand compile call for compilations that should be ok.
5228 compile_ok='
5229 mc_file=$1;
5230 shift;
5231 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5232
5233 : determine filename position in cpp output
5234 echo " "
5235 echo "Computing filename position in cpp output for #include directives..." >&4
5236 case "$osname" in
5237 vos) testaccess=-e ;;
5238 *)   testaccess=-r ;;
5239 esac
5240 echo '#include <stdio.h>' > foo.c
5241 $cat >fieldn <<EOF
5242 $startsh
5243 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5244 $grep '^[       ]*#.*stdio\.h' | \
5245 while read cline; do
5246         pos=1
5247         set \$cline
5248         while $test \$# -gt 0; do
5249                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5250                         echo "\$pos"
5251                         exit 0
5252                 fi
5253                 shift
5254                 pos=\`expr \$pos + 1\`
5255         done
5256 done
5257 EOF
5258 chmod +x fieldn
5259 fieldn=`./fieldn`
5260 $rm -f foo.c fieldn
5261 case $fieldn in
5262 '') pos='???';;
5263 1) pos=first;;
5264 2) pos=second;;
5265 3) pos=third;;
5266 *) pos="${fieldn}th";;
5267 esac
5268 echo "Your cpp writes the filename in the $pos field of the line."
5269
5270 case "$osname" in
5271 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5272 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5273 *)   cppfilter='' ;;
5274 esac
5275 : locate header file
5276 $cat >findhdr <<EOF
5277 $startsh
5278 wanted=\$1
5279 name=''
5280 for usrincdir in $usrinc
5281 do
5282         if test -f \$usrincdir/\$wanted; then
5283                 echo "\$usrincdir/\$wanted"
5284                 exit 0
5285         fi
5286 done
5287 awkprg='{ print \$$fieldn }'
5288 echo "#include <\$wanted>" > foo\$\$.c
5289 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5290 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5291 while read cline; do
5292         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5293         case "\$name" in
5294         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5295         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5296         *) exit 2;;
5297         esac;
5298 done;
5299 #
5300 # status = 0: grep returned 0 lines, case statement not executed
5301 # status = 1: headerfile found
5302 # status = 2: while loop executed, no headerfile found
5303 #
5304 status=\$?
5305 $rm -f foo\$\$.c;
5306 if test \$status -eq 1; then
5307         exit 0;
5308 fi
5309 exit 1
5310 EOF
5311 chmod +x findhdr
5312
5313 : define an alternate in-header-list? function
5314 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5315 cont=true; xxf="echo \"<\$1> found.\" >&4";
5316 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5317 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5318 esac;
5319 case $# in 4) instead=instead;; *) instead="at last";; esac;
5320 while $test "$cont"; do
5321         xxx=`./findhdr $1`
5322         var=$2; eval "was=\$$2";
5323         if $test "$xxx" && $test -r "$xxx";
5324         then eval $xxf;
5325         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5326                 cont="";
5327         else eval $xxnf;
5328         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5329         set $yyy; shift; shift; yyy=$@;
5330         case $# in 0) cont="";;
5331         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5332                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5333         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5334                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5335         esac;
5336 done;
5337 while $test "$yyy";
5338 do set $yyy; var=$2; eval "was=\$$2";
5339         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5340         set $yyy; shift; shift; yyy=$@;
5341 done'
5342
5343 : see if stdlib is available
5344 set stdlib.h i_stdlib
5345 eval $inhdr
5346
5347 : check for lengths of integral types
5348 echo " "
5349 case "$intsize" in
5350 '')
5351         echo "Checking to see how big your integers are..." >&4
5352         $cat >try.c <<EOCP
5353 #include <stdio.h>
5354 #$i_stdlib I_STDLIB
5355 #ifdef I_STDLIB
5356 #include <stdlib.h>
5357 #endif
5358 int main()
5359 {
5360         printf("intsize=%d;\n", (int)sizeof(int));
5361         printf("longsize=%d;\n", (int)sizeof(long));
5362         printf("shortsize=%d;\n", (int)sizeof(short));
5363         exit(0);
5364 }
5365 EOCP
5366         set try
5367         if eval $compile_ok && $run ./try > /dev/null; then
5368                 eval `$run ./try`
5369                 echo "Your integers are $intsize bytes long."
5370                 echo "Your long integers are $longsize bytes long."
5371                 echo "Your short integers are $shortsize bytes long."
5372         else
5373                 $cat >&4 <<EOM
5374 !
5375 Help! I can't compile and run the intsize test program: please enlighten me!
5376 (This is probably a misconfiguration in your system or libraries, and
5377 you really ought to fix it.  Still, I'll try anyway.)
5378 !
5379 EOM
5380                 dflt=4
5381                 rp="What is the size of an integer (in bytes)?"
5382                 . ./myread
5383                 intsize="$ans"
5384                 dflt=$intsize
5385                 rp="What is the size of a long integer (in bytes)?"
5386                 . ./myread
5387                 longsize="$ans"
5388                 dflt=2
5389                 rp="What is the size of a short integer (in bytes)?"
5390                 . ./myread
5391                 shortsize="$ans"
5392         fi
5393         ;;
5394 esac
5395 $rm -f try try.*
5396
5397 : check for long long
5398 echo " "
5399 echo "Checking to see if you have long long..." >&4
5400 echo 'int main() { long long x = 7; return 0; }' > try.c
5401 set try
5402 if eval $compile; then
5403         val="$define"
5404         echo "You have long long."
5405 else
5406         val="$undef"
5407         echo "You do not have long long."
5408 fi
5409 $rm try.*
5410 set d_longlong
5411 eval $setvar
5412
5413 : check for length of long long
5414 case "${d_longlong}${longlongsize}" in
5415 $define)
5416         echo " "
5417         echo "Checking to see how big your long longs are..." >&4
5418         $cat >try.c <<'EOCP'
5419 #include <stdio.h>
5420 int main()
5421 {
5422     printf("%d\n", (int)sizeof(long long));
5423     return(0);
5424 }
5425 EOCP
5426         set try
5427         if eval $compile_ok; then
5428                 longlongsize=`$run ./try`
5429                 echo "Your long longs are $longlongsize bytes long."
5430         else
5431                 dflt='8'
5432                 echo " "
5433                 echo "(I can't seem to compile the test program.  Guessing...)"
5434                 rp="What is the size of a long long (in bytes)?"
5435                 . ./myread
5436                 longlongsize="$ans"
5437         fi
5438         if $test "X$longsize" = "X$longlongsize"; then
5439                 echo "(That isn't any different from an ordinary long.)"
5440         fi      
5441         ;;
5442 esac
5443 $rm -f try.* try
5444
5445 : see if inttypes.h is available
5446 : we want a real compile instead of Inhdr because some systems
5447 : have an inttypes.h which includes non-existent headers
5448 echo " "
5449 $cat >try.c <<EOCP
5450 #include <inttypes.h>
5451 int main() {
5452         static int32_t foo32 = 0x12345678;
5453 }
5454 EOCP
5455 set try
5456 if eval $compile; then
5457         echo "<inttypes.h> found." >&4
5458         val="$define"
5459 else
5460         echo "<inttypes.h> NOT found." >&4
5461         val="$undef"
5462 fi
5463 $rm -f try.c try
5464 set i_inttypes
5465 eval $setvar
5466
5467 : check for int64_t
5468 echo " "
5469 echo "Checking to see if you have int64_t..." >&4
5470 $cat >try.c <<EOCP
5471 #include <sys/types.h>
5472 #$i_inttypes I_INTTYPES
5473 #ifdef I_INTTYPES
5474 #include <inttypes.h>
5475 #endif
5476 int main() { int64_t x = 7; }
5477 EOCP
5478 set try
5479 if eval $compile; then
5480         val="$define"
5481         echo "You have int64_t."
5482 else
5483         val="$undef"
5484         echo "You do not have int64_t."
5485 fi
5486 $rm -f try try.*
5487 set d_int64_t
5488 eval $setvar
5489
5490
5491 echo " "
5492 echo "Checking which 64-bit integer type we could use..." >&4
5493
5494 case "$intsize" in
5495 8) val=int
5496    set quadtype
5497    eval $setvar
5498    val='"unsigned int"'
5499    set uquadtype
5500    eval $setvar
5501    quadkind=1
5502    ;;
5503 *) case "$longsize" in
5504    8) val=long
5505       set quadtype
5506       eval $setvar
5507       val='"unsigned long"'
5508       set uquadtype
5509       eval $setvar
5510       quadkind=2
5511       ;;
5512    *) case "$d_longlong:$longlongsize" in
5513       define:8)
5514         val='"long long"'
5515         set quadtype
5516         eval $setvar
5517         val='"unsigned long long"'
5518         set uquadtype
5519         eval $setvar
5520         quadkind=3
5521         ;;
5522       *) case "$d_int64_t" in
5523          define)
5524            val=int64_t
5525            set quadtype
5526            eval $setvar
5527            val=uint64_t
5528            set uquadtype
5529            eval $setvar
5530            quadkind=4
5531            ;;
5532          esac
5533          ;;
5534       esac
5535       ;;
5536    esac
5537    ;;
5538 esac
5539
5540 case "$quadtype" in
5541 '')     echo "Alas, no 64-bit integer types in sight." >&4
5542         d_quad="$undef"
5543         ;;
5544 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5545         d_quad="$define"
5546         ;;
5547 esac
5548
5549
5550 case "$uselonglong" in
5551 "$define"|true|[yY]*)
5552         cat <<EOM >&4
5553
5554 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5555 EOM
5556         use64bitint="$define"
5557         ;;
5558 esac                          
5559 case "$use64bits" in
5560 "$define"|true|[yY]*)
5561         cat <<EOM >&4
5562
5563 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5564 EOM
5565         use64bitint="$define"
5566         ;;
5567 esac                          
5568 case "$use64bitints" in
5569 "$define"|true|[yY]*)
5570         cat <<EOM >&4
5571
5572 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5573 EOM
5574         use64bitint="$define"
5575         ;;
5576 esac                          
5577 case "$use64bitsint" in
5578 "$define"|true|[yY]*)
5579         cat <<EOM >&4
5580
5581 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5582 EOM
5583         use64bitint="$define"
5584         ;;
5585 esac                          
5586 case "$uselonglongs" in
5587 "$define"|true|[yY]*)
5588         cat <<EOM >&4
5589
5590 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5591 EOM
5592         use64bitint="$define"
5593         ;;
5594 esac                          
5595 case "$use64bitsall" in
5596 "$define"|true|[yY]*)
5597         cat <<EOM >&4
5598
5599 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5600 EOM
5601         use64bitall="$define"
5602         ;;
5603 esac                          
5604
5605 case "$ccflags" in
5606 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5607 esac
5608 case "$use64bitall" in
5609 "$define"|true|[yY]*) use64bitint="$define" ;;
5610 esac
5611
5612 case "$longsize" in
5613 8) cat <<EOM
5614
5615 You have natively 64-bit long integers.
5616 EOM
5617    val="$define"
5618    ;;
5619 *) case "$use64bitint" in
5620    "$define"|true|[yY]*) dflt='y';;
5621    *) dflt='n';;
5622    esac
5623    case "$d_quad" in
5624    "$define") ;;
5625    *) dflt='n' ;;
5626    esac
5627    cat <<EOM
5628
5629 Perl can be built to take advantage of 64-bit integer types
5630 on some systems.  To do so, Configure can be run with -Duse64bitint.
5631 Choosing this option will most probably introduce binary incompatibilities.
5632
5633 If this doesn't make any sense to you, just accept the default '$dflt'.
5634 (The default has been chosen based on your configuration.)
5635 EOM
5636    rp='Try to use 64-bit integers, if available?'
5637    . ./myread
5638    case "$ans" in
5639    [yY]*) val="$define" ;;
5640    *)     val="$undef"  ;;
5641    esac
5642    ;;
5643 esac
5644 set use64bitint
5645 eval $setvar
5646
5647 case "$use64bitall" in
5648 "$define"|true|[yY]*) dflt='y' ;;
5649 *) case "$longsize" in
5650    8) dflt='y' ;;
5651    *) dflt='n' ;;
5652    esac
5653    ;;
5654 esac    
5655 cat <<EOM
5656
5657 You may also choose to try maximal 64-bitness.  It means using as much
5658 64-bitness as possible on the platform.  This in turn means even more
5659 binary incompatibilities.  On the other hand, your platform may not
5660 have any more 64-bitness available than what you already have chosen.
5661
5662 If this doesn't make any sense to you, just accept the default '$dflt'.
5663 (The default has been chosen based on your configuration.)
5664 EOM
5665 rp='Try to use maximal 64-bit support, if available?'
5666 . ./myread
5667 case "$ans" in
5668 [yY]*) val="$define" ;;
5669 *)     val="$undef"  ;;
5670 esac
5671 set use64bitall
5672 eval $setvar
5673 case "$use64bitall" in
5674 "$define")
5675         case "$use64bitint" in
5676         "$undef")
5677                 cat <<EOM
5678
5679 Since you have chosen a maximally 64-bit build, I'm also turning on
5680 the use of 64-bit integers.
5681 EOM
5682                 use64bitint="$define" ;;
5683         esac
5684         ;;
5685 esac
5686
5687 : Look for a hint-file generated 'call-back-unit'.  If the
5688 : user has specified that a 64-bit perl is to be built,
5689 : we may need to set or change some other defaults.
5690 if $test -f use64bitint.cbu; then
5691         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5692         . ./use64bitint.cbu
5693 fi
5694 case "$use64bitint" in
5695 "$define"|true|[yY]*)
5696         case "$longsize" in
5697         4) case "$archname64" in
5698            '') archname64=64int ;;
5699            esac
5700            ;;
5701         esac
5702         ;;
5703 esac
5704
5705 : Look for a hint-file generated 'call-back-unit'.  If the
5706 : user has specified that a maximally 64-bit perl is to be built,
5707 : we may need to set or change some other defaults.
5708 if $test -f use64bitall.cbu; then
5709         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5710         . ./use64bitall.cbu
5711 fi
5712 case "$use64bitall" in
5713 "$define"|true|[yY]*)
5714         case "$longsize" in
5715         4) case "$archname64" in
5716            ''|64int) archname64=64all ;;
5717            esac
5718            ;;
5719         esac
5720         ;;
5721 esac
5722
5723 case "$d_quad:$use64bitint" in
5724 $undef:$define)
5725         cat >&4 <<EOF
5726
5727 *** You have chosen to use 64-bit integers,
5728 *** but none can be found.
5729 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5730 *** Cannot continue, aborting.
5731
5732 EOF
5733         exit 1
5734         ;;
5735 esac
5736
5737 : check for length of double
5738 echo " "
5739 case "$doublesize" in
5740 '')
5741         echo "Checking to see how big your double precision numbers are..." >&4
5742         $cat >try.c <<EOCP
5743 #include <stdio.h>
5744 #$i_stdlib I_STDLIB
5745 #ifdef I_STDLIB
5746 #include <stdlib.h>
5747 #endif
5748 int main()
5749 {
5750     printf("%d\n", (int)sizeof(double));
5751     exit(0);
5752 }
5753 EOCP
5754         set try
5755         if eval $compile_ok; then
5756                 doublesize=`$run ./try`
5757                 echo "Your double is $doublesize bytes long."
5758         else
5759                 dflt='8'
5760                 echo "(I can't seem to compile the test program.  Guessing...)"
5761                 rp="What is the size of a double precision number (in bytes)?"
5762                 . ./myread
5763                 doublesize="$ans"
5764         fi
5765         ;;
5766 esac
5767 $rm -f try.c try
5768
5769 : check for long doubles
5770 echo " "
5771 echo "Checking to see if you have long double..." >&4
5772 echo 'int main() { long double x = 7.0; }' > try.c
5773 set try
5774 if eval $compile; then
5775         val="$define"
5776         echo "You have long double."
5777 else
5778         val="$undef"
5779         echo "You do not have long double."
5780 fi
5781 $rm try.*
5782 set d_longdbl
5783 eval $setvar
5784
5785 : check for length of long double
5786 case "${d_longdbl}${longdblsize}" in
5787 $define)
5788         echo " "
5789         echo "Checking to see how big your long doubles are..." >&4
5790         $cat >try.c <<'EOCP'
5791 #include <stdio.h>
5792 int main()
5793 {
5794         printf("%d\n", sizeof(long double));
5795 }
5796 EOCP
5797         set try
5798         set try
5799         if eval $compile; then
5800                 longdblsize=`$run ./try`
5801                 echo "Your long doubles are $longdblsize bytes long."
5802         else
5803                 dflt='8'
5804                 echo " "
5805                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5806                 rp="What is the size of a long double (in bytes)?"
5807                 . ./myread
5808                 longdblsize="$ans"
5809         fi
5810         if $test "X$doublesize" = "X$longdblsize"; then
5811                 echo "That isn't any different from an ordinary double."
5812                 echo "I'll keep your setting anyway, but you may see some"
5813                 echo "harmless compilation warnings."
5814         fi      
5815         ;;
5816 esac
5817 $rm -f try.* try
5818
5819 : determine the architecture name
5820 echo " "
5821 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5822         tarch=`arch`"-$osname"
5823 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5824         if uname -m > tmparch 2>&1 ; then
5825                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5826                         -e 's/$/'"-$osname/" tmparch`
5827         else
5828                 tarch="$osname"
5829         fi
5830         $rm -f tmparch
5831 else
5832         tarch="$osname"
5833 fi
5834 case "$myarchname" in
5835 ''|"$tarch") ;;
5836 *)
5837         echo "(Your architecture name used to be $myarchname.)"
5838         archname=''
5839         ;;
5840 esac
5841 case "$targetarch" in
5842 '') ;;
5843 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5844 esac
5845 myarchname="$tarch"
5846 case "$archname" in
5847 '') dflt="$tarch";;
5848 *) dflt="$archname";;
5849 esac
5850 rp='What is your architecture name'
5851 . ./myread
5852 archname="$ans"
5853 case "$usethreads" in
5854 $define)
5855         echo "Threads selected." >&4
5856         case "$archname" in
5857         *-thread*) echo "...and architecture name already has -thread." >&4
5858                 ;;
5859         *)      archname="$archname-thread"
5860                 echo "...setting architecture name to $archname." >&4
5861                 ;;
5862         esac
5863         ;;
5864 esac
5865 case "$usemultiplicity" in
5866 $define)
5867         echo "Multiplicity selected." >&4
5868         case "$archname" in
5869         *-multi*) echo "...and architecture name already has -multi." >&4
5870                 ;;
5871         *)      archname="$archname-multi"
5872                 echo "...setting architecture name to $archname." >&4
5873                 ;;
5874         esac
5875         ;;
5876 esac
5877 case "$use64bitint$use64bitall" in
5878 *"$define"*)
5879         case "$archname64" in
5880         '')
5881                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5882                 ;;
5883         *)
5884                 case "$use64bitint" in
5885                 "$define") echo "64 bit integers selected." >&4 ;;
5886                 esac
5887                 case "$use64bitall" in
5888                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5889                 esac
5890                 case "$archname" in
5891                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5892                         ;;
5893                 *)      archname="$archname-$archname64"
5894                         echo "...setting architecture name to $archname." >&4
5895                         ;;
5896                 esac
5897                 ;;
5898         esac
5899 esac
5900 case "$uselongdouble" in
5901 $define)
5902         echo "Long doubles selected." >&4
5903         case "$longdblsize" in
5904         $doublesize)
5905                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5906                 ;;
5907         *)
5908                 case "$archname" in
5909                 *-ld*) echo "...and architecture name already has -ld." >&4
5910                         ;;
5911                 *)      archname="$archname-ld"
5912                         echo "...setting architecture name to $archname." >&4
5913                         ;;
5914                 esac
5915                 ;;
5916         esac
5917         ;;
5918 esac
5919 case "$useperlio" in
5920 $define)
5921         echo "Perlio selected." >&4
5922         ;;
5923 *)
5924         echo "Perlio not selected, using stdio." >&4
5925         case "$archname" in
5926         *-stdio*) echo "...and architecture name already has -stdio." >&4
5927                 ;;
5928         *)      archname="$archname-stdio"
5929                 echo "...setting architecture name to $archname." >&4
5930                 ;;
5931         esac
5932         ;;
5933 esac
5934 if $test -f archname.cbu; then
5935         echo "Your platform has some specific hints for architecture name, using them..."
5936         . ./archname.cbu
5937 fi
5938
5939 : set the prefixit variable, to compute a suitable default value
5940 prefixit='case "$3" in
5941 ""|none)
5942         case "$oldprefix" in
5943         "") eval "$1=\"\$$2\"";;
5944         *)
5945                 case "$3" in
5946                 "") eval "$1=";;
5947                 none)
5948                         eval "tp=\"\$$2\"";
5949                         case "$tp" in
5950                         ""|" ") eval "$1=\"\$$2\"";;
5951                         *) eval "$1=";;
5952                         esac;;
5953                 esac;;
5954         esac;;
5955 *)
5956         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5957         case "$tp" in
5958         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5959         /*-$oldprefix/*|\~*-$oldprefix/*)
5960                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5961         *) eval "$1=\"\$$2\"";;
5962         esac;;
5963 esac'
5964
5965 : get the patchlevel
5966 echo " "
5967 echo "Getting the current patchlevel..." >&4
5968 if $test -r $rsrc/patchlevel.h;then
5969         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5970         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5971         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5972         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5973         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5974         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5975         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5976 else
5977         revision=0
5978         patchlevel=0
5979         subversion=0
5980         api_revision=0
5981         api_version=0
5982         api_subversion=0
5983         perl_patchlevel=0
5984         $echo "(You do not have patchlevel.h.  Eek.)"
5985 fi
5986 if $test -r $rsrc/.patch ; then
5987         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5988                 perl_patchlevel=`cat $rsrc/.patch`
5989         fi
5990 fi
5991 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5992 version_patchlevel_string="version $patchlevel subversion $subversion"
5993 case "$perl_patchlevel" in
5994 0|'') ;;
5995 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5996 esac
5997
5998 $echo "(You have $package $version_patchlevel_string.)"
5999
6000 case "$osname" in
6001 dos|vms)
6002         : XXX Should be a Configure test for double-dots in filenames.
6003         version=`echo $revision $patchlevel $subversion | \
6004                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6005         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6006                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6007         ;;
6008 *)
6009         version=`echo $revision $patchlevel $subversion | \
6010                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6011         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6012                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6013         ;;
6014 esac
6015 : Special case the 5.005_xx maintenance series, which used 5.005
6016 : without any subversion label as a subdirectory in $sitelib
6017 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6018         api_versionstring='5.005'
6019 fi
6020
6021 : determine installation style
6022 : For now, try to deduce it from prefix unless it is already set.
6023 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6024 case "$installstyle" in
6025 '')     case "$prefix" in
6026                 *perl*) dflt='lib';;
6027                 *) dflt='lib/perl5' ;;
6028         esac
6029         ;;
6030 *)      dflt="$installstyle" ;;
6031 esac
6032 : Probably not worth prompting for this since we prompt for all
6033 : the directories individually, and the prompt would be too long and
6034 : confusing anyway.
6035 installstyle=$dflt
6036
6037 : determine where public executables go
6038 echo " "
6039 set dflt bin bin
6040 eval $prefixit
6041 fn=d~
6042 rp='Pathname where the public executables will reside?'
6043 . ./getfile
6044 if $test "X$ansexp" != "X$binexp"; then
6045         installbin=''
6046 fi
6047 prefixvar=bin
6048 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6049 . ./setprefixvar
6050
6051 case "$userelocatableinc" in
6052 $define|true|[yY]*)     dflt='y' ;;
6053 *)                      dflt='n' ;;
6054 esac
6055 cat <<EOM
6056
6057 Would you like to build Perl so that the installation is relocatable, so that
6058 library paths in @INC are determined relative to the path of the perl binary?
6059 This is not advised for system Perl installs, or if you need to run setid
6060 scripts or scripts under taint mode.
6061
6062 If this doesn't make any sense to you, just accept the default '$dflt'.
6063 EOM
6064 rp='Use relocatable @INC?'
6065 . ./myread
6066 case "$ans" in
6067 y|Y)    val="$define" ;;
6068 *)      val="$undef"  ;;
6069 esac
6070 set userelocatableinc
6071 eval $setvar
6072
6073 : Default prefix is now "up one level from where the binaries are"
6074 case "$userelocatableinc" in
6075 $define|true|[yY]*)
6076     initialinstalllocation="$binexp"
6077     bin=".../"
6078     binexp=".../"
6079     prefix=".../.."
6080     prefixexp=".../.."
6081     installprefixexp=".../.."
6082     ;;
6083 esac
6084
6085 : determine where private library files go
6086 : Usual default is /usr/local/lib/perl5/$version.
6087 : Also allow things like /opt/perl/lib/$version, since
6088 : /opt/perl/lib/perl5... would be redundant.
6089 : The default "style" setting is made in installstyle.U
6090 case "$installstyle" in
6091 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6092 *)       set dflt privlib lib/$version ;;
6093 esac
6094 eval $prefixit
6095 $cat <<EOM
6096
6097 There are some auxiliary files for $package that need to be put into a
6098 private library directory that is accessible by everyone.
6099
6100 EOM
6101 fn=$binexp
6102 fn=d~+
6103 rp='Pathname where the private library files will reside?'
6104 . ./getfile
6105 prefixvar=privlib
6106 . ./setprefixvar
6107
6108 : set the prefixup variable, to restore leading tilda escape
6109 prefixup='case "$prefixexp" in
6110 "$prefix") ;;
6111 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6112 esac'
6113
6114 : determine where public architecture dependent libraries go
6115 set archlib archlib
6116 eval $prefixit
6117 : privlib default is /usr/local/lib/$package/$version
6118 : archlib default is /usr/local/lib/$package/$version/$archname
6119 : privlib may have an optional trailing /share.
6120 tdflt=`echo $privlib | $sed 's,/share$,,'`
6121 tdflt=$tdflt/$archname
6122 case "$archlib" in
6123 '')     dflt=$tdflt
6124         ;;
6125 *)      dflt="$archlib"
6126     ;;
6127 esac
6128 $cat <<EOM
6129
6130 $spackage contains architecture-dependent library files.  If you are
6131 sharing libraries in a heterogeneous environment, you might store
6132 these files in a separate location.  Otherwise, you can just include
6133 them with the rest of the public library files.
6134
6135 EOM
6136 fn=$binexp
6137 fn=d+~
6138 rp='Where do you want to put the public architecture-dependent libraries?'
6139 . ./getfile
6140 prefixvar=archlib
6141 . ./setprefixvar
6142 if $test X"$archlib" = X"$privlib"; then
6143         d_archlib="$undef"
6144 else
6145         d_archlib="$define"
6146 fi
6147
6148 : see if setuid scripts can be secure
6149 $cat <<EOM
6150
6151 Some kernels have a bug that prevents setuid #! scripts from being
6152 secure.  Some sites have disabled setuid #! scripts because of this.
6153
6154 First let's decide if your kernel supports secure setuid #! scripts.
6155 (If setuid #! scripts would be secure but have been disabled anyway,
6156 don't say that they are secure if asked.)
6157
6158 EOM
6159
6160 val="$undef"
6161 if $test -d /dev/fd; then
6162         echo "#!$ls" >reflect
6163         chmod +x,u+s reflect
6164         ./reflect >flect 2>&1
6165         if $contains "/dev/fd" flect >/dev/null; then
6166                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6167                 val="$define"
6168         else
6169                 $cat <<EOM
6170 If you are not sure if they are secure, I can check but I'll need a
6171 username and password different from the one you are using right now.
6172 If you don't have such a username or don't want me to test, simply
6173 enter 'none'.
6174
6175 EOM
6176                 rp='Other username to test security of setuid scripts with?'
6177                 dflt='none'
6178                 . ./myread
6179                 case "$ans" in
6180                 n|none)
6181                         case "$d_suidsafe" in
6182                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6183                                 dflt=n;;
6184                         "$undef")
6185                                 echo "Well, the $hint value is *not* secure." >&4
6186                                 dflt=n;;
6187                         *)      echo "Well, the $hint value *is* secure." >&4
6188                                 dflt=y;;
6189                         esac
6190                         ;;
6191                 *)
6192                         $rm -f reflect flect
6193                         echo "#!$ls" >reflect
6194                         chmod +x,u+s reflect
6195                         echo >flect
6196                         chmod a+w flect
6197                         echo '"su" will (probably) prompt you for '"$ans's password."
6198                         su $ans -c './reflect >flect'
6199                         if $contains "/dev/fd" flect >/dev/null; then
6200                                 echo "Okay, it looks like setuid scripts are secure." >&4
6201                                 dflt=y
6202                         else
6203                                 echo "I don't think setuid scripts are secure." >&4
6204                                 dflt=n
6205                         fi
6206                         ;;
6207                 esac
6208                 rp='Does your kernel have *secure* setuid scripts?'
6209                 . ./myread
6210                 case "$ans" in
6211                 [yY]*)  val="$define";;
6212                 *)      val="$undef";;
6213                 esac
6214         fi
6215 else
6216         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6217         echo "(That's for file descriptors, not floppy disks.)"
6218         val="$undef"
6219 fi
6220 set d_suidsafe
6221 eval $setvar
6222
6223 $rm -f reflect flect
6224
6225 : now see if they want to do setuid emulation
6226 echo " "
6227 val="$undef"
6228 case "$d_suidsafe" in
6229 "$define")
6230         val="$undef"
6231         echo "No need to emulate SUID scripts since they are secure here." >&4
6232         ;;
6233 *)
6234         $cat <<EOM
6235 Some systems have disabled setuid scripts, especially systems where
6236 setuid scripts cannot be secure.  On systems where setuid scripts have
6237 been disabled, the setuid/setgid bits on scripts are currently
6238 useless.  It is possible for $package to detect those bits and emulate
6239 setuid/setgid in a secure fashion.  This emulation will only work if
6240 setuid scripts have been disabled in your kernel.
6241
6242 EOM
6243         case "$d_dosuid" in
6244         "$define") dflt=y ;;
6245         *) dflt=n ;;
6246         esac
6247         rp="Do you want to do setuid/setgid emulation?"
6248         . ./myread
6249         case "$ans" in
6250         [yY]*)  val="$define";;
6251         *)      val="$undef";;
6252         esac
6253         ;;
6254 esac
6255 set d_dosuid
6256 eval $setvar
6257
6258 : Find perl5.005 or later.
6259 echo "Looking for a previously installed perl5.005 or later... "
6260 case "$perl5" in
6261 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6262                 : Check if this perl is recent and can load a simple module
6263                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6264                         perl5=$tdir/perl
6265                         break;
6266                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6267                         perl5=$tdir/perl5
6268                         break;
6269                 fi
6270         done
6271         ;;
6272 *)      perl5="$perl5"
6273         ;;
6274 esac
6275 case "$perl5" in
6276 '')     echo "None found.  That's ok.";;
6277 *)      echo "Using $perl5." ;;
6278 esac
6279
6280 $cat <<EOM
6281
6282 After $package is installed, you may wish to install various
6283 add-on modules and utilities.  Typically, these add-ons will
6284 be installed under $prefix with the rest
6285 of this package.  However, you may wish to install such add-ons
6286 elsewhere under a different prefix.
6287
6288 If you do not wish to put everything under a single prefix, that's
6289 ok.  You will be prompted for the individual locations; this siteprefix
6290 is only used to suggest the defaults.
6291
6292 The default should be fine for most people.
6293
6294 EOM
6295 fn=d~+
6296 rp='Installation prefix to use for add-on modules and utilities?'
6297 : XXX Here might be another good place for an installstyle setting.
6298 case "$siteprefix" in
6299 '') dflt=$prefix ;;
6300 *)  dflt=$siteprefix ;;
6301 esac
6302 . ./getfile
6303 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6304 oldsiteprefix=''
6305 case "$siteprefix" in
6306 '') ;;
6307 *)      case "$ans" in
6308         "$prefix") ;;
6309         *) oldsiteprefix="$prefix";;
6310         esac
6311         ;;
6312 esac
6313 siteprefix="$ans"
6314 siteprefixexp="$ansexp"
6315
6316 : determine where site specific libraries go.
6317 : Usual default is /usr/local/lib/perl5/site_perl/$version
6318 : The default "style" setting is made in installstyle.U
6319 : XXX No longer works with Prefixit stuff.
6320 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6321 case "$sitelib" in
6322 '') case "$installstyle" in
6323         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6324         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6325         esac
6326         ;;
6327 *)      dflt="$sitelib"
6328         ;;
6329 esac
6330 $cat <<EOM
6331
6332 The installation process will create a directory for
6333 site-specific extensions and modules.  Most users find it convenient
6334 to place all site-specific files in this directory rather than in the
6335 main distribution directory.
6336
6337 EOM
6338 fn=d~+
6339 rp='Pathname for the site-specific library files?'
6340 . ./getfile
6341 prefixvar=sitelib
6342 . ./setprefixvar
6343 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6344
6345 : Determine list of previous versions to include in @INC
6346 $cat > getverlist <<EOPL
6347 #!$perl5 -w
6348 use File::Basename;
6349 \$api_versionstring = "$api_versionstring";
6350 \$version = "$version";
6351 \$stem = "$sitelib_stem";
6352 \$archname = "$archname";
6353 EOPL
6354         $cat >> getverlist <<'EOPL'
6355 # Can't have leading @ because metaconfig interprets it as a command!
6356 ;@inc_version_list=();
6357 # XXX Redo to do opendir/readdir?
6358 if (-d $stem) {
6359     chdir($stem);
6360     ;@candidates = glob("5.*");
6361 }
6362 else {
6363     ;@candidates = ();
6364 }
6365
6366 # XXX ToDo:  These comparisons must be reworked when two-digit
6367 # subversions come along, so that 5.7.10 compares as greater than
6368 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6369 # widespread that we can use the built-in version vectors rather
6370 # than reinventing them here.  For 5.6.0, however, we must
6371 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6372 foreach $d (@candidates) {
6373     if ($d lt $version) {
6374         if ($d ge $api_versionstring) {
6375             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6376         }
6377         elsif ($d ge "5.005") {
6378             unshift(@inc_version_list, grep { -d } $d);
6379         }
6380     }
6381     else {
6382         # Skip newer version.  I.e. don't look in
6383         # 5.7.0 if we're installing 5.6.1.
6384     }
6385 }
6386
6387 if (@inc_version_list) {
6388     print join(' ', @inc_version_list);
6389 }
6390 else {
6391     # Blank space to preserve value for next Configure run.
6392     print " ";
6393 }
6394 EOPL
6395 chmod +x getverlist
6396 case "$inc_version_list" in
6397 '')     if test -x "$perl5$exe_ext"; then
6398                 dflt=`$perl5 getverlist`
6399         else
6400                 dflt='none'
6401         fi
6402         ;;
6403 $undef) dflt='none' ;;
6404 *)  eval dflt=\"$inc_version_list\" ;;
6405 esac
6406 case "$dflt" in
6407 ''|' ') dflt=none ;;
6408 esac
6409 case "$dflt" in
6410 5.005) dflt=none ;;
6411 esac
6412 $cat <<EOM
6413
6414 In order to ease the process of upgrading, this version of perl
6415 can be configured to use modules built and installed with earlier
6416 versions of perl that were installed under $prefix.  Specify here
6417 the list of earlier versions that this version of perl should check.
6418 If Configure detected no earlier versions of perl installed under
6419 $prefix, then the list will be empty.  Answer 'none' to tell perl
6420 to not search earlier versions.
6421
6422 The default should almost always be sensible, so if you're not sure,
6423 just accept the default.
6424 EOM
6425
6426 rp='List of earlier versions to include in @INC?'
6427 . ./myread
6428 case "$ans" in
6429 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6430 *) inc_version_list="$ans" ;;
6431 esac
6432 case "$inc_version_list" in
6433 ''|' ')
6434         inc_version_list_init='0'
6435         d_inc_version_list="$undef"
6436         ;;
6437 *)      inc_version_list_init=`echo $inc_version_list |
6438                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6439         d_inc_version_list="$define"
6440         ;;
6441 esac
6442 $rm -f getverlist
6443
6444 : see if this is a malloc.h system
6445 : we want a real compile instead of Inhdr because some systems have a
6446 : malloc.h that just gives a compile error saying to use stdlib.h instead
6447 echo " "
6448 $cat >try.c <<EOCP
6449 #include <stdlib.h>
6450 #include <malloc.h>
6451 int main () { return 0; }
6452 EOCP
6453 set try
6454 if eval $compile; then
6455     echo "<malloc.h> found." >&4
6456     val="$define"
6457 else
6458     echo "<malloc.h> NOT found." >&4
6459     val="$undef"
6460 fi
6461 $rm -f try.c try
6462 set i_malloc
6463 eval $setvar
6464
6465 : check for void type
6466 echo " "
6467 echo "Checking to see how well your C compiler groks the void type..." >&4
6468 case "$voidflags" in
6469 '')
6470         $cat >try.c <<EOCP
6471 #$i_stdlib I_STDLIB
6472 #ifdef I_STDLIB
6473 #include <stdlib.h>
6474 #endif
6475 #if TRY & 1
6476 void sub() {
6477 #else
6478 sub() {
6479 #endif
6480         extern void moo();      /* function returning void */
6481         void (*goo)();          /* ptr to func returning void */
6482 #if TRY & 8
6483         void *hue;              /* generic ptr */
6484 #endif
6485 #if TRY & 2
6486         void (*foo[10])();
6487 #endif
6488
6489 #if TRY & 4
6490         if(goo == moo) {
6491                 exit(0);
6492         }
6493 #endif
6494         exit(0);
6495 }
6496 int main() { sub(); }
6497 EOCP
6498         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6499                 voidflags=$defvoidused
6500         echo "Good.  It appears to support void to the level $package wants.">&4
6501                 if $contains warning .out >/dev/null 2>&1; then
6502                         echo "However, you might get some warnings that look like this:"
6503                         $cat .out
6504                 fi
6505         else
6506 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6507                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6508                         echo "It supports 1..."
6509                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6510                                 echo "It also supports 2..."
6511                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6512                                         voidflags=7
6513                                         echo "And it supports 4 but not 8 definitely."
6514                                 else
6515                                         echo "It doesn't support 4..."
6516                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6517                                                 voidflags=11
6518                                                 echo "But it supports 8."
6519                                         else
6520                                                 voidflags=3
6521                                                 echo "Neither does it support 8."
6522                                         fi
6523                                 fi
6524                         else
6525                                 echo "It does not support 2..."
6526                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6527                                         voidflags=13
6528                                         echo "But it supports 4 and 8."
6529                                 else
6530                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6531                                                 voidflags=5
6532                                                 echo "And it supports 4 but has not heard about 8."
6533                                         else
6534                                                 echo "However it supports 8 but not 4."
6535                                         fi
6536                                 fi
6537                         fi
6538                 else
6539                         echo "There is no support at all for void."
6540                         voidflags=0
6541                 fi
6542         fi
6543 esac
6544 case "$voidflags" in
6545 "$defvoidused") ;;
6546 *)      $cat >&4 <<'EOM'
6547   Support flag bits are:
6548     1: basic void declarations.
6549     2: arrays of pointers to functions returning void.
6550     4: operations between pointers to and addresses of void functions.
6551     8: generic void pointers.
6552 EOM
6553         dflt="$voidflags";
6554         rp="Your void support flags add up to what?"
6555         . ./myread
6556         voidflags="$ans"
6557         ;;
6558 esac
6559 $rm -f try.* .out
6560
6561 : check for length of pointer
6562 echo " "
6563 case "$ptrsize" in
6564 '')
6565         echo "Checking to see how big your pointers are..." >&4
6566         if test "$voidflags" -gt 7; then
6567                 echo '#define VOID_PTR char *' > try.c
6568         else
6569                 echo '#define VOID_PTR void *' > try.c
6570         fi
6571         $cat >>try.c <<EOCP
6572 #include <stdio.h>
6573 #$i_stdlib I_STDLIB
6574 #ifdef I_STDLIB
6575 #include <stdlib.h>
6576 #endif
6577 int main()
6578 {
6579     printf("%d\n", (int)sizeof(VOID_PTR));
6580     exit(0);
6581 }
6582 EOCP
6583         set try
6584         if eval $compile_ok; then
6585                 ptrsize=`$run ./try`
6586                 echo "Your pointers are $ptrsize bytes long."
6587         else
6588                 dflt='4'
6589                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6590                 rp="What is the size of a pointer (in bytes)?"
6591                 . ./myread
6592                 ptrsize="$ans"
6593         fi
6594         ;;
6595 esac
6596 $rm -f try.c try
6597 case "$use64bitall" in
6598 "$define"|true|[yY]*)
6599         case "$ptrsize" in
6600         4)      cat <<EOM >&4
6601
6602 *** You have chosen a maximally 64-bit build,
6603 *** but your pointers are only 4 bytes wide.
6604 *** Please rerun Configure without -Duse64bitall.
6605 EOM
6606                 case "$d_quad" in
6607                 define)
6608                         cat <<EOM >&4
6609 *** Since you have quads, you could possibly try with -Duse64bitint.
6610 EOM
6611                         ;;
6612                 esac
6613                 cat <<EOM >&4
6614 *** Cannot continue, aborting.
6615
6616 EOM
6617
6618                 exit 1
6619                 ;;
6620         esac
6621         ;;
6622 esac
6623
6624
6625 : determine whether to use malloc wrapping
6626 echo " "
6627 case "$usemallocwrap" in
6628 [yY]*|true|$define)     dflt='y' ;;
6629 [nN]*|false|$undef)     dflt='n' ;;
6630 *)      case "$usedevel" in
6631         [yY]*|true|$define)     dflt='y' ;;
6632         *) dflt='n' ;;
6633         esac
6634         ;;
6635 esac
6636 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6637 . ./myread
6638 usemallocwrap="$ans"
6639 case "$ans" in
6640 y*|true)
6641         usemallocwrap="$define" ;;
6642 *)
6643         usemallocwrap="$undef" ;;
6644 esac
6645
6646 : determine which malloc to compile in
6647 echo " "
6648 case "$usemymalloc" in
6649 [yY]*|true|$define)     dflt='y' ;;
6650 [nN]*|false|$undef)     dflt='n' ;;
6651 *)      case "$ptrsize" in
6652         4) dflt='y' ;;
6653         *) dflt='n' ;;
6654         esac
6655         ;;
6656 esac
6657 rp="Do you wish to attempt to use the malloc that comes with $package?"
6658 . ./myread
6659 usemymalloc="$ans"
6660 case "$ans" in
6661 y*|true)
6662         usemymalloc='y'
6663         mallocsrc='malloc.c'
6664         mallocobj="malloc$_o"
6665         d_mymalloc="$define"
6666         case "$libs" in
6667         *-lmalloc*)
6668                 : Remove malloc from list of libraries to use
6669                 echo "Removing unneeded -lmalloc from library list" >&4
6670                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6671                 shift
6672                 libs="$*"
6673                 echo "libs = $libs" >&4
6674                 ;;
6675         esac
6676         ;;
6677 *)
6678         usemymalloc='n'
6679         mallocsrc=''
6680         mallocobj=''
6681         d_mymalloc="$undef"
6682         ;;
6683 esac
6684
6685 : compute the return types of malloc and free
6686 echo " "
6687 $cat >malloc.c <<END
6688 #$i_malloc I_MALLOC
6689 #$i_stdlib I_STDLIB
6690 #include <stdio.h>
6691 #include <sys/types.h>
6692 #ifdef I_MALLOC
6693 #include <malloc.h>
6694 #endif
6695 #ifdef I_STDLIB
6696 #include <stdlib.h>
6697 #endif
6698 #ifdef TRY_MALLOC
6699 void *malloc();
6700 #endif
6701 #ifdef TRY_FREE
6702 void free();
6703 #endif
6704 END
6705 case "$malloctype" in
6706 '')
6707         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6708                 malloctype='void *'
6709         else
6710                 malloctype='char *'
6711         fi
6712         ;;
6713 esac
6714 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6715
6716 case "$freetype" in
6717 '')
6718         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6719                 freetype='void'
6720         else
6721                 freetype='int'
6722         fi
6723         ;;
6724 esac
6725 echo "Your system uses $freetype free(), it would seem." >&4
6726 $rm -f malloc.[co]
6727 : determine where site specific architecture-dependent libraries go.
6728 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6729 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6730 : sitelib may have an optional trailing /share.
6731 case "$sitearch" in
6732 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6733         dflt="$dflt/$archname"
6734         ;;
6735 *)      dflt="$sitearch"
6736         ;;
6737 esac
6738 set sitearch sitearch none
6739 eval $prefixit
6740 $cat <<EOM
6741
6742 The installation process will also create a directory for
6743 architecture-dependent site-specific extensions and modules.
6744
6745 EOM
6746 fn=d~+
6747 rp='Pathname for the site-specific architecture-dependent library files?'
6748 . ./getfile
6749 prefixvar=sitearch
6750 . ./setprefixvar
6751 if $test X"$sitearch" = X"$sitelib"; then
6752         d_sitearch="$undef"
6753 else
6754         d_sitearch="$define"
6755 fi
6756
6757 $cat <<EOM
6758
6759 The installation process will also create a directory for
6760 vendor-supplied add-ons.  Vendors who supply perl with their system
6761 may find it convenient to place all vendor-supplied files in this
6762 directory rather than in the main distribution directory.  This will
6763 ease upgrades between binary-compatible maintenance versions of perl.
6764
6765 Of course you may also use these directories in whatever way you see
6766 fit.  For example, you might use them to access modules shared over a
6767 company-wide network.
6768
6769 The default answer should be fine for most people.
6770 This causes further questions about vendor add-ons to be skipped
6771 and no vendor-specific directories will be configured for perl.
6772
6773 EOM
6774 rp='Do you want to configure vendor-specific add-on directories?'
6775 case "$usevendorprefix" in
6776 define|true|[yY]*) dflt=y ;;
6777 *)      : User may have set vendorprefix directly on Configure command line.
6778         case "$vendorprefix" in
6779         ''|' ') dflt=n ;;
6780         *)      dflt=y ;;
6781         esac
6782         ;;
6783 esac
6784 . ./myread
6785 case "$ans" in
6786 [yY]*)  fn=d~+
6787         rp='Installation prefix to use for vendor-supplied add-ons?'
6788         case "$vendorprefix" in
6789         '') dflt='' ;;
6790         *)  dflt=$vendorprefix ;;
6791         esac
6792         . ./getfile
6793         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6794         oldvendorprefix=''
6795         case "$vendorprefix" in
6796         '') ;;
6797         *)      case "$ans" in
6798                 "$prefix") ;;
6799                 *) oldvendorprefix="$prefix";;
6800                 esac
6801                 ;;
6802         esac
6803         usevendorprefix="$define"
6804         vendorprefix="$ans"
6805         vendorprefixexp="$ansexp"
6806         ;;
6807 *)      usevendorprefix="$undef"
6808         vendorprefix=''
6809         vendorprefixexp=''
6810         ;;
6811 esac
6812
6813 case "$vendorprefix" in
6814 '')     d_vendorlib="$undef"
6815         vendorlib=''
6816         vendorlibexp=''
6817         ;;
6818 *)      d_vendorlib="$define"
6819         : determine where vendor-supplied modules go.
6820         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6821         case "$vendorlib" in
6822         '')
6823                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6824                 case "$installstyle" in
6825                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6826                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6827                 esac
6828                 ;;
6829         *)      dflt="$vendorlib"
6830                 ;;
6831         esac
6832         fn=d~+
6833         rp='Pathname for the vendor-supplied library files?'
6834         . ./getfile
6835         vendorlib="$ans"
6836         vendorlibexp="$ansexp"
6837         ;;
6838 esac
6839 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6840 prefixvar=vendorlib
6841 . ./installprefix
6842
6843 case "$vendorprefix" in
6844 '')     d_vendorarch="$undef"
6845         vendorarch=''
6846         vendorarchexp=''
6847         ;;
6848 *)      d_vendorarch="$define"
6849         : determine where vendor-supplied architecture-dependent libraries go.
6850         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6851         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6852         : vendorlib may have an optional trailing /share.
6853         case "$vendorarch" in
6854         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6855                 dflt="$dflt/$archname"
6856                 ;;
6857         *)      dflt="$vendorarch" ;;
6858         esac
6859         fn=d~+
6860         rp='Pathname for vendor-supplied architecture-dependent files?'
6861         . ./getfile
6862         vendorarch="$ans"
6863         vendorarchexp="$ansexp"
6864         ;;
6865 esac
6866 prefixvar=vendorarch
6867 . ./installprefix
6868
6869 : Final catch-all directories to search
6870 $cat <<EOM
6871
6872 Lastly, you can have perl look in other directories for extensions and
6873 modules in addition to those already specified.
6874 These directories will be searched after 
6875         $sitearch 
6876         $sitelib 
6877 EOM
6878 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6879 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6880 echo ' '
6881 case "$otherlibdirs" in
6882 ''|' ') dflt='none' ;;
6883 *)      dflt="$otherlibdirs" ;;
6884 esac
6885 $cat <<EOM
6886 Enter a colon-separated set of extra paths to include in perl's @INC
6887 search path, or enter 'none' for no extra paths.
6888
6889 EOM
6890
6891 rp='Colon-separated list of additional directories for perl to search?'
6892 . ./myread
6893 case "$ans" in
6894 ' '|''|none)    otherlibdirs=' ' ;;     
6895 *)      otherlibdirs="$ans" ;;
6896 esac
6897 case "$otherlibdirs" in
6898 ' ') val=$undef ;;
6899 *)      val=$define ;;
6900 esac
6901 set d_perl_otherlibdirs
6902 eval $setvar
6903
6904 : Cruising for prototypes
6905 echo " "
6906 echo "Checking out function prototypes..." >&4
6907 $cat >prototype.c <<EOCP
6908 #$i_stdlib I_STDLIB
6909 #ifdef I_STDLIB
6910 #include <stdlib.h>
6911 #endif
6912 int main(int argc, char *argv[]) {
6913         exit(0);}
6914 EOCP
6915 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6916         echo "Your C compiler appears to support function prototypes."
6917         val="$define"
6918 else
6919         echo "Your C compiler doesn't seem to understand function prototypes."
6920         val="$undef"
6921 fi
6922 set prototype
6923 eval $setvar
6924 $rm -f prototype*
6925
6926 case "$prototype" in
6927 "$define") ;;
6928 *)      ansi2knr='ansi2knr'
6929         echo " "
6930         cat <<EOM >&4
6931
6932 $me:  FATAL ERROR:
6933 This version of $package can only be compiled by a compiler that 
6934 understands function prototypes.  Unfortunately, your C compiler 
6935         $cc $ccflags
6936 doesn't seem to understand them.  Sorry about that.
6937
6938 If GNU cc is available for your system, perhaps you could try that instead.  
6939
6940 Eventually, we hope to support building Perl with pre-ANSI compilers.
6941 If you would like to help in that effort, please contact <perlbug@perl.org>.
6942
6943 Aborting Configure now.
6944 EOM
6945         exit 2
6946         ;;
6947 esac
6948
6949 echo " "
6950 case "$extras" in
6951 '') dflt='n';;
6952 *) dflt='y';;
6953 esac
6954 cat <<EOM
6955 Perl can be built with extra modules or bundles of modules which
6956 will be fetched from the CPAN and installed alongside Perl.
6957
6958 Notice that you will need access to the CPAN; either via the Internet,
6959 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6960 be asked later to configure the CPAN.pm module which will in turn do
6961 the installation of the rest of the extra modules or bundles.)
6962
6963 Notice also that if the modules require any external software such as
6964 libraries and headers (the libz library and the zlib.h header for the
6965 Compress::Zlib module, for example) you MUST have any such software
6966 already installed, this configuration process will NOT install such
6967 things for you.
6968
6969 If this doesn't make any sense to you, just accept the default '$dflt'.
6970 EOM
6971 rp='Install any extra modules (y or n)?'
6972 . ./myread
6973 case "$ans" in
6974 y|Y)
6975         cat <<EOM
6976
6977 Please list any extra modules or bundles to be installed from CPAN,
6978 with spaces between the names.  The names can be in any format the
6979 'install' command of CPAN.pm will understand.  (Answer 'none',
6980 without the quotes, to install no extra modules or bundles.)
6981 EOM
6982         rp='Extras?'
6983         dflt="$extras"
6984         . ./myread
6985         extras="$ans"
6986 esac
6987 case "$extras" in
6988 ''|'none')
6989         val=''
6990         $rm -f ../extras.lst
6991         ;;
6992 *)      echo "(Saving the list of extras for later...)"
6993         echo "$extras" > ../extras.lst
6994         val="'$extras'"
6995         ;;
6996 esac
6997 set extras
6998 eval $setvar
6999 echo " "
7000
7001 : determine where html pages for programs go
7002 set html1dir html1dir none
7003 eval $prefixit
7004 $cat <<EOM
7005
7006 If you wish to install html files for programs in $spackage, indicate
7007 the appropriate directory here.  To skip installing html files,
7008 answer "none".
7009 EOM
7010 case "$html1dir" in
7011 ''|none|$undef|' ') dflt=none ;;
7012 *) dflt=$html1dir ;;
7013 esac
7014 fn=dn+~
7015 rp="Directory for the main $spackage html pages?"
7016 . ./getfile
7017 prefixvar=html1dir
7018 . ./setprefixvar
7019 : Use ' ' for none so value is preserved next time through Configure
7020 $test X"$html1dir" = "X" && html1dir=' '
7021
7022 : determine where html pages for libraries and modules go
7023 set html3dir html3dir none
7024 eval $prefixit
7025 $cat <<EOM
7026
7027 If you wish to install html files for modules associated with $spackage,
7028 indicate the appropriate directory here.  To skip installing html files,
7029 answer "none".
7030 EOM
7031 : There is no obvious default.  If they have specified html1dir, then
7032 : try to key off that, possibly changing .../html1 into .../html3.
7033 case "$html3dir" in
7034 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7035 *) dflt=$html3dir ;;
7036 esac
7037 fn=dn+~
7038 rp="Directory for the $spackage module html pages?"
7039 . ./getfile
7040 prefixvar=html3dir
7041 . ./setprefixvar
7042 : Use ' ' for none so value is preserved next time through Configure
7043 $test X"$html3dir" = "X" && html3dir=' '
7044
7045 : determine whether to install perl also as /usr/bin/perl
7046
7047 echo " "
7048 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7049         $cat <<EOM
7050 Many scripts expect perl to be installed as /usr/bin/perl.
7051
7052 If you want to, I can install the perl you are about to compile
7053 as /usr/bin/perl (in addition to $bin/perl).
7054 EOM
7055         if test -f /usr/bin/perl; then
7056             $cat <<EOM
7057
7058 However, please note that because you already have a /usr/bin/perl,
7059 overwriting that with a new Perl would very probably cause problems.
7060 Therefore I'm assuming you don't want to do that (unless you insist).
7061
7062 EOM
7063             case "$installusrbinperl" in
7064             "$define"|[yY]*)    dflt='y';;
7065             *)                  dflt='n';;
7066             esac
7067         else
7068             $cat <<EOM
7069
7070 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7071
7072 EOM
7073             case "$installusrbinperl" in
7074             "$undef"|[nN]*)     dflt='n';;
7075             *)                  dflt='y';;
7076             esac
7077         fi
7078         rp="Do you want to install perl as /usr/bin/perl?"
7079         . ./myread
7080         case "$ans" in
7081         [yY]*)  val="$define";;
7082         *)      val="$undef" ;;
7083         esac
7084 else
7085         val="$undef"
7086 fi
7087 set installusrbinperl
7088 eval $setvar
7089
7090 echo " "
7091 echo "Checking for GNU C Library..." >&4
7092 cat >try.c <<'EOCP'
7093 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7094    alone are insufficient to distinguish different versions, such as
7095    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7096    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7097 */
7098 #include <stdio.h>
7099 int main(void)
7100 {
7101 #ifdef __GLIBC__
7102 #   ifdef __GLIBC_MINOR__
7103 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7104 #           include <gnu/libc-version.h>
7105             printf("%s\n",  gnu_get_libc_version());
7106 #       else
7107             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7108 #       endif
7109 #   else
7110         printf("%d\n",  __GLIBC__);
7111 #   endif
7112     return 0;
7113 #else
7114     return 1;
7115 #endif
7116 }
7117 EOCP
7118 set try
7119 if eval $compile_ok && $run ./try > glibc.ver; then
7120         val="$define"
7121         gnulibc_version=`$cat glibc.ver`
7122         echo "You are using the GNU C Library version $gnulibc_version"
7123 else
7124         val="$undef"
7125         gnulibc_version=''
7126         echo "You are not using the GNU C Library"
7127 fi
7128 $rm -f try try.* glibc.ver
7129 set d_gnulibc
7130 eval $setvar
7131
7132 : see if nm is to be used to determine whether a symbol is defined or not
7133 case "$usenm" in
7134 '')
7135         dflt=''
7136         case "$d_gnulibc" in
7137         "$define")
7138                 echo " "
7139                 echo "nm probably won't work on the GNU C Library." >&4
7140                 dflt=n
7141                 ;;
7142         esac
7143         case "$dflt" in
7144         '') 
7145                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7146                         echo " "
7147                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7148                         echo "'nm' won't be sufficient on this sytem." >&4
7149                         dflt=n
7150                 fi
7151                 ;;
7152         esac
7153         case "$dflt" in
7154         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7155                 if $test $dflt -gt 20; then
7156                         dflt=y
7157                 else
7158                         dflt=n
7159                 fi
7160                 ;;
7161         esac
7162         ;;
7163 *)
7164         case "$usenm" in
7165         true|$define) dflt=y;;
7166         *) dflt=n;;
7167         esac
7168         ;;
7169 esac
7170 $cat <<EOM
7171
7172 I can use $nm to extract the symbols from your C libraries. This
7173 is a time consuming task which may generate huge output on the disk (up
7174 to 3 megabytes) but that should make the symbols extraction faster. The
7175 alternative is to skip the 'nm' extraction part and to compile a small
7176 test program instead to determine whether each symbol is present. If
7177 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7178 this may be the best solution.
7179
7180 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7181
7182 EOM
7183 rp="Shall I use $nm to extract C symbols from the libraries?"
7184 . ./myread
7185 case "$ans" in
7186 [Nn]*) usenm=false;;
7187 *) usenm=true;;
7188 esac
7189
7190 runnm=$usenm
7191 case "$reuseval" in
7192 true) runnm=false;;
7193 esac
7194
7195 : nm options which may be necessary
7196 case "$nm_opt" in
7197 '') if $test -f /mach_boot; then
7198                 nm_opt=''       # Mach
7199         elif $test -d /usr/ccs/lib; then
7200                 nm_opt='-p'     # Solaris (and SunOS?)
7201         elif $test -f /dgux; then
7202                 nm_opt='-p'     # DG-UX
7203         elif $test -f /lib64/rld; then
7204                 nm_opt='-p'     # 64-bit Irix
7205         else
7206                 nm_opt=''
7207         fi;;
7208 esac
7209
7210 : nm options which may be necessary for shared libraries but illegal
7211 : for archive libraries.  Thank you, Linux.
7212 case "$nm_so_opt" in
7213 '')     case "$myuname" in
7214         *linux*|gnu*)
7215                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7216                         nm_so_opt='--dynamic'
7217                 fi
7218                 ;;
7219         esac
7220         ;;
7221 esac
7222
7223 case "$runnm" in
7224 true)
7225 : get list of predefined functions in a handy place
7226 echo " "
7227 case "$libc" in
7228 '') libc=unknown
7229         case "$libs" in
7230         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7231         esac
7232         ;;
7233 esac
7234 case "$libs" in
7235 '') ;;
7236 *)  for thislib in $libs; do
7237         case "$thislib" in
7238         -lc|-lc_s)
7239                 : Handle C library specially below.
7240                 ;;
7241         -l*)
7242                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7243                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7244                         :
7245                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7246                         :
7247                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7248                         :
7249                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7250                         :
7251                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7252                         :
7253                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7254                         :
7255                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7256                         :
7257                 else
7258                         try=''
7259                 fi
7260                 libnames="$libnames $try"
7261                 ;;
7262         *) libnames="$libnames $thislib" ;;
7263         esac
7264         done
7265         ;;
7266 esac
7267 xxx=normal
7268 case "$libc" in
7269 unknown)
7270         set /lib/libc.$so
7271         for xxx in $libpth; do
7272                 $test -r $1 || set $xxx/libc.$so
7273                 : The messy sed command sorts on library version numbers.
7274                 $test -r $1 || \
7275                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7276                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7277                                 h
7278                                 s/[0-9][0-9]*/0000&/g
7279                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7280                                 G
7281                                 s/\n/ /' | \
7282                          $sort | $sed -e 's/^.* //'`
7283                 eval set \$$#
7284         done
7285         $test -r $1 || set /usr/ccs/lib/libc.$so
7286         $test -r $1 || set /lib/libsys_s$_a
7287         ;;
7288 *)
7289         set blurfl
7290         ;;
7291 esac
7292 if $test -r "$1"; then
7293         echo "Your (shared) C library seems to be in $1."
7294         libc="$1"
7295 elif $test -r /lib/libc && $test -r /lib/clib; then
7296         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7297         xxx=apollo
7298         libc='/lib/clib /lib/libc'
7299         if $test -r /lib/syslib; then
7300                 echo "(Your math library is in /lib/syslib.)"
7301                 libc="$libc /lib/syslib"
7302         fi
7303 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7304         echo "Your C library seems to be in $libc, as you said before."
7305 elif $test -r $incpath/usr/lib/libc$_a; then
7306         libc=$incpath/usr/lib/libc$_a;
7307         echo "Your C library seems to be in $libc.  That's fine."
7308 elif $test -r /lib/libc$_a; then
7309         libc=/lib/libc$_a;
7310         echo "Your C library seems to be in $libc.  You're normal."
7311 else
7312         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7313                 :
7314         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7315                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7316         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7317                 :
7318         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7319                 :
7320         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7321                 :
7322         else
7323                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7324         fi
7325         if $test -r "$tans"; then
7326                 echo "Your C library seems to be in $tans, of all places."
7327                 libc=$tans
7328         else
7329                 libc='blurfl'
7330         fi
7331 fi
7332 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7333         dflt="$libc"
7334         cat <<EOM
7335
7336 If the guess above is wrong (which it might be if you're using a strange
7337 compiler, or your machine supports multiple models), you can override it here.
7338
7339 EOM
7340 else
7341         dflt=''
7342         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7343         cat >&4 <<EOM
7344 I can't seem to find your C library.  I've looked in the following places:
7345
7346 EOM
7347         $sed 's/^/      /' libpath
7348         cat <<EOM
7349
7350 None of these seems to contain your C library. I need to get its name...
7351
7352 EOM
7353 fi
7354 fn=f
7355 rp='Where is your C library?'
7356 . ./getfile
7357 libc="$ans"
7358
7359 echo " "
7360 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7361 set X `cat libnames`
7362 shift
7363 xxx=files
7364 case $# in 1) xxx=file; esac
7365 echo "Extracting names from the following $xxx for later perusal:" >&4
7366 echo " "
7367 $sed 's/^/      /' libnames >&4
7368 echo " "
7369 $echo $n "This may take a while...$c" >&4
7370
7371 for file in $*; do
7372         case $file in
7373         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7374         *) $nm $nm_opt $file 2>/dev/null;;
7375         esac
7376 done >libc.tmp
7377
7378 $echo $n ".$c"
7379 $grep fprintf libc.tmp > libc.ptf
7380 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7381 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7382 xxx='[ADTSIW]'
7383 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7384         eval $xscan;\
7385         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7386                 eval $xrun
7387 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7388         eval $xscan;\
7389         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7390                 eval $xrun
7391 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7392         eval $xscan;\
7393         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7394                 eval $xrun
7395 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7396         eval $xscan;\
7397         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7398                 eval $xrun
7399 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7400         eval $xscan;\
7401         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7402                 eval $xrun
7403 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7404         eval $xscan;\
7405         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7406                 eval $xrun
7407 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7408                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7409         eval $xscan;\
7410         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7411                 eval $xrun
7412 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7413         eval $xscan;\
7414         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7415                 eval $xrun
7416 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7417         eval $xscan;\
7418         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7419                 eval $xrun
7420 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7421         eval $xscan;\
7422         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7423                 eval $xrun
7424 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7425         eval $xscan;\
7426         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7427                 eval $xrun
7428 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7429         eval $xscan;\
7430         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7431                 eval $xrun
7432 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7433         eval $xscan;\
7434         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7435                 eval $xrun
7436 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7437         eval $xscan;\
7438         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7439                 eval $xrun
7440 else
7441         $nm -p $* 2>/dev/null >libc.tmp
7442         $grep fprintf libc.tmp > libc.ptf
7443         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7444                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7445         then
7446                 nm_opt='-p'
7447                 eval $xrun
7448         else
7449                 echo " "
7450                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7451                 com=''
7452                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7453                         for thisname in $libnames $libc; do
7454                                 $ar t $thisname >>libc.tmp
7455                         done
7456                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7457                         echo "Ok." >&4
7458                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7459                         # Repeat libc to extract forwarders to DLL entries too
7460                         for thisname in $libnames $libc; do
7461                                 $ar tv $thisname >>libc.tmp
7462                                 # Revision 50 of EMX has bug in $ar.
7463                                 # it will not extract forwarders to DLL entries
7464                                 # Use emximp which will extract exactly them.
7465                                 emximp -o tmp.imp $thisname \
7466                                     2>/dev/null && \
7467                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7468                                     < tmp.imp >>libc.tmp
7469                                 $rm tmp.imp
7470                         done
7471                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7472                         echo "Ok." >&4
7473                 else
7474                         echo "$ar didn't seem to work right." >&4
7475                         echo "Maybe this is a Cray...trying bld instead..." >&4
7476                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7477                         then
7478                                 for thisname in $libnames; do
7479                                         bld t $libnames | \
7480                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7481                                         $ar t $thisname >>libc.tmp
7482                                 done
7483                                 echo "Ok." >&4
7484                         else
7485                                 echo "That didn't work either.  Giving up." >&4
7486                                 exit 1
7487                         fi
7488                 fi
7489         fi
7490 fi
7491 nm_extract="$com"
7492 case "$PASE" in
7493 define)
7494     echo " "
7495     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7496     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7497     ;;
7498 *)  if $test -f /lib/syscalls.exp; then
7499         echo " "
7500         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7501         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7502     fi
7503     ;;
7504 esac
7505 ;;
7506 esac
7507 $rm -f libnames libpath
7508
7509 : see if dld is available
7510 set dld.h i_dld
7511 eval $inhdr
7512
7513 : is a C symbol defined?
7514 csym='tlook=$1;
7515 case "$3" in
7516 -v) tf=libc.tmp; tdc="";;
7517 -a) tf=libc.tmp; tdc="[]";;
7518 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7519 esac;
7520 tx=yes;
7521 case "$reuseval-$4" in
7522 true-) ;;
7523 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7524 esac;
7525 case "$tx" in
7526 yes)
7527         tval=false;
7528         if $test "$runnm" = true; then
7529                 if $contains $tlook $tf >/dev/null 2>&1; then
7530                         tval=true;
7531                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7532                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7533                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7534                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7535                         $rm -f try$_exe try.c core core.* try.core;
7536                 fi;
7537         else
7538                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7539                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7540                 $rm -f try$_exe try.c;
7541         fi;
7542         ;;
7543 *)
7544         case "$tval" in
7545         $define) tval=true;;
7546         *) tval=false;;
7547         esac;
7548         ;;
7549 esac;
7550 eval "$2=$tval"'
7551
7552 : define an is-in-libc? function
7553 inlibc='echo " "; td=$define; tu=$undef;
7554 sym=$1; var=$2; eval "was=\$$2";
7555 tx=yes;
7556 case "$reuseval$was" in
7557 true) ;;
7558 true*) tx=no;;
7559 esac;
7560 case "$tx" in
7561 yes)
7562         set $sym tres -f;
7563         eval $csym;
7564         case "$tres" in
7565         true)
7566                 echo "$sym() found." >&4;
7567                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7568         *)
7569                 echo "$sym() NOT found." >&4;
7570                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7571         esac;;
7572 *)
7573         case "$was" in
7574         $define) echo "$sym() found." >&4;;
7575         *) echo "$sym() NOT found." >&4;;
7576         esac;;
7577 esac'
7578
7579 : see if dlopen exists
7580 xxx_runnm="$runnm"
7581 runnm=false
7582 set dlopen d_dlopen
7583 eval $inlibc
7584 runnm="$xxx_runnm"
7585
7586 : determine which dynamic loading, if any, to compile in
7587 echo " "
7588 dldir="ext/DynaLoader"
7589 case "$usedl" in
7590 $define|y|true)
7591         dflt='y'
7592         usedl="$define"
7593         ;;
7594 $undef|n|false)
7595         dflt='n'
7596         usedl="$undef"
7597         ;;
7598 *) 
7599         dflt='n'
7600         case "$d_dlopen" in
7601             $define) dflt='y' ;;
7602         esac
7603         case "$i_dld" in
7604             $define) dflt='y' ;;
7605         esac
7606         : Does a dl_xxx.xs file exist for this operating system
7607         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7608         ;;
7609 esac
7610 rp="Do you wish to use dynamic loading?"
7611 . ./myread
7612 usedl="$ans"
7613 case "$ans" in
7614 y*) usedl="$define"
7615         case "$dlsrc" in
7616         '')
7617                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7618                         dflt="$dldir/dl_${osname}.xs"
7619                 elif $test "$d_dlopen" = "$define" ; then
7620                         dflt="$dldir/dl_dlopen.xs"
7621                 elif $test "$i_dld" = "$define" ; then
7622                         dflt="$dldir/dl_dld.xs"
7623                 else
7624                         dflt=''
7625                 fi
7626                 ;;
7627         *)      dflt="$dldir/$dlsrc"
7628                 ;;
7629         esac
7630     echo "The following dynamic loading files are available:"
7631         : Can not go over to $dldir because getfile has path hard-coded in.
7632         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7633         rp="Source file to use for dynamic loading"
7634         fn="fne"
7635         gfpth="$src"
7636         . ./getfile
7637         usedl="$define"
7638         : emulate basename
7639         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7640
7641         $cat << EOM
7642
7643 Some systems may require passing special flags to $cc -c to
7644 compile modules that will be used to create a shared library.
7645 To use no flags, say "none".
7646
7647 EOM
7648     case "$cccdlflags" in
7649     '') case "$gccversion" in
7650                 '') case "$osname" in
7651                         hpux)   dflt='+z' ;;
7652                         next)   dflt='none' ;;
7653                         irix*)  dflt='-KPIC' ;;
7654                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7655                         sunos)  dflt='-pic' ;;
7656                         *)      dflt='none' ;;
7657                     esac
7658                         ;;
7659                 *)  case "$osname" in
7660                         darwin) dflt='none' ;;
7661                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7662                         *)      dflt='-fpic' ;;
7663                     esac ;;
7664             esac ;;
7665         ' ') dflt='none' ;;
7666     *)  dflt="$cccdlflags" ;;
7667     esac
7668     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7669     . ./myread
7670     case "$ans" in
7671     none) cccdlflags=' ' ;;
7672     *) cccdlflags="$ans" ;;
7673     esac
7674
7675     cat << EOM
7676
7677 Some systems use ld to create libraries that can be dynamically loaded,
7678 while other systems (such as those using ELF) use $cc.
7679
7680 EOM
7681         case "$ld" in
7682         '')     $cat >try.c <<EOM
7683 /* Test for whether ELF binaries are produced */
7684 #include <fcntl.h>
7685 #$i_stdlib I_STDLIB
7686 #ifdef I_STDLIB
7687 #include <stdlib.h>
7688 #endif
7689 int main() {
7690         char b[4];
7691         int i = open("a.out",O_RDONLY);
7692         if(i == -1) 
7693                 exit(1); /* fail */
7694         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7695                 exit(0); /* succeed (yes, it's ELF) */
7696         else
7697                 exit(1); /* fail */
7698 }
7699 EOM
7700                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7701                         cat <<EOM
7702 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7703 EOM
7704                         dflt="$cc"
7705                 else
7706                         echo "I'll use ld to build dynamic libraries."
7707                         dflt='ld'
7708                 fi
7709                 rm -f try.c a.out
7710                 ;;
7711         *)      dflt="$ld"
7712                 ;;
7713         esac
7714
7715     rp="What command should be used to create dynamic libraries?"
7716     . ./myread
7717         ld="$ans"
7718
7719     cat << EOM
7720
7721 Some systems may require passing special flags to $ld to create a
7722 library that can be dynamically loaded.  If your ld flags include
7723 -L/other/path options to locate libraries outside your loader's normal
7724 search path, you may need to specify those -L options here as well.  To
7725 use no flags, say "none".
7726
7727 EOM
7728     case "$lddlflags" in
7729     '') case "$osname" in
7730                         beos) dflt='-nostart' ;;
7731                         hpux) dflt='-b';
7732                               case "$gccversion" in
7733                               '') dflt="$dflt +vnocompatwarnings" ;;
7734                               esac
7735                               ;;        
7736                         linux|irix*|gnu*)       dflt='-shared' ;;
7737                         next)  dflt='none' ;;
7738                         solaris) dflt='-G' ;;
7739                         sunos) dflt='-assert nodefinitions' ;;
7740                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7741                 *)     dflt='none' ;;
7742                         esac
7743                         ;;
7744     *) dflt="$lddlflags" ;;
7745     esac
7746
7747         : Try to guess additional flags to pick up local libraries.
7748         : Be careful not to append to a plain 'none'
7749         case "$dflt" in
7750         none) dflt='' ;;
7751         esac
7752         for thisflag in $ldflags; do
7753                 case "$thisflag" in
7754                 -L*|-R*|-Wl,-R*)
7755                         case " $dflt " in
7756                         *" $thisflag "*) ;;
7757                         *) dflt="$dflt $thisflag" ;;
7758                         esac
7759                         ;;
7760                 esac
7761         done
7762
7763         case "$dflt" in
7764         ''|' ') dflt='none' ;;
7765         esac
7766
7767     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7768     . ./myread
7769     case "$ans" in
7770     none) lddlflags=' ' ;;
7771     *) lddlflags="$ans" ;;
7772     esac
7773
7774         cat <<EOM
7775
7776 Some systems may require passing special flags to $cc to indicate that
7777 the resulting executable will use dynamic linking.  To use no flags,
7778 say "none".
7779
7780 EOM
7781     case "$ccdlflags" in
7782     '') case "$osname" in
7783             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7784             next|sunos) dflt='none' ;;
7785             *)          dflt='none' ;;
7786             esac ;;
7787     ' ')  dflt='none' ;;
7788     *)  dflt="$ccdlflags" ;;
7789     esac
7790     rp="Any special flags to pass to $cc to use dynamic linking?"
7791     . ./myread
7792     case "$ans" in
7793     none) ccdlflags=' ' ;;
7794     *) ccdlflags="$ans" ;;
7795     esac
7796     ;;
7797 *)  usedl="$undef"
7798         ld='ld'
7799     dlsrc='dl_none.xs'
7800     lddlflags=''
7801     ccdlflags=''
7802     ;;
7803 esac
7804
7805 also=''
7806 case "$usedl" in
7807 $undef)
7808         # No dynamic loading being used, so don't bother even to prompt.
7809         useshrplib='false'
7810         ;;
7811 *)      case "$useshrplib" in
7812         '')     case "$osname" in
7813                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7814                         dflt=y
7815                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7816                         ;;
7817                 next*)
7818                         case "$osvers" in
7819                         4*)     dflt=y
7820                                 also='Building a shared libperl is needed for MAB support.'
7821                                 ;;
7822                         *)      dflt=n
7823                                 ;;
7824                         esac
7825                         ;;
7826                 *)      dflt=n
7827                         ;;
7828                 esac
7829                 ;;
7830         $define|true|[Yy]*)
7831                 dflt=y
7832                 ;;
7833         *)      dflt=n
7834                 ;;
7835         esac
7836         $cat << EOM
7837
7838 The perl executable is normally obtained by linking perlmain.c with
7839 libperl${_a}, any static extensions (usually just DynaLoader), and
7840 any other libraries needed on this system (such as -lm, etc.).  Since
7841 your system supports dynamic loading, it is probably possible to build
7842 a shared libperl.$so.  If you will have more than one executable linked
7843 to libperl.$so, this will significantly reduce the size of each
7844 executable, but it may have a noticeable effect on performance.  The
7845 default is probably sensible for your system.
7846 $also
7847
7848 EOM
7849         rp="Build a shared libperl.$so (y/n)"
7850         . ./myread
7851         case "$ans" in
7852         true|$define|[Yy]*)
7853                 useshrplib='true'  ;;
7854         *)      useshrplib='false' ;;
7855         esac
7856         ;;
7857 esac
7858
7859 case "$useshrplib" in
7860 true)
7861         case "$libperl" in
7862         '')
7863                 # Figure out a good name for libperl.so.  Since it gets stored in
7864                 # a version-specific architecture-dependent library, the version
7865                 # number isn't really that important, except for making cc/ld happy.
7866                 #
7867                 # A name such as libperl.so.3.1
7868                 majmin="libperl.$so.$patchlevel.$subversion"
7869                 # A name such as libperl.so.301
7870                 majonly=`echo $patchlevel $subversion |
7871                         $awk '{printf "%d%02d", $1, $2}'`
7872                 majonly=libperl.$so.$majonly
7873                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7874                 # rely on figuring it out from the naming of libc.
7875                 case "${osname}${osvers}" in
7876                 next4*)
7877                         dflt=libperl.5.$so
7878                         # XXX How handle the --version stuff for MAB?
7879                         ;;
7880                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7881                         dflt=libperl.$so
7882                         ;;
7883                 cygwin*) # ld links against an importlib
7884                         dflt=libperl$lib_ext
7885                         ;;
7886                 *)      # Try to guess based on whether libc has major.minor.
7887                         case "$libc" in
7888                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7889                         *libc.$so.[0-9]*) dflt=$majonly ;;
7890                         *)      dflt=libperl.$so ;;
7891                         esac
7892                         ;;
7893                 esac
7894                 ;;
7895         *)      dflt=$libperl
7896                 ;;
7897         esac
7898         cat << EOM
7899
7900 I need to select a good name for the shared libperl.  If your system uses
7901 library names with major and minor numbers, then you might want something
7902 like $majmin.  Alternatively, if your system uses a single version
7903 number for shared libraries, then you might want to use $majonly.
7904 Or, your system might be quite happy with a simple libperl.$so.
7905
7906 Since the shared libperl will get installed into a version-specific
7907 architecture-dependent directory, the version number of the shared perl
7908 library probably isn't important, so the default should be o.k.
7909
7910 EOM
7911         rp='What name do you want to give to the shared libperl?'
7912         . ./myread
7913         libperl=$ans
7914         echo "Ok, I'll use $libperl"
7915         ;;
7916 *)
7917         libperl="libperl${_a}"
7918         ;;
7919 esac
7920
7921 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7922 case "$shrpdir" in
7923 '') ;;
7924 *)      $cat >&4 <<EOM
7925 WARNING:  Use of the shrpdir variable for the installation location of
7926 the shared $libperl is not supported.  It was never documented and
7927 will not work in this version.  Let me (perlbug@perl.org)
7928 know of any problems this may cause.
7929
7930 EOM
7931         case "$shrpdir" in
7932         "$archlibexp/CORE")
7933                 $cat >&4 <<EOM
7934 But your current setting of $shrpdir is
7935 the default anyway, so it's harmless.
7936 EOM
7937                 ;;
7938         *)
7939                 $cat >&4 <<EOM
7940 Further, your current attempted setting of $shrpdir
7941 conflicts with the value of $archlibexp/CORE
7942 that installperl will use.
7943 EOM
7944                 ;;
7945         esac
7946         ;;
7947 esac
7948
7949 # How will the perl executable find the installed shared $libperl?
7950 # Add $xxx to ccdlflags.
7951 # If we can't figure out a command-line option, use $shrpenv to
7952 # set env LD_RUN_PATH.  The main perl makefile uses this.
7953 shrpdir=$archlibexp/CORE
7954 xxx=''
7955 tmp_shrpenv=''
7956 if "$useshrplib"; then
7957     case "$osname" in 
7958         aix)
7959                 # We'll set it in Makefile.SH...
7960                 ;;
7961         solaris)
7962                 xxx="-R $shrpdir"
7963                 ;;
7964         freebsd|netbsd|openbsd|interix|dragonfly)
7965                 xxx="-Wl,-R$shrpdir"
7966                 ;;
7967         bsdos|linux|irix*|dec_osf|gnu*)
7968                 xxx="-Wl,-rpath,$shrpdir"
7969                 ;;
7970         next)
7971                 # next doesn't like the default...
7972                 ;;
7973         beos)
7974                 # beos doesn't like the default, either.
7975                 ;;
7976         hpux*)
7977                 # hpux doesn't like the default, either.
7978                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7979                 ;;
7980         *)
7981                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7982                 ;;
7983         esac
7984         case "$xxx" in
7985         '') ;;
7986         *)      
7987                 # Only add $xxx if it isn't already in ccdlflags.
7988                 case " $ccdlflags " in
7989                 *" $xxx "*)     ;;
7990                 *)      ccdlflags="$ccdlflags $xxx"
7991                         cat <<EOM >&4
7992
7993 Adding $xxx to the flags
7994 passed to $ld so that the perl executable will find the 
7995 installed shared $libperl.
7996
7997 EOM
7998                         ;;
7999                 esac
8000                 ;;
8001         esac
8002 fi
8003 # Fix ccdlflags in AIX for building external extensions.
8004 # (For building Perl itself bare -bE:perl.exp is needed,
8005 #  Makefile.SH takes care of this.)
8006 case "$osname" in
8007 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8008 esac
8009 # Respect a hint or command-line value.
8010 case "$shrpenv" in
8011 '') shrpenv="$tmp_shrpenv" ;;
8012 esac
8013 case "$ldlibpthname" in
8014 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8015 none)   ldlibpthname='' ;;
8016 esac
8017
8018 : determine where manual pages are on this system
8019 echo " "
8020 case "$sysman" in
8021 '') 
8022         syspath='/usr/share/man/man1 /usr/man/man1'
8023         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8024         syspath="$syspath /usr/man/u_man/man1"
8025         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8026         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8027         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8028         sysman=`./loc . /usr/man/man1 $syspath`
8029         ;;
8030 esac
8031 if $test -d "$sysman"; then
8032         echo "System manual is in $sysman." >&4
8033 else
8034         echo "Could not find manual pages in source form." >&4
8035 fi
8036
8037 : determine where manual pages go
8038 set man1dir man1dir none
8039 eval $prefixit
8040 $cat <<EOM
8041
8042 $spackage has manual pages available in source form.
8043 EOM
8044 case "$nroff" in
8045 nroff)
8046         echo "However, you don't have nroff, so they're probably useless to you."
8047         case "$man1dir" in
8048         '') man1dir="none";;
8049         esac;;
8050 esac
8051 echo "If you don't want the manual sources installed, answer 'none'."
8052 case "$man1dir" in
8053 ' ') dflt=none
8054         ;;
8055 '')
8056         lookpath="$prefixexp/share/man/man1"
8057         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8058         lookpath="$lookpath $prefixexp/man/p_man/man1"
8059         lookpath="$lookpath $prefixexp/man/u_man/man1"
8060         lookpath="$lookpath $prefixexp/man/man.1"
8061         case "$sysman" in
8062         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8063         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8064         esac
8065         set dflt
8066         eval $prefixup
8067         ;;
8068 *)  dflt="$man1dir"
8069         ;;
8070 esac
8071 echo " "
8072 fn=dn+~
8073 rp="Where do the main $spackage manual pages (source) go?"
8074 . ./getfile
8075 if $test "X$man1direxp" != "X$ansexp"; then
8076         installman1dir=''
8077 fi
8078 prefixvar=man1dir
8079 . ./setprefixvar
8080
8081 case "$man1dir" in
8082 '')     man1dir=' '
8083         installman1dir='';;
8084 esac
8085
8086 : What suffix to use on installed man pages
8087
8088 case "$man1dir" in
8089 ' ')
8090         man1ext='0'
8091         ;;
8092 *)
8093         rp="What suffix should be used for the main $spackage man pages?"
8094         case "$man1ext" in
8095         '')     case "$man1dir" in
8096                 *1)  dflt=1 ;;
8097                 *1p) dflt=1p ;;
8098                 *1pm) dflt=1pm ;;
8099                 *l) dflt=l;;
8100                 *n) dflt=n;;
8101                 *o) dflt=o;;
8102                 *p) dflt=p;;
8103                 *C) dflt=C;;
8104                 *L) dflt=L;;
8105                 *L1) dflt=L1;;
8106                 *) dflt=1;;
8107                 esac
8108                 ;;
8109         *)      dflt="$man1ext";;
8110         esac
8111         . ./myread
8112         man1ext="$ans"
8113         ;;
8114 esac
8115
8116 : see if we can have long filenames
8117 echo " "
8118 first=123456789abcdef
8119 $rm -f $first
8120 if (echo hi >$first) 2>/dev/null; then
8121         if $test -f 123456789abcde; then
8122                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8123                 val="$undef"
8124         else
8125                 echo 'You can have filenames longer than 14 characters.'>&4
8126                 val="$define"
8127         fi
8128 else
8129         $cat <<'EOM'
8130 You can't have filenames longer than 14 chars.
8131 You can't even think about them!
8132 EOM
8133         val="$undef"
8134 fi 
8135 set d_flexfnam
8136 eval $setvar
8137 $rm -rf 123456789abcde*
8138
8139 : determine where library module manual pages go
8140 set man3dir man3dir none
8141 eval $prefixit
8142 $cat <<EOM
8143
8144 $spackage has manual pages for many of the library modules.
8145 EOM
8146
8147 case "$nroff" in
8148 nroff)
8149         $cat <<'EOM'
8150 However, you don't have nroff, so they're probably useless to you.
8151 EOM
8152         case "$man3dir" in
8153         '') man3dir="none";;
8154         esac;;
8155 esac
8156
8157 case "$d_flexfnam" in
8158 undef)
8159         $cat <<'EOM'
8160 However, your system can't handle the long file names like File::Basename.3.
8161 EOM
8162         case "$man3dir" in
8163         '') man3dir="none";;
8164         esac;;
8165 esac
8166
8167 echo "If you don't want the manual sources installed, answer 'none'."
8168 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8169 case "$man3dir" in
8170 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8171         if $test -d "$privlib/man/man3"; then
8172                 cat <<EOM >&4
8173
8174 WARNING:  Previous versions of perl installed man3 pages into
8175 $privlib/man/man3.  This version will suggest a
8176 new default of $dflt.
8177 EOM
8178                 tdflt=$dflt
8179                 dflt='n'
8180                 rp='Do you wish to preserve the old behavior?(y/n)'
8181                 . ./myread
8182                 case "$ans" in
8183                 y*) dflt="$privlib/man/man3" ;;
8184                 *)  dflt=$tdflt ;;
8185                 esac
8186     fi
8187         ;;
8188 *)      dflt="$man3dir" ;;
8189 esac
8190 case "$dflt" in
8191 ' ') dflt=none ;;
8192 esac
8193 echo " "
8194 fn=dn+~
8195 rp="Where do the $package library man pages (source) go?"
8196 . ./getfile
8197 prefixvar=man3dir
8198 . ./setprefixvar
8199
8200 case "$man3dir" in
8201 '')     man3dir=' '
8202         installman3dir='';;
8203 esac
8204
8205 : What suffix to use on installed man pages
8206 case "$man3dir" in
8207 ' ')
8208         man3ext='0'
8209         ;;
8210 *)
8211         rp="What suffix should be used for the $package library man pages?"
8212         case "$man3ext" in
8213         '')     case "$man3dir" in
8214                 *3)  dflt=3 ;;
8215                 *3p) dflt=3p ;;
8216                 *3pm) dflt=3pm ;;
8217                 *l) dflt=l;;
8218                 *n) dflt=n;;
8219                 *o) dflt=o;;
8220                 *p) dflt=p;;
8221                 *C) dflt=C;;
8222                 *L) dflt=L;;
8223                 *L3) dflt=L3;;
8224                 *) dflt=3;;
8225                 esac
8226                 ;;
8227         *)      dflt="$man3ext";;
8228         esac
8229         . ./myread
8230         man3ext="$ans"
8231         ;;
8232 esac
8233
8234 : see if we have to deal with yellow pages, now NIS.
8235 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8236         if $test -f /usr/etc/nibindd; then
8237                 echo " "
8238                 echo "I'm fairly confident you're on a NeXT."
8239                 echo " "
8240                 rp='Do you get the hosts file via NetInfo?'
8241                 dflt=y
8242                 case "$hostcat" in
8243                 nidump*) ;;
8244                 '') ;;
8245                 *) dflt=n;;
8246                 esac
8247                 . ./myread
8248                 case "$ans" in
8249                 y*) hostcat='nidump hosts .';;
8250                 *)      case "$hostcat" in
8251                         nidump*) hostcat='';;
8252                         esac
8253                         ;;
8254                 esac
8255         fi
8256         case "$hostcat" in
8257         nidump*) ;;
8258         *)
8259                 case "$hostcat" in
8260                 *ypcat*) dflt=y;;
8261                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8262                                 dflt=y
8263                         else
8264                                 dflt=n
8265                         fi;;
8266                 *) dflt=n;;
8267                 esac
8268                 echo " "
8269                 rp='Are you getting the hosts file via yellow pages?'
8270                 . ./myread
8271                 case "$ans" in
8272                 y*) hostcat='ypcat hosts';;
8273                 *) hostcat='cat /etc/hosts';;
8274                 esac
8275                 ;;
8276         esac
8277 fi
8278 case "$hostcat" in
8279 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8280 esac
8281 case "$groupcat" in
8282 '') test -f /etc/group && groupcat='cat /etc/group';;
8283 esac
8284 case "$passcat" in
8285 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8286 esac
8287
8288 : now get the host name
8289 echo " "
8290 echo "Figuring out host name..." >&4
8291 case "$myhostname" in
8292 '') cont=true
8293         echo 'Maybe "hostname" will work...'
8294         if tans=`sh -c hostname 2>&1` ; then
8295                 myhostname=$tans
8296                 phostname=hostname
8297                 cont=''
8298         fi
8299         ;;
8300 *) cont='';;
8301 esac
8302 if $test "$cont"; then
8303         if ./xenix; then
8304                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8305                 if tans=`cat /etc/systemid 2>&1` ; then
8306                         myhostname=$tans
8307                         phostname='cat /etc/systemid'
8308                         echo "Whadyaknow.  Xenix always was a bit strange..."
8309                         cont=''
8310                 fi
8311         elif $test -r /etc/systemid; then
8312                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8313         fi
8314 fi
8315 if $test "$cont"; then
8316         echo 'No, maybe "uuname -l" will work...'
8317         if tans=`sh -c 'uuname -l' 2>&1` ; then
8318                 myhostname=$tans
8319                 phostname='uuname -l'
8320         else
8321                 echo 'Strange.  Maybe "uname -n" will work...'
8322                 if tans=`sh -c 'uname -n' 2>&1` ; then
8323                         myhostname=$tans
8324                         phostname='uname -n'
8325                 else
8326                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8327                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8328                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8329                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8330                         else
8331                                 case "$myhostname" in
8332                                 '') echo "Does this machine have an identity crisis or something?"
8333                                         phostname='';;
8334                                 *)
8335                                         echo "Well, you said $myhostname before..."
8336                                         phostname='echo $myhostname';;
8337                                 esac
8338                         fi
8339                 fi
8340         fi
8341 fi
8342 case "$myhostname" in
8343 '') myhostname=noname ;;
8344 esac
8345 : you do not want to know about this
8346 set $myhostname
8347 myhostname=$1
8348
8349 : verify guess
8350 if $test "$myhostname" ; then
8351         dflt=y
8352         rp='Your host name appears to be "'$myhostname'".'" Right?"
8353         . ./myread
8354         case "$ans" in
8355         y*) ;;
8356         *) myhostname='';;
8357         esac
8358 fi
8359
8360 : bad guess or no guess
8361 while $test "X$myhostname" = X ; do
8362         dflt=''
8363         rp="Please type the (one word) name of your host:"
8364         . ./myread
8365         myhostname="$ans"
8366 done
8367
8368 : translate upper to lower if necessary
8369 case "$myhostname" in
8370 *[A-Z]*)
8371         echo "(Normalizing case in your host name)"
8372         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8373         ;;
8374 esac
8375
8376 case "$myhostname" in
8377 *.*)
8378         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8379         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8380         echo "(Trimming domain name from host name--host name is now $myhostname)"
8381         ;;
8382 *) case "$mydomain" in
8383         '')
8384                 {
8385                         test "X$hostcat" = "Xypcat hosts" &&
8386                         ypmatch "$myhostname" hosts 2>/dev/null |\
8387                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8388                         $test -s hosts
8389                 } || {
8390                         test "X$hostcat" != "X" &&
8391                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8392                                         /[       ]$myhostname[  . ]/p" > hosts
8393                 }
8394                 tmp_re="[       . ]"
8395                 if $test -f hosts; then
8396                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8397                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8398                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8399                                 hosts | $sort | $uniq | \
8400                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8401                         case `$echo X$dflt` in
8402                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8403                                 dflt=.
8404                                 ;;
8405                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8406                                 ;;
8407                         esac
8408                 else
8409                         echo "(I cannot locate a hosts database anywhere)"
8410                         dflt=.
8411                 fi
8412                 case "$dflt" in
8413                 .)
8414                         tans=`./loc resolv.conf X /etc /usr/etc`
8415                         if $test -f "$tans"; then
8416                                 echo "(Attempting domain name extraction from $tans)"
8417                                 dflt=.`$sed -n -e 's/   / /g' \
8418                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8419                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8420                                 case "$dflt" in
8421                                 .) dflt=.`$sed -n -e 's/        / /g' \
8422                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8423                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8424                                         ;;
8425                                 esac
8426                         fi
8427                         ;;
8428                 esac
8429                 case "$dflt" in
8430                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8431                         dflt=.`sh -c domainname 2>/dev/null`
8432                         case "$dflt" in
8433                         '') dflt='.';;
8434                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8435                         esac
8436                         ;;
8437                 esac
8438                 case "$dflt$osname" in
8439                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8440                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8441                         ;;
8442                 esac
8443                 case "$dflt" in
8444                 .) echo "(Lost all hope -- silly guess then)"
8445                         dflt='.nonet'
8446                         ;;
8447                 esac
8448                 $rm -f hosts
8449                 ;;
8450         *) dflt="$mydomain";;
8451         esac;;
8452 esac
8453 echo " "
8454 rp="What is your domain name?"
8455 . ./myread
8456 tans="$ans"
8457 case "$ans" in
8458 '') ;;
8459 .*) ;;
8460 *) tans=".$tans";;
8461 esac
8462 mydomain="$tans"
8463
8464 : translate upper to lower if necessary
8465 case "$mydomain" in
8466 *[A-Z]*)
8467         echo "(Normalizing case in your domain name)"
8468         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8469         ;;
8470 esac
8471
8472 : a little sanity check here
8473 case "$phostname" in
8474 '') ;;
8475 *)
8476         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8477         $myhostname$mydomain|$myhostname) ;;
8478         *)
8479                 case "$phostname" in
8480                 sed*)
8481                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8482                         ;;
8483                 *)
8484                         echo "(That doesn't agree with your $phostname command, by the way.)"
8485                         ;;
8486                 esac
8487         ;;
8488         esac
8489         ;;
8490 esac
8491
8492 $cat <<EOM
8493
8494 I need to get your e-mail address in Internet format if possible, i.e.
8495 something like user@host.domain. Please answer accurately since I have
8496 no easy means to double check it. The default value provided below
8497 is most probably close to reality but may not be valid from outside
8498 your organization...
8499
8500 EOM
8501 cont=x
8502 while test "$cont"; do
8503         case "$cf_email" in
8504         '') dflt="$cf_by@$myhostname$mydomain";;
8505         *) dflt="$cf_email";;
8506         esac
8507         rp='What is your e-mail address?'
8508         . ./myread
8509         cf_email="$ans"
8510         case "$cf_email" in
8511         *@*.*) cont='' ;;
8512         *)
8513                 rp='Address does not look like an Internet one.  Use it anyway?'
8514                 case "$fastread" in
8515                 yes) dflt=y ;;
8516                 *) dflt=n ;;
8517                 esac
8518                 . ./myread
8519                 case "$ans" in
8520                 y*) cont='' ;;
8521                 *) echo " " ;;
8522                 esac
8523                 ;;
8524         esac
8525 done
8526
8527 $cat <<EOM
8528
8529 If you or somebody else will be maintaining perl at your site, please
8530 fill in the correct e-mail address here so that they may be contacted
8531 if necessary. Currently, the "perlbug" program included with perl
8532 will send mail to this address in addition to perlbug@perl.org. You may
8533 enter "none" for no administrator.
8534
8535 EOM
8536 case "$perladmin" in
8537 '') dflt="$cf_email";;
8538 *) dflt="$perladmin";;
8539 esac
8540 rp='Perl administrator e-mail address'
8541 . ./myread
8542 perladmin="$ans"
8543
8544 : determine whether to only install version-specific parts.
8545 echo " "
8546 $cat <<EOM
8547 Do you want to install only the version-specific parts of the perl
8548 distribution?  Usually you do *not* want to do this.
8549 EOM
8550 case "$versiononly" in
8551 "$define"|[Yy]*|true) dflt='y' ;;
8552 *) dflt='n';
8553 esac
8554 rp="Do you want to install only the version-specific parts of perl?"
8555 . ./myread
8556 case "$ans" in
8557 [yY]*)  val="$define";;
8558 *)      val="$undef" ;;
8559 esac
8560 set versiononly
8561 eval $setvar
8562
8563 case "$versiononly" in
8564 "$define") inc_version_list=''
8565            inc_version_list_init=0
8566            ;;
8567 esac
8568
8569 : figure out how to guarantee perl startup
8570 case "$startperl" in
8571 '')
8572         case "$sharpbang" in
8573         *!)
8574                 $cat <<EOH
8575
8576 I can use the #! construct to start perl on your system. This will
8577 make startup of perl scripts faster, but may cause problems if you
8578 want to share those scripts and perl is not in a standard place
8579 ($binexp/perl) on all your platforms. The alternative is to force
8580 a shell by starting the script with a single ':' character.
8581
8582 EOH
8583                 case "$versiononly" in
8584                 "$define")      dflt="$binexp/perl$version";;  
8585                 *)              dflt="$binexp/perl";;
8586                 esac
8587                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8588                 . ./myread
8589                 case "$ans" in
8590                 none)   startperl=": # use perl";;
8591                 *)      startperl="#!$ans"
8592                         if $test 30 -lt `echo "$ans" | wc -c`; then
8593                                 $cat >&4 <<EOM
8594
8595 WARNING:  Some systems limit the #! command to 32 characters.
8596 If you experience difficulty running Perl scripts with #!, try
8597 installing Perl in a directory with a shorter pathname.
8598
8599 EOM
8600                         fi ;;
8601                 esac
8602                 ;;
8603         *) startperl=": # use perl"
8604                 ;;
8605         esac
8606         ;;
8607 esac
8608 echo "I'll use $startperl to start perl scripts."
8609
8610 : figure best path for perl in scripts
8611 case "$perlpath" in
8612 '')
8613         case "$versiononly" in
8614         "$define")      perlpath="$binexp/perl$version";;
8615         *)              perlpath="$binexp/perl";;
8616         esac
8617         case "$startperl" in
8618         *!*) ;;
8619         *)
8620                 $cat <<EOH
8621
8622 I will use the "eval 'exec'" idiom to start Perl on your system.
8623 I can use the full path of your Perl binary for this purpose, but
8624 doing so may cause problems if you want to share those scripts and
8625 Perl is not always in a standard place ($binexp/perl).
8626
8627 EOH
8628                 dflt="$binexp/perl"
8629                 rp="What path shall I use in \"eval 'exec'\"?"
8630                 . ./myread
8631                 perlpath="$ans"
8632                 ;;
8633         esac
8634         ;;
8635 esac
8636 case "$startperl" in
8637 *!*)    ;;
8638 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8639 esac
8640
8641 : determine where public executable scripts go
8642 set scriptdir scriptdir
8643 eval $prefixit
8644 case "$scriptdir" in
8645 '')
8646         dflt="$bin"
8647         : guess some guesses
8648         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8649         $test -d /usr/share/bin     && dflt=/usr/share/bin
8650         $test -d /usr/local/script  && dflt=/usr/local/script
8651         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8652         $test -d $prefixexp/script  && dflt=$prefixexp/script
8653         set dflt
8654         eval $prefixup
8655         ;;
8656 *)  dflt="$scriptdir"
8657         ;;
8658 esac
8659 $cat <<EOM
8660
8661 Some installations have a separate directory just for executable scripts so
8662 that they can mount it across multiple architectures but keep the scripts in
8663 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8664 Or you might just lump your scripts in with all your other executables.
8665
8666 EOM
8667 fn=d~
8668 rp='Where do you keep publicly executable scripts?'
8669 . ./getfile
8670 if $test "X$ansexp" != "X$scriptdirexp"; then
8671         installscript=''
8672 fi
8673 installscriptdir=''
8674 prefixvar=scriptdir
8675 . ./setprefixvar
8676 : A little fix up for an irregularly named variable.
8677 installscript="$installscriptdir"
8678
8679 : determine where add-on public executables go
8680 case "$sitebin" in
8681 '')     dflt=$siteprefix/bin ;;
8682 *)      dflt=$sitebin ;;
8683 esac
8684 fn=d~
8685 rp='Pathname where the add-on public executables should be installed?'
8686 . ./getfile
8687 prefixvar=sitebin
8688 . ./setprefixvar
8689
8690 : determine where add-on html pages go
8691 : There is no standard location, so try to copy the previously-selected
8692 : directory structure for the core html pages.
8693 case "$sitehtml1dir" in
8694 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8695 *)     dflt=$sitehtml1dir ;;
8696 esac
8697 case "$dflt" in
8698 ''|' ') dflt=none ;;
8699 esac
8700 fn=dn+~
8701 rp='Pathname where the site-specific html pages should be installed?'
8702 . ./getfile
8703 prefixvar=sitehtml1dir
8704 . ./setprefixvar
8705
8706 : determine where add-on library html pages go
8707 : There is no standard location, so try to copy the previously-selected
8708 : directory structure for the core html pages.
8709 case "$sitehtml3dir" in
8710 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8711 *)     dflt=$sitehtml3dir ;;
8712 esac
8713 case "$dflt" in
8714 ''|' ') dflt=none ;;
8715 esac
8716 fn=dn+~
8717 rp='Pathname where the site-specific library html pages should be installed?'
8718 . ./getfile
8719 prefixvar=sitehtml3dir
8720 . ./setprefixvar
8721
8722 : determine where add-on manual pages go
8723 case "$siteman1dir" in
8724 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8725 *)      dflt=$siteman1dir ;;
8726 esac
8727 case "$dflt" in
8728 ''|' ') dflt=none ;;
8729 esac
8730 fn=dn+~
8731 rp='Pathname where the site-specific manual pages should be installed?'
8732 . ./getfile
8733 prefixvar=siteman1dir
8734 . ./setprefixvar
8735
8736 : determine where add-on library man pages go
8737 case "$siteman3dir" in
8738 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8739 *)      dflt=$siteman3dir ;;
8740 esac
8741 case "$dflt" in
8742 ''|' ') dflt=none ;;
8743 esac
8744 fn=dn+~
8745 rp='Pathname where the site-specific library manual pages should be installed?'
8746 . ./getfile
8747 prefixvar=siteman3dir
8748 . ./setprefixvar
8749
8750 : determine where add-on public executable scripts go
8751 case "$sitescript" in
8752 '')     dflt=$siteprefix/script
8753         $test -d $dflt || dflt=$sitebin ;;
8754 *)  dflt="$sitescript" ;;
8755 esac
8756 fn=d~+
8757 rp='Pathname where add-on public executable scripts should be installed?'
8758 . ./getfile
8759 prefixvar=sitescript
8760 . ./setprefixvar
8761
8762 case "$usefaststdio" in
8763 $define|true|[yY]*|'')
8764         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8765         case "$xversion" in
8766         [68])   dflt='y' ;;
8767         *)      dflt='n' ;;
8768         esac
8769         ;;
8770 *) dflt='n';;
8771 esac
8772 cat <<EOM
8773
8774 Perl can be built to use 'fast stdio', which means using the stdio
8775 library but also directly manipulating the stdio buffers to enable
8776 faster I/O.  Using stdio is better for backward compatibility (especially
8777 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8778 interface has been preferred instead of stdio.
8779
8780 If this doesn't make any sense to you, just accept the default '$dflt'.
8781 EOM
8782 rp='Use the "fast stdio" if available?'
8783 . ./myread
8784 case "$ans" in
8785 y|Y)    val="$define" ;;     
8786 *)      val="$undef" ;;
8787 esac
8788 set usefaststdio
8789 eval $setvar
8790
8791
8792 : define an is-a-typedef? function
8793 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8794 case "$inclist" in
8795 "") inclist="sys/types.h";;
8796 esac;
8797 eval "varval=\$$var";
8798 case "$varval" in
8799 "")
8800         $rm -f temp.c;
8801         for inc in $inclist; do
8802                 echo "#include <$inc>" >>temp.c;
8803         done;
8804         echo "#ifdef $type" >> temp.c;
8805         echo "printf(\"We have $type\");" >> temp.c;
8806         echo "#endif" >> temp.c;
8807         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8808         if $contains $type temp.E >/dev/null 2>&1; then
8809                 eval "$var=\$type";
8810         else
8811                 eval "$var=\$def";
8812         fi;
8813         $rm -f temp.?;;
8814 *) eval "$var=\$varval";;
8815 esac'
8816
8817 : define an is-a-typedef? function that prompts if the type is not available.
8818 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8819 case "$inclist" in
8820 "") inclist="sys/types.h";;
8821 esac;
8822 eval "varval=\$$var";
8823 case "$varval" in
8824 "")
8825         $rm -f temp.c;
8826         for inc in $inclist; do
8827                 echo "#include <$inc>" >>temp.c;
8828         done;
8829         echo "#ifdef $type" >> temp.c;
8830         echo "printf(\"We have $type\");" >> temp.c;
8831         echo "#endif" >> temp.c;
8832         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8833         echo " " ;
8834         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8835         if $contains $type temp.E >/dev/null 2>&1; then
8836                 echo "$type found." >&4;
8837                 eval "$var=\$type";
8838         else
8839                 echo "$type NOT found." >&4;
8840                 dflt="$def";
8841                 . ./myread ;
8842                 eval "$var=\$ans";
8843         fi;
8844         $rm -f temp.?;;
8845 *) eval "$var=\$varval";;
8846 esac'
8847
8848 : see what type lseek is declared as in the kernel
8849 rp="What is the type used for lseek's offset on this system?"
8850 set off_t lseektype long stdio.h sys/types.h
8851 eval $typedef_ask
8852
8853 echo " "
8854 echo "Checking to see how big your file offsets are..." >&4
8855 $cat >try.c <<EOCP
8856 #include <sys/types.h>
8857 #include <stdio.h>
8858 int main()
8859 {
8860     printf("%d\n", (int)sizeof($lseektype));
8861     return(0); 
8862 }
8863 EOCP
8864 set try
8865 if eval $compile_ok; then
8866         lseeksize=`$run ./try`
8867         echo "Your file offsets are $lseeksize bytes long."
8868 else
8869         dflt=$longsize
8870         echo " "
8871         echo "(I can't seem to compile the test program.  Guessing...)"
8872         rp="What is the size of your file offsets (in bytes)?"
8873         . ./myread
8874         lseeksize="$ans"
8875 fi
8876 $rm -f try.c try
8877
8878 : see what type file positions are declared as in the library
8879 rp="What is the type for file position used by fsetpos()?"
8880 set fpos_t fpostype long stdio.h sys/types.h
8881 eval $typedef_ask
8882
8883 echo " "
8884 case "$fpostype" in
8885 *_t) zzz="$fpostype"    ;;
8886 *)   zzz="fpos_t"       ;;
8887 esac
8888 echo "Checking the size of $zzz..." >&4 
8889 cat > try.c <<EOCP
8890 #include <sys/types.h>
8891 #include <stdio.h>
8892 #$i_stdlib I_STDLIB
8893 #ifdef I_STDLIB
8894 #include <stdlib.h>
8895 #endif
8896 int main() {
8897     printf("%d\n", (int)sizeof($fpostype));
8898     exit(0);
8899 }
8900 EOCP
8901 set try
8902 if eval $compile_ok; then
8903         yyy=`$run ./try`
8904         case "$yyy" in
8905         '')     fpossize=4
8906                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8907                 ;;
8908         *)      fpossize=$yyy
8909                 echo "Your $zzz is $fpossize bytes long."
8910                 ;;
8911         esac
8912 else
8913         dflt="$longsize"
8914         echo " " >&4
8915         echo "(I can't compile the test program.  Guessing...)" >&4
8916         rp="What is the size of your file positions (in bytes)?"
8917         . ./myread
8918         fpossize="$ans"
8919 fi
8920
8921 # Backward compatibility (uselfs is deprecated).
8922 case "$uselfs" in
8923 "$define"|true|[yY]*)
8924         cat <<EOM >&4
8925
8926 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8927 EOM
8928         uselargefiles="$define"
8929         ;;
8930 esac                          
8931
8932 case "$lseeksize:$fpossize" in
8933 8:8) cat <<EOM
8934
8935 You can have files larger than 2 gigabytes.
8936 EOM
8937    val="$define" ;;
8938 *)    case "$uselargefiles" in
8939    "$undef"|false|[nN]*) dflt='n' ;;
8940    *)   dflt='y' ;;
8941    esac
8942    cat <<EOM
8943
8944 Perl can be built to understand large files (files larger than 2 gigabytes)
8945 on some systems.  To do so, Configure can be run with -Duselargefiles.
8946
8947 If this doesn't make any sense to you, just accept the default '$dflt'.
8948 EOM
8949    rp='Try to understand large files, if available?'
8950    . ./myread
8951    case "$ans" in
8952    y|Y)         val="$define" ;;
8953    *)           val="$undef"  ;;
8954    esac
8955    ;;
8956 esac
8957 set uselargefiles
8958 eval $setvar
8959 : Look for a hint-file generated 'call-back-unit'.  If the
8960 : user has specified that a large files perl is to be built,
8961 : we may need to set or change some other defaults.
8962 if $test -f uselargefiles.cbu; then
8963         echo "Your platform has some specific hints regarding large file builds, using them..."
8964         . ./uselargefiles.cbu
8965 fi
8966 case "$uselargefiles" in
8967 "$define")
8968         if $test -f uselargefiles.cbu; then
8969                 echo " "
8970                 echo "Rechecking to see how big your file offsets are..." >&4
8971                 $cat >try.c <<EOCP
8972 #include <sys/types.h>
8973 #include <stdio.h>
8974 int main()
8975 {
8976     printf("%d\n", (int)sizeof($lseektype));
8977     return(0); 
8978 }
8979 EOCP
8980                 set try
8981                 if eval $compile_ok; then
8982                         lseeksize=`$run ./try`
8983                         $echo "Your file offsets are now $lseeksize bytes long."
8984                 else
8985                         dflt="$lseeksize"
8986                         echo " "
8987                         echo "(I can't seem to compile the test program.  Guessing...)"
8988                         rp="What is the size of your file offsets (in bytes)?"
8989                         . ./myread
8990                         lseeksize="$ans"
8991                 fi
8992                 case "$fpostype" in
8993                 *_t) zzz="$fpostype"    ;;
8994                 *)   zzz="fpos_t"       ;;
8995                 esac
8996                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8997                 $cat > try.c <<EOCP
8998 #include <sys/types.h>
8999 #include <stdio.h>
9000 #$i_stdlib I_STDLIB
9001 #ifdef I_STDLIB
9002 #include <stdlib.h>
9003 #endif
9004 int main() {
9005     printf("%d\n", (int)sizeof($fpostype));
9006     return(0);
9007 }
9008 EOCP
9009                 set try
9010                 if eval $compile_ok; then
9011                         yyy=`$run ./try`
9012                         dflt="$lseeksize"
9013                         case "$yyy" in
9014                         '')     echo " "
9015                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9016                                 ;;
9017                         *)      fpossize=$yyy
9018                                 echo " $fpossize bytes." >&4
9019                                 ;;
9020                         esac
9021                 else
9022                         dflt="$fpossize"
9023                         echo " "
9024                         echo "(I can't compile the test program.  Guessing...)" >&4
9025                         rp="What is the size of your file positions (in bytes)?"
9026                         . ./myread
9027                         fpossize="$ans"
9028                 fi
9029                 $rm -f try.c try
9030         fi
9031         ;;
9032 esac
9033
9034 case "$vendorprefix" in
9035 '')     d_vendorbin="$undef"
9036         vendorbin=''
9037         vendorbinexp=''
9038         ;;
9039 *)      d_vendorbin="$define"
9040         : determine where vendor-supplied executables go.
9041         case "$vendorbin" in
9042         '') dflt=$vendorprefix/bin ;;
9043         *)      dflt="$vendorbin" ;;
9044         esac
9045         fn=d~+
9046         rp='Pathname for the vendor-supplied executables directory?'
9047         . ./getfile
9048         vendorbin="$ans"
9049         vendorbinexp="$ansexp"
9050         ;;
9051 esac
9052 prefixvar=vendorbin
9053 . ./installprefix
9054
9055 case "$vendorprefix" in
9056 '')     vendorhtml1dir=''
9057         vendorhtml1direxp=''
9058         ;;
9059 *)      : determine where vendor-supplied html pages go.
9060         : There is no standard location, so try to copy the previously-selected
9061         : directory structure for the core html pages.
9062         : XXX Better default suggestions would be welcome.
9063         case "$vendorhtml1dir" in
9064         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9065         *)      dflt=$vendorhtml1dir ;;
9066         esac
9067         case "$dflt" in
9068         ''|' ') dflt=none ;;
9069         esac
9070         fn=dn+~
9071         rp='Pathname for the vendor-supplied html pages?'
9072         . ./getfile
9073         vendorhtml1dir="$ans"
9074         vendorhtml1direxp="$ansexp"
9075         ;;
9076 esac
9077 : Use ' ' for none so value is preserved next time through Configure
9078 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9079 prefixvar=vendorhtml1dir
9080 . ./installprefix
9081
9082 case "$vendorprefix" in
9083 '')     vendorhtml3dir=''
9084         vendorhtml3direxp=''
9085         ;;
9086 *)      : determine where vendor-supplied module html pages go.
9087         : There is no standard location, so try to copy the previously-selected
9088         : directory structure for the core html pages.
9089         : XXX Better default suggestions would be welcome.
9090         case "$vendorhtml3dir" in
9091         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9092         *)      dflt=$vendorhtml3dir ;;
9093         esac
9094         case "$dflt" in
9095         ''|' ') dflt=none ;;
9096         esac
9097         fn=dn+~
9098         rp='Pathname for the vendor-supplied html pages?'
9099         . ./getfile
9100         vendorhtml3dir="$ans"
9101         vendorhtml3direxp="$ansexp"
9102         ;;
9103 esac
9104 : Use ' ' for none so value is preserved next time through Configure
9105 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9106 prefixvar=vendorhtml3dir
9107 . ./installprefix
9108
9109 case "$vendorprefix" in
9110 '')     vendorman1dir=''
9111         vendorman1direxp=''
9112         ;;
9113 *)      : determine where vendor-supplied manual pages go.
9114         case "$vendorman1dir" in
9115         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9116         *)      dflt=$vendorman1dir ;;
9117         esac
9118         case "$dflt" in
9119         ''|' ') dflt=none ;;
9120         esac
9121         fn=nd~+
9122         rp='Pathname for the vendor-supplied manual section 1 pages?'
9123         . ./getfile
9124         vendorman1dir="$ans"
9125         vendorman1direxp="$ansexp"
9126         ;;
9127 esac
9128 : Use ' ' for none so value is preserved next time through Configure
9129 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9130 prefixvar=vendorman1dir
9131 . ./installprefix
9132
9133 case "$vendorprefix" in
9134 '')     vendorman3dir=''
9135         vendorman3direxp=''
9136         ;;
9137 *)      : determine where vendor-supplied module manual pages go.
9138         case "$vendorman3dir" in
9139         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9140         *)      dflt=$vendorman3dir ;;
9141         esac
9142         case "$dflt" in
9143         ''|' ') dflt=none ;;
9144         esac
9145         fn=nd~+
9146         rp='Pathname for the vendor-supplied manual section 3 pages?'
9147         . ./getfile
9148         vendorman3dir="$ans"
9149         vendorman3direxp="$ansexp"
9150         ;;
9151 esac
9152 : Use ' ' for none so value is preserved next time through Configure
9153 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9154 prefixvar=vendorman3dir
9155 . ./installprefix
9156
9157 case "$vendorprefix" in
9158 '')     d_vendorscript="$undef"
9159         vendorscript=''
9160         vendorscriptexp=''
9161         ;;
9162 *)      d_vendorscript="$define"
9163         : determine where vendor-supplied scripts go.
9164         case "$vendorscript" in
9165         '')     dflt=$vendorprefix/script
9166                 $test -d $dflt || dflt=$vendorbin ;;
9167         *)  dflt="$vendorscript" ;;
9168         esac
9169         $cat <<EOM
9170
9171 The installation process will create a directory for
9172 vendor-supplied scripts.
9173
9174 EOM
9175         fn=d~+
9176         rp='Pathname for the vendor-supplied scripts directory?'
9177         . ./getfile
9178         vendorscript="$ans"
9179         vendorscriptexp="$ansexp"
9180         ;;
9181 esac
9182 prefixvar=vendorscript
9183 . ./installprefix
9184
9185 : see if qgcvt exists
9186 set qgcvt d_qgcvt
9187 eval $inlibc
9188
9189 echo " "
9190
9191 if $test X"$d_longdbl" = X"$define"; then
9192
9193 echo "Checking how to print long doubles..." >&4
9194
9195 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9196         $cat >try.c <<'EOCP'
9197 #include <sys/types.h>
9198 #include <stdio.h>
9199 int main() {
9200   double d = 123.456;
9201   printf("%.3f\n", d);
9202 }
9203 EOCP
9204         set try
9205         if eval $compile; then
9206                 yyy=`$run ./try`
9207                 case "$yyy" in
9208                 123.456)
9209                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9210                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9211                         echo "We will use %f."
9212                         ;;
9213                 esac
9214         fi
9215 fi
9216
9217 if $test X"$sPRIfldbl" = X; then
9218         $cat >try.c <<'EOCP'
9219 #include <sys/types.h>
9220 #include <stdio.h>
9221 int main() {
9222   long double d = 123.456;
9223   printf("%.3Lf\n", d);
9224 }
9225 EOCP
9226         set try
9227         if eval $compile; then
9228                 yyy=`$run ./try`
9229                 case "$yyy" in
9230                 123.456)
9231                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9232                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9233                         echo "We will use %Lf."
9234                         ;;
9235                 esac
9236         fi
9237 fi
9238
9239 if $test X"$sPRIfldbl" = X; then
9240         $cat >try.c <<'EOCP'
9241 #include <sys/types.h>
9242 #include <stdio.h>
9243 int main() {
9244   long double d = 123.456;
9245   printf("%.3llf\n", d);
9246 }
9247 EOCP
9248         set try
9249         if eval $compile; then
9250                 yyy=`$run ./try`
9251                 case "$yyy" in
9252                 123.456)
9253                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9254                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9255                         echo "We will use %llf."
9256                         ;;
9257                 esac
9258         fi
9259 fi
9260
9261 if $test X"$sPRIfldbl" = X; then
9262         $cat >try.c <<'EOCP'
9263 #include <sys/types.h>
9264 #include <stdio.h>
9265 int main() {
9266   long double d = 123.456;
9267   printf("%.3lf\n", d);
9268 }
9269 EOCP
9270         set try
9271         if eval $compile; then
9272                 yyy=`$run ./try`
9273                 case "$yyy" in
9274                 123.456)
9275                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9276                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9277                         echo "We will use %lf."
9278                         ;;
9279                 esac
9280         fi
9281 fi
9282
9283 if $test X"$sPRIfldbl" = X; then
9284         echo "Cannot figure out how to print long doubles." >&4
9285 else
9286         sSCNfldbl=$sPRIfldbl    # expect consistency
9287 fi
9288
9289 $rm -f try try.*
9290
9291 fi # d_longdbl
9292
9293 case "$sPRIfldbl" in
9294 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9295         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9296         d_SCNfldbl="$undef";
9297         ;;
9298 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9299         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9300         d_SCNfldbl="$define";
9301         ;;
9302 esac
9303
9304 : Check how to convert floats to strings.
9305
9306 if test "X$d_Gconvert" = X; then
9307
9308 echo " "
9309 echo "Checking for an efficient way to convert floats to strings."
9310 echo " " > try.c
9311 case "$uselongdouble" in
9312 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9313 esac
9314 case "$d_longdbl" in
9315 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9316 esac
9317 case "$d_PRIgldbl" in
9318 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9319 esac
9320 $cat >>try.c <<EOP
9321 #ifdef TRY_gconvert
9322 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9323 char *myname = "gconvert";
9324 #endif
9325 #ifdef TRY_gcvt
9326 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9327 char *myname = "gcvt";
9328 #endif
9329 #ifdef TRY_qgcvt
9330 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9331 char *myname = "qgcvt";
9332 #define DOUBLETYPE long double
9333 #endif
9334 #ifdef TRY_sprintf
9335 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9336 #ifdef HAS_PRIgldbl
9337 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9338 #else
9339 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9340 #endif
9341 #else
9342 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9343 #endif
9344 char *myname = "sprintf";
9345 #endif
9346
9347 #ifndef DOUBLETYPE
9348 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9349 #define DOUBLETYPE long double
9350 #else
9351 #define DOUBLETYPE double
9352 #endif
9353 #endif
9354
9355 #include <stdio.h>
9356
9357 #define I_STDLIB $i_stdlib
9358 #ifdef I_STDLIB
9359 #include <stdlib.h>
9360 #endif
9361
9362 int
9363 checkit(expect, got)
9364 char *expect;
9365 char *got;
9366 {
9367     if (strcmp(expect, got)) {
9368                 printf("%s oddity:  Expected %s, got %s\n",
9369                         myname, expect, got);
9370                 exit(1);
9371         }
9372 }
9373
9374 int main()
9375
9376         char buf[64]; 
9377         buf[63] = '\0';
9378
9379         /* This must be 1st test on (which?) platform */
9380         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9381         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9382         checkit("0.1", buf);
9383
9384         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9385         checkit("0.01", buf);
9386
9387         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9388         checkit("0.001", buf);
9389
9390         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9391         checkit("0.0001", buf);
9392
9393         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9394         if (strlen(buf) > 5)
9395             checkit("9e-005", buf); /* for Microsoft ?? */
9396         else
9397             checkit("9e-05", buf);
9398
9399         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9400         checkit("1", buf);
9401
9402         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9403         checkit("1.1", buf);
9404
9405         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9406         checkit("1.01", buf);
9407
9408         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9409         checkit("1.001", buf);
9410
9411         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9412         checkit("1.0001", buf);
9413
9414         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9415         checkit("1.00001", buf);
9416
9417         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9418         checkit("1.000001", buf);
9419
9420         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9421         checkit("0", buf);
9422
9423         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9424         checkit("-1", buf);
9425
9426         /* Some Linux gcvt's give 1.e+5 here. */
9427         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9428         checkit("100000", buf);
9429         
9430         /* Some Linux gcvt's give -1.e+5 here. */
9431         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9432         checkit("-100000", buf);
9433
9434         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9435         checkit("123.456", buf);
9436
9437         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9438         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9439         /* 34 should be enough to scare even long double
9440          * places into using the e notation. */
9441         if (strlen(buf) > 5)
9442             checkit("1e+034", buf); /* for Microsoft */
9443         else
9444             checkit("1e+34", buf);
9445
9446         /* For Perl, if you add additional tests here, also add them to
9447          * t/base/num.t for benefit of platforms not using Configure or
9448          * overriding d_Gconvert */
9449
9450         exit(0);
9451 }
9452 EOP
9453 : first add preferred functions to our list
9454 xxx_list=""
9455 for xxx_convert in $gconvert_preference; do
9456     case $xxx_convert in
9457     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9458     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9459     esac 
9460 done
9461 : then add any others
9462 for xxx_convert in gconvert gcvt sprintf; do
9463     case "$xxx_list" in
9464     *$xxx_convert*) ;;
9465     *) xxx_list="$xxx_list $xxx_convert" ;;
9466     esac 
9467 done
9468
9469 case "$d_longdbl$uselongdouble" in
9470 "$define$define")
9471     : again, add prefered functions to our list first
9472     xxx_ld_list=""
9473     for xxx_convert in $gconvert_ld_preference; do
9474         case $xxx_convert in
9475         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9476         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9477         esac
9478     done
9479     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9480     for xxx_convert in qgcvt sprintf $xxx_list; do
9481         case "$xxx_ld_list" in
9482         $xxx_convert*|*" $xxx_convert"*) ;;
9483         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9484         esac
9485     done
9486     : if sprintf cannot do long doubles, move it to the end
9487     if test "$d_PRIgldbl" != "$define"; then
9488         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9489     fi
9490     : if no qgcvt, remove it
9491     if test "$d_qgcvt" != "$define"; then
9492         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9493     fi
9494     : use the ld_list
9495     xxx_list="$xxx_ld_list"
9496     ;;
9497 esac
9498
9499 for xxx_convert in $xxx_list; do
9500         echo "Trying $xxx_convert..."
9501         $rm -f try try$_o
9502         set try -DTRY_$xxx_convert
9503         if eval $compile; then
9504                 echo "$xxx_convert() found." >&4
9505                 if $run ./try; then
9506                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9507                         break;
9508                 else
9509                         echo "...But $xxx_convert didn't work as I expected."
9510                         xxx_convert=''
9511                 fi
9512         else
9513                 echo "$xxx_convert NOT found." >&4
9514         fi
9515 done
9516
9517 if test X$xxx_convert = X; then
9518     echo "*** WHOA THERE!!! ***" >&4
9519     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9520     xxx_convert=sprintf
9521 fi
9522
9523 case "$xxx_convert" in
9524 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9525 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9526 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9527 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9528    "$define$define$define")
9529       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9530    "$define$define$undef")
9531       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9532    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9533    esac
9534    ;;  
9535 esac
9536
9537 fi
9538
9539 : see if _fwalk exists
9540 set fwalk d__fwalk
9541 eval $inlibc
9542
9543 : Initialize h_fcntl
9544 h_fcntl=false
9545
9546 : Initialize h_sysfile
9547 h_sysfile=false
9548
9549 : access call always available on UNIX
9550 set access d_access
9551 eval $inlibc
9552
9553 : locate the flags for 'access()'
9554 case "$d_access" in
9555 "$define")
9556         echo " "
9557         $cat >access.c <<EOCP
9558 #include <sys/types.h>
9559 #ifdef I_FCNTL
9560 #include <fcntl.h>
9561 #endif
9562 #ifdef I_SYS_FILE
9563 #include <sys/file.h>
9564 #endif
9565 #ifdef I_UNISTD
9566 #include <unistd.h>
9567 #endif
9568 #$i_stdlib I_STDLIB
9569 #ifdef I_STDLIB
9570 #include <stdlib.h>
9571 #endif
9572 int main() {
9573         exit(R_OK);
9574 }
9575 EOCP
9576         : check sys/file.h first, no particular reason here
9577         if $test `./findhdr sys/file.h` && \
9578                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9579                 h_sysfile=true;
9580                 echo "<sys/file.h> defines the *_OK access constants." >&4
9581         elif $test `./findhdr fcntl.h` && \
9582                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9583                 h_fcntl=true;
9584                 echo "<fcntl.h> defines the *_OK access constants." >&4
9585         elif $test `./findhdr unistd.h` && \
9586                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9587                 echo "<unistd.h> defines the *_OK access constants." >&4
9588         else
9589                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9590         fi
9591         ;;
9592 esac
9593 $rm -f access*
9594
9595 : see if accessx exists
9596 set accessx d_accessx
9597 eval $inlibc
9598
9599 : see if aintl exists
9600 set aintl d_aintl
9601 eval $inlibc
9602
9603 : see if alarm exists
9604 set alarm d_alarm
9605 eval $inlibc
9606
9607 : see if POSIX threads are available
9608 set pthread.h i_pthread
9609 eval $inhdr
9610
9611 : define a fucntion to check prototypes
9612 $cat > protochk <<EOSH
9613 $startsh
9614 cc="$cc"
9615 optimize="$optimize"
9616 ccflags="$ccflags"
9617 prototype="$prototype"
9618 define="$define"
9619 rm=$rm
9620 usethreads=$usethreads
9621 i_pthread=$i_pthread
9622 pthread_h_first=$pthread_h_first
9623 EOSH
9624
9625 $cat >> protochk <<'EOSH'
9626
9627 $rm -f try.c
9628 foo="$1"
9629 shift
9630 while test $# -ge 2; do
9631         case "$1" in
9632                 $define) echo "#include <$2>" >> try.c ;;
9633                 literal) echo "$2" >> try.c ;;
9634         esac
9635     # Extra magic for the benefit of systems that need pthread.h
9636     # to be included early to correctly detect threadsafe functions.
9637     # Such functions must guarantee themselves, though, that the usethreads
9638     # and i_pthread have been defined, before calling protochk.
9639     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9640         echo "#include <pthread.h>" >> try.c
9641         pthread_h_done=yes
9642     fi
9643     shift 2
9644 done
9645 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9646 cat >> try.c <<'EOCP'
9647 #ifdef CAN_PROTOTYPE
9648 #define _(args) args
9649 #else
9650 #define _(args) ()
9651 #endif
9652 EOCP
9653 echo "$foo" >> try.c
9654 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9655 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9656 status=$?
9657 $rm -f try.[co]
9658 exit $status
9659 EOSH
9660 chmod +x protochk
9661 $eunicefix protochk
9662
9663 hasproto='varname=$1; func=$2; shift; shift;
9664 while $test $# -ge 2; do
9665         case "$1" in
9666         $define) echo "#include <$2>";;
9667         esac ;
9668     shift 2;
9669 done > try.c;
9670 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9671 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9672         echo "$func() prototype found.";
9673         val="$define";
9674 else
9675         echo "$func() prototype NOT found.";
9676         val="$undef";
9677 fi;
9678 set $varname;
9679 eval $setvar;
9680 $rm -f try.c tryout.c'
9681
9682 : see if sys/types.h has to be included
9683 set sys/types.h i_systypes
9684 eval $inhdr
9685
9686 : see if sys/select.h has to be included
9687 set sys/select.h i_sysselct
9688 eval $inhdr
9689
9690 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9691 while $test $# -ge 2; do
9692         case "$1" in
9693         $define) echo "#include <$2>";;
9694         esac ;
9695     shift 2;
9696 done > try.c;
9697 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9698 set try;
9699 if eval $compile; then
9700         val="$define";
9701 else
9702         val="$undef";
9703 fi;
9704 set $varname;
9705 eval $setvar;
9706 $rm -f try.c try.o'
9707
9708 : see if we should include time.h, sys/time.h, or both
9709 echo " "
9710 if test "X$timeincl" = X; then
9711         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9712         $echo $n "I'm now running the test program...$c"
9713         $cat >try.c <<EOCP
9714 #include <sys/types.h>
9715 #ifdef I_TIME
9716 #include <time.h>
9717 #endif
9718 #ifdef I_SYSTIME
9719 #ifdef SYSTIMEKERNEL
9720 #define KERNEL
9721 #endif
9722 #include <sys/time.h>
9723 #endif
9724 #ifdef I_SYSSELECT
9725 #include <sys/select.h>
9726 #endif
9727 #$i_stdlib I_STDLIB
9728 #ifdef I_STDLIB
9729 #include <stdlib.h>
9730 #endif
9731 int main()
9732 {
9733         struct tm foo;
9734 #ifdef S_TIMEVAL
9735         struct timeval bar;
9736 #endif
9737 #ifdef S_TIMEZONE
9738         struct timezone tzp;
9739 #endif
9740         if (foo.tm_sec == foo.tm_sec)
9741                 exit(0);
9742 #ifdef S_TIMEVAL
9743         if (bar.tv_sec == bar.tv_sec)
9744                 exit(0);
9745 #endif
9746         exit(1);
9747 }
9748 EOCP
9749         flags=''
9750         for s_timezone in '-DS_TIMEZONE' ''; do
9751         sysselect=''
9752         for s_timeval in '-DS_TIMEVAL' ''; do
9753         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9754         for i_time in '' '-DI_TIME'; do
9755         for i_systime in '-DI_SYSTIME' ''; do
9756                 case "$flags" in
9757                 '') $echo $n ".$c"
9758                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9759                         if eval $compile; then
9760                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9761                                 shift
9762                                 flags="$*"
9763                                 echo " "
9764                                 $echo $n "Succeeded with $flags$c"
9765                         fi
9766                         ;;
9767                 esac
9768         done
9769         done
9770         done
9771         done
9772         done
9773         timeincl=''
9774         echo " "
9775         case "$flags" in
9776         *SYSTIMEKERNEL*) i_systimek="$define"
9777                 timeincl=`./findhdr sys/time.h`
9778                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9779         *) i_systimek="$undef";;
9780         esac
9781         case "$flags" in
9782         *I_TIME*) i_time="$define"
9783                 timeincl=`./findhdr time.h`" $timeincl"
9784                 echo "We'll include <time.h>." >&4;;
9785         *) i_time="$undef";;
9786         esac
9787         case "$flags" in
9788         *I_SYSTIME*) i_systime="$define"
9789                 timeincl=`./findhdr sys/time.h`" $timeincl"
9790                 echo "We'll include <sys/time.h>." >&4;;
9791         *) i_systime="$undef";;
9792         esac
9793         $rm -f try.c try
9794 fi
9795 : see if struct tm knows about tm_zone
9796 case "$i_systime$i_time" in
9797 *$define*) 
9798         echo " "
9799         echo "Checking to see if your struct tm has tm_zone field..." >&4
9800         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9801         eval $hasfield
9802         ;;
9803 *)      val="$undef"
9804         set d_tm_tm_zone
9805         eval $setvar
9806         ;;
9807 esac
9808 case "$d_tm_tm_zone" in
9809 "$define")      echo "Yes, it does."   ;;
9810 *)              echo "No, it doesn't." ;;
9811 esac
9812 : see if struct tm knows about tm_gmtoff
9813 case "$i_systime$i_time" in
9814 *$define*) 
9815         echo " "
9816         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9817         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9818         eval $hasfield
9819         ;;
9820 *)      val="$undef"
9821         set d_tm_tm_gmtoff
9822         eval $setvar
9823         ;;
9824 esac
9825 case "$d_tm_tm_gmtoff" in
9826 "$define")      echo "Yes, it does."   ;;
9827 *)              echo "No, it doesn't." ;;
9828 esac
9829
9830 : see if asctime_r exists
9831 set asctime_r d_asctime_r
9832 eval $inlibc
9833 case "$d_asctime_r" in
9834 "$define")
9835         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9836         case "$d_asctime_r_proto:$usethreads" in
9837         ":define")      d_asctime_r_proto=define
9838                 set d_asctime_r_proto asctime_r $hdrs
9839                 eval $hasproto ;;
9840         *)      ;;
9841         esac
9842         case "$d_asctime_r_proto" in
9843         define)
9844         case "$asctime_r_proto" in
9845         ''|0) try='char* asctime_r(const struct tm*, char*);'
9846         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9847         esac
9848         case "$asctime_r_proto" in
9849         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9850         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9851         esac
9852         case "$asctime_r_proto" in
9853         ''|0) try='int asctime_r(const struct tm*, char*);'
9854         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9855         esac
9856         case "$asctime_r_proto" in
9857         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9858         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9859         esac
9860         case "$asctime_r_proto" in
9861         ''|0)   d_asctime_r=undef
9862                 asctime_r_proto=0
9863                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9864         * )     case "$asctime_r_proto" in
9865                 REENTRANT_PROTO*) ;;
9866                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9867                 esac
9868                 echo "Prototype: $try" ;;
9869         esac
9870         ;;
9871         *)      case "$usethreads" in
9872                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9873                 esac
9874                 d_asctime_r=undef
9875                 asctime_r_proto=0
9876                 ;;
9877         esac
9878         ;;
9879 *)      asctime_r_proto=0
9880         ;;
9881 esac
9882
9883 : see if atolf exists
9884 set atolf d_atolf
9885 eval $inlibc
9886
9887 : see if atoll exists
9888 set atoll d_atoll
9889 eval $inlibc
9890
9891 : Look for GCC-style attribute format
9892 case "$d_attribute_format" in
9893 '')
9894 echo " "
9895 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9896 $cat >attrib.c <<'EOCP'
9897 #include <stdio.h>
9898 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9899 EOCP
9900 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9901         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9902                 echo "Your C compiler doesn't support __attribute__((format))."
9903                 val="$undef"
9904         else
9905                 echo "Your C compiler supports __attribute__((format))."
9906                 val="$define"
9907         fi
9908 else
9909         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9910         val="$undef"
9911 fi
9912 ;;
9913 *) val="$d_attribute_format" ;;
9914 esac
9915 set d_attribute_format
9916 eval $setvar
9917 $rm -f attrib*
9918
9919 : Look for GCC-style attribute malloc
9920 case "$d_attribute_malloc" in
9921 '')
9922 echo " "
9923 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9924 $cat >attrib.c <<'EOCP'
9925 #include <stdio.h>
9926 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9927 EOCP
9928 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9929         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9930                 echo "Your C compiler doesn't support __attribute__((malloc))."
9931                 val="$undef"
9932         else
9933                 echo "Your C compiler supports __attribute__((malloc))."
9934                 val="$define"
9935         fi
9936 else
9937         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9938         val="$undef"
9939 fi
9940 ;;
9941 *) val="$d_attribute_malloc" ;;
9942 esac
9943 set d_attribute_malloc
9944 eval $setvar
9945 $rm -f attrib*
9946
9947 : Look for GCC-style attribute nonnull
9948 case "$d_attribute_nonnull" in
9949 '')
9950 echo " "
9951 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9952 $cat >attrib.c <<'EOCP'
9953 #include <stdio.h>
9954 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9955 EOCP
9956 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9957         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9958                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9959                 val="$undef"
9960         else
9961                 echo "Your C compiler supports __attribute__((nonnull))."
9962                 val="$define"
9963         fi
9964 else
9965         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9966         val="$undef"
9967 fi
9968 ;;
9969 *) val="$d_attribute_nonnull" ;;
9970 esac
9971 set d_attribute_nonnull
9972 eval $setvar
9973 $rm -f attrib*
9974
9975 : Look for GCC-style attribute noreturn
9976 case "$d_attribute_noreturn" in
9977 '')
9978 echo " "
9979 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9980 $cat >attrib.c <<'EOCP'
9981 #include <stdio.h>
9982 void fall_over_dead( void ) __attribute__((noreturn));
9983 EOCP
9984 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9985         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9986                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9987                 val="$undef"
9988         else
9989                 echo "Your C compiler supports __attribute__((noreturn))."
9990                 val="$define"
9991         fi
9992 else
9993         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9994         val="$undef"
9995 fi
9996 ;;
9997 *) val="$d_attribute_noreturn" ;;
9998 esac
9999 set d_attribute_noreturn
10000 eval $setvar
10001 $rm -f attrib*
10002
10003 : Look for GCC-style attribute pure
10004 case "$d_attribute_pure" in
10005 '')
10006 echo " "
10007 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10008 $cat >attrib.c <<'EOCP'
10009 #include <stdio.h>
10010 int square( int n ) __attribute__((pure));
10011 EOCP
10012 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10013         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10014                 echo "Your C compiler doesn't support __attribute__((pure))."
10015                 val="$undef"
10016         else
10017                 echo "Your C compiler supports __attribute__((pure))."
10018                 val="$define"
10019         fi
10020 else
10021         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10022         val="$undef"
10023 fi
10024 ;;
10025 *) val="$d_attribute_pure" ;;
10026 esac
10027 set d_attribute_pure
10028 eval $setvar
10029 $rm -f attrib*
10030
10031 : Look for GCC-style attribute unused
10032 case "$d_attribute_unused" in
10033 '')
10034 echo " "
10035 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10036 $cat >attrib.c <<'EOCP'
10037 #include <stdio.h>
10038 int do_something( int dummy __attribute__((unused)), int n );
10039 EOCP
10040 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10041         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10042                 echo "Your C compiler doesn't support __attribute__((unused))."
10043                 val="$undef"
10044         else
10045                 echo "Your C compiler supports __attribute__((unused))."
10046                 val="$define"
10047         fi
10048 else
10049         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10050         val="$undef"
10051 fi
10052 ;;
10053 *) val="$d_attribute_unused" ;;
10054 esac
10055 set d_attribute_unused
10056 eval $setvar
10057 $rm -f attrib*
10058
10059 : Look for GCC-style attribute warn_unused_result
10060 case "$d_attribute_warn_unused_result" in
10061 '')
10062 echo " "
10063 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10064 $cat >attrib.c <<'EOCP'
10065 #include <stdio.h>
10066 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10067 EOCP
10068 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10069         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10070                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10071                 val="$undef"
10072         else
10073                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10074                 val="$define"
10075         fi
10076 else
10077         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10078         val="$undef"
10079 fi
10080 ;;
10081 *) val="$d_attribute_warn_unused_result" ;;
10082 esac
10083 set d_attribute_warn_unused_result
10084 eval $setvar
10085 $rm -f attrib*
10086
10087 : see if bcmp exists
10088 set bcmp d_bcmp
10089 eval $inlibc
10090
10091 : see if bcopy exists
10092 set bcopy d_bcopy
10093 eval $inlibc
10094
10095 : see if this is a unistd.h system
10096 set unistd.h i_unistd
10097 eval $inhdr
10098
10099 : see if getpgrp exists
10100 set getpgrp d_getpgrp
10101 eval $inlibc
10102
10103 case "$d_getpgrp" in
10104 "$define")
10105         echo " "
10106         echo "Checking to see which flavor of getpgrp is in use..."
10107         $cat >try.c <<EOP
10108 #$i_unistd I_UNISTD
10109 #include <sys/types.h>
10110 #ifdef I_UNISTD
10111 #  include <unistd.h>
10112 #endif
10113 #$i_stdlib I_STDLIB
10114 #ifdef I_STDLIB
10115 #include <stdlib.h>
10116 #endif
10117 int main()
10118 {
10119         if (getuid() == 0) {
10120                 printf("(I see you are running Configure as super-user...)\n");
10121                 setuid(1);
10122         }
10123 #ifdef TRY_BSD_PGRP
10124         if (getpgrp(1) == 0)
10125                 exit(0);
10126 #else
10127         if (getpgrp() > 0)
10128                 exit(0);
10129 #endif
10130         exit(1);
10131 }
10132 EOP
10133         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10134                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10135                 val="$define"
10136         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10137                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10138                 val="$undef"
10139         else
10140                 echo "I can't seem to compile and run the test program."
10141                 if ./usg; then
10142                         xxx="a USG one, i.e. you use getpgrp()."
10143                 else
10144                         # SVR4 systems can appear rather BSD-ish.
10145                         case "$i_unistd" in
10146                         $undef)
10147                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10148                                 val="$define"
10149                                 ;;
10150                         $define)
10151                                 xxx="probably a USG one, i.e. you use getpgrp()."
10152                                 val="$undef"
10153                                 ;;
10154                         esac
10155                 fi
10156                 echo "Assuming your getpgrp is $xxx" >&4
10157         fi
10158         ;;
10159 *) val="$undef";;
10160 esac
10161 set d_bsdgetpgrp
10162 eval $setvar
10163 $rm -f try try.*
10164
10165 : see if setpgrp exists
10166 set setpgrp d_setpgrp
10167 eval $inlibc
10168
10169 case "$d_setpgrp" in
10170 "$define")
10171         echo " "
10172         echo "Checking to see which flavor of setpgrp is in use..."
10173         $cat >try.c <<EOP
10174 #$i_unistd I_UNISTD
10175 #include <sys/types.h>
10176 #ifdef I_UNISTD
10177 #  include <unistd.h>
10178 #endif
10179 #$i_stdlib I_STDLIB
10180 #ifdef I_STDLIB
10181 #include <stdlib.h>
10182 #endif
10183 int main()
10184 {
10185         if (getuid() == 0) {
10186                 printf("(I see you are running Configure as super-user...)\n");
10187                 setuid(1);
10188         }
10189 #ifdef TRY_BSD_PGRP
10190         if (-1 == setpgrp(1, 1))
10191                 exit(0);
10192 #else
10193         if (setpgrp() != -1)
10194                 exit(0);
10195 #endif
10196         exit(1);
10197 }
10198 EOP
10199         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10200                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10201                 val="$define"
10202         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10203                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10204                 val="$undef"
10205         else
10206                 echo "(I can't seem to compile and run the test program.)"
10207                 if ./usg; then
10208                         xxx="a USG one, i.e. you use setpgrp()."
10209                 else
10210                         # SVR4 systems can appear rather BSD-ish.
10211                         case "$i_unistd" in
10212                         $undef)
10213                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10214                                 val="$define"
10215                                 ;;
10216                         $define)
10217                                 xxx="probably a USG one, i.e. you use setpgrp()."
10218                                 val="$undef"
10219                                 ;;
10220                         esac
10221                 fi
10222                 echo "Assuming your setpgrp is $xxx" >&4
10223         fi
10224         ;;
10225 *) val="$undef";;
10226 esac
10227 set d_bsdsetpgrp
10228 eval $setvar
10229 $rm -f try try.*
10230 : Look for GCC-style __builtin_choose_expr
10231 case "$d_builtin_choose_expr" in
10232 '')
10233     echo " "
10234     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10235     $cat >try.c <<'EOCP'
10236 #include <assert.h>
10237 #include <stdlib.h>
10238 #include <stdio.h>
10239
10240 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10241
10242 int main(void) {
10243     assert( SYRINX(1) == 2112 );
10244     assert( SYRINX(1) != 5150 );
10245     assert( SYRINX(0) == 5150 );
10246     assert( SYRINX(0) != 2112 );
10247     puts( "All good!" );
10248     exit(0);
10249 }
10250
10251 EOCP
10252     set try
10253     if eval $compile; then
10254         echo "Your C compiler supports __builtin_choose_expr."
10255         val="$define"
10256     else
10257         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10258         val="$undef"
10259     fi
10260 ;;
10261 *) val="$d_builtin_choose_expr" ;;
10262 esac
10263
10264 set d_builtin_choose_expr
10265 eval $setvar
10266 $rm -f try.* try core core.try.*
10267
10268 : Look for GCC-style __builtin_expect
10269 case "$d_builtin_expect" in
10270 '')
10271     echo " "
10272     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10273     $cat >builtin.c <<'EOCP'
10274 int main(void) {
10275     int n = 50;
10276     if ( __builtin_expect(n, 0) ) n = 1;
10277 }
10278 EOCP
10279     set try
10280     if eval $compile; then
10281         echo "Your C compiler supports __builtin_choose_expr."
10282         val="$define"
10283     else
10284         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10285         val="$undef"
10286     fi
10287     ;;
10288 *) val="$d_builtin_expect" ;;
10289 esac
10290
10291 set d_builtin_expect
10292 eval $setvar
10293 $rm -f try.* try core core.try.*
10294
10295 : see if bzero exists
10296 set bzero d_bzero
10297 eval $inlibc
10298
10299 : see if signal is declared as pointer to function returning int or void
10300 echo " "
10301 xxx=`./findhdr signal.h`
10302 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10303 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10304         echo "You have int (*signal())() instead of void." >&4
10305         val="$undef"
10306 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10307         echo "You have void (*signal())()." >&4
10308         val="$define"
10309 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10310         echo "You have int (*signal())() instead of void." >&4
10311         val="$undef"
10312 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10313         echo "You have void (*signal())()." >&4
10314         val="$define"
10315 else
10316         case "$d_voidsig" in
10317         '')
10318         echo "I can't determine whether signal handler returns void or int..." >&4
10319                 dflt=void
10320                 rp="What type does your signal handler return?"
10321                 . ./myread
10322                 case "$ans" in
10323                 v*) val="$define";;
10324                 *) val="$undef";;
10325                 esac;;
10326         "$define")
10327                 echo "As you already told me, signal handler returns void." >&4
10328                 val="$define"
10329                 ;;
10330         *)      echo "As you already told me, signal handler returns int." >&4
10331                 val="$undef"
10332                 ;;
10333         esac
10334 fi
10335 set d_voidsig
10336 eval $setvar
10337 case "$d_voidsig" in
10338 "$define") signal_t="void";;
10339 *) signal_t="int";;
10340 esac
10341 $rm -f $$.tmp
10342
10343 : check for ability to cast large floats to 32-bit ints.
10344 echo " "
10345 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10346 if $test "$intsize" -ge 4; then
10347         xxx=int
10348 else
10349         xxx=long
10350 fi
10351 $cat >try.c <<EOCP
10352 #include <stdio.h>
10353 #$i_stdlib I_STDLIB
10354 #ifdef I_STDLIB
10355 #include <stdlib.h>
10356 #endif
10357 #include <sys/types.h>
10358 #include <signal.h>
10359 $signal_t blech(s) int s; { exit(3); }
10360 int main()
10361 {
10362         $xxx i32;
10363         double f, g;
10364         int result = 0;
10365         char str[16];
10366         signal(SIGFPE, blech);
10367
10368         /* Don't let compiler optimize the test away.  Store the number 
10369            in a writable string for gcc to pass to sscanf under HP/UX.
10370         */
10371         sprintf(str, "2147483647");
10372         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10373         g = 10 * f;
10374         i32  = ($xxx) g;
10375
10376         /* x86 processors will probably give 0x8000 0000, which is a
10377            sign change.  We don't want that.  We want to mimic SPARC
10378            behavior here, which is to preserve the sign and give
10379            back 0x7fff ffff.
10380         */
10381         if (i32 != ($xxx) f)
10382                 result |= 1;
10383         exit(result);
10384 }
10385 EOCP
10386 set try
10387 if eval $compile_ok; then
10388         $run ./try
10389         yyy=$?
10390 else
10391         echo "(I can't seem to compile the test program--assuming it can't)"
10392         yyy=1
10393 fi
10394 case "$yyy" in
10395 0)      val="$define"
10396         echo "Yup, it can."
10397         ;;
10398 *)      val="$undef"
10399         echo "Nope, it can't."
10400         ;;
10401 esac
10402 set d_casti32
10403 eval $setvar
10404 $rm -f try try.*
10405
10406 : check for ability to cast negative floats to unsigned
10407 echo " "
10408 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10409 $cat >try.c <<EOCP
10410 #include <stdio.h>
10411 #$i_stdlib I_STDLIB
10412 #ifdef I_STDLIB
10413 #include <stdlib.h>
10414 #endif
10415 #include <sys/types.h>
10416 #include <signal.h>
10417 $signal_t blech(s) int s; { exit(7); }
10418 $signal_t blech_in_list(s) int s; { exit(4); }
10419 unsigned long dummy_long(p) unsigned long p; { return p; }
10420 unsigned int dummy_int(p) unsigned int p; { return p; }
10421 unsigned short dummy_short(p) unsigned short p; { return p; }
10422 int main()
10423 {
10424         double f;
10425         unsigned long along;
10426         unsigned int aint;
10427         unsigned short ashort;
10428         int result = 0;
10429         char str[16];
10430         
10431         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10432            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10433            optimized the whole file away
10434         */
10435         /* Store the number in a writable string for gcc to pass to 
10436            sscanf under HP/UX.
10437         */
10438         sprintf(str, "-123");
10439         sscanf(str, "%lf", &f);  /* f = -123.; */
10440
10441         signal(SIGFPE, blech);
10442         along = (unsigned long)f;
10443         aint = (unsigned int)f;
10444         ashort = (unsigned short)f;
10445         if (along != (unsigned long)-123)
10446                 result |= 1;
10447         if (aint != (unsigned int)-123)
10448                 result |= 1;
10449         if (ashort != (unsigned short)-123)
10450                 result |= 1;
10451         sprintf(str, "1073741824.");
10452         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10453         f = f + f;
10454         along = 0;
10455         along = (unsigned long)f;
10456         if (along != 0x80000000)
10457                 result |= 2;
10458         f -= 1.;
10459         along = 0;
10460         along = (unsigned long)f;
10461         if (along != 0x7fffffff)
10462                 result |= 1;
10463         f += 2.;
10464         along = 0;
10465         along = (unsigned long)f;
10466         if (along != 0x80000001)
10467                 result |= 2;
10468         if (result)
10469                 exit(result);
10470         signal(SIGFPE, blech_in_list);
10471         sprintf(str, "123.");
10472         sscanf(str, "%lf", &f);  /* f = 123.; */
10473         along = dummy_long((unsigned long)f);
10474         aint = dummy_int((unsigned int)f);
10475         ashort = dummy_short((unsigned short)f);
10476         if (along != (unsigned long)123)
10477                 result |= 4;
10478         if (aint != (unsigned int)123)
10479                 result |= 4;
10480         if (ashort != (unsigned short)123)
10481                 result |= 4;
10482         exit(result);
10483
10484 }
10485 EOCP
10486 set try
10487 if eval $compile_ok; then
10488         $run ./try
10489         castflags=$?
10490 else
10491         echo "(I can't seem to compile the test program--assuming it can't)"
10492         castflags=7
10493 fi
10494 case "$castflags" in
10495 0)      val="$define"
10496         echo "Yup, it can."
10497         ;;
10498 *)      val="$undef"
10499         echo "Nope, it can't."
10500         ;;
10501 esac
10502 set d_castneg
10503 eval $setvar
10504 $rm -f try.*
10505
10506 : see if vprintf exists
10507 echo " "
10508 if set vprintf val -f d_vprintf; eval $csym; $val; then
10509         echo 'vprintf() found.' >&4
10510         val="$define"
10511         $cat >try.c <<EOF
10512 #include <varargs.h>
10513 #$i_stdlib I_STDLIB
10514 #ifdef I_STDLIB
10515 #include <stdlib.h>
10516 #endif
10517
10518 int main() { xxx("foo"); }
10519
10520 xxx(va_alist)
10521 va_dcl
10522 {
10523         va_list args;
10524         char buf[10];
10525
10526         va_start(args);
10527         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10528 }
10529 EOF
10530         set try
10531         if eval $compile && $run ./try; then
10532                 echo "Your vsprintf() returns (int)." >&4
10533                 val2="$undef"
10534         else
10535                 echo "Your vsprintf() returns (char*)." >&4
10536                 val2="$define"
10537         fi
10538 else
10539         echo 'vprintf() NOT found.' >&4
10540                 val="$undef"
10541                 val2="$undef"
10542 fi
10543 $rm -f try try.*
10544 set d_vprintf
10545 eval $setvar
10546 val=$val2
10547 set d_charvspr
10548 eval $setvar
10549
10550 : see if chown exists
10551 set chown d_chown
10552 eval $inlibc
10553
10554 : see if chroot exists
10555 set chroot d_chroot
10556 eval $inlibc
10557
10558 : see if chsize exists
10559 set chsize d_chsize
10560 eval $inlibc
10561
10562 : see if class exists
10563 set class d_class
10564 eval $inlibc
10565
10566 : see if clearenv exists
10567 set clearenv d_clearenv
10568 eval $inlibc
10569
10570 hasstruct='varname=$1; struct=$2; shift; shift;
10571 while $test $# -ge 2; do
10572         case "$1" in
10573         $define) echo "#include <$2>";;
10574         esac ;
10575     shift 2;
10576 done > try.c;
10577 echo "int main () { struct $struct foo; }" >> try.c;
10578 set try;
10579 if eval $compile; then
10580         val="$define";
10581 else
10582         val="$undef";
10583 fi;
10584 set $varname;
10585 eval $setvar;
10586 $rm -f try.c try.o'
10587
10588 socketlib=''
10589 sockethdr=''
10590 : see whether socket exists
10591 echo " "
10592 $echo $n "Hmm... $c" >&4
10593 if set socket val -f d_socket; eval $csym; $val; then
10594         echo "Looks like you have Berkeley networking support." >&4
10595         d_socket="$define"
10596         if set setsockopt val -f; eval $csym; $val; then
10597                 d_oldsock="$undef"
10598         else
10599                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10600                 d_oldsock="$define"
10601         fi
10602 else
10603         if $contains socklib libc.list >/dev/null 2>&1; then
10604                 echo "Looks like you have Berkeley networking support." >&4
10605                 d_socket="$define"
10606                 : we will have to assume that it supports the 4.2 BSD interface
10607                 d_oldsock="$undef"
10608         else
10609                 echo "You don't have Berkeley networking in libc$_a..." >&4
10610                 if test "X$d_socket" = "X$define"; then
10611                    echo "...but you seem to believe that you have sockets." >&4
10612                 else
10613                         for net in net socket
10614                         do
10615                                 if test -f /usr/lib/lib$net$_a; then
10616                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10617                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10618                                         if $contains socket libc.list >/dev/null 2>&1; then
10619                                                 d_socket="$define"
10620                                                 socketlib="-l$net"
10621                                                 case "$net" in
10622                                                 net)
10623                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10624                                                         sockethdr="-I/usr/netinclude"
10625                                                         ;;
10626                                                 esac
10627                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10628                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10629                                                         d_oldsock="$undef"
10630                                                 else
10631                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10632                                                         d_oldsock="$define"
10633                                                 fi
10634                                                 break
10635                                         fi
10636                                 fi
10637                         done
10638                         if test "X$d_socket" != "X$define"; then
10639                            echo "or anywhere else I see." >&4
10640                            d_socket="$undef"
10641                            d_oldsock="$undef"
10642                         fi
10643                 fi
10644         fi
10645 fi
10646
10647 : see if socketpair exists
10648 set socketpair d_sockpair
10649 eval $inlibc
10650
10651
10652 echo " "
10653 echo "Checking the availability of certain socket constants..." >&4
10654 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10655         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10656         $cat >try.c <<EOF
10657 #include <sys/types.h>
10658 #include <sys/socket.h>
10659 int main() {
10660     int i = $ENUM;
10661 }
10662 EOF
10663         val="$undef"
10664         set try; if eval $compile; then
10665                 val="$define"
10666         fi
10667         set d_${enum}; eval $setvar
10668         $rm -f try.c try
10669 done
10670
10671 : see if this is a sys/uio.h system
10672 set sys/uio.h i_sysuio
10673 eval $inhdr
10674
10675
10676 echo " "
10677 echo "Checking to see if your system supports struct cmsghdr..." >&4
10678 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10679 eval $hasstruct
10680 case "$d_cmsghdr_s" in
10681 "$define")      echo "Yes, it does."   ;;
10682 *)              echo "No, it doesn't." ;;
10683 esac
10684
10685
10686 : check for const keyword
10687 echo " "
10688 echo 'Checking to see if your C compiler knows about "const"...' >&4
10689 $cat >const.c <<'EOCP'
10690 typedef struct spug { int drokk; } spug;
10691 int main()
10692 {
10693         const char *foo;
10694         const spug y;
10695 }
10696 EOCP
10697 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10698         val="$define"
10699         echo "Yup, it does."
10700 else
10701         val="$undef"
10702         echo "Nope, it doesn't."
10703 fi
10704 set d_const
10705 eval $setvar
10706
10707 : see if copysignl exists
10708 set copysignl d_copysignl
10709 eval $inlibc
10710
10711 : see if crypt exists
10712 echo " "
10713 set crypt d_crypt
10714 eval $inlibc
10715 case "$d_crypt" in
10716 $define) cryptlib='' ;;
10717 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10718                 echo 'crypt() found.' >&4
10719                 val="$define"
10720                 cryptlib=''
10721         else
10722                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10723                 if $test -z "$cryptlib"; then
10724                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10725                 else
10726                         cryptlib=-lcrypt
10727                 fi
10728                 if $test -z "$cryptlib"; then
10729                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10730                 else
10731                         cryptlib=-lcrypt
10732                 fi
10733                 if $test -z "$cryptlib"; then
10734                         cryptlib=`./loc libcrypt$_a "" $libpth`
10735                 else
10736                         cryptlib=-lcrypt
10737                 fi
10738                 if $test -z "$cryptlib"; then
10739                         echo 'crypt() NOT found.' >&4
10740                         val="$undef"
10741                 else
10742                         val="$define"
10743                 fi
10744         fi
10745         set d_crypt
10746         eval $setvar
10747         ;;
10748 esac
10749
10750 : see if this is a crypt.h system
10751 set crypt.h i_crypt
10752 eval $inhdr
10753
10754 : see if crypt_r exists
10755 set crypt_r d_crypt_r
10756 eval $inlibc
10757 case "$d_crypt_r" in
10758 "$define")
10759         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10760         case "$d_crypt_r_proto:$usethreads" in
10761         ":define")      d_crypt_r_proto=define
10762                 set d_crypt_r_proto crypt_r $hdrs
10763                 eval $hasproto ;;
10764         *)      ;;
10765         esac
10766         case "$d_crypt_r_proto" in
10767         define)
10768         case "$crypt_r_proto" in
10769         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10770         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10771         esac
10772         case "$crypt_r_proto" in
10773         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10774         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10775         esac
10776         case "$crypt_r_proto" in
10777         ''|0)   d_crypt_r=undef
10778                 crypt_r_proto=0
10779                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10780         * )     case "$crypt_r_proto" in
10781                 REENTRANT_PROTO*) ;;
10782                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10783                 esac
10784                 echo "Prototype: $try" ;;
10785         esac
10786         ;;
10787         *)      case "$usethreads" in
10788                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10789                 esac
10790                 d_crypt_r=undef
10791                 crypt_r_proto=0
10792                 ;;
10793         esac
10794         ;;
10795 *)      crypt_r_proto=0
10796         ;;
10797 esac
10798
10799 : get csh whereabouts
10800 case "$csh" in
10801 'csh') val="$undef" ;;
10802 *) val="$define" ;;
10803 esac
10804 set d_csh
10805 eval $setvar
10806 : Respect a hint or command line value for full_csh.
10807 case "$full_csh" in
10808 '') full_csh=$csh ;;
10809 esac
10810
10811 : see if ctermid_r exists
10812 set ctermid_r d_ctermid_r
10813 eval $inlibc
10814 case "$d_ctermid_r" in
10815 "$define")
10816         hdrs="$i_systypes sys/types.h define stdio.h "
10817         case "$d_ctermid_r_proto:$usethreads" in
10818         ":define")      d_ctermid_r_proto=define
10819                 set d_ctermid_r_proto ctermid_r $hdrs
10820                 eval $hasproto ;;
10821         *)      ;;
10822         esac
10823         case "$d_ctermid_r_proto" in
10824         define)
10825         case "$ctermid_r_proto" in
10826         ''|0) try='char* ctermid_r(char*);'
10827         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10828         esac
10829         case "$ctermid_r_proto" in
10830         ''|0)   d_ctermid_r=undef
10831                 ctermid_r_proto=0
10832                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10833         * )     case "$ctermid_r_proto" in
10834                 REENTRANT_PROTO*) ;;
10835                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10836                 esac
10837                 echo "Prototype: $try" ;;
10838         esac
10839         ;;
10840         *)      case "$usethreads" in
10841                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10842                 esac
10843                 d_ctermid_r=undef
10844                 ctermid_r_proto=0
10845                 ;;
10846         esac
10847         ;;
10848 *)      ctermid_r_proto=0
10849         ;;
10850 esac
10851
10852 : see if ctime_r exists
10853 set ctime_r d_ctime_r
10854 eval $inlibc
10855 case "$d_ctime_r" in
10856 "$define")
10857         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10858         case "$d_ctime_r_proto:$usethreads" in
10859         ":define")      d_ctime_r_proto=define
10860                 set d_ctime_r_proto ctime_r $hdrs
10861                 eval $hasproto ;;
10862         *)      ;;
10863         esac
10864         case "$d_ctime_r_proto" in
10865         define)
10866         case "$ctime_r_proto" in
10867         ''|0) try='char* ctime_r(const time_t*, char*);'
10868         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10869         esac
10870         case "$ctime_r_proto" in
10871         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10872         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10873         esac
10874         case "$ctime_r_proto" in
10875         ''|0) try='int ctime_r(const time_t*, char*);'
10876         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10877         esac
10878         case "$ctime_r_proto" in
10879         ''|0) try='int ctime_r(const time_t*, char*, int);'
10880         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10881         esac
10882         case "$ctime_r_proto" in
10883         ''|0)   d_ctime_r=undef
10884                 ctime_r_proto=0
10885                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10886         * )     case "$ctime_r_proto" in
10887                 REENTRANT_PROTO*) ;;
10888                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10889                 esac
10890                 echo "Prototype: $try" ;;
10891         esac
10892         ;;
10893         *)      case "$usethreads" in
10894                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10895                 esac
10896                 d_ctime_r=undef
10897                 ctime_r_proto=0
10898                 ;;
10899         esac
10900         ;;
10901 *)      ctime_r_proto=0
10902         ;;
10903 esac
10904
10905 : see if cuserid exists
10906 set cuserid d_cuserid
10907 eval $inlibc
10908
10909 : see if this is a limits.h system
10910 set limits.h i_limits
10911 eval $inhdr
10912
10913 : see if this is a float.h system
10914 set float.h i_float
10915 eval $inhdr
10916
10917 : See if number of significant digits in a double precision number is known
10918 echo " "
10919 $cat >dbl_dig.c <<EOM
10920 #$i_limits I_LIMITS
10921 #$i_float I_FLOAT
10922 #ifdef I_LIMITS
10923 #include <limits.h>
10924 #endif
10925 #ifdef I_FLOAT
10926 #include <float.h>
10927 #endif
10928 #ifdef DBL_DIG
10929 printf("Contains DBL_DIG");
10930 #endif
10931 EOM
10932 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10933 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10934         echo "DBL_DIG found." >&4
10935         val="$define"
10936 else
10937         echo "DBL_DIG NOT found." >&4
10938         val="$undef"
10939 fi
10940 $rm -f dbl_dig.?
10941 set d_dbl_dig
10942 eval $setvar
10943
10944 : see if dbm.h is available
10945 : see if dbmclose exists
10946 set dbmclose d_dbmclose
10947 eval $inlibc
10948
10949 case "$d_dbmclose" in
10950 $define)
10951         set dbm.h i_dbm
10952         eval $inhdr
10953         case "$i_dbm" in
10954         $define)
10955                 val="$undef"
10956                 set i_rpcsvcdbm
10957                 eval $setvar
10958                 ;;
10959         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10960                 eval $inhdr
10961                 ;;
10962         esac
10963         ;;
10964 *)      echo "We won't be including <dbm.h>"
10965         val="$undef"
10966         set i_dbm
10967         eval $setvar
10968         val="$undef"
10969         set i_rpcsvcdbm
10970         eval $setvar
10971         ;;
10972 esac
10973
10974 : see if prototype for dbminit is available
10975 echo " "
10976 set d_dbminitproto dbminit $i_dbm dbm.h
10977 eval $hasproto
10978
10979 : see if difftime exists
10980 set difftime d_difftime
10981 eval $inlibc
10982
10983 : see if this is a dirent system
10984 echo " "
10985 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10986         val="$define"
10987         echo "<dirent.h> found." >&4
10988 else
10989         val="$undef"
10990         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10991                 echo "<sys/dir.h> found." >&4
10992                 echo " "
10993         else
10994                 xinc=`./findhdr sys/ndir.h`
10995         fi
10996         echo "<dirent.h> NOT found." >&4
10997 fi
10998 set i_dirent
10999 eval $setvar
11000
11001 : Look for type of directory structure.
11002 echo " "
11003 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11004
11005 case "$direntrytype" in
11006 ''|' ')
11007         case "$i_dirent" in
11008         $define) guess1='struct dirent' ;;
11009         *) guess1='struct direct'  ;;
11010         esac
11011         ;;
11012 *)      guess1="$direntrytype"
11013         ;;
11014 esac
11015
11016 case "$guess1" in
11017 'struct dirent') guess2='struct direct' ;;
11018 *) guess2='struct dirent' ;;
11019 esac
11020                 
11021 if $contains "$guess1" try.c >/dev/null 2>&1; then
11022         direntrytype="$guess1"
11023         echo "Your directory entries are $direntrytype." >&4
11024 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11025         direntrytype="$guess2"
11026         echo "Your directory entries seem to be $direntrytype." >&4
11027 else
11028         echo "I don't recognize your system's directory entries." >&4
11029         rp="What type is used for directory entries on this system?"
11030         dflt="$guess1"
11031         . ./myread
11032         direntrytype="$ans"
11033 fi
11034 $rm -f try.c
11035
11036
11037 : see if the directory entry stores field length
11038 echo " "
11039 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11040 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11041         echo "Good, your directory entry keeps length information in d_namlen." >&4
11042         val="$define"
11043 else
11044         echo "Your directory entry does not know about the d_namlen field." >&4
11045         val="$undef"
11046 fi
11047 set d_dirnamlen
11048 eval $setvar
11049 $rm -f try.c
11050
11051 : see if this is an sysdir system
11052 set sys/dir.h i_sysdir
11053 eval $inhdr
11054
11055 : see if this is an sysndir system
11056 set sys/ndir.h i_sysndir
11057 eval $inhdr
11058
11059 : Look for dirfd
11060 echo " "
11061 $cat >dirfd.c <<EOM
11062 #include <stdio.h>
11063 #$i_stdlib I_STDLIB
11064 #ifdef I_STDLIB
11065 #include <stdlib.h>
11066 #endif
11067 #$i_dirent I_DIRENT             /**/
11068 #$i_sysdir I_SYS_DIR            /**/
11069 #$i_sysndir I_SYS_NDIR          /**/
11070 #$i_systypes I_SYS_TYPES        /**/
11071 #if defined(I_SYS_TYPES)
11072 #include <sys/types.h>
11073 #endif
11074 #if defined(I_DIRENT)
11075 #include <dirent.h>
11076 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11077 #include <sys/dir.h>
11078 #endif
11079 #else
11080 #ifdef I_SYS_NDIR
11081 #include <sys/ndir.h>
11082 #else
11083 #ifdef I_SYS_DIR
11084 #ifdef hp9000s500
11085 #include <ndir.h>       /* may be wrong in the future */
11086 #else
11087 #include <sys/dir.h>
11088 #endif
11089 #endif
11090 #endif
11091 #endif 
11092 int main() {
11093         DIR *dirp = opendir(".");
11094         if (dirfd(dirp) >= 0)
11095                 exit(0);
11096         else
11097                 exit(1);
11098 }
11099 EOM
11100 val=$undef
11101 set dirfd
11102 if eval $compile; then
11103         val="$define"
11104 fi
11105 case "$val" in
11106 $define)        echo "dirfd() found." >&4       ;;
11107 *)              echo "dirfd() NOT found." >&4   ;;
11108 esac
11109 set d_dirfd
11110 eval $setvar
11111 $rm -f dirfd*
11112
11113 : see if dlerror exists
11114 xxx_runnm="$runnm"
11115 runnm=false
11116 set dlerror d_dlerror
11117 eval $inlibc
11118 runnm="$xxx_runnm"
11119
11120 : see if dlfcn is available
11121 set dlfcn.h i_dlfcn
11122 eval $inhdr
11123
11124 case "$usedl" in
11125 $define|y|true)
11126         $cat << EOM
11127
11128 On a few systems, the dynamically loaded modules that perl generates and uses
11129 will need a different extension than shared libs. The default will probably
11130 be appropriate.
11131
11132 EOM
11133         case "$dlext" in
11134         '')     dflt="$so" ;;
11135         *)      dflt="$dlext" ;;
11136         esac
11137         rp='What is the extension of dynamically loaded modules'
11138         . ./myread
11139         dlext="$ans"
11140         ;;
11141 *)
11142         dlext="none"
11143         ;;
11144 esac
11145
11146 : Check if dlsym need a leading underscore
11147 echo " "
11148 val="$undef"
11149
11150 case "$dlsrc" in
11151 dl_dlopen.xs)
11152         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11153         $cat >dyna.c <<'EOM'
11154 fred () { }
11155 EOM
11156
11157 $cat >fred.c<<EOM
11158
11159 #include <stdio.h>
11160 #$i_stdlib I_STDLIB
11161 #ifdef I_STDLIB
11162 #include <stdlib.h>
11163 #endif
11164 #$i_dlfcn I_DLFCN
11165 #ifdef I_DLFCN
11166 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11167 #else
11168 #include <sys/types.h>
11169 #include <nlist.h>
11170 #include <link.h>
11171 #endif
11172
11173 extern int fred() ;
11174
11175 int main()
11176 {
11177     void * handle ;
11178     void * symbol ;
11179 #ifndef RTLD_LAZY
11180     int mode = 1 ;
11181 #else
11182     int mode = RTLD_LAZY ;
11183 #endif
11184     handle = dlopen("./dyna.$dlext", mode) ;
11185     if (handle == NULL) {
11186         printf ("1\n") ;
11187         fflush (stdout) ;
11188         exit(0);
11189     }
11190     symbol = dlsym(handle, "fred") ;
11191     if (symbol == NULL) {
11192         /* try putting a leading underscore */
11193         symbol = dlsym(handle, "_fred") ;
11194         if (symbol == NULL) {
11195             printf ("2\n") ;
11196             fflush (stdout) ;
11197             exit(0);
11198         }
11199         printf ("3\n") ;
11200     }
11201     else
11202         printf ("4\n") ;
11203     fflush (stdout) ;
11204     exit(0);
11205 }
11206 EOM
11207         : Call the object file tmp-dyna.o in case dlext=o.
11208         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11209                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11210                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11211                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11212                 xxx=`$run ./fred`
11213                 case $xxx in
11214                 1)      echo "Test program failed using dlopen." >&4
11215                         echo "Perhaps you should not use dynamic loading." >&4;;
11216                 2)      echo "Test program failed using dlsym." >&4
11217                         echo "Perhaps you should not use dynamic loading." >&4;;
11218                 3)      echo "dlsym needs a leading underscore" >&4
11219                         val="$define" ;;
11220                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11221                 esac
11222         else
11223                 echo "I can't compile and run the test program." >&4
11224                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11225         fi
11226         ;;
11227 esac
11228                 
11229 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11230
11231 set d_dlsymun
11232 eval $setvar
11233
11234 : see if drand48_r exists
11235 set drand48_r d_drand48_r
11236 eval $inlibc
11237 case "$d_drand48_r" in
11238 "$define")
11239         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11240         case "$d_drand48_r_proto:$usethreads" in
11241         ":define")      d_drand48_r_proto=define
11242                 set d_drand48_r_proto drand48_r $hdrs
11243                 eval $hasproto ;;
11244         *)      ;;
11245         esac
11246         case "$d_drand48_r_proto" in
11247         define)
11248         case "$drand48_r_proto" in
11249         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11250         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11251         esac
11252         case "$drand48_r_proto" in
11253         ''|0)   d_drand48_r=undef
11254                 drand48_r_proto=0
11255                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11256         * )     case "$drand48_r_proto" in
11257                 REENTRANT_PROTO*) ;;
11258                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11259                 esac
11260                 echo "Prototype: $try" ;;
11261         esac
11262         ;;
11263         *)      case "$usethreads" in
11264                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11265                 esac
11266                 d_drand48_r=undef
11267                 drand48_r_proto=0
11268                 ;;
11269         esac
11270         ;;
11271 *)      drand48_r_proto=0
11272         ;;
11273 esac
11274
11275 : see if prototype for drand48 is available
11276 echo " "
11277 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11278 eval $hasproto
11279
11280 : see if dup2 exists
11281 set dup2 d_dup2
11282 eval $inlibc
11283
11284 : see if eaccess exists
11285 set eaccess d_eaccess
11286 eval $inlibc
11287
11288 : see if endgrent exists
11289 set endgrent d_endgrent
11290 eval $inlibc
11291
11292 : see if this is an grp system
11293 set grp.h i_grp
11294 eval $inhdr
11295
11296 case "$i_grp" in
11297 $define)
11298         xxx=`./findhdr grp.h`
11299         $cppstdin $cppflags $cppminus < $xxx >$$.h
11300
11301         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11302                 val="$define"
11303         else
11304                 val="$undef"
11305         fi
11306         set d_grpasswd
11307         eval $setvar
11308
11309         $rm -f $$.h
11310         ;;
11311 *)
11312         val="$undef";
11313         set d_grpasswd; eval $setvar
11314         ;;
11315 esac
11316
11317 : see if endgrent_r exists
11318 set endgrent_r d_endgrent_r
11319 eval $inlibc
11320 case "$d_endgrent_r" in
11321 "$define")
11322         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11323         case "$d_endgrent_r_proto:$usethreads" in
11324         ":define")      d_endgrent_r_proto=define
11325                 set d_endgrent_r_proto endgrent_r $hdrs
11326                 eval $hasproto ;;
11327         *)      ;;
11328         esac
11329         case "$d_endgrent_r_proto" in
11330         define)
11331         case "$endgrent_r_proto" in
11332         ''|0) try='int endgrent_r(FILE**);'
11333         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11334         esac
11335         case "$endgrent_r_proto" in
11336         ''|0) try='void endgrent_r(FILE**);'
11337         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11338         esac
11339         case "$endgrent_r_proto" in
11340         ''|0)   d_endgrent_r=undef
11341                 endgrent_r_proto=0
11342                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11343         * )     case "$endgrent_r_proto" in
11344                 REENTRANT_PROTO*) ;;
11345                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11346                 esac
11347                 echo "Prototype: $try" ;;
11348         esac
11349         ;;
11350         *)      case "$usethreads" in
11351                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11352                 esac
11353                 d_endgrent_r=undef
11354                 endgrent_r_proto=0
11355                 ;;
11356         esac
11357         ;;
11358 *)      endgrent_r_proto=0
11359         ;;
11360 esac
11361
11362 : see if endhostent exists
11363 set endhostent d_endhent
11364 eval $inlibc
11365
11366 : see if this is a netdb.h system
11367 set netdb.h i_netdb
11368 eval $inhdr
11369
11370 : see if endhostent_r exists
11371 set endhostent_r d_endhostent_r
11372 eval $inlibc
11373 case "$d_endhostent_r" in
11374 "$define")
11375         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11376         case "$d_endhostent_r_proto:$usethreads" in
11377         ":define")      d_endhostent_r_proto=define
11378                 set d_endhostent_r_proto endhostent_r $hdrs
11379                 eval $hasproto ;;
11380         *)      ;;
11381         esac
11382         case "$d_endhostent_r_proto" in
11383         define)
11384         case "$endhostent_r_proto" in
11385         ''|0) try='int endhostent_r(struct hostent_data*);'
11386         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11387         esac
11388         case "$endhostent_r_proto" in
11389         ''|0) try='void endhostent_r(struct hostent_data*);'
11390         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11391         esac
11392         case "$endhostent_r_proto" in
11393         ''|0)   d_endhostent_r=undef
11394                 endhostent_r_proto=0
11395                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11396         * )     case "$endhostent_r_proto" in
11397                 REENTRANT_PROTO*) ;;
11398                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11399                 esac
11400                 echo "Prototype: $try" ;;
11401         esac
11402         ;;
11403         *)      case "$usethreads" in
11404                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11405                 esac
11406                 d_endhostent_r=undef
11407                 endhostent_r_proto=0
11408                 ;;
11409         esac
11410         ;;
11411 *)      endhostent_r_proto=0
11412         ;;
11413 esac
11414
11415 : see if endnetent exists
11416 set endnetent d_endnent
11417 eval $inlibc
11418
11419 : see if endnetent_r exists
11420 set endnetent_r d_endnetent_r
11421 eval $inlibc
11422 case "$d_endnetent_r" in
11423 "$define")
11424         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11425         case "$d_endnetent_r_proto:$usethreads" in
11426         ":define")      d_endnetent_r_proto=define
11427                 set d_endnetent_r_proto endnetent_r $hdrs
11428                 eval $hasproto ;;
11429         *)      ;;
11430         esac
11431         case "$d_endnetent_r_proto" in
11432         define)
11433         case "$endnetent_r_proto" in
11434         ''|0) try='int endnetent_r(struct netent_data*);'
11435         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11436         esac
11437         case "$endnetent_r_proto" in
11438         ''|0) try='void endnetent_r(struct netent_data*);'
11439         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11440         esac
11441         case "$endnetent_r_proto" in
11442         ''|0)   d_endnetent_r=undef
11443                 endnetent_r_proto=0
11444                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11445         * )     case "$endnetent_r_proto" in
11446                 REENTRANT_PROTO*) ;;
11447                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11448                 esac
11449                 echo "Prototype: $try" ;;
11450         esac
11451         ;;
11452         *)      case "$usethreads" in
11453                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11454                 esac
11455                 d_endnetent_r=undef
11456                 endnetent_r_proto=0
11457                 ;;
11458         esac
11459         ;;
11460 *)      endnetent_r_proto=0
11461         ;;
11462 esac
11463
11464 : see if endprotoent exists
11465 set endprotoent d_endpent
11466 eval $inlibc
11467
11468 : see if endprotoent_r exists
11469 set endprotoent_r d_endprotoent_r
11470 eval $inlibc
11471 case "$d_endprotoent_r" in
11472 "$define")
11473         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11474         case "$d_endprotoent_r_proto:$usethreads" in
11475         ":define")      d_endprotoent_r_proto=define
11476                 set d_endprotoent_r_proto endprotoent_r $hdrs
11477                 eval $hasproto ;;
11478         *)      ;;
11479         esac
11480         case "$d_endprotoent_r_proto" in
11481         define)
11482         case "$endprotoent_r_proto" in
11483         ''|0) try='int endprotoent_r(struct protoent_data*);'
11484         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11485         esac
11486         case "$endprotoent_r_proto" in
11487         ''|0) try='void endprotoent_r(struct protoent_data*);'
11488         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11489         esac
11490         case "$endprotoent_r_proto" in
11491         ''|0)   d_endprotoent_r=undef
11492                 endprotoent_r_proto=0
11493                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11494         * )     case "$endprotoent_r_proto" in
11495                 REENTRANT_PROTO*) ;;
11496                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11497                 esac
11498                 echo "Prototype: $try" ;;
11499         esac
11500         ;;
11501         *)      case "$usethreads" in
11502                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11503                 esac
11504                 d_endprotoent_r=undef
11505                 endprotoent_r_proto=0
11506                 ;;
11507         esac
11508         ;;
11509 *)      endprotoent_r_proto=0
11510         ;;
11511 esac
11512
11513 : see if endpwent exists
11514 set endpwent d_endpwent
11515 eval $inlibc
11516
11517 : see if this is a pwd.h system
11518 set pwd.h i_pwd
11519 eval $inhdr
11520
11521 case "$i_pwd" in
11522 $define)
11523         xxx=`./findhdr pwd.h`
11524         $cppstdin $cppflags $cppminus < $xxx >$$.h
11525
11526         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11527                 val="$define"
11528         else
11529                 val="$undef"
11530         fi
11531         set d_pwquota
11532         eval $setvar
11533
11534         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11535                 val="$define"
11536         else
11537                 val="$undef"
11538         fi
11539         set d_pwage
11540         eval $setvar
11541
11542         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11543                 val="$define"
11544         else
11545                 val="$undef"
11546         fi
11547         set d_pwchange
11548         eval $setvar
11549
11550         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11551                 val="$define"
11552         else
11553                 val="$undef"
11554         fi
11555         set d_pwclass
11556         eval $setvar
11557
11558         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11559                 val="$define"
11560         else
11561                 val="$undef"
11562         fi
11563         set d_pwexpire
11564         eval $setvar
11565
11566         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11567                 val="$define"
11568         else
11569                 val="$undef"
11570         fi
11571         set d_pwcomment
11572         eval $setvar
11573
11574         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11575                 val="$define"
11576         else
11577                 val="$undef"
11578         fi
11579         set d_pwgecos
11580         eval $setvar
11581
11582         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11583                 val="$define"
11584         else
11585                 val="$undef"
11586         fi
11587         set d_pwpasswd
11588         eval $setvar
11589
11590         $rm -f $$.h
11591         ;;
11592 *)
11593         val="$undef"; 
11594         set d_pwquota; eval $setvar
11595         set d_pwage; eval $setvar
11596         set d_pwchange; eval $setvar
11597         set d_pwclass; eval $setvar
11598         set d_pwexpire; eval $setvar
11599         set d_pwcomment; eval $setvar
11600         set d_pwgecos; eval $setvar
11601         set d_pwpasswd; eval $setvar
11602         ;;
11603 esac
11604
11605 : see if endpwent_r exists
11606 set endpwent_r d_endpwent_r
11607 eval $inlibc
11608 case "$d_endpwent_r" in
11609 "$define")
11610         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11611         case "$d_endpwent_r_proto:$usethreads" in
11612         ":define")      d_endpwent_r_proto=define
11613                 set d_endpwent_r_proto endpwent_r $hdrs
11614                 eval $hasproto ;;
11615         *)      ;;
11616         esac
11617         case "$d_endpwent_r_proto" in
11618         define)
11619         case "$endpwent_r_proto" in
11620         ''|0) try='int endpwent_r(FILE**);'
11621         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11622         esac
11623         case "$endpwent_r_proto" in
11624         ''|0) try='void endpwent_r(FILE**);'
11625         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11626         esac
11627         case "$endpwent_r_proto" in
11628         ''|0)   d_endpwent_r=undef
11629                 endpwent_r_proto=0
11630                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11631         * )     case "$endpwent_r_proto" in
11632                 REENTRANT_PROTO*) ;;
11633                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11634                 esac
11635                 echo "Prototype: $try" ;;
11636         esac
11637         ;;
11638         *)      case "$usethreads" in
11639                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11640                 esac
11641                 d_endpwent_r=undef
11642                 endpwent_r_proto=0
11643                 ;;
11644         esac
11645         ;;
11646 *)      endpwent_r_proto=0
11647         ;;
11648 esac
11649
11650 : see if endservent exists
11651 set endservent d_endsent
11652 eval $inlibc
11653
11654 : see if endservent_r exists
11655 set endservent_r d_endservent_r
11656 eval $inlibc
11657 case "$d_endservent_r" in
11658 "$define")
11659         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11660         case "$d_endservent_r_proto:$usethreads" in
11661         ":define")      d_endservent_r_proto=define
11662                 set d_endservent_r_proto endservent_r $hdrs
11663                 eval $hasproto ;;
11664         *)      ;;
11665         esac
11666         case "$d_endservent_r_proto" in
11667         define)
11668         case "$endservent_r_proto" in
11669         ''|0) try='int endservent_r(struct servent_data*);'
11670         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11671         esac
11672         case "$endservent_r_proto" in
11673         ''|0) try='void endservent_r(struct servent_data*);'
11674         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11675         esac
11676         case "$endservent_r_proto" in
11677         ''|0)   d_endservent_r=undef
11678                 endservent_r_proto=0
11679                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11680         * )     case "$endservent_r_proto" in
11681                 REENTRANT_PROTO*) ;;
11682                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11683                 esac
11684                 echo "Prototype: $try" ;;
11685         esac
11686         ;;
11687         *)      case "$usethreads" in
11688                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11689                 esac
11690                 d_endservent_r=undef
11691                 endservent_r_proto=0
11692                 ;;
11693         esac
11694         ;;
11695 *)      endservent_r_proto=0
11696         ;;
11697 esac
11698
11699 : Locate the flags for 'open()'
11700 echo " "
11701 $cat >try.c <<EOCP
11702 #include <sys/types.h>
11703 #ifdef I_FCNTL
11704 #include <fcntl.h>
11705 #endif
11706 #ifdef I_SYS_FILE
11707 #include <sys/file.h>
11708 #endif
11709 #$i_stdlib I_STDLIB
11710 #ifdef I_STDLIB
11711 #include <stdlib.h>
11712 #endif
11713 int main() {
11714         if(O_RDONLY);
11715 #ifdef O_TRUNC
11716         exit(0);
11717 #else
11718         exit(1);
11719 #endif
11720 }
11721 EOCP
11722 : check sys/file.h first to get FREAD on Sun
11723 if $test `./findhdr sys/file.h` && \
11724                 set try -DI_SYS_FILE && eval $compile; then
11725         h_sysfile=true;
11726         echo "<sys/file.h> defines the O_* constants..." >&4
11727         if $run ./try; then
11728                 echo "and you have the 3 argument form of open()." >&4
11729                 val="$define"
11730         else
11731                 echo "but not the 3 argument form of open().  Oh, well." >&4
11732                 val="$undef"
11733         fi
11734 elif $test `./findhdr fcntl.h` && \
11735                 set try -DI_FCNTL && eval $compile; then
11736         h_fcntl=true;
11737         echo "<fcntl.h> defines the O_* constants..." >&4
11738         if $run ./try; then
11739                 echo "and you have the 3 argument form of open()." >&4
11740                 val="$define"
11741         else
11742                 echo "but not the 3 argument form of open().  Oh, well." >&4
11743                 val="$undef"
11744         fi
11745 else
11746         val="$undef"
11747         echo "I can't find the O_* constant definitions!  You got problems." >&4
11748 fi
11749 set d_open3
11750 eval $setvar
11751 $rm -f try try.*
11752
11753 : see which of string.h or strings.h is needed
11754 echo " "
11755 strings=`./findhdr string.h`
11756 if $test "$strings" && $test -r "$strings"; then
11757         echo "Using <string.h> instead of <strings.h>." >&4
11758         val="$define"
11759 else
11760         val="$undef"
11761         strings=`./findhdr strings.h`
11762         if $test "$strings" && $test -r "$strings"; then
11763                 echo "Using <strings.h> instead of <string.h>." >&4
11764         else
11765                 echo "No string header found -- You'll surely have problems." >&4
11766         fi
11767 fi
11768 set i_string
11769 eval $setvar
11770 case "$i_string" in
11771 "$undef") strings=`./findhdr strings.h`;;
11772 *)        strings=`./findhdr string.h`;;
11773 esac
11774
11775 : see if this is a sys/file.h system
11776 val=''
11777 set sys/file.h val
11778 eval $inhdr
11779
11780 : do we need to include sys/file.h ?
11781 case "$val" in
11782 "$define")
11783         echo " "
11784         if $h_sysfile; then
11785                 val="$define"
11786                 echo "We'll be including <sys/file.h>." >&4
11787         else
11788                 val="$undef"
11789                 echo "We won't be including <sys/file.h>." >&4
11790         fi
11791         ;;
11792 *)
11793         h_sysfile=false
11794         ;;
11795 esac
11796 set i_sysfile
11797 eval $setvar
11798
11799 : see if fcntl.h is there
11800 val=''
11801 set fcntl.h val
11802 eval $inhdr
11803
11804 : see if we can include fcntl.h
11805 case "$val" in
11806 "$define")
11807         echo " "
11808         if $h_fcntl; then
11809                 val="$define"
11810                 echo "We'll be including <fcntl.h>." >&4
11811         else
11812                 val="$undef"
11813                 if $h_sysfile; then
11814         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11815                 else
11816                         echo "We won't be including <fcntl.h>." >&4
11817                 fi
11818         fi
11819         ;;
11820 *)
11821         h_fcntl=false
11822         val="$undef"
11823         ;;
11824 esac
11825 set i_fcntl
11826 eval $setvar
11827
11828 : check for non-blocking I/O stuff
11829 case "$h_sysfile" in
11830 true) echo "#include <sys/file.h>" > head.c;;
11831 *)
11832        case "$h_fcntl" in
11833        true) echo "#include <fcntl.h>" > head.c;;
11834        *) echo "#include <sys/fcntl.h>" > head.c;;
11835        esac
11836        ;;
11837 esac
11838 echo " "
11839 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11840 case "$o_nonblock" in
11841 '')
11842         $cat head.c > try.c
11843         $cat >>try.c <<EOCP
11844 #include <stdio.h>
11845 #$i_stdlib I_STDLIB
11846 #ifdef I_STDLIB
11847 #include <stdlib.h>
11848 #endif
11849 #$i_fcntl I_FCNTL
11850 #ifdef I_FCNTL
11851 #include <fcntl.h>
11852 #endif
11853 int main() {
11854 #ifdef O_NONBLOCK
11855         printf("O_NONBLOCK\n");
11856         exit(0);
11857 #endif
11858 #ifdef O_NDELAY
11859         printf("O_NDELAY\n");
11860         exit(0);
11861 #endif
11862 #ifdef FNDELAY
11863         printf("FNDELAY\n");
11864         exit(0);
11865 #endif
11866         exit(0);
11867 }
11868 EOCP
11869         set try
11870         if eval $compile_ok; then
11871                 o_nonblock=`$run ./try`
11872                 case "$o_nonblock" in
11873                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11874                 *) echo "Seems like we can use $o_nonblock.";;
11875                 esac
11876         else
11877                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11878         fi
11879         ;;
11880 *) echo "Using $hint value $o_nonblock.";;
11881 esac
11882 $rm -f try try.* .out core
11883
11884 echo " "
11885 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11886 case "$eagain" in
11887 '')
11888         $cat head.c > try.c
11889         $cat >>try.c <<EOCP
11890 #include <errno.h>
11891 #include <sys/types.h>
11892 #include <signal.h>
11893 #include <stdio.h> 
11894 #$i_stdlib I_STDLIB
11895 #ifdef I_STDLIB
11896 #include <stdlib.h>
11897 #endif
11898 #$i_fcntl I_FCNTL
11899 #ifdef I_FCNTL
11900 #include <fcntl.h>
11901 #endif
11902 #define MY_O_NONBLOCK $o_nonblock
11903 #ifndef errno  /* XXX need better Configure test */
11904 extern int errno;
11905 #endif
11906 #$i_unistd I_UNISTD
11907 #ifdef I_UNISTD
11908 #include <unistd.h>
11909 #endif
11910 #$i_string I_STRING
11911 #ifdef I_STRING
11912 #include <string.h>
11913 #else
11914 #include <strings.h>
11915 #endif
11916 $signal_t blech(x) int x; { exit(3); }
11917 EOCP
11918         $cat >> try.c <<'EOCP'
11919 int main()
11920 {
11921         int pd[2];
11922         int pu[2];
11923         char buf[1];
11924         char string[100];
11925
11926         pipe(pd);       /* Down: child -> parent */
11927         pipe(pu);       /* Up: parent -> child */
11928         if (0 != fork()) {
11929                 int ret;
11930                 close(pd[1]);   /* Parent reads from pd[0] */
11931                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11932 #ifdef F_SETFL
11933                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11934                         exit(1);
11935 #else
11936                 exit(4);
11937 #endif
11938                 signal(SIGALRM, blech);
11939                 alarm(5);
11940                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11941                         exit(2);
11942                 sprintf(string, "%d\n", ret);
11943                 write(2, string, strlen(string));
11944                 alarm(0);
11945 #ifdef EAGAIN
11946                 if (errno == EAGAIN) {
11947                         printf("EAGAIN\n");
11948                         goto ok;
11949                 }
11950 #endif
11951 #ifdef EWOULDBLOCK
11952                 if (errno == EWOULDBLOCK)
11953                         printf("EWOULDBLOCK\n");
11954 #endif
11955         ok:
11956                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11957                 sleep(2);                               /* Give it time to close our pipe */
11958                 alarm(5);
11959                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11960                 alarm(0);
11961                 sprintf(string, "%d\n", ret);
11962                 write(4, string, strlen(string));
11963                 exit(0);
11964         }
11965
11966         close(pd[0]);                   /* We write to pd[1] */
11967         close(pu[1]);                   /* We read from pu[0] */
11968         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11969         close(pd[1]);                   /* Pipe pd is now fully closed! */
11970         exit(0);                                /* Bye bye, thank you for playing! */
11971 }
11972 EOCP
11973         set try
11974         if eval $compile_ok; then
11975                 echo "$startsh" >mtry
11976                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11977                 chmod +x mtry
11978                 ./mtry >/dev/null 2>&1
11979                 case $? in
11980                 0) eagain=`$cat try.out`;;
11981                 1) echo "Could not perform non-blocking setting!";;
11982                 2) echo "I did a successful read() for something that was not there!";;
11983                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11984                 4) echo "Could not find F_SETFL!";;
11985                 *) echo "Something terribly wrong happened during testing.";;
11986                 esac
11987                 rd_nodata=`$cat try.ret`
11988                 echo "A read() system call with no data present returns $rd_nodata."
11989                 case "$rd_nodata" in
11990                 0|-1) ;;
11991                 *)
11992                         echo "(That's peculiar, fixing that to be -1.)"
11993                         rd_nodata=-1
11994                         ;;
11995                 esac
11996                 case "$eagain" in
11997                 '')
11998                         echo "Forcing errno EAGAIN on read() with no data available."
11999                         eagain=EAGAIN
12000                         ;;
12001                 *)
12002                         echo "Your read() sets errno to $eagain when no data is available."
12003                         ;;
12004                 esac
12005                 status=`$cat try.err`
12006                 case "$status" in
12007                 0) echo "And it correctly returns 0 to signal EOF.";;
12008                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12009                 *) echo "However, your read() returns '$status' on EOF??";;
12010                 esac
12011                 val="$define"
12012                 if test "$status" = "$rd_nodata"; then
12013                         echo "WARNING: you can't distinguish between EOF and no data!"
12014                         val="$undef"
12015                 fi
12016         else
12017                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12018                 eagain=EAGAIN
12019         fi
12020         set d_eofnblk
12021         eval $setvar
12022         ;;
12023 *)
12024         echo "Using $hint value $eagain."
12025         echo "Your read() returns $rd_nodata when no data is present."
12026         case "$d_eofnblk" in
12027         "$define") echo "And you can see EOF because read() returns 0.";;
12028         "$undef") echo "But you can't see EOF status from read() returned value.";;
12029         *)
12030                 echo "(Assuming you can't see EOF status from read anyway.)"
12031                 d_eofnblk=$undef
12032                 ;;
12033         esac
12034         ;;
12035 esac
12036 $rm -f try try.* .out core head.c mtry
12037
12038 : see if _ptr and _cnt from stdio act std
12039 echo " "
12040
12041 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12042         echo "(Looks like you have stdio.h from BSD.)"
12043         case "$stdio_ptr" in
12044         '') stdio_ptr='((fp)->_p)'
12045                 ptr_lval=$define
12046                 ;;
12047         *)      ptr_lval=$d_stdio_ptr_lval;;
12048         esac
12049         case "$stdio_cnt" in
12050         '') stdio_cnt='((fp)->_r)'
12051                 cnt_lval=$define
12052                 ;;
12053         *)      cnt_lval=$d_stdio_cnt_lval;;
12054         esac
12055         case "$stdio_base" in
12056         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12057         esac
12058         case "$stdio_bufsiz" in
12059         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12060         esac
12061 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12062         echo "(Looks like you have stdio.h from Linux.)"
12063         case "$stdio_ptr" in
12064         '') stdio_ptr='((fp)->_IO_read_ptr)'
12065                 ptr_lval=$define
12066                 ;;
12067         *)      ptr_lval=$d_stdio_ptr_lval;;
12068         esac
12069         case "$stdio_cnt" in
12070         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12071                 cnt_lval=$undef
12072                 ;;
12073         *)      cnt_lval=$d_stdio_cnt_lval;;
12074         esac
12075         case "$stdio_base" in
12076         '') stdio_base='((fp)->_IO_read_base)';;
12077         esac
12078         case "$stdio_bufsiz" in
12079         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12080         esac
12081 else
12082         case "$stdio_ptr" in
12083         '') stdio_ptr='((fp)->_ptr)'
12084                 ptr_lval=$define
12085                 ;;
12086         *)      ptr_lval=$d_stdio_ptr_lval;;
12087         esac
12088         case "$stdio_cnt" in
12089         '') stdio_cnt='((fp)->_cnt)'
12090                 cnt_lval=$define
12091                 ;;
12092         *)      cnt_lval=$d_stdio_cnt_lval;;
12093         esac
12094         case "$stdio_base" in
12095         '') stdio_base='((fp)->_base)';;
12096         esac
12097         case "$stdio_bufsiz" in
12098         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12099         esac
12100 fi
12101
12102 : test whether _ptr and _cnt really work
12103 echo "Checking how std your stdio is..." >&4
12104 $cat >try.c <<EOP
12105 #include <stdio.h>
12106 #$i_stdlib I_STDLIB
12107 #ifdef I_STDLIB
12108 #include <stdlib.h>
12109 #endif
12110 #define FILE_ptr(fp)    $stdio_ptr
12111 #define FILE_cnt(fp)    $stdio_cnt
12112 int main() {
12113         FILE *fp = fopen("try.c", "r");
12114         char c = getc(fp);
12115         if (
12116                 18 <= FILE_cnt(fp) &&
12117                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12118         )
12119                 exit(0);
12120         exit(1);
12121 }
12122 EOP
12123 val="$undef"
12124 set try
12125 if eval $compile && $to try.c; then
12126         if $run ./try; then
12127                 echo "Your stdio acts pretty std."
12128                 val="$define"
12129         else
12130                 echo "Your stdio isn't very std."
12131         fi
12132 else
12133         echo "Your stdio doesn't appear very std."
12134 fi
12135 $rm -f try.c try
12136
12137 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12138 # direct buffer manipulation no longer works.  The Configure tests
12139 # should be changed to correctly detect this, but until then,
12140 # the following check should at least let perl compile and run.
12141 # (This quick fix should be updated before 5.8.1.)
12142 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12143 # A. Dougherty, June 3, 2002.
12144 case "$d_gnulibc" in
12145 $define)
12146         case "$gnulibc_version" in
12147         2.[01]*)  ;;
12148         2.2) ;;
12149         2.2.[0-9]) ;;
12150         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12151                 val="$undef"
12152                 ;;
12153         esac
12154         ;;
12155 esac
12156 set d_stdstdio
12157 eval $setvar
12158
12159 : Can _ptr be used as an lvalue?
12160 case "$d_stdstdio$ptr_lval" in
12161 $define$define) val=$define ;;
12162 *) val=$undef ;;
12163 esac
12164 set d_stdio_ptr_lval
12165 eval $setvar
12166
12167 : Can _cnt be used as an lvalue?
12168 case "$d_stdstdio$cnt_lval" in
12169 $define$define) val=$define ;;
12170 *) val=$undef ;;
12171 esac
12172 set d_stdio_cnt_lval
12173 eval $setvar
12174
12175
12176 : test whether setting _ptr sets _cnt as a side effect
12177 d_stdio_ptr_lval_sets_cnt="$undef"
12178 d_stdio_ptr_lval_nochange_cnt="$undef"
12179 case "$d_stdio_ptr_lval$d_stdstdio" in
12180 $define$define)
12181         echo "Checking to see what happens if we set the stdio ptr..." >&4
12182 $cat >try.c <<EOP
12183 #include <stdio.h>
12184 /* Can we scream? */
12185 /* Eat dust sed :-) */
12186 /* In the buffer space, no one can hear you scream. */
12187 #$i_stdlib I_STDLIB
12188 #ifdef I_STDLIB
12189 #include <stdlib.h>
12190 #endif
12191 #define FILE_ptr(fp)    $stdio_ptr
12192 #define FILE_cnt(fp)    $stdio_cnt
12193 #include <sys/types.h>
12194 int main() {
12195         FILE *fp = fopen("try.c", "r");
12196         int c;
12197         char *ptr;
12198         size_t cnt;
12199         if (!fp) {
12200             puts("Fail even to read");
12201             exit(1);
12202         }
12203         c = getc(fp); /* Read away the first # */
12204         if (c == EOF) {
12205             puts("Fail even to read");
12206             exit(1);
12207         }
12208         if (!(
12209                 18 <= FILE_cnt(fp) &&
12210                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12211         )) {
12212                 puts("Fail even to read");
12213                 exit (1);
12214         }
12215         ptr = (char*) FILE_ptr(fp);
12216         cnt = (size_t)FILE_cnt(fp);
12217
12218         FILE_ptr(fp) += 42;
12219
12220         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12221                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12222                 exit (1);
12223         }
12224         if (FILE_cnt(fp) <= 20) {
12225                 printf ("Fail (<20 chars to test)");
12226                 exit (1);
12227         }
12228         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12229                 puts("Fail compare");
12230                 exit (1);
12231         }
12232         if (cnt == FILE_cnt(fp)) {
12233                 puts("Pass_unchanged");
12234                 exit (0);
12235         }       
12236         if (FILE_cnt(fp) == (cnt - 42)) {
12237                 puts("Pass_changed");
12238                 exit (0);
12239         }
12240         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12241         return 1;
12242
12243 }
12244 EOP
12245         set try
12246         if eval $compile && $to try.c; then
12247                 case `$run ./try` in
12248                 Pass_changed)
12249                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12250                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12251                 Pass_unchanged)
12252                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12253                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12254                 Fail*)
12255                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12256                 *)
12257                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12258         esac
12259         else
12260                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12261         fi
12262         $rm -f try.c try
12263         ;;
12264 esac
12265
12266 : see if _base is also standard
12267 val="$undef"
12268 case "$d_stdstdio" in
12269 $define)
12270         $cat >try.c <<EOP
12271 #include <stdio.h>
12272 #$i_stdlib I_STDLIB
12273 #ifdef I_STDLIB
12274 #include <stdlib.h>
12275 #endif
12276 #define FILE_base(fp)   $stdio_base
12277 #define FILE_bufsiz(fp) $stdio_bufsiz
12278 int main() {
12279         FILE *fp = fopen("try.c", "r");
12280         char c = getc(fp);
12281         if (
12282                 19 <= FILE_bufsiz(fp) &&
12283                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12284         )
12285                 exit(0);
12286         exit(1);
12287 }
12288 EOP
12289         set try
12290         if eval $compile && $to try.c; then
12291                 if $run ./try; then
12292                         echo "And its _base field acts std."
12293                         val="$define"
12294                 else
12295                         echo "But its _base field isn't std."
12296                 fi
12297         else
12298                 echo "However, it seems to be lacking the _base field."
12299         fi
12300         $rm -f try.c try
12301         ;;
12302 esac
12303 set d_stdiobase
12304 eval $setvar
12305
12306 : see if fast_stdio exists
12307 val="$undef"
12308 case "$d_stdstdio:$d_stdio_ptr_lval" in
12309 "$define:$define")
12310         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12311         *$define*)
12312                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12313                 val="$define"
12314                 ;;
12315         esac
12316         ;;
12317 esac
12318 set d_faststdio
12319 eval $setvar
12320
12321
12322
12323 : see if fchdir exists
12324 set fchdir d_fchdir
12325 eval $inlibc
12326
12327 : see if fchmod exists
12328 set fchmod d_fchmod
12329 eval $inlibc
12330
12331 : see if fchown exists
12332 set fchown d_fchown
12333 eval $inlibc
12334
12335 : see if this is an fcntl system
12336 set fcntl d_fcntl
12337 eval $inlibc
12338
12339 echo " "
12340 : See if fcntl-based locking works.
12341 $cat >try.c <<EOCP
12342 #$i_stdlib I_STDLIB
12343 #ifdef I_STDLIB
12344 #include <stdlib.h>
12345 #endif
12346 #include <unistd.h>
12347 #include <fcntl.h>
12348 #include <signal.h>
12349 $signal_t blech(x) int x; { exit(3); }
12350 int main() {
12351 #if defined(F_SETLK) && defined(F_SETLKW)
12352      struct flock flock;
12353      int retval, fd;
12354      fd = open("try.c", O_RDONLY);
12355      flock.l_type = F_RDLCK;
12356      flock.l_whence = SEEK_SET;
12357      flock.l_start = flock.l_len = 0;
12358      signal(SIGALRM, blech);
12359      alarm(10);
12360      retval = fcntl(fd, F_SETLK, &flock);
12361      close(fd);
12362      (retval < 0 ? exit(2) : exit(0));
12363 #else
12364      exit(2);
12365 #endif
12366 }
12367 EOCP
12368 echo "Checking if fcntl-based file locking works... "
12369 case "$d_fcntl" in
12370 "$define")
12371         set try
12372         if eval $compile_ok; then
12373                 if $run ./try; then
12374                         echo "Yes, it seems to work."
12375                         val="$define"
12376                 else
12377                         echo "Nope, it didn't work."
12378                         val="$undef"
12379                         case "$?" in
12380                         3) $cat >&4 <<EOM
12381 ***
12382 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12383 *** This is (almost) impossible.
12384 *** If your NFS lock daemons are not feeling well, something like
12385 *** this may happen, please investigate.  Cannot continue, aborting.
12386 ***
12387 EOM
12388                                 exit 1
12389                                 ;;
12390                         esac
12391                 fi
12392         else
12393                 echo "I'm unable to compile the test program, so I'll assume not."
12394                 val="$undef"
12395         fi
12396         ;;
12397 *) val="$undef";
12398         echo "Nope, since you don't even have fcntl()."
12399         ;;
12400 esac
12401 set d_fcntl_can_lock
12402 eval $setvar
12403 $rm -f try*
12404
12405
12406 : check for fd_set items
12407 $cat <<EOM
12408
12409 Checking to see how well your C compiler handles fd_set and friends ...
12410 EOM
12411 $cat >try.c <<EOCP
12412 #$i_stdlib I_STDLIB
12413 #ifdef I_STDLIB
12414 #include <stdlib.h>
12415 #endif
12416 #$i_systime I_SYS_TIME
12417 #$i_sysselct I_SYS_SELECT
12418 #$d_socket HAS_SOCKET
12419 #include <sys/types.h>
12420 #ifdef HAS_SOCKET
12421 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12422 #endif
12423 #ifdef I_SYS_TIME
12424 #include <sys/time.h>
12425 #endif
12426 #ifdef I_SYS_SELECT
12427 #include <sys/select.h>
12428 #endif
12429 int main() {
12430         fd_set fds;
12431
12432 #ifdef TRYBITS
12433         if(fds.fds_bits);
12434 #endif
12435
12436 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12437         exit(0);
12438 #else
12439         exit(1);
12440 #endif
12441 }
12442 EOCP
12443 set try -DTRYBITS
12444 if eval $compile; then
12445         d_fds_bits="$define"
12446         d_fd_set="$define"
12447         echo "Well, your system knows about the normal fd_set typedef..." >&4
12448         if $run ./try; then
12449                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12450                 d_fd_macros="$define"
12451         else
12452                 $cat >&4 <<'EOM'
12453 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12454 EOM
12455                 d_fd_macros="$undef"
12456         fi
12457 else
12458         $cat <<'EOM'
12459 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12460 EOM
12461         set try
12462         if eval $compile; then
12463                 d_fds_bits="$undef"
12464                 d_fd_set="$define"
12465                 echo "Well, your system has some sort of fd_set available..." >&4
12466                 if $run ./try; then
12467                         echo "and you have the normal fd_set macros." >&4
12468                         d_fd_macros="$define"
12469                 else
12470                         $cat <<'EOM'
12471 but not the normal fd_set macros!  Gross!  More work for me...
12472 EOM
12473                         d_fd_macros="$undef"
12474                 fi
12475         else
12476         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12477                 d_fd_set="$undef"
12478                 d_fds_bits="$undef"
12479                 d_fd_macros="$undef"
12480         fi
12481 fi
12482 $rm -f try try.*
12483
12484 : see if fgetpos exists
12485 set fgetpos d_fgetpos
12486 eval $inlibc
12487
12488 : see if finite exists
12489 set finite d_finite
12490 eval $inlibc
12491
12492 : see if finitel exists
12493 set finitel d_finitel
12494 eval $inlibc
12495
12496 : see if flock exists
12497 set flock d_flock
12498 eval $inlibc
12499
12500 : see if prototype for flock is available
12501 echo " "
12502 set d_flockproto flock $i_sysfile sys/file.h
12503 eval $hasproto
12504
12505 : see if fork exists
12506 set fork d_fork
12507 eval $inlibc
12508
12509 : see if fp_class exists
12510 set fp_class d_fp_class
12511 eval $inlibc
12512
12513 : see if pathconf exists
12514 set pathconf d_pathconf
12515 eval $inlibc
12516
12517 : see if fpathconf exists
12518 set fpathconf d_fpathconf
12519 eval $inlibc
12520
12521 : see if fpclass exists
12522 set fpclass d_fpclass
12523 eval $inlibc
12524
12525 : see if fpclassify exists
12526 set fpclassify d_fpclassify
12527 eval $inlibc
12528
12529 : see if fpclassl exists
12530 set fpclassl d_fpclassl
12531 eval $inlibc
12532
12533
12534 : check for fpos64_t
12535 echo " "
12536 echo "Checking to see if you have fpos64_t..." >&4
12537 $cat >try.c <<EOCP
12538 #include <stdio.h>
12539 int main() { fpos64_t x = 7; }
12540 EOCP
12541 set try
12542 if eval $compile; then
12543         val="$define"
12544         echo "You have fpos64_t."
12545 else
12546         val="$undef"
12547         echo "You do not have fpos64_t."
12548         case "$fpossize" in
12549         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12550         esac
12551 fi
12552 $rm -f try.* try
12553 set d_fpos64_t
12554 eval $setvar
12555
12556 : see if frexpl exists
12557 set frexpl d_frexpl
12558 eval $inlibc
12559
12560 : see if this is a sys/param system
12561 set sys/param.h i_sysparam
12562 eval $inhdr
12563
12564 : see if this is a sys/mount.h system
12565 set sys/mount.h i_sysmount
12566 eval $inhdr
12567
12568
12569 echo " "
12570 echo "Checking to see if your system supports struct fs_data..." >&4
12571 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12572 eval $hasstruct
12573 case "$d_fs_data_s" in
12574 "$define")      echo "Yes, it does."   ;;
12575 *)              echo "No, it doesn't." ;;
12576 esac
12577
12578 : see if fseeko exists
12579 set fseeko d_fseeko
12580 eval $inlibc
12581 case "$longsize" in
12582 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12583 esac
12584
12585 : see if fsetpos exists
12586 set fsetpos d_fsetpos
12587 eval $inlibc
12588
12589
12590 : see if fstatfs exists
12591 set fstatfs d_fstatfs
12592 eval $inlibc
12593
12594
12595 : see if statvfs exists
12596 set statvfs d_statvfs
12597 eval $inlibc
12598
12599 : see if fstatvfs exists
12600 set fstatvfs d_fstatvfs
12601 eval $inlibc
12602
12603
12604 : see if fsync exists
12605 set fsync d_fsync
12606 eval $inlibc
12607
12608 : see if ftello exists
12609 set ftello d_ftello
12610 eval $inlibc
12611 case "$longsize" in
12612 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12613 esac
12614
12615 d_futimes="$undef"
12616 : check for a working futimes
12617 echo " "
12618 echo "Checking for a working futimes()" >&4
12619 $cat >try.c <<EOCP
12620 #include <stdio.h>
12621 #include <sys/time.h>
12622 #include <errno.h>
12623 #include <fcntl.h>
12624
12625 int main ()
12626 {
12627     int fd, rv;
12628     fd = open ("try.c", O_RDWR);
12629     if (-1 == fd) exit (1);
12630     rv = futimes (fd, NULL);
12631     exit (rv == -1 ? errno : 0);
12632 }
12633 EOCP
12634 set try
12635 if eval $compile; then
12636     `$run ./try`
12637     rc=$?
12638     case "$rc" in
12639         0)  echo "Yes, it does" >&4
12640             d_futimes="$define"
12641             ;;
12642         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12643             ;;
12644     esac
12645 else
12646     echo "No, it does not (probably harmless)\n" >&4
12647 fi
12648 $rm -f try.* try core core.try.*
12649
12650 : see if getcwd exists
12651 set getcwd d_getcwd
12652 eval $inlibc
12653
12654 : see if getespwnam exists
12655 set getespwnam d_getespwnam
12656 eval $inlibc
12657
12658
12659 : see if getfsstat exists
12660 set getfsstat d_getfsstat
12661 eval $inlibc
12662
12663 : see if getgrent exists
12664 set getgrent d_getgrent
12665 eval $inlibc
12666
12667 : see if getgrent_r exists
12668 set getgrent_r d_getgrent_r
12669 eval $inlibc
12670 case "$d_getgrent_r" in
12671 "$define")
12672         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12673         case "$d_getgrent_r_proto:$usethreads" in
12674         ":define")      d_getgrent_r_proto=define
12675                 set d_getgrent_r_proto getgrent_r $hdrs
12676                 eval $hasproto ;;
12677         *)      ;;
12678         esac
12679         case "$d_getgrent_r_proto" in
12680         define)
12681         case "$getgrent_r_proto" in
12682         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12683         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12684         esac
12685         case "$getgrent_r_proto" in
12686         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12687         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12688         esac
12689         case "$getgrent_r_proto" in
12690         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12691         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12692         esac
12693         case "$getgrent_r_proto" in
12694         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12695         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12696         esac
12697         case "$getgrent_r_proto" in
12698         ''|0) try='int getgrent_r(struct group*, char*, int);'
12699         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12700         esac
12701         case "$getgrent_r_proto" in
12702         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12703         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12704         esac
12705         case "$getgrent_r_proto" in
12706         ''|0)   d_getgrent_r=undef
12707                 getgrent_r_proto=0
12708                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12709         * )     case "$getgrent_r_proto" in
12710                 REENTRANT_PROTO*) ;;
12711                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12712                 esac
12713                 echo "Prototype: $try" ;;
12714         esac
12715         ;;
12716         *)      case "$usethreads" in
12717                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12718                 esac
12719                 d_getgrent_r=undef
12720                 getgrent_r_proto=0
12721                 ;;
12722         esac
12723         ;;
12724 *)      getgrent_r_proto=0
12725         ;;
12726 esac
12727
12728 : see if getgrgid_r exists
12729 set getgrgid_r d_getgrgid_r
12730 eval $inlibc
12731 case "$d_getgrgid_r" in
12732 "$define")
12733         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12734         case "$d_getgrgid_r_proto:$usethreads" in
12735         ":define")      d_getgrgid_r_proto=define
12736                 set d_getgrgid_r_proto getgrgid_r $hdrs
12737                 eval $hasproto ;;
12738         *)      ;;
12739         esac
12740         case "$d_getgrgid_r_proto" in
12741         define)
12742         case "$getgrgid_r_proto" in
12743         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12744         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12745         esac
12746         case "$getgrgid_r_proto" in
12747         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12748         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12749         esac
12750         case "$getgrgid_r_proto" in
12751         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12752         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12753         esac
12754         case "$getgrgid_r_proto" in
12755         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12756         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12757         esac
12758         case "$getgrgid_r_proto" in
12759         ''|0)   d_getgrgid_r=undef
12760                 getgrgid_r_proto=0
12761                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12762         * )     case "$getgrgid_r_proto" in
12763                 REENTRANT_PROTO*) ;;
12764                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12765                 esac
12766                 echo "Prototype: $try" ;;
12767         esac
12768         ;;
12769         *)      case "$usethreads" in
12770                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12771                 esac
12772                 d_getgrgid_r=undef
12773                 getgrgid_r_proto=0
12774                 ;;
12775         esac
12776         ;;
12777 *)      getgrgid_r_proto=0
12778         ;;
12779 esac
12780
12781 : see if getgrnam_r exists
12782 set getgrnam_r d_getgrnam_r
12783 eval $inlibc
12784 case "$d_getgrnam_r" in
12785 "$define")
12786         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12787         case "$d_getgrnam_r_proto:$usethreads" in
12788         ":define")      d_getgrnam_r_proto=define
12789                 set d_getgrnam_r_proto getgrnam_r $hdrs
12790                 eval $hasproto ;;
12791         *)      ;;
12792         esac
12793         case "$d_getgrnam_r_proto" in
12794         define)
12795         case "$getgrnam_r_proto" in
12796         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12797         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12798         esac
12799         case "$getgrnam_r_proto" in
12800         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12801         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12802         esac
12803         case "$getgrnam_r_proto" in
12804         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12805         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12806         esac
12807         case "$getgrnam_r_proto" in
12808         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12809         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12810         esac
12811         case "$getgrnam_r_proto" in
12812         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12813         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12814         esac
12815         case "$getgrnam_r_proto" in
12816         ''|0)   d_getgrnam_r=undef
12817                 getgrnam_r_proto=0
12818                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12819         * )     case "$getgrnam_r_proto" in
12820                 REENTRANT_PROTO*) ;;
12821                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12822                 esac
12823                 echo "Prototype: $try" ;;
12824         esac
12825         ;;
12826         *)      case "$usethreads" in
12827                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12828                 esac
12829                 d_getgrnam_r=undef
12830                 getgrnam_r_proto=0
12831                 ;;
12832         esac
12833         ;;
12834 *)      getgrnam_r_proto=0
12835         ;;
12836 esac
12837
12838 : see if gethostbyaddr exists
12839 set gethostbyaddr d_gethbyaddr
12840 eval $inlibc
12841
12842 : see if gethostbyname exists
12843 set gethostbyname d_gethbyname
12844 eval $inlibc
12845
12846 : see if gethostent exists
12847 set gethostent d_gethent
12848 eval $inlibc
12849
12850 : see how we will look up host name
12851 echo " "
12852 call=''
12853 if set gethostname val -f d_gethname; eval $csym; $val; then
12854         echo 'gethostname() found.' >&4
12855         d_gethname="$define"
12856         call=gethostname
12857 fi
12858 if set uname val -f d_uname; eval $csym; $val; then
12859         if ./xenix; then
12860                 $cat <<'EOM'
12861 uname() was found, but you're running xenix, and older versions of xenix
12862 have a broken uname(). If you don't really know whether your xenix is old
12863 enough to have a broken system call, use the default answer.
12864
12865 EOM
12866                 dflt=y
12867                 case "$d_uname" in
12868                 "$define") dflt=n;;
12869                 esac
12870                 rp='Is your uname() broken?'
12871                 . ./myread
12872                 case "$ans" in
12873                 n*) d_uname="$define"; call=uname;;
12874                 esac
12875         else
12876                 echo 'uname() found.' >&4
12877                 d_uname="$define"
12878                 case "$call" in
12879                 '') call=uname ;;
12880                 esac
12881         fi
12882 fi
12883 case "$d_gethname" in
12884 '') d_gethname="$undef";;
12885 esac
12886 case "$d_uname" in
12887 '') d_uname="$undef";;
12888 esac
12889 case "$d_uname$d_gethname" in
12890 *define*)
12891         dflt=n
12892         cat <<EOM
12893  
12894 Every now and then someone has a $call() that lies about the hostname
12895 but can't be fixed for political or economic reasons.  If you wish, I can
12896 pretend $call() isn't there and maybe compute hostname at run-time
12897 thanks to the '$phostname' command.
12898
12899 EOM
12900         rp="Shall I ignore $call() from now on?"
12901         . ./myread
12902         case "$ans" in
12903         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12904         esac;;
12905 esac
12906 case "$phostname" in
12907 '') aphostname='';;
12908 *) case "$aphostname" in
12909         /*) ;;
12910         *) set X $phostname
12911                 shift
12912                 file=$1
12913                 shift
12914                 file=`./loc $file $file $pth`
12915                 aphostname=`echo $file $*`
12916                 ;;
12917         esac
12918         ;;
12919 esac
12920 case "$d_uname$d_gethname" in
12921 *define*) ;;
12922 *)
12923         case "$phostname" in
12924         '')
12925                 echo "There will be no way for $package to get your hostname." >&4;;
12926         *)
12927         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12928                 ;;
12929         esac;;
12930 esac
12931 case "$d_phostname" in
12932 '') d_phostname="$undef";;
12933 esac
12934
12935 : see if gethostbyaddr_r exists
12936 set gethostbyaddr_r d_gethostbyaddr_r
12937 eval $inlibc
12938 case "$d_gethostbyaddr_r" in
12939 "$define")
12940         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12941         case "$d_gethostbyaddr_r_proto:$usethreads" in
12942         ":define")      d_gethostbyaddr_r_proto=define
12943                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12944                 eval $hasproto ;;
12945         *)      ;;
12946         esac
12947         case "$d_gethostbyaddr_r_proto" in
12948         define)
12949         case "$gethostbyaddr_r_proto" in
12950         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12951         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12952         esac
12953         case "$gethostbyaddr_r_proto" in
12954         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12955         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12956         esac
12957         case "$gethostbyaddr_r_proto" in
12958         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12959         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12960         esac
12961         case "$gethostbyaddr_r_proto" in
12962         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12963         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12964         esac
12965         case "$gethostbyaddr_r_proto" in
12966         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12967         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12968         esac
12969         case "$gethostbyaddr_r_proto" in
12970         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12971         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12972         esac
12973         case "$gethostbyaddr_r_proto" in
12974         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12975         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12976         esac
12977         case "$gethostbyaddr_r_proto" in
12978         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12979         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12980         esac
12981         case "$gethostbyaddr_r_proto" in
12982         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12983         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12984         esac
12985         case "$gethostbyaddr_r_proto" in
12986         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12987         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12988         esac
12989         case "$gethostbyaddr_r_proto" in
12990         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12991         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12992         esac
12993         case "$gethostbyaddr_r_proto" in
12994         ''|0)   d_gethostbyaddr_r=undef
12995                 gethostbyaddr_r_proto=0
12996                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12997         * )     case "$gethostbyaddr_r_proto" in
12998                 REENTRANT_PROTO*) ;;
12999                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13000                 esac
13001                 echo "Prototype: $try" ;;
13002         esac
13003         ;;
13004         *)      case "$usethreads" in
13005                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13006                 esac
13007                 d_gethostbyaddr_r=undef
13008                 gethostbyaddr_r_proto=0
13009                 ;;
13010         esac
13011         ;;
13012 *)      gethostbyaddr_r_proto=0
13013         ;;
13014 esac
13015
13016 : see if gethostbyname_r exists
13017 set gethostbyname_r d_gethostbyname_r
13018 eval $inlibc
13019 case "$d_gethostbyname_r" in
13020 "$define")
13021         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13022         case "$d_gethostbyname_r_proto:$usethreads" in
13023         ":define")      d_gethostbyname_r_proto=define
13024                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13025                 eval $hasproto ;;
13026         *)      ;;
13027         esac
13028         case "$d_gethostbyname_r_proto" in
13029         define)
13030         case "$gethostbyname_r_proto" in
13031         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13032         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13033         esac
13034         case "$gethostbyname_r_proto" in
13035         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13036         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13037         esac
13038         case "$gethostbyname_r_proto" in
13039         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13040         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13041         esac
13042         case "$gethostbyname_r_proto" in
13043         ''|0)   d_gethostbyname_r=undef
13044                 gethostbyname_r_proto=0
13045                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13046         * )     case "$gethostbyname_r_proto" in
13047                 REENTRANT_PROTO*) ;;
13048                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13049                 esac
13050                 echo "Prototype: $try" ;;
13051         esac
13052         ;;
13053         *)      case "$usethreads" in
13054                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13055                 esac
13056                 d_gethostbyname_r=undef
13057                 gethostbyname_r_proto=0
13058                 ;;
13059         esac
13060         ;;
13061 *)      gethostbyname_r_proto=0
13062         ;;
13063 esac
13064
13065 : see if gethostent_r exists
13066 set gethostent_r d_gethostent_r
13067 eval $inlibc
13068 case "$d_gethostent_r" in
13069 "$define")
13070         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13071         case "$d_gethostent_r_proto:$usethreads" in
13072         ":define")      d_gethostent_r_proto=define
13073                 set d_gethostent_r_proto gethostent_r $hdrs
13074                 eval $hasproto ;;
13075         *)      ;;
13076         esac
13077         case "$d_gethostent_r_proto" in
13078         define)
13079         case "$gethostent_r_proto" in
13080         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13081         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13082         esac
13083         case "$gethostent_r_proto" in
13084         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13085         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13086         esac
13087         case "$gethostent_r_proto" in
13088         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13089         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13090         esac
13091         case "$gethostent_r_proto" in
13092         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13093         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13094         esac
13095         case "$gethostent_r_proto" in
13096         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13097         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13098         esac
13099         case "$gethostent_r_proto" in
13100         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13101         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13102         esac
13103         case "$gethostent_r_proto" in
13104         ''|0)   d_gethostent_r=undef
13105                 gethostent_r_proto=0
13106                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13107         * )     case "$gethostent_r_proto" in
13108                 REENTRANT_PROTO*) ;;
13109                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13110                 esac
13111                 echo "Prototype: $try" ;;
13112         esac
13113         ;;
13114         *)      case "$usethreads" in
13115                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13116                 esac
13117                 d_gethostent_r=undef
13118                 gethostent_r_proto=0
13119                 ;;
13120         esac
13121         ;;
13122 *)      gethostent_r_proto=0
13123         ;;
13124 esac
13125
13126 : see if prototypes for various gethostxxx netdb.h functions are available
13127 echo " "
13128 set d_gethostprotos gethostent $i_netdb netdb.h
13129 eval $hasproto
13130
13131 : see if getitimer exists
13132 set getitimer d_getitimer
13133 eval $inlibc
13134
13135 : see if getlogin exists
13136 set getlogin d_getlogin
13137 eval $inlibc
13138
13139 : see if getlogin_r exists
13140 set getlogin_r d_getlogin_r
13141 eval $inlibc
13142 case "$d_getlogin_r" in
13143 "$define")
13144         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13145         case "$d_getlogin_r_proto:$usethreads" in
13146         ":define")      d_getlogin_r_proto=define
13147                 set d_getlogin_r_proto getlogin_r $hdrs
13148                 eval $hasproto ;;
13149         *)      ;;
13150         esac
13151         case "$d_getlogin_r_proto" in
13152         define)
13153         case "$getlogin_r_proto" in
13154         ''|0) try='int getlogin_r(char*, size_t);'
13155         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13156         esac
13157         case "$getlogin_r_proto" in
13158         ''|0) try='int getlogin_r(char*, int);'
13159         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13160         esac
13161         case "$getlogin_r_proto" in
13162         ''|0) try='char* getlogin_r(char*, size_t);'
13163         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13164         esac
13165         case "$getlogin_r_proto" in
13166         ''|0) try='char* getlogin_r(char*, int);'
13167         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13168         esac
13169         case "$getlogin_r_proto" in
13170         ''|0)   d_getlogin_r=undef
13171                 getlogin_r_proto=0
13172                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13173         * )     case "$getlogin_r_proto" in
13174                 REENTRANT_PROTO*) ;;
13175                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13176                 esac
13177                 echo "Prototype: $try" ;;
13178         esac
13179         ;;
13180         *)      case "$usethreads" in
13181                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13182                 esac
13183                 d_getlogin_r=undef
13184                 getlogin_r_proto=0
13185                 ;;
13186         esac
13187         ;;
13188 *)      getlogin_r_proto=0
13189         ;;
13190 esac
13191
13192 : see if getmnt exists
13193 set getmnt d_getmnt
13194 eval $inlibc
13195
13196 : see if getmntent exists
13197 set getmntent d_getmntent
13198 eval $inlibc
13199
13200 : see if getnetbyaddr exists
13201 set getnetbyaddr d_getnbyaddr
13202 eval $inlibc
13203
13204 : see if getnetbyname exists
13205 set getnetbyname d_getnbyname
13206 eval $inlibc
13207
13208 : see if getnetent exists
13209 set getnetent d_getnent
13210 eval $inlibc
13211
13212 : see if getnetbyaddr_r exists
13213 set getnetbyaddr_r d_getnetbyaddr_r
13214 eval $inlibc
13215 case "$d_getnetbyaddr_r" in
13216 "$define")
13217         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13218         case "$d_getnetbyaddr_r_proto:$usethreads" in
13219         ":define")      d_getnetbyaddr_r_proto=define
13220                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13221                 eval $hasproto ;;
13222         *)      ;;
13223         esac
13224         case "$d_getnetbyaddr_r_proto" in
13225         define)
13226         case "$getnetbyaddr_r_proto" in
13227         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13228         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13229         esac
13230         case "$getnetbyaddr_r_proto" in
13231         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13232         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13233         esac
13234         case "$getnetbyaddr_r_proto" in
13235         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13236         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13237         esac
13238         case "$getnetbyaddr_r_proto" in
13239         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13240         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13241         esac
13242         case "$getnetbyaddr_r_proto" in
13243         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13244         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13245         esac
13246         case "$getnetbyaddr_r_proto" in
13247         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13248         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13249         esac
13250         case "$getnetbyaddr_r_proto" in
13251         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13252         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13253         esac
13254         case "$getnetbyaddr_r_proto" in
13255         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13256         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13257         esac
13258         case "$getnetbyaddr_r_proto" in
13259         ''|0)   d_getnetbyaddr_r=undef
13260                 getnetbyaddr_r_proto=0
13261                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13262         * )     case "$getnetbyaddr_r_proto" in
13263                 REENTRANT_PROTO*) ;;
13264                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13265                 esac
13266                 echo "Prototype: $try" ;;
13267         esac
13268         ;;
13269         *)      case "$usethreads" in
13270                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13271                 esac
13272                 d_getnetbyaddr_r=undef
13273                 getnetbyaddr_r_proto=0
13274                 ;;
13275         esac
13276         ;;
13277 *)      getnetbyaddr_r_proto=0
13278         ;;
13279 esac
13280
13281 : see if getnetbyname_r exists
13282 set getnetbyname_r d_getnetbyname_r
13283 eval $inlibc
13284 case "$d_getnetbyname_r" in
13285 "$define")
13286         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13287         case "$d_getnetbyname_r_proto:$usethreads" in
13288         ":define")      d_getnetbyname_r_proto=define
13289                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13290                 eval $hasproto ;;
13291         *)      ;;
13292         esac
13293         case "$d_getnetbyname_r_proto" in
13294         define)
13295         case "$getnetbyname_r_proto" in
13296         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13297         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13298         esac
13299         case "$getnetbyname_r_proto" in
13300         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13301         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13302         esac
13303         case "$getnetbyname_r_proto" in
13304         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13305         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13306         esac
13307         case "$getnetbyname_r_proto" in
13308         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13309         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13310         esac
13311         case "$getnetbyname_r_proto" in
13312         ''|0)   d_getnetbyname_r=undef
13313                 getnetbyname_r_proto=0
13314                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13315         * )     case "$getnetbyname_r_proto" in
13316                 REENTRANT_PROTO*) ;;
13317                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13318                 esac
13319                 echo "Prototype: $try" ;;
13320         esac
13321         ;;
13322         *)      case "$usethreads" in
13323                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13324                 esac
13325                 d_getnetbyname_r=undef
13326                 getnetbyname_r_proto=0
13327                 ;;
13328         esac
13329         ;;
13330 *)      getnetbyname_r_proto=0
13331         ;;
13332 esac
13333
13334 : see if getnetent_r exists
13335 set getnetent_r d_getnetent_r
13336 eval $inlibc
13337 case "$d_getnetent_r" in
13338 "$define")
13339         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13340         case "$d_getnetent_r_proto:$usethreads" in
13341         ":define")      d_getnetent_r_proto=define
13342                 set d_getnetent_r_proto getnetent_r $hdrs
13343                 eval $hasproto ;;
13344         *)      ;;
13345         esac
13346         case "$d_getnetent_r_proto" in
13347         define)
13348         case "$getnetent_r_proto" in
13349         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13350         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13351         esac
13352         case "$getnetent_r_proto" in
13353         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13354         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13355         esac
13356         case "$getnetent_r_proto" in
13357         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13358         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13359         esac
13360         case "$getnetent_r_proto" in
13361         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13362         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13363         esac
13364         case "$getnetent_r_proto" in
13365         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13366         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13367         esac
13368         case "$getnetent_r_proto" in
13369         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13370         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13371         esac
13372         case "$getnetent_r_proto" in
13373         ''|0)   d_getnetent_r=undef
13374                 getnetent_r_proto=0
13375                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13376         * )     case "$getnetent_r_proto" in
13377                 REENTRANT_PROTO*) ;;
13378                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13379                 esac
13380                 echo "Prototype: $try" ;;
13381         esac
13382         ;;
13383         *)      case "$usethreads" in
13384                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13385                 esac
13386                 d_getnetent_r=undef
13387                 getnetent_r_proto=0
13388                 ;;
13389         esac
13390         ;;
13391 *)      getnetent_r_proto=0
13392         ;;
13393 esac
13394
13395 : see if prototypes for various getnetxxx netdb.h functions are available
13396 echo " "
13397 set d_getnetprotos getnetent $i_netdb netdb.h
13398 eval $hasproto
13399
13400 : see if getpagesize exists
13401 set getpagesize d_getpagsz
13402 eval $inlibc
13403
13404
13405 : see if getprotobyname exists
13406 set getprotobyname d_getpbyname
13407 eval $inlibc
13408
13409 : see if getprotobynumber exists
13410 set getprotobynumber d_getpbynumber
13411 eval $inlibc
13412
13413 : see if getprotoent exists
13414 set getprotoent d_getpent
13415 eval $inlibc
13416
13417 : see if getpgid exists
13418 set getpgid d_getpgid
13419 eval $inlibc
13420
13421 : see if getpgrp2 exists
13422 set getpgrp2 d_getpgrp2
13423 eval $inlibc
13424
13425 : see if getppid exists
13426 set getppid d_getppid
13427 eval $inlibc
13428
13429 : see if getpriority exists
13430 set getpriority d_getprior
13431 eval $inlibc
13432
13433 : see if getprotobyname_r exists
13434 set getprotobyname_r d_getprotobyname_r
13435 eval $inlibc
13436 case "$d_getprotobyname_r" in
13437 "$define")
13438         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13439         case "$d_getprotobyname_r_proto:$usethreads" in
13440         ":define")      d_getprotobyname_r_proto=define
13441                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13442                 eval $hasproto ;;
13443         *)      ;;
13444         esac
13445         case "$d_getprotobyname_r_proto" in
13446         define)
13447         case "$getprotobyname_r_proto" in
13448         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13449         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13450         esac
13451         case "$getprotobyname_r_proto" in
13452         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13453         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13454         esac
13455         case "$getprotobyname_r_proto" in
13456         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13457         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13458         esac
13459         case "$getprotobyname_r_proto" in
13460         ''|0)   d_getprotobyname_r=undef
13461                 getprotobyname_r_proto=0
13462                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13463         * )     case "$getprotobyname_r_proto" in
13464                 REENTRANT_PROTO*) ;;
13465                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13466                 esac
13467                 echo "Prototype: $try" ;;
13468         esac
13469         ;;
13470         *)      case "$usethreads" in
13471                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13472                 esac
13473                 d_getprotobyname_r=undef
13474                 getprotobyname_r_proto=0
13475                 ;;
13476         esac
13477         ;;
13478 *)      getprotobyname_r_proto=0
13479         ;;
13480 esac
13481
13482 : see if getprotobynumber_r exists
13483 set getprotobynumber_r d_getprotobynumber_r
13484 eval $inlibc
13485 case "$d_getprotobynumber_r" in
13486 "$define")
13487         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13488         case "$d_getprotobynumber_r_proto:$usethreads" in
13489         ":define")      d_getprotobynumber_r_proto=define
13490                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13491                 eval $hasproto ;;
13492         *)      ;;
13493         esac
13494         case "$d_getprotobynumber_r_proto" in
13495         define)
13496         case "$getprotobynumber_r_proto" in
13497         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13498         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13499         esac
13500         case "$getprotobynumber_r_proto" in
13501         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13502         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13503         esac
13504         case "$getprotobynumber_r_proto" in
13505         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13506         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13507         esac
13508         case "$getprotobynumber_r_proto" in
13509         ''|0)   d_getprotobynumber_r=undef
13510                 getprotobynumber_r_proto=0
13511                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13512         * )     case "$getprotobynumber_r_proto" in
13513                 REENTRANT_PROTO*) ;;
13514                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13515                 esac
13516                 echo "Prototype: $try" ;;
13517         esac
13518         ;;
13519         *)      case "$usethreads" in
13520                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13521                 esac
13522                 d_getprotobynumber_r=undef
13523                 getprotobynumber_r_proto=0
13524                 ;;
13525         esac
13526         ;;
13527 *)      getprotobynumber_r_proto=0
13528         ;;
13529 esac
13530
13531 : see if getprotoent_r exists
13532 set getprotoent_r d_getprotoent_r
13533 eval $inlibc
13534 case "$d_getprotoent_r" in
13535 "$define")
13536         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13537         case "$d_getprotoent_r_proto:$usethreads" in
13538         ":define")      d_getprotoent_r_proto=define
13539                 set d_getprotoent_r_proto getprotoent_r $hdrs
13540                 eval $hasproto ;;
13541         *)      ;;
13542         esac
13543         case "$d_getprotoent_r_proto" in
13544         define)
13545         case "$getprotoent_r_proto" in
13546         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13547         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13548         esac
13549         case "$getprotoent_r_proto" in
13550         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13551         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13552         esac
13553         case "$getprotoent_r_proto" in
13554         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13555         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13556         esac
13557         case "$getprotoent_r_proto" in
13558         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13559         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13560         esac
13561         case "$getprotoent_r_proto" in
13562         ''|0)   d_getprotoent_r=undef
13563                 getprotoent_r_proto=0
13564                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13565         * )     case "$getprotoent_r_proto" in
13566                 REENTRANT_PROTO*) ;;
13567                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13568                 esac
13569                 echo "Prototype: $try" ;;
13570         esac
13571         ;;
13572         *)      case "$usethreads" in
13573                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13574                 esac
13575                 d_getprotoent_r=undef
13576                 getprotoent_r_proto=0
13577                 ;;
13578         esac
13579         ;;
13580 *)      getprotoent_r_proto=0
13581         ;;
13582 esac
13583
13584 : see if prototypes for various getprotoxxx netdb.h functions are available
13585 echo " "
13586 set d_getprotoprotos getprotoent $i_netdb netdb.h
13587 eval $hasproto
13588
13589 : see if getprpwnam exists
13590 set getprpwnam d_getprpwnam
13591 eval $inlibc
13592
13593 : see if getpwent exists
13594 set getpwent d_getpwent
13595 eval $inlibc
13596
13597 : see if getpwent_r exists
13598 set getpwent_r d_getpwent_r
13599 eval $inlibc
13600 case "$d_getpwent_r" in
13601 "$define")
13602         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13603         case "$d_getpwent_r_proto:$usethreads" in
13604         ":define")      d_getpwent_r_proto=define
13605                 set d_getpwent_r_proto getpwent_r $hdrs
13606                 eval $hasproto ;;
13607         *)      ;;
13608         esac
13609         case "$d_getpwent_r_proto" in
13610         define)
13611         case "$getpwent_r_proto" in
13612         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13613         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13614         esac
13615         case "$getpwent_r_proto" in
13616         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13617         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13618         esac
13619         case "$getpwent_r_proto" in
13620         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13621         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13622         esac
13623         case "$getpwent_r_proto" in
13624         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13625         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13626         esac
13627         case "$getpwent_r_proto" in
13628         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13629         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13630         esac
13631         case "$getpwent_r_proto" in
13632         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13633         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13634         esac
13635         case "$getpwent_r_proto" in
13636         ''|0)   d_getpwent_r=undef
13637                 getpwent_r_proto=0
13638                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13639         * )     case "$getpwent_r_proto" in
13640                 REENTRANT_PROTO*) ;;
13641                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13642                 esac
13643                 echo "Prototype: $try" ;;
13644         esac
13645         ;;
13646         *)      case "$usethreads" in
13647                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13648                 esac
13649                 d_getpwent_r=undef
13650                 getpwent_r_proto=0
13651                 ;;
13652         esac
13653         ;;
13654 *)      getpwent_r_proto=0
13655         ;;
13656 esac
13657
13658 : see if getpwnam_r exists
13659 set getpwnam_r d_getpwnam_r
13660 eval $inlibc
13661 case "$d_getpwnam_r" in
13662 "$define")
13663         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13664         case "$d_getpwnam_r_proto:$usethreads" in
13665         ":define")      d_getpwnam_r_proto=define
13666                 set d_getpwnam_r_proto getpwnam_r $hdrs
13667                 eval $hasproto ;;
13668         *)      ;;
13669         esac
13670         case "$d_getpwnam_r_proto" in
13671         define)
13672         case "$getpwnam_r_proto" in
13673         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13674         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13675         esac
13676         case "$getpwnam_r_proto" in
13677         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13678         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13679         esac
13680         case "$getpwnam_r_proto" in
13681         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13682         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13683         esac
13684         case "$getpwnam_r_proto" in
13685         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13686         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13687         esac
13688         case "$getpwnam_r_proto" in
13689         ''|0)   d_getpwnam_r=undef
13690                 getpwnam_r_proto=0
13691                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13692         * )     case "$getpwnam_r_proto" in
13693                 REENTRANT_PROTO*) ;;
13694                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13695                 esac
13696                 echo "Prototype: $try" ;;
13697         esac
13698         ;;
13699         *)      case "$usethreads" in
13700                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13701                 esac
13702                 d_getpwnam_r=undef
13703                 getpwnam_r_proto=0
13704                 ;;
13705         esac
13706         ;;
13707 *)      getpwnam_r_proto=0
13708         ;;
13709 esac
13710
13711 : see if getpwuid_r exists
13712 set getpwuid_r d_getpwuid_r
13713 eval $inlibc
13714 case "$d_getpwuid_r" in
13715 "$define")
13716         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13717         case "$d_getpwuid_r_proto:$usethreads" in
13718         ":define")      d_getpwuid_r_proto=define
13719                 set d_getpwuid_r_proto getpwuid_r $hdrs
13720                 eval $hasproto ;;
13721         *)      ;;
13722         esac
13723         case "$d_getpwuid_r_proto" in
13724         define)
13725         case "$getpwuid_r_proto" in
13726         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13727         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13728         esac
13729         case "$getpwuid_r_proto" in
13730         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13731         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13732         esac
13733         case "$getpwuid_r_proto" in
13734         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13735         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13736         esac
13737         case "$getpwuid_r_proto" in
13738         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13739         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13740         esac
13741         case "$getpwuid_r_proto" in
13742         ''|0)   d_getpwuid_r=undef
13743                 getpwuid_r_proto=0
13744                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13745         * )     case "$getpwuid_r_proto" in
13746                 REENTRANT_PROTO*) ;;
13747                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13748                 esac
13749                 echo "Prototype: $try" ;;
13750         esac
13751         ;;
13752         *)      case "$usethreads" in
13753                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13754                 esac
13755                 d_getpwuid_r=undef
13756                 getpwuid_r_proto=0
13757                 ;;
13758         esac
13759         ;;
13760 *)      getpwuid_r_proto=0
13761         ;;
13762 esac
13763
13764
13765 : see if getservbyname exists
13766 set getservbyname d_getsbyname
13767 eval $inlibc
13768
13769 : see if getservbyport exists
13770 set getservbyport d_getsbyport
13771 eval $inlibc
13772
13773 : see if getservent exists
13774 set getservent d_getsent
13775 eval $inlibc
13776
13777 : see if getservbyname_r exists
13778 set getservbyname_r d_getservbyname_r
13779 eval $inlibc
13780 case "$d_getservbyname_r" in
13781 "$define")
13782         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13783         case "$d_getservbyname_r_proto:$usethreads" in
13784         ":define")      d_getservbyname_r_proto=define
13785                 set d_getservbyname_r_proto getservbyname_r $hdrs
13786                 eval $hasproto ;;
13787         *)      ;;
13788         esac
13789         case "$d_getservbyname_r_proto" in
13790         define)
13791         case "$getservbyname_r_proto" in
13792         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13793         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13794         esac
13795         case "$getservbyname_r_proto" in
13796         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13797         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13798         esac
13799         case "$getservbyname_r_proto" in
13800         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13801         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13802         esac
13803         case "$getservbyname_r_proto" in
13804         ''|0)   d_getservbyname_r=undef
13805                 getservbyname_r_proto=0
13806                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13807         * )     case "$getservbyname_r_proto" in
13808                 REENTRANT_PROTO*) ;;
13809                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13810                 esac
13811                 echo "Prototype: $try" ;;
13812         esac
13813         ;;
13814         *)      case "$usethreads" in
13815                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13816                 esac
13817                 d_getservbyname_r=undef
13818                 getservbyname_r_proto=0
13819                 ;;
13820         esac
13821         ;;
13822 *)      getservbyname_r_proto=0
13823         ;;
13824 esac
13825
13826 : see if getservbyport_r exists
13827 set getservbyport_r d_getservbyport_r
13828 eval $inlibc
13829 case "$d_getservbyport_r" in
13830 "$define")
13831         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13832         case "$d_getservbyport_r_proto:$usethreads" in
13833         ":define")      d_getservbyport_r_proto=define
13834                 set d_getservbyport_r_proto getservbyport_r $hdrs
13835                 eval $hasproto ;;
13836         *)      ;;
13837         esac
13838         case "$d_getservbyport_r_proto" in
13839         define)
13840         case "$getservbyport_r_proto" in
13841         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13842         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13843         esac
13844         case "$getservbyport_r_proto" in
13845         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13846         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13847         esac
13848         case "$getservbyport_r_proto" in
13849         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13850         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13851         esac
13852         case "$getservbyport_r_proto" in
13853         ''|0)   d_getservbyport_r=undef
13854                 getservbyport_r_proto=0
13855                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13856         * )     case "$getservbyport_r_proto" in
13857                 REENTRANT_PROTO*) ;;
13858                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13859                 esac
13860                 echo "Prototype: $try" ;;
13861         esac
13862         ;;
13863         *)      case "$usethreads" in
13864                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13865                 esac
13866                 d_getservbyport_r=undef
13867                 getservbyport_r_proto=0
13868                 ;;
13869         esac
13870         ;;
13871 *)      getservbyport_r_proto=0
13872         ;;
13873 esac
13874
13875 : see if getservent_r exists
13876 set getservent_r d_getservent_r
13877 eval $inlibc
13878 case "$d_getservent_r" in
13879 "$define")
13880         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13881         case "$d_getservent_r_proto:$usethreads" in
13882         ":define")      d_getservent_r_proto=define
13883                 set d_getservent_r_proto getservent_r $hdrs
13884                 eval $hasproto ;;
13885         *)      ;;
13886         esac
13887         case "$d_getservent_r_proto" in
13888         define)
13889         case "$getservent_r_proto" in
13890         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13891         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13892         esac
13893         case "$getservent_r_proto" in
13894         ''|0) try='int getservent_r(struct servent*, char*, int);'
13895         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13896         esac
13897         case "$getservent_r_proto" in
13898         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13899         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13900         esac
13901         case "$getservent_r_proto" in
13902         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13903         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13904         esac
13905         case "$getservent_r_proto" in
13906         ''|0)   d_getservent_r=undef
13907                 getservent_r_proto=0
13908                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13909         * )     case "$getservent_r_proto" in
13910                 REENTRANT_PROTO*) ;;
13911                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13912                 esac
13913                 echo "Prototype: $try" ;;
13914         esac
13915         ;;
13916         *)      case "$usethreads" in
13917                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13918                 esac
13919                 d_getservent_r=undef
13920                 getservent_r_proto=0
13921                 ;;
13922         esac
13923         ;;
13924 *)      getservent_r_proto=0
13925         ;;
13926 esac
13927
13928 : see if prototypes for various getservxxx netdb.h functions are available
13929 echo " "
13930 set d_getservprotos getservent $i_netdb netdb.h
13931 eval $hasproto
13932
13933 : see if getspnam exists
13934 set getspnam d_getspnam
13935 eval $inlibc
13936
13937 : see if this is a shadow.h system
13938 set shadow.h i_shadow
13939 eval $inhdr
13940
13941 : see if getspnam_r exists
13942 set getspnam_r d_getspnam_r
13943 eval $inlibc
13944 case "$d_getspnam_r" in
13945 "$define")
13946         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13947         case "$d_getspnam_r_proto:$usethreads" in
13948         ":define")      d_getspnam_r_proto=define
13949                 set d_getspnam_r_proto getspnam_r $hdrs
13950                 eval $hasproto ;;
13951         *)      ;;
13952         esac
13953         case "$d_getspnam_r_proto" in
13954         define)
13955         case "$getspnam_r_proto" in
13956         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13957         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13958         esac
13959         case "$getspnam_r_proto" in
13960         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13961         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13962         esac
13963         case "$getspnam_r_proto" in
13964         ''|0)   d_getspnam_r=undef
13965                 getspnam_r_proto=0
13966                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13967         * )     case "$getspnam_r_proto" in
13968                 REENTRANT_PROTO*) ;;
13969                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13970                 esac
13971                 echo "Prototype: $try" ;;
13972         esac
13973         ;;
13974         *)      case "$usethreads" in
13975                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13976                 esac
13977                 d_getspnam_r=undef
13978                 getspnam_r_proto=0
13979                 ;;
13980         esac
13981         ;;
13982 *)      getspnam_r_proto=0
13983         ;;
13984 esac
13985
13986 : see if gettimeofday or ftime exists
13987 set gettimeofday d_gettimeod
13988 eval $inlibc
13989 case "$d_gettimeod" in
13990 "$undef")
13991         set ftime d_ftime 
13992         eval $inlibc
13993         ;;
13994 *)
13995         val="$undef"; set d_ftime; eval $setvar
13996         ;;
13997 esac
13998 case "$d_gettimeod$d_ftime" in
13999 "$undef$undef")
14000         echo " "
14001         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14002         ;;
14003 esac
14004
14005 : see if gmtime_r exists
14006 set gmtime_r d_gmtime_r
14007 eval $inlibc
14008 case "$d_gmtime_r" in
14009 "$define")
14010         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14011         case "$d_gmtime_r_proto:$usethreads" in
14012         ":define")      d_gmtime_r_proto=define
14013                 set d_gmtime_r_proto gmtime_r $hdrs
14014                 eval $hasproto ;;
14015         *)      ;;
14016         esac
14017         case "$d_gmtime_r_proto" in
14018         define)
14019         case "$gmtime_r_proto" in
14020         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14021         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14022         esac
14023         case "$gmtime_r_proto" in
14024         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14025         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14026         esac
14027         case "$gmtime_r_proto" in
14028         ''|0)   d_gmtime_r=undef
14029                 gmtime_r_proto=0
14030                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14031         * )     case "$gmtime_r_proto" in
14032                 REENTRANT_PROTO*) ;;
14033                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14034                 esac
14035                 echo "Prototype: $try" ;;
14036         esac
14037         ;;
14038         *)      case "$usethreads" in
14039                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14040                 esac
14041                 d_gmtime_r=undef
14042                 gmtime_r_proto=0
14043                 ;;
14044         esac
14045         ;;
14046 *)      gmtime_r_proto=0
14047         ;;
14048 esac
14049
14050 : see if hasmntopt exists
14051 set hasmntopt d_hasmntopt
14052 eval $inlibc
14053
14054 : see if this is a netinet/in.h or sys/in.h system
14055 set netinet/in.h i_niin sys/in.h i_sysin
14056 eval $inhdr
14057
14058 : see if arpa/inet.h has to be included
14059 set arpa/inet.h i_arpainet
14060 eval $inhdr
14061
14062 : see if htonl --and friends-- exists
14063 val=''
14064 set htonl val
14065 eval $inlibc
14066
14067 : Maybe they are macros.
14068 case "$val" in
14069 $undef)
14070         $cat >htonl.c <<EOM
14071 #include <stdio.h>
14072 #include <sys/types.h>
14073 #$i_niin I_NETINET_IN
14074 #$i_sysin I_SYS_IN
14075 #$i_arpainet I_ARPA_INET
14076 #ifdef I_NETINET_IN
14077 #include <netinet/in.h>
14078 #endif
14079 #ifdef I_SYS_IN
14080 #include <sys/in.h>
14081 #endif
14082 #ifdef I_ARPA_INET
14083 #include <arpa/inet.h>
14084 #endif
14085 #ifdef htonl
14086 printf("Defined as a macro.");
14087 #endif
14088 EOM
14089         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14090         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14091                 val="$define"
14092                 echo "But it seems to be defined as a macro." >&4
14093         fi
14094         $rm -f htonl.?
14095         ;;
14096 esac
14097 set d_htonl
14098 eval $setvar
14099
14100 : see if ilogbl exists
14101 set ilogbl d_ilogbl
14102 eval $inlibc
14103
14104 : index or strchr
14105 echo " "
14106 if set index val -f; eval $csym; $val; then
14107         if set strchr val -f d_strchr; eval $csym; $val; then
14108                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14109                         val="$define"
14110                         vali="$undef"
14111                         echo "strchr() found." >&4
14112                 else
14113                         val="$undef"
14114                         vali="$define"
14115                         echo "index() found." >&4
14116                 fi
14117         else
14118                 val="$undef"
14119                 vali="$define"
14120                 echo "index() found." >&4
14121         fi
14122 else
14123         if set strchr val -f d_strchr; eval $csym; $val; then
14124                 val="$define"
14125                 vali="$undef"
14126                 echo "strchr() found." >&4
14127         else
14128                 echo "No index() or strchr() found!" >&4
14129                 val="$undef"
14130                 vali="$undef"
14131         fi
14132 fi
14133 set d_strchr; eval $setvar
14134 val="$vali"
14135 set d_index; eval $setvar
14136
14137 : check whether inet_aton exists
14138 set inet_aton d_inetaton
14139 eval $inlibc
14140
14141 : Look for isascii
14142 echo " "
14143 $cat >isascii.c <<EOCP
14144 #include <stdio.h>
14145 #include <ctype.h>
14146 #$i_stdlib I_STDLIB
14147 #ifdef I_STDLIB
14148 #include <stdlib.h>
14149 #endif
14150 int main() {
14151         int c = 'A';
14152         if (isascii(c))
14153                 exit(0);
14154         else
14155                 exit(1);
14156 }
14157 EOCP
14158 set isascii
14159 if eval $compile; then
14160         echo "isascii() found." >&4
14161         val="$define"
14162 else
14163         echo "isascii() NOT found." >&4
14164         val="$undef"
14165 fi
14166 set d_isascii
14167 eval $setvar
14168 $rm -f isascii*
14169
14170 : see if isfinite exists
14171 set isfinite d_isfinite
14172 eval $inlibc
14173
14174 : see if isinf exists
14175 set isinf d_isinf
14176 eval $inlibc
14177
14178 : see if isnan exists
14179 set isnan d_isnan
14180 eval $inlibc
14181
14182 : see if isnanl exists
14183 set isnanl d_isnanl
14184 eval $inlibc
14185
14186 : see if killpg exists
14187 set killpg d_killpg
14188 eval $inlibc
14189
14190 : see if lchown exists
14191 echo " "
14192 $cat > try.c <<'EOCP'
14193 /* System header to define __stub macros and hopefully few prototypes,
14194     which can conflict with char lchown(); below.  */
14195 #include <assert.h>
14196 /* Override any gcc2 internal prototype to avoid an error.  */
14197 /* We use char because int might match the return type of a gcc2
14198    builtin and then its argument prototype would still apply.  */
14199 char lchown();
14200 int main() {
14201     /*  The GNU C library defines this for functions which it implements
14202         to always fail with ENOSYS.  Some functions are actually named
14203         something starting with __ and the normal name is an alias.  */
14204 #if defined (__stub_lchown) || defined (__stub___lchown)
14205 choke me
14206 #else
14207 lchown();
14208 #endif
14209 ; return 0; }
14210 EOCP
14211 set try
14212 if eval $compile; then
14213     $echo "lchown() found." >&4
14214     val="$define"
14215 else
14216     $echo "lchown() NOT found." >&4
14217     val="$undef"
14218 fi
14219 set d_lchown
14220 eval $setvar
14221
14222 : See if number of significant digits in a double precision number is known
14223 echo " "
14224 $cat >ldbl_dig.c <<EOM
14225 #$i_limits I_LIMITS
14226 #$i_float I_FLOAT
14227 #ifdef I_LIMITS
14228 #include <limits.h>
14229 #endif
14230 #ifdef I_FLOAT
14231 #include <float.h>
14232 #endif
14233 #ifdef LDBL_DIG
14234 printf("Contains LDBL_DIG");
14235 #endif
14236 EOM
14237 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14238 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14239         echo "LDBL_DIG found." >&4
14240         val="$define"
14241 else
14242         echo "LDBL_DIG NOT found." >&4
14243         val="$undef"
14244 fi
14245 $rm -f ldbl_dig.?
14246 set d_ldbl_dig
14247 eval $setvar
14248
14249 : see if this is a math.h system
14250 set math.h i_math
14251 eval $inhdr
14252
14253 d_libm_lib_version="$undef"
14254 case $i_math in
14255     $define)
14256         : check to see if math.h defines _LIB_VERSION
14257         echo " "
14258         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14259         $cat >try.c <<EOCP
14260 #include <unistd.h>
14261 #include <math.h>
14262 int main (int argc, char *argv[])
14263 {
14264     printf ("%d\n", _LIB_VERSION);
14265     return (0);
14266     } /* main */
14267 EOCP
14268         set try
14269         if eval $compile; then
14270             foo=`$run ./try`
14271             echo "Yes, it does ($foo)" >&4
14272             d_libm_lib_version="$define"
14273         else
14274             echo "No, it does not (probably harmless)\n" >&4
14275             fi
14276         $rm -f try.* try core core.try.*
14277         ;;
14278
14279     esac
14280
14281 : see if link exists
14282 set link d_link
14283 eval $inlibc
14284
14285 : see if localtime_r exists
14286 set localtime_r d_localtime_r
14287 eval $inlibc
14288 case "$d_localtime_r" in
14289 "$define")
14290         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14291         case "$d_localtime_r_proto:$usethreads" in
14292         ":define")      d_localtime_r_proto=define
14293                 set d_localtime_r_proto localtime_r $hdrs
14294                 eval $hasproto ;;
14295         *)      ;;
14296         esac
14297         case "$d_localtime_r_proto" in
14298         define)
14299         case "$localtime_r_proto" in
14300         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14301         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14302         esac
14303         case "$localtime_r_proto" in
14304         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14305         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14306         esac
14307         case "$localtime_r_proto" in
14308         ''|0)   d_localtime_r=undef
14309                 localtime_r_proto=0
14310                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14311         * )     case "$localtime_r_proto" in
14312                 REENTRANT_PROTO*) ;;
14313                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14314                 esac
14315                 echo "Prototype: $try" ;;
14316         esac
14317         ;;
14318         *)      case "$usethreads" in
14319                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14320                 esac
14321                 d_localtime_r=undef
14322                 localtime_r_proto=0
14323                 ;;
14324         esac
14325         ;;
14326 *)      localtime_r_proto=0
14327         ;;
14328 esac
14329
14330 : see if localeconv exists
14331 set localeconv d_locconv
14332 eval $inlibc
14333
14334 : see if lockf exists
14335 set lockf d_lockf
14336 eval $inlibc
14337
14338 : see if prototype for lseek is available
14339 echo " "
14340 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14341 eval $hasproto
14342
14343 : see if lstat exists
14344 set lstat d_lstat
14345 eval $inlibc
14346
14347 : see if madvise exists
14348 set madvise d_madvise
14349 eval $inlibc
14350
14351 : see if malloc_size exists
14352 set malloc_size d_malloc_size
14353 eval $inlibc
14354
14355 : see if malloc_size_good exists
14356 set malloc_good_size d_malloc_good_size
14357 eval $inlibc
14358
14359 : see if mblen exists
14360 set mblen d_mblen
14361 eval $inlibc
14362
14363 : see if mbstowcs exists
14364 set mbstowcs d_mbstowcs
14365 eval $inlibc
14366
14367 : see if mbtowc exists
14368 set mbtowc d_mbtowc
14369 eval $inlibc
14370
14371 : see if memchr exists
14372 set memchr d_memchr
14373 eval $inlibc
14374
14375 : see if memcmp exists
14376 set memcmp d_memcmp
14377 eval $inlibc
14378
14379 : see if memcpy exists
14380 set memcpy d_memcpy
14381 eval $inlibc
14382
14383 : see if memmove exists
14384 set memmove d_memmove
14385 eval $inlibc
14386
14387 : see if memset exists
14388 set memset d_memset
14389 eval $inlibc
14390
14391 : see if mkdir exists
14392 set mkdir d_mkdir
14393 eval $inlibc
14394
14395 : see if mkdtemp exists
14396 set mkdtemp d_mkdtemp
14397 eval $inlibc
14398
14399 : see if mkfifo exists
14400 set mkfifo d_mkfifo
14401 eval $inlibc
14402
14403 : see if mkstemp exists
14404 set mkstemp d_mkstemp
14405 eval $inlibc
14406
14407 : see if mkstemps exists
14408 set mkstemps d_mkstemps
14409 eval $inlibc
14410
14411 : see if mktime exists
14412 set mktime d_mktime
14413 eval $inlibc
14414
14415 : see if this is a sys/mman.h system
14416 set sys/mman.h i_sysmman
14417 eval $inhdr
14418
14419 : see if mmap exists
14420 set mmap d_mmap
14421 eval $inlibc
14422 : see what shmat returns
14423 : default to something harmless
14424 mmaptype='void *'
14425 case "$i_sysmman$d_mmap" in
14426 "$define$define")
14427         $cat >mmap.c <<'END'
14428 #include <sys/mman.h>
14429 void *mmap();
14430 END
14431         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14432                 mmaptype='void *'
14433         else
14434                 mmaptype='caddr_t'
14435         fi
14436         echo "and it returns ($mmaptype)." >&4
14437         ;;
14438 esac
14439
14440
14441
14442 : see if sqrtl exists
14443 set sqrtl d_sqrtl
14444 eval $inlibc
14445
14446 : see if scalbnl exists
14447 set scalbnl d_scalbnl
14448 eval $inlibc
14449
14450 : see if modfl exists
14451 set modfl d_modfl
14452 eval $inlibc
14453
14454 : see if prototype for modfl is available
14455 echo " "
14456 set d_modflproto modfl $i_math math.h
14457 eval $hasproto
14458
14459 d_modfl_pow32_bug="$undef"
14460
14461 case "$d_longdbl$d_modfl" in
14462 $define$define)
14463         $cat <<EOM
14464 Checking to see whether your modfl() is okay for large values...
14465 EOM
14466 $cat >try.c <<EOCP
14467 #include <math.h> 
14468 #include <stdio.h>
14469 EOCP
14470 if $test "X$d_modflproto" != "X$define"; then
14471         $cat >>try.c <<EOCP
14472 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14473 long double modfl (long double, long double *);
14474 EOCP
14475 fi
14476 $cat >>try.c <<EOCP
14477 int main() {
14478     long double nv = 4294967303.15;
14479     long double v, w;
14480     v = modfl(nv, &w);         
14481 #ifdef __GLIBC__
14482     printf("glibc");
14483 #endif
14484     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14485     return 0;
14486 }
14487 EOCP
14488         case "$osname:$gccversion" in
14489         aix:)   saveccflags="$ccflags"
14490                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14491         esac
14492         set try
14493         if eval $compile; then
14494                 foo=`$run ./try`
14495                 case "$foo" in
14496                 *" 4294967303.150000 1.150000 4294967302.000000")
14497                         echo >&4 "Your modfl() is broken for large values."
14498                         d_modfl_pow32_bug="$define"
14499                         case "$foo" in
14500                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14501                         ;;
14502                         esac
14503                         ;;
14504                 *" 4294967303.150000 0.150000 4294967303.000000")
14505                         echo >&4 "Your modfl() seems okay for large values."
14506                         ;;
14507                 *)      echo >&4 "I don't understand your modfl() at all."
14508                         d_modfl="$undef"
14509                         ;;
14510                 esac
14511                 $rm -f try.* try core core.try.*
14512         else
14513                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14514                 d_modfl="$undef"
14515         fi
14516         case "$osname:$gccversion" in
14517         aix:)   ccflags="$saveccflags" ;; # restore
14518         esac
14519         ;;
14520 esac
14521
14522 if $test "$uselongdouble" = "$define"; then
14523     message=""
14524     if $test "$d_sqrtl" != "$define"; then
14525         message="$message sqrtl"
14526     fi
14527     if $test "$d_modfl" != "$define"; then
14528         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14529             echo "You have both aintl and copysignl, so I can emulate modfl."
14530         else
14531             message="$message modfl"
14532         fi
14533     fi
14534     if $test "$d_frexpl" != "$define"; then
14535         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14536             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14537         else
14538             message="$message frexpl"
14539         fi
14540     fi
14541
14542     if $test "$message" != ""; then
14543         $cat <<EOM >&4
14544
14545 *** You requested the use of long doubles but you do not seem to have
14546 *** the following mathematical functions needed for long double support:
14547 ***    $message
14548 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14549 *** Cannot continue, aborting.
14550
14551 EOM
14552
14553         exit 1
14554     fi
14555 fi
14556
14557 : see if mprotect exists
14558 set mprotect d_mprotect
14559 eval $inlibc
14560
14561 : see if msgctl exists
14562 set msgctl d_msgctl
14563 eval $inlibc
14564
14565 : see if msgget exists
14566 set msgget d_msgget
14567 eval $inlibc
14568
14569 : see if msgsnd exists
14570 set msgsnd d_msgsnd
14571 eval $inlibc
14572
14573 : see if msgrcv exists
14574 set msgrcv d_msgrcv
14575 eval $inlibc
14576
14577 : see how much of the 'msg*(2)' library is present.
14578 h_msg=true
14579 echo " "
14580 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14581 *"$undef"*) h_msg=false;;
14582 esac
14583 case "$osname" in
14584 freebsd)
14585     case "`ipcs 2>&1`" in
14586     "SVID messages"*"not configured"*)
14587         echo "Your $osname does not have the msg*(2) configured." >&4
14588         h_msg=false
14589         val="$undef"
14590         set msgctl d_msgctl
14591         eval $setvar
14592         set msgget d_msgget
14593         eval $setvar
14594         set msgsnd d_msgsnd
14595         eval $setvar
14596         set msgrcv d_msgrcv
14597         eval $setvar
14598         ;;
14599     esac
14600     ;;
14601 esac
14602 : we could also check for sys/ipc.h ...
14603 if $h_msg && $test `./findhdr sys/msg.h`; then
14604         echo "You have the full msg*(2) library." >&4
14605         val="$define"
14606 else
14607         echo "You don't have the full msg*(2) library." >&4
14608         val="$undef"
14609 fi
14610 set d_msg
14611 eval $setvar
14612
14613
14614 echo " "
14615 echo "Checking to see if your system supports struct msghdr..." >&4
14616 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14617 eval $hasstruct
14618 case "$d_msghdr_s" in
14619 "$define")      echo "Yes, it does."   ;;
14620 *)              echo "No, it doesn't." ;;
14621 esac
14622
14623
14624 : see if msync exists
14625 set msync d_msync
14626 eval $inlibc
14627
14628 : see if munmap exists
14629 set munmap d_munmap
14630 eval $inlibc
14631
14632 : see if nice exists
14633 set nice d_nice
14634 eval $inlibc
14635
14636 : see if this is a langinfo.h system
14637 set langinfo.h i_langinfo
14638 eval $inhdr
14639
14640 : see if nl_langinfo exists
14641 set nl_langinfo d_nl_langinfo
14642 eval $inlibc
14643
14644 : check for length of character
14645 echo " "
14646 case "$charsize" in
14647 '')
14648         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14649         $cat >try.c <<EOCP
14650 #include <stdio.h>
14651 #$i_stdlib I_STDLIB
14652 #ifdef I_STDLIB
14653 #include <stdlib.h>
14654 #endif
14655 int main()
14656 {
14657     printf("%d\n", (int)sizeof(char));
14658     exit(0);
14659 }
14660 EOCP
14661         set try
14662         if eval $compile_ok; then
14663                 dflt=`$run ./try`
14664         else
14665                 dflt='1'
14666                 echo "(I can't seem to compile the test program.  Guessing...)"
14667         fi
14668         ;;
14669 *)
14670         dflt="$charsize"
14671         ;;
14672 esac
14673 rp="What is the size of a character (in bytes)?"
14674 . ./myread
14675 charsize="$ans"
14676 $rm -f try.c try
14677
14678 : check for volatile keyword
14679 echo " "
14680 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14681 $cat >try.c <<'EOCP'
14682 int main()
14683 {
14684         typedef struct _goo_struct goo_struct;
14685         goo_struct * volatile goo = ((goo_struct *)0);
14686         struct _goo_struct {
14687                 long long_int;
14688                 int reg_int;
14689                 char char_var;
14690         };
14691         typedef unsigned short foo_t;
14692         char *volatile foo;
14693         volatile int bar;
14694         volatile foo_t blech;
14695         foo = foo;
14696 }
14697 EOCP
14698 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14699         val="$define"
14700         echo "Yup, it does."
14701 else
14702         val="$undef"
14703         echo "Nope, it doesn't."
14704 fi
14705 set d_volatile
14706 eval $setvar
14707 $rm -f try.*
14708
14709
14710 echo " "
14711 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14712
14713 case "$use64bitint:$d_quad:$quadtype" in
14714 define:define:?*)
14715         ivtype="$quadtype"
14716         uvtype="$uquadtype"
14717         ivsize=8
14718         uvsize=8
14719         ;;
14720 *)      ivtype="long"
14721         uvtype="unsigned long"
14722         ivsize=$longsize
14723         uvsize=$longsize
14724         ;;
14725 esac
14726
14727 case "$uselongdouble:$d_longdbl" in
14728 define:define)
14729         nvtype="long double"
14730         nvsize=$longdblsize
14731         ;;
14732 *)      nvtype=double
14733         nvsize=$doublesize
14734         ;;
14735 esac
14736
14737 $echo "(IV will be "$ivtype", $ivsize bytes)"
14738 $echo "(UV will be "$uvtype", $uvsize bytes)"
14739 $echo "(NV will be "$nvtype", $nvsize bytes)"
14740
14741 $cat >try.c <<EOCP
14742 #$i_inttypes I_INTTYPES
14743 #ifdef I_INTTYPES
14744 #include <inttypes.h>
14745 #endif
14746 #include <stdio.h>
14747 int main() {
14748 #ifdef INT8
14749    int8_t i =  INT8_MAX;
14750   uint8_t u = UINT8_MAX;
14751   printf("int8_t\n");
14752 #endif
14753 #ifdef INT16
14754    int16_t i =  INT16_MAX;
14755   uint16_t i = UINT16_MAX;
14756   printf("int16_t\n");
14757 #endif
14758 #ifdef INT32
14759    int32_t i =  INT32_MAX;
14760   uint32_t u = UINT32_MAX;
14761   printf("int32_t\n");
14762 #endif
14763 }
14764 EOCP
14765
14766 case "$i8type" in
14767 '')     case "$charsize" in
14768         1)      i8type=char
14769                 u8type="unsigned char"
14770                 i8size=$charsize
14771                 u8size=$charsize
14772                 ;;
14773         esac
14774         ;;
14775 esac
14776 case "$i8type" in
14777 '')     set try -DINT8
14778         if eval $compile; then
14779                 case "`$run ./try`" in
14780                 int8_t) i8type=int8_t
14781                         u8type=uint8_t
14782                         i8size=1
14783                         u8size=1
14784                         ;;
14785                 esac
14786         fi
14787         ;;
14788 esac
14789 case "$i8type" in
14790 '')     if $test $charsize -ge 1; then
14791                 i8type=char
14792                 u8type="unsigned char"
14793                 i8size=$charsize
14794                 u8size=$charsize
14795         fi
14796         ;;
14797 esac
14798
14799 case "$i16type" in
14800 '')     case "$shortsize" in
14801         2)      i16type=short
14802                 u16type="unsigned short"
14803                 i16size=$shortsize
14804                 u16size=$shortsize
14805                 ;;
14806         esac
14807         ;;
14808 esac
14809 case "$i16type" in
14810 '')     set try -DINT16
14811         if eval $compile; then
14812                 case "`$run ./try`" in
14813                 int16_t)
14814                         i16type=int16_t
14815                         u16type=uint16_t
14816                         i16size=2
14817                         u16size=2
14818                         ;;
14819                 esac
14820         fi
14821         ;;
14822 esac
14823 case "$i16type" in
14824 '')     if $test $shortsize -ge 2; then
14825                 i16type=short
14826                 u16type="unsigned short"
14827                 i16size=$shortsize
14828                 u16size=$shortsize
14829         fi
14830         ;;
14831 esac
14832
14833 case "$i32type" in
14834 '')     case "$longsize" in
14835         4)      i32type=long
14836                 u32type="unsigned long"
14837                 i32size=$longsize
14838                 u32size=$longsize
14839                 ;;
14840         *)      case "$intsize" in
14841                 4)      i32type=int
14842                         u32type="unsigned int"
14843                         i32size=$intsize
14844                         u32size=$intsize
14845                         ;;
14846                 esac
14847                 ;;
14848         esac
14849         ;;
14850 esac
14851 case "$i32type" in
14852 '')     set try -DINT32
14853         if eval $compile; then
14854                 case "`$run ./try`" in
14855                 int32_t)
14856                         i32type=int32_t
14857                         u32type=uint32_t
14858                         i32size=4
14859                         u32size=4
14860                         ;;
14861                 esac
14862         fi
14863         ;;
14864 esac
14865 case "$i32type" in
14866 '')     if $test $intsize -ge 4; then
14867                 i32type=int
14868                 u32type="unsigned int"
14869                 i32size=$intsize
14870                 u32size=$intsize
14871         fi
14872         ;;
14873 esac
14874
14875 case "$i64type" in
14876 '')     case "$d_quad:$quadtype" in
14877         define:?*)
14878                 i64type="$quadtype"
14879                 u64type="$uquadtype"
14880                 i64size=8
14881                 u64size=8
14882                 ;;
14883         esac
14884         ;;
14885 esac
14886
14887 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14888 : volatile so that the compiler has to store it out to memory.
14889 if test X"$d_volatile" = X"$define"; then
14890         volatile=volatile
14891 fi
14892 $cat <<EOP >try.c
14893 #include <stdio.h>
14894 #$i_stdlib I_STDLIB
14895 #ifdef I_STDLIB
14896 #include <stdlib.h>
14897 #endif
14898 #include <sys/types.h>
14899 #include <signal.h>
14900 #ifdef SIGFPE
14901 $volatile int bletched = 0;
14902 $signal_t blech(s) int s; { bletched = 1; }
14903 #endif
14904 int main() {
14905     $uvtype u = 0;
14906     $nvtype d;
14907     int     n = 8 * $uvsize;
14908     int     i;
14909 #ifdef SIGFPE
14910     signal(SIGFPE, blech);
14911 #endif
14912
14913     for (i = 0; i < n; i++) {
14914       u = u << 1 | ($uvtype)1;
14915       d = ($nvtype)u;
14916       if (($uvtype)d != u)
14917         break;
14918       if (d <= 0)
14919         break;
14920       d = ($nvtype)(u - 1);
14921       if (($uvtype)d != (u - 1))
14922         break;
14923 #ifdef SIGFPE
14924       if (bletched) {
14925         break;
14926 #endif
14927       } 
14928     }
14929     printf("%d\n", ((i == n) ? -n : i));
14930     exit(0);
14931 }
14932 EOP
14933 set try
14934
14935 d_nv_preserves_uv="$undef"
14936 if eval $compile; then
14937         nv_preserves_uv_bits="`$run ./try`"
14938 fi
14939 case "$nv_preserves_uv_bits" in
14940 \-[1-9]*)       
14941         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14942         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14943         d_nv_preserves_uv="$define"
14944         ;;
14945 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14946         d_nv_preserves_uv="$undef" ;;
14947 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14948         nv_preserves_uv_bits="$undef" ;;
14949 esac
14950
14951 $rm -f try.* try
14952
14953 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14954 : volatile so that the compiler has to store it out to memory.
14955 if test X"$d_volatile" = X"$define"; then
14956         volatile=volatile
14957 fi
14958 $cat <<EOP >try.c
14959 #include <stdio.h>
14960 #$i_stdlib I_STDLIB
14961 #ifdef I_STDLIB
14962 #include <stdlib.h>
14963 #endif
14964 #$i_string I_STRING
14965 #ifdef I_STRING
14966 #  include <string.h>
14967 #else
14968 #  include <strings.h>
14969 #endif
14970 #include <sys/types.h>
14971 #include <signal.h>
14972 #ifdef SIGFPE
14973 $volatile int bletched = 0;
14974 $signal_t blech(s) int s; { bletched = 1; }
14975 #endif
14976
14977 int checkit($nvtype d, char *where) {
14978     unsigned char *p = (char *)&d;
14979     unsigned char *end = p + sizeof(d);
14980     int fail = 0;
14981
14982     while (p < end)
14983         fail += *p++;
14984
14985     if (!fail)
14986         return 0;
14987
14988     p = (char *)&d;
14989     printf("No - %s: 0x", where);
14990     while (p < end)
14991         printf ("%02X", *p++);
14992     printf("\n");
14993     return 1;
14994 }
14995
14996 int main(int argc, char **argv) {
14997     $nvtype d = 0.0;
14998     int fail = 0;
14999     fail += checkit(d, "0.0");
15000
15001     /* The compiler shouldn't be assuming that bletched is 0  */
15002     d = bletched;
15003
15004     fail += checkit(d, "bleched");
15005
15006 #ifdef SIGFPE
15007     signal(SIGFPE, blech);
15008 #endif
15009
15010     /* Paranoia - the compiler should have no way of knowing that ANSI says
15011        that argv[argc] will always be NULL.  Actually, if it did assume this it
15012        would be buggy, as this is C and main() can be called from elsewhere in
15013        the program.  */
15014     d = argv[argc] ? 1 : 0;
15015
15016     if (d) {
15017         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15018     }
15019
15020     fail += checkit(d, "ternary");
15021
15022     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15023
15024     if (d != 0.0) {
15025         printf("No - memset doesn't give 0.0\n");
15026         /* This might just blow up:  */
15027         printf("(gives %g)\n", d);
15028         return 1;
15029     }
15030     
15031 #ifdef SIGFPE
15032     if (bletched) {
15033         printf("No - something bleched\n");
15034         return 1;
15035     }
15036 #endif
15037     if (fail) {
15038       printf("No - %d fail(s)\n", fail);
15039       return 1;
15040     }
15041     printf("Yes\n");
15042     return 0;
15043 }
15044 EOP
15045 set try
15046
15047 d_nv_zero_is_allbits_zero="$undef"
15048 if eval $compile; then
15049     xxx="`$run ./try`"
15050     case "$?" in
15051         0)
15052             case "$xxx" in
15053                 Yes)  cat >&4 <<EOM
15054 0.0 is represented as all bits zero in memory
15055 EOM
15056                     d_nv_zero_is_allbits_zero="$define"
15057                     ;;
15058                 *)  cat >&4 <<EOM
15059 0.0 is not represented as all bits zero in memory
15060 EOM
15061                     d_nv_zero_is_allbits_zero="$undef"
15062                     ;;
15063             esac
15064             ;;
15065         *)  cat >&4 <<EOM
15066 0.0 is not represented as all bits zero in memory
15067 EOM
15068             d_nv_zero_is_allbits_zero="$undef"
15069             ;;
15070     esac
15071 fi
15072
15073 $rm -f try.* try
15074
15075
15076 : check for off64_t
15077 echo " "
15078 echo "Checking to see if you have off64_t..." >&4
15079 $cat >try.c <<EOCP
15080 #include <sys/types.h>
15081 #include <unistd.h>
15082 int main() { off64_t x = 7; }
15083 EOCP
15084 set try
15085 if eval $compile; then
15086         val="$define"
15087         echo "You have off64_t."
15088 else
15089         val="$undef"
15090         echo "You do not have off64_t."
15091         case "$lseeksize" in
15092         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15093         esac
15094 fi
15095 $rm -f try.* try
15096 set d_off64_t
15097 eval $setvar
15098
15099 : how to create joinable pthreads
15100 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15101         echo " "
15102         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15103         $cat >try.c <<'EOCP'
15104 #include <pthread.h>
15105 int main() {
15106     int detachstate = JOINABLE;
15107 }
15108 EOCP
15109         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15110         if eval $compile; then
15111                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15112                 val="$undef" # Yes, undef.
15113                 set d_old_pthread_create_joinable
15114                 eval $setvar
15115                 val=""
15116                 set old_pthread_create_joinable
15117                 eval $setvar
15118         else
15119                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15120                 if eval $compile; then
15121                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15122                         val="$define"
15123                         set d_old_pthread_create_joinable
15124                         eval $setvar
15125                         val=PTHREAD_CREATE_UNDETACHED
15126                         set old_pthread_create_joinable
15127                         eval $setvar
15128                 else            
15129                         set try -DJOINABLE=__UNDETACHED
15130                         if eval $compile; then
15131                                 echo "You seem to use __UNDETACHED." >&4
15132                                 val="$define"
15133                                 set d_old_pthread_create_joinable
15134                                 eval $setvar
15135                                 val=__UNDETACHED
15136                                 set old_pthread_create_joinable
15137                                 eval $setvar
15138                         else
15139                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15140                                 val="$define"
15141                                 set d_old_pthread_create_joinable
15142                                 eval $setvar
15143                                 val=0
15144                                 set old_pthread_create_joinable
15145                                 eval $setvar
15146                         fi
15147                 fi
15148         fi
15149         $rm -f try try.*
15150 else
15151     d_old_pthread_create_joinable="$undef"
15152     old_pthread_create_joinable=""
15153 fi
15154
15155 : see if pause exists
15156 set pause d_pause
15157 eval $inlibc
15158
15159 : see if pipe exists
15160 set pipe d_pipe
15161 eval $inlibc
15162
15163 : see if poll exists
15164 set poll d_poll
15165 eval $inlibc
15166
15167 : see if readlink exists
15168 set readlink d_readlink
15169 eval $inlibc
15170
15171 echo " "
15172 procselfexe=''
15173 val="$undef"
15174 case "$d_readlink" in
15175 "$define")
15176         if $issymlink /proc/self/exe ; then
15177                 $ls -l /proc/self/exe > reflect
15178                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15179                         echo "You have Linux-like /proc/self/exe."
15180                         procselfexe='"/proc/self/exe"'
15181                         val="$define"
15182                 fi
15183         fi
15184         if $issymlink /proc/curproc/file ; then
15185                 $ls -l /proc/curproc/file > reflect
15186                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15187                         echo "You have BSD-like /proc/curproc/file."
15188                         procselfexe='"/proc/curproc/file"'
15189                         val="$define"
15190                 fi
15191         fi
15192         ;;
15193 esac
15194 $rm -f reflect
15195 set d_procselfexe
15196 eval $setvar
15197
15198 : see whether the pthread_atfork exists
15199 $cat >try.c <<EOP
15200 #include <pthread.h>
15201 #include <stdio.h>
15202 int main() {
15203 #ifdef  PTHREAD_ATFORK
15204         pthread_atfork(NULL,NULL,NULL);
15205 #endif
15206 }
15207 EOP
15208
15209 : see if pthread_atfork exists
15210 set try -DPTHREAD_ATFORK
15211 if eval $compile; then
15212     val="$define"
15213 else
15214     val="$undef"
15215 fi
15216 case "$usethreads" in
15217 $define)
15218         case "$val" in
15219         $define) echo 'pthread_atfork found.' >&4        ;;
15220         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15221         esac
15222 esac
15223 set d_pthread_atfork
15224 eval $setvar
15225
15226 : see if pthread_attr_setscope exists
15227 set pthread_attr_setscope d_pthread_attr_setscope
15228 eval $inlibc
15229
15230
15231 : see whether the various POSIXish _yields exist
15232 $cat >try.c <<EOP
15233 #include <pthread.h>
15234 #include <stdio.h>
15235 int main() {
15236 #ifdef SCHED_YIELD
15237         sched_yield();
15238 #else
15239 #ifdef PTHREAD_YIELD
15240         pthread_yield();
15241 #else
15242 #ifdef PTHREAD_YIELD_NULL
15243         pthread_yield(NULL);
15244 #endif
15245 #endif
15246 #endif
15247 }
15248 EOP
15249 : see if sched_yield exists
15250 set try -DSCHED_YIELD
15251 if eval $compile; then
15252     val="$define"
15253     sched_yield='sched_yield()'
15254 else
15255     val="$undef"
15256 fi
15257 case "$usethreads" in
15258 $define)
15259         case "$val" in
15260         $define) echo 'sched_yield() found.' >&4        ;;
15261         *)       echo 'sched_yield() NOT found.' >&4    ;;
15262         esac
15263 esac
15264 set d_sched_yield
15265 eval $setvar
15266
15267 : see if pthread_yield exists
15268 set try -DPTHREAD_YIELD
15269 if eval $compile; then
15270     val="$define"
15271     case "$sched_yield" in
15272     '') sched_yield='pthread_yield()' ;;
15273     esac
15274 else
15275     set try -DPTHREAD_YIELD_NULL
15276     if eval $compile; then
15277         val="$define"
15278         case "$sched_yield" in
15279         '') sched_yield='pthread_yield(NULL)' ;;
15280         esac
15281     else
15282         val="$undef"
15283     fi
15284 fi
15285 case "$usethreads" in
15286 $define)
15287         case "$val" in
15288         $define) echo 'pthread_yield() found.' >&4      ;;
15289         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15290         esac
15291         ;;
15292 esac
15293 set d_pthread_yield
15294 eval $setvar
15295
15296 case "$sched_yield" in
15297 '') sched_yield=undef ;;
15298 esac
15299
15300 $rm -f try try.*
15301
15302 : see if random_r exists
15303 set random_r d_random_r
15304 eval $inlibc
15305 case "$d_random_r" in
15306 "$define")
15307         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15308         case "$d_random_r_proto:$usethreads" in
15309         ":define")      d_random_r_proto=define
15310                 set d_random_r_proto random_r $hdrs
15311                 eval $hasproto ;;
15312         *)      ;;
15313         esac
15314         case "$d_random_r_proto" in
15315         define)
15316         case "$random_r_proto" in
15317         ''|0) try='int random_r(int*, struct random_data*);'
15318         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15319         esac
15320         case "$random_r_proto" in
15321         ''|0) try='int random_r(long*, struct random_data*);'
15322         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15323         esac
15324         case "$random_r_proto" in
15325         ''|0) try='int random_r(struct random_data*, int32_t*);'
15326         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15327         esac
15328         case "$random_r_proto" in
15329         ''|0)   d_random_r=undef
15330                 random_r_proto=0
15331                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15332         * )     case "$random_r_proto" in
15333                 REENTRANT_PROTO*) ;;
15334                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15335                 esac
15336                 echo "Prototype: $try" ;;
15337         esac
15338         ;;
15339         *)      case "$usethreads" in
15340                 define) echo "random_r has no prototype, not using it." >&4 ;;
15341                 esac
15342                 d_random_r=undef
15343                 random_r_proto=0
15344                 ;;
15345         esac
15346         ;;
15347 *)      random_r_proto=0
15348         ;;
15349 esac
15350
15351 : see if readdir and friends exist
15352 set readdir d_readdir
15353 eval $inlibc
15354 set seekdir d_seekdir
15355 eval $inlibc
15356 set telldir d_telldir
15357 eval $inlibc
15358 set rewinddir d_rewinddir
15359 eval $inlibc
15360
15361 : see if readdir64_r exists
15362 set readdir64_r d_readdir64_r
15363 eval $inlibc
15364 case "$d_readdir64_r" in
15365 "$define")
15366         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15367         case "$d_readdir64_r_proto:$usethreads" in
15368         ":define")      d_readdir64_r_proto=define
15369                 set d_readdir64_r_proto readdir64_r $hdrs
15370                 eval $hasproto ;;
15371         *)      ;;
15372         esac
15373         case "$d_readdir64_r_proto" in
15374         define)
15375         case "$readdir64_r_proto" in
15376         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15377         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15378         esac
15379         case "$readdir64_r_proto" in
15380         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15381         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15382         esac
15383         case "$readdir64_r_proto" in
15384         ''|0)   d_readdir64_r=undef
15385                 readdir64_r_proto=0
15386                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15387         * )     case "$readdir64_r_proto" in
15388                 REENTRANT_PROTO*) ;;
15389                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15390                 esac
15391                 echo "Prototype: $try" ;;
15392         esac
15393         ;;
15394         *)      case "$usethreads" in
15395                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15396                 esac
15397                 d_readdir64_r=undef
15398                 readdir64_r_proto=0
15399                 ;;
15400         esac
15401         ;;
15402 *)      readdir64_r_proto=0
15403         ;;
15404 esac
15405
15406 : see if readdir_r exists
15407 set readdir_r d_readdir_r
15408 eval $inlibc
15409 case "$d_readdir_r" in
15410 "$define")
15411         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15412         case "$d_readdir_r_proto:$usethreads" in
15413         ":define")      d_readdir_r_proto=define
15414                 set d_readdir_r_proto readdir_r $hdrs
15415                 eval $hasproto ;;
15416         *)      ;;
15417         esac
15418         case "$d_readdir_r_proto" in
15419         define)
15420         case "$readdir_r_proto" in
15421         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15422         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15423         esac
15424         case "$readdir_r_proto" in
15425         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15426         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15427         esac
15428         case "$readdir_r_proto" in
15429         ''|0)   d_readdir_r=undef
15430                 readdir_r_proto=0
15431                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15432         * )     case "$readdir_r_proto" in
15433                 REENTRANT_PROTO*) ;;
15434                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15435                 esac
15436                 echo "Prototype: $try" ;;
15437         esac
15438         ;;
15439         *)      case "$usethreads" in
15440                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15441                 esac
15442                 d_readdir_r=undef
15443                 readdir_r_proto=0
15444                 ;;
15445         esac
15446         ;;
15447 *)      readdir_r_proto=0
15448         ;;
15449 esac
15450
15451 : see if readv exists
15452 set readv d_readv
15453 eval $inlibc
15454
15455 : see if recvmsg exists
15456 set recvmsg d_recvmsg
15457 eval $inlibc
15458
15459 : see if rename exists
15460 set rename d_rename
15461 eval $inlibc
15462
15463 : see if rmdir exists
15464 set rmdir d_rmdir
15465 eval $inlibc
15466
15467 : see if memory.h is available.
15468 val=''
15469 set memory.h val
15470 eval $inhdr
15471
15472 : See if it conflicts with string.h
15473 case "$val" in
15474 $define)
15475         case "$strings" in
15476         '') ;;
15477         *)
15478                 $cppstdin $cppflags $cppminus < $strings > mem.h
15479                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15480                         echo " "
15481                         echo "We won't be including <memory.h>."
15482                         val="$undef"
15483                 fi
15484                 $rm -f mem.h
15485                 ;;
15486         esac
15487 esac
15488 set i_memory
15489 eval $setvar
15490
15491 : can bcopy handle overlapping blocks?
15492 echo " "
15493 val="$undef"
15494 case "$d_memmove" in
15495 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15496 *)      case "$d_bcopy" in
15497         "$define")
15498                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15499                 $cat >try.c <<EOCP
15500 #$i_memory I_MEMORY
15501 #$i_stdlib I_STDLIB
15502 #$i_string I_STRING
15503 #$i_unistd I_UNISTD
15504 EOCP
15505         $cat >>try.c <<'EOCP'
15506 #include <stdio.h>
15507 #ifdef I_MEMORY
15508 #  include <memory.h>
15509 #endif
15510 #ifdef I_STDLIB
15511 #  include <stdlib.h>
15512 #endif
15513 #ifdef I_STRING
15514 #  include <string.h>
15515 #else
15516 #  include <strings.h>
15517 #endif
15518 #ifdef I_UNISTD
15519 #  include <unistd.h>  /* Needed for NetBSD */
15520 #endif
15521 int main()
15522 {
15523 char buf[128], abc[128];
15524 char *b;
15525 int len;
15526 int off;
15527 int align;
15528
15529 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15530    try to store the string in read-only memory. */
15531 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15532
15533 for (align = 7; align >= 0; align--) {
15534         for (len = 36; len; len--) {
15535                 b = buf+align;
15536                 bcopy(abc, b, len);
15537                 for (off = 1; off <= len; off++) {
15538                         bcopy(b, b+off, len);
15539                         bcopy(b+off, b, len);
15540                         if (bcmp(b, abc, len))
15541                                 exit(1);
15542                 }
15543         }
15544 }
15545 exit(0);
15546 }
15547 EOCP
15548                 set try
15549                 if eval $compile_ok; then
15550                         if ./try 2>/dev/null; then
15551                                 echo "Yes, it can."
15552                                 val="$define"
15553                         else
15554                                 echo "It can't, sorry."
15555                         fi
15556                 else
15557                         echo "(I can't compile the test program, so we'll assume not...)"
15558                 fi
15559                 ;;
15560         esac
15561         $rm -f try.* try core
15562         ;;
15563 esac
15564 set d_safebcpy
15565 eval $setvar
15566
15567 : can memcpy handle overlapping blocks?
15568 echo " "
15569 val="$undef"
15570 case "$d_memmove" in
15571 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15572 *)      case "$d_memcpy" in
15573         "$define")
15574                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15575                 $cat >try.c <<EOCP
15576 #$i_memory I_MEMORY
15577 #$i_stdlib I_STDLIB
15578 #$i_string I_STRING
15579 #$i_unistd I_UNISTD
15580 EOCP
15581         $cat >>try.c <<'EOCP'
15582 #include <stdio.h>
15583 #ifdef I_MEMORY
15584 #  include <memory.h>
15585 #endif
15586 #ifdef I_STDLIB
15587 #  include <stdlib.h>
15588 #endif
15589 #ifdef I_STRING
15590 #  include <string.h>
15591 #else
15592 #  include <strings.h>
15593 #endif
15594 #ifdef I_UNISTD
15595 #  include <unistd.h>  /* Needed for NetBSD */
15596 #endif
15597 int main()
15598 {
15599 char buf[128], abc[128];
15600 char *b;
15601 int len;
15602 int off;
15603 int align;
15604
15605 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15606    try to store the string in read-only memory. */
15607 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15608
15609 for (align = 7; align >= 0; align--) {
15610         for (len = 36; len; len--) {
15611                 b = buf+align;
15612                 memcpy(b, abc, len);
15613                 for (off = 1; off <= len; off++) {
15614                         memcpy(b+off, b, len);
15615                         memcpy(b, b+off, len);
15616                         if (memcmp(b, abc, len))
15617                                 exit(1);
15618                 }
15619         }
15620 }
15621 exit(0);
15622 }
15623 EOCP
15624                 set try
15625                 if eval $compile_ok; then
15626                         if ./try 2>/dev/null; then
15627                                 echo "Yes, it can."
15628                                 val="$define"
15629                         else
15630                                 echo "It can't, sorry."
15631                         fi
15632                 else
15633                         echo "(I can't compile the test program, so we'll assume not...)"
15634                 fi
15635                 ;;
15636         esac
15637         $rm -f try.* try core
15638         ;;
15639 esac
15640 set d_safemcpy
15641 eval $setvar
15642
15643 : can memcmp be trusted to compare relative magnitude?
15644 val="$undef"
15645 case "$d_memcmp" in
15646 "$define")
15647         echo " "
15648         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15649         $cat >try.c <<EOCP
15650 #$i_memory I_MEMORY
15651 #$i_stdlib I_STDLIB
15652 #$i_string I_STRING
15653 #$i_unistd I_UNISTD
15654 EOCP
15655         $cat >>try.c <<'EOCP'
15656 #include <stdio.h>
15657 #ifdef I_MEMORY
15658 #  include <memory.h>
15659 #endif
15660 #ifdef I_STDLIB
15661 #  include <stdlib.h>
15662 #endif
15663 #ifdef I_STRING
15664 #  include <string.h>
15665 #else
15666 #  include <strings.h>
15667 #endif
15668 #ifdef I_UNISTD
15669 #  include <unistd.h>  /* Needed for NetBSD */
15670 #endif
15671 int main()
15672 {
15673 char a = -1;
15674 char b = 0;
15675 if ((a < b) && memcmp(&a, &b, 1) < 0)
15676         exit(1);
15677 exit(0);
15678 }
15679 EOCP
15680         set try
15681         if eval $compile_ok; then
15682                 if $run ./try 2>/dev/null; then
15683                         echo "Yes, it can."
15684                         val="$define"
15685                 else
15686                         echo "No, it can't (it uses signed chars)."
15687                 fi
15688         else
15689                 echo "(I can't compile the test program, so we'll assume not...)"
15690         fi
15691         ;;
15692 esac
15693 $rm -f try.* try core
15694 set d_sanemcmp
15695 eval $setvar
15696
15697 : see if prototype for sbrk is available
15698 echo " "
15699 set d_sbrkproto sbrk $i_unistd unistd.h
15700 eval $hasproto
15701
15702 : see if select exists
15703 set select d_select
15704 eval $inlibc
15705
15706 : see if semctl exists
15707 set semctl d_semctl
15708 eval $inlibc
15709
15710 : see if semget exists
15711 set semget d_semget
15712 eval $inlibc
15713
15714 : see if semop exists
15715 set semop d_semop
15716 eval $inlibc
15717
15718 : see how much of the 'sem*(2)' library is present.
15719 h_sem=true
15720 echo " "
15721 case "$d_semctl$d_semget$d_semop" in
15722 *"$undef"*) h_sem=false;;
15723 esac
15724 case "$osname" in
15725 freebsd)
15726     case "`ipcs 2>&1`" in
15727     "SVID messages"*"not configured"*)
15728         echo "Your $osname does not have the sem*(2) configured." >&4
15729         h_sem=false
15730         val="$undef"
15731         set semctl d_semctl
15732         eval $setvar
15733         set semget d_semget
15734         eval $setvar
15735         set semop d_semop
15736         eval $setvar
15737         ;;
15738     esac
15739     ;;
15740 esac
15741 : we could also check for sys/ipc.h ...
15742 if $h_sem && $test `./findhdr sys/sem.h`; then
15743         echo "You have the full sem*(2) library." >&4
15744         val="$define"
15745 else
15746         echo "You don't have the full sem*(2) library." >&4
15747         val="$undef"
15748 fi
15749 set d_sem
15750 eval $setvar
15751
15752 : see whether sys/sem.h defines union semun
15753 echo " "
15754 $cat > try.c <<'END'
15755 #include <sys/types.h>
15756 #include <sys/ipc.h>
15757 #include <sys/sem.h>
15758 int main () { union semun semun; semun.buf = 0; }
15759 END
15760 set try
15761 if eval $compile; then
15762     echo "You have union semun in <sys/sem.h>." >&4
15763     val="$define"
15764 else
15765     echo "You do not have union semun in <sys/sem.h>." >&4
15766     val="$undef"
15767 fi
15768 $rm -f try try.c
15769 set d_union_semun
15770 eval $setvar
15771
15772 : see how to do semctl IPC_STAT
15773 case "$d_sem" in
15774 $define)
15775     echo " "
15776     $cat > try.h <<END
15777 #ifndef S_IRUSR
15778 #   ifdef S_IREAD
15779 #       define S_IRUSR S_IREAD
15780 #       define S_IWUSR S_IWRITE
15781 #       define S_IXUSR S_IEXEC
15782 #   else
15783 #       define S_IRUSR 0400
15784 #       define S_IWUSR 0200
15785 #       define S_IXUSR 0100
15786 #   endif
15787 #   define S_IRGRP (S_IRUSR>>3)
15788 #   define S_IWGRP (S_IWUSR>>3)
15789 #   define S_IXGRP (S_IXUSR>>3)
15790 #   define S_IROTH (S_IRUSR>>6)
15791 #   define S_IWOTH (S_IWUSR>>6)
15792 #   define S_IXOTH (S_IXUSR>>6)
15793 #endif
15794 #ifndef S_IRWXU
15795 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15796 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15797 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15798 #endif
15799 END
15800     : see whether semctl IPC_STAT can use union semun
15801     case "$d_semctl_semun" in
15802     '')
15803       val="$undef"
15804       $cat > try.c <<END
15805 #include <sys/types.h>
15806 #include <sys/ipc.h>
15807 #include <sys/sem.h>
15808 #include <sys/stat.h>
15809 #include <stdio.h>
15810 #include <errno.h>
15811 #include "try.h"
15812 #ifndef errno
15813 extern int errno;
15814 #endif
15815 #$d_union_semun HAS_UNION_SEMUN
15816 int main() {
15817     union semun
15818 #ifndef HAS_UNION_SEMUN
15819     {
15820         int val;
15821         struct semid_ds *buf;
15822         unsigned short *array;
15823     }
15824 #endif
15825     arg;
15826     int sem, st;
15827
15828 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15829     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15830     if (sem > -1) {
15831         struct semid_ds argbuf;
15832         arg.buf = &argbuf;
15833 #       ifdef IPC_STAT
15834         st = semctl(sem, 0, IPC_STAT, arg);
15835         if (st == 0)
15836             printf("semun\n");
15837         else
15838 #       endif /* IPC_STAT */
15839             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15840 #       ifdef IPC_RMID
15841         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15842 #       endif /* IPC_RMID */
15843             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15844     } else
15845 #endif /* IPC_PRIVATE && ... */
15846         printf("semget failed: errno = %d\n", errno);
15847   return 0;
15848 }
15849 END
15850       set try
15851       if eval $compile; then
15852           xxx=`$run ./try`
15853           case "$xxx" in
15854           semun) val="$define" ;;
15855           esac
15856       fi
15857       $rm -f try try.c
15858       set d_semctl_semun
15859       eval $setvar
15860       ;;
15861     esac
15862     case "$d_semctl_semun" in
15863     $define)
15864         echo "You can use union semun for semctl IPC_STAT." >&4
15865         also='also'
15866         ;;
15867     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15868         also=''
15869         ;;
15870     esac
15871
15872     : see whether semctl IPC_STAT can use struct semid_ds pointer
15873     case "$d_semctl_semid_ds" in
15874     '')
15875       val="$undef"
15876       $cat > try.c <<'END'
15877 #include <sys/types.h>
15878 #include <sys/ipc.h>
15879 #include <sys/sem.h>
15880 #include <sys/stat.h>
15881 #include "try.h"
15882 #include <stdio.h>
15883 #include <errno.h>
15884 #ifndef errno
15885 extern int errno;
15886 #endif
15887 int main() {
15888     struct semid_ds arg;
15889     int sem, st;
15890
15891 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15892     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15893     if (sem > -1) {
15894 #       ifdef IPC_STAT
15895         st = semctl(sem, 0, IPC_STAT, &arg);
15896         if (st == 0)
15897             printf("semid_ds\n");
15898         else
15899 #       endif /* IPC_STAT */
15900             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15901 #       ifdef IPC_RMID
15902         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15903 #       endif /* IPC_RMID */
15904             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15905     } else
15906 #endif /* IPC_PRIVATE && ... */
15907         printf("semget failed: errno = %d\n", errno);
15908
15909     return 0;
15910 }
15911 END
15912       set try
15913       if eval $compile; then
15914           xxx=`$run ./try`
15915           case "$xxx" in
15916           semid_ds) val="$define" ;;
15917           esac
15918       fi
15919       $rm -f try try.c
15920       set d_semctl_semid_ds
15921       eval $setvar
15922       ;;
15923     esac
15924     case "$d_semctl_semid_ds" in
15925     $define)
15926         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15927         ;;
15928     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15929         ;;
15930     esac
15931     $rm -f try.h
15932     ;;
15933 *)  val="$undef"
15934
15935     # We do not have the full sem*(2) library, so assume we can not
15936     # use either.
15937
15938     set d_semctl_semun
15939     eval $setvar
15940
15941     set d_semctl_semid_ds
15942     eval $setvar
15943     ;;
15944 esac
15945
15946 : see if sendmsg exists
15947 set sendmsg d_sendmsg
15948 eval $inlibc
15949
15950 : see if setegid exists
15951 set setegid d_setegid
15952 eval $inlibc
15953
15954 : see if seteuid exists
15955 set seteuid d_seteuid
15956 eval $inlibc
15957
15958 : see if setgrent exists
15959 set setgrent d_setgrent
15960 eval $inlibc
15961
15962 : see if setgrent_r exists
15963 set setgrent_r d_setgrent_r
15964 eval $inlibc
15965 case "$d_setgrent_r" in
15966 "$define")
15967         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15968         case "$d_setgrent_r_proto:$usethreads" in
15969         ":define")      d_setgrent_r_proto=define
15970                 set d_setgrent_r_proto setgrent_r $hdrs
15971                 eval $hasproto ;;
15972         *)      ;;
15973         esac
15974         case "$d_setgrent_r_proto" in
15975         define)
15976         case "$setgrent_r_proto" in
15977         ''|0) try='int setgrent_r(FILE**);'
15978         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15979         esac
15980         case "$setgrent_r_proto" in
15981         ''|0) try='void setgrent_r(FILE**);'
15982         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15983         esac
15984         case "$setgrent_r_proto" in
15985         ''|0)   d_setgrent_r=undef
15986                 setgrent_r_proto=0
15987                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15988         * )     case "$setgrent_r_proto" in
15989                 REENTRANT_PROTO*) ;;
15990                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15991                 esac
15992                 echo "Prototype: $try" ;;
15993         esac
15994         ;;
15995         *)      case "$usethreads" in
15996                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15997                 esac
15998                 d_setgrent_r=undef
15999                 setgrent_r_proto=0
16000                 ;;
16001         esac
16002         ;;
16003 *)      setgrent_r_proto=0
16004         ;;
16005 esac
16006
16007 : see if sethostent exists
16008 set sethostent d_sethent
16009 eval $inlibc
16010
16011 : see if sethostent_r exists
16012 set sethostent_r d_sethostent_r
16013 eval $inlibc
16014 case "$d_sethostent_r" in
16015 "$define")
16016         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16017         case "$d_sethostent_r_proto:$usethreads" in
16018         ":define")      d_sethostent_r_proto=define
16019                 set d_sethostent_r_proto sethostent_r $hdrs
16020                 eval $hasproto ;;
16021         *)      ;;
16022         esac
16023         case "$d_sethostent_r_proto" in
16024         define)
16025         case "$sethostent_r_proto" in
16026         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16027         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16028         esac
16029         case "$sethostent_r_proto" in
16030         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16031         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16032         esac
16033         case "$sethostent_r_proto" in
16034         ''|0)   d_sethostent_r=undef
16035                 sethostent_r_proto=0
16036                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16037         * )     case "$sethostent_r_proto" in
16038                 REENTRANT_PROTO*) ;;
16039                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16040                 esac
16041                 echo "Prototype: $try" ;;
16042         esac
16043         ;;
16044         *)      case "$usethreads" in
16045                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16046                 esac
16047                 d_sethostent_r=undef
16048                 sethostent_r_proto=0
16049                 ;;
16050         esac
16051         ;;
16052 *)      sethostent_r_proto=0
16053         ;;
16054 esac
16055
16056 : see if setitimer exists
16057 set setitimer d_setitimer
16058 eval $inlibc
16059
16060 : see if setlinebuf exists
16061 set setlinebuf d_setlinebuf
16062 eval $inlibc
16063
16064 : see if setlocale exists
16065 set setlocale d_setlocale
16066 eval $inlibc
16067
16068 : see if locale.h is available
16069 set locale.h i_locale
16070 eval $inhdr
16071
16072 : see if setlocale_r exists
16073 set setlocale_r d_setlocale_r
16074 eval $inlibc
16075 case "$d_setlocale_r" in
16076 "$define")
16077         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16078         case "$d_setlocale_r_proto:$usethreads" in
16079         ":define")      d_setlocale_r_proto=define
16080                 set d_setlocale_r_proto setlocale_r $hdrs
16081                 eval $hasproto ;;
16082         *)      ;;
16083         esac
16084         case "$d_setlocale_r_proto" in
16085         define)
16086         case "$setlocale_r_proto" in
16087         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16088         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16089         esac
16090         case "$setlocale_r_proto" in
16091         ''|0)   d_setlocale_r=undef
16092                 setlocale_r_proto=0
16093                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16094         * )     case "$setlocale_r_proto" in
16095                 REENTRANT_PROTO*) ;;
16096                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16097                 esac
16098                 echo "Prototype: $try" ;;
16099         esac
16100         ;;
16101         *)      case "$usethreads" in
16102                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16103                 esac
16104                 d_setlocale_r=undef
16105                 setlocale_r_proto=0
16106                 ;;
16107         esac
16108         ;;
16109 *)      setlocale_r_proto=0
16110         ;;
16111 esac
16112
16113 : see if setnetent exists
16114 set setnetent d_setnent
16115 eval $inlibc
16116
16117 : see if setnetent_r exists
16118 set setnetent_r d_setnetent_r
16119 eval $inlibc
16120 case "$d_setnetent_r" in
16121 "$define")
16122         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16123         case "$d_setnetent_r_proto:$usethreads" in
16124         ":define")      d_setnetent_r_proto=define
16125                 set d_setnetent_r_proto setnetent_r $hdrs
16126                 eval $hasproto ;;
16127         *)      ;;
16128         esac
16129         case "$d_setnetent_r_proto" in
16130         define)
16131         case "$setnetent_r_proto" in
16132         ''|0) try='int setnetent_r(int, struct netent_data*);'
16133         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16134         esac
16135         case "$setnetent_r_proto" in
16136         ''|0) try='void setnetent_r(int, struct netent_data*);'
16137         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16138         esac
16139         case "$setnetent_r_proto" in
16140         ''|0)   d_setnetent_r=undef
16141                 setnetent_r_proto=0
16142                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16143         * )     case "$setnetent_r_proto" in
16144                 REENTRANT_PROTO*) ;;
16145                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16146                 esac
16147                 echo "Prototype: $try" ;;
16148         esac
16149         ;;
16150         *)      case "$usethreads" in
16151                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16152                 esac
16153                 d_setnetent_r=undef
16154                 setnetent_r_proto=0
16155                 ;;
16156         esac
16157         ;;
16158 *)      setnetent_r_proto=0
16159         ;;
16160 esac
16161
16162 : see if setprotoent exists
16163 set setprotoent d_setpent
16164 eval $inlibc
16165
16166 : see if setpgid exists
16167 set setpgid d_setpgid
16168 eval $inlibc
16169
16170 : see if setpgrp2 exists
16171 set setpgrp2 d_setpgrp2
16172 eval $inlibc
16173
16174 : see if setpriority exists
16175 set setpriority d_setprior
16176 eval $inlibc
16177
16178 : see if setproctitle exists
16179 set setproctitle d_setproctitle
16180 eval $inlibc
16181
16182 : see if setprotoent_r exists
16183 set setprotoent_r d_setprotoent_r
16184 eval $inlibc
16185 case "$d_setprotoent_r" in
16186 "$define")
16187         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16188         case "$d_setprotoent_r_proto:$usethreads" in
16189         ":define")      d_setprotoent_r_proto=define
16190                 set d_setprotoent_r_proto setprotoent_r $hdrs
16191                 eval $hasproto ;;
16192         *)      ;;
16193         esac
16194         case "$d_setprotoent_r_proto" in
16195         define)
16196         case "$setprotoent_r_proto" in
16197         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16198         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16199         esac
16200         case "$setprotoent_r_proto" in
16201         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16202         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16203         esac
16204         case "$setprotoent_r_proto" in
16205         ''|0)   d_setprotoent_r=undef
16206                 setprotoent_r_proto=0
16207                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16208         * )     case "$setprotoent_r_proto" in
16209                 REENTRANT_PROTO*) ;;
16210                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16211                 esac
16212                 echo "Prototype: $try" ;;
16213         esac
16214         ;;
16215         *)      case "$usethreads" in
16216                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16217                 esac
16218                 d_setprotoent_r=undef
16219                 setprotoent_r_proto=0
16220                 ;;
16221         esac
16222         ;;
16223 *)      setprotoent_r_proto=0
16224         ;;
16225 esac
16226
16227 : see if setpwent exists
16228 set setpwent d_setpwent
16229 eval $inlibc
16230
16231 : see if setpwent_r exists
16232 set setpwent_r d_setpwent_r
16233 eval $inlibc
16234 case "$d_setpwent_r" in
16235 "$define")
16236         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16237         case "$d_setpwent_r_proto:$usethreads" in
16238         ":define")      d_setpwent_r_proto=define
16239                 set d_setpwent_r_proto setpwent_r $hdrs
16240                 eval $hasproto ;;
16241         *)      ;;
16242         esac
16243         case "$d_setpwent_r_proto" in
16244         define)
16245         case "$setpwent_r_proto" in
16246         ''|0) try='int setpwent_r(FILE**);'
16247         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16248         esac
16249         case "$setpwent_r_proto" in
16250         ''|0) try='void setpwent_r(FILE**);'
16251         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16252         esac
16253         case "$setpwent_r_proto" in
16254         ''|0)   d_setpwent_r=undef
16255                 setpwent_r_proto=0
16256                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16257         * )     case "$setpwent_r_proto" in
16258                 REENTRANT_PROTO*) ;;
16259                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16260                 esac
16261                 echo "Prototype: $try" ;;
16262         esac
16263         ;;
16264         *)      case "$usethreads" in
16265                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16266                 esac
16267                 d_setpwent_r=undef
16268                 setpwent_r_proto=0
16269                 ;;
16270         esac
16271         ;;
16272 *)      setpwent_r_proto=0
16273         ;;
16274 esac
16275
16276 : see if setregid exists
16277 set setregid d_setregid
16278 eval $inlibc
16279 set setresgid d_setresgid
16280 eval $inlibc
16281
16282 : see if setreuid exists
16283 set setreuid d_setreuid
16284 eval $inlibc
16285 set setresuid d_setresuid
16286 eval $inlibc
16287
16288 : see if setrgid exists
16289 set setrgid d_setrgid
16290 eval $inlibc
16291
16292 : see if setruid exists
16293 set setruid d_setruid
16294 eval $inlibc
16295
16296 : see if setservent exists
16297 set setservent d_setsent
16298 eval $inlibc
16299
16300 : see if setservent_r exists
16301 set setservent_r d_setservent_r
16302 eval $inlibc
16303 case "$d_setservent_r" in
16304 "$define")
16305         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16306         case "$d_setservent_r_proto:$usethreads" in
16307         ":define")      d_setservent_r_proto=define
16308                 set d_setservent_r_proto setservent_r $hdrs
16309                 eval $hasproto ;;
16310         *)      ;;
16311         esac
16312         case "$d_setservent_r_proto" in
16313         define)
16314         case "$setservent_r_proto" in
16315         ''|0) try='int setservent_r(int, struct servent_data*);'
16316         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16317         esac
16318         case "$setservent_r_proto" in
16319         ''|0) try='void setservent_r(int, struct servent_data*);'
16320         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16321         esac
16322         case "$setservent_r_proto" in
16323         ''|0)   d_setservent_r=undef
16324                 setservent_r_proto=0
16325                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16326         * )     case "$setservent_r_proto" in
16327                 REENTRANT_PROTO*) ;;
16328                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16329                 esac
16330                 echo "Prototype: $try" ;;
16331         esac
16332         ;;
16333         *)      case "$usethreads" in
16334                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16335                 esac
16336                 d_setservent_r=undef
16337                 setservent_r_proto=0
16338                 ;;
16339         esac
16340         ;;
16341 *)      setservent_r_proto=0
16342         ;;
16343 esac
16344
16345 : see if setsid exists
16346 set setsid d_setsid
16347 eval $inlibc
16348
16349 : see if setvbuf exists
16350 set setvbuf d_setvbuf
16351 eval $inlibc
16352
16353 : see if sfio.h is available
16354 set sfio.h i_sfio
16355 eval $inhdr
16356
16357
16358 : see if sfio library is available
16359 case "$i_sfio" in
16360 $define)
16361         val=''
16362         set sfreserve val
16363         eval $inlibc
16364         ;;
16365 *)
16366         val="$undef"
16367         ;;
16368 esac
16369 : Ok, but do we want to use it.
16370 case "$val" in
16371 $define)
16372         case "$usesfio" in
16373         true|$define|[yY]*) dflt='y';;
16374         *) dflt='n';;
16375         esac
16376         echo "$package can use the sfio library, but it is experimental."
16377         case "$useperlio" in
16378         "$undef")
16379             echo "For sfio also the PerlIO abstraction layer is needed."
16380             echo "Earlier you said you wouldn't want that."
16381             ;;
16382         esac
16383         rp="You seem to have sfio available, do you want to try using it?"
16384         . ./myread
16385         case "$ans" in
16386         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16387                 useperlio="$define"
16388                 val="$define"
16389                 ;;
16390         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16391                 val="$undef"
16392                 ;;
16393         esac
16394         ;;
16395 *)      case "$usesfio" in
16396         true|$define|[yY]*)
16397                 echo "Sorry, cannot find sfio on this machine." >&4
16398                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16399                 val="$undef"
16400                 ;;
16401         esac
16402         ;;
16403 esac
16404 set d_sfio
16405 eval $setvar
16406 case "$d_sfio" in
16407 $define) usesfio='true';;
16408 *) usesfio='false';;
16409 esac
16410 case "$d_sfio" in
16411 $define) ;;
16412 *)      : Remove sfio from list of libraries to use
16413         case "$libs" in
16414         *-lsfio*)
16415                 echo "Removing unneeded -lsfio from library list" >&4
16416                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16417                 shift
16418                 libs="$*"
16419                 echo "libs = $libs" >&4
16420                 ;;
16421         esac
16422 ;;
16423 esac
16424
16425
16426 : see if shmctl exists
16427 set shmctl d_shmctl
16428 eval $inlibc
16429
16430 : see if shmget exists
16431 set shmget d_shmget
16432 eval $inlibc
16433
16434 : see if shmat exists
16435 set shmat d_shmat
16436 eval $inlibc
16437 : see what shmat returns
16438 case "$d_shmat" in
16439 "$define")
16440         $cat >shmat.c <<'END'
16441 #include <sys/shm.h>
16442 void *shmat();
16443 END
16444         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16445                 shmattype='void *'
16446         else
16447                 shmattype='char *'
16448         fi
16449         echo "and it returns ($shmattype)." >&4
16450         : see if a prototype for shmat is available
16451         xxx=`./findhdr sys/shm.h`
16452         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16453         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16454                 val="$define"
16455         else
16456                 val="$undef"
16457         fi
16458         $rm -f shmat.[co]
16459         ;;
16460 *)
16461         val="$undef"
16462         ;;
16463 esac
16464 set d_shmatprototype
16465 eval $setvar
16466
16467 : see if shmdt exists
16468 set shmdt d_shmdt
16469 eval $inlibc
16470
16471 : see how much of the 'shm*(2)' library is present.
16472 h_shm=true
16473 echo " "
16474 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16475 *"$undef"*) h_shm=false;;
16476 esac
16477 case "$osname" in
16478 freebsd)
16479     case "`ipcs 2>&1`" in
16480     "SVID shared memory"*"not configured"*)
16481         echo "Your $osname does not have the shm*(2) configured." >&4
16482         h_shm=false
16483         val="$undef"
16484         set shmctl d_shmctl
16485         evat $setvar
16486         set shmget d_shmget
16487         evat $setvar
16488         set shmat d_shmat
16489         evat $setvar
16490         set shmdt d_shmdt
16491         evat $setvar
16492         ;;
16493     esac
16494     ;;
16495 esac
16496 : we could also check for sys/ipc.h ...
16497 if $h_shm && $test `./findhdr sys/shm.h`; then
16498         echo "You have the full shm*(2) library." >&4
16499         val="$define"
16500 else
16501         echo "You don't have the full shm*(2) library." >&4
16502         val="$undef"
16503 fi
16504 set d_shm
16505 eval $setvar
16506
16507 echo " "
16508 : see if we have sigaction
16509 if set sigaction val -f d_sigaction; eval $csym; $val; then
16510         echo 'sigaction() found.' >&4
16511         $cat > try.c <<EOP
16512 #include <stdio.h>
16513 #include <sys/types.h>
16514 #include <signal.h>
16515 #$i_stdlib I_STDLIB
16516 #ifdef I_STDLIB
16517 #include <stdlib.h>
16518 #endif
16519 int main()
16520 {
16521     struct sigaction act, oact;
16522     act.sa_flags = 0;
16523     oact.sa_handler = 0;
16524     /* so that act and oact are used */
16525     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16526 }
16527 EOP
16528         set try
16529         if eval $compile_ok; then
16530                 val="$define"
16531         else
16532                 echo "But you don't seem to have a useable struct sigaction." >&4
16533                 val="$undef"
16534         fi
16535 else
16536         echo 'sigaction NOT found.' >&4
16537         val="$undef"
16538 fi
16539 set d_sigaction; eval $setvar
16540 $rm -f try try$_o try.c
16541
16542 : see if sigprocmask exists
16543 set sigprocmask d_sigprocmask
16544 eval $inlibc
16545
16546 : see if sigsetjmp exists
16547 echo " "
16548 case "$d_sigsetjmp" in
16549 '')
16550         $cat >try.c <<EOP
16551 #include <setjmp.h>
16552 #$i_stdlib I_STDLIB
16553 #ifdef I_STDLIB
16554 #include <stdlib.h>
16555 #endif
16556 sigjmp_buf env;
16557 int set = 1;
16558 int main()
16559 {
16560         if (sigsetjmp(env,1))
16561                 exit(set);
16562         set = 0;
16563         siglongjmp(env, 1);
16564         exit(1);
16565 }
16566 EOP
16567         set try
16568         if eval $compile; then
16569                 if $run ./try >/dev/null 2>&1; then
16570                         echo "POSIX sigsetjmp found." >&4
16571                         val="$define"
16572                 else
16573                         $cat >&4 <<EOM
16574 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16575 I'll ignore them.
16576 EOM
16577                         val="$undef"
16578                 fi
16579         else
16580                 echo "sigsetjmp not found." >&4
16581                 val="$undef"
16582         fi
16583         ;;
16584 *) val="$d_sigsetjmp"
16585         case "$d_sigsetjmp" in
16586         $define) echo "POSIX sigsetjmp found." >&4;;
16587         $undef) echo "sigsetjmp not found." >&4;;
16588         esac
16589         ;;
16590 esac
16591 set d_sigsetjmp
16592 eval $setvar
16593 $rm -f try.c try
16594
16595 : see if snprintf exists
16596 set snprintf d_snprintf
16597 eval $inlibc
16598
16599 : see if vsnprintf exists
16600 set vsnprintf d_vsnprintf
16601 eval $inlibc
16602
16603 case "$d_snprintf-$d_vsnprintf" in
16604 "$define-$define")
16605     $cat <<EOM
16606 Checking whether your snprintf() and vsnprintf() work okay...
16607 EOM
16608     $cat >try.c <<'EOCP'
16609 /* v?snprintf testing logic courtesy of Russ Allbery.
16610  * According to C99:
16611  * - if the buffer is too short it still must be \0-terminated
16612  * - if the buffer is too short the potentially required length
16613  *   must be returned and not -1
16614  * - if the buffer is NULL the potentially required length
16615  *   must be returned and not -1 or core dump
16616  */
16617 #include <stdio.h>
16618 #include <stdarg.h>
16619
16620 char buf[2];
16621
16622 int test (char *format, ...)
16623 {
16624     va_list args;
16625     int count;
16626
16627     va_start (args, format);
16628     count = vsnprintf (buf, sizeof buf, format, args);
16629     va_end (args);
16630     return count;
16631 }
16632
16633 int main ()
16634 {
16635     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16636              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16637 }
16638 EOCP
16639     set try
16640     if eval $compile; then
16641         `$run ./try`
16642         case "$?" in
16643         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16644         *) cat <<EOM >&4
16645 Your snprintf() and snprintf() don't seem to be working okay.
16646 EOM
16647            d_snprintf="$undef"
16648            d_vsnprintf="$undef"
16649            ;;
16650         esac
16651     else
16652         echo "(I can't seem to compile the test program--assuming they don't)"
16653         d_snprintf="$undef"
16654         d_vsnprintf="$undef"
16655     fi
16656     $rm -f try.* try core core.try.*
16657     ;;
16658 esac
16659
16660 : see if sockatmark exists
16661 set sockatmark d_sockatmark
16662 eval $inlibc
16663
16664 : see if prototype for sockatmark is available
16665 echo " "
16666 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16667 eval $hasproto
16668
16669 : see if socks5_init exists
16670 set socks5_init d_socks5_init
16671 eval $inlibc
16672
16673 : see if sprintf returns the length of the string in the buffer as per ANSI
16674 $echo "Checking whether sprintf returns the length of the string..." >&4
16675 $cat <<EOP >try.c
16676 #include <stdio.h>
16677 #$i_stdlib I_STDLIB
16678 #ifdef I_STDLIB
16679 #include <stdlib.h>
16680 #endif
16681 #$i_string I_STRING
16682 #ifdef I_STRING
16683 #  include <string.h>
16684 #else
16685 #  include <strings.h>
16686 #endif
16687 #$i_math I_MATH
16688 #ifdef I_MATH
16689 #include <math.h>
16690 #endif
16691
16692 char buffer[256];
16693
16694 int check (size_t expect, int test) {
16695   size_t got = strlen(buffer);
16696   if (expect == got)
16697     return 0;
16698
16699   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16700        test, buffer);
16701   exit (test);
16702 }
16703
16704 int main(int argc, char **argv) {
16705   int test = 0;
16706
16707   check(sprintf(buffer, ""), ++test);
16708   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16709   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16710
16711   return 0;
16712 }
16713 EOP
16714 set try
16715
16716 d_sprintf_returns_strlen="$undef"
16717 if eval $compile; then
16718     xxx="`$run ./try`"
16719     case "$?" in
16720         0) cat >&4 <<EOM
16721 sprintf returns the length of the string (as ANSI says it should)
16722 EOM
16723         d_sprintf_returns_strlen="$define"
16724         ;;
16725         *) cat >&4 <<EOM
16726 sprintf does not return the length of the string (how old is this system?)
16727 EOM
16728         d_sprintf_returns_strlen="$undef"
16729         ;;
16730     esac
16731 fi
16732
16733 $rm -f try.* try
16734
16735 : see if srand48_r exists
16736 set srand48_r d_srand48_r
16737 eval $inlibc
16738 case "$d_srand48_r" in
16739 "$define")
16740         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16741         case "$d_srand48_r_proto:$usethreads" in
16742         ":define")      d_srand48_r_proto=define
16743                 set d_srand48_r_proto srand48_r $hdrs
16744                 eval $hasproto ;;
16745         *)      ;;
16746         esac
16747         case "$d_srand48_r_proto" in
16748         define)
16749         case "$srand48_r_proto" in
16750         ''|0) try='int srand48_r(long, struct drand48_data*);'
16751         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16752         esac
16753         case "$srand48_r_proto" in
16754         ''|0)   d_srand48_r=undef
16755                 srand48_r_proto=0
16756                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16757         * )     case "$srand48_r_proto" in
16758                 REENTRANT_PROTO*) ;;
16759                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16760                 esac
16761                 echo "Prototype: $try" ;;
16762         esac
16763         ;;
16764         *)      case "$usethreads" in
16765                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16766                 esac
16767                 d_srand48_r=undef
16768                 srand48_r_proto=0
16769                 ;;
16770         esac
16771         ;;
16772 *)      srand48_r_proto=0
16773         ;;
16774 esac
16775
16776 : see if srandom_r exists
16777 set srandom_r d_srandom_r
16778 eval $inlibc
16779 case "$d_srandom_r" in
16780 "$define")
16781         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16782         case "$d_srandom_r_proto:$usethreads" in
16783         ":define")      d_srandom_r_proto=define
16784                 set d_srandom_r_proto srandom_r $hdrs
16785                 eval $hasproto ;;
16786         *)      ;;
16787         esac
16788         case "$d_srandom_r_proto" in
16789         define)
16790         case "$srandom_r_proto" in
16791         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16792         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16793         esac
16794         case "$srandom_r_proto" in
16795         ''|0)   d_srandom_r=undef
16796                 srandom_r_proto=0
16797                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16798         * )     case "$srandom_r_proto" in
16799                 REENTRANT_PROTO*) ;;
16800                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16801                 esac
16802                 echo "Prototype: $try" ;;
16803         esac
16804         ;;
16805         *)      case "$usethreads" in
16806                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16807                 esac
16808                 d_srandom_r=undef
16809                 srandom_r_proto=0
16810                 ;;
16811         esac
16812         ;;
16813 *)      srandom_r_proto=0
16814         ;;
16815 esac
16816
16817 : see if prototype for setresgid is available
16818 echo " "
16819 set d_sresgproto setresgid $i_unistd unistd.h
16820 eval $hasproto
16821
16822 : see if prototype for setresuid is available
16823 echo " "
16824 set d_sresuproto setresuid $i_unistd unistd.h
16825 eval $hasproto
16826
16827 : see if sys/stat.h is available
16828 set sys/stat.h i_sysstat
16829 eval $inhdr
16830
16831
16832 : see if stat knows about block sizes
16833 echo " "
16834 echo "Checking to see if your struct stat has st_blocks field..." >&4
16835 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16836 eval $hasfield
16837
16838
16839 : see if this is a sys/vfs.h system
16840 set sys/vfs.h i_sysvfs
16841 eval $inhdr
16842
16843
16844 : see if this is a sys/statfs.h system
16845 set sys/statfs.h i_sysstatfs
16846 eval $inhdr
16847
16848
16849 echo " "
16850 echo "Checking to see if your system supports struct statfs..." >&4
16851 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
16852 eval $hasstruct
16853 case "$d_statfs_s" in
16854 "$define")      echo "Yes, it does."   ;;
16855 *)              echo "No, it doesn't." ;;
16856 esac
16857
16858
16859
16860 : see if struct statfs knows about f_flags
16861 case "$d_statfs_s" in
16862 define) 
16863         echo " "
16864         echo "Checking to see if your struct statfs has f_flags field..." >&4
16865         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
16866         eval $hasfield
16867         ;;
16868 *)      val="$undef"
16869         set d_statfs_f_flags
16870         eval $setvar
16871         ;;
16872 esac
16873 case "$d_statfs_f_flags" in
16874 "$define")      echo "Yes, it does."   ;;
16875 *)              echo "No, it doesn't." ;;
16876 esac
16877
16878 $cat >&4 <<EOM
16879 Checking how to access stdio streams by file descriptor number...
16880 EOM
16881 case "$stdio_stream_array" in
16882 '')     $cat >try.c <<EOCP
16883 #include <stdio.h>
16884 int main() {
16885   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16886     printf("yes\n");
16887 }
16888 EOCP
16889         for s in _iob __iob __sF
16890         do
16891                 set try -DSTDIO_STREAM_ARRAY=$s
16892                 if eval $compile; then
16893                         case "`$run ./try`" in
16894                         yes)    stdio_stream_array=$s; break ;;
16895                         esac
16896                 fi
16897         done
16898         $rm -f try.* try$exe_ext
16899 esac
16900 case "$stdio_stream_array" in
16901 '')     $cat >&4 <<EOM
16902 I can't figure out how to access stdio streams by file descriptor number.
16903 EOM
16904         d_stdio_stream_array="$undef"
16905         ;;
16906 *)      $cat >&4 <<EOM
16907 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16908 EOM
16909         d_stdio_stream_array="$define"
16910         ;;
16911 esac
16912
16913 : see if strcoll exists
16914 set strcoll d_strcoll
16915 eval $inlibc
16916
16917 : check for structure copying
16918 echo " "
16919 echo "Checking to see if your C compiler can copy structs..." >&4
16920 $cat >try.c <<'EOCP'
16921 int main()
16922 {
16923         struct blurfl {
16924                 int dyick;
16925         } foo, bar;
16926
16927         foo = bar;
16928 }
16929 EOCP
16930 if $cc -c try.c >/dev/null 2>&1 ; then
16931         val="$define"
16932         echo "Yup, it can."
16933 else
16934         val="$undef"
16935         echo "Nope, it can't."
16936 fi
16937 set d_strctcpy
16938 eval $setvar
16939 $rm -f try.*
16940
16941 : see if strerror and/or sys_errlist[] exist
16942 echo " "
16943 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16944     if set strerror val -f d_strerror; eval $csym; $val; then
16945                 echo 'strerror() found.' >&4
16946                 d_strerror="$define"
16947                 d_strerrm='strerror(e)'
16948                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16949                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16950                         d_syserrlst="$define"
16951                 else
16952                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16953                         d_syserrlst="$undef"
16954                 fi
16955     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16956                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16957                 echo 'strerror() found in string header.' >&4
16958                 d_strerror="$define"
16959                 d_strerrm='strerror(e)'
16960                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16961                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16962                                 d_syserrlst="$define"
16963                 else
16964                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16965                         d_syserrlst="$undef"
16966                 fi
16967     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16968                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16969                 d_strerror="$undef"
16970                 d_syserrlst="$define"
16971                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16972     else
16973                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16974                 d_strerror="$undef"
16975                 d_syserrlst="$undef"
16976                 d_strerrm='"unknown"'
16977     fi
16978 fi
16979
16980 : see if strerror_r exists
16981 set strerror_r d_strerror_r
16982 eval $inlibc
16983 case "$d_strerror_r" in
16984 "$define")
16985         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16986         case "$d_strerror_r_proto:$usethreads" in
16987         ":define")      d_strerror_r_proto=define
16988                 set d_strerror_r_proto strerror_r $hdrs
16989                 eval $hasproto ;;
16990         *)      ;;
16991         esac
16992         case "$d_strerror_r_proto" in
16993         define)
16994         case "$strerror_r_proto" in
16995         ''|0) try='int strerror_r(int, char*, size_t);'
16996         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16997         esac
16998         case "$strerror_r_proto" in
16999         ''|0) try='int strerror_r(int, char*, int);'
17000         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17001         esac
17002         case "$strerror_r_proto" in
17003         ''|0) try='char* strerror_r(int, char*, size_t);'
17004         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17005         esac
17006         case "$strerror_r_proto" in
17007         ''|0)   d_strerror_r=undef
17008                 strerror_r_proto=0
17009                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17010         * )     case "$strerror_r_proto" in
17011                 REENTRANT_PROTO*) ;;
17012                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17013                 esac
17014                 echo "Prototype: $try" ;;
17015         esac
17016         ;;
17017         *)      case "$usethreads" in
17018                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17019                 esac
17020                 d_strerror_r=undef
17021                 strerror_r_proto=0
17022                 ;;
17023         esac
17024         ;;
17025 *)      strerror_r_proto=0
17026         ;;
17027 esac
17028
17029 : see if strftime exists
17030 set strftime d_strftime
17031 eval $inlibc
17032
17033 : see if strlcat exists
17034 set strlcat d_strlcat
17035 eval $inlibc
17036
17037 : see if strlcpy exists
17038 set strlcpy d_strlcpy
17039 eval $inlibc
17040
17041 : see if strtod exists
17042 set strtod d_strtod
17043 eval $inlibc
17044
17045 : see if strtol exists
17046 set strtol d_strtol
17047 eval $inlibc
17048
17049 : see if strtold exists
17050 set strtold d_strtold
17051 eval $inlibc
17052
17053 : see if strtoll exists
17054 set strtoll d_strtoll
17055 eval $inlibc
17056
17057 case "$d_longlong-$d_strtoll" in
17058 "$define-$define")
17059         $cat <<EOM
17060 Checking whether your strtoll() works okay...
17061 EOM
17062         $cat >try.c <<'EOCP'
17063 #include <errno.h>
17064 #ifdef __hpux
17065 #define strtoll __strtoll
17066 #endif
17067 #ifdef __EMX__
17068 #define strtoll _strtoll
17069 #endif
17070 #include <stdio.h>
17071 extern long long int strtoll(char *s, char **, int); 
17072 static int bad = 0;
17073 int check(char *s, long long ell, int een) {
17074         long long gll;
17075         errno = 0;
17076         gll = strtoll(s, 0, 10);
17077         if (!((gll == ell) && (errno == een)))
17078                 bad++;
17079 }
17080 int main() {
17081         check(" 1",                                      1LL, 0);
17082         check(" 0",                                      0LL, 0);
17083         check("-1",                                     -1LL, 0);
17084         check("-9223372036854775808", -9223372036854775808LL, 0);
17085         check("-9223372036854775808", -9223372036854775808LL, 0);
17086         check(" 9223372036854775807",  9223372036854775807LL, 0);
17087         check("-9223372036854775808", -9223372036854775808LL, 0);
17088         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17089         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17090         if (!bad)
17091                 printf("ok\n");
17092 }
17093 EOCP
17094         set try
17095         if eval $compile; then
17096                 yyy=`$run ./try`
17097                 case "$yyy" in
17098                 ok) echo "Your strtoll() seems to be working okay." ;;
17099                 *) cat <<EOM >&4
17100 Your strtoll() doesn't seem to be working okay.
17101 EOM
17102                    d_strtoll="$undef"
17103                    ;;
17104                 esac
17105         else
17106                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17107                 d_strtoll="$undef"
17108         fi
17109         ;;
17110 esac
17111
17112 : see if strtoq exists
17113 set strtoq d_strtoq
17114 eval $inlibc
17115
17116 : see if strtoul exists
17117 set strtoul d_strtoul
17118 eval $inlibc
17119
17120 case "$d_strtoul" in
17121 "$define")
17122         $cat <<EOM
17123 Checking whether your strtoul() works okay...
17124 EOM
17125         $cat >try.c <<'EOCP'
17126 #include <errno.h>
17127 #include <stdio.h>
17128 extern unsigned long int strtoul(char *s, char **, int); 
17129 static int bad = 0;
17130 void check(char *s, unsigned long eul, int een) {
17131         unsigned long gul;
17132         errno = 0;
17133         gul = strtoul(s, 0, 10);
17134         if (!((gul == eul) && (errno == een)))
17135                 bad++;
17136 }
17137 int main() {
17138         check(" 1", 1L, 0);
17139         check(" 0", 0L, 0);
17140 EOCP
17141         case "$longsize" in
17142         8)
17143             $cat >>try.c <<'EOCP'
17144         check("18446744073709551615", 18446744073709551615UL, 0);
17145         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17146 #if 0 /* strtoul() for /^-/ strings is undefined. */
17147         check("-1", 18446744073709551615UL, 0);
17148         check("-18446744073709551614", 2, 0);
17149         check("-18446744073709551615", 1, 0);
17150         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17151         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17152 #endif
17153 EOCP
17154                 ;;
17155         4)
17156                     $cat >>try.c <<'EOCP'
17157         check("4294967295", 4294967295UL, 0);
17158         check("4294967296", 4294967295UL, ERANGE);
17159 #if 0 /* strtoul() for /^-/ strings is undefined. */
17160         check("-1", 4294967295UL, 0);
17161         check("-4294967294", 2, 0);
17162         check("-4294967295", 1, 0);
17163         check("-4294967296", 4294967295UL, ERANGE);
17164         check("-4294967297", 4294967295UL, ERANGE);
17165 #endif
17166 EOCP
17167                 ;;
17168         *)
17169 : Should we write these tests to be more portable by sprintf-ing
17170 : ~0 and then manipulating that char string as input for strtol?
17171                 ;;
17172         esac
17173         $cat >>try.c <<'EOCP'
17174         if (!bad)
17175                 printf("ok\n");
17176         return 0;
17177 }
17178 EOCP
17179         set try
17180         if eval $compile; then
17181                 case "`$run ./try`" in
17182                 ok) echo "Your strtoul() seems to be working okay." ;;
17183                 *) cat <<EOM >&4
17184 Your strtoul() doesn't seem to be working okay.
17185 EOM
17186                    d_strtoul="$undef"
17187                    ;;
17188                 esac
17189         fi
17190         ;;
17191 esac
17192
17193 : see if strtoull exists
17194 set strtoull d_strtoull
17195 eval $inlibc
17196
17197 case "$d_longlong-$d_strtoull" in
17198 "$define-$define")
17199         $cat <<EOM
17200 Checking whether your strtoull() works okay...
17201 EOM
17202         $cat >try.c <<'EOCP'
17203 #include <errno.h>
17204 #ifdef __hpux
17205 #define strtoull __strtoull
17206 #endif
17207 #include <stdio.h>
17208 extern unsigned long long int strtoull(char *s, char **, int); 
17209 static int bad = 0;
17210 int check(char *s, long long eull, int een) {
17211         long long gull;
17212         errno = 0;
17213         gull = strtoull(s, 0, 10);
17214         if (!((gull == eull) && (errno == een)))
17215                 bad++;
17216 }
17217 int main() {
17218         check(" 1",                                        1LL, 0);
17219         check(" 0",                                        0LL, 0);
17220         check("18446744073709551615",  18446744073709551615ULL, 0);
17221         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17222 #if 0 /* strtoull() for /^-/ strings is undefined. */
17223         check("-1",                    18446744073709551615ULL, 0);
17224         check("-18446744073709551614",                     2LL, 0);
17225         check("-18446744073709551615",                     1LL, 0);
17226         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17227         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17228 #endif
17229         if (!bad)
17230                 printf("ok\n");
17231 }
17232 EOCP
17233         set try
17234         if eval $compile; then
17235                 case "`$run ./try`" in
17236                 ok) echo "Your strtoull() seems to be working okay." ;;
17237                 *) cat <<EOM >&4
17238 Your strtoull() doesn't seem to be working okay.
17239 EOM
17240                    d_strtoull="$undef"
17241                    ;;
17242                 esac
17243         fi
17244         ;;
17245 esac
17246
17247 : see if strtouq exists
17248 set strtouq d_strtouq
17249 eval $inlibc
17250
17251 case "$d_strtouq" in
17252 "$define")
17253         $cat <<EOM
17254 Checking whether your strtouq() works okay...
17255 EOM
17256         $cat >try.c <<'EOCP'
17257 #include <errno.h>
17258 #include <stdio.h>
17259 extern unsigned long long int strtouq(char *s, char **, int); 
17260 static int bad = 0;
17261 void check(char *s, unsigned long long eull, int een) {
17262         unsigned long long gull;
17263         errno = 0;
17264         gull = strtouq(s, 0, 10);
17265         if (!((gull == eull) && (errno == een)))
17266                 bad++;
17267 }
17268 int main() {
17269         check(" 1",                                        1LL, 0);
17270         check(" 0",                                        0LL, 0);
17271         check("18446744073709551615",  18446744073709551615ULL, 0);
17272         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17273 #if 0 /* strtouq() for /^-/ strings is undefined. */
17274         check("-1",                    18446744073709551615ULL, 0);
17275         check("-18446744073709551614",                     2LL, 0);
17276         check("-18446744073709551615",                     1LL, 0);
17277         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17278         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17279 #endif
17280         if (!bad)
17281                 printf("ok\n");
17282         return 0;
17283 }
17284 EOCP
17285         set try
17286         if eval $compile; then
17287                 case "`$run ./try`" in
17288                 ok) echo "Your strtouq() seems to be working okay." ;;
17289                 *) cat <<EOM >&4
17290 Your strtouq() doesn't seem to be working okay.
17291 EOM
17292                    d_strtouq="$undef"
17293                    ;;
17294                 esac
17295         fi
17296         ;;
17297 esac
17298
17299 : see if strxfrm exists
17300 set strxfrm d_strxfrm
17301 eval $inlibc
17302
17303 : see if symlink exists
17304 set symlink d_symlink
17305 eval $inlibc
17306
17307 : see if syscall exists
17308 set syscall d_syscall
17309 eval $inlibc
17310
17311 : see if prototype for syscall is available
17312 echo " "
17313 set d_syscallproto syscall $i_unistd unistd.h
17314 eval $hasproto
17315
17316 : see if sysconf exists
17317 set sysconf d_sysconf
17318 eval $inlibc
17319
17320 : see if system exists
17321 set system d_system
17322 eval $inlibc
17323
17324 : see if tcgetpgrp exists
17325 set tcgetpgrp d_tcgetpgrp
17326 eval $inlibc
17327
17328 : see if tcsetpgrp exists
17329 set tcsetpgrp d_tcsetpgrp
17330 eval $inlibc
17331
17332 : see if prototype for telldir is available
17333 echo " "
17334 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17335 eval $hasproto
17336
17337 : see if time exists
17338 echo " "
17339 if test "X$d_time" = X -o X"$timetype" = X; then
17340     if set time val -f d_time; eval $csym; $val; then
17341                 echo 'time() found.' >&4
17342                 val="$define"
17343                 rp="What is the type returned by time() on this system?"
17344                 set time_t timetype long stdio.h sys/types.h
17345                 eval $typedef_ask
17346     else
17347                 echo 'time() not found, hope that will do.' >&4
17348                 val="$undef"
17349                 timetype='int';
17350     fi
17351     set d_time
17352     eval $setvar
17353 fi
17354
17355 : see if this is a sys/times.h system
17356 set sys/times.h i_systimes
17357 eval $inhdr
17358
17359 : see if times exists
17360 echo " "
17361 if set times val -f d_times; eval $csym; $val; then
17362         echo 'times() found.' >&4
17363         d_times="$define"
17364         inc=''
17365         case "$i_systimes" in
17366         "$define") inc='sys/times.h';;
17367         esac
17368         rp="What is the type returned by times() on this system?"
17369         set clock_t clocktype long stdio.h sys/types.h $inc
17370         eval $typedef_ask
17371 else
17372         echo 'times() NOT found, hope that will do.' >&4
17373         d_times="$undef"
17374         clocktype='int'
17375 fi
17376
17377 : see if tmpnam_r exists
17378 set tmpnam_r d_tmpnam_r
17379 eval $inlibc
17380 case "$d_tmpnam_r" in
17381 "$define")
17382         hdrs="$i_systypes sys/types.h define stdio.h "
17383         case "$d_tmpnam_r_proto:$usethreads" in
17384         ":define")      d_tmpnam_r_proto=define
17385                 set d_tmpnam_r_proto tmpnam_r $hdrs
17386                 eval $hasproto ;;
17387         *)      ;;
17388         esac
17389         case "$d_tmpnam_r_proto" in
17390         define)
17391         case "$tmpnam_r_proto" in
17392         ''|0) try='char* tmpnam_r(char*);'
17393         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17394         esac
17395         case "$tmpnam_r_proto" in
17396         ''|0)   d_tmpnam_r=undef
17397                 tmpnam_r_proto=0
17398                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17399         * )     case "$tmpnam_r_proto" in
17400                 REENTRANT_PROTO*) ;;
17401                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17402                 esac
17403                 echo "Prototype: $try" ;;
17404         esac
17405         ;;
17406         *)      case "$usethreads" in
17407                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17408                 esac
17409                 d_tmpnam_r=undef
17410                 tmpnam_r_proto=0
17411                 ;;
17412         esac
17413         ;;
17414 *)      tmpnam_r_proto=0
17415         ;;
17416 esac
17417
17418 : see if truncate exists
17419 set truncate d_truncate
17420 eval $inlibc
17421
17422 : see if ttyname_r exists
17423 set ttyname_r d_ttyname_r
17424 eval $inlibc
17425 case "$d_ttyname_r" in
17426 "$define")
17427         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17428         case "$d_ttyname_r_proto:$usethreads" in
17429         ":define")      d_ttyname_r_proto=define
17430                 set d_ttyname_r_proto ttyname_r $hdrs
17431                 eval $hasproto ;;
17432         *)      ;;
17433         esac
17434         case "$d_ttyname_r_proto" in
17435         define)
17436         case "$ttyname_r_proto" in
17437         ''|0) try='int ttyname_r(int, char*, size_t);'
17438         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17439         esac
17440         case "$ttyname_r_proto" in
17441         ''|0) try='int ttyname_r(int, char*, int);'
17442         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17443         esac
17444         case "$ttyname_r_proto" in
17445         ''|0) try='char* ttyname_r(int, char*, int);'
17446         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17447         esac
17448         case "$ttyname_r_proto" in
17449         ''|0)   d_ttyname_r=undef
17450                 ttyname_r_proto=0
17451                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17452         * )     case "$ttyname_r_proto" in
17453                 REENTRANT_PROTO*) ;;
17454                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17455                 esac
17456                 echo "Prototype: $try" ;;
17457         esac
17458         ;;
17459         *)      case "$usethreads" in
17460                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17461                 esac
17462                 d_ttyname_r=undef
17463                 ttyname_r_proto=0
17464                 ;;
17465         esac
17466         ;;
17467 *)      ttyname_r_proto=0
17468         ;;
17469 esac
17470
17471 : see if tzname[] exists
17472 echo " "
17473 if set tzname val -a d_tzname; eval $csym; $val; then
17474         val="$define"
17475         echo 'tzname[] found.' >&4
17476 else
17477         val="$undef"
17478         echo 'tzname[] NOT found.' >&4
17479 fi
17480 set d_tzname
17481 eval $setvar
17482
17483 case "$osname" in
17484 next|rhapsody|darwin) multiarch="$define" ;;
17485 esac
17486 case "$multiarch" in
17487 ''|[nN]*) multiarch="$undef" ;;
17488 esac
17489
17490 : check for ordering of bytes in a UV
17491 echo " "
17492 case "$usecrosscompile$multiarch" in
17493 *$define*)
17494         $cat <<EOM
17495 You seem to be either cross-compiling or doing a multiarchitecture build,
17496 skipping the byteorder check.
17497
17498 EOM
17499         byteorder='ffff'
17500         ;;
17501 *)
17502         case "$byteorder" in
17503         '')
17504                 $cat <<'EOM'
17505 In the following, larger digits indicate more significance.  A big-endian
17506 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17507 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17508 machines may have weird orders like 3412.  A Cray will report 87654321,
17509 an Alpha will report 12345678. If the test program works the default is
17510 probably right.
17511 I'm now running the test program...
17512 EOM
17513                 $cat >try.c <<EOCP
17514 #include <stdio.h>
17515 #$i_stdlib I_STDLIB
17516 #ifdef I_STDLIB
17517 #include <stdlib.h>
17518 #endif
17519 #include <sys/types.h>
17520 typedef $uvtype UV;
17521 int main()
17522 {
17523         int i;
17524         union {
17525                 UV l;
17526                 char c[$uvsize];
17527         } u;
17528
17529         if ($uvsize > 4)
17530                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17531         else
17532                 u.l = (UV)0x04030201;
17533         for (i = 0; i < $uvsize; i++)
17534                 printf("%c", u.c[i]+'0');
17535         printf("\n");
17536         exit(0);
17537 }
17538 EOCP
17539                 xxx_prompt=y
17540                 set try
17541                 if eval $compile && ./try > /dev/null; then
17542                         dflt=`$run ./try`
17543                         case "$dflt" in
17544                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17545                                 echo "(The test program ran ok.)"
17546                                 echo "byteorder=$dflt"
17547                                 xxx_prompt=n
17548                         ;;
17549                         ????|????????) echo "(The test program ran ok.)" ;;
17550                         *) echo "(The test program didn't run right for some reason.)" ;;
17551                         esac
17552                 else
17553                         dflt='4321'
17554                         cat <<'EOM'
17555 (I can't seem to compile the test program.  Guessing big-endian...)
17556 EOM
17557                 fi
17558                 case "$xxx_prompt" in
17559                 y)
17560                         rp="What is the order of bytes in $uvtype?"
17561                         . ./myread
17562                         byteorder="$ans"
17563                         ;;
17564                 *)      byteorder=$dflt
17565                         ;;
17566                 esac
17567                 ;;
17568         esac
17569         $rm -f try.c try
17570         ;;
17571 esac
17572
17573
17574 $cat <<EOM
17575
17576 Checking to see whether you can access character data unalignedly...
17577 EOM
17578 case "$d_u32align" in
17579 '')   $cat >try.c <<EOCP
17580 #include <stdio.h>
17581 #$i_stdlib I_STDLIB
17582 #ifdef I_STDLIB
17583 #include <stdlib.h>
17584 #endif
17585 #define U32 $u32type
17586 #define BYTEORDER 0x$byteorder
17587 #define U8 $u8type
17588 #include <signal.h>
17589 #ifdef SIGBUS
17590 $signal_t bletch(s) int s; { exit(4); }
17591 #endif
17592 int main() {
17593 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17594     U8 buf[8];
17595     U32 *up;
17596     int i;
17597
17598     if (sizeof(U32) != 4) {
17599         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17600         exit(1);
17601     }
17602
17603     fflush(stdout);
17604
17605 #ifdef SIGBUS
17606     signal(SIGBUS, bletch);
17607 #endif
17608
17609     buf[0] = 0;
17610     buf[1] = 0;
17611     buf[2] = 0;
17612     buf[3] = 1;
17613     buf[4] = 0;
17614     buf[5] = 0;
17615     buf[6] = 0;
17616     buf[7] = 1;
17617
17618     for (i = 0; i < 4; i++) {
17619         up = (U32*)(buf + i);
17620         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17621                (*up == 1 << (8*(3-i)))  /* little-endian */
17622               )
17623            )
17624         {
17625             printf("read failed (%x)\n", *up);
17626             exit(2);
17627         }
17628     }
17629
17630     /* write test */
17631     for (i = 0; i < 4; i++) {
17632         up = (U32*)(buf + i);
17633         *up = 0xBeef;
17634         if (*up != 0xBeef) {
17635             printf("write failed (%x)\n", *up);
17636             exit(3);
17637         }
17638     }
17639
17640     exit(0);
17641 #else
17642     printf("1\n");
17643     exit(1);
17644 #endif
17645     return 0;
17646 }
17647 EOCP
17648 set try
17649 if eval $compile_ok; then
17650         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17651         $run ./try 2>&1 >/dev/null
17652         case "$?" in
17653         0)      cat >&4 <<EOM
17654 You can access character data pretty unalignedly.
17655 EOM
17656                 d_u32align="$undef"
17657                 ;;
17658         *)      cat >&4 <<EOM
17659 It seems that you must access character data in an aligned manner.
17660 EOM
17661                 d_u32align="$define"
17662                 ;;
17663         esac
17664 else
17665         rp='Can you access character data at unaligned addresses?'
17666         dflt='n'
17667         . ./myread
17668         case "$ans" in
17669         [yY]*)  d_u32align="$undef"  ;;
17670         *)      d_u32align="$define" ;;
17671         esac
17672 fi
17673 $rm -f core core.try.* try.core
17674 ;;
17675 esac
17676
17677 : see if ualarm exists
17678 set ualarm d_ualarm
17679 eval $inlibc
17680
17681 : see if umask exists
17682 set umask d_umask
17683 eval $inlibc
17684
17685 : see if unordered exists
17686 set unordered d_unordered
17687 eval $inlibc
17688
17689 : see if unsetenv exists
17690 set unsetenv d_unsetenv
17691 eval $inlibc
17692
17693 : see if usleep exists
17694 set usleep d_usleep
17695 eval $inlibc
17696
17697 : see if prototype for usleep is available
17698 echo " "
17699 set d_usleepproto usleep $i_unistd unistd.h
17700 eval $hasproto
17701
17702 : see if ustat exists
17703 set ustat d_ustat
17704 eval $inlibc
17705
17706 : backward compatibility for d_hvfork
17707 if test X$d_hvfork != X; then
17708         d_vfork="$d_hvfork"
17709         d_hvfork=''
17710 fi
17711 : see if there is a vfork
17712 val=''
17713 set vfork val
17714 eval $inlibc
17715
17716 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17717 : perl on Solaris 2.x, and probably elsewhere.
17718 case "$val" in
17719 $define)
17720         echo " "
17721         case "$usevfork" in
17722         false) dflt='n';;
17723         *) dflt='y';;
17724         esac
17725         cat <<'EOM'
17726  
17727 Perl can only use a vfork() that doesn't suffer from strict
17728 restrictions on calling functions or modifying global data in
17729 the child.  For example, glibc-2.1 contains such a vfork()
17730 that is unsuitable.  If your system provides a proper fork()
17731 call, chances are that you do NOT want perl to use vfork().
17732
17733 EOM
17734         rp="Do you still want to use vfork()?"
17735         . ./myread
17736         case "$ans" in
17737         y|Y) ;;
17738         *)
17739                 echo "Ok, we won't use vfork()."
17740                 val="$undef"
17741                 ;;
17742         esac
17743         ;;
17744 esac
17745 set d_vfork
17746 eval $setvar
17747 case "$d_vfork" in
17748 $define) usevfork='true';;
17749 *) usevfork='false';;
17750 esac
17751
17752 : see if closedir exists
17753 set closedir d_closedir
17754 eval $inlibc
17755
17756 case "$d_closedir" in
17757 "$define")
17758         echo " "
17759         echo "Checking whether closedir() returns a status..." >&4
17760         cat > try.c <<EOM
17761 #$i_dirent I_DIRENT             /**/
17762 #$i_sysdir I_SYS_DIR            /**/
17763 #$i_sysndir I_SYS_NDIR          /**/
17764 #$i_systypes I_SYS_TYPES        /**/
17765
17766 #if defined(I_SYS_TYPES)
17767 #include <sys/types.h>
17768 #endif
17769 #if defined(I_DIRENT)
17770 #include <dirent.h>
17771 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17772 #include <sys/dir.h>
17773 #endif
17774 #else
17775 #ifdef I_SYS_NDIR
17776 #include <sys/ndir.h>
17777 #else
17778 #ifdef I_SYS_DIR
17779 #ifdef hp9000s500
17780 #include <ndir.h>       /* may be wrong in the future */
17781 #else
17782 #include <sys/dir.h>
17783 #endif
17784 #endif
17785 #endif
17786 #endif 
17787 int main() { return closedir(opendir(".")); }
17788 EOM
17789         set try
17790         if eval $compile_ok; then
17791                 if $run ./try > /dev/null 2>&1 ; then
17792                         echo "Yes, it does."
17793                         val="$undef"
17794                 else
17795                         echo "No, it doesn't."
17796                         val="$define"
17797                 fi
17798         else
17799                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17800                 val="$define"
17801         fi
17802         ;;
17803 *)
17804         val="$undef";
17805         ;;
17806 esac
17807 set d_void_closedir
17808 eval $setvar
17809 $rm -f try try.*
17810 : see if there is a wait4
17811 set wait4 d_wait4
17812 eval $inlibc
17813
17814 : see if waitpid exists
17815 set waitpid d_waitpid
17816 eval $inlibc
17817
17818 : see if wcstombs exists
17819 set wcstombs d_wcstombs
17820 eval $inlibc
17821
17822 : see if wctomb exists
17823 set wctomb d_wctomb
17824 eval $inlibc
17825
17826 : see if writev exists
17827 set writev d_writev
17828 eval $inlibc
17829
17830 : preserve RCS keywords in files with variable substitution, grrr
17831 Date='$Date'
17832 Id='$Id'
17833 Log='$Log'
17834 RCSfile='$RCSfile'
17835 Revision='$Revision'
17836
17837 : check for alignment requirements
17838 echo " "
17839 case "$usecrosscompile$multiarch" in
17840 *$define*)
17841         $cat <<EOM
17842 You seem to be either cross-compiling or doing a multiarchitecture build,
17843 skipping the memory alignment check.
17844
17845 EOM
17846         case "$alignbytes" in
17847         '') alignbytes=8 ;;
17848         esac
17849         ;;
17850 *)
17851         case "$alignbytes" in
17852         '') echo "Checking alignment constraints..." >&4
17853                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17854                         $cat >try.c <<'EOCP'
17855 typedef long double NV;
17856 EOCP
17857                 else
17858                         $cat >try.c <<'EOCP'
17859 typedef double NV;
17860 EOCP
17861                 fi
17862                 $cat >>try.c <<'EOCP'
17863 #include <stdio.h>
17864 struct foobar {
17865         char foo;
17866         NV bar;
17867 } try_algn;
17868 int main()
17869 {
17870     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17871     return(0);
17872 }
17873 EOCP
17874                 set try
17875                 if eval $compile_ok; then
17876                         dflt=`$run ./try`
17877                 else
17878                         dflt='8'
17879                         echo "(I can't seem to compile the test program...)"
17880                 fi
17881                 ;;
17882         *) dflt="$alignbytes"
17883                 ;;
17884         esac
17885         rp="Doubles must be aligned on a how-many-byte boundary?"
17886         . ./myread
17887         alignbytes="$ans"
17888         $rm -f try.c try
17889         ;;
17890 esac
17891
17892
17893 : set the base revision
17894 baserev=5.0
17895
17896 : how do we concatenate cpp tokens here?
17897 echo " "
17898 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17899 $cat >cpp_stuff.c <<'EOCP'
17900 #define RCAT(a,b)a/**/b
17901 #define ACAT(a,b)a ## b
17902 RCAT(Rei,ser)
17903 ACAT(Cir,cus)
17904 EOCP
17905 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17906 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17907         echo "Oh!  Smells like ANSI's been here." >&4
17908         echo "We can catify or stringify, separately or together!"
17909         cpp_stuff=42
17910 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17911         echo "Ah, yes!  The good old days!" >&4
17912         echo "However, in the good old days we don't know how to stringify and"
17913         echo "catify at the same time."
17914         cpp_stuff=1
17915 else
17916         $cat >&4 <<EOM
17917 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17918 You're going to have to edit the values of CAT[2-5] in config.h...
17919 EOM
17920         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17921 fi
17922 $rm -f cpp_stuff.*
17923
17924 : see if this is a db.h system
17925 set db.h i_db
17926 eval $inhdr
17927
17928 case "$i_db" in
17929 $define)
17930         : Check db version.
17931         echo " "
17932         echo "Checking Berkeley DB version ..." >&4
17933         $cat >try.c <<EOCP
17934 #$d_const HASCONST
17935 #ifndef HASCONST
17936 #define const
17937 #endif
17938 #include <sys/types.h>
17939 #include <stdio.h>
17940 #$i_stdlib I_STDLIB
17941 #ifdef I_STDLIB
17942 #include <stdlib.h>
17943 #endif
17944 #include <db.h>
17945 int main(int argc, char *argv[])
17946 {
17947 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17948     int Major, Minor, Patch ;
17949     unsigned long Version ;
17950     (void)db_version(&Major, &Minor, &Patch) ;
17951     if (argc == 2) {
17952         printf("%d %d %d %d %d %d\n",
17953                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17954                Major, Minor, Patch);
17955         exit(0);
17956     }
17957     printf("You have Berkeley DB Version 2 or greater.\n");
17958
17959     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17960                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17961     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17962                 Major, Minor, Patch) ;
17963
17964     /* check that db.h & libdb are compatible */
17965     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17966         printf("db.h and libdb are incompatible.\n") ;
17967         exit(3);        
17968     }
17969
17970     printf("db.h and libdb are compatible.\n") ;
17971
17972     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17973                 + DB_VERSION_PATCH ;
17974
17975     /* needs to be >= 2.3.4 */
17976     if (Version < 2003004) {
17977     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17978         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17979         exit(2);        
17980     }
17981
17982     exit(0);
17983 #else
17984 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17985     if (argc == 2) {
17986         printf("1 0 0\n");
17987         exit(0);
17988     }
17989     printf("You have Berkeley DB Version 1.\n");
17990     exit(0);    /* DB version < 2: the coast is clear. */
17991 #else
17992     exit(1);    /* <db.h> not Berkeley DB? */
17993 #endif
17994 #endif
17995 }
17996 EOCP
17997         set try
17998         if eval $compile_ok && $run ./try; then
17999                 echo 'Looks OK.' >&4
18000                 set `$run ./try 1`
18001                 db_version_major=$1
18002                 db_version_minor=$2
18003                 db_version_patch=$3
18004         else
18005                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18006                 i_db=$undef
18007                 case " $libs " in
18008                 *"-ldb "*)
18009                         : Remove db from list of libraries to use
18010                         echo "Removing unusable -ldb from library list" >&4
18011                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18012                         shift
18013                         libs="$*"
18014                         echo "libs = $libs" >&4
18015                         ;;
18016                 esac
18017         fi
18018         $rm -f try.*
18019         ;;
18020 esac
18021
18022 case "$i_db" in
18023 define)
18024         : Check the return type needed for hash 
18025         echo " "
18026         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18027         $cat >try.c <<EOCP
18028 #$d_const HASCONST
18029 #ifndef HASCONST
18030 #define const
18031 #endif
18032 #include <sys/types.h>
18033 #include <db.h>
18034
18035 #ifndef DB_VERSION_MAJOR
18036 u_int32_t hash_cb (ptr, size)
18037 const void *ptr;
18038 size_t size;
18039 {
18040 }
18041 HASHINFO info;
18042 int main()
18043 {
18044         info.hash = hash_cb;
18045 }
18046 #endif
18047 EOCP
18048         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18049                 if $contains warning try.out >>/dev/null 2>&1 ; then
18050                         db_hashtype='int'
18051                 else
18052                         db_hashtype='u_int32_t'
18053                 fi
18054         else
18055                 : XXX Maybe we should just give up here.
18056                 db_hashtype=u_int32_t
18057                 $cat try.out >&4
18058                 echo "Help:  I can't seem to compile the db test program." >&4
18059                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18060         fi
18061         $rm -f try.*
18062         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18063         ;;
18064 *)      db_hashtype=u_int32_t
18065         ;;
18066 esac
18067 case "$i_db" in
18068 define)
18069         : Check the return type needed for prefix 
18070         echo " "
18071         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18072         cat >try.c <<EOCP
18073 #$d_const HASCONST
18074 #ifndef HASCONST
18075 #define const
18076 #endif
18077 #include <sys/types.h>
18078 #include <db.h>
18079
18080 #ifndef DB_VERSION_MAJOR
18081 size_t prefix_cb (key1, key2)
18082 const DBT *key1;
18083 const DBT *key2;
18084 {
18085 }
18086 BTREEINFO info;
18087 int main()
18088 {
18089         info.prefix = prefix_cb;
18090 }
18091 #endif
18092 EOCP
18093         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18094                 if $contains warning try.out >>/dev/null 2>&1 ; then
18095                         db_prefixtype='int'
18096                 else
18097                         db_prefixtype='size_t'
18098                 fi
18099         else
18100                 db_prefixtype='size_t'
18101                 : XXX Maybe we should just give up here.
18102                 $cat try.out >&4
18103                 echo "Help:  I can't seem to compile the db test program." >&4
18104                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18105         fi
18106         $rm -f try.*
18107         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18108         ;;
18109 *)      db_prefixtype='size_t'
18110         ;;
18111 esac
18112
18113
18114 : How can we generate normalized random numbers ?
18115 echo " "
18116 echo "Looking for a random number function..." >&4
18117 case "$randfunc" in
18118 '')
18119         if set drand48 val -f; eval $csym; $val; then
18120                 dflt="drand48"
18121                 echo "Good, found drand48()." >&4
18122         elif set random val -f; eval $csym; $val; then
18123                 dflt="random"
18124                 echo "OK, found random()." >&4
18125         else
18126                 dflt="rand"
18127                 echo "Yick, looks like I have to use rand()." >&4
18128         fi
18129         echo " "
18130         ;;
18131 *)
18132         dflt="$randfunc"
18133         ;;
18134 esac
18135 cont=true
18136
18137 case "$ccflags" in
18138 *-Dmy_rand=*|*-Dmy_srand=*)
18139         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18140         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18141         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18142         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18143         ;;
18144 esac
18145
18146 while $test "$cont"; do
18147         rp="Use which function to generate random numbers?"
18148         . ./myread
18149         if $test "$ans" = "$dflt"; then
18150                 : null
18151         else
18152                 randbits=''
18153         fi
18154         randfunc="$ans"
18155         if set $ans val -f; eval $csym; $val; then
18156                 cont=''
18157         else
18158                 dflt=y
18159                 rp="I cannot find function $ans. Use that name anyway?"
18160                 . ./myread
18161                 dflt=rand
18162                 case "$ans" in
18163                         [yY]*) cont='';;
18164                 esac
18165         fi
18166         case "$cont" in
18167         '')
18168                 case "$randfunc" in
18169                 drand48)
18170                         drand01="drand48()"
18171                         seedfunc="srand48"
18172                         randbits=48
18173                         randseedtype=long
18174                         ;;
18175                 rand|random)
18176                         case "$randbits" in
18177                         '')
18178 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18179                                 $cat >try.c <<EOCP
18180 #$i_unistd I_UNISTD
18181 #$i_stdlib I_STDLIB
18182 #include <stdio.h>
18183 #ifdef I_UNISTD
18184 #  include <unistd.h>
18185 #endif
18186 #ifdef I_STDLIB
18187 #  include <stdlib.h>
18188 #endif
18189 int main()
18190 {
18191         register int i;
18192         register unsigned long tmp;
18193         register unsigned long max = 0L;
18194
18195         for (i = 1000; i; i--) {
18196                 tmp = (unsigned long) $randfunc();
18197                 if (tmp > max) max = tmp;
18198         }
18199         for (i = 0; max; i++)
18200                 max /= 2;
18201         printf("%d\n",i);
18202 }
18203 EOCP
18204                                 set try
18205                                 if eval $compile_ok; then
18206                                         dflt=`try`
18207                                 else
18208                                         dflt='?'
18209                                         echo "(I can't seem to compile the test program...)"
18210                                 fi
18211                                 ;;
18212                         *)
18213                                 dflt="$randbits"
18214                                 ;;
18215                         esac
18216                         rp="How many bits does your $randfunc() function produce?"
18217                         . ./myread
18218                         randbits="$ans"
18219                         $rm -f try.c try
18220                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18221                         seedfunc="s$randfunc"
18222                         randseedtype=unsigned
18223                         ;;
18224                 *)
18225                         dflt="31"
18226                         rp="How many bits does your $randfunc() function produce?"
18227                         . ./myread
18228                         randbits="$ans"
18229                         seedfunc="s$randfunc"
18230                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18231                         if set $seedfunc val -f; eval $csym; $val; then
18232                                 echo "(Using $seedfunc() to seed random generator)"
18233                         else
18234                                 echo "(Warning: no $seedfunc() to seed random generator)"
18235                                 seedfunc=rand
18236                         fi
18237                         randseedtype=unsigned
18238                         ;;
18239                 esac
18240                 ;;
18241         esac
18242 done
18243
18244 echo " "
18245 echo "Determining whether or not we are on an EBCDIC system..." >&4
18246 $cat >try.c <<'EOM'
18247 int main()
18248 {
18249   if ('M'==0xd4) return 0;
18250   return 1;
18251 }
18252 EOM
18253
18254 val=$undef
18255 set try
18256 if eval $compile_ok; then
18257         if $run ./try; then
18258                 echo "You seem to speak EBCDIC." >&4
18259                 val="$define"
18260         else
18261                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18262         fi
18263 else
18264         echo "I'm unable to compile the test program." >&4
18265         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18266 fi
18267 $rm -f try try.*
18268 set ebcdic
18269 eval $setvar
18270
18271 echo " "
18272 $cat >&4 <<EOM
18273 Checking how to flush all pending stdio output...
18274 EOM
18275 # I only know how to find the first 32 possibly open files on SunOS.
18276 # See also hints/sunos_4_1.sh and util.c  --AD
18277 case "$osname" in
18278 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18279 esac
18280 $cat >>try.c <<EOCP
18281 #include <stdio.h>
18282 #$i_stdlib I_STDLIB
18283 #ifdef I_STDLIB
18284 #include <stdlib.h>
18285 #endif
18286 #$i_unistd I_UNISTD
18287 #ifdef I_UNISTD
18288 # include <unistd.h>
18289 #endif
18290 #$d_sysconf HAS_SYSCONF
18291 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18292 #ifdef HAS_STDIO_STREAM_ARRAY
18293 # define STDIO_STREAM_ARRAY $stdio_stream_array
18294 #endif
18295 int main() {
18296   FILE* p;
18297   unlink("try.out");
18298   p = fopen("try.out", "w");
18299 #ifdef TRY_FPUTC
18300   fputc('x', p);
18301 #else
18302 # ifdef TRY_FPRINTF
18303   fprintf(p, "x");
18304 # endif
18305 #endif
18306 #ifdef TRY_FFLUSH_NULL
18307   fflush(NULL);
18308 #endif
18309 #ifdef TRY_FFLUSH_ALL
18310   {
18311     long open_max = -1;
18312 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18313     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18314 # else
18315 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18316     open_max = sysconf(_SC_OPEN_MAX);
18317 #  else
18318 #   ifdef FOPEN_MAX
18319     open_max = FOPEN_MAX;
18320 #   else
18321 #    ifdef OPEN_MAX
18322     open_max = OPEN_MAX;
18323 #    else
18324 #     ifdef _NFILE
18325     open_max = _NFILE;
18326 #     endif
18327 #    endif
18328 #   endif
18329 #  endif
18330 # endif 
18331 # ifdef HAS_STDIO_STREAM_ARRAY
18332     if (open_max > 0) {
18333       long i;
18334       for (i = 0; i < open_max; i++)
18335             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18336                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18337                 STDIO_STREAM_ARRAY[i]._flag)
18338                 fflush(&STDIO_STREAM_ARRAY[i]);
18339     }   
18340   }
18341 # endif
18342 #endif
18343   _exit(42);
18344 }
18345 EOCP
18346 : first we have to find out how _not_ to flush
18347 $to try.c
18348 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18349     output=''
18350     set try -DTRY_FPUTC
18351     if eval $compile; then
18352             $run ./try 2>/dev/null
18353             code="$?"
18354             $from try.out
18355             if $test ! -s try.out -a "X$code" = X42; then
18356                 output=-DTRY_FPUTC
18357             fi
18358     fi
18359     case "$output" in
18360     '')
18361             set try -DTRY_FPRINTF
18362             if eval $compile; then
18363                     $run ./try 2>/dev/null
18364                     code="$?"
18365                     $from try.out
18366                     if $test ! -s try.out -a "X$code" = X42; then
18367                         output=-DTRY_FPRINTF
18368                     fi
18369             fi
18370         ;;
18371     esac
18372 fi
18373 : check for fflush NULL behaviour
18374 case "$fflushNULL" in
18375 '')     set try -DTRY_FFLUSH_NULL $output
18376         if eval $compile; then
18377                 $run ./try 2>/dev/null
18378                 code="$?"
18379                 $from try.out
18380                 if $test -s try.out -a "X$code" = X42; then
18381                         fflushNULL="`$cat try.out`"
18382                 else
18383                         if $test "X$code" != X42; then
18384                                 $cat >&4 <<EOM
18385 (If this test failed, don't worry, we'll try another method shortly.)
18386 EOM
18387                         fi
18388                 fi
18389         fi
18390         $rm -f core try.core core.try.*
18391         case "$fflushNULL" in
18392         x)      $cat >&4 <<EOM
18393 Your fflush(NULL) works okay for output streams.
18394 Let's see if it clobbers input pipes...
18395 EOM
18396 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18397 # bug that improperly flushes the input end of pipes.  So we avoid the
18398 # autoflush on fork/system/exec support for now. :-(
18399 $cat >tryp.c <<EOCP
18400 #include <stdio.h>
18401 int
18402 main(int argc, char **argv)
18403 {
18404     char buf[1024];
18405     int i;
18406     char *bp = buf;
18407     while (1) {
18408         while ((i = getc(stdin)) != -1
18409                && (*bp++ = i) != '\n'
18410                && bp < &buf[1024])
18411         /* DO NOTHING */ ;
18412         *bp = '\0';
18413         fprintf(stdout, "%s", buf);
18414         fflush(NULL);
18415         if (i == -1)
18416             return 0;
18417         bp = buf;
18418     }
18419 }
18420 EOCP
18421                 fflushNULL="$define"
18422                 set tryp
18423                 if eval $compile; then
18424                     $rm -f tryp.out
18425                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18426                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18427                        $cat >&4 <<EOM
18428 fflush(NULL) seems to behave okay with input streams.
18429 EOM
18430                         fflushNULL="$define"
18431                     else
18432                         $cat >&4 <<EOM
18433 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18434 EOM
18435                         fflushNULL="$undef"
18436                     fi
18437                 fi
18438                 $rm -f core tryp.c tryp.core core.tryp.*
18439                 ;;
18440         '')     $cat >&4 <<EOM
18441 Your fflush(NULL) isn't working (contrary to ANSI C).
18442 EOM
18443                 fflushNULL="$undef"
18444                 ;;
18445         *)      $cat >&4 <<EOM
18446 Cannot figure out whether your fflush(NULL) works or not.
18447 I'm assuming it doesn't (contrary to ANSI C).
18448 EOM
18449                 fflushNULL="$undef"
18450                 ;;
18451         esac
18452         ;;
18453 $define|true|[yY]*)
18454         fflushNULL="$define"
18455         ;;
18456 *)
18457         fflushNULL="$undef"
18458         ;;
18459 esac
18460 : check explicit looping only if NULL did not work, and if the pipe
18461 : bug does not show up on an explicit flush too
18462 case "$fflushNULL" in
18463 "$undef")
18464         $cat >tryp.c <<EOCP
18465 #include <stdio.h>
18466 int
18467 main(int argc, char **argv)
18468 {
18469     char buf[1024];
18470     int i;
18471     char *bp = buf;
18472     while (1) {
18473         while ((i = getc(stdin)) != -1
18474                && (*bp++ = i) != '\n'
18475                && bp < &buf[1024])
18476         /* DO NOTHING */ ;
18477         *bp = '\0';
18478         fprintf(stdout, "%s", buf);
18479         fflush(stdin);
18480         if (i == -1)
18481             return 0;
18482         bp = buf;
18483     }
18484 }
18485 EOCP
18486         set tryp
18487         if eval $compile; then
18488             $rm -f tryp.out
18489             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18490             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18491                $cat >&4 <<EOM
18492 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18493 EOM
18494                 : now check for fflushall behaviour
18495                 case "$fflushall" in
18496                 '')     set try -DTRY_FFLUSH_ALL $output
18497                         if eval $compile; then
18498                                 $cat >&4 <<EOM
18499 (Now testing the other method--but note that this also may fail.)
18500 EOM
18501                                 $run ./try 2>/dev/null
18502                                 code=$?
18503                                 $from try.out
18504                                 if $test -s try.out -a "X$code" = X42; then
18505                                         fflushall="`$cat try.out`"
18506                                 fi
18507                         fi
18508                         $rm -f core try.core core.try.*
18509                         case "$fflushall" in
18510                         x)      $cat >&4 <<EOM
18511 Whew. Flushing explicitly all the stdio streams works.
18512 EOM
18513                                 fflushall="$define"
18514                                 ;;
18515                         '')     $cat >&4 <<EOM
18516 Sigh. Flushing explicitly all the stdio streams doesn't work.
18517 EOM
18518                                 fflushall="$undef"
18519                                 ;;
18520                         *)      $cat >&4 <<EOM
18521 Cannot figure out whether flushing stdio streams explicitly works or not.
18522 I'm assuming it doesn't.
18523 EOM
18524                                 fflushall="$undef"
18525                                 ;;
18526                         esac
18527                         ;;
18528                 "$define"|true|[yY]*)
18529                         fflushall="$define"
18530                         ;;
18531                 *)
18532                         fflushall="$undef"
18533                         ;;
18534                 esac
18535             else
18536                 $cat >&4 <<EOM
18537 All is futile.  Even fflush(stdin) clobbers input pipes!
18538 EOM
18539                 fflushall="$undef"
18540             fi
18541         else
18542             fflushall="$undef"
18543         fi
18544         $rm -f core tryp.c tryp.core core.tryp.*
18545         ;;
18546 *)      fflushall="$undef"
18547         ;;
18548 esac
18549
18550 case "$fflushNULL$fflushall" in
18551 undefundef)
18552         $cat <<EOM
18553 OK, I give up.  I cannot figure out how to flush pending stdio output.
18554 We won't be flushing handles at all before fork/exec/popen.
18555 EOM
18556         ;;
18557 esac
18558 $rm -f try.* try$exe_ext
18559
18560 : Store the full pathname to the ar program for use in the C program
18561 : Respect a hint or command line value for full_ar.
18562 case "$full_ar" in
18563 '') full_ar=$ar ;;
18564 esac
18565
18566 : Store the full pathname to the sed program for use in the C program
18567 full_sed=$sed
18568
18569 : see what type gids are declared as in the kernel
18570 echo " "
18571 echo "Looking for the type for group ids returned by getgid()."
18572 set gid_t gidtype xxx stdio.h sys/types.h
18573 eval $typedef
18574 case "$gidtype" in
18575 xxx)
18576         xxx=`./findhdr sys/user.h`
18577         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18578         case $1 in
18579         unsigned) dflt="$1 $2" ;;
18580         *) dflt="$1" ;;
18581         esac
18582         ;;
18583 *) dflt="$gidtype";;
18584 esac
18585 case "$gidtype" in
18586 gid_t) echo "gid_t found." ;;
18587 *)      rp="What is the type for group ids returned by getgid()?"
18588         . ./myread
18589         gidtype="$ans"
18590         ;;
18591 esac
18592
18593 echo " "
18594 case "$gidtype" in
18595 *_t) zzz="$gidtype"     ;;
18596 *)   zzz="gid"          ;;
18597 esac
18598 echo "Checking the size of $zzz..." >&4 
18599 cat > try.c <<EOCP
18600 #include <sys/types.h>
18601 #include <stdio.h>
18602 #$i_stdlib I_STDLIB
18603 #ifdef I_STDLIB
18604 #include <stdlib.h>
18605 #endif
18606 int main() {
18607     printf("%d\n", (int)sizeof($gidtype));
18608     exit(0);
18609 }
18610 EOCP
18611 set try
18612 if eval $compile_ok; then
18613         yyy=`$run ./try`
18614         case "$yyy" in
18615         '')     gidsize=4
18616                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18617                 ;;
18618         *)      gidsize=$yyy
18619                 echo "Your $zzz is $gidsize bytes long."
18620                 ;;
18621         esac
18622 else
18623         gidsize=4
18624         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18625 fi
18626
18627
18628 echo " "
18629 case "$gidtype" in
18630 *_t) zzz="$gidtype"     ;;
18631 *)   zzz="gid"          ;;
18632 esac
18633 echo "Checking the sign of $zzz..." >&4 
18634 cat > try.c <<EOCP
18635 #include <sys/types.h>
18636 #include <stdio.h>
18637 int main() {
18638         $gidtype foo = -1;
18639         if (foo < 0)
18640                 printf("-1\n");
18641         else
18642                 printf("1\n");
18643 }
18644 EOCP
18645 set try
18646 if eval $compile; then
18647         yyy=`$run ./try`
18648         case "$yyy" in
18649         '')     gidsign=1
18650                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18651                 ;;
18652         *)      gidsign=$yyy
18653                 case "$gidsign" in
18654                  1) echo "Your $zzz is unsigned." ;;
18655                 -1) echo "Your $zzz is signed."   ;;
18656                 esac
18657                 ;;
18658         esac
18659 else
18660         gidsign=1
18661         echo "(I can't compile the test program--guessing unsigned.)" >&4
18662 fi
18663
18664
18665 echo " "
18666
18667 if $test X"$quadtype" != X; then
18668
18669 echo "Checking how to print 64-bit integers..." >&4
18670
18671 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18672         $cat >try.c <<'EOCP'
18673 #include <sys/types.h>
18674 #include <stdio.h>
18675 int main() {
18676   int q = 12345678901;
18677   printf("%ld\n", q);
18678 }
18679 EOCP
18680         set try
18681         if eval $compile; then
18682                 yyy=`$run ./try`
18683                 case "$yyy" in
18684                 12345678901)
18685                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18686                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18687                         echo "We will use %d."
18688                         ;;
18689                 esac
18690         fi
18691 fi
18692
18693 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18694         $cat >try.c <<'EOCP'
18695 #include <sys/types.h>
18696 #include <stdio.h>
18697 int main() {
18698   long q = 12345678901;
18699   printf("%ld\n", q);
18700 }
18701 EOCP
18702         set try
18703         if eval $compile; then
18704                 yyy=`$run ./try`
18705                 case "$yyy" in
18706                 12345678901)
18707                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18708                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18709                         echo "We will use %ld."
18710                         ;;
18711                 esac
18712         fi
18713 fi
18714
18715 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18716         $cat >try.c <<'EOCP'
18717 #include <sys/types.h>
18718 #include <inttypes.h>
18719 #include <stdio.h>
18720 int main() {
18721   int64_t q = 12345678901;
18722   printf("%" PRId64 "\n", q);
18723 }
18724 EOCP
18725         set try
18726         if eval $compile; then
18727                 yyy=`$run ./try`
18728                 case "$yyy" in
18729                 12345678901)
18730                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18731                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18732                         echo "We will use the C9X style."
18733                         ;;
18734                 esac
18735         fi
18736 fi
18737
18738 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18739         $cat >try.c <<EOCP
18740 #include <sys/types.h>
18741 #include <stdio.h>
18742 int main() {
18743   $quadtype q = 12345678901;
18744   printf("%Ld\n", q);
18745 }
18746 EOCP
18747         set try
18748         if eval $compile; then
18749                 yyy=`$run ./try`
18750                 case "$yyy" in
18751                 12345678901)
18752                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18753                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18754                         echo "We will use %Ld."
18755                         ;;
18756                 esac
18757         fi
18758 fi
18759
18760 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18761         $cat >try.c <<'EOCP'
18762 #include <sys/types.h>
18763 #include <stdio.h>
18764 int main() {
18765   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18766   printf("%lld\n", q);
18767 }
18768 EOCP
18769         set try
18770         if eval $compile; then
18771                 yyy=`$run ./try`
18772                 case "$yyy" in
18773                 12345678901)
18774                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18775                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18776                         echo "We will use the %lld style."
18777                         ;;
18778                 esac
18779         fi
18780 fi
18781
18782 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18783         $cat >try.c <<EOCP
18784 #include <sys/types.h>
18785 #include <stdio.h>
18786 int main() {
18787   $quadtype q = 12345678901;
18788   printf("%qd\n", q);
18789 }
18790 EOCP
18791         set try
18792         if eval $compile; then
18793                 yyy=`$run ./try`
18794                 case "$yyy" in
18795                 12345678901)
18796                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18797                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18798                         echo "We will use %qd."
18799                         ;;
18800                 esac
18801         fi
18802 fi
18803
18804 if $test X"$sPRId64" = X; then
18805         echo "Cannot figure out how to print 64-bit integers." >&4
18806 fi
18807
18808 $rm -f try try.*
18809
18810 fi
18811
18812 case "$sPRId64" in
18813 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18814         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18815         ;;
18816 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18817         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18818         ;;
18819 esac
18820
18821
18822 echo " "
18823 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18824
18825 if $test X"$ivsize" = X8; then
18826         ivdformat="$sPRId64"
18827         uvuformat="$sPRIu64"
18828         uvoformat="$sPRIo64"
18829         uvxformat="$sPRIx64"
18830         uvXUformat="$sPRIXU64"
18831 else
18832         if $test X"$ivsize" = X"$longsize"; then
18833                 ivdformat='"ld"'
18834                 uvuformat='"lu"'
18835                 uvoformat='"lo"'
18836                 uvxformat='"lx"'
18837                 uvXUformat='"lX"'
18838         else
18839                 if $test X"$ivsize" = X"$intsize"; then
18840                         ivdformat='"d"'
18841                         uvuformat='"u"'
18842                         uvoformat='"o"'
18843                         uvxformat='"x"'
18844                         uvXUformat='"X"'
18845                 else
18846                         : far out
18847                         if $test X"$ivsize" = X"$shortsize"; then
18848                                 ivdformat='"hd"'
18849                                 uvuformat='"hu"'
18850                                 uvoformat='"ho"'
18851                                 uvxformat='"hx"'
18852                                 uvXUformat='"hX"'
18853                         fi
18854                 fi
18855         fi
18856 fi
18857
18858 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18859         nveformat="$sPRIeldbl"
18860         nvfformat="$sPRIfldbl"
18861         nvgformat="$sPRIgldbl"
18862         nvEUformat="$sPRIEUldbl"
18863         nvFUformat="$sPRIFUldbl"
18864         nvGUformat="$sPRIGUldbl"
18865 else
18866         nveformat='"e"'
18867         nvfformat='"f"'
18868         nvgformat='"g"'
18869         nvEUformat='"E"'
18870         nvFUformat='"F"'
18871         nvGUformat='"G"'
18872 fi
18873
18874 case "$ivdformat" in
18875 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18876     exit 1
18877     ;;
18878 esac
18879
18880
18881 echo " "
18882 $echo "Checking the format string to be used for gids..." >&4
18883
18884 case "$gidsign" in
18885 -1)     if $test X"$gidsize" = X"$ivsize"; then
18886                 gidformat="$ivdformat"
18887         else
18888                 if $test X"$gidsize" = X"$longsize"; then
18889                         gidformat='"ld"'
18890                 else
18891                         if $test X"$gidsize" = X"$intsize"; then
18892                                 gidformat='"d"'
18893                         else
18894                                 if $test X"$gidsize" = X"$shortsize"; then
18895                                         gidformat='"hd"'
18896                                 fi
18897                         fi
18898                 fi
18899         fi
18900         ;;
18901 *)      if $test X"$gidsize" = X"$uvsize"; then
18902                 gidformat="$uvuformat"
18903         else
18904                 if $test X"$gidsize" = X"$longsize"; then
18905                         gidformat='"lu"'
18906                 else
18907                         if $test X"$gidsize" = X"$intsize"; then
18908                                 gidformat='"u"'
18909                         else
18910                                 if $test X"$gidsize" = X"$shortsize"; then
18911                                         gidformat='"hu"'
18912                                 fi
18913                         fi
18914                 fi
18915         fi
18916         ;;
18917 esac
18918
18919 : see if getgroups exists
18920 set getgroups d_getgrps
18921 eval $inlibc
18922
18923 : see if setgroups exists
18924 set setgroups d_setgrps
18925 eval $inlibc
18926
18927
18928 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18929 echo " "
18930 case "$d_getgrps$d_setgrps" in
18931 *define*)
18932         case "$groupstype" in
18933         '') dflt="$gidtype" ;;
18934         *)  dflt="$groupstype" ;;
18935         esac
18936         $cat <<EOM
18937 What type of pointer is the second argument to getgroups() and setgroups()?
18938 Usually this is the same as group ids, $gidtype, but not always.
18939
18940 EOM
18941         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18942         . ./myread
18943         groupstype="$ans"
18944         ;;
18945 *)  groupstype="$gidtype";;
18946 esac
18947
18948
18949 if $test $patchlevel -lt 9; then
18950 : MAD is not available in 5.8.x or earlier.
18951     ans=n;
18952 else
18953     case "$mad" in
18954     $define|true|[yY]*) dflt='y' ;;
18955     *)                  dflt='n' ;;
18956     esac
18957     cat <<EOM
18958
18959 Would you like to build with Misc Attribute Decoration? This is development
18960 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18961 overhead on the interpreter.
18962
18963 If this doesn't make any sense to you, just accept the default '$dflt'.
18964 EOM
18965     rp='Build Perl with MAD?'
18966     . ./myread
18967 fi
18968 case "$ans" in
18969 y|Y)    val="$define"
18970         madlyh='madly.h madly.act madly.tab'
18971         madlysrc='madly.c'
18972         madlyobj="madly$_o" ;;
18973 *)      val="$undef"
18974         madlyh=''
18975         madlysrc=''
18976         madlyobj='' ;;
18977 esac
18978 set mad
18979 eval $setvar
18980
18981 echo " "
18982 echo "Checking if your $make program sets \$(MAKE)..." >&4
18983 case "$make_set_make" in
18984 '')
18985         $sed 's/^X //' > testmake.mak << 'EOF'
18986 Xall:
18987 X       @echo 'maketemp="$(MAKE)"'
18988 EOF
18989         case "`$make -f testmake.mak 2>/dev/null`" in
18990         *maketemp=*) make_set_make='#' ;;
18991         *)      make_set_make="MAKE=$make" ;;
18992         esac
18993         $rm -f testmake.mak
18994         ;;
18995 esac
18996 case "$make_set_make" in
18997 '#') echo "Yup, it does.";;
18998 *) echo "Nope, it doesn't.";;
18999 esac
19000
19001 : see what type is used for mode_t
19002 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19003 set mode_t modetype int stdio.h sys/types.h
19004 eval $typedef_ask
19005
19006 : see if stdarg is available
19007 echo " "
19008 if $test `./findhdr stdarg.h`; then
19009         echo "<stdarg.h> found." >&4
19010         valstd="$define"
19011 else
19012         echo "<stdarg.h> NOT found." >&4
19013         valstd="$undef"
19014 fi
19015
19016 : see if varags is available
19017 echo " "
19018 if $test `./findhdr varargs.h`; then
19019         echo "<varargs.h> found." >&4
19020 else
19021         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19022 fi
19023
19024 : set up the varargs testing programs
19025 $cat > varargs.c <<EOP
19026 #ifdef I_STDARG
19027 #include <stdarg.h>
19028 #endif
19029 #ifdef I_VARARGS
19030 #include <varargs.h>
19031 #endif
19032
19033 #ifdef I_STDARG
19034 int f(char *p, ...)
19035 #else
19036 int f(va_alist)
19037 va_dcl
19038 #endif
19039 {
19040         va_list ap;
19041 #ifndef I_STDARG
19042         char *p;
19043 #endif
19044 #ifdef I_STDARG
19045         va_start(ap,p);
19046 #else
19047         va_start(ap);
19048         p = va_arg(ap, char *);
19049 #endif
19050         va_end(ap);
19051 }
19052 EOP
19053 $cat > varargs <<EOP
19054 $startsh
19055 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19056         echo "true"
19057 else
19058         echo "false"
19059 fi
19060 $rm -f varargs$_o
19061 EOP
19062 chmod +x varargs
19063
19064 : now check which varargs header should be included
19065 echo " "
19066 i_varhdr=''
19067 case "$valstd" in
19068 "$define")
19069         if `./varargs I_STDARG`; then
19070                 val='stdarg.h'
19071         elif `./varargs I_VARARGS`; then
19072                 val='varargs.h'
19073         fi
19074         ;;
19075 *)
19076         if `./varargs I_VARARGS`; then
19077                 val='varargs.h'
19078         fi
19079         ;;
19080 esac
19081 case "$val" in
19082 '')
19083 echo "I could not find the definition for va_dcl... You have problems..." >&4
19084         val="$undef"; set i_stdarg; eval $setvar
19085         val="$undef"; set i_varargs; eval $setvar
19086         ;;
19087 *) 
19088         set i_varhdr
19089         eval $setvar
19090         case "$i_varhdr" in
19091         stdarg.h)
19092                 val="$define"; set i_stdarg; eval $setvar
19093                 val="$undef"; set i_varargs; eval $setvar
19094                 ;;
19095         varargs.h)
19096                 val="$undef"; set i_stdarg; eval $setvar
19097                 val="$define"; set i_varargs; eval $setvar
19098                 ;;
19099         esac
19100         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19101 esac
19102 $rm -f varargs*
19103
19104 : see if we need va_copy
19105 echo " "
19106 case "$i_stdarg" in
19107 "$define")
19108         $cat >try.c <<EOCP
19109 #include <stdarg.h>
19110 #include <stdio.h>
19111 #$i_stdlib I_STDLIB
19112 #ifdef I_STDLIB
19113 #include <stdlib.h>
19114 #endif
19115 #include <signal.h>
19116
19117 int
19118 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19119 {
19120   return vfprintf(f, fmt, *valp);
19121 }
19122  
19123 int    
19124 myvfprintf(FILE *f, const  char *fmt, va_list val)
19125 {
19126   return ivfprintf(f, fmt, &val);
19127 }
19128       
19129 int
19130 myprintf(char *fmt, ...) 
19131 {
19132   va_list val;
19133   va_start(val, fmt);
19134   return myvfprintf(stdout, fmt, val); 
19135 }         
19136
19137 int
19138 main(int ac, char **av)
19139 {
19140   signal(SIGSEGV, exit);
19141
19142   myprintf("%s%cs all right, then\n", "that", '\'');                            
19143   exit(0);      
19144 }
19145 EOCP
19146         set try
19147         if eval $compile && $run ./try 2>&1 >/dev/null; then
19148                 case "`$run ./try`" in
19149                 "that's all right, then")
19150                         okay=yes
19151                         ;;
19152                 esac
19153         fi
19154         case "$okay" in
19155         yes)    echo "It seems that you don't need va_copy()." >&4
19156                 need_va_copy="$undef"
19157                 ;;
19158         *)      echo "It seems that va_copy() or similar will be needed." >&4
19159                 need_va_copy="$define"
19160                 ;;
19161         esac
19162         $rm -f try.* core core.* *.core *.core.*
19163         ;;
19164 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19165         ;;
19166 esac
19167
19168 : see if the Compiler supports C99 variadic macros 
19169 case "$i_stdarg$i_stdlib" in
19170     "$define$define")
19171     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
19172     $cat >try.c <<EOCP
19173 #include <stdio.h>
19174 #include <stdarg.h>
19175
19176 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
19177
19178 int main() {
19179   char buf[20];
19180   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
19181   puts(buf);
19182   return 0;
19183 }
19184 EOCP
19185     set try
19186     if eval $compile && $run ./try 2>&1 >/dev/null; then
19187         case "`$run ./try`" in
19188             "123 456 789")
19189             echo "You have C99 variadic macros." >&4
19190             d_c99_variadic_macros="$define"
19191             ;;
19192             *)
19193             echo "You don't have functional C99 variadic macros." >&4
19194             d_c99_variadic_macros="$undef"
19195             ;;
19196         esac
19197     else
19198         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
19199         d_c99_variadic_macros="$undef"
19200     fi
19201     ;;
19202     *)
19203     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
19204     d_c99_variadic_macros="$undef"
19205     ;;
19206 esac
19207
19208 : see what type is used for size_t
19209 rp="What is the type used for the length parameter for string functions?"
19210 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19211 eval $typedef_ask
19212
19213 : check for type of arguments to gethostbyaddr. 
19214 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19215         case "$d_gethbyaddr" in
19216         $define)
19217                 $cat <<EOM
19218
19219 Checking to see what type of arguments are accepted by gethostbyaddr().
19220 EOM
19221                 hdrs="$define sys/types.h
19222                         $d_socket sys/socket.h 
19223                         $i_niin netinet/in.h 
19224                         $i_netdb netdb.h
19225                         $i_unistd unistd.h"
19226                 : The first arg can 'char *' or 'void *'
19227                 : The second arg is some of integral type
19228                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19229                         for yyy in size_t long int; do
19230                                 case "$netdb_host_type" in
19231                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19232                                         if ./protochk "$try" $hdrs; then
19233                                                 echo "Your system accepts $xxx for the first arg."
19234                                                 echo "...and $yyy for the second arg."
19235                                                 netdb_host_type="$xxx"
19236                                                 netdb_hlen_type="$yyy"
19237                                         fi
19238                                         ;;
19239                                 esac
19240                         done
19241                 done
19242                 : In case none of those worked, prompt the user.
19243                 case "$netdb_host_type" in
19244                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19245                         dflt='char *'
19246                         . ./myread
19247                         netdb_host_type=$ans
19248                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19249                         dflt="$sizetype"
19250                         . ./myread
19251                         netdb_hlen_type=$ans
19252                         ;;
19253                 esac
19254                 ;;
19255         *)      : no gethostbyaddr, so pick harmless defaults
19256                 netdb_host_type='char *'
19257                 netdb_hlen_type="$sizetype"
19258                 ;;
19259         esac
19260         # Remove the "const" if needed. -- but then we'll have a 
19261         # prototype clash!
19262         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19263 fi
19264
19265 : check for type of argument to gethostbyname. 
19266 if test "X$netdb_name_type" = X ; then
19267         case "$d_gethbyname" in
19268         $define)
19269                 $cat <<EOM
19270
19271 Checking to see what type of argument is accepted by gethostbyname().
19272 EOM
19273                 hdrs="$define sys/types.h
19274                         $d_socket sys/socket.h 
19275                         $i_niin netinet/in.h 
19276                         $i_netdb netdb.h
19277                         $i_unistd unistd.h"
19278                 for xxx in "const char *" "char *"; do
19279                         case "$netdb_name_type" in
19280                         '')     try="extern struct hostent *gethostbyname($xxx);"
19281                                 if ./protochk "$try" $hdrs; then
19282                                         echo "Your system accepts $xxx."
19283                                         netdb_name_type="$xxx"
19284                                 fi
19285                                 ;;
19286                         esac
19287                 done
19288                 : In case none of those worked, prompt the user.
19289                 case "$netdb_name_type" in
19290                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19291                         dflt='char *'
19292                         . ./myread
19293                         netdb_name_type=$ans
19294                         ;;
19295                 esac
19296                 ;;
19297         *)      : no gethostbyname, so pick harmless default
19298                 netdb_name_type='char *'
19299                 ;;
19300         esac
19301 fi
19302
19303 : check for type of 1st argument to getnetbyaddr. 
19304 if test "X$netdb_net_type" = X ; then
19305         case "$d_getnbyaddr" in
19306         $define)
19307                 $cat <<EOM
19308
19309 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19310 EOM
19311                 hdrs="$define sys/types.h
19312                         $d_socket sys/socket.h 
19313                         $i_niin netinet/in.h 
19314                         $i_netdb netdb.h
19315                         $i_unistd unistd.h"
19316                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19317                         case "$netdb_net_type" in
19318                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19319                                 if ./protochk "$try" $hdrs; then
19320                                         echo "Your system accepts $xxx."
19321                                         netdb_net_type="$xxx"
19322                                 fi
19323                                 ;;
19324                         esac
19325                 done
19326                 : In case none of those worked, prompt the user.
19327                 case "$netdb_net_type" in
19328                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19329                         dflt='long'
19330                         . ./myread
19331                         netdb_net_type=$ans
19332                         ;;
19333                 esac
19334                 ;;
19335         *)      : no getnetbyaddr, so pick harmless default
19336                 netdb_net_type='long'
19337                 ;;
19338         esac
19339 fi
19340 : locate the preferred pager for this system
19341 fn=f/
19342 case "$pager" in
19343 '')
19344         dflt=''
19345         case "$pg" in
19346         /*) dflt=$pg;;
19347         [a-zA-Z]:/*) dflt=$pg;;
19348         esac
19349         case "$more" in
19350         /*) dflt=$more;;
19351         [a-zA-Z]:/*) dflt=$more;;
19352         esac
19353         case "$less" in
19354         /*) dflt=$less;;
19355         [a-zA-Z]:/*) dflt=$less;;
19356         esac
19357         case "$dflt" in
19358         '') dflt=/usr/ucb/more;;
19359         esac
19360         ;;
19361 *)      dflt="$pager"
19362         : Instruct ./getfile to trust the hinted or previous pager value,
19363         : even if it does not begin with a slash.  For example, on os2,
19364         : pager might be cmd /c more.  See comments in UU/getfile.
19365         fn="f/($pager)"
19366         ;;
19367 esac
19368 echo " "
19369 rp='What pager is used on your system?'
19370 . ./getfile
19371 pager="$ans"
19372
19373 : see what type pids are declared as in the kernel
19374 rp="What is the type of process ids on this system?"
19375 set pid_t pidtype int stdio.h sys/types.h
19376 eval $typedef_ask
19377
19378 : see if ar generates random libraries by itself
19379 echo " "
19380 echo "Checking how to generate random libraries on your machine..." >&4
19381 echo 'int bar1() { return bar2(); }' > bar1.c
19382 echo 'int bar2() { return 2; }' > bar2.c
19383 $cat > foo.c <<EOP
19384 #$i_stdlib I_STDLIB
19385 #ifdef I_STDLIB
19386 #include <stdlib.h>
19387 #endif
19388 int main() { printf("%d\n", bar1()); exit(0); }
19389 EOP
19390 $cc $ccflags -c bar1.c >/dev/null 2>&1
19391 $cc $ccflags -c bar2.c >/dev/null 2>&1
19392 $cc $ccflags -c foo.c >/dev/null 2>&1
19393 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19394 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19395         $run ./foobar >/dev/null 2>&1; then
19396         echo "$ar appears to generate random libraries itself."
19397         orderlib=false
19398         if [ "X$ranlib" = "X" ]; then
19399             ranlib=":"
19400         fi
19401 elif $ar s bar$_a >/dev/null 2>&1 &&
19402         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19403         $run ./foobar >/dev/null 2>&1; then
19404                 echo "a table of contents needs to be added with '$ar s'."
19405                 orderlib=false
19406                 ranlib="$ar s"
19407 elif $ar ts bar$_a >/dev/null 2>&1 &&
19408         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19409         $run ./foobar >/dev/null 2>&1; then
19410                 echo "a table of contents needs to be added with '$ar ts'."
19411                 orderlib=false
19412                 ranlib="$ar ts"
19413 else
19414         case "$ranlib" in
19415         :) ranlib='';;
19416         '')
19417                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19418                 $test -f $ranlib || ranlib=''
19419                 ;;
19420         esac
19421         if $test -n "$ranlib"; then
19422                 echo "your system has '$ranlib'; we'll use that."
19423                 orderlib=false
19424         else
19425                 echo "your system doesn't seem to support random libraries"
19426                 echo "so we'll use lorder and tsort to order the libraries."
19427                 orderlib=true
19428                 ranlib=":"
19429         fi
19430 fi
19431 $rm -f foo* bar*
19432
19433 : check for type of arguments to select. 
19434 case "$selecttype" in
19435 '') case "$d_select" in
19436         $define)
19437                 echo " "
19438                 $cat <<EOM
19439 Checking to see what type of arguments are accepted by select().
19440 EOM
19441                 hdrs="$define sys/types.h
19442                         $i_systime sys/time.h 
19443                         $i_sysselct sys/select.h
19444                         $d_socket sys/socket.h"
19445                 : The first arg can be int, unsigned, or size_t
19446                 : The last arg may or may not be 'const'
19447                 val=''
19448                 : void pointer has been seen but using that
19449                 : breaks the selectminbits test
19450                 for xxx in 'fd_set *' 'int *'; do
19451                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19452                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19453                                         case "$val" in
19454                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19455                                                 if ./protochk "$try" $hdrs; then
19456                                                         echo "Your system accepts $xxx."
19457                                                         val="$xxx"
19458                                                 fi
19459                                                 ;;
19460                                         esac
19461                                 done
19462                         done
19463                 done
19464                 case "$val" in
19465                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19466                         case "$d_fd_set" in
19467                                 $define) dflt="fd_set *" ;;
19468                                 *)              dflt="int *" ;;
19469                         esac
19470                         . ./myread
19471                         val=$ans
19472                         ;;
19473                 esac
19474                 selecttype="$val"
19475                 ;;
19476         *)      : no select, so pick a harmless default
19477                 selecttype='int *'
19478                 ;;
19479         esac
19480         ;;
19481 esac
19482
19483 : check for the select 'width'
19484 case "$selectminbits" in
19485 '') safebits=`expr $ptrsize \* 8`
19486     case "$d_select" in
19487         $define)
19488                 $cat <<EOM
19489
19490 Checking to see on how many bits at a time your select() operates...
19491 EOM
19492                 $cat >try.c <<EOCP
19493 #include <sys/types.h>
19494 #$i_time I_TIME
19495 #$i_systime I_SYS_TIME
19496 #$i_systimek I_SYS_TIME_KERNEL
19497 #ifdef I_TIME
19498 #   include <time.h>
19499 #endif
19500 #ifdef I_SYS_TIME
19501 #   ifdef I_SYS_TIME_KERNEL
19502 #       define KERNEL
19503 #   endif
19504 #   include <sys/time.h>
19505 #   ifdef I_SYS_TIME_KERNEL
19506 #       undef KERNEL
19507 #   endif
19508 #endif
19509 #$i_sysselct I_SYS_SELECT
19510 #ifdef I_SYS_SELECT
19511 #include <sys/select.h>
19512 #endif
19513 #$d_socket HAS_SOCKET
19514 #ifdef HAS_SOCKET
19515 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19516 #endif
19517 #include <stdio.h>
19518 #$i_stdlib I_STDLIB
19519 #ifdef I_STDLIB
19520 #include <stdlib.h>
19521 #endif
19522 $selecttype b;
19523 #define S sizeof(*(b))
19524 #define MINBITS 64
19525 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19526 #define NBITS  (NBYTES * 8)
19527 int main() {
19528     char *s = malloc(NBYTES);
19529     struct timeval t;
19530     int i;
19531     FILE* fp;
19532     int fd;
19533
19534     if (!s)
19535         exit(1);
19536     fclose(stdin);
19537     fp = fopen("try.c", "r");
19538     if (fp == 0)
19539       exit(2);
19540     fd = fileno(fp);
19541     if (fd < 0)
19542       exit(3);
19543     b = ($selecttype)s;
19544     for (i = 0; i < NBITS; i++)
19545         FD_SET(i, b);
19546     t.tv_sec  = 0;
19547     t.tv_usec = 0;
19548     select(fd + 1, b, 0, 0, &t);
19549     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19550     free(s);
19551     printf("%d\n", i + 1);
19552     return 0;
19553 }
19554 EOCP
19555                 set try
19556                 if eval $compile_ok; then
19557                         selectminbits=`$run ./try`
19558                         case "$selectminbits" in
19559                         '')     cat >&4 <<EOM
19560 Cannot figure out on how many bits at a time your select() operates.
19561 I'll play safe and guess it is $safebits bits.
19562 EOM
19563                                 selectminbits=$safebits
19564                                 bits="$safebits bits"
19565                                 ;;
19566                         1)      bits="1 bit" ;;
19567                         *)      bits="$selectminbits bits" ;;
19568                         esac
19569                         echo "Your select() operates on $bits at a time." >&4
19570                 else
19571                         rp='What is the minimum number of bits your select() operates on?'
19572                         case "$byteorder" in
19573                         12345678)       dflt=64 ;;
19574                         1234)           dflt=32 ;;
19575                         *)              dflt=1  ;;
19576                         esac
19577                         . ./myread
19578                         val=$ans
19579                         selectminbits="$val"
19580                 fi
19581                 $rm -f try.* try
19582                 ;;
19583         *)      : no select, so pick a harmless default
19584                 selectminbits=$safebits
19585                 ;;
19586         esac
19587         ;;
19588 esac
19589
19590 : Trace out the files included by signal.h, then look for SIGxxx names.
19591 : Remove SIGARRAYSIZE used by HPUX.
19592 : Remove SIGSTKSIZE used by Linux.
19593 : Remove SIGSTKSZ used by Posix.
19594 : Remove SIGTYP void lines used by OS2.
19595 : Some cpps, like os390, dont give the file name anywhere
19596 if [ "X$fieldn" = X ]; then
19597         : Just make some guesses.  We check them later.
19598         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19599 else
19600         xxx=`echo '#include <signal.h>' |
19601         $cppstdin $cppminus $cppflags 2>/dev/null |
19602         $grep '^[       ]*#.*include' | 
19603         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19604 fi
19605 : Check this list of files to be sure we have parsed the cpp output ok.
19606 : This will also avoid potentially non-existent files, such 
19607 : as ../foo/bar.h
19608 xxxfiles=''
19609 for xx in $xxx /dev/null ; do
19610         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19611 done
19612 : If we have found no files, at least try signal.h
19613 case "$xxxfiles" in
19614 '')     xxxfiles=`./findhdr signal.h` ;;
19615 esac
19616 xxx=`awk '
19617 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19618         print substr($2, 4, 20)
19619 }
19620 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19621         print substr($3, 4, 20)
19622 }' $xxxfiles`
19623 : Append some common names just in case the awk scan failed.
19624 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19625 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19626 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19627 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19628 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19629
19630 : generate a few handy files for later
19631 $cat > signal.c <<EOCP
19632 #include <sys/types.h>
19633 #include <signal.h>
19634 #$i_stdlib I_STDLIB
19635 #ifdef I_STDLIB
19636 #include <stdlib.h>
19637 #endif
19638 #include <stdio.h>
19639 int main() {
19640
19641 /* Strange style to avoid deeply-nested #if/#else/#endif */
19642 #ifndef NSIG
19643 #  ifdef _NSIG
19644 #    define NSIG (_NSIG)
19645 #  endif
19646 #endif
19647
19648 #ifndef NSIG
19649 #  ifdef SIGMAX
19650 #    define NSIG (SIGMAX+1)
19651 #  endif
19652 #endif
19653
19654 #ifndef NSIG
19655 #  ifdef SIG_MAX
19656 #    define NSIG (SIG_MAX+1)
19657 #  endif
19658 #endif
19659
19660 #ifndef NSIG
19661 #  ifdef _SIG_MAX
19662 #    define NSIG (_SIG_MAX+1)
19663 #  endif
19664 #endif
19665
19666 #ifndef NSIG
19667 #  ifdef MAXSIG
19668 #    define NSIG (MAXSIG+1)
19669 #  endif
19670 #endif
19671
19672 #ifndef NSIG
19673 #  ifdef MAX_SIG
19674 #    define NSIG (MAX_SIG+1)
19675 #  endif
19676 #endif
19677
19678 #ifndef NSIG
19679 #  ifdef SIGARRAYSIZE
19680 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19681 #  endif
19682 #endif
19683
19684 #ifndef NSIG
19685 #  ifdef _sys_nsig
19686 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19687 #  endif
19688 #endif
19689
19690 /* Default to some arbitrary number that's big enough to get most
19691    of the common signals.
19692 */
19693 #ifndef NSIG
19694 #    define NSIG 50
19695 #endif
19696
19697 printf("NSIG %d\n", NSIG);
19698
19699 #ifndef JUST_NSIG
19700
19701 EOCP
19702
19703 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19704 {
19705         printf "#ifdef SIG"; printf $1; printf "\n"
19706         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19707         printf $1; printf ");\n"
19708         printf "#endif\n"
19709 }
19710 END {
19711         printf "#endif /* JUST_NSIG */\n";
19712         printf "exit(0);\n}\n";
19713 }
19714 ' >>signal.c
19715 $cat >signal.awk <<'EOP'
19716 BEGIN { ndups = 0 }
19717 $1 ~ /^NSIG$/ { nsig = $2 }
19718 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19719     if ($2 > maxsig) { maxsig = $2 }
19720     if (sig_name[$2]) {
19721         dup_name[ndups] = $1
19722         dup_num[ndups] = $2
19723         ndups++ 
19724     }
19725     else {
19726         sig_name[$2] = $1
19727         sig_num[$2] = $2
19728     }
19729 }
19730 END { 
19731     if (nsig == 0) {
19732         nsig = maxsig + 1
19733     }
19734     printf("NSIG %d\n", nsig);
19735     for (n = 1; n < nsig; n++) {
19736         if (sig_name[n]) {
19737             printf("%s %d\n", sig_name[n], sig_num[n])
19738         }
19739         else {
19740             printf("NUM%d %d\n", n, n) 
19741         }
19742     }
19743     for (n = 0; n < ndups; n++) {
19744         printf("%s %d\n", dup_name[n], dup_num[n])
19745     }
19746 }
19747 EOP
19748 $cat >signal_cmd <<EOS
19749 $startsh
19750 if $test -s signal.lst; then
19751     echo "Using your existing signal.lst file"
19752         exit 0
19753 fi
19754 xxx="$xxx"
19755 EOS
19756 $cat >>signal_cmd <<'EOS'
19757
19758 set signal
19759 if eval $compile_ok; then
19760         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19761 else
19762         echo "(I can't seem be able to compile the whole test program)" >&4
19763         echo "(I'll try it in little pieces.)" >&4
19764         set signal -DJUST_NSIG
19765         if eval $compile_ok; then
19766                 $run ./signal$_exe > signal.nsg
19767                 $cat signal.nsg
19768         else
19769                 echo "I can't seem to figure out how many signals you have." >&4
19770                 echo "Guessing 50." >&4
19771                 echo 'NSIG 50' > signal.nsg
19772         fi
19773         : Now look at all the signal names, one at a time.
19774         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19775                 $cat > signal.c <<EOCP
19776 #include <sys/types.h>
19777 #include <signal.h>
19778 #include <stdio.h>
19779 int main() {
19780 printf("$xx %d\n", SIG${xx});
19781 return 0;
19782 }
19783 EOCP
19784                 set signal
19785                 if eval $compile; then
19786                         echo "SIG${xx} found."
19787                         $run ./signal$_exe  >> signal.ls1
19788                 else
19789                         echo "SIG${xx} NOT found."
19790                 fi
19791         done
19792         if $test -s signal.ls1; then
19793                 $cat signal.nsg signal.ls1 |
19794                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19795         fi
19796
19797 fi
19798 if $test -s signal.lst; then
19799         :
19800 else
19801         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19802         echo 'kill -l' >signal
19803         set X `csh -f <signal`
19804         $rm -f signal
19805         shift
19806         case $# in
19807         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19808         esac
19809         echo $@ | $tr ' ' $trnl | \
19810             $awk '{ printf "%s %d\n", $1, ++s; }
19811                   END { printf "NSIG %d\n", ++s }' >signal.lst
19812 fi
19813 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19814 EOS
19815 chmod a+x signal_cmd
19816 $eunicefix signal_cmd
19817
19818 : generate list of signal names
19819 echo " "
19820 case "$sig_name_init" in
19821 '') doinit=yes ;;
19822 *)  case "$sig_num_init" in
19823     ''|*,*) doinit=yes ;;
19824     esac ;;
19825 esac
19826 case "$doinit" in
19827 yes)
19828         echo "Generating a list of signal names and numbers..." >&4
19829         . ./signal_cmd
19830         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19831         sig_name=`$awk 'BEGIN { printf "ZERO " }
19832                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19833         sig_num=`$awk  'BEGIN { printf "0 " }
19834                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19835         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19836                              !/^NSIG/   { printf "\"%s\", ", $1 }
19837                              END        { printf "0\n" }' signal.lst`
19838         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19839                              !/^NSIG/   { printf "%d, ", $2}
19840                              END        { printf "0\n"}' signal.lst`
19841         ;;
19842 esac
19843 echo "The following $sig_count signals are available:"
19844 echo " "
19845 echo $sig_name | $awk \
19846 'BEGIN { linelen = 0 }
19847 {
19848         for (i = 1; i <= NF; i++) {
19849                 name = "SIG" $i " "
19850                 linelen = linelen + length(name)
19851                 if (linelen > 70) {
19852                         printf "\n"
19853                         linelen = length(name)
19854                 }
19855                 printf "%s", name
19856         }
19857         printf "\n"
19858 }'
19859 sig_size=`echo $sig_name | awk '{print NF}'`
19860 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19861
19862 echo " "
19863 case "$sizetype" in
19864 *_t) zzz="$sizetype"    ;;
19865 *)   zzz="filesize"     ;;
19866 esac
19867 echo "Checking the size of $zzz..." >&4 
19868 cat > try.c <<EOCP
19869 #include <sys/types.h>
19870 #include <stdio.h>
19871 #$i_stdlib I_STDLIB
19872 #ifdef I_STDLIB
19873 #include <stdlib.h>
19874 #endif
19875 int main() {
19876     printf("%d\n", (int)sizeof($sizetype));
19877     exit(0);
19878 }
19879 EOCP
19880 set try
19881 if eval $compile_ok; then
19882         yyy=`$run ./try`
19883         case "$yyy" in
19884         '')     sizesize=4
19885                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19886                 ;;
19887         *)      sizesize=$yyy
19888                 echo "Your $zzz size is $sizesize bytes."
19889                 ;;
19890         esac
19891 else
19892         sizesize=4
19893         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19894 fi
19895
19896
19897 : check for socklen_t
19898 echo " "
19899 echo "Checking to see if you have socklen_t..." >&4
19900 $cat >try.c <<EOCP
19901 #include <sys/types.h>
19902 #$d_socket HAS_SOCKET
19903 #ifdef HAS_SOCKET
19904 #include <sys/socket.h>
19905 #endif
19906 int main() { socklen_t x = 16; }
19907 EOCP
19908 set try
19909 if eval $compile; then
19910         val="$define"
19911         echo "You have socklen_t."
19912 else
19913         val="$undef"
19914         echo "You do not have socklen_t."
19915         case "$sizetype" in
19916         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19917         esac
19918 fi
19919 $rm -f try try.*
19920 set d_socklen_t
19921 eval $setvar
19922
19923 : see if this is a socks.h system
19924 set socks.h i_socks
19925 eval $inhdr
19926
19927 : check for type of the size argument to socket calls
19928 case "$d_socket" in
19929 "$define")
19930         $cat <<EOM
19931
19932 Checking to see what type is the last argument of accept().
19933 EOM
19934         yyy=''
19935         case "$d_socklen_t" in
19936         "$define") yyy="$yyy socklen_t"
19937         esac
19938         yyy="$yyy $sizetype int long unsigned"
19939         for xxx in $yyy; do
19940                 case "$socksizetype" in
19941                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19942                         case "$usesocks" in
19943                         "$define")
19944                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19945                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19946                                         socksizetype="$xxx"
19947                                 fi
19948                                 ;;
19949                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19950                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19951                                         socksizetype="$xxx"
19952                                 fi
19953                                 ;;
19954                         esac
19955                         ;;
19956                 esac
19957         done
19958 : In case none of those worked, prompt the user.
19959         case "$socksizetype" in
19960         '')     rp='What is the type for socket address structure sizes?'
19961                 dflt='int'
19962                 . ./myread
19963                 socksizetype=$ans
19964                 ;;
19965         esac
19966         ;;
19967 *)      : no sockets, so pick relatively harmless default
19968         socksizetype='int'
19969         ;;
19970 esac
19971
19972 : see what type is used for signed size_t
19973 set ssize_t ssizetype int stdio.h sys/types.h
19974 eval $typedef
19975 dflt="$ssizetype"
19976 $cat > try.c <<EOM
19977 #include <stdio.h>
19978 #$i_stdlib I_STDLIB
19979 #ifdef I_STDLIB
19980 #include <stdlib.h>
19981 #endif
19982 #include <sys/types.h>
19983 #define Size_t $sizetype
19984 #define SSize_t $dflt
19985 int main()
19986 {
19987         if (sizeof(Size_t) == sizeof(SSize_t))
19988                 printf("$dflt\n");
19989         else if (sizeof(Size_t) == sizeof(int))
19990                 printf("int\n");
19991         else 
19992                 printf("long\n");
19993         exit(0);
19994 }
19995 EOM
19996 echo " "
19997 set try
19998 if eval $compile_ok && $run ./try > /dev/null; then
19999         ssizetype=`$run ./try`
20000         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20001 else
20002         $cat >&4 <<EOM
20003 Help! I can't compile and run the ssize_t test program: please enlighten me!
20004 (This is probably a misconfiguration in your system or libraries, and
20005 you really ought to fix it.  Still, I'll try anyway.)
20006
20007 I need a type that is the same size as $sizetype, but is guaranteed to
20008 be signed.  Common values are ssize_t, int and long.
20009
20010 EOM
20011         rp="What signed type is the same size as $sizetype?"
20012         . ./myread
20013         ssizetype="$ans"
20014 fi
20015 $rm -f try try.*
20016
20017 : see what type of char stdio uses.
20018 echo " "
20019 echo '#include <stdio.h>' > stdio.c
20020 $cppstdin $cppminus < stdio.c > stdioh
20021 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20022         echo "Your stdio uses unsigned chars." >&4
20023         stdchar="unsigned char"
20024 else
20025         echo "Your stdio uses signed chars." >&4
20026         stdchar="char"
20027 fi
20028 $rm -f stdio.* stdioh
20029
20030 : see what type uids are declared as in the kernel
20031 echo " "
20032 echo "Looking for the type for user ids returned by getuid()."
20033 set uid_t uidtype xxx stdio.h sys/types.h
20034 eval $typedef
20035 case "$uidtype" in
20036 xxx)
20037         xxx=`./findhdr sys/user.h`
20038         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20039         case $1 in
20040         unsigned) dflt="$1 $2" ;;
20041         *) dflt="$1" ;;
20042         esac
20043         ;;
20044 *) dflt="$uidtype";;
20045 esac
20046 case "$uidtype" in
20047 uid_t)  echo "uid_t found." ;;
20048 *)      rp="What is the type for user ids returned by getuid()?"
20049         . ./myread
20050         uidtype="$ans"
20051         ;;
20052 esac
20053
20054 echo " "
20055 case "$uidtype" in
20056 *_t) zzz="$uidtype"     ;;
20057 *)   zzz="uid"          ;;
20058 esac
20059 echo "Checking the size of $zzz..." >&4 
20060 cat > try.c <<EOCP
20061 #include <sys/types.h>
20062 #include <stdio.h>
20063 #$i_stdlib I_STDLIB
20064 #ifdef I_STDLIB
20065 #include <stdlib.h>
20066 #endif
20067 int main() {
20068     printf("%d\n", (int)sizeof($uidtype));
20069     exit(0);
20070 }
20071 EOCP
20072 set try
20073 if eval $compile_ok; then
20074         yyy=`$run ./try`
20075         case "$yyy" in
20076         '')     uidsize=4
20077                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20078                 ;;
20079         *)      uidsize=$yyy
20080                 echo "Your $zzz is $uidsize bytes long."
20081                 ;;
20082         esac
20083 else
20084         uidsize=4
20085         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20086 fi
20087
20088 echo " "
20089 case "$uidtype" in
20090 *_t) zzz="$uidtype"     ;;
20091 *)   zzz="uid"          ;;
20092 esac
20093 echo "Checking the sign of $zzz..." >&4
20094 cat > try.c <<EOCP
20095 #include <sys/types.h>
20096 #include <stdio.h>
20097 int main() {
20098         $uidtype foo = -1;
20099         if (foo < 0)
20100                 printf("-1\n");
20101         else
20102                 printf("1\n");
20103 }
20104 EOCP
20105 set try
20106 if eval $compile; then
20107         yyy=`$run ./try`
20108         case "$yyy" in
20109         '')     uidsign=1
20110                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20111                 ;;
20112         *)      uidsign=$yyy
20113                 case "$uidsign" in
20114                  1) echo "Your $zzz is unsigned." ;;
20115                 -1) echo "Your $zzz is signed."   ;;
20116                 esac
20117                 ;;
20118         esac
20119 else
20120         uidsign=1
20121         echo "(I can't compile the test program--guessing unsigned.)" >&4
20122 fi
20123
20124
20125
20126 echo " "
20127 $echo "Checking the format string to be used for uids..." >&4
20128
20129 case "$uidsign" in
20130 -1)     if $test X"$uidsize" = X"$ivsize"; then
20131                 uidformat="$ivdformat"
20132         else
20133                 if $test X"$uidsize" = X"$longsize"; then
20134                         uidformat='"ld"'
20135                 else
20136                         if $test X"$uidsize" = X"$intsize"; then
20137                                 uidformat='"d"'
20138                         else
20139                                 if $test X"$uidsize" = X"$shortsize"; then
20140                                         uidformat='"hd"'
20141                                 fi
20142                         fi
20143                 fi
20144         fi
20145         ;;
20146 *)      if $test X"$uidsize" = X"$uvsize"; then
20147                 uidformat="$uvuformat"
20148         else
20149                 if $test X"$uidsize" = X"$longsize"; then
20150                         uidformat='"lu"'
20151                 else
20152                         if $test X"$uidsize" = X"$intsize"; then
20153                                 uidformat='"u"'
20154                         else
20155                                 if $test X"$uidsize" = X"$shortsize"; then
20156                                         uidformat='"hu"'
20157                                 fi
20158                         fi
20159                 fi
20160         fi
20161         ;;
20162 esac
20163
20164
20165 case "$usesitecustomize" in
20166     $define|true|[Yy]*)
20167         usesitecustomize="$define"
20168         ;;
20169     *)
20170         usesitecustomize="$undef"
20171         ;;
20172     esac
20173
20174 : determine compiler compiler
20175 case "$yacc" in
20176 '')
20177         dflt=yacc;;
20178 *)
20179         dflt="$yacc";;
20180 esac
20181 echo " "
20182 comp='yacc'
20183 if $test -f "$byacc$_exe"; then
20184         dflt="$byacc"
20185         comp="byacc or $comp"
20186 fi
20187 if $test -f "$bison$_exe"; then
20188         comp="$comp or bison -y"
20189 fi
20190 rp="Which compiler compiler ($comp) shall I use?"
20191 . ./myread
20192 yacc="$ans"
20193 case "$yacc" in
20194 *bis*)
20195         case "$yacc" in
20196         *-y*) ;;
20197         *)
20198                 yacc="$yacc -y"
20199                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20200                 ;;
20201         esac
20202         ;;
20203 esac
20204
20205 : see if this is a fp.h system
20206 set fp.h i_fp
20207 eval $inhdr
20208
20209 : see if this is a fp_class.h system
20210 set fp_class.h i_fp_class
20211 eval $inhdr
20212
20213 : see if this is a ieeefp.h system
20214 case "$i_ieeefp" in
20215 '' ) set ieeefp.h i_ieeefp
20216      eval $inhdr
20217      ;;
20218 esac
20219
20220 : see if this is a libutil.h system
20221 set libutil.h i_libutil
20222 eval $inhdr
20223
20224 : see if mach cthreads are available
20225 if test "X$usethreads" = "X$define"; then
20226         set mach/cthreads.h i_machcthr
20227         eval $inhdr
20228 else
20229         i_machcthr="$undef"
20230 fi
20231
20232
20233
20234 : see if this is a mntent.h system
20235 set mntent.h i_mntent
20236 eval $inhdr
20237
20238 : see if ndbm.h is available
20239 set ndbm.h t_ndbm
20240 eval $inhdr
20241
20242 case "$t_ndbm" in
20243 $undef)
20244     # Some Linux distributions such as RedHat 7.1 put the
20245     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20246     if $test -f /usr/include/gdbm/ndbm.h; then
20247         echo '<gdbm/ndbm.h> found.'
20248         ccflags="$ccflags -I/usr/include/gdbm"
20249         cppflags="$cppflags -I/usr/include/gdbm"
20250         t_ndbm=$define
20251     fi
20252     ;;
20253 esac
20254
20255 case "$t_ndbm" in
20256 $define)
20257         : see if dbm_open exists
20258         set dbm_open d_dbm_open
20259         eval $inlibc
20260         case "$d_dbm_open" in
20261         $undef)
20262                 t_ndbm="$undef"
20263                 echo "We won't be including <ndbm.h>"
20264                 ;;
20265         esac
20266         ;;
20267 esac
20268 val="$t_ndbm"
20269 set i_ndbm
20270 eval $setvar
20271
20272 : see if net/errno.h is available
20273 val=''
20274 set net/errno.h val
20275 eval $inhdr
20276
20277 : Unfortunately, it causes problems on some systems.  Arrgh.
20278 case "$val" in
20279 $define)
20280         cat > try.c <<'EOM'
20281 #include <stdio.h>
20282 #include <errno.h>
20283 #include <net/errno.h>
20284 int func()
20285 {
20286         return ENOTSOCK;
20287 }
20288 EOM
20289         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20290                 echo "We'll be including <net/errno.h>." >&4
20291         else
20292                 echo "We won't be including <net/errno.h>." >&4
20293                 val="$undef"
20294         fi
20295         $rm -f try.* try
20296         ;;
20297 esac
20298 set i_neterrno
20299 eval $setvar
20300
20301 : see if netinet/tcp.h is available
20302 set netinet/tcp.h i_netinettcp
20303 eval $inhdr
20304
20305 : see if this is a poll.h system
20306 set poll.h i_poll
20307 eval $inhdr
20308
20309 : see if this is a prot.h system
20310 set prot.h i_prot
20311 eval $inhdr
20312
20313 echo " "
20314 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20315 $cat <<'EOSH' > Cppsym.know
20316 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20317 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20318 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20319 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20320 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20321 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20322 bull c cadmus clipper CMU COFF COMPILER_VERSION
20323 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20324 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20325 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20326 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20327 GLIBC GLIBC_MINOR
20328 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20329 H3050R H3050RX hbullx20 hcx host_mips
20330 hp200 hp300 hp700 HP700 hp800 hp9000
20331 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20332 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20333 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20334 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20335 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20336 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20337 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20338 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20339 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20340 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20341 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20342 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20343 MATH_HAS_NO_SIDE_EFFECTS
20344 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20345 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20346 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20347 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20348 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20349 NetBSD news1500 news1700 news1800 news1900 news3700
20350 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20351 ns32016 ns32332 ns32k nsc32000
20352 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20353 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20354 pc532 pdp11 PGC PIC plexus PORTAR posix
20355 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20356 POSIX_C_SOURCE POSIX_SOURCE POWER
20357 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20358 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20359 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20360 sony sony_news sonyrisc sparc sparclite spectrum
20361 stardent stdc STDC_EXT stratos sun sun3 sun386
20362 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20363 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20364 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20365 sysV68 sysV88 Tek4132 Tek4300 titan
20366 TM3200 TM5400 TM5600
20367 tower tower32 tower32_200 tower32_600 tower32_700
20368 tower32_800 tower32_850 tss
20369 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20370 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20371 unix UNIX95 UNIX99 unixpc unos
20372 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20373 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20374 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20375 USGr4 USGr4_2
20376 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20377 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20378 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20379 z8000
20380 EOSH
20381 # Maybe put other stuff here too.
20382 cat <<EOSH >>Cppsym.know
20383 $osname
20384 EOSH
20385 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20386 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20387 $cat Cppsym.know > Cppsym.c
20388 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20389 $rm -f Cppsym.a Cppsym.b Cppsym.c
20390 cat <<EOSH > Cppsym
20391 $startsh
20392 if $test \$# -gt 0; then
20393     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20394     if $test -s Cppsym.got; then
20395         $rm -f Cppsym.got
20396         exit 0
20397     fi
20398     $rm -f Cppsym.got
20399     exit 1
20400 else
20401     $tr " " "$trnl" | ./Cppsym.try
20402     exit 0
20403 fi
20404 EOSH
20405 chmod +x Cppsym
20406 $eunicefix Cppsym
20407 cat <<EOSH > Cppsym.try
20408 $startsh
20409 cat <<'EOCP' > try.c
20410 #include <stdio.h>
20411 #if cpp_stuff == 1
20412 #define STRINGIFY(a)    "a"
20413 #endif
20414 #if cpp_stuff == 42
20415 #define StGiFy(a)  #a
20416 #define STRINGIFY(a)    StGiFy(a)
20417 #endif
20418 #if $cpp_stuff != 1 && $cpp_stuff != 42
20419 #   include "Bletch: How does this C preprocessor stringify macros?"
20420 #endif
20421 int main() {
20422 EOCP
20423 $awk \\
20424 EOSH
20425 cat <<'EOSH' >> Cppsym.try
20426 'length($1) > 0 {
20427     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20428     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20429     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20430     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20431 }'       >> try.c
20432 echo 'return 0;}' >> try.c
20433 EOSH
20434 cat <<EOSH >> Cppsym.try
20435 ccflags="$ccflags"
20436 case "$osname-$gccversion" in
20437 irix-) ccflags="\$ccflags -woff 1178" ;;
20438 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20439 esac
20440 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20441 EOSH
20442 chmod +x Cppsym.try
20443 $eunicefix Cppsym.try
20444 ./Cppsym < Cppsym.know > Cppsym.true
20445 : Add in any linux cpp "predefined macros":
20446 case "$osname::$gccversion" in
20447   *linux*::*.*)
20448     tHdrH=_tmpHdr
20449     rm -f $tHdrH'.h' $tHdrH
20450     touch $tHdrH'.h'
20451     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20452        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20453        if [ -s $tHdrH'_cppsym.real' ]; then
20454           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20455        fi
20456     fi
20457     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20458   ;;
20459 esac
20460 : now check the C compiler for additional symbols
20461 postprocess_cc_v=''
20462 case "$osname" in
20463 aix) postprocess_cc_v="|$tr , ' '" ;;
20464 esac
20465 $cat >ccsym <<EOS
20466 $startsh
20467 $cat >tmp.c <<EOF
20468 extern int foo;
20469 EOF
20470 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20471 do
20472         case "\$i" in
20473         -D*) echo "\$i" | $sed 's/^-D//';;
20474         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20475         esac
20476 done
20477 $rm -f try.c
20478 EOS
20479 postprocess_cc_v=''
20480 chmod +x ccsym
20481 $eunicefix ccsym
20482 ./ccsym > ccsym1.raw
20483 if $test -s ccsym1.raw; then
20484        $sort ccsym1.raw | $uniq >ccsym.raw
20485 else
20486        mv ccsym1.raw ccsym.raw
20487 fi
20488
20489 $awk '/\=/ { print $0; next }
20490         { print $0"=1" }' ccsym.raw >ccsym.list
20491 $comm -13 Cppsym.true ccsym.list >ccsym.own
20492 $comm -12 Cppsym.true ccsym.list >ccsym.com
20493 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20494 also=''
20495 if $test -z ccsym.raw; then
20496         echo "Your C compiler doesn't seem to define any symbols!" >&4
20497         echo " "
20498         echo "However, your C preprocessor defines the following symbols:"
20499         $cat Cppsym.true
20500         ccsymbols=''
20501         cppsymbols=`$cat Cppsym.true`
20502         cppsymbols=`echo $cppsymbols`
20503         cppccsymbols="$cppsymbols"
20504 else
20505         if $test -s ccsym.com; then
20506                 echo "Your C compiler and pre-processor define these symbols:"
20507                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20508                 also='also '
20509                 symbols='ones'
20510                 cppccsymbols=`$cat ccsym.com`
20511                 cppccsymbols=`echo $cppccsymbols`
20512                 $test "$silent" || sleep 1
20513         fi
20514         if $test -s ccsym.cpp; then
20515                 $test "$also" && echo " "
20516                 echo "Your C pre-processor ${also}defines the following symbols:"
20517                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20518                 also='further '
20519                 cppsymbols=`$cat ccsym.cpp`
20520                 cppsymbols=`echo $cppsymbols`
20521                 $test "$silent" || sleep 1
20522         fi
20523         if $test -s ccsym.own; then
20524                 $test "$also" && echo " "
20525                 echo "Your C compiler ${also}defines the following cpp symbols:"
20526                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20527                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20528                 ccsymbols=`$cat ccsym.own`
20529                 ccsymbols=`echo $ccsymbols`
20530                 $test "$silent" || sleep 1
20531         fi
20532 fi
20533
20534 : see if this is a termio system
20535 val="$undef"
20536 val2="$undef"
20537 val3="$undef"
20538 if $test `./findhdr termios.h`; then
20539         set tcsetattr i_termios
20540         eval $inlibc
20541         val3="$i_termios"
20542 fi
20543 echo " "
20544 case "$val3" in
20545 "$define") echo "You have POSIX termios.h... good!" >&4;;
20546 *) if ./Cppsym pyr; then
20547                 case "`/bin/universe`" in
20548                 ucb) if $test `./findhdr sgtty.h`; then
20549                                 val2="$define"
20550                                 echo "<sgtty.h> found." >&4
20551                         else
20552                                 echo "System is pyramid with BSD universe."
20553                                 echo "<sgtty.h> not found--you could have problems." >&4
20554                         fi;;
20555                 *) if $test `./findhdr termio.h`; then
20556                                 val="$define"
20557                                 echo "<termio.h> found." >&4
20558                         else
20559                                 echo "System is pyramid with USG universe."
20560                                 echo "<termio.h> not found--you could have problems." >&4
20561                         fi;;
20562                 esac
20563         elif ./usg; then
20564                 if $test `./findhdr termio.h`; then
20565                         echo "<termio.h> found." >&4
20566                         val="$define"
20567                 elif $test `./findhdr sgtty.h`; then
20568                         echo "<sgtty.h> found." >&4
20569                         val2="$define"
20570                 else
20571 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20572                 fi
20573         else
20574                 if $test `./findhdr sgtty.h`; then
20575                         echo "<sgtty.h> found." >&4
20576                         val2="$define"
20577                 elif $test `./findhdr termio.h`; then
20578                         echo "<termio.h> found." >&4
20579                         val="$define"
20580                 else
20581 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20582                 fi
20583         fi;;
20584 esac
20585 set i_termio; eval $setvar
20586 val=$val2; set i_sgtty; eval $setvar
20587 val=$val3; set i_termios; eval $setvar
20588
20589 : see if stddef is available
20590 set stddef.h i_stddef
20591 eval $inhdr
20592
20593 : see if this is a sunmath.h system
20594 set sunmath.h i_sunmath
20595 eval $inhdr
20596
20597 : see if sys/access.h is available
20598 set sys/access.h i_sysaccess
20599 eval $inhdr
20600
20601 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20602 set sys/filio.h i_sysfilio
20603 eval $inhdr
20604 echo " "
20605 if $test `./findhdr sys/ioctl.h`; then
20606         val="$define"
20607         echo '<sys/ioctl.h> found.' >&4
20608 else
20609         val="$undef"
20610         if $test $i_sysfilio = "$define"; then
20611             echo '<sys/ioctl.h> NOT found.' >&4
20612         else
20613                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20614                 $test $i_termio = "$define" && xxx="termio.h"
20615                 $test $i_termios = "$define" && xxx="termios.h"
20616 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20617         fi
20618 fi
20619 set i_sysioctl
20620 eval $setvar
20621
20622 : see if socket ioctl defs are in sys/sockio.h
20623 echo " "
20624 xxx=`./findhdr sys/sockio.h`
20625 if $test "$xxx"; then
20626         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20627                 val="$define"
20628                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20629         else
20630                 val="$undef"
20631                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20632         fi
20633 else
20634         val="$undef"
20635         $cat <<EOM
20636 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20637 EOM
20638 fi
20639 set i_syssockio
20640 eval $setvar
20641
20642
20643 : see if this is a syslog.h system
20644 set syslog.h i_syslog
20645 eval $inhdr
20646
20647
20648 : see if this is a sys/mode.h system
20649 set sys/mode.h i_sysmode
20650 eval $inhdr
20651
20652 : see if sys/resource.h has to be included
20653 set sys/resource.h i_sysresrc
20654 eval $inhdr
20655
20656 : see if sys/security.h is available
20657 set sys/security.h i_syssecrt
20658 eval $inhdr
20659
20660 : see if this is a sys/statvfs.h system
20661 set sys/statvfs.h i_sysstatvfs
20662 eval $inhdr
20663
20664 : see if this is a sys/un.h system
20665 set sys/un.h i_sysun
20666 eval $inhdr
20667
20668
20669 : see if this is a sys/utsname.h system
20670 set sys/utsname.h i_sysutsname
20671 eval $inhdr
20672
20673 : see if this is a syswait system
20674 set sys/wait.h i_syswait
20675 eval $inhdr
20676
20677 : see if this is a ustat.h system
20678 set ustat.h i_ustat
20679 eval $inhdr
20680
20681 : see if this is an utime system
20682 set utime.h i_utime
20683 eval $inhdr
20684
20685 : see if this is a values.h system
20686 set values.h i_values
20687 eval $inhdr
20688
20689 : see if this is a vfork system
20690 case "$d_vfork" in
20691 "$define")
20692         set vfork.h i_vfork
20693         eval $inhdr
20694         ;;
20695 *)
20696         i_vfork="$undef"
20697         ;;
20698 esac
20699
20700 : see if gdbm.h is available
20701 set gdbm.h t_gdbm
20702 eval $inhdr
20703 case "$t_gdbm" in
20704 $define)
20705         : see if gdbm_open exists
20706         set gdbm_open d_gdbm_open
20707         eval $inlibc
20708         case "$d_gdbm_open" in
20709         $undef)
20710                 t_gdbm="$undef"
20711                 echo "We won't be including <gdbm.h>"
20712                 ;;
20713         esac
20714         ;;
20715 esac
20716 val="$t_gdbm"
20717 set i_gdbm
20718 eval $setvar
20719
20720 echo " "
20721 echo "Looking for extensions..." >&4
20722 : If we are using the old config.sh, known_extensions may contain
20723 : old or inaccurate or duplicate values.
20724 known_extensions=''
20725 nonxs_extensions=''
20726 : We do not use find because it might not be available.
20727 : We do not just use MANIFEST because the user may have dropped
20728 : some additional extensions into the source tree and expect them
20729 : to be built.
20730
20731 : Function to recursively find available extensions, ignoring DynaLoader
20732 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20733 find_extensions='
20734     for xxx in *; do
20735        case "$xxx" in
20736            DynaLoader|dynaload) ;;
20737            *)
20738            if $test -f $xxx/$xxx.xs; then
20739                known_extensions="$known_extensions $1$xxx";
20740            elif $test -f $xxx/Makefile.PL; then
20741                nonxs_extensions="$nonxs_extensions $1$xxx";
20742            else
20743                if $test -d $xxx -a $# -lt 10; then
20744                    set $1$xxx/ $*;
20745                    cd "$xxx";
20746                    eval $find_extensions;
20747                    cd ..;
20748                    shift;
20749                fi;
20750            fi
20751            ;;
20752        esac;
20753     done'
20754 tdir=`pwd`
20755 cd "$rsrc/ext"
20756 set X
20757 shift
20758 eval $find_extensions
20759 # Special case:  Add in threads/shared since it is not picked up by the
20760 # recursive find above (and adding in general recursive finding breaks
20761 # SDBM_File/sdbm).  A.D.  10/25/2001.
20762 known_extensions="$known_extensions threads/shared"
20763 set X $nonxs_extensions
20764 shift
20765 nonxs_extensions="$*"
20766 set X $known_extensions
20767 shift
20768 known_extensions="$*"
20769 cd "$tdir"
20770
20771 : Now see which are supported on this system.
20772 avail_ext=''
20773 for xxx in $known_extensions ; do
20774         case "$xxx" in
20775         DB_File|db_file)
20776                 case "$i_db" in
20777                 $define) avail_ext="$avail_ext $xxx" ;;
20778                 esac
20779                 ;;
20780         GDBM_File|gdbm_fil)
20781                 case "$i_gdbm" in 
20782                 $define) avail_ext="$avail_ext $xxx" ;;
20783                 esac
20784                 ;;
20785         I18N/Langinfo|i18n_lan)
20786                 case "$i_langinfo$d_nl_langinfo" in 
20787                 $define$define) avail_ext="$avail_ext $xxx" ;;
20788                 esac
20789                 ;;
20790         NDBM_File|ndbm_fil)
20791                 case "$i_ndbm" in
20792                 $define)
20793                     case "$osname-$use64bitint" in
20794                     hpux-define)
20795                         case "$libs" in
20796                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20797                         esac
20798                         ;;
20799                     *) avail_ext="$avail_ext $xxx" ;;
20800                     esac
20801                     ;;
20802                 esac
20803                 ;;
20804         ODBM_File|odbm_fil) 
20805                 case "${i_dbm}${i_rpcsvcdbm}" in
20806                 *"${define}"*)
20807                     case "$osname-$use64bitint" in
20808                     hpux-define)
20809                         case "$libs" in
20810                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20811                         esac
20812                         ;;
20813                     *) avail_ext="$avail_ext $xxx" ;;
20814                     esac
20815                     ;;
20816                 esac
20817                 ;;
20818         POSIX|posix)
20819                 case "$useposix" in
20820                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20821                 esac
20822                 ;;
20823         Opcode|opcode)
20824                 case "$useopcode" in
20825                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20826                 esac
20827                 ;;
20828         Socket|socket)
20829                 case "$d_socket" in 
20830                 true|$define|y)
20831                     case "$osname" in
20832                     beos) ;; # not unless BONE
20833                     *) avail_ext="$avail_ext $xxx" ;;
20834                     esac
20835                     ;;
20836                 esac
20837                 ;;
20838         Sys/Syslog|sys/syslog)
20839                 : XXX syslog requires socket
20840                 case "$d_socket" in 
20841                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20842                 esac
20843                 ;;
20844         Thread|thread)
20845                 case "$usethreads" in
20846                 true|$define|y)
20847                         case "$useithreads" in
20848                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20849                         esac
20850                 esac
20851                 ;;
20852         XS/APItest|xs/apitest)
20853                 # This is just for testing.  Skip it unless we have dynamic loading.
20854
20855                 case "$usedl" in
20856                 $define) avail_ext="$avail_ext $xxx" ;;
20857                 esac
20858                 ;;
20859         XS/Typemap|xs/typemap)
20860                 # This is just for testing.  Skip it unless we have dynamic loading.
20861                 case "$usedl" in
20862                 $define) avail_ext="$avail_ext $xxx" ;;
20863                 esac
20864                 ;;
20865         threads|threads/shared)
20866                 # threads and threads::shared are special cases.
20867                 # To stop people from asking "Perl 5.8.0 was supposed
20868                 # to have this new fancy threads implementation but my
20869                 # perl doesn't have it" and from people trying to
20870                 # (re)install the threads module using CPAN.pm and
20871                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20872                 # the threads.pm and threads/shared.pm will always be
20873                 # there, croaking informatively ("you need to rebuild
20874                 # all of Perl with threads, sorry") when threads haven't
20875                 # been compiled in.
20876                 # --jhi
20877                 avail_ext="$avail_ext $xxx"
20878                 ;;
20879         IPC/SysV|ipc/sysv)
20880                 : XXX Do we need a useipcsysv variable here
20881                 case "${d_msg}${d_sem}${d_shm}" in 
20882                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20883                 esac
20884                 ;;
20885         *)      avail_ext="$avail_ext $xxx"
20886                 ;;
20887         esac
20888 done
20889
20890 set X $avail_ext
20891 shift
20892 avail_ext="$*"
20893
20894 case "$onlyextensions" in
20895 '') ;;
20896 *)  keepextensions=''
20897     echo "You have requested that only certains extensions be included..." >&4
20898     for i in $onlyextensions; do
20899         case " $avail_ext " in
20900         *" $i "*)
20901             echo "Keeping extension $i."
20902             keepextensions="$keepextensions $i"
20903             ;;
20904         *) echo "Ignoring extension $i." ;;
20905         esac
20906     done
20907     avail_ext="$keepextensions"
20908     ;;
20909 esac
20910
20911 case "$noextensions" in
20912 '') ;;
20913 *)  keepextensions=''
20914     echo "You have requested that certain extensions be ignored..." >&4
20915     for i in $avail_ext; do
20916         case " $noextensions " in
20917         *" $i "*) echo "Ignoring extension $i." ;;
20918         *) echo "Keeping extension $i.";
20919            keepextensions="$keepextensions $i"
20920            ;;
20921         esac
20922     done
20923     avail_ext="$keepextensions"
20924     ;;
20925 esac
20926
20927 : Now see which nonxs extensions are supported on this system.
20928 : For now assume all are.
20929 nonxs_ext=''
20930 for xxx in $nonxs_extensions ; do
20931         case "$xxx" in
20932         *)      nonxs_ext="$nonxs_ext $xxx"
20933                 ;;
20934         esac
20935 done
20936
20937 set X $nonxs_ext
20938 shift
20939 nonxs_ext="$*"
20940
20941 case $usedl in
20942 $define)
20943         $cat <<EOM
20944 A number of extensions are supplied with $package.  You may choose to
20945 compile these extensions for dynamic loading (the default), compile
20946 them into the $package executable (static loading), or not include
20947 them at all.  Answer "none" to include no extensions.
20948 Note that DynaLoader is always built and need not be mentioned here.
20949
20950 EOM
20951         case "$dynamic_ext" in
20952         '')
20953                 : Exclude those listed in static_ext
20954                 dflt=''
20955                 for xxx in $avail_ext; do
20956                         case " $static_ext " in
20957                         *" $xxx "*) ;;
20958                         *) dflt="$dflt $xxx" ;;
20959                         esac
20960                 done
20961                 set X $dflt
20962                 shift
20963                 dflt="$*"
20964                 ;;
20965         *)      dflt="$dynamic_ext"
20966                 # Perhaps we are reusing an old out-of-date config.sh.
20967                 case "$hint" in
20968                 previous)
20969                         if test X"$dynamic_ext" != X"$avail_ext"; then
20970                                 $cat <<EOM
20971 NOTICE:  Your previous config.sh list may be incorrect. 
20972 The extensions now available to you are 
20973         ${avail_ext}
20974 but the default list from your previous config.sh is
20975         ${dynamic_ext} 
20976
20977 EOM
20978                         fi
20979                         ;;
20980                 esac
20981                 ;;
20982         esac
20983         case "$dflt" in
20984         '')     dflt=none;;
20985         esac
20986         rp="What extensions do you wish to load dynamically?"
20987         . ./myread
20988         case "$ans" in
20989         none) dynamic_ext=' ' ;;
20990         *) dynamic_ext="$ans" ;;
20991         esac
20992
20993         case "$static_ext" in
20994         '')
20995                 : Exclude those already listed in dynamic linking
20996                 dflt=''
20997                 for xxx in $avail_ext; do
20998                         case " $dynamic_ext " in
20999                         *" $xxx "*) ;;
21000                         *) dflt="$dflt $xxx" ;;
21001                         esac
21002                 done
21003                 set X $dflt
21004                 shift
21005                 dflt="$*"
21006                 ;;
21007         *)  dflt="$static_ext" 
21008                 ;;
21009         esac
21010
21011         case "$dflt" in
21012         '')     dflt=none;;
21013         esac
21014         rp="What extensions do you wish to load statically?"
21015         . ./myread
21016         case "$ans" in
21017         none) static_ext=' ' ;;
21018         *) static_ext="$ans" ;;
21019         esac
21020         ;;
21021 *)
21022         $cat <<EOM
21023 A number of extensions are supplied with $package.  Answer "none" 
21024 to include no extensions. 
21025 Note that DynaLoader is always built and need not be mentioned here.
21026
21027 EOM
21028         case "$static_ext" in
21029         '') dflt="$avail_ext" ;;
21030         *)      dflt="$static_ext"
21031                 # Perhaps we are reusing an old out-of-date config.sh.
21032                 case "$hint" in
21033                 previous)
21034                         if test X"$static_ext" != X"$avail_ext"; then
21035                                 $cat <<EOM
21036 NOTICE:  Your previous config.sh list may be incorrect. 
21037 The extensions now available to you are 
21038         ${avail_ext}
21039 but the default list from your previous config.sh is
21040         ${static_ext} 
21041
21042 EOM
21043                         fi
21044                         ;;
21045                 esac
21046                 ;;
21047         esac
21048         : Exclude those that are not xs extensions
21049         case "$dflt" in
21050         '')     dflt=none;;
21051         esac
21052         rp="What extensions do you wish to include?"
21053         . ./myread
21054         case "$ans" in
21055         none) static_ext=' ' ;;
21056         *) static_ext="$ans" ;;
21057         esac
21058         ;;
21059 esac
21060 #        
21061 # Encode is a special case.  If we are building Encode as a static
21062 # extension, we need to explicitly list its subextensions as well.
21063 # For other nested extensions, this is handled automatically by
21064 # the appropriate Makefile.PL.
21065 case " $static_ext " in
21066         *" Encode "*) # Add the subextensions of Encode
21067         cd "$rsrc/ext"
21068         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21069                 static_ext="$static_ext Encode/$xxx"
21070         done
21071         cd "$tdir"
21072         ;;
21073 esac
21074
21075 set X $dynamic_ext $static_ext $nonxs_ext
21076 shift
21077 extensions="$*"
21078
21079 # Sanity check:  We require an extension suitable for use with
21080 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21081 # should show up as failures in the test suite, but it's helpful to
21082 # catch them now.) The 'extensions' list is normally sorted
21083 # alphabetically, so we need to accept either
21084 #    DB_File ... Fcntl ... IO  ....
21085 # or something like
21086 #    Fcntl ... NDBM_File ... IO  ....
21087 case " $extensions"  in
21088 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21089 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21090 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21091 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21092    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21093    ;;
21094 esac
21095
21096 : Remove libraries needed only for extensions
21097 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21098 : The exception is SunOS 4.x, which needs them.
21099 case "${osname}X${osvers}" in
21100 sunos*X4*)
21101     perllibs="$libs"
21102     ;;
21103 *) case "$usedl" in
21104     $define|true|[yY]*)
21105             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21106             shift
21107             perllibs="$*"
21108             ;;
21109     *)  perllibs="$libs"
21110             ;;
21111     esac
21112     ;;
21113 esac
21114
21115 : Remove build directory name from cppstdin so it can be used from
21116 : either the present location or the final installed location.
21117 echo " "
21118 : Get out of the UU directory to get correct path name.
21119 cd ..
21120 case "$cppstdin" in
21121 `pwd`/cppstdin)
21122         echo "Stripping down cppstdin path name"
21123         cppstdin=cppstdin
21124         ;;
21125 esac
21126 cd UU
21127
21128 : end of configuration questions
21129 echo " "
21130 echo "End of configuration questions."
21131 echo " "
21132
21133 : back to where it started
21134 if test -d ../UU; then
21135         cd ..
21136 fi
21137
21138 : configuration may be patched via a 'config.arch' file
21139 if $test -f config.arch; then
21140         echo "I see a config.arch file, loading it."
21141         . ./config.arch
21142 fi
21143
21144 : configuration may be patched via a 'config.over' file
21145 if $test -f config.over; then
21146         echo " "
21147         dflt=y
21148         rp='I see a config.over file.  Do you wish to load it?'
21149         . UU/myread
21150         case "$ans" in
21151         n*) echo "OK, I'll ignore it.";;
21152         *)      . ./config.over
21153                 echo "Configuration override changes have been loaded."
21154                 ;;
21155         esac
21156 fi
21157
21158 : in case they want portability, strip down executable paths
21159 case "$d_portable" in
21160 "$define")
21161         echo " "
21162         echo "Stripping down executable paths..." >&4
21163         for file in $loclist $trylist; do
21164                 eval temp=\$$file
21165                 eval $file=`basename $temp`
21166         done
21167         ;;
21168 esac
21169
21170 : create config.sh file
21171 echo " "
21172 echo "Creating config.sh..." >&4
21173 $spitshell <<EOT >config.sh
21174 $startsh
21175 #
21176 # This file was produced by running the Configure script. It holds all the
21177 # definitions figured out by Configure. Should you modify one of these values,
21178 # do not forget to propagate your changes by running "Configure -der". You may
21179 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21180 #
21181
21182 # Package name      : $package
21183 # Source directory  : $src
21184 # Configuration time: $cf_time
21185 # Configured by     : $cf_by
21186 # Target system     : $myuname
21187
21188 Author='$Author'
21189 Date='$Date'
21190 Header='$Header'
21191 Id='$Id'
21192 Locker='$Locker'
21193 Log='$Log'
21194 Mcc='$Mcc'
21195 RCSfile='$RCSfile'
21196 Revision='$Revision'
21197 Source='$Source'
21198 State='$State'
21199 _a='$_a'
21200 _exe='$_exe'
21201 _o='$_o'
21202 afs='$afs'
21203 afsroot='$afsroot'
21204 alignbytes='$alignbytes'
21205 ansi2knr='$ansi2knr'
21206 aphostname='$aphostname'
21207 api_revision='$api_revision'
21208 api_subversion='$api_subversion'
21209 api_version='$api_version'
21210 api_versionstring='$api_versionstring'
21211 ar='$ar'
21212 archlib='$archlib'
21213 archlibexp='$archlibexp'
21214 archname64='$archname64'
21215 archname='$archname'
21216 archobjs='$archobjs'
21217 asctime_r_proto='$asctime_r_proto'
21218 awk='$awk'
21219 baserev='$baserev'
21220 bash='$bash'
21221 bin='$bin'
21222 binexp='$binexp'
21223 bison='$bison'
21224 byacc='$byacc'
21225 byteorder='$byteorder'
21226 c='$c'
21227 castflags='$castflags'
21228 cat='$cat'
21229 cc='$cc'
21230 cccdlflags='$cccdlflags'
21231 ccdlflags='$ccdlflags'
21232 ccflags='$ccflags'
21233 ccflags_uselargefiles='$ccflags_uselargefiles'
21234 ccname='$ccname'
21235 ccsymbols='$ccsymbols'
21236 ccversion='$ccversion'
21237 cf_by='$cf_by'
21238 cf_email='$cf_email'
21239 cf_time='$cf_time'
21240 charsize='$charsize'
21241 chgrp='$chgrp'
21242 chmod='$chmod'
21243 chown='$chown'
21244 clocktype='$clocktype'
21245 comm='$comm'
21246 compress='$compress'
21247 contains='$contains'
21248 cp='$cp'
21249 cpio='$cpio'
21250 cpp='$cpp'
21251 cpp_stuff='$cpp_stuff'
21252 cppccsymbols='$cppccsymbols'
21253 cppflags='$cppflags'
21254 cpplast='$cpplast'
21255 cppminus='$cppminus'
21256 cpprun='$cpprun'
21257 cppstdin='$cppstdin'
21258 cppsymbols='$cppsymbols'
21259 crypt_r_proto='$crypt_r_proto'
21260 cryptlib='$cryptlib'
21261 csh='$csh'
21262 ctermid_r_proto='$ctermid_r_proto'
21263 ctime_r_proto='$ctime_r_proto'
21264 d_Gconvert='$d_Gconvert'
21265 d_PRIEUldbl='$d_PRIEUldbl'
21266 d_PRIFUldbl='$d_PRIFUldbl'
21267 d_PRIGUldbl='$d_PRIGUldbl'
21268 d_PRIXU64='$d_PRIXU64'
21269 d_PRId64='$d_PRId64'
21270 d_PRIeldbl='$d_PRIeldbl'
21271 d_PRIfldbl='$d_PRIfldbl'
21272 d_PRIgldbl='$d_PRIgldbl'
21273 d_PRIi64='$d_PRIi64'
21274 d_PRIo64='$d_PRIo64'
21275 d_PRIu64='$d_PRIu64'
21276 d_PRIx64='$d_PRIx64'
21277 d_SCNfldbl='$d_SCNfldbl'
21278 d__fwalk='$d__fwalk'
21279 d_access='$d_access'
21280 d_accessx='$d_accessx'
21281 d_aintl='$d_aintl'
21282 d_alarm='$d_alarm'
21283 d_archlib='$d_archlib'
21284 d_asctime_r='$d_asctime_r'
21285 d_atolf='$d_atolf'
21286 d_atoll='$d_atoll'
21287 d_attribute_format='$d_attribute_format'
21288 d_attribute_malloc='$d_attribute_malloc'
21289 d_attribute_nonnull='$d_attribute_nonnull'
21290 d_attribute_noreturn='$d_attribute_noreturn'
21291 d_attribute_pure='$d_attribute_pure'
21292 d_attribute_unused='$d_attribute_unused'
21293 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21294 d_bcmp='$d_bcmp'
21295 d_bcopy='$d_bcopy'
21296 d_bsd='$d_bsd'
21297 d_bsdgetpgrp='$d_bsdgetpgrp'
21298 d_bsdsetpgrp='$d_bsdsetpgrp'
21299 d_builtin_choose_expr='$d_builtin_choose_expr'
21300 d_builtin_expect='$d_builtin_expect'
21301 d_bzero='$d_bzero'
21302 d_casti32='$d_casti32'
21303 d_castneg='$d_castneg'
21304 d_charvspr='$d_charvspr'
21305 d_chown='$d_chown'
21306 d_chroot='$d_chroot'
21307 d_chsize='$d_chsize'
21308 d_class='$d_class'
21309 d_clearenv='$d_clearenv'
21310 d_closedir='$d_closedir'
21311 d_cmsghdr_s='$d_cmsghdr_s'
21312 d_const='$d_const'
21313 d_copysignl='$d_copysignl'
21314 d_crypt='$d_crypt'
21315 d_crypt_r='$d_crypt_r'
21316 d_csh='$d_csh'
21317 d_ctermid_r='$d_ctermid_r'
21318 d_ctime_r='$d_ctime_r'
21319 d_cuserid='$d_cuserid'
21320 d_c99_variadic_macros='$d_c99_variadic_macros'
21321 d_dbl_dig='$d_dbl_dig'
21322 d_dbminitproto='$d_dbminitproto'
21323 d_difftime='$d_difftime'
21324 d_dirfd='$d_dirfd'
21325 d_dirnamlen='$d_dirnamlen'
21326 d_dlerror='$d_dlerror'
21327 d_dlopen='$d_dlopen'
21328 d_dlsymun='$d_dlsymun'
21329 d_dosuid='$d_dosuid'
21330 d_drand48_r='$d_drand48_r'
21331 d_drand48proto='$d_drand48proto'
21332 d_dup2='$d_dup2'
21333 d_eaccess='$d_eaccess'
21334 d_endgrent='$d_endgrent'
21335 d_endgrent_r='$d_endgrent_r'
21336 d_endhent='$d_endhent'
21337 d_endhostent_r='$d_endhostent_r'
21338 d_endnent='$d_endnent'
21339 d_endnetent_r='$d_endnetent_r'
21340 d_endpent='$d_endpent'
21341 d_endprotoent_r='$d_endprotoent_r'
21342 d_endpwent='$d_endpwent'
21343 d_endpwent_r='$d_endpwent_r'
21344 d_endsent='$d_endsent'
21345 d_endservent_r='$d_endservent_r'
21346 d_eofnblk='$d_eofnblk'
21347 d_eunice='$d_eunice'
21348 d_faststdio='$d_faststdio'
21349 d_fchdir='$d_fchdir'
21350 d_fchmod='$d_fchmod'
21351 d_fchown='$d_fchown'
21352 d_fcntl='$d_fcntl'
21353 d_fcntl_can_lock='$d_fcntl_can_lock'
21354 d_fd_macros='$d_fd_macros'
21355 d_fd_set='$d_fd_set'
21356 d_fds_bits='$d_fds_bits'
21357 d_fgetpos='$d_fgetpos'
21358 d_finite='$d_finite'
21359 d_finitel='$d_finitel'
21360 d_flexfnam='$d_flexfnam'
21361 d_flock='$d_flock'
21362 d_flockproto='$d_flockproto'
21363 d_fork='$d_fork'
21364 d_fp_class='$d_fp_class'
21365 d_fpathconf='$d_fpathconf'
21366 d_fpclass='$d_fpclass'
21367 d_fpclassify='$d_fpclassify'
21368 d_fpclassl='$d_fpclassl'
21369 d_fpos64_t='$d_fpos64_t'
21370 d_frexpl='$d_frexpl'
21371 d_fs_data_s='$d_fs_data_s'
21372 d_fseeko='$d_fseeko'
21373 d_fsetpos='$d_fsetpos'
21374 d_fstatfs='$d_fstatfs'
21375 d_fstatvfs='$d_fstatvfs'
21376 d_fsync='$d_fsync'
21377 d_ftello='$d_ftello'
21378 d_ftime='$d_ftime'
21379 d_futimes='$d_futimes'
21380 d_getcwd='$d_getcwd'
21381 d_getespwnam='$d_getespwnam'
21382 d_getfsstat='$d_getfsstat'
21383 d_getgrent='$d_getgrent'
21384 d_getgrent_r='$d_getgrent_r'
21385 d_getgrgid_r='$d_getgrgid_r'
21386 d_getgrnam_r='$d_getgrnam_r'
21387 d_getgrps='$d_getgrps'
21388 d_gethbyaddr='$d_gethbyaddr'
21389 d_gethbyname='$d_gethbyname'
21390 d_gethent='$d_gethent'
21391 d_gethname='$d_gethname'
21392 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21393 d_gethostbyname_r='$d_gethostbyname_r'
21394 d_gethostent_r='$d_gethostent_r'
21395 d_gethostprotos='$d_gethostprotos'
21396 d_getitimer='$d_getitimer'
21397 d_getlogin='$d_getlogin'
21398 d_getlogin_r='$d_getlogin_r'
21399 d_getmnt='$d_getmnt'
21400 d_getmntent='$d_getmntent'
21401 d_getnbyaddr='$d_getnbyaddr'
21402 d_getnbyname='$d_getnbyname'
21403 d_getnent='$d_getnent'
21404 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21405 d_getnetbyname_r='$d_getnetbyname_r'
21406 d_getnetent_r='$d_getnetent_r'
21407 d_getnetprotos='$d_getnetprotos'
21408 d_getpagsz='$d_getpagsz'
21409 d_getpbyname='$d_getpbyname'
21410 d_getpbynumber='$d_getpbynumber'
21411 d_getpent='$d_getpent'
21412 d_getpgid='$d_getpgid'
21413 d_getpgrp2='$d_getpgrp2'
21414 d_getpgrp='$d_getpgrp'
21415 d_getppid='$d_getppid'
21416 d_getprior='$d_getprior'
21417 d_getprotobyname_r='$d_getprotobyname_r'
21418 d_getprotobynumber_r='$d_getprotobynumber_r'
21419 d_getprotoent_r='$d_getprotoent_r'
21420 d_getprotoprotos='$d_getprotoprotos'
21421 d_getprpwnam='$d_getprpwnam'
21422 d_getpwent='$d_getpwent'
21423 d_getpwent_r='$d_getpwent_r'
21424 d_getpwnam_r='$d_getpwnam_r'
21425 d_getpwuid_r='$d_getpwuid_r'
21426 d_getsbyname='$d_getsbyname'
21427 d_getsbyport='$d_getsbyport'
21428 d_getsent='$d_getsent'
21429 d_getservbyname_r='$d_getservbyname_r'
21430 d_getservbyport_r='$d_getservbyport_r'
21431 d_getservent_r='$d_getservent_r'
21432 d_getservprotos='$d_getservprotos'
21433 d_getspnam='$d_getspnam'
21434 d_getspnam_r='$d_getspnam_r'
21435 d_gettimeod='$d_gettimeod'
21436 d_gmtime_r='$d_gmtime_r'
21437 d_gnulibc='$d_gnulibc'
21438 d_grpasswd='$d_grpasswd'
21439 d_hasmntopt='$d_hasmntopt'
21440 d_htonl='$d_htonl'
21441 d_ilogbl='$d_ilogbl'
21442 d_inc_version_list='$d_inc_version_list'
21443 d_index='$d_index'
21444 d_inetaton='$d_inetaton'
21445 d_int64_t='$d_int64_t'
21446 d_isascii='$d_isascii'
21447 d_isfinite='$d_isfinite'
21448 d_isinf='$d_isinf'
21449 d_isnan='$d_isnan'
21450 d_isnanl='$d_isnanl'
21451 d_killpg='$d_killpg'
21452 d_lchown='$d_lchown'
21453 d_ldbl_dig='$d_ldbl_dig'
21454 d_libm_lib_version='$d_libm_lib_version'
21455 d_link='$d_link'
21456 d_localtime_r='$d_localtime_r'
21457 d_locconv='$d_locconv'
21458 d_lockf='$d_lockf'
21459 d_longdbl='$d_longdbl'
21460 d_longlong='$d_longlong'
21461 d_lseekproto='$d_lseekproto'
21462 d_lstat='$d_lstat'
21463 d_madvise='$d_madvise'
21464 d_malloc_good_size='$d_malloc_good_size'
21465 d_malloc_size='$d_malloc_size'
21466 d_mblen='$d_mblen'
21467 d_mbstowcs='$d_mbstowcs'
21468 d_mbtowc='$d_mbtowc'
21469 d_memchr='$d_memchr'
21470 d_memcmp='$d_memcmp'
21471 d_memcpy='$d_memcpy'
21472 d_memmove='$d_memmove'
21473 d_memset='$d_memset'
21474 d_mkdir='$d_mkdir'
21475 d_mkdtemp='$d_mkdtemp'
21476 d_mkfifo='$d_mkfifo'
21477 d_mkstemp='$d_mkstemp'
21478 d_mkstemps='$d_mkstemps'
21479 d_mktime='$d_mktime'
21480 d_mmap='$d_mmap'
21481 d_modfl='$d_modfl'
21482 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21483 d_modflproto='$d_modflproto'
21484 d_mprotect='$d_mprotect'
21485 d_msg='$d_msg'
21486 d_msg_ctrunc='$d_msg_ctrunc'
21487 d_msg_dontroute='$d_msg_dontroute'
21488 d_msg_oob='$d_msg_oob'
21489 d_msg_peek='$d_msg_peek'
21490 d_msg_proxy='$d_msg_proxy'
21491 d_msgctl='$d_msgctl'
21492 d_msgget='$d_msgget'
21493 d_msghdr_s='$d_msghdr_s'
21494 d_msgrcv='$d_msgrcv'
21495 d_msgsnd='$d_msgsnd'
21496 d_msync='$d_msync'
21497 d_munmap='$d_munmap'
21498 d_mymalloc='$d_mymalloc'
21499 d_nice='$d_nice'
21500 d_nl_langinfo='$d_nl_langinfo'
21501 d_nv_preserves_uv='$d_nv_preserves_uv'
21502 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21503 d_off64_t='$d_off64_t'
21504 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21505 d_oldpthreads='$d_oldpthreads'
21506 d_oldsock='$d_oldsock'
21507 d_open3='$d_open3'
21508 d_pathconf='$d_pathconf'
21509 d_pause='$d_pause'
21510 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21511 d_phostname='$d_phostname'
21512 d_pipe='$d_pipe'
21513 d_poll='$d_poll'
21514 d_portable='$d_portable'
21515 d_procselfexe='$d_procselfexe'
21516 d_pthread_atfork='$d_pthread_atfork'
21517 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21518 d_pthread_yield='$d_pthread_yield'
21519 d_pwage='$d_pwage'
21520 d_pwchange='$d_pwchange'
21521 d_pwclass='$d_pwclass'
21522 d_pwcomment='$d_pwcomment'
21523 d_pwexpire='$d_pwexpire'
21524 d_pwgecos='$d_pwgecos'
21525 d_pwpasswd='$d_pwpasswd'
21526 d_pwquota='$d_pwquota'
21527 d_qgcvt='$d_qgcvt'
21528 d_quad='$d_quad'
21529 d_random_r='$d_random_r'
21530 d_readdir64_r='$d_readdir64_r'
21531 d_readdir='$d_readdir'
21532 d_readdir_r='$d_readdir_r'
21533 d_readlink='$d_readlink'
21534 d_readv='$d_readv'
21535 d_recvmsg='$d_recvmsg'
21536 d_rename='$d_rename'
21537 d_rewinddir='$d_rewinddir'
21538 d_rmdir='$d_rmdir'
21539 d_safebcpy='$d_safebcpy'
21540 d_safemcpy='$d_safemcpy'
21541 d_sanemcmp='$d_sanemcmp'
21542 d_sbrkproto='$d_sbrkproto'
21543 d_scalbnl='$d_scalbnl'
21544 d_sched_yield='$d_sched_yield'
21545 d_scm_rights='$d_scm_rights'
21546 d_seekdir='$d_seekdir'
21547 d_select='$d_select'
21548 d_sem='$d_sem'
21549 d_semctl='$d_semctl'
21550 d_semctl_semid_ds='$d_semctl_semid_ds'
21551 d_semctl_semun='$d_semctl_semun'
21552 d_semget='$d_semget'
21553 d_semop='$d_semop'
21554 d_sendmsg='$d_sendmsg'
21555 d_setegid='$d_setegid'
21556 d_seteuid='$d_seteuid'
21557 d_setgrent='$d_setgrent'
21558 d_setgrent_r='$d_setgrent_r'
21559 d_setgrps='$d_setgrps'
21560 d_sethent='$d_sethent'
21561 d_sethostent_r='$d_sethostent_r'
21562 d_setitimer='$d_setitimer'
21563 d_setlinebuf='$d_setlinebuf'
21564 d_setlocale='$d_setlocale'
21565 d_setlocale_r='$d_setlocale_r'
21566 d_setnent='$d_setnent'
21567 d_setnetent_r='$d_setnetent_r'
21568 d_setpent='$d_setpent'
21569 d_setpgid='$d_setpgid'
21570 d_setpgrp2='$d_setpgrp2'
21571 d_setpgrp='$d_setpgrp'
21572 d_setprior='$d_setprior'
21573 d_setproctitle='$d_setproctitle'
21574 d_setprotoent_r='$d_setprotoent_r'
21575 d_setpwent='$d_setpwent'
21576 d_setpwent_r='$d_setpwent_r'
21577 d_setregid='$d_setregid'
21578 d_setresgid='$d_setresgid'
21579 d_setresuid='$d_setresuid'
21580 d_setreuid='$d_setreuid'
21581 d_setrgid='$d_setrgid'
21582 d_setruid='$d_setruid'
21583 d_setsent='$d_setsent'
21584 d_setservent_r='$d_setservent_r'
21585 d_setsid='$d_setsid'
21586 d_setvbuf='$d_setvbuf'
21587 d_sfio='$d_sfio'
21588 d_shm='$d_shm'
21589 d_shmat='$d_shmat'
21590 d_shmatprototype='$d_shmatprototype'
21591 d_shmctl='$d_shmctl'
21592 d_shmdt='$d_shmdt'
21593 d_shmget='$d_shmget'
21594 d_sigaction='$d_sigaction'
21595 d_sigprocmask='$d_sigprocmask'
21596 d_sigsetjmp='$d_sigsetjmp'
21597 d_sitearch='$d_sitearch'
21598 d_snprintf='$d_snprintf'
21599 d_sockatmark='$d_sockatmark'
21600 d_sockatmarkproto='$d_sockatmarkproto'
21601 d_socket='$d_socket'
21602 d_socklen_t='$d_socklen_t'
21603 d_sockpair='$d_sockpair'
21604 d_socks5_init='$d_socks5_init'
21605 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21606 d_sqrtl='$d_sqrtl'
21607 d_srand48_r='$d_srand48_r'
21608 d_srandom_r='$d_srandom_r'
21609 d_sresgproto='$d_sresgproto'
21610 d_sresuproto='$d_sresuproto'
21611 d_statblks='$d_statblks'
21612 d_statfs_f_flags='$d_statfs_f_flags'
21613 d_statfs_s='$d_statfs_s'
21614 d_statvfs='$d_statvfs'
21615 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21616 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21617 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21618 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21619 d_stdio_stream_array='$d_stdio_stream_array'
21620 d_stdiobase='$d_stdiobase'
21621 d_stdstdio='$d_stdstdio'
21622 d_strchr='$d_strchr'
21623 d_strcoll='$d_strcoll'
21624 d_strctcpy='$d_strctcpy'
21625 d_strerrm='$d_strerrm'
21626 d_strerror='$d_strerror'
21627 d_strerror_r='$d_strerror_r'
21628 d_strftime='$d_strftime'
21629 d_strlcat='$d_strlcat'
21630 d_strlcpy='$d_strlcpy'
21631 d_strtod='$d_strtod'
21632 d_strtol='$d_strtol'
21633 d_strtold='$d_strtold'
21634 d_strtoll='$d_strtoll'
21635 d_strtoq='$d_strtoq'
21636 d_strtoul='$d_strtoul'
21637 d_strtoull='$d_strtoull'
21638 d_strtouq='$d_strtouq'
21639 d_strxfrm='$d_strxfrm'
21640 d_suidsafe='$d_suidsafe'
21641 d_symlink='$d_symlink'
21642 d_syscall='$d_syscall'
21643 d_syscallproto='$d_syscallproto'
21644 d_sysconf='$d_sysconf'
21645 d_sysernlst='$d_sysernlst'
21646 d_syserrlst='$d_syserrlst'
21647 d_system='$d_system'
21648 d_tcgetpgrp='$d_tcgetpgrp'
21649 d_tcsetpgrp='$d_tcsetpgrp'
21650 d_telldir='$d_telldir'
21651 d_telldirproto='$d_telldirproto'
21652 d_time='$d_time'
21653 d_times='$d_times'
21654 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21655 d_tm_tm_zone='$d_tm_tm_zone'
21656 d_tmpnam_r='$d_tmpnam_r'
21657 d_truncate='$d_truncate'
21658 d_ttyname_r='$d_ttyname_r'
21659 d_tzname='$d_tzname'
21660 d_u32align='$d_u32align'
21661 d_ualarm='$d_ualarm'
21662 d_umask='$d_umask'
21663 d_uname='$d_uname'
21664 d_union_semun='$d_union_semun'
21665 d_unordered='$d_unordered'
21666 d_unsetenv='$d_unsetenv'
21667 d_usleep='$d_usleep'
21668 d_usleepproto='$d_usleepproto'
21669 d_ustat='$d_ustat'
21670 d_vendorarch='$d_vendorarch'
21671 d_vendorbin='$d_vendorbin'
21672 d_vendorlib='$d_vendorlib'
21673 d_vendorscript='$d_vendorscript'
21674 d_vfork='$d_vfork'
21675 d_void_closedir='$d_void_closedir'
21676 d_voidsig='$d_voidsig'
21677 d_voidtty='$d_voidtty'
21678 d_volatile='$d_volatile'
21679 d_vprintf='$d_vprintf'
21680 d_vsnprintf='$d_vsnprintf'
21681 d_wait4='$d_wait4'
21682 d_waitpid='$d_waitpid'
21683 d_wcstombs='$d_wcstombs'
21684 d_wctomb='$d_wctomb'
21685 d_writev='$d_writev'
21686 d_xenix='$d_xenix'
21687 date='$date'
21688 db_hashtype='$db_hashtype'
21689 db_prefixtype='$db_prefixtype'
21690 db_version_major='$db_version_major'
21691 db_version_minor='$db_version_minor'
21692 db_version_patch='$db_version_patch'
21693 defvoidused='$defvoidused'
21694 direntrytype='$direntrytype'
21695 dlext='$dlext'
21696 dlsrc='$dlsrc'
21697 doublesize='$doublesize'
21698 drand01='$drand01'
21699 drand48_r_proto='$drand48_r_proto'
21700 dynamic_ext='$dynamic_ext'
21701 eagain='$eagain'
21702 ebcdic='$ebcdic'
21703 echo='$echo'
21704 egrep='$egrep'
21705 emacs='$emacs'
21706 endgrent_r_proto='$endgrent_r_proto'
21707 endhostent_r_proto='$endhostent_r_proto'
21708 endnetent_r_proto='$endnetent_r_proto'
21709 endprotoent_r_proto='$endprotoent_r_proto'
21710 endpwent_r_proto='$endpwent_r_proto'
21711 endservent_r_proto='$endservent_r_proto'
21712 eunicefix='$eunicefix'
21713 exe_ext='$exe_ext'
21714 expr='$expr'
21715 extensions='$extensions'
21716 extras='$extras'
21717 fflushNULL='$fflushNULL'
21718 fflushall='$fflushall'
21719 find='$find'
21720 firstmakefile='$firstmakefile'
21721 flex='$flex'
21722 fpossize='$fpossize'
21723 fpostype='$fpostype'
21724 freetype='$freetype'
21725 from='$from'
21726 full_ar='$full_ar'
21727 full_csh='$full_csh'
21728 full_sed='$full_sed'
21729 gccansipedantic='$gccansipedantic'
21730 gccosandvers='$gccosandvers'
21731 gccversion='$gccversion'
21732 getgrent_r_proto='$getgrent_r_proto'
21733 getgrgid_r_proto='$getgrgid_r_proto'
21734 getgrnam_r_proto='$getgrnam_r_proto'
21735 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21736 gethostbyname_r_proto='$gethostbyname_r_proto'
21737 gethostent_r_proto='$gethostent_r_proto'
21738 getlogin_r_proto='$getlogin_r_proto'
21739 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21740 getnetbyname_r_proto='$getnetbyname_r_proto'
21741 getnetent_r_proto='$getnetent_r_proto'
21742 getprotobyname_r_proto='$getprotobyname_r_proto'
21743 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21744 getprotoent_r_proto='$getprotoent_r_proto'
21745 getpwent_r_proto='$getpwent_r_proto'
21746 getpwnam_r_proto='$getpwnam_r_proto'
21747 getpwuid_r_proto='$getpwuid_r_proto'
21748 getservbyname_r_proto='$getservbyname_r_proto'
21749 getservbyport_r_proto='$getservbyport_r_proto'
21750 getservent_r_proto='$getservent_r_proto'
21751 getspnam_r_proto='$getspnam_r_proto'
21752 gidformat='$gidformat'
21753 gidsign='$gidsign'
21754 gidsize='$gidsize'
21755 gidtype='$gidtype'
21756 glibpth='$glibpth'
21757 gmake='$gmake'
21758 gmtime_r_proto='$gmtime_r_proto'
21759 gnulibc_version='$gnulibc_version'
21760 grep='$grep'
21761 groupcat='$groupcat'
21762 groupstype='$groupstype'
21763 gzip='$gzip'
21764 h_fcntl='$h_fcntl'
21765 h_sysfile='$h_sysfile'
21766 hint='$hint'
21767 hostcat='$hostcat'
21768 html1dir='$html1dir'
21769 html1direxp='$html1direxp'
21770 html3dir='$html3dir'
21771 html3direxp='$html3direxp'
21772 i16size='$i16size'
21773 i16type='$i16type'
21774 i32size='$i32size'
21775 i32type='$i32type'
21776 i64size='$i64size'
21777 i64type='$i64type'
21778 i8size='$i8size'
21779 i8type='$i8type'
21780 i_arpainet='$i_arpainet'
21781 i_bsdioctl='$i_bsdioctl'
21782 i_crypt='$i_crypt'
21783 i_db='$i_db'
21784 i_dbm='$i_dbm'
21785 i_dirent='$i_dirent'
21786 i_dld='$i_dld'
21787 i_dlfcn='$i_dlfcn'
21788 i_fcntl='$i_fcntl'
21789 i_float='$i_float'
21790 i_fp='$i_fp'
21791 i_fp_class='$i_fp_class'
21792 i_gdbm='$i_gdbm'
21793 i_grp='$i_grp'
21794 i_ieeefp='$i_ieeefp'
21795 i_inttypes='$i_inttypes'
21796 i_langinfo='$i_langinfo'
21797 i_libutil='$i_libutil'
21798 i_limits='$i_limits'
21799 i_locale='$i_locale'
21800 i_machcthr='$i_machcthr'
21801 i_malloc='$i_malloc'
21802 i_math='$i_math'
21803 i_memory='$i_memory'
21804 i_mntent='$i_mntent'
21805 i_ndbm='$i_ndbm'
21806 i_netdb='$i_netdb'
21807 i_neterrno='$i_neterrno'
21808 i_netinettcp='$i_netinettcp'
21809 i_niin='$i_niin'
21810 i_poll='$i_poll'
21811 i_prot='$i_prot'
21812 i_pthread='$i_pthread'
21813 i_pwd='$i_pwd'
21814 i_rpcsvcdbm='$i_rpcsvcdbm'
21815 i_sfio='$i_sfio'
21816 i_sgtty='$i_sgtty'
21817 i_shadow='$i_shadow'
21818 i_socks='$i_socks'
21819 i_stdarg='$i_stdarg'
21820 i_stddef='$i_stddef'
21821 i_stdlib='$i_stdlib'
21822 i_string='$i_string'
21823 i_sunmath='$i_sunmath'
21824 i_sysaccess='$i_sysaccess'
21825 i_sysdir='$i_sysdir'
21826 i_sysfile='$i_sysfile'
21827 i_sysfilio='$i_sysfilio'
21828 i_sysin='$i_sysin'
21829 i_sysioctl='$i_sysioctl'
21830 i_syslog='$i_syslog'
21831 i_sysmman='$i_sysmman'
21832 i_sysmode='$i_sysmode'
21833 i_sysmount='$i_sysmount'
21834 i_sysndir='$i_sysndir'
21835 i_sysparam='$i_sysparam'
21836 i_sysresrc='$i_sysresrc'
21837 i_syssecrt='$i_syssecrt'
21838 i_sysselct='$i_sysselct'
21839 i_syssockio='$i_syssockio'
21840 i_sysstat='$i_sysstat'
21841 i_sysstatfs='$i_sysstatfs'
21842 i_sysstatvfs='$i_sysstatvfs'
21843 i_systime='$i_systime'
21844 i_systimek='$i_systimek'
21845 i_systimes='$i_systimes'
21846 i_systypes='$i_systypes'
21847 i_sysuio='$i_sysuio'
21848 i_sysun='$i_sysun'
21849 i_sysutsname='$i_sysutsname'
21850 i_sysvfs='$i_sysvfs'
21851 i_syswait='$i_syswait'
21852 i_termio='$i_termio'
21853 i_termios='$i_termios'
21854 i_time='$i_time'
21855 i_unistd='$i_unistd'
21856 i_ustat='$i_ustat'
21857 i_utime='$i_utime'
21858 i_values='$i_values'
21859 i_varargs='$i_varargs'
21860 i_varhdr='$i_varhdr'
21861 i_vfork='$i_vfork'
21862 ignore_versioned_solibs='$ignore_versioned_solibs'
21863 inc_version_list='$inc_version_list'
21864 inc_version_list_init='$inc_version_list_init'
21865 incpath='$incpath'
21866 inews='$inews'
21867 initialinstalllocation='$initialinstalllocation'
21868 installarchlib='$installarchlib'
21869 installbin='$installbin'
21870 installhtml1dir='$installhtml1dir'
21871 installhtml3dir='$installhtml3dir'
21872 installman1dir='$installman1dir'
21873 installman3dir='$installman3dir'
21874 installprefix='$installprefix'
21875 installprefixexp='$installprefixexp'
21876 installprivlib='$installprivlib'
21877 installscript='$installscript'
21878 installsitearch='$installsitearch'
21879 installsitebin='$installsitebin'
21880 installsitehtml1dir='$installsitehtml1dir'
21881 installsitehtml3dir='$installsitehtml3dir'
21882 installsitelib='$installsitelib'
21883 installsiteman1dir='$installsiteman1dir'
21884 installsiteman3dir='$installsiteman3dir'
21885 installsitescript='$installsitescript'
21886 installstyle='$installstyle'
21887 installusrbinperl='$installusrbinperl'
21888 installvendorarch='$installvendorarch'
21889 installvendorbin='$installvendorbin'
21890 installvendorhtml1dir='$installvendorhtml1dir'
21891 installvendorhtml3dir='$installvendorhtml3dir'
21892 installvendorlib='$installvendorlib'
21893 installvendorman1dir='$installvendorman1dir'
21894 installvendorman3dir='$installvendorman3dir'
21895 installvendorscript='$installvendorscript'
21896 intsize='$intsize'
21897 issymlink='$issymlink'
21898 ivdformat='$ivdformat'
21899 ivsize='$ivsize'
21900 ivtype='$ivtype'
21901 known_extensions='$known_extensions'
21902 ksh='$ksh'
21903 ld='$ld'
21904 lddlflags='$lddlflags'
21905 ldflags='$ldflags'
21906 ldflags_uselargefiles='$ldflags_uselargefiles'
21907 ldlibpthname='$ldlibpthname'
21908 less='$less'
21909 lib_ext='$lib_ext'
21910 libc='$libc'
21911 libperl='$libperl'
21912 libpth='$libpth'
21913 libs='$libs'
21914 libsdirs='$libsdirs'
21915 libsfiles='$libsfiles'
21916 libsfound='$libsfound'
21917 libspath='$libspath'
21918 libswanted='$libswanted'
21919 libswanted_uselargefiles='$libswanted_uselargefiles'
21920 line='$line'
21921 lint='$lint'
21922 lkflags='$lkflags'
21923 ln='$ln'
21924 lns='$lns'
21925 localtime_r_proto='$localtime_r_proto'
21926 locincpth='$locincpth'
21927 loclibpth='$loclibpth'
21928 longdblsize='$longdblsize'
21929 longlongsize='$longlongsize'
21930 longsize='$longsize'
21931 lp='$lp'
21932 lpr='$lpr'
21933 ls='$ls'
21934 lseeksize='$lseeksize'
21935 lseektype='$lseektype'
21936 mad='$mad'
21937 madlyh='$madlyh'
21938 madlyobj='$madlyobj'
21939 madlysrc='$madlysrc'
21940 mail='$mail'
21941 mailx='$mailx'
21942 make='$make'
21943 make_set_make='$make_set_make'
21944 mallocobj='$mallocobj'
21945 mallocsrc='$mallocsrc'
21946 malloctype='$malloctype'
21947 man1dir='$man1dir'
21948 man1direxp='$man1direxp'
21949 man1ext='$man1ext'
21950 man3dir='$man3dir'
21951 man3direxp='$man3direxp'
21952 man3ext='$man3ext'
21953 mips_type='$mips_type'
21954 mistrustnm='$mistrustnm'
21955 mkdir='$mkdir'
21956 mmaptype='$mmaptype'
21957 modetype='$modetype'
21958 more='$more'
21959 multiarch='$multiarch'
21960 mv='$mv'
21961 myarchname='$myarchname'
21962 mydomain='$mydomain'
21963 myhostname='$myhostname'
21964 myuname='$myuname'
21965 n='$n'
21966 need_va_copy='$need_va_copy'
21967 netdb_hlen_type='$netdb_hlen_type'
21968 netdb_host_type='$netdb_host_type'
21969 netdb_name_type='$netdb_name_type'
21970 netdb_net_type='$netdb_net_type'
21971 nm='$nm'
21972 nm_opt='$nm_opt'
21973 nm_so_opt='$nm_so_opt'
21974 nonxs_ext='$nonxs_ext'
21975 nroff='$nroff'
21976 nvEUformat='$nvEUformat'
21977 nvFUformat='$nvFUformat'
21978 nvGUformat='$nvGUformat'
21979 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21980 nveformat='$nveformat'
21981 nvfformat='$nvfformat'
21982 nvgformat='$nvgformat'
21983 nvsize='$nvsize'
21984 nvtype='$nvtype'
21985 o_nonblock='$o_nonblock'
21986 obj_ext='$obj_ext'
21987 old_pthread_create_joinable='$old_pthread_create_joinable'
21988 optimize='$optimize'
21989 orderlib='$orderlib'
21990 osname='$osname'
21991 osvers='$osvers'
21992 otherlibdirs='$otherlibdirs'
21993 package='$package'
21994 pager='$pager'
21995 passcat='$passcat'
21996 patchlevel='$patchlevel'
21997 path_sep='$path_sep'
21998 perl5='$perl5'
21999 perl='$perl'
22000 perl_patchlevel='$perl_patchlevel'
22001 perladmin='$perladmin'
22002 perllibs='$perllibs'
22003 perlpath='$perlpath'
22004 pg='$pg'
22005 phostname='$phostname'
22006 pidtype='$pidtype'
22007 plibpth='$plibpth'
22008 pmake='$pmake'
22009 pr='$pr'
22010 prefix='$prefix'
22011 prefixexp='$prefixexp'
22012 privlib='$privlib'
22013 privlibexp='$privlibexp'
22014 procselfexe='$procselfexe'
22015 prototype='$prototype'
22016 ptrsize='$ptrsize'
22017 quadkind='$quadkind'
22018 quadtype='$quadtype'
22019 randbits='$randbits'
22020 randfunc='$randfunc'
22021 random_r_proto='$random_r_proto'
22022 randseedtype='$randseedtype'
22023 ranlib='$ranlib'
22024 rd_nodata='$rd_nodata'
22025 readdir64_r_proto='$readdir64_r_proto'
22026 readdir_r_proto='$readdir_r_proto'
22027 revision='$revision'
22028 rm='$rm'
22029 rmail='$rmail'
22030 run='$run'
22031 runnm='$runnm'
22032 sPRIEUldbl='$sPRIEUldbl'
22033 sPRIFUldbl='$sPRIFUldbl'
22034 sPRIGUldbl='$sPRIGUldbl'
22035 sPRIXU64='$sPRIXU64'
22036 sPRId64='$sPRId64'
22037 sPRIeldbl='$sPRIeldbl'
22038 sPRIfldbl='$sPRIfldbl'
22039 sPRIgldbl='$sPRIgldbl'
22040 sPRIi64='$sPRIi64'
22041 sPRIo64='$sPRIo64'
22042 sPRIu64='$sPRIu64'
22043 sPRIx64='$sPRIx64'
22044 sSCNfldbl='$sSCNfldbl'
22045 sched_yield='$sched_yield'
22046 scriptdir='$scriptdir'
22047 scriptdirexp='$scriptdirexp'
22048 sed='$sed'
22049 seedfunc='$seedfunc'
22050 selectminbits='$selectminbits'
22051 selecttype='$selecttype'
22052 sendmail='$sendmail'
22053 setgrent_r_proto='$setgrent_r_proto'
22054 sethostent_r_proto='$sethostent_r_proto'
22055 setlocale_r_proto='$setlocale_r_proto'
22056 setnetent_r_proto='$setnetent_r_proto'
22057 setprotoent_r_proto='$setprotoent_r_proto'
22058 setpwent_r_proto='$setpwent_r_proto'
22059 setservent_r_proto='$setservent_r_proto'
22060 sh='$sh'
22061 shar='$shar'
22062 sharpbang='$sharpbang'
22063 shmattype='$shmattype'
22064 shortsize='$shortsize'
22065 shrpenv='$shrpenv'
22066 shsharp='$shsharp'
22067 sig_count='$sig_count'
22068 sig_name='$sig_name'
22069 sig_name_init='$sig_name_init'
22070 sig_num='$sig_num'
22071 sig_num_init='$sig_num_init'
22072 sig_size='$sig_size'
22073 signal_t='$signal_t'
22074 sitearch='$sitearch'
22075 sitearchexp='$sitearchexp'
22076 sitebin='$sitebin'
22077 sitebinexp='$sitebinexp'
22078 sitehtml1dir='$sitehtml1dir'
22079 sitehtml1direxp='$sitehtml1direxp'
22080 sitehtml3dir='$sitehtml3dir'
22081 sitehtml3direxp='$sitehtml3direxp'
22082 sitelib='$sitelib'
22083 sitelib_stem='$sitelib_stem'
22084 sitelibexp='$sitelibexp'
22085 siteman1dir='$siteman1dir'
22086 siteman1direxp='$siteman1direxp'
22087 siteman3dir='$siteman3dir'
22088 siteman3direxp='$siteman3direxp'
22089 siteprefix='$siteprefix'
22090 siteprefixexp='$siteprefixexp'
22091 sitescript='$sitescript'
22092 sitescriptexp='$sitescriptexp'
22093 sizesize='$sizesize'
22094 sizetype='$sizetype'
22095 sleep='$sleep'
22096 smail='$smail'
22097 so='$so'
22098 sockethdr='$sockethdr'
22099 socketlib='$socketlib'
22100 socksizetype='$socksizetype'
22101 sort='$sort'
22102 spackage='$spackage'
22103 spitshell='$spitshell'
22104 srand48_r_proto='$srand48_r_proto'
22105 srandom_r_proto='$srandom_r_proto'
22106 src='$src'
22107 ssizetype='$ssizetype'
22108 startperl='$startperl'
22109 startsh='$startsh'
22110 static_ext='$static_ext'
22111 stdchar='$stdchar'
22112 stdio_base='$stdio_base'
22113 stdio_bufsiz='$stdio_bufsiz'
22114 stdio_cnt='$stdio_cnt'
22115 stdio_filbuf='$stdio_filbuf'
22116 stdio_ptr='$stdio_ptr'
22117 stdio_stream_array='$stdio_stream_array'
22118 strerror_r_proto='$strerror_r_proto'
22119 strings='$strings'
22120 submit='$submit'
22121 subversion='$subversion'
22122 sysman='$sysman'
22123 tail='$tail'
22124 tar='$tar'
22125 targetarch='$targetarch'
22126 tbl='$tbl'
22127 tee='$tee'
22128 test='$test'
22129 timeincl='$timeincl'
22130 timetype='$timetype'
22131 tmpnam_r_proto='$tmpnam_r_proto'
22132 to='$to'
22133 touch='$touch'
22134 tr='$tr'
22135 trnl='$trnl'
22136 troff='$troff'
22137 ttyname_r_proto='$ttyname_r_proto'
22138 u16size='$u16size'
22139 u16type='$u16type'
22140 u32size='$u32size'
22141 u32type='$u32type'
22142 u64size='$u64size'
22143 u64type='$u64type'
22144 u8size='$u8size'
22145 u8type='$u8type'
22146 uidformat='$uidformat'
22147 uidsign='$uidsign'
22148 uidsize='$uidsize'
22149 uidtype='$uidtype'
22150 uname='$uname'
22151 uniq='$uniq'
22152 uquadtype='$uquadtype'
22153 use5005threads='$use5005threads'
22154 use64bitall='$use64bitall'
22155 use64bitint='$use64bitint'
22156 usecrosscompile='$usecrosscompile'
22157 usedl='$usedl'
22158 usefaststdio='$usefaststdio'
22159 useithreads='$useithreads'
22160 uselargefiles='$uselargefiles'
22161 uselongdouble='$uselongdouble'
22162 usemallocwrap='$usemallocwrap'
22163 usemorebits='$usemorebits'
22164 usemultiplicity='$usemultiplicity'
22165 usemymalloc='$usemymalloc'
22166 usenm='$usenm'
22167 useopcode='$useopcode'
22168 useperlio='$useperlio'
22169 useposix='$useposix'
22170 usereentrant='$usereentrant'
22171 userelocatableinc='$userelocatableinc'
22172 usesfio='$usesfio'
22173 useshrplib='$useshrplib'
22174 usesitecustomize='$usesitecustomize'
22175 usesocks='$usesocks'
22176 usethreads='$usethreads'
22177 usevendorprefix='$usevendorprefix'
22178 usevfork='$usevfork'
22179 usrinc='$usrinc'
22180 uuname='$uuname'
22181 uvXUformat='$uvXUformat'
22182 uvoformat='$uvoformat'
22183 uvsize='$uvsize'
22184 uvtype='$uvtype'
22185 uvuformat='$uvuformat'
22186 uvxformat='$uvxformat'
22187 vendorarch='$vendorarch'
22188 vendorarchexp='$vendorarchexp'
22189 vendorbin='$vendorbin'
22190 vendorbinexp='$vendorbinexp'
22191 vendorhtml1dir='$vendorhtml1dir'
22192 vendorhtml1direxp='$vendorhtml1direxp'
22193 vendorhtml3dir='$vendorhtml3dir'
22194 vendorhtml3direxp='$vendorhtml3direxp'
22195 vendorlib='$vendorlib'
22196 vendorlib_stem='$vendorlib_stem'
22197 vendorlibexp='$vendorlibexp'
22198 vendorman1dir='$vendorman1dir'
22199 vendorman1direxp='$vendorman1direxp'
22200 vendorman3dir='$vendorman3dir'
22201 vendorman3direxp='$vendorman3direxp'
22202 vendorprefix='$vendorprefix'
22203 vendorprefixexp='$vendorprefixexp'
22204 vendorscript='$vendorscript'
22205 vendorscriptexp='$vendorscriptexp'
22206 version='$version'
22207 version_patchlevel_string='$version_patchlevel_string'
22208 versiononly='$versiononly'
22209 vi='$vi'
22210 voidflags='$voidflags'
22211 xlibpth='$xlibpth'
22212 yacc='$yacc'
22213 yaccflags='$yaccflags'
22214 zcat='$zcat'
22215 zip='$zip'
22216 EOT
22217
22218 : Add in command line options if available
22219 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22220
22221 : add special variables
22222 $test -f $src/patchlevel.h && \
22223 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22224 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22225 echo "PERL_CONFIG_SH=true" >>config.sh
22226
22227 : propagate old symbols
22228 if $test -f UU/config.sh; then
22229         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22230         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22231         $sort | $uniq -u >UU/oldsyms
22232         set X `cat UU/oldsyms`
22233         shift
22234         case $# in
22235         0) ;;
22236         *)
22237                 cat <<EOM
22238 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22239 EOM
22240                 echo "# Variables propagated from previous config.sh file." >>config.sh
22241                 for sym in `cat UU/oldsyms`; do
22242                         echo "    Propagating $hint variable "'$'"$sym..."
22243                         eval 'tmp="$'"${sym}"'"'
22244                         echo "$tmp" | \
22245                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22246                 done
22247                 ;;
22248         esac
22249 fi
22250
22251 : Finish up by extracting the .SH files
22252 case "$alldone" in
22253 exit)
22254         $rm -rf UU
22255         echo "Extraction done."
22256         exit 0
22257         ;;
22258 cont)
22259         ;;
22260 '')
22261         dflt=''
22262         nostick=true
22263         $cat <<EOM
22264
22265 If you'd like to make any changes to the config.sh file before I begin
22266 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22267
22268 EOM
22269         rp="Press return or use a shell escape to edit config.sh:"
22270         . UU/myread
22271         nostick=''
22272         case "$ans" in
22273         '') ;;
22274         *) : in case they cannot read
22275                 sh 1>&4 -c "$ans";;
22276         esac
22277         ;;
22278 esac
22279
22280 : if this fails, just run all the .SH files by hand
22281 . ./config.sh
22282
22283 echo " "
22284 exec 1>&4
22285 pwd=`pwd`
22286 . ./UU/extract
22287 cd "$pwd"
22288
22289 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22290         dflt=y
22291         case "$silent" in
22292         true) ;;
22293         *)
22294                 $cat <<EOM
22295
22296 Now you need to generate make dependencies by running "$make depend".
22297 You might prefer to run it in background: "$make depend > makedepend.out &"
22298 It can take a while, so you might not want to run it right now.
22299
22300 EOM
22301                 ;;
22302         esac
22303         rp="Run $make depend now?"
22304         . UU/myread
22305         case "$ans" in
22306         y*)
22307                 $make depend && echo "Now you must run '$make'."
22308                 ;;
22309         *)
22310                 echo "You must run '$make depend' then '$make'."
22311                 ;;
22312         esac
22313 elif test -f [Mm]akefile; then
22314         echo " "
22315         echo "Now you must run a $make."
22316 else
22317         echo "Configure done."
22318 fi
22319
22320 if $test -f Policy.sh; then
22321     $cat <<EOM
22322
22323 If you compile $package on a different machine or from a different object
22324 directory, copy the Policy.sh file from this object directory to the
22325 new one before you run Configure -- this will help you with most of
22326 the policy defaults.
22327
22328 EOM
22329 fi
22330 if $test -f config.msg; then
22331     echo "Hmm.  I also noted the following information while running:"
22332     echo " "
22333     $cat config.msg >&4
22334     $rm -f config.msg
22335 fi
22336 $rm -f kit*isdone ark*isdone
22337 $rm -rf UU
22338
22339 : End of Configure
22340