Rewrite t/op/getppid.t to remove the assumption that init has PID of 1.
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Mar  8 09:08:03 CET 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_builtin_choose_expr=''
358 d_builtin_expect=''
359 d_bzero=''
360 d_casti32=''
361 castflags=''
362 d_castneg=''
363 d_chown=''
364 d_chroot=''
365 d_chsize=''
366 d_class=''
367 d_clearenv=''
368 d_closedir=''
369 d_void_closedir=''
370 d_cmsghdr_s=''
371 d_const=''
372 d_copysignl=''
373 cryptlib=''
374 d_crypt=''
375 crypt_r_proto=''
376 d_crypt_r=''
377 d_csh=''
378 full_csh=''
379 ctermid_r_proto=''
380 d_ctermid_r=''
381 ctime_r_proto=''
382 d_ctime_r=''
383 d_cuserid=''
384 d_dbl_dig=''
385 d_dbminitproto=''
386 d_difftime=''
387 d_dirfd=''
388 d_dlerror=''
389 d_dlopen=''
390 d_dlsymun=''
391 d_dosuid=''
392 d_suidsafe=''
393 d_drand48_r=''
394 drand48_r_proto=''
395 d_drand48proto=''
396 d_dup2=''
397 d_eaccess=''
398 d_endgrent=''
399 d_endgrent_r=''
400 endgrent_r_proto=''
401 d_endhent=''
402 d_endhostent_r=''
403 endhostent_r_proto=''
404 d_endnent=''
405 d_endnetent_r=''
406 endnetent_r_proto=''
407 d_endpent=''
408 d_endprotoent_r=''
409 endprotoent_r_proto=''
410 d_endpwent=''
411 d_endpwent_r=''
412 endpwent_r_proto=''
413 d_endsent=''
414 d_endservent_r=''
415 endservent_r_proto=''
416 d_faststdio=''
417 d_fchdir=''
418 d_fchmod=''
419 d_fchown=''
420 d_fcntl=''
421 d_fcntl_can_lock=''
422 d_fd_macros=''
423 d_fd_set=''
424 d_fds_bits=''
425 d_fgetpos=''
426 d_finite=''
427 d_finitel=''
428 d_flexfnam=''
429 d_flock=''
430 d_flockproto=''
431 d_fork=''
432 d_fp_class=''
433 d_fpclass=''
434 d_fpclassify=''
435 d_fpclassl=''
436 d_fpos64_t=''
437 d_frexpl=''
438 d_fs_data_s=''
439 d_fseeko=''
440 d_fsetpos=''
441 d_fstatfs=''
442 d_fsync=''
443 d_ftello=''
444 d_ftime=''
445 d_gettimeod=''
446 d_futimes=''
447 d_Gconvert=''
448 d_getcwd=''
449 d_getespwnam=''
450 d_getfsstat=''
451 d_getgrent=''
452 d_getgrent_r=''
453 getgrent_r_proto=''
454 d_getgrgid_r=''
455 getgrgid_r_proto=''
456 d_getgrnam_r=''
457 getgrnam_r_proto=''
458 d_getgrps=''
459 d_gethbyaddr=''
460 d_gethbyname=''
461 d_gethent=''
462 aphostname=''
463 d_gethname=''
464 d_phostname=''
465 d_uname=''
466 d_gethostbyaddr_r=''
467 gethostbyaddr_r_proto=''
468 d_gethostbyname_r=''
469 gethostbyname_r_proto=''
470 d_gethostent_r=''
471 gethostent_r_proto=''
472 d_gethostprotos=''
473 d_getitimer=''
474 d_getlogin=''
475 d_getlogin_r=''
476 getlogin_r_proto=''
477 d_getmnt=''
478 d_getmntent=''
479 d_getnbyaddr=''
480 d_getnbyname=''
481 d_getnent=''
482 d_getnetbyaddr_r=''
483 getnetbyaddr_r_proto=''
484 d_getnetbyname_r=''
485 getnetbyname_r_proto=''
486 d_getnetent_r=''
487 getnetent_r_proto=''
488 d_getnetprotos=''
489 d_getpagsz=''
490 d_getpent=''
491 d_getpgid=''
492 d_getpgrp2=''
493 d_bsdgetpgrp=''
494 d_getpgrp=''
495 d_getppid=''
496 d_getprior=''
497 d_getpbyname=''
498 d_getpbynumber=''
499 d_getprotobyname_r=''
500 getprotobyname_r_proto=''
501 d_getprotobynumber_r=''
502 getprotobynumber_r_proto=''
503 d_getprotoent_r=''
504 getprotoent_r_proto=''
505 d_getprotoprotos=''
506 d_getprpwnam=''
507 d_getpwent=''
508 d_getpwent_r=''
509 getpwent_r_proto=''
510 d_getpwnam_r=''
511 getpwnam_r_proto=''
512 d_getpwuid_r=''
513 getpwuid_r_proto=''
514 d_getsent=''
515 d_getservbyname_r=''
516 getservbyname_r_proto=''
517 d_getservbyport_r=''
518 getservbyport_r_proto=''
519 d_getservent_r=''
520 getservent_r_proto=''
521 d_getservprotos=''
522 d_getspnam=''
523 d_getspnam_r=''
524 getspnam_r_proto=''
525 d_getsbyname=''
526 d_getsbyport=''
527 d_gmtime_r=''
528 gmtime_r_proto=''
529 d_gnulibc=''
530 gnulibc_version=''
531 d_hasmntopt=''
532 d_htonl=''
533 d_ilogbl=''
534 d_inetaton=''
535 d_int64_t=''
536 d_isascii=''
537 d_isfinite=''
538 d_isinf=''
539 d_isnan=''
540 d_isnanl=''
541 d_killpg=''
542 d_lchown=''
543 d_ldbl_dig=''
544 d_libm_lib_version=''
545 d_link=''
546 d_localtime_r=''
547 localtime_r_proto=''
548 d_locconv=''
549 d_lockf=''
550 d_longdbl=''
551 longdblsize=''
552 d_longlong=''
553 longlongsize=''
554 d_lseekproto=''
555 d_lstat=''
556 d_madvise=''
557 d_malloc_good_size=''
558 d_malloc_size=''
559 d_mblen=''
560 d_mbstowcs=''
561 d_mbtowc=''
562 d_memchr=''
563 d_memcmp=''
564 d_memcpy=''
565 d_memmove=''
566 d_memset=''
567 d_mkdir=''
568 d_mkdtemp=''
569 d_mkfifo=''
570 d_mkstemp=''
571 d_mkstemps=''
572 d_mktime=''
573 d_mmap=''
574 mmaptype=''
575 d_modfl=''
576 d_modfl_pow32_bug=''
577 d_modflproto=''
578 d_mprotect=''
579 d_msg=''
580 d_msgctl=''
581 d_msgget=''
582 d_msghdr_s=''
583 d_msgrcv=''
584 d_msgsnd=''
585 d_msync=''
586 d_munmap=''
587 d_nice=''
588 d_nl_langinfo=''
589 d_off64_t=''
590 d_open3=''
591 d_fpathconf=''
592 d_pathconf=''
593 d_pause=''
594 d_pipe=''
595 d_poll=''
596 d_portable=''
597 d_procselfexe=''
598 procselfexe=''
599 d_old_pthread_create_joinable=''
600 old_pthread_create_joinable=''
601 d_pthread_atfork=''
602 d_pthread_attr_setscope=''
603 d_pthread_yield=''
604 d_sched_yield=''
605 sched_yield=''
606 d_qgcvt=''
607 d_random_r=''
608 random_r_proto=''
609 d_readdir64_r=''
610 readdir64_r_proto=''
611 d_readdir=''
612 d_rewinddir=''
613 d_seekdir=''
614 d_telldir=''
615 d_readdir_r=''
616 readdir_r_proto=''
617 d_readlink=''
618 d_readv=''
619 d_recvmsg=''
620 d_rename=''
621 d_rmdir=''
622 d_safebcpy=''
623 d_safemcpy=''
624 d_sanemcmp=''
625 d_sbrkproto=''
626 d_scalbnl=''
627 d_select=''
628 d_sem=''
629 d_semctl=''
630 d_semget=''
631 d_semop=''
632 d_sendmsg=''
633 d_setegid=''
634 d_seteuid=''
635 d_setgrent=''
636 d_setgrent_r=''
637 setgrent_r_proto=''
638 d_setgrps=''
639 d_sethent=''
640 d_sethostent_r=''
641 sethostent_r_proto=''
642 d_setitimer=''
643 d_setlinebuf=''
644 d_setlocale=''
645 d_setlocale_r=''
646 setlocale_r_proto=''
647 d_setnent=''
648 d_setnetent_r=''
649 setnetent_r_proto=''
650 d_setpent=''
651 d_setpgid=''
652 d_setpgrp2=''
653 d_bsdsetpgrp=''
654 d_setpgrp=''
655 d_setprior=''
656 d_setproctitle=''
657 d_setprotoent_r=''
658 setprotoent_r_proto=''
659 d_setpwent=''
660 d_setpwent_r=''
661 setpwent_r_proto=''
662 d_setregid=''
663 d_setresgid=''
664 d_setresuid=''
665 d_setreuid=''
666 d_setrgid=''
667 d_setruid=''
668 d_setsent=''
669 d_setservent_r=''
670 setservent_r_proto=''
671 d_setsid=''
672 d_setvbuf=''
673 d_sfio=''
674 usesfio=''
675 d_shm=''
676 d_shmat=''
677 d_shmatprototype=''
678 shmattype=''
679 d_shmctl=''
680 d_shmdt=''
681 d_shmget=''
682 d_sigaction=''
683 d_sigprocmask=''
684 d_sigsetjmp=''
685 usesitecustomize=''
686 d_snprintf=''
687 d_vsnprintf=''
688 d_sockatmark=''
689 d_sockatmarkproto=''
690 d_msg_ctrunc=''
691 d_msg_dontroute=''
692 d_msg_oob=''
693 d_msg_peek=''
694 d_msg_proxy=''
695 d_oldsock=''
696 d_scm_rights=''
697 d_socket=''
698 d_sockpair=''
699 sockethdr=''
700 socketlib=''
701 d_socklen_t=''
702 d_socks5_init=''
703 d_sprintf_returns_strlen=''
704 d_sqrtl=''
705 d_srand48_r=''
706 srand48_r_proto=''
707 d_srandom_r=''
708 srandom_r_proto=''
709 d_sresgproto=''
710 d_sresuproto=''
711 d_statblks=''
712 d_statfs_f_flags=''
713 d_statfs_s=''
714 d_fstatvfs=''
715 d_statvfs=''
716 d_stdio_cnt_lval=''
717 d_stdio_ptr_lval=''
718 d_stdio_ptr_lval_nochange_cnt=''
719 d_stdio_ptr_lval_sets_cnt=''
720 d_stdiobase=''
721 d_stdstdio=''
722 stdio_base=''
723 stdio_bufsiz=''
724 stdio_cnt=''
725 stdio_filbuf=''
726 stdio_ptr=''
727 d_index=''
728 d_strchr=''
729 d_strcoll=''
730 d_strctcpy=''
731 d_strerrm=''
732 d_strerror=''
733 d_sysernlst=''
734 d_syserrlst=''
735 d_strerror_r=''
736 strerror_r_proto=''
737 d_strftime=''
738 d_strlcat=''
739 d_strlcpy=''
740 d_strtod=''
741 d_strtol=''
742 d_strtold=''
743 d_strtoll=''
744 d_strtoq=''
745 d_strtoul=''
746 d_strtoull=''
747 d_strtouq=''
748 d_strxfrm=''
749 d_symlink=''
750 d_syscall=''
751 d_syscallproto=''
752 d_sysconf=''
753 d_system=''
754 d_tcgetpgrp=''
755 d_tcsetpgrp=''
756 d_telldirproto=''
757 d_time=''
758 timetype=''
759 clocktype=''
760 d_times=''
761 d_tmpnam_r=''
762 tmpnam_r_proto=''
763 d_truncate=''
764 d_ttyname_r=''
765 ttyname_r_proto=''
766 d_tzname=''
767 d_u32align=''
768 d_ualarm=''
769 d_umask=''
770 d_semctl_semid_ds=''
771 d_semctl_semun=''
772 d_union_semun=''
773 d_unordered=''
774 d_unsetenv=''
775 d_usleep=''
776 d_usleepproto=''
777 d_ustat=''
778 d_vfork=''
779 usevfork=''
780 d_voidsig=''
781 signal_t=''
782 d_volatile=''
783 d_charvspr=''
784 d_vprintf=''
785 d_wait4=''
786 d_waitpid=''
787 d_wcstombs=''
788 d_wctomb=''
789 d_writev=''
790 dlext=''
791 cccdlflags=''
792 ccdlflags=''
793 dlsrc=''
794 ld=''
795 lddlflags=''
796 usedl=''
797 doublesize=''
798 ebcdic=''
799 fflushNULL=''
800 fflushall=''
801 fpossize=''
802 fpostype=''
803 gccansipedantic=''
804 gccosandvers=''
805 gccversion=''
806 gidformat=''
807 gidsign=''
808 gidsize=''
809 gidtype=''
810 groupstype=''
811 h_fcntl=''
812 h_sysfile=''
813 html1dir=''
814 html1direxp=''
815 installhtml1dir=''
816 html3dir=''
817 html3direxp=''
818 installhtml3dir=''
819 i_arpainet=''
820 i_crypt=''
821 db_hashtype=''
822 db_prefixtype=''
823 db_version_major=''
824 db_version_minor=''
825 db_version_patch=''
826 i_db=''
827 i_dbm=''
828 i_rpcsvcdbm=''
829 d_dirnamlen=''
830 direntrytype=''
831 i_dirent=''
832 i_dld=''
833 i_dlfcn=''
834 i_fcntl=''
835 i_float=''
836 i_fp=''
837 i_fp_class=''
838 i_gdbm=''
839 d_grpasswd=''
840 i_grp=''
841 i_ieeefp=''
842 i_inttypes=''
843 i_langinfo=''
844 i_libutil=''
845 i_limits=''
846 i_locale=''
847 i_machcthr=''
848 i_malloc=''
849 i_math=''
850 i_memory=''
851 i_mntent=''
852 i_ndbm=''
853 i_netdb=''
854 i_neterrno=''
855 i_netinettcp=''
856 i_niin=''
857 i_sysin=''
858 i_poll=''
859 i_prot=''
860 i_pthread=''
861 d_pwage=''
862 d_pwchange=''
863 d_pwclass=''
864 d_pwcomment=''
865 d_pwexpire=''
866 d_pwgecos=''
867 d_pwpasswd=''
868 d_pwquota=''
869 i_pwd=''
870 i_sfio=''
871 i_shadow=''
872 i_socks=''
873 i_stddef=''
874 i_stdlib=''
875 i_string=''
876 strings=''
877 i_sunmath=''
878 i_sysaccess=''
879 i_sysdir=''
880 i_sysfile=''
881 d_voidtty=''
882 i_bsdioctl=''
883 i_sysfilio=''
884 i_sysioctl=''
885 i_syssockio=''
886 i_syslog=''
887 i_sysmman=''
888 i_sysmode=''
889 i_sysmount=''
890 i_sysndir=''
891 i_sysparam=''
892 i_sysresrc=''
893 i_syssecrt=''
894 i_sysselct=''
895 i_sysstat=''
896 i_sysstatfs=''
897 i_sysstatvfs=''
898 i_systimes=''
899 i_systypes=''
900 i_sysuio=''
901 i_sysun=''
902 i_sysutsname=''
903 i_sysvfs=''
904 i_syswait=''
905 i_sgtty=''
906 i_termio=''
907 i_termios=''
908 d_tm_tm_gmtoff=''
909 d_tm_tm_zone=''
910 i_systime=''
911 i_systimek=''
912 i_time=''
913 timeincl=''
914 i_unistd=''
915 i_ustat=''
916 i_utime=''
917 i_values=''
918 i_stdarg=''
919 i_varargs=''
920 i_varhdr=''
921 i_vfork=''
922 inc_version_list=''
923 inc_version_list_init=''
924 d_inc_version_list=''
925 installprefix=''
926 installprefixexp=''
927 installstyle=''
928 installusrbinperl=''
929 intsize=''
930 longsize=''
931 shortsize=''
932 issymlink=''
933 libc=''
934 ldlibpthname=''
935 libperl=''
936 shrpenv=''
937 useshrplib=''
938 glibpth=''
939 libpth=''
940 loclibpth=''
941 plibpth=''
942 xlibpth=''
943 ignore_versioned_solibs=''
944 libs=''
945 libsdirs=''
946 libsfiles=''
947 libsfound=''
948 libspath=''
949 lns=''
950 d_PRIEUldbl=''
951 d_PRIFUldbl=''
952 d_PRIGUldbl=''
953 d_PRIeldbl=''
954 d_PRIfldbl=''
955 d_PRIgldbl=''
956 d_SCNfldbl=''
957 sPRIEUldbl=''
958 sPRIFUldbl=''
959 sPRIGUldbl=''
960 sPRIeldbl=''
961 sPRIfldbl=''
962 sPRIgldbl=''
963 sSCNfldbl=''
964 lseeksize=''
965 lseektype=''
966 mad=''
967 make_set_make=''
968 d_mymalloc=''
969 freetype=''
970 madlyh=''
971 madlyobj=''
972 madlysrc=''
973 mallocobj=''
974 mallocsrc=''
975 malloctype=''
976 usemallocwrap=''
977 usemymalloc=''
978 installman1dir=''
979 man1dir=''
980 man1direxp=''
981 man1ext=''
982 installman3dir=''
983 man3dir=''
984 man3direxp=''
985 man3ext=''
986 modetype=''
987 multiarch=''
988 mydomain=''
989 myhostname=''
990 phostname=''
991 c=''
992 n=''
993 d_eofnblk=''
994 eagain=''
995 o_nonblock=''
996 rd_nodata=''
997 need_va_copy=''
998 netdb_hlen_type=''
999 netdb_host_type=''
1000 netdb_name_type=''
1001 netdb_net_type=''
1002 groupcat=''
1003 hostcat=''
1004 passcat=''
1005 orderlib=''
1006 ranlib=''
1007 d_perl_otherlibdirs=''
1008 otherlibdirs=''
1009 package=''
1010 spackage=''
1011 pager=''
1012 api_revision=''
1013 api_subversion=''
1014 api_version=''
1015 api_versionstring=''
1016 patchlevel=''
1017 perl_patchlevel=''
1018 revision=''
1019 subversion=''
1020 version=''
1021 version_patchlevel_string=''
1022 perl5=''
1023 perladmin=''
1024 perlpath=''
1025 d_nv_preserves_uv=''
1026 d_nv_zero_is_allbits_zero=''
1027 i16size=''
1028 i16type=''
1029 i32size=''
1030 i32type=''
1031 i64size=''
1032 i64type=''
1033 i8size=''
1034 i8type=''
1035 ivsize=''
1036 ivtype=''
1037 nv_preserves_uv_bits=''
1038 nvsize=''
1039 nvtype=''
1040 u16size=''
1041 u16type=''
1042 u32size=''
1043 u32type=''
1044 u64size=''
1045 u64type=''
1046 u8size=''
1047 u8type=''
1048 uvsize=''
1049 uvtype=''
1050 ivdformat=''
1051 nvEUformat=''
1052 nvFUformat=''
1053 nvGUformat=''
1054 nveformat=''
1055 nvfformat=''
1056 nvgformat=''
1057 uvXUformat=''
1058 uvoformat=''
1059 uvuformat=''
1060 uvxformat=''
1061 pidtype=''
1062 prefix=''
1063 prefixexp=''
1064 installprivlib=''
1065 privlib=''
1066 privlibexp=''
1067 prototype=''
1068 ptrsize=''
1069 d_PRIXU64=''
1070 d_PRId64=''
1071 d_PRIi64=''
1072 d_PRIo64=''
1073 d_PRIu64=''
1074 d_PRIx64=''
1075 sPRIXU64=''
1076 sPRId64=''
1077 sPRIi64=''
1078 sPRIo64=''
1079 sPRIu64=''
1080 sPRIx64=''
1081 d_quad=''
1082 quadkind=''
1083 quadtype=''
1084 uquadtype=''
1085 drand01=''
1086 randbits=''
1087 randfunc=''
1088 randseedtype=''
1089 seedfunc=''
1090 installscript=''
1091 scriptdir=''
1092 scriptdirexp=''
1093 selectminbits=''
1094 selecttype=''
1095 sh=''
1096 sig_count=''
1097 sig_name=''
1098 sig_name_init=''
1099 sig_num=''
1100 sig_num_init=''
1101 sig_size=''
1102 installsitearch=''
1103 sitearch=''
1104 sitearchexp=''
1105 d_sitearch=''
1106 installsitebin=''
1107 sitebin=''
1108 sitebinexp=''
1109 installsitehtml1dir=''
1110 sitehtml1dir=''
1111 sitehtml1direxp=''
1112 installsitehtml3dir=''
1113 sitehtml3dir=''
1114 sitehtml3direxp=''
1115 installsitelib=''
1116 sitelib=''
1117 sitelib_stem=''
1118 sitelibexp=''
1119 installsiteman1dir=''
1120 siteman1dir=''
1121 siteman1direxp=''
1122 installsiteman3dir=''
1123 siteman3dir=''
1124 siteman3direxp=''
1125 siteprefix=''
1126 siteprefixexp=''
1127 installsitescript=''
1128 sitescript=''
1129 sitescriptexp=''
1130 sizesize=''
1131 sizetype=''
1132 so=''
1133 socksizetype=''
1134 sharpbang=''
1135 shsharp=''
1136 spitshell=''
1137 src=''
1138 ssizetype=''
1139 startperl=''
1140 startsh=''
1141 stdchar=''
1142 d_stdio_stream_array=''
1143 stdio_stream_array=''
1144 sysman=''
1145 trnl=''
1146 uidformat=''
1147 uidsign=''
1148 uidsize=''
1149 uidtype=''
1150 archname64=''
1151 use64bitall=''
1152 use64bitint=''
1153 usefaststdio=''
1154 ccflags_uselargefiles=''
1155 ldflags_uselargefiles=''
1156 libswanted_uselargefiles=''
1157 uselargefiles=''
1158 uselongdouble=''
1159 usemorebits=''
1160 usemultiplicity=''
1161 nm_opt=''
1162 nm_so_opt=''
1163 runnm=''
1164 usenm=''
1165 useperlio=''
1166 initialinstalllocation=''
1167 userelocatableinc=''
1168 usesocks=''
1169 d_oldpthreads=''
1170 use5005threads=''
1171 useithreads=''
1172 usereentrant=''
1173 usethreads=''
1174 incpath=''
1175 mips_type=''
1176 usrinc=''
1177 d_vendorarch=''
1178 installvendorarch=''
1179 vendorarch=''
1180 vendorarchexp=''
1181 d_vendorbin=''
1182 installvendorbin=''
1183 vendorbin=''
1184 vendorbinexp=''
1185 installvendorhtml1dir=''
1186 vendorhtml1dir=''
1187 vendorhtml1direxp=''
1188 installvendorhtml3dir=''
1189 vendorhtml3dir=''
1190 vendorhtml3direxp=''
1191 d_vendorlib=''
1192 installvendorlib=''
1193 vendorlib=''
1194 vendorlib_stem=''
1195 vendorlibexp=''
1196 installvendorman1dir=''
1197 vendorman1dir=''
1198 vendorman1direxp=''
1199 installvendorman3dir=''
1200 vendorman3dir=''
1201 vendorman3direxp=''
1202 usevendorprefix=''
1203 vendorprefix=''
1204 vendorprefixexp=''
1205 d_vendorscript=''
1206 installvendorscript=''
1207 vendorscript=''
1208 vendorscriptexp=''
1209 versiononly=''
1210 defvoidused=''
1211 voidflags=''
1212 yacc=''
1213 yaccflags=''
1214 CONFIG=''
1215
1216 define='define'
1217 undef='undef'
1218 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1219 rmlist=''
1220
1221 : We must find out about Eunice early
1222 eunicefix=':'
1223 if test -f /etc/unixtovms; then
1224         eunicefix=/etc/unixtovms
1225 fi
1226 if test -f /etc/unixtovms.exe; then
1227         eunicefix=/etc/unixtovms.exe
1228 fi
1229
1230 : Set executable suffix now -- needed before hints available
1231 if test -f "/libs/version.library"; then
1232 : Amiga OS
1233     _exe=""
1234 elif test -f "/system/gnu_library/bin/ar.pm"; then
1235 : Stratus VOS
1236     _exe=".pm"
1237 elif test -n "$DJGPP"; then
1238 : DOS DJGPP
1239     _exe=".exe"
1240 elif test -d c:/. -o -n "$is_os2" ; then
1241 : OS/2 or cygwin
1242     _exe=".exe"
1243 fi
1244
1245 i_whoami=''
1246 ccname=''
1247 ccversion=''
1248 perllibs=''
1249 : set useposix=false in your hint file to disable the POSIX extension.
1250 useposix=true
1251 : set useopcode=false in your hint file to disable the Opcode extension.
1252 useopcode=true
1253 : Trailing extension.  Override this in a hint file, if needed.
1254 : Extra object files, if any, needed on this platform.
1255 archobjs=''
1256 archname=''
1257 : Possible local include directories to search.
1258 : Set locincpth to "" in a hint file to defeat local include searches.
1259 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1260 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1261 :
1262 : no include file wanted by default
1263 inclwanted=''
1264
1265 groupstype=''
1266 libnames=''
1267 : change the next line if compiling for Xenix/286 on Xenix/386
1268 xlibpth='/usr/lib/386 /lib/386'
1269 : Possible local library directories to search.
1270 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1271 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1272
1273 : general looking path for locating libraries
1274 glibpth="/lib /usr/lib $xlibpth"
1275 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1276 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1277 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1278
1279 : Private path used by Configure to find libraries.  Its value
1280 : is prepended to libpth. This variable takes care of special
1281 : machines, like the mips.  Usually, it should be empty.
1282 plibpth=''
1283
1284 : default library list
1285 libswanted=''
1286 : some systems want to use only the non-versioned libso:s
1287 ignore_versioned_solibs=''
1288 siteman1dir=''
1289 siteman3dir=''
1290 sitescript=''
1291 archname64=''
1292 ccflags_uselargefiles=''
1293 ldflags_uselargefiles=''
1294 libswanted_uselargefiles=''
1295 : set usemultiplicity on the Configure command line to enable multiplicity.
1296 : set usesocks on the Configure command line to enable socks.
1297 : set usethreads on the Configure command line to enable threads.
1298 usereentrant='undef'
1299 : full support for void wanted by default
1300 defvoidused=15
1301
1302 : List of libraries we want.
1303 : If anyone needs extra -lxxx, put those in a hint file.
1304 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1305 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1306 : We probably want to search /usr/shlib before most other libraries.
1307 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1308 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1309 glibpth="/usr/shlib $glibpth"
1310 : Do not use vfork unless overridden by a hint file.
1311 usevfork=false
1312
1313 : Find the basic shell for Bourne shell scripts
1314 case "$sh" in
1315 '')
1316         case "$SYSTYPE" in
1317         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1318         *) xxx='/bin/sh';;
1319         esac
1320         if test -f "$xxx"; then
1321                 sh="$xxx"
1322         else
1323                 : Build up a list and do a single loop so we can 'break' out.
1324                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1325                 for xxx in sh bash ksh pdksh ash; do
1326                         for p in $pth; do
1327                                 try="$try ${p}/${xxx}"
1328                         done
1329                 done
1330                 for xxx in $try; do
1331                         if test -f "$xxx"; then
1332                                 sh="$xxx";
1333                                 break
1334                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1335                                 sh="$xxx";
1336                                 break
1337                         elif test -f "$xxx.exe"; then
1338                                 sh="$xxx";
1339                                 break
1340                         fi
1341                 done
1342         fi
1343         ;;
1344 esac
1345
1346 case "$sh" in
1347 '')     cat >&2 <<EOM
1348 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1349
1350 Usually it's in /bin/sh.  How did you even get this far?
1351 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1352 we'll try to straighten this all out.
1353 EOM
1354         exit 1
1355         ;;
1356 esac
1357
1358 : see if sh knows # comments
1359 if `$sh -c '#' >/dev/null 2>&1`; then
1360         shsharp=true
1361         spitshell=cat
1362         xcat=/bin/cat
1363         test -f $xcat$_exe || xcat=/usr/bin/cat
1364         if test ! -f $xcat$_exe; then
1365                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1366                         if test -f $p/cat$_exe; then
1367                                 xcat=$p/cat
1368                                 break
1369                         fi
1370                 done
1371                 if test ! -f $xcat$_exe; then
1372                         echo "Can't find cat anywhere!"
1373                         exit 1
1374                 fi
1375         fi
1376         echo "#!$xcat" >sharp
1377         $eunicefix sharp
1378         chmod +x sharp
1379         ./sharp > today
1380         if test -s today; then
1381                 sharpbang='#!'
1382         else
1383                 echo "#! $xcat" > sharp
1384                 $eunicefix sharp
1385                 chmod +x sharp
1386                 ./sharp > today
1387                 if test -s today; then
1388                         sharpbang='#! '
1389                 else
1390                         sharpbang=': use '
1391                 fi
1392         fi
1393 else
1394         echo " "
1395         echo "Your $sh doesn't grok # comments--I will strip them later on."
1396         shsharp=false
1397         cd ..
1398         echo "exec grep -v '^[  ]*#'" >spitshell
1399         chmod +x spitshell
1400         $eunicefix spitshell
1401         spitshell=`pwd`/spitshell
1402         cd UU
1403         echo "I presume that if # doesn't work, #! won't work either!"
1404         sharpbang=': use '
1405 fi
1406 rm -f sharp today
1407
1408 : figure out how to guarantee sh startup
1409 case "$startsh" in
1410 '') startsh=${sharpbang}${sh} ;;
1411 *)
1412 esac
1413 cat >sharp <<EOSS
1414 $startsh
1415 set abc
1416 test "$?abc" != 1
1417 EOSS
1418
1419 chmod +x sharp
1420 $eunicefix sharp
1421 if ./sharp; then
1422         : echo "Yup, it does."
1423 else
1424         echo "Hmm... '$startsh' does not guarantee sh startup..."
1425         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1426 fi
1427 rm -f sharp
1428
1429
1430 : Save command line options in file UU/cmdline.opt for later use in
1431 : generating config.sh.
1432 cat > cmdline.opt <<EOSH
1433 # Configure command line arguments.
1434 config_arg0='$0'
1435 config_args='$*'
1436 config_argc=$#
1437 EOSH
1438 argn=1
1439 args_exp=''
1440 args_sep=''
1441 for arg in "$@"; do
1442         cat >>cmdline.opt <<EOSH
1443 config_arg$argn='$arg'
1444 EOSH
1445         # Extreme backslashitis: replace each ' by '"'"'
1446         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1447 $arg
1448 EOC
1449         arg_exp=`cat cmdl.opt`
1450         args_exp="$args_exp$args_sep'$arg_exp'"
1451         argn=`expr $argn + 1`
1452         args_sep=' '
1453 done
1454 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1455 # used by ./hints/os2.sh
1456 rm -f cmdl.opt
1457
1458 : produce awk script to parse command line options
1459 cat >options.awk <<'EOF'
1460 BEGIN {
1461         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1462
1463         len = length(optstr);
1464         for (i = 1; i <= len; i++) {
1465                 c = substr(optstr, i, 1);
1466                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1467                 if (a == ":") {
1468                         arg[c] = 1;
1469                         i++;
1470                 }
1471                 opt[c] = 1;
1472         }
1473 }
1474 {
1475         expect = 0;
1476         str = $0;
1477         if (substr(str, 1, 1) != "-") {
1478                 printf("'%s'\n", str);
1479                 next;
1480         }
1481         len = length($0);
1482         for (i = 2; i <= len; i++) {
1483                 c = substr(str, i, 1);
1484                 if (!opt[c]) {
1485                         printf("-%s\n", substr(str, i));
1486                         next;
1487                 }
1488                 printf("-%s\n", c);
1489                 if (arg[c]) {
1490                         if (i < len)
1491                                 printf("'%s'\n", substr(str, i + 1));
1492                         else
1493                                 expect = 1;
1494                         next;
1495                 }
1496         }
1497 }
1498 END {
1499         if (expect)
1500                 print "?";
1501 }
1502 EOF
1503
1504 : process the command line options
1505 set X `for arg in "$@"; do echo "X$arg"; done |
1506         sed -e s/X// | awk -f options.awk`
1507 eval "set $*"
1508 shift
1509 rm -f options.awk
1510
1511 : set up default values
1512 fastread=''
1513 reuseval=false
1514 config_sh=''
1515 alldone=''
1516 error=''
1517 silent=''
1518 extractsh=''
1519 override=''
1520 knowitall=''
1521 rm -f optdef.sh posthint.sh
1522 cat >optdef.sh <<EOS
1523 $startsh
1524 EOS
1525
1526
1527 : option parsing
1528 while test $# -gt 0; do
1529         case "$1" in
1530         -d) shift; fastread=yes;;
1531         -e) shift; alldone=cont;;
1532         -f)
1533                 shift
1534                 cd ..
1535                 if test -r "$1"; then
1536                         config_sh="$1"
1537                 else
1538                         echo "$me: cannot read config file $1." >&2
1539                         error=true
1540                 fi
1541                 cd UU
1542                 shift;;
1543         -h) shift; error=true;;
1544         -r) shift; reuseval=true;;
1545         -s) shift; silent=true; realsilent=true;;
1546         -E) shift; alldone=exit;;
1547         -K) shift; knowitall=true;;
1548         -O) shift; override=true;;
1549         -S) shift; silent=true; extractsh=true;;
1550         -D)
1551                 shift
1552                 case "$1" in
1553                 *=)
1554                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1555                         echo "$me: ignoring -D $1" >&2
1556                         ;;
1557                 *=*) echo "$1" | \
1558                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1559                 *) echo "$1='define'" >> optdef.sh;;
1560                 esac
1561                 shift
1562                 ;;
1563         -U)
1564                 shift
1565                 case "$1" in
1566                 *=) echo "$1" >> optdef.sh;;
1567                 *=*)
1568                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1569                         echo "$me: ignoring -U $1" >&2
1570                         ;;
1571                 *) echo "$1='undef'" >> optdef.sh;;
1572                 esac
1573                 shift
1574                 ;;
1575         -A)
1576             shift
1577             xxx=''
1578             yyy="$1"
1579             zzz=''
1580             uuu=undef
1581             case "$yyy" in
1582             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1583                  case "$zzz" in
1584                  *:*) zzz='' ;;
1585                  *)   xxx=append
1586                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1587                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1588                  esac
1589                  ;;
1590             esac
1591             case "$xxx" in
1592             '')  case "$yyy" in
1593                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1594                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1595                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1596                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1597                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1598                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1599                  esac
1600                  ;;       
1601             esac
1602             case "$xxx" in
1603             append)
1604                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1605             clear)
1606                 echo "$yyy=''"                  >> posthint.sh ;;
1607             define)
1608                 case "$zzz" in
1609                 '') zzz=define ;;
1610                 esac
1611                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1612             eval)
1613                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1614             prepend)
1615                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1616             undef)
1617                 case "$zzz" in
1618                 '') zzz="$uuu" ;;
1619                 esac
1620                 echo "$yyy=$zzz"                >> posthint.sh ;;
1621             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1622             esac
1623             shift
1624             ;;
1625         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1626             exit 0;;
1627         --) break;;
1628         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1629         *) break;;
1630         esac
1631 done
1632
1633 case "$error" in
1634 true)
1635         cat >&2 <<EOM
1636 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1637                  [-U symbol] [-U symbol=] [-A command:symbol...]
1638   -d : use defaults for all answers.
1639   -e : go on without questioning past the production of config.sh.
1640   -f : specify an alternate default configuration file.
1641   -h : print this help message and exit (with an error status).
1642   -r : reuse C symbols value if possible (skips costly nm extraction).
1643   -s : silent mode, only echoes questions and essential information.
1644   -D : define symbol to have some value:
1645          -D symbol         symbol gets the value 'define'
1646          -D symbol=value   symbol gets the value 'value'
1647   -E : stop at the end of questions, after having produced config.sh.
1648   -K : do not use unless you know what you are doing.
1649   -O : let -D and -U override definitions from loaded configuration file.
1650   -S : perform variable substitutions on all .SH files (can mix with -f)
1651   -U : undefine symbol:
1652          -U symbol    symbol gets the value 'undef'
1653          -U symbol=   symbol gets completely empty
1654   -A : manipulate symbol after the platform specific hints have been applied:
1655          -A symbol=value                append " "value to symbol
1656          -A append:symbol=value         append value to symbol
1657          -A define:symbol=value         define symbol to have value
1658          -A clear:symbol                define symbol to be ''
1659          -A define:symbol               define symbol to be 'define'
1660          -A eval:symbol=value           define symbol to be eval of value
1661          -A prepend:symbol=value        prepend value to symbol
1662          -A undef:symbol                define symbol to be 'undef'
1663          -A undef:symbol=               define symbol to be ''
1664   -V : print version number and exit (with a zero status).
1665 EOM
1666         exit 1
1667         ;;
1668 esac
1669
1670 : Sanity checks
1671 case "$fastread$alldone" in
1672 yescont|yesexit) ;;
1673 *)
1674         case "$extractsh" in
1675         true) ;;
1676         *)
1677                 if test ! -t 0; then
1678                         echo "Say 'sh Configure', not 'sh <Configure'"
1679                         exit 1
1680                 fi
1681                 ;;
1682         esac
1683         ;;
1684 esac
1685
1686 exec 4>&1
1687 case "$silent" in
1688 true) exec 1>/dev/null;;
1689 esac
1690
1691 : run the defines and the undefines, if any, but leave the file out there...
1692 touch optdef.sh
1693 . ./optdef.sh
1694 : create the posthint manipulation script and leave the file out there...
1695 touch posthint.sh
1696
1697 : set package name
1698 package=perl5
1699 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1700 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1701 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1702 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1703 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1704 esac
1705
1706 : Some greps do not return status, grrr.
1707 echo "grimblepritz" >grimble
1708 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1709         contains=contains
1710 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1711         contains=grep
1712 else
1713         contains=contains
1714 fi
1715 rm -f grimble
1716 : the following should work in any shell
1717 case "$contains" in
1718 contains*)
1719         echo " "
1720         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1721         cat >contains <<'EOSS'
1722 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1723 EOSS
1724 chmod +x contains
1725 esac
1726
1727 : Find the path to the source tree
1728 case "$src" in
1729 '') case "$0" in
1730     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1731          case "$src" in
1732          /*)    ;;
1733          .)     ;;
1734          *)     src=`cd ../$src && pwd` ;;
1735          esac
1736          ;;
1737     *)   src='.';;
1738     esac;;
1739 esac
1740 case "$src" in
1741 '')     src=/
1742         rsrc=/
1743         ;;
1744 /*) rsrc="$src";;
1745 *) rsrc="../$src";;
1746 esac
1747 if test -f $rsrc/Configure && \
1748         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1749 then
1750    : found it, so we are ok.
1751 else
1752         rsrc=''
1753         for src in . .. ../.. ../../.. ../../../..; do
1754                 if test -f ../$src/Configure && \
1755                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1756                 then
1757                         rsrc=../$src
1758                         break
1759                 fi
1760         done
1761 fi
1762 case "$rsrc" in
1763 '')
1764         cat <<EOM >&4
1765
1766 Sorry, I can't seem to locate the source dir for $package.  Please start
1767 Configure with an explicit path -- i.e. /some/path/Configure.
1768
1769 EOM
1770         exit 1
1771         ;;
1772 ../.)   rsrc='..';;
1773 *)
1774         echo " "
1775         echo "Sources for $package found in \"$src\"." >&4
1776         ;;
1777 esac
1778
1779 : script used to extract .SH files with variable substitutions
1780 cat >extract <<'EOS'
1781 PERL_CONFIG_SH=true
1782 echo "Doing variable substitutions on .SH files..."
1783 if test -f MANIFEST; then
1784         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1785 else
1786         echo "(Looking for .SH files under the source directory.)"
1787         set x `(cd "$src"; find . -name "*.SH" -print)`
1788 fi
1789 shift
1790 case $# in
1791 0) set x `(cd "$src"; echo *.SH)`; shift;;
1792 esac
1793 if test ! -f "$src/$1"; then
1794         shift
1795 fi
1796 mkdir_p='
1797 name=$1;
1798 create="";
1799 while test $name; do
1800         if test ! -d "$name"; then
1801                 create="$name $create";
1802                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1803                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1804         else
1805                 name="";
1806         fi;
1807 done;
1808 for file in $create; do
1809         mkdir $file;
1810 done
1811 '
1812 for file in $*; do
1813         case "$src" in
1814         ".")
1815                 case "$file" in
1816                 */*)
1817                         dir=`expr X$file : 'X\(.*\)/'`
1818                         file=`expr X$file : 'X.*/\(.*\)'`
1819                         (cd "$dir" && . ./$file)
1820                         ;;
1821                 *)
1822                         . ./$file
1823                         ;;
1824                 esac
1825                 ;;
1826         *)
1827                 case "$file" in
1828                 */*)
1829                         dir=`expr X$file : 'X\(.*\)/'`
1830                         file=`expr X$file : 'X.*/\(.*\)'`
1831                         (set x $dir; shift; eval $mkdir_p)
1832                         sh <"$src/$dir/$file"
1833                         ;;
1834                 *)
1835                         sh <"$src/$file"
1836                         ;;
1837                 esac
1838                 ;;
1839         esac
1840 done
1841 if test -f "$src/config_h.SH"; then
1842         if test ! -f config.h; then
1843         : oops, they left it out of MANIFEST, probably, so do it anyway.
1844         . "$src/config_h.SH"
1845         fi
1846 fi
1847 EOS
1848
1849 : extract files and exit if asked to do so
1850 case "$extractsh" in
1851 true)
1852         case "$realsilent" in
1853         true) ;;
1854         *) exec 1>&4;;
1855         esac
1856         case "$config_sh" in
1857         '') config_sh='config.sh';;
1858         esac
1859         echo " "
1860         echo "Fetching answers from $config_sh..."
1861         cd ..
1862         . $config_sh
1863         test "$override" && . ./optdef.sh
1864         echo " "
1865         . UU/extract
1866         rm -rf UU
1867         echo "Extraction done."
1868         exit 0
1869         ;;
1870 esac
1871
1872 : Eunice requires " " instead of "", can you believe it
1873 echo " "
1874 : Here we go...
1875 echo "Beginning of configuration questions for $package."
1876
1877 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1878
1879 : first determine how to suppress newline on echo command
1880 echo " "
1881 echo "Checking echo to see how to suppress newlines..."
1882 (echo "hi there\c" ; echo " ") >.echotmp
1883 if $contains c .echotmp >/dev/null 2>&1 ; then
1884         echo "...using -n."
1885         n='-n'
1886         c=''
1887 else
1888         cat <<'EOM'
1889 ...using \c
1890 EOM
1891         n=''
1892         c='\c'
1893 fi
1894 echo $n "The star should be here-->$c"
1895 echo '*'
1896 rm -f .echotmp
1897
1898 : Now test for existence of everything in MANIFEST
1899 echo " "
1900 if test -f "$rsrc/MANIFEST"; then
1901         echo "First let's make sure your kit is complete.  Checking..." >&4
1902         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1903         rm -f missing
1904         tmppwd=`pwd`
1905         for filelist in x??; do
1906                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1907         done
1908         if test -s missing; then
1909                 cat missing >&4
1910                 cat >&4 <<'EOM'
1911
1912 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1913
1914 You have the option of continuing the configuration process, despite the
1915 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1916 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1917 and contact the author (perlbug@perl.org).
1918
1919 EOM
1920                 echo $n "Continue? [n] $c" >&4
1921                 read ans
1922                 case "$ans" in
1923                 y*)
1924                         echo "Continuing..." >&4
1925                         rm -f missing
1926                         ;;
1927                 *)
1928                         echo "ABORTING..." >&4
1929                         kill $$
1930                         ;;
1931                 esac
1932         else
1933                 echo "Looks good..."
1934         fi
1935 else
1936         echo "There is no MANIFEST file.  I hope your kit is complete !"
1937 fi
1938 rm -f missing x??
1939
1940 echo " "
1941 : Find the appropriate value for a newline for tr
1942 if test -n "$DJGPP"; then
1943        trnl='\012'
1944 fi
1945 if test X"$trnl" = X; then
1946         case "`echo foo|tr '\n' x 2>/dev/null`" in
1947         foox) trnl='\n' ;;
1948         esac
1949 fi
1950 if test X"$trnl" = X; then
1951         case "`echo foo|tr '\012' x 2>/dev/null`" in
1952         foox) trnl='\012' ;;
1953         esac
1954 fi
1955 if test X"$trnl" = X; then
1956        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1957        fooxy) trnl='\n\r' ;;
1958        esac
1959 fi
1960 if test X"$trnl" = X; then
1961         cat <<EOM >&2
1962
1963 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1964
1965 EOM
1966         exit 1
1967 fi
1968
1969 : compute the number of columns on the terminal for proper question formatting
1970 case "$COLUMNS" in
1971 '') COLUMNS='80';;
1972 esac
1973
1974 : set up the echo used in my read
1975 myecho="case \"\$xxxm\" in
1976 '') echo $n \"\$rp $c\" >&4;;
1977 *) case \"\$rp\" in
1978         '') echo $n \"[\$xxxm] $c\";;
1979         *)
1980                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1981                         echo \"\$rp\" >&4
1982                         echo $n \"[\$xxxm] $c\" >&4
1983                 else
1984                         echo $n \"\$rp [\$xxxm] $c\" >&4
1985                 fi
1986                 ;;
1987         esac;;
1988 esac"
1989
1990 : now set up to do reads with possible shell escape and default assignment
1991 cat <<EOSC >myread
1992 $startsh
1993 xxxm=\$dflt
1994 $myecho
1995 ans='!'
1996 case "\$fastread" in
1997 yes) case "\$dflt" in
1998         '') ;;
1999         *) ans='';
2000                 case "\$silent-\$rp" in
2001                 true-) ;;
2002                 *) echo " " >&4;;
2003                 esac;;
2004         esac;;
2005 *) case "\$silent" in
2006         true) case "\$rp" in
2007                 '') ans='';;
2008                 esac;;
2009         esac;;
2010 esac
2011 while expr "X\$ans" : "X!" >/dev/null; do
2012         read answ
2013         set x \$xxxm
2014         shift
2015         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2016         case  "\$answ" in
2017         "!")
2018                 sh 1>&4
2019                 echo " "
2020                 $myecho
2021                 ;;
2022         !*)
2023                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2024                 shift
2025                 sh 1>&4 -c "\$*"
2026                 echo " "
2027                 $myecho
2028                 ;;
2029         "\$ans")
2030                 case "\$ans" in
2031                 \\&*)
2032                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2033                         shift
2034                         case "\$1" in
2035                         -d)
2036                                 fastread=yes
2037                                 echo "(OK, I'll run with -d after this question.)" >&4
2038                                 ;;
2039                         -*)
2040                                 echo "*** Sorry, \$1 not supported yet." >&4
2041                                 ;;
2042                         esac
2043                         $myecho
2044                         ans=!
2045                         ;;
2046                 esac;;
2047         *)
2048                 case "\$aok" in
2049                 y)
2050                         echo "*** Substitution done -- please confirm."
2051                         xxxm="\$ans"
2052                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2053                         xxxm="\$ans"
2054                         ans=!
2055                         ;;
2056                 *)
2057                         echo "*** Error -- try again."
2058                         ans=!
2059                         ;;
2060                 esac
2061                 $myecho
2062                 ;;
2063         esac
2064         case "\$ans\$xxxm\$nostick" in
2065         '')
2066                 ans=!
2067                 $myecho
2068                 ;;
2069         esac
2070 done
2071 case "\$ans" in
2072 '') ans="\$xxxm";;
2073 esac
2074 EOSC
2075
2076 : create .config dir to save info across Configure sessions
2077 test -d ../.config || mkdir ../.config
2078 cat >../.config/README <<EOF
2079 This directory created by Configure to save information that should
2080 persist across sessions for $package.
2081
2082 You may safely delete it if you wish.
2083 EOF
2084
2085 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2086 case "$usedevel" in
2087 $define|true|[yY]*) ;;
2088 *) case "$xversion" in
2089    *[13579])
2090         cat >&4 <<EOH
2091 *** WHOA THERE!!! ***
2092
2093     This is an UNSTABLE DEVELOPMENT release.
2094     The version of this $package distribution is $xversion, that is, odd,
2095     (as opposed to even) and that signifies a development release.
2096     If you want a maintenance release, you want an even-numbered version.
2097
2098     Do ***NOT*** install this into production use.
2099     Data corruption and crashes are possible.
2100
2101     It is most seriously suggested that you do not continue any further
2102     unless you want to help in developing and debugging Perl.
2103
2104     If you *still* want to build perl, you can answer 'y' now,
2105     or pass -Dusedevel to Configure.
2106
2107 EOH
2108         rp='Do you really want to continue?'
2109         dflt='n'
2110         . ./myread
2111         case "$ans" in
2112         [yY]) echo >&4 "Okay, continuing."
2113               usedevel="$define" ;;
2114         *) echo >&4 "Okay, bye."
2115            exit 1
2116            ;;
2117         esac
2118         ;;
2119     esac
2120     ;;
2121 esac
2122 case "$usedevel" in
2123 $define|true|[yY]*)
2124         case "$versiononly" in
2125         '') versiononly="$define" ;;
2126         esac
2127         case "$installusrbinperl" in
2128         '') installusrbinperl="$undef" ;;
2129         esac
2130         ;;
2131 esac
2132
2133 : general instructions
2134 needman=true
2135 firsttime=true
2136 user=`(logname) 2>/dev/null`
2137 case "$user" in
2138 '') user=`whoami 2>&1`;;
2139 esac
2140 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2141         firsttime=false
2142         echo " "
2143         rp='Would you like to see the instructions?'
2144         dflt=n
2145         . ./myread
2146         case "$ans" in
2147         [yY]*) ;;
2148         *) needman=false;;
2149         esac
2150 fi
2151 if $needman; then
2152         cat <<EOH
2153
2154 This installation shell script will examine your system and ask you questions
2155 to determine how the perl5 package should be installed. If you get
2156 stuck on a question, you may use a ! shell escape to start a subshell or
2157 execute a command.  Many of the questions will have default answers in square
2158 brackets; typing carriage return will give you the default.
2159
2160 On some of the questions which ask for file or directory names you are allowed
2161 to use the ~name construct to specify the login directory belonging to "name",
2162 even if you don't have a shell which knows about that.  Questions where this is
2163 allowed will be marked "(~name ok)".
2164
2165 EOH
2166         rp=''
2167         dflt='Type carriage return to continue'
2168         . ./myread
2169         cat <<'EOH'
2170
2171 The prompter used in this script allows you to use shell variables and
2172 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2173 in the default answer, as if the default line was a set of arguments given to a
2174 script shell.  This means you may also use $* to repeat the whole default line,
2175 so you do not have to re-type everything to add something to the default.
2176
2177 Everytime there is a substitution, you will have to confirm.  If there is an
2178 error (e.g. an unmatched backtick), the default answer will remain unchanged
2179 and you will be prompted again.
2180
2181 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2182 the questions and use the computed defaults (or the previous answers if there
2183 was already a config.sh file). Type 'Configure -h' for a list of options.
2184 You may also start interactively and then answer '& -d' at any prompt to turn
2185 on the non-interactive behaviour for the remainder of the execution.
2186
2187 EOH
2188         . ./myread
2189         cat <<EOH
2190
2191 Much effort has been expended to ensure that this shell script will run on any
2192 Unix system.  If despite that it blows up on yours, your best bet is to edit
2193 Configure and run it again.  If you can't run Configure for some reason,
2194 you'll have to generate a config.sh file by hand.  Whatever problems you
2195 have, let me (perlbug@perl.org) know how I blew it.
2196
2197 This installation script affects things in two ways:
2198
2199 1) it may do direct variable substitutions on some of the files included
2200    in this kit.
2201 2) it builds a config.h file for inclusion in C programs.  You may edit
2202    any of these files as the need arises after running this script.
2203
2204 If you make a mistake on a question, there is no easy way to back up to it
2205 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2206 files.  Configure will offer to let you do this before it runs the SH files.
2207
2208 EOH
2209         dflt='Type carriage return to continue'
2210         . ./myread
2211         case "$firsttime" in
2212         true) echo $user >>../.config/instruct;;
2213         esac
2214 fi
2215
2216 : find out where common programs are
2217 echo " "
2218 echo "Locating common programs..." >&4
2219 cat <<EOSC >loc
2220 $startsh
2221 case \$# in
2222 0) exit 1;;
2223 esac
2224 thing=\$1
2225 shift
2226 dflt=\$1
2227 shift
2228 for dir in \$*; do
2229         case "\$thing" in
2230         .)
2231         if test -d \$dir/\$thing; then
2232                 echo \$dir
2233                 exit 0
2234         fi
2235         ;;
2236         *)
2237         for thisthing in \$dir/\$thing; do
2238                 : just loop through to pick last item
2239         done
2240         if test -f \$thisthing; then
2241                 echo \$thisthing
2242                 exit 0
2243         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2244                 echo \$thisthing
2245                 exit 0
2246         elif test -f \$dir/\$thing.exe; then
2247                 if test -n "$DJGPP"; then
2248                         echo \$dir/\$thing.exe
2249                 elif test "$eunicefix" != ":"; then
2250                         : on Eunice apparently
2251                         echo \$dir/\$thing
2252                         exit 0
2253                 fi
2254                 exit 0
2255         fi
2256         ;;
2257         esac
2258 done
2259 echo \$dflt
2260 exit 1
2261 EOSC
2262 chmod +x loc
2263 $eunicefix loc
2264 loclist="
2265 awk
2266 cat
2267 chmod
2268 comm
2269 cp
2270 echo
2271 expr
2272 grep
2273 ls
2274 mkdir
2275 rm
2276 sed
2277 sort
2278 touch
2279 tr
2280 uniq
2281 "
2282 trylist="
2283 Mcc
2284 ar
2285 bison
2286 byacc
2287 cpp
2288 csh
2289 date
2290 egrep
2291 gmake
2292 gzip
2293 less
2294 ln
2295 make
2296 more
2297 nm
2298 nroff
2299 pg
2300 test
2301 uname
2302 zip
2303 "
2304 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2305 pth="$pth /lib /usr/lib"
2306 for file in $loclist; do
2307         eval xxx=\$$file
2308         case "$xxx" in
2309         /*|?:[\\/]*)
2310                 if test -f "$xxx"; then
2311                         : ok
2312                 else
2313                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2314                         xxx=`./loc $file $file $pth`
2315                 fi
2316                 ;;
2317         '') xxx=`./loc $file $file $pth`;;
2318         *) xxx=`./loc $xxx $xxx $pth`;;
2319         esac
2320         eval $file=$xxx$_exe
2321         eval _$file=$xxx
2322         case "$xxx" in
2323         /*)
2324                 echo $file is in $xxx.
2325                 ;;
2326         ?:[\\/]*)
2327                 echo $file is in $xxx.
2328                 ;;
2329         *)
2330                 echo "I don't know where '$file' is, and my life depends on it." >&4
2331                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2332                 exit 1
2333                 ;;
2334         esac
2335 done
2336 echo " "
2337 echo "Don't worry if any of the following aren't found..."
2338 say=offhand
2339 for file in $trylist; do
2340         eval xxx=\$$file
2341         case "$xxx" in
2342         /*|?:[\\/]*)
2343                 if test -f "$xxx"; then
2344                         : ok
2345                 else
2346                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2347                         xxx=`./loc $file $file $pth`
2348                 fi
2349                 ;;
2350         '') xxx=`./loc $file $file $pth`;;
2351         *) xxx=`./loc $xxx $xxx $pth`;;
2352         esac
2353         eval $file=$xxx$_exe
2354         eval _$file=$xxx
2355         case "$xxx" in
2356         /*)
2357                 echo $file is in $xxx.
2358                 ;;
2359         ?:[\\/]*)
2360                 echo $file is in $xxx.
2361                 ;;
2362         *)
2363                 echo "I don't see $file out there, $say."
2364                 say=either
2365                 ;;
2366         esac
2367 done
2368 case "$egrep" in
2369 egrep)
2370         echo "Substituting grep for egrep."
2371         egrep=$grep
2372         _egrep=$grep
2373         ;;
2374 esac
2375 case "$ln" in
2376 ln)
2377         echo "Substituting cp for ln."
2378         ln=$cp
2379         _ln=$cp
2380         ;;
2381 esac
2382 case "$make" in
2383 make)   
2384         case "$gmake" in
2385         gmake)
2386         echo "I can't find make or gmake, and my life depends on it." >&4
2387         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2388         exit 1
2389         ;;
2390         esac
2391         ;;
2392 esac    
2393 case "$gmake" in
2394 gmake)  ;;
2395 *)      # We can't have osname yet.
2396         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2397                 # Assume that gmake, if found, is definitely GNU make
2398                 # and prefer it over the system make.
2399                 echo "Substituting gmake for make."
2400                 make=$gmake
2401                 _make=$gmake
2402         fi
2403         ;;
2404 esac
2405 case "$test" in
2406 test)
2407         echo "Hopefully test is built into your sh."
2408         ;;
2409 *)
2410         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2411                 echo "Using the test built into your sh."
2412                 test=test
2413                 _test=test
2414         fi
2415         ;;
2416 esac
2417 case "$echo" in
2418 echo)
2419         echo "Hopefully echo is built into your sh."
2420         ;;
2421 '') ;;
2422 *)
2423         echo " "
2424 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2425         $echo $n "hi there$c" >foo1
2426         echo $n "hi there$c" >foo2
2427         if cmp foo1 foo2 >/dev/null 2>&1; then
2428                 echo "They are compatible.  In fact, they may be identical."
2429         else
2430                 case "$n" in
2431                 '-n') n='' c='\c';;
2432                 *) n='-n' c='';;
2433                 esac
2434                 cat <<FOO
2435 They are not compatible!  You are probably running ksh on a non-USG system.
2436 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2437 have echo built in and we may have to run some Bourne shell scripts.  That
2438 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2439
2440 FOO
2441                 $echo $n "The star should be here-->$c"
2442                 $echo "*"
2443         fi
2444         $rm -f foo1 foo2
2445         ;;
2446 esac
2447
2448 cat <<EOS >trygcc
2449 $startsh
2450 EOS
2451 cat <<'EOSC' >>trygcc
2452 case "$cc" in
2453 '') ;;
2454 *)  $rm -f try try.*
2455     $cat >try.c <<EOM
2456 int main(int argc, char *argv[]) {
2457   return 0;
2458 }
2459 EOM
2460     if $cc -o try $ccflags $ldflags try.c; then
2461        :
2462     else
2463         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2464         despair=yes
2465         trygcc=yes
2466         case "$cc" in
2467         *gcc*) trygcc=no ;;
2468         esac
2469         case "`$cc -v -c try.c 2>&1`" in
2470         *gcc*) trygcc=no ;;
2471         esac
2472         if $test X"$trygcc" = Xyes; then
2473             if gcc -o try -c try.c; then
2474                 echo " "
2475                 echo "You seem to have a working gcc, though." >&4
2476                 rp="Would you like to use it?"
2477                 dflt=y
2478                 if $test -f myread; then
2479                     . ./myread
2480                 else
2481                     if $test -f UU/myread; then
2482                         . ./UU/myread
2483                     else
2484                         echo "Cannot find myread, sorry.  Aborting." >&2
2485                         exit 1
2486                     fi
2487                 fi  
2488                 case "$ans" in
2489                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2490                        if $test -f usethreads.cbu; then
2491                            $cat >&4 <<EOM 
2492
2493 *** However, any setting of the C compiler flags (e.g. for thread support)
2494 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2495 *** (together with e.g. -Dusethreads).
2496
2497 EOM
2498                        fi;;
2499                 esac
2500             fi
2501         fi
2502     fi
2503     $rm -f try try.*
2504     ;;
2505 esac
2506 EOSC
2507
2508 cat <<EOS >checkcc
2509 $startsh
2510 EOS
2511 cat <<'EOSC' >>checkcc
2512 case "$cc" in        
2513 '') ;;
2514 *)  $rm -f try try.*              
2515     $cat >try.c <<EOM
2516 int main(int argc, char *argv[]) {
2517   return 0;
2518 }
2519 EOM
2520     if $cc -o try $ccflags $ldflags try.c; then
2521        :
2522     else
2523         if $test X"$despair" = Xyes; then
2524            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2525         fi
2526         $cat >&4 <<EOM         
2527 You need to find a working C compiler.
2528 Either (purchase and) install the C compiler supplied by your OS vendor,
2529 or for a free C compiler try http://gcc.gnu.org/
2530 I cannot continue any further, aborting.
2531 EOM
2532         exit 1
2533     fi
2534     $rm -f try try.*
2535     ;;
2536 esac
2537 EOSC
2538
2539 : determine whether symbolic links are supported
2540 echo " "
2541 $touch blurfl
2542 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2543         echo "Symbolic links are supported." >&4
2544         lns="$ln -s"
2545 else
2546         echo "Symbolic links are NOT supported." >&4
2547         lns="$ln"
2548 fi
2549 $rm -f blurfl sym
2550
2551 : determine whether symbolic links are supported
2552 echo " "
2553 case "$lns" in
2554 *"ln"*" -s")
2555         echo "Checking how to test for symbolic links..." >&4
2556         $lns blurfl sym
2557         if $test "X$issymlink" = X; then
2558                 case "$newsh" in
2559                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2560                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2561                 esac
2562                 if test $? = 0; then
2563                         issymlink="test -h"
2564                 else
2565                         echo "Your builtin 'test -h' may be broken." >&4
2566                         case "$test" in
2567                         /*)     ;;
2568                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2569                                 for p in $pth
2570                                 do
2571                                         if test -f "$p/$test"; then
2572                                                 test="$p/$test"
2573                                                 break
2574                                         fi
2575                                 done
2576                                 ;;
2577                         esac
2578                         case "$test" in
2579                         /*)
2580                                 echo "Trying external '$test -h'." >&4
2581                                 issymlink="$test -h"
2582                                 if $test ! -h sym >/dev/null 2>&1; then
2583                                         echo "External '$test -h' is broken, too." >&4
2584                                         issymlink=''
2585                                 fi
2586                                 ;;
2587                         *)      issymlink='' ;;
2588                         esac
2589                 fi              
2590         fi
2591         if $test "X$issymlink" = X; then
2592                 if $test -L sym 2>/dev/null; then
2593                         issymlink="$test -L"
2594                         echo "The builtin '$test -L' worked." >&4
2595                 fi
2596         fi
2597         if $test "X$issymlink" != X; then
2598                 echo "You can test for symbolic links with '$issymlink'." >&4
2599         else
2600                 echo "I do not know how you can test for symbolic links." >&4
2601         fi
2602         $rm -f blurfl sym
2603         ;;
2604 *)      echo "No symbolic links, so not testing for their testing..." >&4
2605         ;;
2606 esac
2607 echo " "
2608
2609
2610 case "$mksymlinks" in
2611 $define|true|[yY]*)
2612         case "$src" in
2613         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2614                 exit 1
2615                 ;;
2616         *)      case "$lns:$issymlink" in
2617                 *"ln"*" -s:"*"test -"?)
2618                         echo "Creating the symbolic links..." >&4
2619                         echo "(First creating the subdirectories...)" >&4
2620                         cd ..
2621                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2622                                 read directory
2623                                 test -z "$directory" && break
2624                                 mkdir -p $directory
2625                         done
2626                         # Sanity check 1.
2627                         if test ! -d t/base; then
2628                                 echo "Failed to create the subdirectories.  Aborting." >&4
2629                                 exit 1
2630                         fi
2631                         echo "(Then creating the symlinks...)" >&4
2632                         awk '{print $1}' $src/MANIFEST | while true; do
2633                                 read filename
2634                                 test -z "$filename" && break
2635                                 if test -f $filename; then
2636                                         if $issymlink $filename; then
2637                                                 rm -f $filename
2638                                         fi
2639                                 fi
2640                                 if test -f $filename; then
2641                                         echo "$filename already exists, not symlinking."
2642                                 else
2643                                         ln -s $src/$filename $filename
2644                                 fi
2645                         done
2646                         # Sanity check 2.
2647                         if test ! -f t/base/lex.t; then
2648                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2649                                 exit 1
2650                         fi
2651                         cd UU
2652                         ;;
2653                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2654                         ;;
2655                 esac
2656                 ;;
2657         esac
2658         ;;
2659 esac
2660
2661
2662 case "$usecrosscompile" in
2663 $define|true|[yY]*)
2664         $echo "Cross-compiling..."
2665         croak=''
2666         case "$cc" in
2667         *-*-gcc) # A cross-compiling gcc, probably.
2668             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2669             ar=$targetarch-ar
2670             # leave out ld, choosing it is more complex
2671             nm=$targetarch-nm
2672             ranlib=$targetarch-ranlib
2673             $echo 'extern int foo;' > try.c
2674             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2675             shift
2676             if $test $# -gt 0; then
2677                 incpth="$incpth $*"
2678                 incpth="`$echo $incpth|$sed 's/^ //'`"
2679                 echo "Guessing incpth '$incpth'." >&4
2680                 for i in $*; do
2681                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2682                     if $test -d $j; then
2683                         libpth="$libpth $j"
2684                     fi
2685                 done   
2686                 libpth="`$echo $libpth|$sed 's/^ //'`"
2687                 echo "Guessing libpth '$libpth'." >&4
2688             fi
2689             $rm -f try.c
2690             ;;
2691         esac
2692         case "$targetarch" in
2693         '') echo "Targetarch not defined." >&4; croak=y ;;
2694         *)  echo "Using targetarch $targetarch." >&4 ;;
2695         esac
2696         case "$incpth" in
2697         '') echo "Incpth not defined." >&4; croak=y ;;
2698         *)  echo "Using incpth '$incpth'." >&4 ;;
2699         esac
2700         case "$libpth" in
2701         '') echo "Libpth not defined." >&4; croak=y ;;
2702         *)  echo "Using libpth '$libpth'." >&4 ;;
2703         esac
2704         case "$usrinc" in
2705         '') for i in $incpth; do
2706                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2707                     usrinc=$i
2708                     echo "Guessing usrinc $usrinc." >&4
2709                     break
2710                 fi
2711             done
2712             case "$usrinc" in
2713             '') echo "Usrinc not defined." >&4; croak=y ;;
2714             esac
2715             ;;
2716         *)  echo "Using usrinc $usrinc." >&4 ;;
2717         esac
2718         case "$targethost" in
2719         '') echo "Targethost not defined." >&4; croak=y ;;
2720         *)  echo "Using targethost $targethost." >&4
2721         esac
2722         locincpth=' '
2723         loclibpth=' '
2724         case "$croak" in
2725         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2726         esac
2727         case "$src" in
2728         /*) run=$src/Cross/run
2729             targetmkdir=$src/Cross/mkdir
2730             to=$src/Cross/to
2731             from=$src/Cross/from
2732             ;;
2733         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2734             run=$pwd/Cross/run
2735             targetmkdir=$pwd/Cross/mkdir
2736             to=$pwd/Cross/to
2737             from=$pwd/Cross/from
2738             ;;
2739         esac
2740         case "$targetrun" in
2741         '') targetrun=ssh ;;
2742         esac
2743         case "$targetto" in
2744         '') targetto=scp ;;
2745         esac
2746         case "$targetfrom" in
2747         '') targetfrom=scp ;;
2748         esac
2749         run=$run-$targetrun
2750         to=$to-$targetto
2751         from=$from-$targetfrom
2752         case "$targetdir" in
2753         '')  targetdir=/tmp
2754              echo "Guessing targetdir $targetdir." >&4
2755              ;;
2756         esac
2757         case "$targetuser" in
2758         '')  targetuser=root
2759              echo "Guessing targetuser $targetuser." >&4
2760              ;;
2761         esac
2762         case "$targetfrom" in
2763         scp)    q=-q ;;
2764         *)      q='' ;;
2765         esac
2766         case "$targetrun" in
2767         ssh|rsh)
2768             cat >$run <<EOF
2769 #!/bin/sh
2770 case "\$1" in
2771 -cwd)
2772   shift
2773   cwd=\$1
2774   shift
2775   ;;
2776 esac
2777 case "\$cwd" in
2778 '') cwd=$targetdir ;;
2779 esac
2780 exe=\$1
2781 shift
2782 if $test ! -f \$exe.xok; then
2783   $to \$exe
2784   $touch \$exe.xok
2785 fi
2786 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2787 EOF
2788             ;;
2789         *)  echo "Unknown targetrun '$targetrun'" >&4
2790             exit 1
2791             ;;
2792         esac
2793         case "$targetmkdir" in
2794         */Cross/mkdir)
2795             cat >$targetmkdir <<EOF
2796 #!/bin/sh
2797 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2798 EOF
2799             $chmod a+rx $targetmkdir
2800             ;;
2801         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2802             exit 1
2803             ;;
2804         esac
2805         case "$targetto" in
2806         scp|rcp)
2807             cat >$to <<EOF
2808 #!/bin/sh
2809 for f in \$@
2810 do
2811   case "\$f" in
2812   /*)
2813     $targetmkdir \`dirname \$f\`
2814     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2815     ;;
2816   *)
2817     $targetmkdir $targetdir/\`dirname \$f\`
2818     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2819     ;;
2820   esac
2821 done
2822 exit 0
2823 EOF
2824             ;;
2825         cp) cat >$to <<EOF
2826 #!/bin/sh
2827 for f in \$@
2828 do
2829   case "\$f" in
2830   /*)
2831     $mkdir -p $targetdir/\`dirname \$f\`
2832     $cp \$f $targetdir/\$f || exit 1
2833     ;;
2834   *)
2835     $targetmkdir $targetdir/\`dirname \$f\`
2836     $cp \$f $targetdir/\$f || exit 1
2837     ;;
2838   esac
2839 done
2840 exit 0
2841 EOF
2842             ;;
2843         *)  echo "Unknown targetto '$targetto'" >&4
2844             exit 1
2845             ;;
2846         esac
2847         case "$targetfrom" in
2848         scp|rcp)
2849           cat >$from <<EOF
2850 #!/bin/sh
2851 for f in \$@
2852 do
2853   $rm -f \$f
2854   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2855 done
2856 exit 0
2857 EOF
2858             ;;
2859         cp) cat >$from <<EOF
2860 #!/bin/sh
2861 for f in \$@
2862 do
2863   $rm -f \$f
2864   cp $targetdir/\$f . || exit 1
2865 done
2866 exit 0
2867 EOF
2868             ;;
2869         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2870             exit 1
2871             ;;
2872         esac
2873         if $test ! -f $run; then
2874             echo "Target 'run' script '$run' not found." >&4
2875         else
2876             $chmod a+rx $run
2877         fi
2878         if $test ! -f $to; then
2879             echo "Target 'to' script '$to' not found." >&4
2880         else
2881             $chmod a+rx $to
2882         fi
2883         if $test ! -f $from; then
2884             echo "Target 'from' script '$from' not found." >&4
2885         else
2886             $chmod a+rx $from
2887         fi
2888         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2889             exit 1
2890         fi
2891         cat >&4 <<EOF
2892 Using '$run' for remote execution,
2893 and '$from' and '$to'
2894 for remote file transfer.
2895 EOF
2896         ;;
2897 *)      run=''
2898         to=:
2899         from=:
2900         usecrosscompile='undef'
2901         targetarch=''
2902         ;;
2903 esac
2904
2905 : see whether [:lower:] and [:upper:] are supported character classes
2906 echo " "
2907 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2908 ABYZ)
2909         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2910         up='[:upper:]'
2911         low='[:lower:]'
2912         ;;
2913 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2914         # (0xd9 and 0xe2), therefore that is a nice testing point.
2915         if test "X$up" = X -o "X$low" = X; then
2916             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2917             rs) up='[A-Z]'
2918                 low='[a-z]'
2919                 ;;
2920             esac
2921         fi
2922         if test "X$up" = X -o "X$low" = X; then
2923             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2924             rs) up='A-Z'
2925                 low='a-z'
2926                 ;;
2927             esac
2928         fi
2929         if test "X$up" = X -o "X$low" = X; then
2930             case "`echo RS | od -x 2>/dev/null`" in
2931             *D9E2*|*d9e2*)
2932                 echo "Hey, this might be EBCDIC." >&4
2933                 if test "X$up" = X -o "X$low" = X; then
2934                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2935                     rs) up='[A-IJ-RS-Z]'
2936                         low='[a-ij-rs-z]'
2937                         ;;
2938                     esac
2939                 fi
2940                 if test "X$up" = X -o "X$low" = X; then
2941                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2942                     rs) up='A-IJ-RS-Z'
2943                         low='a-ij-rs-z'
2944                         ;;
2945                     esac
2946                 fi
2947                 ;;
2948             esac
2949         fi
2950 esac
2951 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2952 rs)
2953     echo "Using $up and $low to convert case." >&4
2954     ;;
2955 *)
2956     echo "I don't know how to translate letters from upper to lower case." >&4
2957     echo "Your tr is not acting any way I know of." >&4
2958     exit 1
2959     ;;
2960 esac
2961 : set up the translation script tr, must be called with ./tr of course
2962 cat >tr <<EOSC
2963 $startsh
2964 case "\$1\$2" in
2965 '[A-Z][a-z]') exec $tr '$up' '$low';;
2966 '[a-z][A-Z]') exec $tr '$low' '$up';;
2967 esac
2968 exec $tr "\$@"
2969 EOSC
2970 chmod +x tr
2971 $eunicefix tr
2972
2973 : Try to determine whether config.sh was made on this system
2974 case "$config_sh" in
2975 '')
2976 myuname=`$uname -a 2>/dev/null`
2977 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2978 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2979 # because the A-Z/a-z are not consecutive.
2980 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2981         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2982 newmyuname="$myuname"
2983 dflt=n
2984 case "$knowitall" in
2985 '')
2986         if test -f ../config.sh; then
2987                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2988                         eval "`grep myuname= ../config.sh`"
2989                 fi
2990                 if test "X$myuname" = "X$newmyuname"; then
2991                         dflt=y
2992                 fi
2993         fi
2994         ;;
2995 *) dflt=y;;
2996 esac
2997
2998 : Get old answers from old config file if Configure was run on the
2999 : same system, otherwise use the hints.
3000 hint=default
3001 cd ..
3002 if test -f config.sh; then
3003         echo " "
3004         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3005         . UU/myread
3006         case "$ans" in
3007         n*|N*) echo "OK, I'll ignore it."
3008                 mv config.sh config.sh.old
3009                 myuname="$newmyuname"
3010                 ;;
3011         *)  echo "Fetching default answers from your old config.sh file..." >&4
3012                 tmp_n="$n"
3013                 tmp_c="$c"
3014                 tmp_sh="$sh"
3015                 . ./config.sh
3016                 cp config.sh UU
3017                 n="$tmp_n"
3018                 c="$tmp_c"
3019                 : Older versions did not always set $sh.  Catch re-use of such
3020                 : an old config.sh.
3021                 case "$sh" in
3022                 '') sh="$tmp_sh" ;;
3023                 esac
3024                 hint=previous
3025                 ;;
3026         esac
3027 fi
3028 . ./UU/checkcc
3029 if test ! -f config.sh; then
3030         $cat <<EOM
3031
3032 First time through, eh?  I have some defaults handy for some systems
3033 that need some extra help getting the Configure answers right:
3034
3035 EOM
3036         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3037         dflt=''
3038         : Half the following guesses are probably wrong... If you have better
3039         : tests or hints, please send them to perlbug@perl.org
3040         : The metaconfig authors would also appreciate a copy...
3041         $test -f /irix && osname=irix
3042         $test -f /xenix && osname=sco_xenix
3043         $test -f /dynix && osname=dynix
3044         $test -f /dnix && osname=dnix
3045         $test -f /lynx.os && osname=lynxos
3046         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3047         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3048         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3049         $test -f /bin/mips && /bin/mips && osname=mips
3050         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3051                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3052         $test -d /usr/apollo/bin && osname=apollo
3053         $test -f /etc/saf/_sactab && osname=svr4
3054         $test -d /usr/include/minix && osname=minix
3055         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3056         if $test -d /MachTen -o -d /MachTen_Folder; then
3057                 osname=machten
3058                 if $test -x /sbin/version; then
3059                         osvers=`/sbin/version | $awk '{print $2}' |
3060                         $sed -e 's/[A-Za-z]$//'`
3061                 elif $test -x /usr/etc/version; then
3062                         osvers=`/usr/etc/version | $awk '{print $2}' |
3063                         $sed -e 's/[A-Za-z]$//'`
3064                 else
3065                         osvers="$2.$3"
3066                 fi
3067         fi
3068
3069         $test -f /sys/posix.dll &&
3070                 $test -f /usr/bin/what &&
3071                 set X `/usr/bin/what /sys/posix.dll` &&
3072                 $test "$3" = UWIN &&
3073                 osname=uwin &&
3074                 osvers="$5"
3075
3076         if $test -f $uname; then
3077                 set X $myuname
3078                 shift
3079
3080                 case "$5" in
3081                 fps*) osname=fps ;;
3082                 mips*)
3083                         case "$4" in
3084                         umips) osname=umips ;;
3085                         *) osname=mips ;;
3086                         esac;;
3087                 [23]100) osname=mips ;;
3088                 next*) osname=next ;;
3089                 i386*)
3090                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3091                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3092                                 osname='sco'
3093                                 osvers=$tmp
3094                         elif $test -f /etc/kconfig; then
3095                                 osname=isc
3096                                 if test "$lns" = "$ln -s"; then
3097                                         osvers=4
3098                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3099                                         osvers=3
3100                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3101                                         osvers=2
3102                                 fi
3103                         fi
3104                         tmp=''
3105                         ;;
3106                 pc*)
3107                         if test -n "$DJGPP"; then
3108                                 osname=dos
3109                                 osvers=djgpp
3110                         fi
3111                         ;;
3112                 esac
3113
3114                 case "$1" in
3115                 aix) osname=aix
3116                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3117                         case "$tmp" in
3118                         # oslevel can fail with:
3119                         # oslevel: Unable to acquire lock.
3120                         *not\ found) osvers="$4"."$3" ;;
3121                         '<3240'|'<>3240') osvers=3.2.0 ;;
3122                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3123                         '=3250'|'>3250') osvers=3.2.5 ;;
3124                         *) osvers=$tmp;;
3125                         esac
3126                         ;;
3127                 bsd386) osname=bsd386
3128                         osvers=`$uname -r`
3129                         ;;
3130                 cygwin*) osname=cygwin
3131                         osvers="$3"
3132                         ;;
3133                 *dc.osx) osname=dcosx
3134                         osvers="$3"
3135                         ;;
3136                 dnix) osname=dnix
3137                         osvers="$3"
3138                         ;;
3139                 domainos) osname=apollo
3140                         osvers="$3"
3141                         ;;
3142                 dgux)   osname=dgux
3143                         osvers="$3"
3144                         ;;
3145                 dragonfly) osname=dragonfly
3146                         osvers="$3"
3147                         ;;
3148                 dynixptx*) osname=dynixptx
3149                         osvers=`echo "$4"|sed 's/^v//'`
3150                         ;;
3151                 freebsd) osname=freebsd
3152                         osvers="$3" ;;
3153                 genix)  osname=genix ;;
3154                 gnu)    osname=gnu
3155                         osvers="$3" ;;
3156                 hp*)    osname=hpux
3157                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3158                         ;;
3159                 irix*)  osname=irix
3160                         case "$3" in
3161                         4*) osvers=4 ;;
3162                         5*) osvers=5 ;;
3163                         *)      osvers="$3" ;;
3164                         esac
3165                         ;;
3166                 linux)  osname=linux
3167                         case "$3" in
3168                         *)      osvers="$3" ;;
3169                         esac
3170                         ;;
3171                 MiNT)   osname=mint
3172                         ;;
3173                 netbsd*) osname=netbsd
3174                         osvers="$3"
3175                         ;;
3176                 news-os) osvers="$3"
3177                         case "$3" in
3178                         4*) osname=newsos4 ;;
3179                         *) osname=newsos ;;
3180                         esac
3181                         ;;
3182                 next*) osname=next ;;
3183                 nonstop-ux) osname=nonstopux ;;
3184                 openbsd) osname=openbsd
3185                         osvers="$3"
3186                         ;;
3187                 os2)    osname=os2
3188                         osvers="$4"
3189                         ;;
3190                 POSIX-BC | posix-bc ) osname=posix-bc
3191                         osvers="$3"
3192                         ;;
3193                 powerux | power_ux | powermax_os | powermaxos | \
3194                 powerunix | power_unix) osname=powerux
3195                         osvers="$3"
3196                         ;;
3197                 qnx) osname=qnx
3198                         osvers="$4"
3199                         ;;
3200                 solaris) osname=solaris
3201                         case "$3" in
3202                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3203                         *)      osvers="$3" ;;
3204                         esac
3205                         ;;
3206                 sunos) osname=sunos
3207                         case "$3" in
3208                         5*) osname=solaris
3209                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3210                         *)      osvers="$3" ;;
3211                         esac
3212                         ;;
3213                 titanos) osname=titanos
3214                         case "$3" in
3215                         1*) osvers=1 ;;
3216                         2*) osvers=2 ;;
3217                         3*) osvers=3 ;;
3218                         4*) osvers=4 ;;
3219                         *)      osvers="$3" ;;
3220                         esac
3221                         ;;
3222                 ultrix) osname=ultrix
3223                         osvers="$3"
3224                         ;;
3225                 osf1|mls+)      case "$5" in
3226                                 alpha)
3227                                         osname=dec_osf
3228                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3229                                         case "$osvers" in
3230                                         [1-9].[0-9]*) ;;
3231                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3232                                         esac
3233                                         ;;
3234                         hp*)    osname=hp_osf1  ;;
3235                         mips)   osname=mips_osf1 ;;
3236                         esac
3237                         ;;
3238                 # UnixWare 7.1.2 is known as Open UNIX 8
3239                 openunix|unixware) osname=svr5
3240                         osvers="$4"
3241                         ;;
3242                 uts)    osname=uts
3243                         osvers="$3"
3244                         ;;
3245                 vos) osvers="$3"
3246                         ;;
3247                 $2) case "$osname" in
3248                         *isc*) ;;
3249                         *freebsd*) ;;
3250                         svr*)
3251                                 : svr4.x or possibly later
3252                                 case "svr$3" in
3253                                 ${osname}*)
3254                                         osname=svr$3
3255                                         osvers=$4
3256                                         ;;
3257                                 esac
3258                                 case "$osname" in
3259                                 svr4.0)
3260                                         : Check for ESIX
3261                                         if test -f /stand/boot ; then
3262                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3263                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3264                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3265                                                         if test -n "$isesix"; then
3266                                                                 osname=esix4
3267                                                         fi
3268                                                 fi
3269                                         fi
3270                                         ;;
3271                                 esac
3272                                 ;;
3273                         *)      if test -f /etc/systemid; then
3274                                         osname=sco
3275                                         set `echo $3 | $sed 's/\./ /g'` $4
3276                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3277                                                 osvers=$1.$2.$3
3278                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3279                                                 osvers=$1.$2
3280                                         elif $test -f $src/hints/sco_$1.sh; then
3281                                                 osvers=$1
3282                                         fi
3283                                 else
3284                                         case "$osname" in
3285                                         '') : Still unknown.  Probably a generic Sys V.
3286                                                 osname="sysv"
3287                                                 osvers="$3"
3288                                                 ;;
3289                                         esac
3290                                 fi
3291                                 ;;
3292                         esac
3293                         ;;
3294                 *)      case "$osname" in
3295                         '') : Still unknown.  Probably a generic BSD.
3296                                 osname="$1"
3297                                 osvers="$3"
3298                                 ;;
3299                         esac
3300                         ;;
3301                 esac
3302         else
3303                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3304                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3305                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3306                                 osname=news_os
3307                         fi
3308                         $rm -f UU/kernel.what
3309                 elif test -d c:/. -o -n "$is_os2" ; then
3310                         set X $myuname
3311                         osname=os2
3312                         osvers="$5"
3313                 fi
3314         fi
3315
3316         case "$targetarch" in
3317         '') ;;
3318         *)  hostarch=$osname
3319             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3320             osvers=''
3321             ;;
3322         esac
3323
3324         : Now look for a hint file osname_osvers, unless one has been
3325         : specified already.
3326         case "$hintfile" in
3327         ''|' ')
3328                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3329                 : Also try without trailing minor version numbers.
3330                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3331                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3332                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3333                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3334                 case "$file" in
3335                 '') dflt=none ;;
3336                 *)  case "$osvers" in
3337                         '') dflt=$file
3338                                 ;;
3339                         *)  if $test -f $src/hints/$file.sh ; then
3340                                         dflt=$file
3341                                 elif $test -f $src/hints/$xfile.sh ; then
3342                                         dflt=$xfile
3343                                 elif $test -f $src/hints/$xxfile.sh ; then
3344                                         dflt=$xxfile
3345                                 elif $test -f $src/hints/$xxxfile.sh ; then
3346                                         dflt=$xxxfile
3347                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3348                                         dflt=$xxxxfile
3349                                 elif $test -f "$src/hints/${osname}.sh" ; then
3350                                         dflt="${osname}"
3351                                 else
3352                                         dflt=none
3353                                 fi
3354                                 ;;
3355                         esac
3356                         ;;
3357                 esac
3358                 if $test -f Policy.sh ; then
3359                         case "$dflt" in
3360                         *Policy*) ;;
3361                         none) dflt="Policy" ;;
3362                         *) dflt="Policy $dflt" ;;
3363                         esac
3364                 fi
3365                 ;;
3366         *)
3367                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3368                 ;;
3369         esac
3370
3371         if $test -f Policy.sh ; then
3372                 $cat <<EOM
3373
3374 There's also a Policy hint file available, which should make the
3375 site-specific (policy) questions easier to answer.
3376 EOM
3377
3378         fi
3379
3380         $cat <<EOM
3381
3382 You may give one or more space-separated answers, or "none" if appropriate.
3383 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3384 is a good thing.  DO NOT give a wrong version or a wrong OS.
3385
3386 EOM
3387
3388         rp="Which of these apply, if any?"
3389         . UU/myread
3390         tans=$ans
3391         for file in $tans; do
3392                 if $test X$file = XPolicy -a -f Policy.sh; then
3393                         . Policy.sh
3394                         $cat Policy.sh >> UU/config.sh
3395                 elif $test -f $src/hints/$file.sh; then
3396                         . $src/hints/$file.sh
3397                         $cat $src/hints/$file.sh >> UU/config.sh
3398                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3399                         : nothing
3400                 else
3401                         : Give one chance to correct a possible typo.
3402                         echo "$file.sh does not exist"
3403                         dflt=$file
3404                         rp="hint to use instead?"
3405                         . UU/myread
3406                         for file in $ans; do
3407                                 if $test -f "$src/hints/$file.sh"; then
3408                                         . $src/hints/$file.sh
3409                                         $cat $src/hints/$file.sh >> UU/config.sh
3410                                 elif $test X$ans = X -o X$ans = Xnone ; then
3411                                         : nothing
3412                                 else
3413                                         echo "$file.sh does not exist -- ignored."
3414                                 fi
3415                         done
3416                 fi
3417         done
3418
3419         hint=recommended
3420         : Remember our hint file for later.
3421         if $test -f "$src/hints/$file.sh" ; then
3422                 hintfile="$file"
3423         else
3424                 hintfile=''
3425         fi
3426 fi
3427 cd UU
3428 ;;
3429 *)
3430         echo " "
3431         echo "Fetching default answers from $config_sh..." >&4
3432         tmp_n="$n"
3433         tmp_c="$c"
3434         cd ..
3435         cp $config_sh config.sh 2>/dev/null
3436         chmod +w config.sh
3437         . ./config.sh
3438         cd UU
3439         cp ../config.sh .
3440         n="$tmp_n"
3441         c="$tmp_c"
3442         hint=previous
3443         ;;
3444 esac
3445 test "$override" && . ./optdef.sh
3446
3447 : Restore computed paths
3448 for file in $loclist $trylist; do
3449         eval $file="\$_$file"
3450 done
3451
3452 cat << EOM
3453
3454 Configure uses the operating system name and version to set some defaults.
3455 The default value is probably right if the name rings a bell. Otherwise,
3456 since spelling matters for me, either accept the default or answer "none"
3457 to leave it blank.
3458
3459 EOM
3460 case "$osname" in
3461         ''|' ')
3462                 case "$hintfile" in
3463                 ''|' '|none) dflt=none ;;
3464                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3465                 esac
3466                 ;;
3467         *) dflt="$osname" ;;
3468 esac
3469 rp="Operating system name?"
3470 . ./myread
3471 case "$ans" in
3472 none)  osname='' ;;
3473 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3474 esac
3475 echo " "
3476 case "$osvers" in
3477         ''|' ')
3478                 case "$hintfile" in
3479                 ''|' '|none) dflt=none ;;
3480                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3481                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3482                         case "$dflt" in
3483                         ''|' ') dflt=none ;;
3484                         esac
3485                         ;;
3486                 esac
3487                 ;;
3488         *) dflt="$osvers" ;;
3489 esac
3490 rp="Operating system version?"
3491 . ./myread
3492 case "$ans" in
3493 none)  osvers='' ;;
3494 *) osvers="$ans" ;;
3495 esac
3496
3497
3498 . ./posthint.sh
3499
3500 : who configured the system
3501 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3502 case "$cf_by" in
3503 "")
3504         cf_by=`(logname) 2>/dev/null`
3505         case "$cf_by" in
3506         "")
3507                 cf_by=`(whoami) 2>/dev/null`
3508                 case "$cf_by" in
3509                 "") cf_by=unknown ;;
3510                 esac ;;
3511         esac ;;
3512 esac
3513
3514 : set up the script used to warn in case of inconsistency
3515 cat <<EOS >whoa
3516 $startsh
3517 EOS
3518 cat <<'EOSC' >>whoa
3519 dflt=y
3520 echo " "
3521 echo "*** WHOA THERE!!! ***" >&4
3522 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3523 rp="    Keep the $hint value?"
3524 . ./myread
3525 case "$ans" in
3526 y) td=$was; tu=$was;;
3527 esac
3528 EOSC
3529
3530 : function used to set $1 to $val
3531 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3532 case "$val$was" in
3533 $define$undef) . ./whoa; eval "$var=\$td";;
3534 $undef$define) . ./whoa; eval "$var=\$tu";;
3535 *) eval "$var=$val";;
3536 esac'
3537
3538 case "$usesocks" in
3539 $define|true|[yY]*)     dflt='y';;
3540 *) dflt='n';;
3541 esac
3542 cat <<EOM
3543
3544 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3545 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3546 to use the PerlIO abstraction layer, this will be implicitly selected.
3547
3548 If this doesn't make any sense to you, just accept the default '$dflt'.
3549 EOM
3550 rp='Build Perl for SOCKS?'
3551 . ./myread
3552 case "$ans" in
3553 y|Y)    val="$define" ;;     
3554 *)      val="$undef" ;;
3555 esac
3556 set usesocks
3557 eval $setvar
3558
3559 case "$usesocks" in
3560 $define|true|[yY]*) useperlio="$define";;
3561 esac
3562
3563 case "$useperlio" in
3564 $define|true|[yY]*|'')  dflt='y';;
3565 *) dflt='n';;
3566 esac
3567 cat <<EOM
3568
3569 Previous version of $package used the standard IO mechanisms as
3570 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3571 alternate IO mechanisms via the PerlIO abstraction layer, but the
3572 stdio mechanism is still available if needed.  The abstraction layer
3573 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3574 Using PerlIO with sfio may cause problems with some extension modules.
3575
3576 If this doesn't make any sense to you, just accept the default '$dflt'.
3577 EOM
3578 rp='Use the PerlIO abstraction layer?'
3579 . ./myread
3580 case "$ans" in
3581 y|Y) 
3582         val="$define"
3583         ;;
3584 *)      
3585         echo "Ok, doing things the stdio way."
3586         val="$undef"
3587         ;;
3588 esac
3589 set useperlio
3590 eval $setvar 
3591
3592 case "$usesocks" in
3593 $define|true|[yY]*)
3594         case "$useperlio" in
3595         $define|true|[yY]*) ;;
3596         *)      cat >&4 <<EOM
3597
3598 You are using the SOCKS proxy protocol library which means that you
3599 should also use the PerlIO layer.  You may be headed for trouble.
3600
3601 EOM
3602                 ;;
3603         esac
3604         ;;
3605 esac
3606
3607         
3608 case "$usethreads" in
3609 $define|true|[yY]*)     dflt='y';;
3610 *)     # Catch case where user specified ithreads or 5005threads but
3611        # forgot -Dusethreads (A.D. 4/2002)
3612        case "$useithreads$use5005threads" in
3613        *$define*)      
3614                 case "$useperlio" in
3615                 "$define")      dflt='y' ;;
3616                 *)              dflt='n' ;;
3617                 esac
3618                 ;;
3619        *)       dflt='n';;
3620        esac
3621        ;;
3622 esac
3623 cat <<EOM
3624
3625 Perl can be built to take advantage of threads on some systems.
3626 To do so, Configure can be run with -Dusethreads.
3627
3628 Note that Perl built with threading support runs slightly slower
3629 and uses more memory than plain Perl. The current implementation
3630 is believed to be stable, but it is fairly new, and so should be
3631 treated with caution.
3632
3633 If this doesn't make any sense to you, just accept the default '$dflt'.
3634 EOM
3635 rp='Build a threading Perl?'
3636 . ./myread
3637 case "$ans" in
3638 y|Y)    val="$define" ;;
3639 *)      val="$undef" ;;
3640 esac
3641 set usethreads
3642 eval $setvar
3643
3644 case "$usethreads" in
3645 $define)
3646         $cat <<EOM
3647
3648 Since release 5.6, Perl has had two different threading implementations,
3649 the newer interpreter-based version (ithreads) with one interpreter per
3650 thread, and the older 5.005 version (5005threads).
3651 The 5005threads version is effectively unmaintained and will probably be
3652 removed in Perl 5.10, so there should be no need to build a Perl using it
3653 unless needed for backwards compatibility with some existing 5.005threads
3654 code.
3655
3656 EOM
3657         : Default to ithreads unless overridden on command line or with
3658         : old config.sh
3659         dflt='y'
3660         case "$use5005threads" in
3661                 $define|true|[yY]*) dflt='n';;
3662         esac
3663         case "$useithreads" in
3664                 $undef|false|[nN]*) dflt='n';;
3665         esac
3666         rp='Use the newer interpreter-based ithreads?'
3667         . ./myread
3668         case "$ans" in
3669         y|Y)    val="$define" ;;
3670         *)      val="$undef" ;;
3671         esac
3672         set useithreads
3673         eval $setvar
3674         : Now set use5005threads to the opposite value.
3675         case "$useithreads" in
3676         $define) val="$undef" ;;
3677         *) val="$define" ;;
3678         esac
3679         set use5005threads
3680         eval $setvar
3681         ;;
3682 *)
3683         useithreads="$undef"
3684         use5005threads="$undef"
3685         ;;
3686 esac
3687
3688 case "$useithreads$use5005threads" in
3689 "$define$define")
3690         $cat >&4 <<EOM
3691
3692 You cannot have both the ithreads and the 5.005 threads enabled
3693 at the same time.  Disabling the 5.005 threads since they are
3694 much less stable than the ithreads.
3695
3696 EOM
3697         use5005threads="$undef"
3698         ;;
3699 esac
3700
3701 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3702         cat >&4 <<EOF
3703 ***
3704 *** To build with ithreads you must also use the PerlIO layer.
3705 *** Cannot continue, aborting.
3706 ***
3707 EOF
3708         exit 1
3709 fi
3710
3711 case "$d_oldpthreads" in
3712 '')     : Configure tests would be welcome here.  For now, assume undef.
3713         val="$undef" ;;
3714 *)      val="$d_oldpthreads" ;;
3715 esac
3716 set d_oldpthreads
3717 eval $setvar
3718
3719
3720 : Look for a hint-file generated 'call-back-unit'.  If the
3721 : user has specified that a threading perl is to be built,
3722 : we may need to set or change some other defaults.
3723 if $test -f usethreads.cbu; then
3724     echo "Your platform has some specific hints regarding threaded builds, using them..."
3725     . ./usethreads.cbu
3726 else
3727     case "$usethreads" in
3728         "$define"|true|[yY]*)
3729                 $cat <<EOM
3730 (Your platform does not have any specific hints for threaded builds.
3731  Assuming POSIX threads, then.)
3732 EOM
3733         ;;
3734     esac
3735 fi
3736
3737 cat <<EOM
3738
3739 Perl can be built so that multiple Perl interpreters can coexist
3740 within the same Perl executable.
3741 EOM
3742
3743 case "$useithreads" in
3744 $define)
3745         cat <<EOM
3746 This multiple interpreter support is required for interpreter-based threads.
3747 EOM
3748         val="$define"
3749         ;;
3750 *)      case "$usemultiplicity" in
3751         $define|true|[yY]*)     dflt='y';;
3752         *) dflt='n';;
3753         esac
3754         echo " "
3755         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3756         rp='Build Perl for multiplicity?'
3757         . ./myread
3758         case "$ans" in
3759         y|Y)    val="$define" ;;
3760         *)      val="$undef" ;;
3761         esac
3762         ;;
3763 esac
3764 set usemultiplicity
3765 eval $setvar
3766
3767
3768 case "$usemorebits" in
3769 "$define"|true|[yY]*)
3770         use64bitint="$define"
3771         uselongdouble="$define"
3772         usemorebits="$define"
3773         ;;
3774 *)      usemorebits="$undef"
3775         ;;
3776 esac
3777
3778 : make some quick guesses about what we are up against
3779 echo " "
3780 $echo $n "Hmm...  $c"
3781 echo exit 1 >bsd
3782 echo exit 1 >usg
3783 echo exit 1 >v7
3784 echo exit 1 >osf1
3785 echo exit 1 >eunice
3786 echo exit 1 >xenix
3787 echo exit 1 >venix
3788 echo exit 1 >os2
3789 d_bsd="$undef"
3790 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3791 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3792 then
3793         echo "Looks kind of like an OSF/1 system, but we'll see..."
3794         echo exit 0 >osf1
3795 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3796         xxx=`./loc addbib blurfl $pth`
3797         if $test -f $xxx; then
3798         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3799                 echo exit 0 >bsd
3800                 echo exit 0 >usg
3801         else
3802                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3803                         echo "Looks kind of like an extended USG system, but we'll see..."
3804                 else
3805                         echo "Looks kind of like a USG system, but we'll see..."
3806                 fi
3807                 echo exit 0 >usg
3808         fi
3809 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3810         echo "Looks kind of like a BSD system, but we'll see..."
3811         d_bsd="$define"
3812         echo exit 0 >bsd
3813 else
3814         echo "Looks kind of like a Version 7 system, but we'll see..."
3815         echo exit 0 >v7
3816 fi
3817 case "$eunicefix" in
3818 *unixtovms*)
3819         $cat <<'EOI'
3820 There is, however, a strange, musty smell in the air that reminds me of
3821 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3822 EOI
3823         echo exit 0 >eunice
3824         d_eunice="$define"
3825 : it so happens the Eunice I know will not run shell scripts in Unix format
3826         ;;
3827 *)
3828         echo " "
3829         echo "Congratulations.  You aren't running Eunice."
3830         d_eunice="$undef"
3831         ;;
3832 esac
3833 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3834 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3835 : semicolon as a patch separator
3836 case "$p_" in
3837 :) ;;
3838 *)
3839         $cat <<'EOI'
3840 I have the feeling something is not exactly right, however...don't tell me...
3841 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3842 (Or you may be running DOS with DJGPP.)
3843 EOI
3844         echo exit 0 >os2
3845         ;;
3846 esac
3847 if test -f /xenix; then
3848         echo "Actually, this looks more like a XENIX system..."
3849         echo exit 0 >xenix
3850         d_xenix="$define"
3851 else
3852         echo " "
3853         echo "It's not Xenix..."
3854         d_xenix="$undef"
3855 fi
3856 chmod +x xenix
3857 $eunicefix xenix
3858 if test -f /venix; then
3859         echo "Actually, this looks more like a VENIX system..."
3860         echo exit 0 >venix
3861 else
3862         echo " "
3863         if ./xenix; then
3864                 : null
3865         else
3866                 echo "Nor is it Venix..."
3867         fi
3868 fi
3869 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3870 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3871 $rm -f foo
3872
3873 case "$cc" in
3874 '') dflt=cc;;
3875 *) dflt="$cc";;
3876 esac
3877 rp="Use which C compiler?"
3878 . ./myread
3879 cc="$ans"
3880
3881 : See if they have not cc but they do have gcc
3882 . ./trygcc
3883 : Look for a hint-file generated 'call-back-unit'.  Now that the
3884 : user has specified the compiler, we may need to set or change some
3885 : other defaults.
3886 if $test -f cc.cbu; then
3887     . ./cc.cbu
3888 fi
3889 . ./checkcc
3890
3891 echo " "
3892 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3893 $cat >try.c <<EOM
3894 #include <stdio.h>
3895 int main() {
3896 #ifdef __GNUC__
3897 #ifdef __VERSION__
3898         printf("%s\n", __VERSION__);
3899 #else
3900         printf("%s\n", "1");
3901 #endif
3902 #endif
3903         return(0);
3904 }
3905 EOM
3906 if $cc -o try $ccflags $ldflags try.c; then
3907         gccversion=`$run ./try`
3908         case "$gccversion" in
3909         '') echo "You are not using GNU cc." ;;
3910         *)  echo "You are using GNU cc $gccversion."
3911             ccname=gcc
3912             ;;
3913         esac
3914 else
3915         echo " "
3916         echo "*** WHOA THERE!!! ***" >&4
3917         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3918         case "$knowitall" in
3919         '')
3920         echo "    You'd better start hunting for one and let me know about it." >&4
3921                 exit 1
3922                 ;;
3923         esac
3924 fi
3925 $rm -f try try.*
3926 case "$gccversion" in
3927 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3928 esac
3929 case "$gccversion" in
3930 '') gccosandvers='' ;;
3931 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3932    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3933    gccshortvers=''
3934    case "$gccosandvers" in
3935    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3936    $osname$osvers) ;; # looking good
3937    $osname*) cat <<EOM >&4
3938
3939 *** WHOA THERE!!! ***
3940
3941     Your gcc has not been compiled for the exact release of
3942     your operating system ($gccosandvers versus $osname$osvers).
3943
3944     In general it is a good idea to keep gcc synchronized with
3945     the operating system because otherwise serious problems
3946     may ensue when trying to compile software, like Perl.
3947
3948     I'm trying to be optimistic here, though, and will continue.
3949     If later during the configuration and build icky compilation
3950     problems appear (headerfile conflicts being the most common
3951     manifestation), I suggest reinstalling the gcc to match
3952     your operating system release.
3953
3954 EOM
3955       ;;
3956    *) gccosandvers='' ;; # failed to parse, better be silent
3957    esac
3958    ;;
3959 esac
3960 case "$ccname" in
3961 '') ccname="$cc" ;;
3962 esac
3963
3964 # gcc 3.* complain about adding -Idirectories that they already know about,
3965 # so we will take those off from locincpth.
3966 case "$gccversion" in
3967 3*)
3968     echo "main(){}">try.c
3969     for incdir in $locincpth; do
3970        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3971              grep '^c[cp]p*[01]: warning: changing search order '`
3972        if test "X$warn" != X; then
3973            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3974        fi
3975     done
3976     $rm -f try try.*
3977 esac
3978
3979 : decide how portable to be.  Allow command line overrides.
3980 case "$d_portable" in
3981 "$undef") ;;
3982 *)      d_portable="$define" ;;
3983 esac
3984
3985 : set up shell script to do ~ expansion
3986 cat >filexp <<EOSS
3987 $startsh
3988 : expand filename
3989 case "\$1" in
3990  ~/*|~)
3991         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3992         ;;
3993  ~*)
3994         if $test -f /bin/csh; then
3995                 /bin/csh -f -c "glob \$1"
3996                 failed=\$?
3997                 echo ""
3998                 exit \$failed
3999         else
4000                 name=\`$expr x\$1 : '..\([^/]*\)'\`
4001                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
4002                 if $test ! -d "\$dir"; then
4003                         me=\`basename \$0\`
4004                         echo "\$me: can't locate home directory for: \$name" >&2
4005                         exit 1
4006                 fi
4007                 case "\$1" in
4008                 */*)
4009                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4010                         ;;
4011                 *)
4012                         echo \$dir
4013                         ;;
4014                 esac
4015         fi
4016         ;;
4017 *)
4018         echo \$1
4019         ;;
4020 esac
4021 EOSS
4022 chmod +x filexp
4023 $eunicefix filexp
4024
4025 : now set up to get a file name
4026 cat <<EOS >getfile
4027 $startsh
4028 EOS
4029 cat <<'EOSC' >>getfile
4030 tilde=''
4031 fullpath=''
4032 already=''
4033 skip=''
4034 none_ok=''
4035 exp_file=''
4036 nopath_ok=''
4037 orig_rp="$rp"
4038 orig_dflt="$dflt"
4039 case "$gfpth" in
4040 '') gfpth='.' ;;
4041 esac
4042
4043 case "$fn" in
4044 *\(*)
4045         : getfile will accept an answer from the comma-separated list
4046         : enclosed in parentheses even if it does not meet other criteria.
4047         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4048         fn=`echo $fn | sed 's/(.*)//'`
4049         ;;
4050 esac
4051
4052 case "$fn" in
4053 *:*)
4054         loc_file=`expr $fn : '.*:\(.*\)'`
4055         fn=`expr $fn : '\(.*\):.*'`
4056         ;;
4057 esac
4058
4059 case "$fn" in
4060 *~*) tilde=true;;
4061 esac
4062 case "$fn" in
4063 */*) fullpath=true;;
4064 esac
4065 case "$fn" in
4066 *+*) skip=true;;
4067 esac
4068 case "$fn" in
4069 *n*) none_ok=true;;
4070 esac
4071 case "$fn" in
4072 *e*) exp_file=true;;
4073 esac
4074 case "$fn" in
4075 *p*) nopath_ok=true;;
4076 esac
4077
4078 case "$fn" in
4079 *f*) type='File';;
4080 *d*) type='Directory';;
4081 *l*) type='Locate';;
4082 esac
4083
4084 what="$type"
4085 case "$what" in
4086 Locate) what='File';;
4087 esac
4088
4089 case "$exp_file" in
4090 '')
4091         case "$d_portable" in
4092         "$define") ;;
4093         *) exp_file=true;;
4094         esac
4095         ;;
4096 esac
4097
4098 cd ..
4099 while test "$type"; do
4100         redo=''
4101         rp="$orig_rp"
4102         dflt="$orig_dflt"
4103         case "$tilde" in
4104         true) rp="$rp (~name ok)";;
4105         esac
4106         . UU/myread
4107         if test -f UU/getfile.ok && \
4108                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4109         then
4110                 value="$ans"
4111                 ansexp="$ans"
4112                 break
4113         fi
4114         case "$ans" in
4115         none)
4116                 value=''
4117                 ansexp=''
4118                 case "$none_ok" in
4119                 true) type='';;
4120                 esac
4121                 ;;
4122         *)
4123                 case "$tilde" in
4124                 '') value="$ans"
4125                         ansexp="$ans";;
4126                 *)
4127                         value=`UU/filexp $ans`
4128                         case $? in
4129                         0)
4130                                 if test "$ans" != "$value"; then
4131                                         echo "(That expands to $value on this system.)"
4132                                 fi
4133                                 ;;
4134                         *) value="$ans";;
4135                         esac
4136                         ansexp="$value"
4137                         case "$exp_file" in
4138                         '') value="$ans";;
4139                         esac
4140                         ;;
4141                 esac
4142                 case "$fullpath" in
4143                 true)
4144                         case "$ansexp" in
4145                         /*) value="$ansexp" ;;
4146                         [a-zA-Z]:/*) value="$ansexp" ;;
4147                         *)
4148                                 redo=true
4149                                 case "$already" in
4150                                 true)
4151                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4152                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4153                                         ;;
4154                                 *)
4155                                 echo "Please give a full path name, starting with slash." >&4
4156                                         case "$tilde" in
4157                                         true)
4158                                 echo "Note that using ~name is ok provided it expands well." >&4
4159                                                 already=true
4160                                                 ;;
4161                                         esac
4162                                 esac
4163                                 ;;
4164                         esac
4165                         ;;
4166                 esac
4167                 case "$redo" in
4168                 '')
4169                         case "$type" in
4170                         File)
4171                                 for fp in $gfpth; do
4172                                         if test "X$fp" = X.; then
4173                                             pf="$ansexp"
4174                                         else    
4175                                             pf="$fp/$ansexp"
4176                                         fi
4177                                         if test -f "$pf"; then
4178                                                 type=''
4179                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4180                                         then
4181                                                 echo "($value is not a plain file, but that's ok.)"
4182                                                 type=''
4183                                         fi
4184                                         if test X"$type" = X; then
4185                                             value="$pf"
4186                                             break
4187                                         fi
4188                                 done
4189                                 ;;
4190                         Directory)
4191                                 for fp in $gfpth; do
4192                                         if test "X$fp" = X.; then
4193                                             dir="$ans"
4194                                             direxp="$ansexp"
4195                                         else    
4196                                             dir="$fp/$ansexp"
4197                                             direxp="$fp/$ansexp"
4198                                         fi
4199                                         if test -d "$direxp"; then
4200                                                 type=''
4201                                                 value="$dir"
4202                                                 break
4203                                         fi
4204                                 done
4205                                 ;;
4206                         Locate)
4207                                 if test -d "$ansexp"; then
4208                                         echo "(Looking for $loc_file in directory $value.)"
4209                                         value="$value/$loc_file"
4210                                         ansexp="$ansexp/$loc_file"
4211                                 fi
4212                                 if test -f "$ansexp"; then
4213                                         type=''
4214                                 fi
4215                                 case "$nopath_ok" in
4216                                 true)   case "$value" in
4217                                         */*) ;;
4218                                         *)      echo "Assuming $value will be in people's path."
4219                                                 type=''
4220                                                 ;;
4221                                         esac
4222                                         ;;
4223                                 esac
4224                                 ;;
4225                         esac
4226
4227                         case "$skip" in
4228                         true) type='';
4229                         esac
4230
4231                         case "$type" in
4232                         '') ;;
4233                         *)
4234                                 if test "$fastread" = yes; then
4235                                         dflt=y
4236                                 else
4237                                         dflt=n
4238                                 fi
4239                                 rp="$what $value doesn't exist.  Use that name anyway?"
4240                                 . UU/myread
4241                                 dflt=''
4242                                 case "$ans" in
4243                                 y*) type='';;
4244                                 *) echo " ";;
4245                                 esac
4246                                 ;;
4247                         esac
4248                         ;;
4249                 esac
4250                 ;;
4251         esac
4252 done
4253 cd UU
4254 ans="$value"
4255 rp="$orig_rp"
4256 dflt="$orig_dflt"
4257 rm -f getfile.ok
4258 test "X$gfpthkeep" != Xy && gfpth=""
4259 EOSC
4260
4261 : What should the include directory be ?
4262 echo " "
4263 $echo $n "Hmm...  $c"
4264 dflt='/usr/include'
4265 incpath=''
4266 mips_type=''
4267 if $test -f /bin/mips && /bin/mips; then
4268         echo "Looks like a MIPS system..."
4269         $cat >usr.c <<'EOCP'
4270 #ifdef SYSTYPE_BSD43
4271 /bsd43
4272 #endif
4273 EOCP
4274         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4275                 dflt='/bsd43/usr/include'
4276                 incpath='/bsd43'
4277                 mips_type='BSD 4.3'
4278         else
4279                 mips_type='System V'
4280         fi
4281         $rm -f usr.c usr.out
4282         echo "and you're compiling with the $mips_type compiler and libraries."
4283         xxx_prompt=y
4284         echo "exit 0" >mips
4285 else
4286         echo "Doesn't look like a MIPS system."
4287         xxx_prompt=n
4288         echo "exit 1" >mips
4289 fi
4290 chmod +x mips
4291 $eunicefix mips
4292 case "$usrinc" in
4293 '') ;;
4294 *) dflt="$usrinc";;
4295 esac
4296 case "$xxx_prompt" in
4297 y)      fn=d/
4298         echo " "
4299         rp='Where are the include files you want to use?'
4300         . ./getfile
4301         usrinc="$ans"
4302         ;;
4303 *)      usrinc="$dflt"
4304         ;;
4305 esac
4306
4307 : see how we invoke the C preprocessor
4308 echo " "
4309 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4310 cat <<'EOT' >testcpp.c
4311 #define ABC abc
4312 #define XYZ xyz
4313 ABC.XYZ
4314 EOT
4315 cd ..
4316 if test ! -f cppstdin; then
4317         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4318                 # AIX cc -E doesn't show the absolute headerfile
4319                 # locations but we'll cheat by using the -M flag.
4320                 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
4321         else
4322                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4323         fi
4324 else
4325         echo "Keeping your $hint cppstdin wrapper."
4326 fi
4327 chmod 755 cppstdin
4328 wrapper=`pwd`/cppstdin
4329 ok='false'
4330 cd UU
4331
4332 if $test "X$cppstdin" != "X" && \
4333         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4335 then
4336         echo "You used to use $cppstdin $cppminus so we'll use that again."
4337         case "$cpprun" in
4338         '') echo "But let's see if we can live without a wrapper..." ;;
4339         *)
4340                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4341                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4342                 then
4343                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4344                         ok='true'
4345                 else
4346                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4347                 fi
4348                 ;;
4349         esac
4350 else
4351         case "$cppstdin" in
4352         '') ;;
4353         *)
4354                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4355                 ;;
4356         esac
4357 fi
4358
4359 if $ok; then
4360         : nothing
4361 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4362         $cc -E <testcpp.c >testcpp.out 2>&1; \
4363         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4364         echo "Yup, it does."
4365         x_cpp="$cc -E"
4366         x_minus='';
4367 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4368         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4369         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4370         echo "Yup, it does."
4371         x_cpp="$cc -E"
4372         x_minus='-';
4373 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4374         $cc -P <testcpp.c >testcpp.out 2>&1; \
4375         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4376         echo "Yipee, that works!"
4377         x_cpp="$cc -P"
4378         x_minus='';
4379 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4380         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4381         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4382         echo "At long last!"
4383         x_cpp="$cc -P"
4384         x_minus='-';
4385 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4386         $cpp <testcpp.c >testcpp.out 2>&1; \
4387         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4388         echo "It works!"
4389         x_cpp="$cpp"
4390         x_minus='';
4391 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4392         $cpp - <testcpp.c >testcpp.out 2>&1; \
4393         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4394         echo "Hooray, it works!  I was beginning to wonder."
4395         x_cpp="$cpp"
4396         x_minus='-';
4397 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4398         $wrapper <testcpp.c >testcpp.out 2>&1; \
4399         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4400         x_cpp="$wrapper"
4401         x_minus=''
4402         echo "Eureka!"
4403 else
4404         dflt=''
4405         rp="No dice.  I can't find a C preprocessor.  Name one:"
4406         . ./myread
4407         x_cpp="$ans"
4408         x_minus=''
4409         $x_cpp <testcpp.c >testcpp.out 2>&1
4410         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4411                 echo "OK, that will do." >&4
4412         else
4413 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4414                 exit 1
4415         fi
4416 fi
4417
4418 case "$ok" in
4419 false)
4420         cppstdin="$x_cpp"
4421         cppminus="$x_minus"
4422         cpprun="$x_cpp"
4423         cpplast="$x_minus"
4424         set X $x_cpp
4425         shift
4426         case "$1" in
4427         "$cpp")
4428                 echo "Perhaps can we force $cc -E using a wrapper..."
4429                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4430                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4431                 then
4432                         echo "Yup, we can."
4433                         cppstdin="$wrapper"
4434                         cppminus='';
4435                 else
4436                         echo "Nope, we'll have to live without it..."
4437                 fi
4438                 ;;
4439         esac
4440         case "$cpprun" in
4441         "$wrapper")
4442                 cpprun=''
4443                 cpplast=''
4444                 ;;
4445         esac
4446         ;;
4447 esac
4448
4449 case "$cppstdin" in
4450 "$wrapper"|'cppstdin') ;;
4451 *) $rm -f $wrapper;;
4452 esac
4453 $rm -f testcpp.c testcpp.out
4454
4455 : Set private lib path
4456 case "$plibpth" in
4457 '') if ./mips; then
4458                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4459         fi;;
4460 esac
4461 case "$libpth" in
4462 ' ') dlist='';;
4463 '') dlist="$loclibpth $plibpth $glibpth";;
4464 *) dlist="$libpth";;
4465 esac
4466
4467 : Now check and see which directories actually exist, avoiding duplicates
4468 libpth=''
4469 for xxx in $dlist
4470 do
4471     if $test -d $xxx; then
4472                 case " $libpth " in
4473                 *" $xxx "*) ;;
4474                 *) libpth="$libpth $xxx";;
4475                 esac
4476     fi
4477 done
4478 $cat <<'EOM'
4479
4480 Some systems have incompatible or broken versions of libraries.  Among
4481 the directories listed in the question below, please remove any you
4482 know not to be holding relevant libraries, and add any that are needed.
4483 Say "none" for none.
4484
4485 EOM
4486 case "$libpth" in
4487 '') dflt='none';;
4488 *)
4489         set X $libpth
4490         shift
4491         dflt=${1+"$@"}
4492         ;;
4493 esac
4494 rp="Directories to use for library searches?"
4495 . ./myread
4496 case "$ans" in
4497 none) libpth=' ';;
4498 *) libpth="$ans";;
4499 esac
4500
4501 : compute shared library extension
4502 case "$so" in
4503 '')
4504         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4505                 dflt='sl'
4506         else
4507                 dflt='so'
4508         fi
4509         ;;
4510 *) dflt="$so";;
4511 esac
4512 $cat <<EOM
4513
4514 On some systems, shared libraries may be available.  Answer 'none' if
4515 you want to suppress searching of shared libraries for the remainder
4516 of this configuration.
4517
4518 EOM
4519 rp='What is the file extension used for shared libraries?'
4520 . ./myread
4521 so="$ans"
4522
4523 : Define several unixisms.
4524 : Hints files or command line option can be used to override them.
4525 : The convoluted testing is in case hints files set either the old
4526 : or the new name.
4527 case "$_exe" in
4528 '')     case "$exe_ext" in
4529         '')     ;;
4530         *)      _exe="$exe_ext" ;;
4531         esac
4532         ;;
4533 esac
4534 case "$_a" in
4535 '')     case "$lib_ext" in
4536     '') _a='.a';;
4537         *)      _a="$lib_ext" ;;
4538         esac
4539         ;;
4540 esac
4541 case "$_o" in
4542 '') case "$obj_ext" in
4543         '')     _o='.o';;
4544         *)      _o="$obj_ext";;
4545         esac
4546         ;;
4547 esac
4548 case "$p_" in
4549 '') case "$path_sep" in
4550         '')     p_=':';;
4551         *)      p_="$path_sep";;
4552         esac
4553         ;;
4554 esac
4555 exe_ext=$_exe
4556 lib_ext=$_a
4557 obj_ext=$_o
4558 path_sep=$p_
4559
4560 : Which makefile gets called first.  This is used by make depend.
4561 case "$firstmakefile" in
4562 '') firstmakefile='makefile';;
4563 esac
4564
4565 case "$ccflags" in
4566 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4567 esac
4568
4569 case "$uselongdouble" in
4570 $define|true|[yY]*)     dflt='y';;
4571 *) dflt='n';;
4572 esac
4573 cat <<EOM
4574
4575 Perl can be built to take advantage of long doubles which
4576 (if available) may give more accuracy and range for floating point numbers.
4577
4578 If this doesn't make any sense to you, just accept the default '$dflt'.
4579 EOM
4580 rp='Try to use long doubles if available?'
4581 . ./myread
4582 case "$ans" in
4583 y|Y)    val="$define"   ;;
4584 *)      val="$undef"    ;;
4585 esac
4586 set uselongdouble
4587 eval $setvar
4588
4589 case "$uselongdouble" in
4590 true|[yY]*) uselongdouble="$define" ;;
4591 esac
4592
4593 : Look for a hint-file generated 'call-back-unit'.  If the
4594 : user has specified that long doubles should be used,
4595 : we may need to set or change some other defaults.
4596 if $test -f uselongdouble.cbu; then
4597     echo "Your platform has some specific hints regarding long doubles, using them..."
4598     . ./uselongdouble.cbu
4599 else
4600     case "$uselongdouble" in
4601         $define)
4602                 $cat <<EOM
4603 (Your platform does not have any specific hints for long doubles.)
4604 EOM
4605         ;;
4606     esac
4607 fi
4608
4609 : Looking for optional libraries
4610 echo " "
4611 echo "Checking for optional libraries..." >&4
4612 case "$libs" in
4613 ' '|'') dflt='';;
4614 *) dflt="$libs";;
4615 esac
4616 case "$libswanted" in
4617 '') libswanted='c_s';;
4618 esac
4619 case "$usesocks" in
4620 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4621 esac
4622 libsfound=''
4623 libsfiles=''
4624 libsdirs=''
4625 libspath=''
4626 for thisdir in $libpth $xlibpth; do
4627   test -d $thisdir && libspath="$libspath $thisdir"
4628 done
4629 for thislib in $libswanted; do
4630         for thisdir in $libspath; do
4631             xxx=''
4632             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4633                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4634                 $test -f "$xxx" && eval $libscheck
4635                 $test -f "$xxx" && libstyle=shared
4636             fi
4637             if test ! -f "$xxx"; then
4638                 xxx=$thisdir/lib$thislib.$so
4639                 $test -f "$xxx" && eval $libscheck
4640                 $test -f "$xxx" && libstyle=shared
4641             fi  
4642             if test ! -f "$xxx"; then
4643                 xxx=$thisdir/lib$thislib$_a
4644                 $test -f "$xxx" && eval $libscheck
4645                 $test -f "$xxx" && libstyle=static
4646             fi
4647             if test ! -f "$xxx"; then
4648                 xxx=$thisdir/$thislib$_a
4649                 $test -f "$xxx" && eval $libscheck
4650                 $test -f "$xxx" && libstyle=static
4651             fi
4652             if test ! -f "$xxx"; then
4653                 xxx=$thisdir/lib${thislib}_s$_a
4654                 $test -f "$xxx" && eval $libscheck
4655                 $test -f "$xxx" && libstyle=static
4656                 $test -f "$xxx" && thislib=${thislib}_s
4657             fi
4658             if test ! -f "$xxx"; then
4659                 xxx=$thisdir/Slib$thislib$_a
4660                 $test -f "$xxx" && eval $libscheck
4661                 $test -f "$xxx" && libstyle=static
4662             fi
4663             if $test -f "$xxx"; then
4664                 case "$libstyle" in
4665                 shared) echo "Found -l$thislib (shared)." ;;
4666                 static) echo "Found -l$thislib." ;;
4667                 *)      echo "Found -l$thislib ($libstyle)." ;;
4668                 esac
4669                 case " $dflt " in
4670                 *"-l$thislib "*);;
4671                 *) dflt="$dflt -l$thislib"
4672                    libsfound="$libsfound $xxx"
4673                    yyy=`basename $xxx`
4674                    libsfiles="$libsfiles $yyy"
4675                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4676                    case " $libsdirs " in
4677                    *" $yyy "*) ;;
4678                    *) libsdirs="$libsdirs $yyy" ;;
4679                    esac
4680                    ;;
4681                 esac
4682                 break
4683             fi  
4684         done
4685         if $test ! -f "$xxx"; then
4686             echo "No -l$thislib."
4687         fi
4688 done
4689 set X $dflt
4690 shift
4691 dflt="$*"
4692 case "$libs" in
4693 '') dflt="$dflt";;
4694 *) dflt="$libs";;
4695 esac
4696 case "$dflt" in
4697 ' '|'') dflt='none';;
4698 esac
4699
4700 $cat <<EOM
4701
4702 In order to compile $package on your machine, a number of libraries
4703 are usually needed.  Include any other special libraries here as well.
4704 Say "none" for none.  The default list is almost always right.
4705 EOM
4706
4707 echo " "
4708 rp="What libraries to use?"
4709 . ./myread
4710 case "$ans" in
4711 none) libs=' ';;
4712 *) libs="$ans";;
4713 esac
4714
4715 : determine optimization, if desired, or use for debug flag also
4716 case "$optimize" in
4717 ' '|$undef) dflt='none';;
4718 '') dflt='-O';;
4719 *) dflt="$optimize";;
4720 esac
4721 $cat <<EOH
4722
4723 By default, $package compiles with the -O flag to use the optimizer.
4724 Alternately, you might want to use the symbolic debugger, which uses
4725 the -g flag (on traditional Unix systems).  Either flag can be
4726 specified here.  To use neither flag, specify the word "none".
4727
4728 EOH
4729 rp="What optimizer/debugger flag should be used?"
4730 . ./myread
4731 optimize="$ans"
4732 case "$optimize" in
4733 'none') optimize=" ";;
4734 esac
4735
4736 dflt=''
4737 : We will not override a previous value, but we might want to
4738 : augment a hint file
4739 case "$hint" in
4740 default|recommended)
4741         case "$gccversion" in
4742         1*) dflt='-fpcc-struct-return' ;;
4743         esac
4744         case "$optimize" in
4745         *-g*) dflt="$dflt -DDEBUGGING";;
4746         esac
4747         case "$gccversion" in
4748         2*) if test -d /etc/conf/kconfig.d &&
4749                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4750                 then
4751                         # Interactive Systems (ISC) POSIX mode.
4752                         dflt="$dflt -posix"
4753                 fi
4754                 ;;
4755         esac
4756         case "$gccversion" in
4757         1*) ;;
4758         2.[0-8]*) ;;
4759         ?*)     echo " "
4760                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4761                 echo 'int main(void) { return 0; }' > gcctest.c
4762                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4763                         echo "Yes, it does." 2>&1
4764                         case "$ccflags" in
4765                         *strict-aliasing*)
4766                                 echo "Leaving current flags $ccflags alone." 2>&1
4767                                 ;;
4768                         *) dflt="$dflt -fno-strict-aliasing" ;;
4769                         esac
4770                 else
4771                         echo "Nope, it doesn't, but that's ok." 2>&1
4772                 fi
4773                 ;;
4774         esac
4775         # For gcc, adding -pipe speeds up compilations for some, but apparently
4776         # some assemblers can't read from stdin.  (It also slows down compilations
4777         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4778         case "$gccversion" in
4779         ?*)     echo " "
4780                 echo "Checking if your compiler accepts -pipe" 2>&1
4781                 echo 'int main(void) { return 0; }' > gcctest.c
4782                 if $cc -pipe -o gcctest gcctest.c; then
4783                         echo "Yes, it does." 2>&1
4784                         case "$ccflags" in
4785                         *-pipe*)
4786                                 echo "Leaving current flags $ccflags alone." 2>&1
4787                                 ;;
4788                         *) dflt="$dflt -pipe" ;;
4789                         esac
4790                 else
4791                         echo "Nope, it doesn't, but that's ok." 2>&1
4792                 fi
4793
4794                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4795                 echo 'int main(void) { return 0; }' > gcctest.c
4796                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4797                         echo "Yes, it does." 2>&1
4798                         case "$ccflags" in
4799                         *-Wdeclaration-after-statement*)
4800                                 echo "Leaving current flags $ccflags alone." 2>&1
4801                                 ;;
4802                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4803                         esac
4804                 else
4805                         echo "Nope, it doesn't, but that's ok." 2>&1
4806                 fi
4807                 ;;
4808         esac
4809         ;;
4810 esac
4811
4812 case "$mips_type" in
4813 *BSD*|'') inclwanted="$locincpth $usrinc";;
4814 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4815 esac
4816 for thisincl in $inclwanted; do
4817         if $test -d $thisincl; then
4818                 if $test x$thisincl != x$usrinc; then
4819                         case "$dflt" in
4820                         *" -I$thisincl "*);;
4821                         *) dflt="$dflt -I$thisincl ";;
4822                         esac
4823                 fi
4824         fi
4825 done
4826
4827 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4828         xxx=true;
4829 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4830         xxx=true;
4831 else
4832         xxx=false;
4833 fi;
4834 if $xxx; then
4835         case "$dflt" in
4836         *$2*);;
4837         *) dflt="$dflt -D$2";;
4838         esac;
4839 fi'
4840
4841 set signal.h LANGUAGE_C; eval $inctest
4842
4843 case "$usesocks" in
4844 $define)
4845         ccflags="$ccflags -DSOCKS"
4846         ;;
4847 esac
4848
4849 case "$hint" in
4850 default|recommended) dflt="$ccflags $dflt" ;;
4851 *) dflt="$ccflags";;
4852 esac
4853
4854 case "$dflt" in
4855 ''|' ') dflt=none;;
4856 esac
4857
4858 $cat <<EOH
4859
4860 Your C compiler may want other flags.  For this question you should include
4861 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4862 but you should NOT include libraries or ld flags like -lwhatever.  If you
4863 want $package to honor its debug switch, you should include -DDEBUGGING here.
4864 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4865
4866 To use no flags, specify the word "none".
4867
4868 EOH
4869 set X $dflt
4870 shift
4871 dflt=${1+"$@"}
4872 rp="Any additional cc flags?"
4873 . ./myread
4874 case "$ans" in
4875 none) ccflags='';;
4876 *) ccflags="$ans";;
4877 esac
4878
4879 : the following weeds options from ccflags that are of no interest to cpp
4880 case "$cppflags" in
4881 '') cppflags="$ccflags" ;;
4882 *)  cppflags="$cppflags $ccflags" ;;
4883 esac
4884 case "$gccversion" in
4885 1*) cppflags="$cppflags -D__GNUC__"
4886 esac
4887 case "$mips_type" in
4888 '');;
4889 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4890 esac
4891 case "$cppflags" in
4892 '');;
4893 *)
4894         echo " "
4895         echo "Let me guess what the preprocessor flags are..." >&4
4896         set X $cppflags
4897         shift
4898         cppflags=''
4899         $cat >cpp.c <<'EOM'
4900 #define BLURFL foo
4901
4902 BLURFL xx LFRULB
4903 EOM
4904         previous=''
4905         for flag in $*
4906         do
4907                 case "$flag" in
4908                 -*) ftry="$flag";;
4909                 *) ftry="$previous $flag";;
4910                 esac
4911                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4912                         >cpp1.out 2>/dev/null && \
4913                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4914                         >cpp2.out 2>/dev/null && \
4915                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4916                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4917                 then
4918                         cppflags="$cppflags $ftry"
4919                         previous=''
4920                 else
4921                         previous="$flag"
4922                 fi
4923         done
4924         set X $cppflags
4925         shift
4926         cppflags=${1+"$@"}
4927         case "$cppflags" in
4928         *-*)  echo "They appear to be: $cppflags";;
4929         esac
4930         $rm -f cpp.c cpp?.out
4931         ;;
4932 esac
4933
4934 : flags used in final linking phase
4935 case "$ldflags" in
4936 '') if ./venix; then
4937                 dflt='-i -z'
4938         else
4939                 dflt=''
4940         fi
4941         case "$ccflags" in
4942         *-posix*) dflt="$dflt -posix" ;;
4943         esac
4944         ;;
4945 *) dflt="$ldflags";;
4946 esac
4947
4948 : Try to guess additional flags to pick up local libraries.
4949 for thislibdir in $libpth; do
4950         case " $loclibpth " in
4951         *" $thislibdir "*)
4952                 case "$dflt " in
4953                 *"-L$thislibdir "*) ;;
4954                 *)  dflt="$dflt -L$thislibdir" ;;
4955                 esac
4956                 ;;
4957         esac
4958 done
4959
4960 case "$dflt" in
4961 '') dflt='none' ;;
4962 esac
4963
4964 $cat <<EOH
4965
4966 Your C linker may need flags.  For this question you should
4967 include -L/whatever and any other flags used by the C linker, but you
4968 should NOT include libraries like -lwhatever.
4969
4970 Make sure you include the appropriate -L/path flags if your C linker
4971 does not normally search all of the directories you specified above,
4972 namely
4973         $libpth
4974 To use no flags, specify the word "none".
4975
4976 EOH
4977
4978 rp="Any additional ld flags (NOT including libraries)?"
4979 . ./myread
4980 case "$ans" in
4981 none) ldflags='';;
4982 *) ldflags="$ans";;
4983 esac
4984 rmlist="$rmlist pdp11"
4985
4986 : coherency check
4987 echo " "
4988 echo "Checking your choice of C compiler and flags for coherency..." >&4
4989 $cat > try.c <<'EOF'
4990 #include <stdio.h>
4991 int main() { printf("Ok\n"); return(0); }
4992 EOF
4993 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4994 shift
4995 $cat >try.msg <<'EOM'
4996 I've tried to compile and run the following simple program:
4997
4998 EOM
4999 $cat try.c >> try.msg
5000
5001 $cat >> try.msg <<EOM
5002
5003 I used the command:
5004
5005         $*
5006         $run ./try
5007
5008 and I got the following output:
5009
5010 EOM
5011 dflt=y
5012 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5013         if $sh -c "$run ./try" >>try.msg 2>&1; then
5014                 xxx=`$run ./try`
5015                 case "$xxx" in
5016                 "Ok") dflt=n ;;
5017                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5018                         case " $libs " in
5019                         *" -lsfio "*)
5020                                 cat >> try.msg <<'EOQS'
5021 If $libs contains -lsfio, and sfio is mis-configured, then it
5022 sometimes (apparently) runs and exits with a 0 status, but with no
5023 output!  It may have to do with sfio's use of _exit vs. exit.
5024
5025 EOQS
5026                                 rp="You have a big problem.  Shall I abort Configure"
5027                                 dflt=y
5028                                 ;;
5029                         esac
5030                         ;;
5031                 esac
5032         else
5033                 echo "The program compiled OK, but exited with status $?." >>try.msg
5034                 rp="You have a problem.  Shall I abort Configure"
5035                 dflt=y
5036         fi
5037 else
5038         echo "I can't compile the test program." >>try.msg
5039         rp="You have a BIG problem.  Shall I abort Configure"
5040         dflt=y
5041 fi
5042 case "$dflt" in
5043 y)
5044         $cat try.msg >&4
5045         case "$knowitall" in
5046         '')
5047                 echo "(The supplied flags or libraries might be incorrect.)"
5048                 ;;
5049         *) dflt=n;;
5050         esac
5051         echo " "
5052         . ./myread
5053         case "$ans" in
5054         n*|N*) ;;
5055         *)      echo "Ok.  Stopping Configure." >&4
5056                 exit 1
5057                 ;;
5058         esac
5059         ;;
5060 n) echo "OK, that should do.";;
5061 esac
5062 $rm -f try try.* core
5063
5064 : define a shorthand compile call
5065 compile='
5066 mc_file=$1;
5067 shift;
5068 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5069 : define a shorthand compile call for compilations that should be ok.
5070 compile_ok='
5071 mc_file=$1;
5072 shift;
5073 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5074
5075 : determine filename position in cpp output
5076 echo " "
5077 echo "Computing filename position in cpp output for #include directives..." >&4
5078 case "$osname" in
5079 vos) testaccess=-e ;;
5080 *)   testaccess=-r ;;
5081 esac
5082 echo '#include <stdio.h>' > foo.c
5083 $cat >fieldn <<EOF
5084 $startsh
5085 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5086 $grep '^[       ]*#.*stdio\.h' | \
5087 while read cline; do
5088         pos=1
5089         set \$cline
5090         while $test \$# -gt 0; do
5091                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5092                         echo "\$pos"
5093                         exit 0
5094                 fi
5095                 shift
5096                 pos=\`expr \$pos + 1\`
5097         done
5098 done
5099 EOF
5100 chmod +x fieldn
5101 fieldn=`./fieldn`
5102 $rm -f foo.c fieldn
5103 case $fieldn in
5104 '') pos='???';;
5105 1) pos=first;;
5106 2) pos=second;;
5107 3) pos=third;;
5108 *) pos="${fieldn}th";;
5109 esac
5110 echo "Your cpp writes the filename in the $pos field of the line."
5111
5112 case "$osname" in
5113 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5114 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5115 *)   cppfilter='' ;;
5116 esac
5117 : locate header file
5118 $cat >findhdr <<EOF
5119 $startsh
5120 wanted=\$1
5121 name=''
5122 for usrincdir in $usrinc
5123 do
5124         if test -f \$usrincdir/\$wanted; then
5125                 echo "\$usrincdir/\$wanted"
5126                 exit 0
5127         fi
5128 done
5129 awkprg='{ print \$$fieldn }'
5130 echo "#include <\$wanted>" > foo\$\$.c
5131 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5132 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5133 while read cline; do
5134         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5135         case "\$name" in
5136         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5137         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5138         *) exit 2;;
5139         esac;
5140 done;
5141 #
5142 # status = 0: grep returned 0 lines, case statement not executed
5143 # status = 1: headerfile found
5144 # status = 2: while loop executed, no headerfile found
5145 #
5146 status=\$?
5147 $rm -f foo\$\$.c;
5148 if test \$status -eq 1; then
5149         exit 0;
5150 fi
5151 exit 1
5152 EOF
5153 chmod +x findhdr
5154
5155 : define an alternate in-header-list? function
5156 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5157 cont=true; xxf="echo \"<\$1> found.\" >&4";
5158 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5159 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5160 esac;
5161 case $# in 4) instead=instead;; *) instead="at last";; esac;
5162 while $test "$cont"; do
5163         xxx=`./findhdr $1`
5164         var=$2; eval "was=\$$2";
5165         if $test "$xxx" && $test -r "$xxx";
5166         then eval $xxf;
5167         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5168                 cont="";
5169         else eval $xxnf;
5170         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5171         set $yyy; shift; shift; yyy=$@;
5172         case $# in 0) cont="";;
5173         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5174                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5175         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5176                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5177         esac;
5178 done;
5179 while $test "$yyy";
5180 do set $yyy; var=$2; eval "was=\$$2";
5181         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5182         set $yyy; shift; shift; yyy=$@;
5183 done'
5184
5185 : see if stdlib is available
5186 set stdlib.h i_stdlib
5187 eval $inhdr
5188
5189 : check for lengths of integral types
5190 echo " "
5191 case "$intsize" in
5192 '')
5193         echo "Checking to see how big your integers are..." >&4
5194         $cat >try.c <<EOCP
5195 #include <stdio.h>
5196 #$i_stdlib I_STDLIB
5197 #ifdef I_STDLIB
5198 #include <stdlib.h>
5199 #endif
5200 int main()
5201 {
5202         printf("intsize=%d;\n", (int)sizeof(int));
5203         printf("longsize=%d;\n", (int)sizeof(long));
5204         printf("shortsize=%d;\n", (int)sizeof(short));
5205         exit(0);
5206 }
5207 EOCP
5208         set try
5209         if eval $compile_ok && $run ./try > /dev/null; then
5210                 eval `$run ./try`
5211                 echo "Your integers are $intsize bytes long."
5212                 echo "Your long integers are $longsize bytes long."
5213                 echo "Your short integers are $shortsize bytes long."
5214         else
5215                 $cat >&4 <<EOM
5216 !
5217 Help! I can't compile and run the intsize test program: please enlighten me!
5218 (This is probably a misconfiguration in your system or libraries, and
5219 you really ought to fix it.  Still, I'll try anyway.)
5220 !
5221 EOM
5222                 dflt=4
5223                 rp="What is the size of an integer (in bytes)?"
5224                 . ./myread
5225                 intsize="$ans"
5226                 dflt=$intsize
5227                 rp="What is the size of a long integer (in bytes)?"
5228                 . ./myread
5229                 longsize="$ans"
5230                 dflt=2
5231                 rp="What is the size of a short integer (in bytes)?"
5232                 . ./myread
5233                 shortsize="$ans"
5234         fi
5235         ;;
5236 esac
5237 $rm -f try try.*
5238
5239 : check for long long
5240 echo " "
5241 echo "Checking to see if you have long long..." >&4
5242 echo 'int main() { long long x = 7; return 0; }' > try.c
5243 set try
5244 if eval $compile; then
5245         val="$define"
5246         echo "You have long long."
5247 else
5248         val="$undef"
5249         echo "You do not have long long."
5250 fi
5251 $rm try.*
5252 set d_longlong
5253 eval $setvar
5254
5255 : check for length of long long
5256 case "${d_longlong}${longlongsize}" in
5257 $define)
5258         echo " "
5259         echo "Checking to see how big your long longs are..." >&4
5260         $cat >try.c <<'EOCP'
5261 #include <stdio.h>
5262 int main()
5263 {
5264     printf("%d\n", (int)sizeof(long long));
5265     return(0);
5266 }
5267 EOCP
5268         set try
5269         if eval $compile_ok; then
5270                 longlongsize=`$run ./try`
5271                 echo "Your long longs are $longlongsize bytes long."
5272         else
5273                 dflt='8'
5274                 echo " "
5275                 echo "(I can't seem to compile the test program.  Guessing...)"
5276                 rp="What is the size of a long long (in bytes)?"
5277                 . ./myread
5278                 longlongsize="$ans"
5279         fi
5280         if $test "X$longsize" = "X$longlongsize"; then
5281                 echo "(That isn't any different from an ordinary long.)"
5282         fi      
5283         ;;
5284 esac
5285 $rm -f try.* try
5286
5287 : see if inttypes.h is available
5288 : we want a real compile instead of Inhdr because some systems
5289 : have an inttypes.h which includes non-existent headers
5290 echo " "
5291 $cat >try.c <<EOCP
5292 #include <inttypes.h>
5293 int main() {
5294         static int32_t foo32 = 0x12345678;
5295 }
5296 EOCP
5297 set try
5298 if eval $compile; then
5299         echo "<inttypes.h> found." >&4
5300         val="$define"
5301 else
5302         echo "<inttypes.h> NOT found." >&4
5303         val="$undef"
5304 fi
5305 $rm -f try.c try
5306 set i_inttypes
5307 eval $setvar
5308
5309 : check for int64_t
5310 echo " "
5311 echo "Checking to see if you have int64_t..." >&4
5312 $cat >try.c <<EOCP
5313 #include <sys/types.h>
5314 #$i_inttypes I_INTTYPES
5315 #ifdef I_INTTYPES
5316 #include <inttypes.h>
5317 #endif
5318 int main() { int64_t x = 7; }
5319 EOCP
5320 set try
5321 if eval $compile; then
5322         val="$define"
5323         echo "You have int64_t."
5324 else
5325         val="$undef"
5326         echo "You do not have int64_t."
5327 fi
5328 $rm -f try try.*
5329 set d_int64_t
5330 eval $setvar
5331
5332
5333 echo " "
5334 echo "Checking which 64-bit integer type we could use..." >&4
5335
5336 case "$intsize" in
5337 8) val=int
5338    set quadtype
5339    eval $setvar
5340    val='"unsigned int"'
5341    set uquadtype
5342    eval $setvar
5343    quadkind=1
5344    ;;
5345 *) case "$longsize" in
5346    8) val=long
5347       set quadtype
5348       eval $setvar
5349       val='"unsigned long"'
5350       set uquadtype
5351       eval $setvar
5352       quadkind=2
5353       ;;
5354    *) case "$d_longlong:$longlongsize" in
5355       define:8)
5356         val='"long long"'
5357         set quadtype
5358         eval $setvar
5359         val='"unsigned long long"'
5360         set uquadtype
5361         eval $setvar
5362         quadkind=3
5363         ;;
5364       *) case "$d_int64_t" in
5365          define)
5366            val=int64_t
5367            set quadtype
5368            eval $setvar
5369            val=uint64_t
5370            set uquadtype
5371            eval $setvar
5372            quadkind=4
5373            ;;
5374          esac
5375          ;;
5376       esac
5377       ;;
5378    esac
5379    ;;
5380 esac
5381
5382 case "$quadtype" in
5383 '')     echo "Alas, no 64-bit integer types in sight." >&4
5384         d_quad="$undef"
5385         ;;
5386 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5387         d_quad="$define"
5388         ;;
5389 esac
5390
5391
5392 case "$uselonglong" in
5393 "$define"|true|[yY]*)
5394         cat <<EOM >&4
5395
5396 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5397 EOM
5398         use64bitint="$define"
5399         ;;
5400 esac                          
5401 case "$use64bits" in
5402 "$define"|true|[yY]*)
5403         cat <<EOM >&4
5404
5405 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5406 EOM
5407         use64bitint="$define"
5408         ;;
5409 esac                          
5410 case "$use64bitints" in
5411 "$define"|true|[yY]*)
5412         cat <<EOM >&4
5413
5414 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5415 EOM
5416         use64bitint="$define"
5417         ;;
5418 esac                          
5419 case "$use64bitsint" in
5420 "$define"|true|[yY]*)
5421         cat <<EOM >&4
5422
5423 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5424 EOM
5425         use64bitint="$define"
5426         ;;
5427 esac                          
5428 case "$uselonglongs" in
5429 "$define"|true|[yY]*)
5430         cat <<EOM >&4
5431
5432 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5433 EOM
5434         use64bitint="$define"
5435         ;;
5436 esac                          
5437 case "$use64bitsall" in
5438 "$define"|true|[yY]*)
5439         cat <<EOM >&4
5440
5441 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5442 EOM
5443         use64bitall="$define"
5444         ;;
5445 esac                          
5446
5447 case "$ccflags" in
5448 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5449 esac
5450 case "$use64bitall" in
5451 "$define"|true|[yY]*) use64bitint="$define" ;;
5452 esac
5453
5454 case "$longsize" in
5455 8) cat <<EOM
5456
5457 You have natively 64-bit long integers.
5458 EOM
5459    val="$define"
5460    ;;
5461 *) case "$use64bitint" in
5462    "$define"|true|[yY]*) dflt='y';;
5463    *) dflt='n';;
5464    esac
5465    case "$d_quad" in
5466    "$define") ;;
5467    *) dflt='n' ;;
5468    esac
5469    cat <<EOM
5470
5471 Perl can be built to take advantage of 64-bit integer types
5472 on some systems.  To do so, Configure can be run with -Duse64bitint.
5473 Choosing this option will most probably introduce binary incompatibilities.
5474
5475 If this doesn't make any sense to you, just accept the default '$dflt'.
5476 (The default has been chosen based on your configuration.)
5477 EOM
5478    rp='Try to use 64-bit integers, if available?'
5479    . ./myread
5480    case "$ans" in
5481    [yY]*) val="$define" ;;
5482    *)     val="$undef"  ;;
5483    esac
5484    ;;
5485 esac
5486 set use64bitint
5487 eval $setvar
5488
5489 case "$use64bitall" in
5490 "$define"|true|[yY]*) dflt='y' ;;
5491 *) case "$longsize" in
5492    8) dflt='y' ;;
5493    *) dflt='n' ;;
5494    esac
5495    ;;
5496 esac    
5497 cat <<EOM
5498
5499 You may also choose to try maximal 64-bitness.  It means using as much
5500 64-bitness as possible on the platform.  This in turn means even more
5501 binary incompatibilities.  On the other hand, your platform may not
5502 have any more 64-bitness available than what you already have chosen.
5503
5504 If this doesn't make any sense to you, just accept the default '$dflt'.
5505 (The default has been chosen based on your configuration.)
5506 EOM
5507 rp='Try to use maximal 64-bit support, if available?'
5508 . ./myread
5509 case "$ans" in
5510 [yY]*) val="$define" ;;
5511 *)     val="$undef"  ;;
5512 esac
5513 set use64bitall
5514 eval $setvar
5515 case "$use64bitall" in
5516 "$define")
5517         case "$use64bitint" in
5518         "$undef")
5519                 cat <<EOM
5520
5521 Since you have chosen a maximally 64-bit build, I'm also turning on
5522 the use of 64-bit integers.
5523 EOM
5524                 use64bitint="$define" ;;
5525         esac
5526         ;;
5527 esac
5528
5529 : Look for a hint-file generated 'call-back-unit'.  If the
5530 : user has specified that a 64-bit perl is to be built,
5531 : we may need to set or change some other defaults.
5532 if $test -f use64bitint.cbu; then
5533         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5534         . ./use64bitint.cbu
5535 fi
5536 case "$use64bitint" in
5537 "$define"|true|[yY]*)
5538         case "$longsize" in
5539         4) case "$archname64" in
5540            '') archname64=64int ;;
5541            esac
5542            ;;
5543         esac
5544         ;;
5545 esac
5546
5547 : Look for a hint-file generated 'call-back-unit'.  If the
5548 : user has specified that a maximally 64-bit perl is to be built,
5549 : we may need to set or change some other defaults.
5550 if $test -f use64bitall.cbu; then
5551         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5552         . ./use64bitall.cbu
5553 fi
5554 case "$use64bitall" in
5555 "$define"|true|[yY]*)
5556         case "$longsize" in
5557         4) case "$archname64" in
5558            ''|64int) archname64=64all ;;
5559            esac
5560            ;;
5561         esac
5562         ;;
5563 esac
5564
5565 case "$d_quad:$use64bitint" in
5566 $undef:$define)
5567         cat >&4 <<EOF
5568
5569 *** You have chosen to use 64-bit integers,
5570 *** but none can be found.
5571 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5572 *** Cannot continue, aborting.
5573
5574 EOF
5575         exit 1
5576         ;;
5577 esac
5578
5579 : check for length of double
5580 echo " "
5581 case "$doublesize" in
5582 '')
5583         echo "Checking to see how big your double precision numbers are..." >&4
5584         $cat >try.c <<EOCP
5585 #include <stdio.h>
5586 #$i_stdlib I_STDLIB
5587 #ifdef I_STDLIB
5588 #include <stdlib.h>
5589 #endif
5590 int main()
5591 {
5592     printf("%d\n", (int)sizeof(double));
5593     exit(0);
5594 }
5595 EOCP
5596         set try
5597         if eval $compile_ok; then
5598                 doublesize=`$run ./try`
5599                 echo "Your double is $doublesize bytes long."
5600         else
5601                 dflt='8'
5602                 echo "(I can't seem to compile the test program.  Guessing...)"
5603                 rp="What is the size of a double precision number (in bytes)?"
5604                 . ./myread
5605                 doublesize="$ans"
5606         fi
5607         ;;
5608 esac
5609 $rm -f try.c try
5610
5611 : check for long doubles
5612 echo " "
5613 echo "Checking to see if you have long double..." >&4
5614 echo 'int main() { long double x = 7.0; }' > try.c
5615 set try
5616 if eval $compile; then
5617         val="$define"
5618         echo "You have long double."
5619 else
5620         val="$undef"
5621         echo "You do not have long double."
5622 fi
5623 $rm try.*
5624 set d_longdbl
5625 eval $setvar
5626
5627 : check for length of long double
5628 case "${d_longdbl}${longdblsize}" in
5629 $define)
5630         echo " "
5631         echo "Checking to see how big your long doubles are..." >&4
5632         $cat >try.c <<'EOCP'
5633 #include <stdio.h>
5634 int main()
5635 {
5636         printf("%d\n", sizeof(long double));
5637 }
5638 EOCP
5639         set try
5640         set try
5641         if eval $compile; then
5642                 longdblsize=`$run ./try`
5643                 echo "Your long doubles are $longdblsize bytes long."
5644         else
5645                 dflt='8'
5646                 echo " "
5647                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5648                 rp="What is the size of a long double (in bytes)?"
5649                 . ./myread
5650                 longdblsize="$ans"
5651         fi
5652         if $test "X$doublesize" = "X$longdblsize"; then
5653                 echo "That isn't any different from an ordinary double."
5654                 echo "I'll keep your setting anyway, but you may see some"
5655                 echo "harmless compilation warnings."
5656         fi      
5657         ;;
5658 esac
5659 $rm -f try.* try
5660
5661 : determine the architecture name
5662 echo " "
5663 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5664         tarch=`arch`"-$osname"
5665 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5666         if uname -m > tmparch 2>&1 ; then
5667                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5668                         -e 's/$/'"-$osname/" tmparch`
5669         else
5670                 tarch="$osname"
5671         fi
5672         $rm -f tmparch
5673 else
5674         tarch="$osname"
5675 fi
5676 case "$myarchname" in
5677 ''|"$tarch") ;;
5678 *)
5679         echo "(Your architecture name used to be $myarchname.)"
5680         archname=''
5681         ;;
5682 esac
5683 case "$targetarch" in
5684 '') ;;
5685 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5686 esac
5687 myarchname="$tarch"
5688 case "$archname" in
5689 '') dflt="$tarch";;
5690 *) dflt="$archname";;
5691 esac
5692 rp='What is your architecture name'
5693 . ./myread
5694 archname="$ans"
5695 case "$usethreads" in
5696 $define)
5697         echo "Threads selected." >&4
5698         case "$archname" in
5699         *-thread*) echo "...and architecture name already has -thread." >&4
5700                 ;;
5701         *)      archname="$archname-thread"
5702                 echo "...setting architecture name to $archname." >&4
5703                 ;;
5704         esac
5705         ;;
5706 esac
5707 case "$usemultiplicity" in
5708 $define)
5709         echo "Multiplicity selected." >&4
5710         case "$archname" in
5711         *-multi*) echo "...and architecture name already has -multi." >&4
5712                 ;;
5713         *)      archname="$archname-multi"
5714                 echo "...setting architecture name to $archname." >&4
5715                 ;;
5716         esac
5717         ;;
5718 esac
5719 case "$use64bitint$use64bitall" in
5720 *"$define"*)
5721         case "$archname64" in
5722         '')
5723                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5724                 ;;
5725         *)
5726                 case "$use64bitint" in
5727                 "$define") echo "64 bit integers selected." >&4 ;;
5728                 esac
5729                 case "$use64bitall" in
5730                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5731                 esac
5732                 case "$archname" in
5733                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5734                         ;;
5735                 *)      archname="$archname-$archname64"
5736                         echo "...setting architecture name to $archname." >&4
5737                         ;;
5738                 esac
5739                 ;;
5740         esac
5741 esac
5742 case "$uselongdouble" in
5743 $define)
5744         echo "Long doubles selected." >&4
5745         case "$longdblsize" in
5746         $doublesize)
5747                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5748                 ;;
5749         *)
5750                 case "$archname" in
5751                 *-ld*) echo "...and architecture name already has -ld." >&4
5752                         ;;
5753                 *)      archname="$archname-ld"
5754                         echo "...setting architecture name to $archname." >&4
5755                         ;;
5756                 esac
5757                 ;;
5758         esac
5759         ;;
5760 esac
5761 case "$useperlio" in
5762 $define)
5763         echo "Perlio selected." >&4
5764         ;;
5765 *)
5766         echo "Perlio not selected, using stdio." >&4
5767         case "$archname" in
5768         *-stdio*) echo "...and architecture name already has -stdio." >&4
5769                 ;;
5770         *)      archname="$archname-stdio"
5771                 echo "...setting architecture name to $archname." >&4
5772                 ;;
5773         esac
5774         ;;
5775 esac
5776 if $test -f archname.cbu; then
5777         echo "Your platform has some specific hints for architecture name, using them..."
5778         . ./archname.cbu
5779 fi
5780
5781 : determine root of directory hierarchy where package will be installed.
5782 case "$prefix" in
5783 '')
5784         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5785         ;;
5786 *?/)
5787         dflt=`echo "$prefix" | sed 's/.$//'`
5788         ;;
5789 *)
5790         dflt="$prefix"
5791         ;;
5792 esac
5793 $cat <<EOM
5794
5795 By default, $package will be installed in $dflt/bin, manual pages
5796 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5797 installation directories. Typically this is something like /usr/local.
5798 If you wish to have binaries under /usr/bin but other parts of the
5799 installation under /usr/local, that's ok: you will be prompted
5800 separately for each of the installation directories, the prefix being
5801 only used to set the defaults.
5802
5803 EOM
5804 fn=d~
5805 rp='Installation prefix to use?'
5806 . ./getfile
5807 oldprefix=''
5808 case "$prefix" in
5809 '') ;;
5810 *)
5811         case "$ans" in
5812         "$prefix") ;;
5813         *) oldprefix="$prefix";;
5814         esac
5815         ;;
5816 esac
5817 prefix="$ans"
5818 prefixexp="$ansexp"
5819
5820 case "$afsroot" in
5821 '')     afsroot=/afs ;;
5822 *)      afsroot=$afsroot ;;
5823 esac
5824
5825 : is AFS running?
5826 echo " "
5827 case "$afs" in
5828 $define|true)   afs=true ;;
5829 $undef|false)   afs=false ;;
5830 *)      if test -d $afsroot; then
5831                 afs=true
5832         else
5833                 afs=false
5834         fi
5835         ;;
5836 esac
5837 if $afs; then
5838         echo "AFS may be running... I'll be extra cautious then..." >&4
5839 else
5840         echo "AFS does not seem to be running..." >&4
5841 fi
5842
5843 : determine installation prefix for where package is to be installed.
5844 if $afs; then 
5845 $cat <<EOM
5846
5847 Since you are running AFS, I need to distinguish the directory in which
5848 files will reside from the directory in which they are installed (and from
5849 which they are presumably copied to the former directory by occult means).
5850
5851 EOM
5852         case "$installprefix" in
5853         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5854         *) dflt="$installprefix";;
5855         esac
5856 else
5857 $cat <<EOM
5858
5859 In some special cases, particularly when building $package for distribution,
5860 it is convenient to distinguish the directory in which files should be
5861 installed from the directory ($prefix) in which they will
5862 eventually reside.  For most users, these two directories are the same.
5863
5864 EOM
5865         case "$installprefix" in
5866         '') dflt=$prefix ;;
5867         *) dflt=$installprefix;;
5868         esac
5869 fi
5870 fn=d~
5871 rp='What installation prefix should I use for installing files?'
5872 . ./getfile
5873 installprefix="$ans"
5874 installprefixexp="$ansexp"
5875
5876 : set the prefixit variable, to compute a suitable default value
5877 prefixit='case "$3" in
5878 ""|none)
5879         case "$oldprefix" in
5880         "") eval "$1=\"\$$2\"";;
5881         *)
5882                 case "$3" in
5883                 "") eval "$1=";;
5884                 none)
5885                         eval "tp=\"\$$2\"";
5886                         case "$tp" in
5887                         ""|" ") eval "$1=\"\$$2\"";;
5888                         *) eval "$1=";;
5889                         esac;;
5890                 esac;;
5891         esac;;
5892 *)
5893         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5894         case "$tp" in
5895         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5896         /*-$oldprefix/*|\~*-$oldprefix/*)
5897                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5898         *) eval "$1=\"\$$2\"";;
5899         esac;;
5900 esac'
5901
5902 : get the patchlevel
5903 echo " "
5904 echo "Getting the current patchlevel..." >&4
5905 if $test -r $rsrc/patchlevel.h;then
5906         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5907         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5908         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5909         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5910         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5911         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5912         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5913 else
5914         revision=0
5915         patchlevel=0
5916         subversion=0
5917         api_revision=0
5918         api_version=0
5919         api_subversion=0
5920         perl_patchlevel=0
5921         $echo "(You do not have patchlevel.h.  Eek.)"
5922 fi
5923 if $test -r $rsrc/.patch ; then
5924         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5925                 perl_patchlevel=`cat $rsrc/.patch`
5926         fi
5927 fi
5928 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5929 version_patchlevel_string="version $patchlevel subversion $subversion"
5930 case "$perl_patchlevel" in
5931 0|'') ;;
5932 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5933 esac
5934
5935 $echo "(You have $package $version_patchlevel_string.)"
5936
5937 case "$osname" in
5938 dos|vms)
5939         : XXX Should be a Configure test for double-dots in filenames.
5940         version=`echo $revision $patchlevel $subversion | \
5941                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5942         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5943                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5944         ;;
5945 *)
5946         version=`echo $revision $patchlevel $subversion | \
5947                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5948         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5949                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5950         ;;
5951 esac
5952 : Special case the 5.005_xx maintenance series, which used 5.005
5953 : without any subversion label as a subdirectory in $sitelib
5954 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5955         api_versionstring='5.005'
5956 fi
5957
5958 : determine installation style
5959 : For now, try to deduce it from prefix unless it is already set.
5960 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5961 case "$installstyle" in
5962 '')     case "$prefix" in
5963                 *perl*) dflt='lib';;
5964                 *) dflt='lib/perl5' ;;
5965         esac
5966         ;;
5967 *)      dflt="$installstyle" ;;
5968 esac
5969 : Probably not worth prompting for this since we prompt for all
5970 : the directories individually, and the prompt would be too long and
5971 : confusing anyway.
5972 installstyle=$dflt
5973
5974
5975 : Perform the prefixexp/installprefixexp correction if necessary
5976 cat <<EOS >installprefix
5977 $startsh
5978 EOS
5979 cat <<'EOSC' >>installprefix
5980 : Change installation prefix, if necessary.
5981 if $test X"$prefix" != X"$installprefix"; then
5982         eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
5983 else
5984         eval "install${prefixvar}=\"\$${prefixvar}exp\""
5985 fi
5986 EOSC
5987
5988 : Set variables such as privlib and privlibexp from the output of ./getfile
5989 : performing the prefixexp/installprefixexp correction if necessary.
5990 cat <<EOS >setprefixvar
5991 $startsh
5992 EOS
5993 cat <<'EOSC' >>setprefixvar
5994 eval "${prefixvar}=\"\$ans\""
5995 eval "${prefixvar}exp=\"\$ansexp\""
5996 . ./installprefix
5997 EOSC
5998
5999 : determine where public executables go
6000 echo " "
6001 set dflt bin bin
6002 eval $prefixit
6003 fn=d~
6004 rp='Pathname where the public executables will reside?'
6005 . ./getfile
6006 if $test "X$ansexp" != "X$binexp"; then
6007         installbin=''
6008 fi
6009 prefixvar=bin
6010 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6011 . ./setprefixvar
6012
6013 case "$userelocatableinc" in
6014 $define|true|[yY]*)     dflt='y';;
6015 *) dflt='n';;
6016 esac
6017 cat <<EOM
6018
6019 Would you like to build Perl so that the installation is relocatable, so that
6020 library paths in @INC are determined relative to the path of the perl binary?
6021 This is not advised for system Perl installs, or if you need to run setid
6022 scripts or scripts under taint mode.
6023
6024 If this doesn't make any sense to you, just accept the default '$dflt'.
6025 EOM
6026 rp='Use relocatable @INC?'
6027 . ./myread
6028 case "$ans" in
6029 y|Y)    val="$define" ;;     
6030 *)      val="$undef" ;;
6031 esac
6032 set userelocatableinc
6033 eval $setvar
6034
6035 : Default prefix is now "up one level from where the binaries are"
6036 case "$userelocatableinc" in
6037 $define|true|[yY]*) initialinstalllocation="$binexp"
6038                     bin=".../"
6039                     binexp=".../"
6040                     prefix=".../.."
6041                     prefixexp=".../.."
6042                     installprefixexp=".../..";;
6043 esac
6044
6045
6046 : determine where private library files go
6047 : Usual default is /usr/local/lib/perl5/$version.
6048 : Also allow things like /opt/perl/lib/$version, since 
6049 : /opt/perl/lib/perl5... would be redundant.
6050 : The default "style" setting is made in installstyle.U
6051 case "$installstyle" in
6052 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6053 *)       set dflt privlib lib/$version ;;
6054 esac
6055 eval $prefixit
6056 $cat <<EOM
6057
6058 There are some auxiliary files for $package that need to be put into a
6059 private library directory that is accessible by everyone.
6060
6061 EOM
6062 fn=d~+
6063 rp='Pathname where the private library files will reside?'
6064 . ./getfile
6065 prefixvar=privlib
6066 . ./setprefixvar
6067
6068 : set the prefixup variable, to restore leading tilda escape
6069 prefixup='case "$prefixexp" in
6070 "$prefix") ;;
6071 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6072 esac'
6073
6074 : determine where public architecture dependent libraries go
6075 set archlib archlib
6076 eval $prefixit
6077 : privlib default is /usr/local/lib/$package/$version
6078 : archlib default is /usr/local/lib/$package/$version/$archname
6079 : privlib may have an optional trailing /share.
6080 tdflt=`echo $privlib | $sed 's,/share$,,'`
6081 tdflt=$tdflt/$archname
6082 case "$archlib" in
6083 '')     dflt=$tdflt
6084         ;;
6085 *)      dflt="$archlib"
6086     ;;
6087 esac
6088 $cat <<EOM
6089
6090 $spackage contains architecture-dependent library files.  If you are
6091 sharing libraries in a heterogeneous environment, you might store
6092 these files in a separate location.  Otherwise, you can just include
6093 them with the rest of the public library files.
6094
6095 EOM
6096 fn=d+~
6097 rp='Where do you want to put the public architecture-dependent libraries?'
6098 . ./getfile
6099 prefixvar=archlib
6100 . ./setprefixvar
6101 if $test X"$archlib" = X"$privlib"; then
6102         d_archlib="$undef"
6103 else
6104         d_archlib="$define"
6105 fi
6106
6107 : see if setuid scripts can be secure
6108 $cat <<EOM
6109
6110 Some kernels have a bug that prevents setuid #! scripts from being
6111 secure.  Some sites have disabled setuid #! scripts because of this.
6112
6113 First let's decide if your kernel supports secure setuid #! scripts.
6114 (If setuid #! scripts would be secure but have been disabled anyway,
6115 don't say that they are secure if asked.)
6116
6117 EOM
6118
6119 val="$undef"
6120 if $test -d /dev/fd; then
6121         echo "#!$ls" >reflect
6122         chmod +x,u+s reflect
6123         ./reflect >flect 2>&1
6124         if $contains "/dev/fd" flect >/dev/null; then
6125                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6126                 val="$define"
6127         else
6128                 $cat <<EOM
6129 If you are not sure if they are secure, I can check but I'll need a
6130 username and password different from the one you are using right now.
6131 If you don't have such a username or don't want me to test, simply
6132 enter 'none'.
6133
6134 EOM
6135                 rp='Other username to test security of setuid scripts with?'
6136                 dflt='none'
6137                 . ./myread
6138                 case "$ans" in
6139                 n|none)
6140                         case "$d_suidsafe" in
6141                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6142                                 dflt=n;;
6143                         "$undef")
6144                                 echo "Well, the $hint value is *not* secure." >&4
6145                                 dflt=n;;
6146                         *)      echo "Well, the $hint value *is* secure." >&4
6147                                 dflt=y;;
6148                         esac
6149                         ;;
6150                 *)
6151                         $rm -f reflect flect
6152                         echo "#!$ls" >reflect
6153                         chmod +x,u+s reflect
6154                         echo >flect
6155                         chmod a+w flect
6156                         echo '"su" will (probably) prompt you for '"$ans's password."
6157                         su $ans -c './reflect >flect'
6158                         if $contains "/dev/fd" flect >/dev/null; then
6159                                 echo "Okay, it looks like setuid scripts are secure." >&4
6160                                 dflt=y
6161                         else
6162                                 echo "I don't think setuid scripts are secure." >&4
6163                                 dflt=n
6164                         fi
6165                         ;;
6166                 esac
6167                 rp='Does your kernel have *secure* setuid scripts?'
6168                 . ./myread
6169                 case "$ans" in
6170                 [yY]*)  val="$define";;
6171                 *)      val="$undef";;
6172                 esac
6173         fi
6174 else
6175         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6176         echo "(That's for file descriptors, not floppy disks.)"
6177         val="$undef"
6178 fi
6179 set d_suidsafe
6180 eval $setvar
6181
6182 $rm -f reflect flect
6183
6184 : now see if they want to do setuid emulation
6185 echo " "
6186 val="$undef"
6187 case "$d_suidsafe" in
6188 "$define")
6189         val="$undef"
6190         echo "No need to emulate SUID scripts since they are secure here." >&4
6191         ;;
6192 *)
6193         $cat <<EOM
6194 Some systems have disabled setuid scripts, especially systems where
6195 setuid scripts cannot be secure.  On systems where setuid scripts have
6196 been disabled, the setuid/setgid bits on scripts are currently
6197 useless.  It is possible for $package to detect those bits and emulate
6198 setuid/setgid in a secure fashion.  This emulation will only work if
6199 setuid scripts have been disabled in your kernel.
6200
6201 EOM
6202         case "$d_dosuid" in
6203         "$define") dflt=y ;;
6204         *) dflt=n ;;
6205         esac
6206         rp="Do you want to do setuid/setgid emulation?"
6207         . ./myread
6208         case "$ans" in
6209         [yY]*)  val="$define";;
6210         *)      val="$undef";;
6211         esac
6212         ;;
6213 esac
6214 set d_dosuid
6215 eval $setvar
6216
6217 : see if this is a malloc.h system
6218 : we want a real compile instead of Inhdr because some systems have a
6219 : malloc.h that just gives a compile error saying to use stdlib.h instead
6220 echo " "
6221 $cat >try.c <<EOCP
6222 #include <stdlib.h>
6223 #include <malloc.h>
6224 int main () { return 0; }
6225 EOCP
6226 set try
6227 if eval $compile; then
6228     echo "<malloc.h> found." >&4
6229     val="$define"
6230 else
6231     echo "<malloc.h> NOT found." >&4
6232     val="$undef"
6233 fi
6234 $rm -f try.c try
6235 set i_malloc
6236 eval $setvar
6237
6238 : check for void type
6239 echo " "
6240 echo "Checking to see how well your C compiler groks the void type..." >&4
6241 case "$voidflags" in
6242 '')
6243         $cat >try.c <<EOCP
6244 #$i_stdlib I_STDLIB
6245 #ifdef I_STDLIB
6246 #include <stdlib.h>
6247 #endif
6248 #if TRY & 1
6249 void sub() {
6250 #else
6251 sub() {
6252 #endif
6253         extern void moo();      /* function returning void */
6254         void (*goo)();          /* ptr to func returning void */
6255 #if TRY & 8
6256         void *hue;              /* generic ptr */
6257 #endif
6258 #if TRY & 2
6259         void (*foo[10])();
6260 #endif
6261
6262 #if TRY & 4
6263         if(goo == moo) {
6264                 exit(0);
6265         }
6266 #endif
6267         exit(0);
6268 }
6269 int main() { sub(); }
6270 EOCP
6271         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6272                 voidflags=$defvoidused
6273         echo "Good.  It appears to support void to the level $package wants.">&4
6274                 if $contains warning .out >/dev/null 2>&1; then
6275                         echo "However, you might get some warnings that look like this:"
6276                         $cat .out
6277                 fi
6278         else
6279 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6280                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6281                         echo "It supports 1..."
6282                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6283                                 echo "It also supports 2..."
6284                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6285                                         voidflags=7
6286                                         echo "And it supports 4 but not 8 definitely."
6287                                 else
6288                                         echo "It doesn't support 4..."
6289                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6290                                                 voidflags=11
6291                                                 echo "But it supports 8."
6292                                         else
6293                                                 voidflags=3
6294                                                 echo "Neither does it support 8."
6295                                         fi
6296                                 fi
6297                         else
6298                                 echo "It does not support 2..."
6299                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6300                                         voidflags=13
6301                                         echo "But it supports 4 and 8."
6302                                 else
6303                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6304                                                 voidflags=5
6305                                                 echo "And it supports 4 but has not heard about 8."
6306                                         else
6307                                                 echo "However it supports 8 but not 4."
6308                                         fi
6309                                 fi
6310                         fi
6311                 else
6312                         echo "There is no support at all for void."
6313                         voidflags=0
6314                 fi
6315         fi
6316 esac
6317 case "$voidflags" in
6318 "$defvoidused") ;;
6319 *)      $cat >&4 <<'EOM'
6320   Support flag bits are:
6321     1: basic void declarations.
6322     2: arrays of pointers to functions returning void.
6323     4: operations between pointers to and addresses of void functions.
6324     8: generic void pointers.
6325 EOM
6326         dflt="$voidflags";
6327         rp="Your void support flags add up to what?"
6328         . ./myread
6329         voidflags="$ans"
6330         ;;
6331 esac
6332 $rm -f try.* .out
6333
6334 : check for length of pointer
6335 echo " "
6336 case "$ptrsize" in
6337 '')
6338         echo "Checking to see how big your pointers are..." >&4
6339         if test "$voidflags" -gt 7; then
6340                 echo '#define VOID_PTR char *' > try.c
6341         else
6342                 echo '#define VOID_PTR void *' > try.c
6343         fi
6344         $cat >>try.c <<EOCP
6345 #include <stdio.h>
6346 #$i_stdlib I_STDLIB
6347 #ifdef I_STDLIB
6348 #include <stdlib.h>
6349 #endif
6350 int main()
6351 {
6352     printf("%d\n", (int)sizeof(VOID_PTR));
6353     exit(0);
6354 }
6355 EOCP
6356         set try
6357         if eval $compile_ok; then
6358                 ptrsize=`$run ./try`
6359                 echo "Your pointers are $ptrsize bytes long."
6360         else
6361                 dflt='4'
6362                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6363                 rp="What is the size of a pointer (in bytes)?"
6364                 . ./myread
6365                 ptrsize="$ans"
6366         fi
6367         ;;
6368 esac
6369 $rm -f try.c try
6370 case "$use64bitall" in
6371 "$define"|true|[yY]*)
6372         case "$ptrsize" in
6373         4)      cat <<EOM >&4
6374
6375 *** You have chosen a maximally 64-bit build,
6376 *** but your pointers are only 4 bytes wide.
6377 *** Please rerun Configure without -Duse64bitall.
6378 EOM
6379                 case "$d_quad" in
6380                 define)
6381                         cat <<EOM >&4
6382 *** Since you have quads, you could possibly try with -Duse64bitint.
6383 EOM
6384                         ;;
6385                 esac
6386                 cat <<EOM >&4
6387 *** Cannot continue, aborting.
6388
6389 EOM
6390
6391                 exit 1
6392                 ;;
6393         esac
6394         ;;
6395 esac
6396
6397
6398 : determine whether to use malloc wrapping
6399 echo " "
6400 case "$usemallocwrap" in
6401 [yY]*|true|$define)     dflt='y' ;;
6402 [nN]*|false|$undef)     dflt='n' ;;
6403 *)      case "$usedevel" in
6404         [yY]*|true|$define)     dflt='y' ;;
6405         *) dflt='n' ;;
6406         esac
6407         ;;
6408 esac
6409 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6410 . ./myread
6411 usemallocwrap="$ans"
6412 case "$ans" in
6413 y*|true)
6414         usemallocwrap="$define" ;;
6415 *)
6416         usemallocwrap="$undef" ;;
6417 esac
6418
6419 : determine which malloc to compile in
6420 echo " "
6421 case "$usemymalloc" in
6422 [yY]*|true|$define)     dflt='y' ;;
6423 [nN]*|false|$undef)     dflt='n' ;;
6424 *)      case "$ptrsize" in
6425         4) dflt='y' ;;
6426         *) dflt='n' ;;
6427         esac
6428         ;;
6429 esac
6430 rp="Do you wish to attempt to use the malloc that comes with $package?"
6431 . ./myread
6432 usemymalloc="$ans"
6433 case "$ans" in
6434 y*|true)
6435         usemymalloc='y'
6436         mallocsrc='malloc.c'
6437         mallocobj="malloc$_o"
6438         d_mymalloc="$define"
6439         case "$libs" in
6440         *-lmalloc*)
6441                 : Remove malloc from list of libraries to use
6442                 echo "Removing unneeded -lmalloc from library list" >&4
6443                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6444                 shift
6445                 libs="$*"
6446                 echo "libs = $libs" >&4
6447                 ;;
6448         esac
6449         ;;
6450 *)
6451         usemymalloc='n'
6452         mallocsrc=''
6453         mallocobj=''
6454         d_mymalloc="$undef"
6455         ;;
6456 esac
6457
6458 : compute the return types of malloc and free
6459 echo " "
6460 $cat >malloc.c <<END
6461 #$i_malloc I_MALLOC
6462 #$i_stdlib I_STDLIB
6463 #include <stdio.h>
6464 #include <sys/types.h>
6465 #ifdef I_MALLOC
6466 #include <malloc.h>
6467 #endif
6468 #ifdef I_STDLIB
6469 #include <stdlib.h>
6470 #endif
6471 #ifdef TRY_MALLOC
6472 void *malloc();
6473 #endif
6474 #ifdef TRY_FREE
6475 void free();
6476 #endif
6477 END
6478 case "$malloctype" in
6479 '')
6480         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6481                 malloctype='void *'
6482         else
6483                 malloctype='char *'
6484         fi
6485         ;;
6486 esac
6487 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6488
6489 case "$freetype" in
6490 '')
6491         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6492                 freetype='void'
6493         else
6494                 freetype='int'
6495         fi
6496         ;;
6497 esac
6498 echo "Your system uses $freetype free(), it would seem." >&4
6499 $rm -f malloc.[co]
6500 $cat <<EOM
6501
6502 After $package is installed, you may wish to install various
6503 add-on modules and utilities.  Typically, these add-ons will
6504 be installed under $prefix with the rest
6505 of this package.  However, you may wish to install such add-ons
6506 elsewhere under a different prefix.
6507
6508 If you do not wish to put everything under a single prefix, that's
6509 ok.  You will be prompted for the individual locations; this siteprefix
6510 is only used to suggest the defaults.
6511
6512 The default should be fine for most people.
6513
6514 EOM
6515 fn=d~+
6516 rp='Installation prefix to use for add-on modules and utilities?'
6517 : XXX Here might be another good place for an installstyle setting.
6518 case "$siteprefix" in
6519 '') dflt=$prefix ;;
6520 *)  dflt=$siteprefix ;;
6521 esac
6522 . ./getfile
6523 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6524 oldsiteprefix=''
6525 case "$siteprefix" in
6526 '') ;;
6527 *)      case "$ans" in
6528         "$prefix") ;;
6529         *) oldsiteprefix="$prefix";;
6530         esac
6531         ;;
6532 esac
6533 siteprefix="$ans"
6534 siteprefixexp="$ansexp"
6535
6536 : determine where site specific libraries go.
6537 : Usual default is /usr/local/lib/perl5/site_perl/$version
6538 : The default "style" setting is made in installstyle.U
6539 : XXX No longer works with Prefixit stuff.
6540 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6541 case "$sitelib" in
6542 '') case "$installstyle" in
6543         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6544         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6545         esac
6546         ;;
6547 *)      dflt="$sitelib"
6548         ;;
6549 esac
6550 $cat <<EOM
6551
6552 The installation process will create a directory for
6553 site-specific extensions and modules.  Most users find it convenient
6554 to place all site-specific files in this directory rather than in the
6555 main distribution directory.
6556
6557 EOM
6558 fn=d~+
6559 rp='Pathname for the site-specific library files?'
6560 . ./getfile
6561 prefixvar=sitelib
6562 . ./setprefixvar
6563 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6564
6565 : determine where site specific architecture-dependent libraries go.
6566 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6567 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6568 : sitelib may have an optional trailing /share.
6569 case "$sitearch" in
6570 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6571         dflt="$dflt/$archname"
6572         ;;
6573 *)      dflt="$sitearch"
6574         ;;
6575 esac
6576 set sitearch sitearch none
6577 eval $prefixit
6578 $cat <<EOM
6579
6580 The installation process will also create a directory for
6581 architecture-dependent site-specific extensions and modules.
6582
6583 EOM
6584 fn=d~+
6585 rp='Pathname for the site-specific architecture-dependent library files?'
6586 . ./getfile
6587 prefixvar=sitearch
6588 . ./setprefixvar
6589 if $test X"$sitearch" = X"$sitelib"; then
6590         d_sitearch="$undef"
6591 else
6592         d_sitearch="$define"
6593 fi
6594
6595 $cat <<EOM
6596
6597 The installation process will also create a directory for
6598 vendor-supplied add-ons.  Vendors who supply perl with their system
6599 may find it convenient to place all vendor-supplied files in this
6600 directory rather than in the main distribution directory.  This will
6601 ease upgrades between binary-compatible maintenance versions of perl.
6602
6603 Of course you may also use these directories in whatever way you see
6604 fit.  For example, you might use them to access modules shared over a
6605 company-wide network.
6606
6607 The default answer should be fine for most people.
6608 This causes further questions about vendor add-ons to be skipped
6609 and no vendor-specific directories will be configured for perl.
6610
6611 EOM
6612 rp='Do you want to configure vendor-specific add-on directories?'
6613 case "$usevendorprefix" in
6614 define|true|[yY]*) dflt=y ;;
6615 *)      : User may have set vendorprefix directly on Configure command line.
6616         case "$vendorprefix" in
6617         ''|' ') dflt=n ;;
6618         *)      dflt=y ;;
6619         esac
6620         ;;
6621 esac
6622 . ./myread
6623 case "$ans" in
6624 [yY]*)  fn=d~+
6625         rp='Installation prefix to use for vendor-supplied add-ons?'
6626         case "$vendorprefix" in
6627         '') dflt='' ;;
6628         *)  dflt=$vendorprefix ;;
6629         esac
6630         . ./getfile
6631         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6632         oldvendorprefix=''
6633         case "$vendorprefix" in
6634         '') ;;
6635         *)      case "$ans" in
6636                 "$prefix") ;;
6637                 *) oldvendorprefix="$prefix";;
6638                 esac
6639                 ;;
6640         esac
6641         usevendorprefix="$define"
6642         vendorprefix="$ans"
6643         vendorprefixexp="$ansexp"
6644         ;;
6645 *)      usevendorprefix="$undef"
6646         vendorprefix=''
6647         vendorprefixexp=''
6648         ;;
6649 esac
6650
6651 case "$vendorprefix" in
6652 '')     d_vendorlib="$undef"
6653         vendorlib=''
6654         vendorlibexp=''
6655         ;;
6656 *)      d_vendorlib="$define"
6657         : determine where vendor-supplied modules go.
6658         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6659         case "$vendorlib" in
6660         '')
6661                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6662                 case "$installstyle" in
6663                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6664                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6665                 esac
6666                 ;;
6667         *)      dflt="$vendorlib"
6668                 ;;
6669         esac
6670         fn=d~+
6671         rp='Pathname for the vendor-supplied library files?'
6672         . ./getfile
6673         vendorlib="$ans"
6674         vendorlibexp="$ansexp"
6675         ;;
6676 esac
6677 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6678 prefixvar=vendorlib
6679 . ./installprefix
6680
6681 case "$vendorprefix" in
6682 '')     d_vendorarch="$undef"
6683         vendorarch=''
6684         vendorarchexp=''
6685         ;;
6686 *)      d_vendorarch="$define"
6687         : determine where vendor-supplied architecture-dependent libraries go.
6688         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6689         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6690         : vendorlib may have an optional trailing /share.
6691         case "$vendorarch" in
6692         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6693                 dflt="$dflt/$archname"
6694                 ;;
6695         *)      dflt="$vendorarch" ;;
6696         esac
6697         fn=d~+
6698         rp='Pathname for vendor-supplied architecture-dependent files?'
6699         . ./getfile
6700         vendorarch="$ans"
6701         vendorarchexp="$ansexp"
6702         ;;
6703 esac
6704 prefixvar=vendorarch
6705 . ./installprefix
6706
6707 : Final catch-all directories to search
6708 $cat <<EOM
6709
6710 Lastly, you can have perl look in other directories for extensions and
6711 modules in addition to those already specified.
6712 These directories will be searched after 
6713         $sitearch 
6714         $sitelib 
6715 EOM
6716 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6717 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6718 echo ' '
6719 case "$otherlibdirs" in
6720 ''|' ') dflt='none' ;;
6721 *)      dflt="$otherlibdirs" ;;
6722 esac
6723 $cat <<EOM
6724 Enter a colon-separated set of extra paths to include in perl's @INC
6725 search path, or enter 'none' for no extra paths.
6726
6727 EOM
6728
6729 rp='Colon-separated list of additional directories for perl to search?'
6730 . ./myread
6731 case "$ans" in
6732 ' '|''|none)    otherlibdirs=' ' ;;     
6733 *)      otherlibdirs="$ans" ;;
6734 esac
6735 case "$otherlibdirs" in
6736 ' ') val=$undef ;;
6737 *)      val=$define ;;
6738 esac
6739 set d_perl_otherlibdirs
6740 eval $setvar
6741
6742 : Cruising for prototypes
6743 echo " "
6744 echo "Checking out function prototypes..." >&4
6745 $cat >prototype.c <<EOCP
6746 #$i_stdlib I_STDLIB
6747 #ifdef I_STDLIB
6748 #include <stdlib.h>
6749 #endif
6750 int main(int argc, char *argv[]) {
6751         exit(0);}
6752 EOCP
6753 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6754         echo "Your C compiler appears to support function prototypes."
6755         val="$define"
6756 else
6757         echo "Your C compiler doesn't seem to understand function prototypes."
6758         val="$undef"
6759 fi
6760 set prototype
6761 eval $setvar
6762 $rm -f prototype*
6763
6764 case "$prototype" in
6765 "$define") ;;
6766 *)      ansi2knr='ansi2knr'
6767         echo " "
6768         cat <<EOM >&4
6769
6770 $me:  FATAL ERROR:
6771 This version of $package can only be compiled by a compiler that 
6772 understands function prototypes.  Unfortunately, your C compiler 
6773         $cc $ccflags
6774 doesn't seem to understand them.  Sorry about that.
6775
6776 If GNU cc is available for your system, perhaps you could try that instead.  
6777
6778 Eventually, we hope to support building Perl with pre-ANSI compilers.
6779 If you would like to help in that effort, please contact <perlbug@perl.org>.
6780
6781 Aborting Configure now.
6782 EOM
6783         exit 2
6784         ;;
6785 esac
6786
6787 echo " "
6788 case "$extras" in
6789 '') dflt='n';;
6790 *) dflt='y';;
6791 esac
6792 cat <<EOM
6793 Perl can be built with extra modules or bundles of modules which
6794 will be fetched from the CPAN and installed alongside Perl.
6795
6796 Notice that you will need access to the CPAN; either via the Internet,
6797 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6798 be asked later to configure the CPAN.pm module which will in turn do
6799 the installation of the rest of the extra modules or bundles.)
6800
6801 Notice also that if the modules require any external software such as
6802 libraries and headers (the libz library and the zlib.h header for the
6803 Compress::Zlib module, for example) you MUST have any such software
6804 already installed, this configuration process will NOT install such
6805 things for you.
6806
6807 If this doesn't make any sense to you, just accept the default '$dflt'.
6808 EOM
6809 rp='Install any extra modules (y or n)?'
6810 . ./myread
6811 case "$ans" in
6812 y|Y)
6813         cat <<EOM
6814
6815 Please list any extra modules or bundles to be installed from CPAN,
6816 with spaces between the names.  The names can be in any format the
6817 'install' command of CPAN.pm will understand.  (Answer 'none',
6818 without the quotes, to install no extra modules or bundles.)
6819 EOM
6820         rp='Extras?'
6821         dflt="$extras"
6822         . ./myread
6823         extras="$ans"
6824 esac
6825 case "$extras" in
6826 ''|'none')
6827         val=''
6828         $rm -f ../extras.lst
6829         ;;
6830 *)      echo "(Saving the list of extras for later...)"
6831         echo "$extras" > ../extras.lst
6832         val="'$extras'"
6833         ;;
6834 esac
6835 set extras
6836 eval $setvar
6837 echo " "
6838
6839 : determine where html pages for programs go
6840 set html1dir html1dir none
6841 eval $prefixit
6842 $cat <<EOM
6843
6844 If you wish to install html files for programs in $spackage, indicate 
6845 the appropriate directory here.  To skip installing html files,
6846 answer "none".
6847 EOM
6848 case "$html1dir" in
6849 ''|none|$undef|' ') dflt=none ;;
6850 *) dflt=$html1dir ;;
6851 esac
6852 fn=dn+~
6853 rp="Directory for the main $spackage html pages?"
6854 . ./getfile
6855 prefixvar=html1dir
6856 . ./setprefixvar
6857 : Use ' ' for none so value is preserved next time through Configure
6858 $test X"$html1dir" = "X" && html1dir=' '
6859
6860 : determine where html pages for libraries and modules go
6861 set html3dir html3dir none
6862 eval $prefixit
6863 $cat <<EOM
6864
6865 If you wish to install html files for modules associated with $spackage,
6866 indicate the appropriate directory here.  To skip installing html files,
6867 answer "none".
6868 EOM
6869 : There is no obvious default.  If they have specified html1dir, then
6870 : try to key off that, possibly changing .../html1 into .../html3.
6871 case "$html3dir" in
6872 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6873 *) dflt=$html3dir ;;
6874 esac
6875 fn=dn+~
6876 rp="Directory for the $spackage module html pages?"
6877 . ./getfile
6878 prefixvar=html3dir
6879 . ./setprefixvar
6880 : Use ' ' for none so value is preserved next time through Configure
6881 $test X"$html3dir" = "X" && html3dir=' '
6882
6883 : Find perl5.005 or later.
6884 echo "Looking for a previously installed perl5.005 or later... "
6885 case "$perl5" in
6886 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6887                 : Check if this perl is recent and can load a simple module
6888                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6889                         perl5=$tdir/perl
6890                         break;
6891                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6892                         perl5=$tdir/perl5
6893                         break;
6894                 fi
6895         done
6896         ;;
6897 *)      perl5="$perl5"
6898         ;;
6899 esac
6900 case "$perl5" in
6901 '')     echo "None found.  That's ok.";;
6902 *)      echo "Using $perl5." ;;
6903 esac
6904
6905 : Determine list of previous versions to include in @INC
6906 $cat > getverlist <<EOPL
6907 #!$perl5 -w
6908 use File::Basename;
6909 \$api_versionstring = "$api_versionstring";
6910 \$version = "$version";
6911 \$stem = "$sitelib_stem";
6912 \$archname = "$archname";
6913 EOPL
6914         $cat >> getverlist <<'EOPL'
6915 # Can't have leading @ because metaconfig interprets it as a command!
6916 ;@inc_version_list=();
6917 # XXX Redo to do opendir/readdir? 
6918 if (-d $stem) {
6919     chdir($stem);
6920     ;@candidates = glob("5.*");
6921 }
6922 else {
6923     ;@candidates = ();
6924 }
6925
6926 # XXX ToDo:  These comparisons must be reworked when two-digit
6927 # subversions come along, so that 5.7.10 compares as greater than
6928 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6929 # widespread that we can use the built-in version vectors rather
6930 # than reinventing them here.  For 5.6.0, however, we must
6931 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6932 foreach $d (@candidates) {
6933     if ($d lt $version) {
6934         if ($d ge $api_versionstring) {
6935             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6936         }
6937         elsif ($d ge "5.005") {
6938             unshift(@inc_version_list, grep { -d } $d);
6939         }
6940     }
6941     else {
6942         # Skip newer version.  I.e. don't look in
6943         # 5.7.0 if we're installing 5.6.1.
6944     }
6945 }
6946
6947 if (@inc_version_list) {
6948     print join(' ', @inc_version_list);
6949 }
6950 else {
6951     # Blank space to preserve value for next Configure run.
6952     print " ";
6953 }
6954 EOPL
6955 chmod +x getverlist
6956 case "$inc_version_list" in
6957 '')     if test -x "$perl5$exe_ext"; then
6958                 dflt=`$perl5 getverlist`
6959         else
6960                 dflt='none'
6961         fi
6962         ;;
6963 $undef) dflt='none' ;;
6964 *)  eval dflt=\"$inc_version_list\" ;;
6965 esac
6966 case "$dflt" in
6967 ''|' ') dflt=none ;;
6968 esac
6969 case "$dflt" in
6970 5.005) dflt=none ;;
6971 esac
6972 $cat <<EOM
6973
6974 In order to ease the process of upgrading, this version of perl 
6975 can be configured to use modules built and installed with earlier 
6976 versions of perl that were installed under $prefix.  Specify here
6977 the list of earlier versions that this version of perl should check.
6978 If Configure detected no earlier versions of perl installed under
6979 $prefix, then the list will be empty.  Answer 'none' to tell perl
6980 to not search earlier versions.
6981
6982 The default should almost always be sensible, so if you're not sure,
6983 just accept the default.
6984 EOM
6985
6986 rp='List of earlier versions to include in @INC?'
6987 . ./myread
6988 case "$ans" in
6989 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6990 *) inc_version_list="$ans" ;;
6991 esac
6992 case "$inc_version_list" in
6993 ''|' ') 
6994         inc_version_list_init='0'
6995         d_inc_version_list="$undef"
6996         ;;
6997 *)      inc_version_list_init=`echo $inc_version_list |
6998                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6999         d_inc_version_list="$define"
7000         ;;
7001 esac
7002 $rm -f getverlist
7003
7004 : determine whether to install perl also as /usr/bin/perl
7005
7006 echo " "
7007 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7008         $cat <<EOM
7009 Many scripts expect perl to be installed as /usr/bin/perl.
7010
7011 If you want to, I can install the perl you are about to compile
7012 as /usr/bin/perl (in addition to $bin/perl).
7013 EOM
7014         if test -f /usr/bin/perl; then
7015             $cat <<EOM
7016
7017 However, please note that because you already have a /usr/bin/perl,
7018 overwriting that with a new Perl would very probably cause problems.
7019 Therefore I'm assuming you don't want to do that (unless you insist).
7020
7021 EOM
7022             case "$installusrbinperl" in
7023             "$define"|[yY]*)    dflt='y';;
7024             *)                  dflt='n';;
7025             esac
7026         else
7027             $cat <<EOM
7028
7029 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7030
7031 EOM
7032             case "$installusrbinperl" in
7033             "$undef"|[nN]*)     dflt='n';;
7034             *)                  dflt='y';;
7035             esac
7036         fi
7037         rp="Do you want to install perl as /usr/bin/perl?"
7038         . ./myread
7039         case "$ans" in
7040         [yY]*)  val="$define";;
7041         *)      val="$undef" ;;
7042         esac
7043 else
7044         val="$undef"
7045 fi
7046 set installusrbinperl
7047 eval $setvar
7048
7049 echo " "
7050 echo "Checking for GNU C Library..." >&4
7051 cat >try.c <<'EOCP'
7052 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7053    alone are insufficient to distinguish different versions, such as
7054    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7055    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7056 */
7057 #include <stdio.h>
7058 int main(void)
7059 {
7060 #ifdef __GLIBC__
7061 #   ifdef __GLIBC_MINOR__
7062 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7063 #           include <gnu/libc-version.h>
7064             printf("%s\n",  gnu_get_libc_version());
7065 #       else
7066             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7067 #       endif
7068 #   else
7069         printf("%d\n",  __GLIBC__);
7070 #   endif
7071     return 0;
7072 #else
7073     return 1;
7074 #endif
7075 }
7076 EOCP
7077 set try
7078 if eval $compile_ok && $run ./try > glibc.ver; then
7079         val="$define"
7080         gnulibc_version=`$cat glibc.ver`
7081         echo "You are using the GNU C Library version $gnulibc_version"
7082 else
7083         val="$undef"
7084         gnulibc_version=''
7085         echo "You are not using the GNU C Library"
7086 fi
7087 $rm -f try try.* glibc.ver
7088 set d_gnulibc
7089 eval $setvar
7090
7091 : see if nm is to be used to determine whether a symbol is defined or not
7092 case "$usenm" in
7093 '')
7094         dflt=''
7095         case "$d_gnulibc" in
7096         "$define")
7097                 echo " "
7098                 echo "nm probably won't work on the GNU C Library." >&4
7099                 dflt=n
7100                 ;;
7101         esac
7102         case "$dflt" in
7103         '') 
7104                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7105                         echo " "
7106                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7107                         echo "'nm' won't be sufficient on this sytem." >&4
7108                         dflt=n
7109                 fi
7110                 ;;
7111         esac
7112         case "$dflt" in
7113         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7114                 if $test $dflt -gt 20; then
7115                         dflt=y
7116                 else
7117                         dflt=n
7118                 fi
7119                 ;;
7120         esac
7121         ;;
7122 *)
7123         case "$usenm" in
7124         true|$define) dflt=y;;
7125         *) dflt=n;;
7126         esac
7127         ;;
7128 esac
7129 $cat <<EOM
7130
7131 I can use $nm to extract the symbols from your C libraries. This
7132 is a time consuming task which may generate huge output on the disk (up
7133 to 3 megabytes) but that should make the symbols extraction faster. The
7134 alternative is to skip the 'nm' extraction part and to compile a small
7135 test program instead to determine whether each symbol is present. If
7136 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7137 this may be the best solution.
7138
7139 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7140
7141 EOM
7142 rp="Shall I use $nm to extract C symbols from the libraries?"
7143 . ./myread
7144 case "$ans" in
7145 [Nn]*) usenm=false;;
7146 *) usenm=true;;
7147 esac
7148
7149 runnm=$usenm
7150 case "$reuseval" in
7151 true) runnm=false;;
7152 esac
7153
7154 : nm options which may be necessary
7155 case "$nm_opt" in
7156 '') if $test -f /mach_boot; then
7157                 nm_opt=''       # Mach
7158         elif $test -d /usr/ccs/lib; then
7159                 nm_opt='-p'     # Solaris (and SunOS?)
7160         elif $test -f /dgux; then
7161                 nm_opt='-p'     # DG-UX
7162         elif $test -f /lib64/rld; then
7163                 nm_opt='-p'     # 64-bit Irix
7164         else
7165                 nm_opt=''
7166         fi;;
7167 esac
7168
7169 : nm options which may be necessary for shared libraries but illegal
7170 : for archive libraries.  Thank you, Linux.
7171 case "$nm_so_opt" in
7172 '')     case "$myuname" in
7173         *linux*|gnu*)
7174                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7175                         nm_so_opt='--dynamic'
7176                 fi
7177                 ;;
7178         esac
7179         ;;
7180 esac
7181
7182 case "$runnm" in
7183 true)
7184 : get list of predefined functions in a handy place
7185 echo " "
7186 case "$libc" in
7187 '') libc=unknown
7188         case "$libs" in
7189         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7190         esac
7191         ;;
7192 esac
7193 case "$libs" in
7194 '') ;;
7195 *)  for thislib in $libs; do
7196         case "$thislib" in
7197         -lc|-lc_s)
7198                 : Handle C library specially below.
7199                 ;;
7200         -l*)
7201                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7202                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7203                         :
7204                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7205                         :
7206                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7207                         :
7208                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7209                         :
7210                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7211                         :
7212                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7213                         :
7214                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7215                         :
7216                 else
7217                         try=''
7218                 fi
7219                 libnames="$libnames $try"
7220                 ;;
7221         *) libnames="$libnames $thislib" ;;
7222         esac
7223         done
7224         ;;
7225 esac
7226 xxx=normal
7227 case "$libc" in
7228 unknown)
7229         set /lib/libc.$so
7230         for xxx in $libpth; do
7231                 $test -r $1 || set $xxx/libc.$so
7232                 : The messy sed command sorts on library version numbers.
7233                 $test -r $1 || \
7234                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7235                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7236                                 h
7237                                 s/[0-9][0-9]*/0000&/g
7238                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7239                                 G
7240                                 s/\n/ /' | \
7241                          $sort | $sed -e 's/^.* //'`
7242                 eval set \$$#
7243         done
7244         $test -r $1 || set /usr/ccs/lib/libc.$so
7245         $test -r $1 || set /lib/libsys_s$_a
7246         ;;
7247 *)
7248         set blurfl
7249         ;;
7250 esac
7251 if $test -r "$1"; then
7252         echo "Your (shared) C library seems to be in $1."
7253         libc="$1"
7254 elif $test -r /lib/libc && $test -r /lib/clib; then
7255         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7256         xxx=apollo
7257         libc='/lib/clib /lib/libc'
7258         if $test -r /lib/syslib; then
7259                 echo "(Your math library is in /lib/syslib.)"
7260                 libc="$libc /lib/syslib"
7261         fi
7262 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7263         echo "Your C library seems to be in $libc, as you said before."
7264 elif $test -r $incpath/usr/lib/libc$_a; then
7265         libc=$incpath/usr/lib/libc$_a;
7266         echo "Your C library seems to be in $libc.  That's fine."
7267 elif $test -r /lib/libc$_a; then
7268         libc=/lib/libc$_a;
7269         echo "Your C library seems to be in $libc.  You're normal."
7270 else
7271         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7272                 :
7273         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7274                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7275         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7276                 :
7277         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7278                 :
7279         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7280                 :
7281         else
7282                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7283         fi
7284         if $test -r "$tans"; then
7285                 echo "Your C library seems to be in $tans, of all places."
7286                 libc=$tans
7287         else
7288                 libc='blurfl'
7289         fi
7290 fi
7291 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7292         dflt="$libc"
7293         cat <<EOM
7294
7295 If the guess above is wrong (which it might be if you're using a strange
7296 compiler, or your machine supports multiple models), you can override it here.
7297
7298 EOM
7299 else
7300         dflt=''
7301         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7302         cat >&4 <<EOM
7303 I can't seem to find your C library.  I've looked in the following places:
7304
7305 EOM
7306         $sed 's/^/      /' libpath
7307         cat <<EOM
7308
7309 None of these seems to contain your C library. I need to get its name...
7310
7311 EOM
7312 fi
7313 fn=f
7314 rp='Where is your C library?'
7315 . ./getfile
7316 libc="$ans"
7317
7318 echo " "
7319 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7320 set X `cat libnames`
7321 shift
7322 xxx=files
7323 case $# in 1) xxx=file; esac
7324 echo "Extracting names from the following $xxx for later perusal:" >&4
7325 echo " "
7326 $sed 's/^/      /' libnames >&4
7327 echo " "
7328 $echo $n "This may take a while...$c" >&4
7329
7330 for file in $*; do
7331         case $file in
7332         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7333         *) $nm $nm_opt $file 2>/dev/null;;
7334         esac
7335 done >libc.tmp
7336
7337 $echo $n ".$c"
7338 $grep fprintf libc.tmp > libc.ptf
7339 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7340 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7341 xxx='[ADTSIW]'
7342 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7343         eval $xscan;\
7344         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7345                 eval $xrun
7346 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7347         eval $xscan;\
7348         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7349                 eval $xrun
7350 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7351         eval $xscan;\
7352         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7353                 eval $xrun
7354 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7355         eval $xscan;\
7356         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7357                 eval $xrun
7358 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7359         eval $xscan;\
7360         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7361                 eval $xrun
7362 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7363         eval $xscan;\
7364         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7365                 eval $xrun
7366 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7367                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7368         eval $xscan;\
7369         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7370                 eval $xrun
7371 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7372         eval $xscan;\
7373         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7374                 eval $xrun
7375 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7376         eval $xscan;\
7377         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7378                 eval $xrun
7379 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7380         eval $xscan;\
7381         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7382                 eval $xrun
7383 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7384         eval $xscan;\
7385         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7386                 eval $xrun
7387 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7388         eval $xscan;\
7389         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7390                 eval $xrun
7391 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7392         eval $xscan;\
7393         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7394                 eval $xrun
7395 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7396         eval $xscan;\
7397         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7398                 eval $xrun
7399 else
7400         $nm -p $* 2>/dev/null >libc.tmp
7401         $grep fprintf libc.tmp > libc.ptf
7402         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7403                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7404         then
7405                 nm_opt='-p'
7406                 eval $xrun
7407         else
7408                 echo " "
7409                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7410                 com=''
7411                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7412                         for thisname in $libnames $libc; do
7413                                 $ar t $thisname >>libc.tmp
7414                         done
7415                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7416                         echo "Ok." >&4
7417                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7418                         # Repeat libc to extract forwarders to DLL entries too
7419                         for thisname in $libnames $libc; do
7420                                 $ar tv $thisname >>libc.tmp
7421                                 # Revision 50 of EMX has bug in $ar.
7422                                 # it will not extract forwarders to DLL entries
7423                                 # Use emximp which will extract exactly them.
7424                                 emximp -o tmp.imp $thisname \
7425                                     2>/dev/null && \
7426                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7427                                     < tmp.imp >>libc.tmp
7428                                 $rm tmp.imp
7429                         done
7430                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7431                         echo "Ok." >&4
7432                 else
7433                         echo "$ar didn't seem to work right." >&4
7434                         echo "Maybe this is a Cray...trying bld instead..." >&4
7435                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7436                         then
7437                                 for thisname in $libnames; do
7438                                         bld t $libnames | \
7439                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7440                                         $ar t $thisname >>libc.tmp
7441                                 done
7442                                 echo "Ok." >&4
7443                         else
7444                                 echo "That didn't work either.  Giving up." >&4
7445                                 exit 1
7446                         fi
7447                 fi
7448         fi
7449 fi
7450 nm_extract="$com"
7451 case "$PASE" in
7452 define)
7453     echo " "
7454     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7455     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7456     ;;
7457 *)  if $test -f /lib/syscalls.exp; then
7458         echo " "
7459         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7460         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7461     fi
7462     ;;
7463 esac
7464 ;;
7465 esac
7466 $rm -f libnames libpath
7467
7468 : see if dld is available
7469 set dld.h i_dld
7470 eval $inhdr
7471
7472 : is a C symbol defined?
7473 csym='tlook=$1;
7474 case "$3" in
7475 -v) tf=libc.tmp; tdc="";;
7476 -a) tf=libc.tmp; tdc="[]";;
7477 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7478 esac;
7479 tx=yes;
7480 case "$reuseval-$4" in
7481 true-) ;;
7482 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7483 esac;
7484 case "$tx" in
7485 yes)
7486         tval=false;
7487         if $test "$runnm" = true; then
7488                 if $contains $tlook $tf >/dev/null 2>&1; then
7489                         tval=true;
7490                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7491                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7492                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7493                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7494                         $rm -f try$_exe try.c core core.* try.core;
7495                 fi;
7496         else
7497                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7498                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7499                 $rm -f try$_exe try.c;
7500         fi;
7501         ;;
7502 *)
7503         case "$tval" in
7504         $define) tval=true;;
7505         *) tval=false;;
7506         esac;
7507         ;;
7508 esac;
7509 eval "$2=$tval"'
7510
7511 : define an is-in-libc? function
7512 inlibc='echo " "; td=$define; tu=$undef;
7513 sym=$1; var=$2; eval "was=\$$2";
7514 tx=yes;
7515 case "$reuseval$was" in
7516 true) ;;
7517 true*) tx=no;;
7518 esac;
7519 case "$tx" in
7520 yes)
7521         set $sym tres -f;
7522         eval $csym;
7523         case "$tres" in
7524         true)
7525                 echo "$sym() found." >&4;
7526                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7527         *)
7528                 echo "$sym() NOT found." >&4;
7529                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7530         esac;;
7531 *)
7532         case "$was" in
7533         $define) echo "$sym() found." >&4;;
7534         *) echo "$sym() NOT found." >&4;;
7535         esac;;
7536 esac'
7537
7538 : see if dlopen exists
7539 xxx_runnm="$runnm"
7540 runnm=false
7541 set dlopen d_dlopen
7542 eval $inlibc
7543 runnm="$xxx_runnm"
7544
7545 : determine which dynamic loading, if any, to compile in
7546 echo " "
7547 dldir="ext/DynaLoader"
7548 case "$usedl" in
7549 $define|y|true)
7550         dflt='y'
7551         usedl="$define"
7552         ;;
7553 $undef|n|false)
7554         dflt='n'
7555         usedl="$undef"
7556         ;;
7557 *) 
7558         dflt='n'
7559         case "$d_dlopen" in
7560             $define) dflt='y' ;;
7561         esac
7562         case "$i_dld" in
7563             $define) dflt='y' ;;
7564         esac
7565         : Does a dl_xxx.xs file exist for this operating system
7566         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7567         ;;
7568 esac
7569 rp="Do you wish to use dynamic loading?"
7570 . ./myread
7571 usedl="$ans"
7572 case "$ans" in
7573 y*) usedl="$define"
7574         case "$dlsrc" in
7575         '')
7576                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7577                         dflt="$dldir/dl_${osname}.xs"
7578                 elif $test "$d_dlopen" = "$define" ; then
7579                         dflt="$dldir/dl_dlopen.xs"
7580                 elif $test "$i_dld" = "$define" ; then
7581                         dflt="$dldir/dl_dld.xs"
7582                 else
7583                         dflt=''
7584                 fi
7585                 ;;
7586         *)      dflt="$dldir/$dlsrc"
7587                 ;;
7588         esac
7589     echo "The following dynamic loading files are available:"
7590         : Can not go over to $dldir because getfile has path hard-coded in.
7591         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7592         rp="Source file to use for dynamic loading"
7593         fn="fne"
7594         gfpth="$src"
7595         . ./getfile
7596         usedl="$define"
7597         : emulate basename
7598         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7599
7600         $cat << EOM
7601
7602 Some systems may require passing special flags to $cc -c to
7603 compile modules that will be used to create a shared library.
7604 To use no flags, say "none".
7605
7606 EOM
7607     case "$cccdlflags" in
7608     '') case "$gccversion" in
7609                 '') case "$osname" in
7610                         hpux)   dflt='+z' ;;
7611                         next)   dflt='none' ;;
7612                         irix*)  dflt='-KPIC' ;;
7613                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7614                         sunos)  dflt='-pic' ;;
7615                         *)      dflt='none' ;;
7616                     esac
7617                         ;;
7618                 *)  case "$osname" in
7619                         darwin) dflt='none' ;;
7620                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7621                         *)      dflt='-fpic' ;;
7622                     esac ;;
7623             esac ;;
7624         ' ') dflt='none' ;;
7625     *)  dflt="$cccdlflags" ;;
7626     esac
7627     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7628     . ./myread
7629     case "$ans" in
7630     none) cccdlflags=' ' ;;
7631     *) cccdlflags="$ans" ;;
7632     esac
7633
7634     cat << EOM
7635
7636 Some systems use ld to create libraries that can be dynamically loaded,
7637 while other systems (such as those using ELF) use $cc.
7638
7639 EOM
7640         case "$ld" in
7641         '')     $cat >try.c <<EOM
7642 /* Test for whether ELF binaries are produced */
7643 #include <fcntl.h>
7644 #$i_stdlib I_STDLIB
7645 #ifdef I_STDLIB
7646 #include <stdlib.h>
7647 #endif
7648 int main() {
7649         char b[4];
7650         int i = open("a.out",O_RDONLY);
7651         if(i == -1) 
7652                 exit(1); /* fail */
7653         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7654                 exit(0); /* succeed (yes, it's ELF) */
7655         else
7656                 exit(1); /* fail */
7657 }
7658 EOM
7659                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7660                         cat <<EOM
7661 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7662 EOM
7663                         dflt="$cc"
7664                 else
7665                         echo "I'll use ld to build dynamic libraries."
7666                         dflt='ld'
7667                 fi
7668                 rm -f try.c a.out
7669                 ;;
7670         *)      dflt="$ld"
7671                 ;;
7672         esac
7673
7674     rp="What command should be used to create dynamic libraries?"
7675     . ./myread
7676         ld="$ans"
7677
7678     cat << EOM
7679
7680 Some systems may require passing special flags to $ld to create a
7681 library that can be dynamically loaded.  If your ld flags include
7682 -L/other/path options to locate libraries outside your loader's normal
7683 search path, you may need to specify those -L options here as well.  To
7684 use no flags, say "none".
7685
7686 EOM
7687     case "$lddlflags" in
7688     '') case "$osname" in
7689                         beos) dflt='-nostart' ;;
7690                         hpux) dflt='-b';
7691                               case "$gccversion" in
7692                               '') dflt="$dflt +vnocompatwarnings" ;;
7693                               esac
7694                               ;;        
7695                         linux|irix*|gnu*)       dflt='-shared' ;;
7696                         next)  dflt='none' ;;
7697                         solaris) dflt='-G' ;;
7698                         sunos) dflt='-assert nodefinitions' ;;
7699                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7700                 *)     dflt='none' ;;
7701                         esac
7702                         ;;
7703     *) dflt="$lddlflags" ;;
7704     esac
7705
7706         : Try to guess additional flags to pick up local libraries.
7707         : Be careful not to append to a plain 'none'
7708         case "$dflt" in
7709         none) dflt='' ;;
7710         esac
7711         for thisflag in $ldflags; do
7712                 case "$thisflag" in
7713                 -L*|-R*|-Wl,-R*)
7714                         case " $dflt " in
7715                         *" $thisflag "*) ;;
7716                         *) dflt="$dflt $thisflag" ;;
7717                         esac
7718                         ;;
7719                 esac
7720         done
7721
7722         case "$dflt" in
7723         ''|' ') dflt='none' ;;
7724         esac
7725
7726     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7727     . ./myread
7728     case "$ans" in
7729     none) lddlflags=' ' ;;
7730     *) lddlflags="$ans" ;;
7731     esac
7732
7733         cat <<EOM
7734
7735 Some systems may require passing special flags to $cc to indicate that
7736 the resulting executable will use dynamic linking.  To use no flags,
7737 say "none".
7738
7739 EOM
7740     case "$ccdlflags" in
7741     '') case "$osname" in
7742             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7743             next|sunos) dflt='none' ;;
7744             *)          dflt='none' ;;
7745             esac ;;
7746     ' ')  dflt='none' ;;
7747     *)  dflt="$ccdlflags" ;;
7748     esac
7749     rp="Any special flags to pass to $cc to use dynamic linking?"
7750     . ./myread
7751     case "$ans" in
7752     none) ccdlflags=' ' ;;
7753     *) ccdlflags="$ans" ;;
7754     esac
7755     ;;
7756 *)  usedl="$undef"
7757         ld='ld'
7758     dlsrc='dl_none.xs'
7759     lddlflags=''
7760     ccdlflags=''
7761     ;;
7762 esac
7763
7764 also=''
7765 case "$usedl" in
7766 $undef)
7767         # No dynamic loading being used, so don't bother even to prompt.
7768         useshrplib='false'
7769         ;;
7770 *)      case "$useshrplib" in
7771         '')     case "$osname" in
7772                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7773                         dflt=y
7774                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7775                         ;;
7776                 next*)
7777                         case "$osvers" in
7778                         4*)     dflt=y
7779                                 also='Building a shared libperl is needed for MAB support.'
7780                                 ;;
7781                         *)      dflt=n
7782                                 ;;
7783                         esac
7784                         ;;
7785                 *)      dflt=n
7786                         ;;
7787                 esac
7788                 ;;
7789         $define|true|[Yy]*)
7790                 dflt=y
7791                 ;;
7792         *)      dflt=n
7793                 ;;
7794         esac
7795         $cat << EOM
7796
7797 The perl executable is normally obtained by linking perlmain.c with
7798 libperl${_a}, any static extensions (usually just DynaLoader), and
7799 any other libraries needed on this system (such as -lm, etc.).  Since
7800 your system supports dynamic loading, it is probably possible to build
7801 a shared libperl.$so.  If you will have more than one executable linked
7802 to libperl.$so, this will significantly reduce the size of each
7803 executable, but it may have a noticeable effect on performance.  The
7804 default is probably sensible for your system.
7805 $also
7806
7807 EOM
7808         rp="Build a shared libperl.$so (y/n)"
7809         . ./myread
7810         case "$ans" in
7811         true|$define|[Yy]*)
7812                 useshrplib='true'  ;;
7813         *)      useshrplib='false' ;;
7814         esac
7815         ;;
7816 esac
7817
7818 case "$useshrplib" in
7819 true)
7820         case "$libperl" in
7821         '')
7822                 # Figure out a good name for libperl.so.  Since it gets stored in
7823                 # a version-specific architecture-dependent library, the version
7824                 # number isn't really that important, except for making cc/ld happy.
7825                 #
7826                 # A name such as libperl.so.3.1
7827                 majmin="libperl.$so.$patchlevel.$subversion"
7828                 # A name such as libperl.so.301
7829                 majonly=`echo $patchlevel $subversion |
7830                         $awk '{printf "%d%02d", $1, $2}'`
7831                 majonly=libperl.$so.$majonly
7832                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7833                 # rely on figuring it out from the naming of libc.
7834                 case "${osname}${osvers}" in
7835                 next4*)
7836                         dflt=libperl.5.$so
7837                         # XXX How handle the --version stuff for MAB?
7838                         ;;
7839                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7840                         dflt=libperl.$so
7841                         ;;
7842                 cygwin*) # ld links against an importlib
7843                         dflt=libperl$lib_ext
7844                         ;;
7845                 *)      # Try to guess based on whether libc has major.minor.
7846                         case "$libc" in
7847                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7848                         *libc.$so.[0-9]*) dflt=$majonly ;;
7849                         *)      dflt=libperl.$so ;;
7850                         esac
7851                         ;;
7852                 esac
7853                 ;;
7854         *)      dflt=$libperl
7855                 ;;
7856         esac
7857         cat << EOM
7858
7859 I need to select a good name for the shared libperl.  If your system uses
7860 library names with major and minor numbers, then you might want something
7861 like $majmin.  Alternatively, if your system uses a single version
7862 number for shared libraries, then you might want to use $majonly.
7863 Or, your system might be quite happy with a simple libperl.$so.
7864
7865 Since the shared libperl will get installed into a version-specific
7866 architecture-dependent directory, the version number of the shared perl
7867 library probably isn't important, so the default should be o.k.
7868
7869 EOM
7870         rp='What name do you want to give to the shared libperl?'
7871         . ./myread
7872         libperl=$ans
7873         echo "Ok, I'll use $libperl"
7874         ;;
7875 *)
7876         libperl="libperl${_a}"
7877         ;;
7878 esac
7879
7880 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7881 case "$shrpdir" in
7882 '') ;;
7883 *)      $cat >&4 <<EOM
7884 WARNING:  Use of the shrpdir variable for the installation location of
7885 the shared $libperl is not supported.  It was never documented and
7886 will not work in this version.  Let me (perlbug@perl.org)
7887 know of any problems this may cause.
7888
7889 EOM
7890         case "$shrpdir" in
7891         "$archlibexp/CORE")
7892                 $cat >&4 <<EOM
7893 But your current setting of $shrpdir is
7894 the default anyway, so it's harmless.
7895 EOM
7896                 ;;
7897         *)
7898                 $cat >&4 <<EOM
7899 Further, your current attempted setting of $shrpdir
7900 conflicts with the value of $archlibexp/CORE
7901 that installperl will use.
7902 EOM
7903                 ;;
7904         esac
7905         ;;
7906 esac
7907
7908 # How will the perl executable find the installed shared $libperl?
7909 # Add $xxx to ccdlflags.
7910 # If we can't figure out a command-line option, use $shrpenv to
7911 # set env LD_RUN_PATH.  The main perl makefile uses this.
7912 shrpdir=$archlibexp/CORE
7913 xxx=''
7914 tmp_shrpenv=''
7915 if "$useshrplib"; then
7916     case "$osname" in 
7917         aix)
7918                 # We'll set it in Makefile.SH...
7919                 ;;
7920         solaris)
7921                 xxx="-R $shrpdir"
7922                 ;;
7923         freebsd|netbsd|openbsd|interix|dragonfly)
7924                 xxx="-Wl,-R$shrpdir"
7925                 ;;
7926         bsdos|linux|irix*|dec_osf|gnu*)
7927                 xxx="-Wl,-rpath,$shrpdir"
7928                 ;;
7929         next)
7930                 # next doesn't like the default...
7931                 ;;
7932         beos)
7933                 # beos doesn't like the default, either.
7934                 ;;
7935         hpux*)
7936                 # hpux doesn't like the default, either.
7937                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7938                 ;;
7939         *)
7940                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7941                 ;;
7942         esac
7943         case "$xxx" in
7944         '') ;;
7945         *)      
7946                 # Only add $xxx if it isn't already in ccdlflags.
7947                 case " $ccdlflags " in
7948                 *" $xxx "*)     ;;
7949                 *)      ccdlflags="$ccdlflags $xxx"
7950                         cat <<EOM >&4
7951
7952 Adding $xxx to the flags
7953 passed to $ld so that the perl executable will find the 
7954 installed shared $libperl.
7955
7956 EOM
7957                         ;;
7958                 esac
7959                 ;;
7960         esac
7961 fi
7962 # Fix ccdlflags in AIX for building external extensions.
7963 # (For building Perl itself bare -bE:perl.exp is needed,
7964 #  Makefile.SH takes care of this.)
7965 case "$osname" in
7966 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7967 esac
7968 # Respect a hint or command-line value.
7969 case "$shrpenv" in
7970 '') shrpenv="$tmp_shrpenv" ;;
7971 esac
7972 case "$ldlibpthname" in
7973 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7974 none)   ldlibpthname='' ;;
7975 esac
7976
7977 : determine where manual pages are on this system
7978 echo " "
7979 case "$sysman" in
7980 '') 
7981         syspath='/usr/share/man/man1 /usr/man/man1'
7982         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7983         syspath="$syspath /usr/man/u_man/man1"
7984         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7985         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7986         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7987         sysman=`./loc . /usr/man/man1 $syspath`
7988         ;;
7989 esac
7990 if $test -d "$sysman"; then
7991         echo "System manual is in $sysman." >&4
7992 else
7993         echo "Could not find manual pages in source form." >&4
7994 fi
7995
7996 : determine where manual pages go
7997 set man1dir man1dir none
7998 eval $prefixit
7999 $cat <<EOM
8000
8001 $spackage has manual pages available in source form.
8002 EOM
8003 case "$nroff" in
8004 nroff)
8005         echo "However, you don't have nroff, so they're probably useless to you."
8006         case "$man1dir" in
8007         '') man1dir="none";;
8008         esac;;
8009 esac
8010 echo "If you don't want the manual sources installed, answer 'none'."
8011 case "$man1dir" in
8012 ' ') dflt=none
8013         ;;
8014 '')
8015         lookpath="$prefixexp/share/man/man1"
8016         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8017         lookpath="$lookpath $prefixexp/man/p_man/man1"
8018         lookpath="$lookpath $prefixexp/man/u_man/man1"
8019         lookpath="$lookpath $prefixexp/man/man.1"
8020         case "$sysman" in
8021         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8022         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8023         esac
8024         set dflt
8025         eval $prefixup
8026         ;;
8027 *)  dflt="$man1dir"
8028         ;;
8029 esac
8030 echo " "
8031 fn=dn+~
8032 rp="Where do the main $spackage manual pages (source) go?"
8033 . ./getfile
8034 if $test "X$man1direxp" != "X$ansexp"; then
8035         installman1dir=''
8036 fi
8037 prefixvar=man1dir
8038 . ./setprefixvar
8039
8040 case "$man1dir" in
8041 '')     man1dir=' '
8042         installman1dir='';;
8043 esac
8044
8045 : What suffix to use on installed man pages
8046
8047 case "$man1dir" in
8048 ' ')
8049         man1ext='0'
8050         ;;
8051 *)
8052         rp="What suffix should be used for the main $spackage man pages?"
8053         case "$man1ext" in
8054         '')     case "$man1dir" in
8055                 *1)  dflt=1 ;;
8056                 *1p) dflt=1p ;;
8057                 *1pm) dflt=1pm ;;
8058                 *l) dflt=l;;
8059                 *n) dflt=n;;
8060                 *o) dflt=o;;
8061                 *p) dflt=p;;
8062                 *C) dflt=C;;
8063                 *L) dflt=L;;
8064                 *L1) dflt=L1;;
8065                 *) dflt=1;;
8066                 esac
8067                 ;;
8068         *)      dflt="$man1ext";;
8069         esac
8070         . ./myread
8071         man1ext="$ans"
8072         ;;
8073 esac
8074
8075 : see if we can have long filenames
8076 echo " "
8077 first=123456789abcdef
8078 $rm -f $first
8079 if (echo hi >$first) 2>/dev/null; then
8080         if $test -f 123456789abcde; then
8081                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8082                 val="$undef"
8083         else
8084                 echo 'You can have filenames longer than 14 characters.'>&4
8085                 val="$define"
8086         fi
8087 else
8088         $cat <<'EOM'
8089 You can't have filenames longer than 14 chars.
8090 You can't even think about them!
8091 EOM
8092         val="$undef"
8093 fi 
8094 set d_flexfnam
8095 eval $setvar
8096 $rm -rf 123456789abcde*
8097
8098 : determine where library module manual pages go
8099 set man3dir man3dir none
8100 eval $prefixit
8101 $cat <<EOM
8102
8103 $spackage has manual pages for many of the library modules.
8104 EOM
8105
8106 case "$nroff" in
8107 nroff)
8108         $cat <<'EOM'
8109 However, you don't have nroff, so they're probably useless to you.
8110 EOM
8111         case "$man3dir" in
8112         '') man3dir="none";;
8113         esac;;
8114 esac
8115
8116 case "$d_flexfnam" in
8117 undef)
8118         $cat <<'EOM'
8119 However, your system can't handle the long file names like File::Basename.3. 
8120 EOM
8121         case "$man3dir" in
8122         '') man3dir="none";;
8123         esac;;
8124 esac
8125
8126 echo "If you don't want the manual sources installed, answer 'none'."
8127 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8128 case "$man3dir" in
8129 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8130         if $test -d "$privlib/man/man3"; then
8131                 cat <<EOM >&4
8132
8133 WARNING:  Previous versions of perl installed man3 pages into
8134 $privlib/man/man3.  This version will suggest a 
8135 new default of $dflt.  
8136 EOM
8137                 tdflt=$dflt
8138                 dflt='n'
8139                 rp='Do you wish to preserve the old behavior?(y/n)'
8140                 . ./myread
8141                 case "$ans" in
8142                 y*) dflt="$privlib/man/man3" ;;
8143                 *)  dflt=$tdflt ;;
8144                 esac
8145     fi
8146         ;;
8147 *)      dflt="$man3dir" ;;
8148 esac
8149 case "$dflt" in
8150 ' ') dflt=none ;;
8151 esac
8152 echo " "
8153 fn=dn+~
8154 rp="Where do the $package library man pages (source) go?"
8155 . ./getfile
8156 prefixvar=man3dir
8157 . ./setprefixvar
8158
8159 case "$man3dir" in
8160 '')     man3dir=' '
8161         installman3dir='';;
8162 esac
8163
8164 : What suffix to use on installed man pages
8165 case "$man3dir" in
8166 ' ')
8167         man3ext='0'
8168         ;;
8169 *)
8170         rp="What suffix should be used for the $package library man pages?"
8171         case "$man3ext" in
8172         '')     case "$man3dir" in
8173                 *3)  dflt=3 ;;
8174                 *3p) dflt=3p ;;
8175                 *3pm) dflt=3pm ;;
8176                 *l) dflt=l;;
8177                 *n) dflt=n;;
8178                 *o) dflt=o;;
8179                 *p) dflt=p;;
8180                 *C) dflt=C;;
8181                 *L) dflt=L;;
8182                 *L3) dflt=L3;;
8183                 *) dflt=3;;
8184                 esac
8185                 ;;
8186         *)      dflt="$man3ext";;
8187         esac
8188         . ./myread
8189         man3ext="$ans"
8190         ;;
8191 esac
8192
8193 : see if we have to deal with yellow pages, now NIS.
8194 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8195         if $test -f /usr/etc/nibindd; then
8196                 echo " "
8197                 echo "I'm fairly confident you're on a NeXT."
8198                 echo " "
8199                 rp='Do you get the hosts file via NetInfo?'
8200                 dflt=y
8201                 case "$hostcat" in
8202                 nidump*) ;;
8203                 '') ;;
8204                 *) dflt=n;;
8205                 esac
8206                 . ./myread
8207                 case "$ans" in
8208                 y*) hostcat='nidump hosts .';;
8209                 *)      case "$hostcat" in
8210                         nidump*) hostcat='';;
8211                         esac
8212                         ;;
8213                 esac
8214         fi
8215         case "$hostcat" in
8216         nidump*) ;;
8217         *)
8218                 case "$hostcat" in
8219                 *ypcat*) dflt=y;;
8220                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8221                                 dflt=y
8222                         else
8223                                 dflt=n
8224                         fi;;
8225                 *) dflt=n;;
8226                 esac
8227                 echo " "
8228                 rp='Are you getting the hosts file via yellow pages?'
8229                 . ./myread
8230                 case "$ans" in
8231                 y*) hostcat='ypcat hosts';;
8232                 *) hostcat='cat /etc/hosts';;
8233                 esac
8234                 ;;
8235         esac
8236 fi
8237 case "$hostcat" in
8238 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8239 esac
8240 case "$groupcat" in
8241 '') test -f /etc/group && groupcat='cat /etc/group';;
8242 esac
8243 case "$passcat" in
8244 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8245 esac
8246
8247 : now get the host name
8248 echo " "
8249 echo "Figuring out host name..." >&4
8250 case "$myhostname" in
8251 '') cont=true
8252         echo 'Maybe "hostname" will work...'
8253         if tans=`sh -c hostname 2>&1` ; then
8254                 myhostname=$tans
8255                 phostname=hostname
8256                 cont=''
8257         fi
8258         ;;
8259 *) cont='';;
8260 esac
8261 if $test "$cont"; then
8262         if ./xenix; then
8263                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8264                 if tans=`cat /etc/systemid 2>&1` ; then
8265                         myhostname=$tans
8266                         phostname='cat /etc/systemid'
8267                         echo "Whadyaknow.  Xenix always was a bit strange..."
8268                         cont=''
8269                 fi
8270         elif $test -r /etc/systemid; then
8271                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8272         fi
8273 fi
8274 if $test "$cont"; then
8275         echo 'No, maybe "uuname -l" will work...'
8276         if tans=`sh -c 'uuname -l' 2>&1` ; then
8277                 myhostname=$tans
8278                 phostname='uuname -l'
8279         else
8280                 echo 'Strange.  Maybe "uname -n" will work...'
8281                 if tans=`sh -c 'uname -n' 2>&1` ; then
8282                         myhostname=$tans
8283                         phostname='uname -n'
8284                 else
8285                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8286                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8287                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8288                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8289                         else
8290                                 case "$myhostname" in
8291                                 '') echo "Does this machine have an identity crisis or something?"
8292                                         phostname='';;
8293                                 *)
8294                                         echo "Well, you said $myhostname before..."
8295                                         phostname='echo $myhostname';;
8296                                 esac
8297                         fi
8298                 fi
8299         fi
8300 fi
8301 case "$myhostname" in
8302 '') myhostname=noname ;;
8303 esac
8304 : you do not want to know about this
8305 set $myhostname
8306 myhostname=$1
8307
8308 : verify guess
8309 if $test "$myhostname" ; then
8310         dflt=y
8311         rp='Your host name appears to be "'$myhostname'".'" Right?"
8312         . ./myread
8313         case "$ans" in
8314         y*) ;;
8315         *) myhostname='';;
8316         esac
8317 fi
8318
8319 : bad guess or no guess
8320 while $test "X$myhostname" = X ; do
8321         dflt=''
8322         rp="Please type the (one word) name of your host:"
8323         . ./myread
8324         myhostname="$ans"
8325 done
8326
8327 : translate upper to lower if necessary
8328 case "$myhostname" in
8329 *[A-Z]*)
8330         echo "(Normalizing case in your host name)"
8331         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8332         ;;
8333 esac
8334
8335 case "$myhostname" in
8336 *.*)
8337         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8338         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8339         echo "(Trimming domain name from host name--host name is now $myhostname)"
8340         ;;
8341 *) case "$mydomain" in
8342         '')
8343                 {
8344                         test "X$hostcat" = "Xypcat hosts" &&
8345                         ypmatch "$myhostname" hosts 2>/dev/null |\
8346                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8347                         $test -s hosts
8348                 } || {
8349                         test "X$hostcat" != "X" &&
8350                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8351                                         /[       ]$myhostname[  . ]/p" > hosts
8352                 }
8353                 tmp_re="[       . ]"
8354                 if $test -f hosts; then
8355                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8356                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8357                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8358                                 hosts | $sort | $uniq | \
8359                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8360                         case `$echo X$dflt` in
8361                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8362                                 dflt=.
8363                                 ;;
8364                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8365                                 ;;
8366                         esac
8367                 else
8368                         echo "(I cannot locate a hosts database anywhere)"
8369                         dflt=.
8370                 fi
8371                 case "$dflt" in
8372                 .)
8373                         tans=`./loc resolv.conf X /etc /usr/etc`
8374                         if $test -f "$tans"; then
8375                                 echo "(Attempting domain name extraction from $tans)"
8376                                 dflt=.`$sed -n -e 's/   / /g' \
8377                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8378                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8379                                 case "$dflt" in
8380                                 .) dflt=.`$sed -n -e 's/        / /g' \
8381                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8382                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8383                                         ;;
8384                                 esac
8385                         fi
8386                         ;;
8387                 esac
8388                 case "$dflt" in
8389                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8390                         dflt=.`sh -c domainname 2>/dev/null`
8391                         case "$dflt" in
8392                         '') dflt='.';;
8393                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8394                         esac
8395                         ;;
8396                 esac
8397                 case "$dflt$osname" in
8398                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8399                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8400                         ;;
8401                 esac
8402                 case "$dflt" in
8403                 .) echo "(Lost all hope -- silly guess then)"
8404                         dflt='.nonet'
8405                         ;;
8406                 esac
8407                 $rm -f hosts
8408                 ;;
8409         *) dflt="$mydomain";;
8410         esac;;
8411 esac
8412 echo " "
8413 rp="What is your domain name?"
8414 . ./myread
8415 tans="$ans"
8416 case "$ans" in
8417 '') ;;
8418 .*) ;;
8419 *) tans=".$tans";;
8420 esac
8421 mydomain="$tans"
8422
8423 : translate upper to lower if necessary
8424 case "$mydomain" in
8425 *[A-Z]*)
8426         echo "(Normalizing case in your domain name)"
8427         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8428         ;;
8429 esac
8430
8431 : a little sanity check here
8432 case "$phostname" in
8433 '') ;;
8434 *)
8435         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8436         $myhostname$mydomain|$myhostname) ;;
8437         *)
8438                 case "$phostname" in
8439                 sed*)
8440                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8441                         ;;
8442                 *)
8443                         echo "(That doesn't agree with your $phostname command, by the way.)"
8444                         ;;
8445                 esac
8446         ;;
8447         esac
8448         ;;
8449 esac
8450
8451 $cat <<EOM
8452
8453 I need to get your e-mail address in Internet format if possible, i.e.
8454 something like user@host.domain. Please answer accurately since I have
8455 no easy means to double check it. The default value provided below
8456 is most probably close to reality but may not be valid from outside
8457 your organization...
8458
8459 EOM
8460 cont=x
8461 while test "$cont"; do
8462         case "$cf_email" in
8463         '') dflt="$cf_by@$myhostname$mydomain";;
8464         *) dflt="$cf_email";;
8465         esac
8466         rp='What is your e-mail address?'
8467         . ./myread
8468         cf_email="$ans"
8469         case "$cf_email" in
8470         *@*.*) cont='' ;;
8471         *)
8472                 rp='Address does not look like an Internet one.  Use it anyway?'
8473                 case "$fastread" in
8474                 yes) dflt=y ;;
8475                 *) dflt=n ;;
8476                 esac
8477                 . ./myread
8478                 case "$ans" in
8479                 y*) cont='' ;;
8480                 *) echo " " ;;
8481                 esac
8482                 ;;
8483         esac
8484 done
8485
8486 $cat <<EOM
8487
8488 If you or somebody else will be maintaining perl at your site, please
8489 fill in the correct e-mail address here so that they may be contacted
8490 if necessary. Currently, the "perlbug" program included with perl
8491 will send mail to this address in addition to perlbug@perl.org. You may
8492 enter "none" for no administrator.
8493
8494 EOM
8495 case "$perladmin" in
8496 '') dflt="$cf_email";;
8497 *) dflt="$perladmin";;
8498 esac
8499 rp='Perl administrator e-mail address'
8500 . ./myread
8501 perladmin="$ans"
8502
8503 : determine whether to only install version-specific parts.
8504 echo " "
8505 $cat <<EOM
8506 Do you want to install only the version-specific parts of the perl
8507 distribution?  Usually you do *not* want to do this.
8508 EOM
8509 case "$versiononly" in
8510 "$define"|[Yy]*|true) dflt='y' ;;
8511 *) dflt='n';
8512 esac
8513 rp="Do you want to install only the version-specific parts of perl?"
8514 . ./myread
8515 case "$ans" in
8516 [yY]*)  val="$define";;
8517 *)      val="$undef" ;;
8518 esac
8519 set versiononly
8520 eval $setvar
8521
8522 case "$versiononly" in
8523 "$define") inc_version_list=''
8524            inc_version_list_init=0
8525            ;;
8526 esac
8527
8528 : figure out how to guarantee perl startup
8529 case "$startperl" in
8530 '')
8531         case "$sharpbang" in
8532         *!)
8533                 $cat <<EOH
8534
8535 I can use the #! construct to start perl on your system. This will
8536 make startup of perl scripts faster, but may cause problems if you
8537 want to share those scripts and perl is not in a standard place
8538 ($binexp/perl) on all your platforms. The alternative is to force
8539 a shell by starting the script with a single ':' character.
8540
8541 EOH
8542                 case "$versiononly" in
8543                 "$define")      dflt="$binexp/perl$version";;  
8544                 *)              dflt="$binexp/perl";;
8545                 esac
8546                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8547                 . ./myread
8548                 case "$ans" in
8549                 none)   startperl=": # use perl";;
8550                 *)      startperl="#!$ans"
8551                         if $test 30 -lt `echo "$ans" | wc -c`; then
8552                                 $cat >&4 <<EOM
8553
8554 WARNING:  Some systems limit the #! command to 32 characters.
8555 If you experience difficulty running Perl scripts with #!, try
8556 installing Perl in a directory with a shorter pathname.
8557
8558 EOM
8559                         fi ;;
8560                 esac
8561                 ;;
8562         *) startperl=": # use perl"
8563                 ;;
8564         esac
8565         ;;
8566 esac
8567 echo "I'll use $startperl to start perl scripts."
8568
8569 : figure best path for perl in scripts
8570 case "$perlpath" in
8571 '')
8572         case "$versiononly" in
8573         "$define")      perlpath="$binexp/perl$version";;
8574         *)              perlpath="$binexp/perl";;
8575         esac
8576         case "$startperl" in
8577         *!*) ;;
8578         *)
8579                 $cat <<EOH
8580
8581 I will use the "eval 'exec'" idiom to start Perl on your system.
8582 I can use the full path of your Perl binary for this purpose, but
8583 doing so may cause problems if you want to share those scripts and
8584 Perl is not always in a standard place ($binexp/perl).
8585
8586 EOH
8587                 dflt="$binexp/perl"
8588                 rp="What path shall I use in \"eval 'exec'\"?"
8589                 . ./myread
8590                 perlpath="$ans"
8591                 ;;
8592         esac
8593         ;;
8594 esac
8595 case "$startperl" in
8596 *!*)    ;;
8597 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8598 esac
8599
8600 : determine where public executable scripts go
8601 set scriptdir scriptdir
8602 eval $prefixit
8603 case "$scriptdir" in
8604 '')
8605         dflt="$bin"
8606         : guess some guesses
8607         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8608         $test -d /usr/share/bin     && dflt=/usr/share/bin
8609         $test -d /usr/local/script  && dflt=/usr/local/script
8610         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8611         $test -d $prefixexp/script  && dflt=$prefixexp/script
8612         set dflt
8613         eval $prefixup
8614         ;;
8615 *)  dflt="$scriptdir"
8616         ;;
8617 esac
8618 $cat <<EOM
8619  
8620 Some installations have a separate directory just for executable scripts so
8621 that they can mount it across multiple architectures but keep the scripts in
8622 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8623 Or you might just lump your scripts in with all your other executables.
8624  
8625 EOM
8626 fn=d~
8627 rp='Where do you keep publicly executable scripts?'
8628 . ./getfile
8629 if $test "X$ansexp" != "X$scriptdirexp"; then
8630         installscript=''
8631 fi
8632 prefixvar=scriptdir
8633 . ./setprefixvar
8634 : A little fix up for an irregularly named variable.
8635 installscript="$installscriptdir"
8636
8637
8638 : determine where add-on public executables go
8639 case "$sitebin" in
8640 '')     dflt=$siteprefix/bin ;;
8641 *)      dflt=$sitebin ;;
8642 esac
8643 fn=d~
8644 rp='Pathname where the add-on public executables should be installed?'
8645 . ./getfile
8646 prefixvar=sitebin
8647 . ./setprefixvar
8648
8649 : determine where add-on html pages go
8650 : There is no standard location, so try to copy the previously-selected
8651 : directory structure for the core html pages.
8652 case "$sitehtml1dir" in
8653 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8654 *)     dflt=$sitehtml1dir ;;
8655 esac
8656 case "$dflt" in
8657 ''|' ') dflt=none ;;
8658 esac
8659 fn=dn+~
8660 rp='Pathname where the site-specific html pages should be installed?'
8661 . ./getfile
8662 prefixvar=sitehtml1dir
8663 . ./setprefixvar
8664
8665 : determine where add-on library html pages go
8666 : There is no standard location, so try to copy the previously-selected
8667 : directory structure for the core html pages.
8668 case "$sitehtml3dir" in
8669 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8670 *)     dflt=$sitehtml3dir ;;
8671 esac
8672 case "$dflt" in
8673 ''|' ') dflt=none ;;
8674 esac
8675 fn=dn+~
8676 rp='Pathname where the site-specific library html pages should be installed?'
8677 . ./getfile
8678 prefixvar=sitehtml3dir
8679 . ./setprefixvar
8680
8681 : determine where add-on manual pages go
8682 case "$siteman1dir" in
8683 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8684 *)      dflt=$siteman1dir ;;
8685 esac
8686 case "$dflt" in
8687 ''|' ') dflt=none ;;
8688 esac
8689 fn=dn+~
8690 rp='Pathname where the site-specific manual pages should be installed?'
8691 . ./getfile
8692 prefixvar=siteman1dir
8693 . ./setprefixvar
8694
8695 : determine where add-on library man pages go
8696 case "$siteman3dir" in
8697 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8698 *)      dflt=$siteman3dir ;;
8699 esac
8700 case "$dflt" in
8701 ''|' ') dflt=none ;;
8702 esac
8703 fn=dn+~
8704 rp='Pathname where the site-specific library manual pages should be installed?'
8705 . ./getfile
8706 prefixvar=siteman3dir
8707 . ./setprefixvar
8708
8709 : determine where add-on public executable scripts go
8710 case "$sitescript" in
8711 '')     dflt=$siteprefix/script
8712         $test -d $dflt || dflt=$sitebin ;;
8713 *)  dflt="$sitescript" ;;
8714 esac
8715 fn=d~+
8716 rp='Pathname where add-on public executable scripts should be installed?'
8717 . ./getfile
8718 prefixvar=sitescript
8719 . ./setprefixvar
8720
8721 case "$usefaststdio" in
8722 $define|true|[yY]*|'')
8723         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8724         case "$xversion" in
8725         [68])   dflt='y' ;;
8726         *)      dflt='n' ;;
8727         esac
8728         ;;
8729 *) dflt='n';;
8730 esac
8731 cat <<EOM
8732
8733 Perl can be built to use 'fast stdio', which means using the stdio
8734 library but also directly manipulating the stdio buffers to enable
8735 faster I/O.  Using stdio is better for backward compatibility (especially
8736 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8737 interface has been preferred instead of stdio.
8738
8739 If this doesn't make any sense to you, just accept the default '$dflt'.
8740 EOM
8741 rp='Use the "fast stdio" if available?'
8742 . ./myread
8743 case "$ans" in
8744 y|Y)    val="$define" ;;     
8745 *)      val="$undef" ;;
8746 esac
8747 set usefaststdio
8748 eval $setvar
8749
8750
8751 : define an is-a-typedef? function
8752 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8753 case "$inclist" in
8754 "") inclist="sys/types.h";;
8755 esac;
8756 eval "varval=\$$var";
8757 case "$varval" in
8758 "")
8759         $rm -f temp.c;
8760         for inc in $inclist; do
8761                 echo "#include <$inc>" >>temp.c;
8762         done;
8763         echo "#ifdef $type" >> temp.c;
8764         echo "printf(\"We have $type\");" >> temp.c;
8765         echo "#endif" >> temp.c;
8766         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8767         if $contains $type temp.E >/dev/null 2>&1; then
8768                 eval "$var=\$type";
8769         else
8770                 eval "$var=\$def";
8771         fi;
8772         $rm -f temp.?;;
8773 *) eval "$var=\$varval";;
8774 esac'
8775
8776 : define an is-a-typedef? function that prompts if the type is not available.
8777 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8778 case "$inclist" in
8779 "") inclist="sys/types.h";;
8780 esac;
8781 eval "varval=\$$var";
8782 case "$varval" in
8783 "")
8784         $rm -f temp.c;
8785         for inc in $inclist; do
8786                 echo "#include <$inc>" >>temp.c;
8787         done;
8788         echo "#ifdef $type" >> temp.c;
8789         echo "printf(\"We have $type\");" >> temp.c;
8790         echo "#endif" >> temp.c;
8791         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8792         echo " " ;
8793         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8794         if $contains $type temp.E >/dev/null 2>&1; then
8795                 echo "$type found." >&4;
8796                 eval "$var=\$type";
8797         else
8798                 echo "$type NOT found." >&4;
8799                 dflt="$def";
8800                 . ./myread ;
8801                 eval "$var=\$ans";
8802         fi;
8803         $rm -f temp.?;;
8804 *) eval "$var=\$varval";;
8805 esac'
8806
8807 : see what type lseek is declared as in the kernel
8808 rp="What is the type used for lseek's offset on this system?"
8809 set off_t lseektype long stdio.h sys/types.h
8810 eval $typedef_ask
8811
8812 echo " "
8813 echo "Checking to see how big your file offsets are..." >&4
8814 $cat >try.c <<EOCP
8815 #include <sys/types.h>
8816 #include <stdio.h>
8817 int main()
8818 {
8819     printf("%d\n", (int)sizeof($lseektype));
8820     return(0); 
8821 }
8822 EOCP
8823 set try
8824 if eval $compile_ok; then
8825         lseeksize=`$run ./try`
8826         echo "Your file offsets are $lseeksize bytes long."
8827 else
8828         dflt=$longsize
8829         echo " "
8830         echo "(I can't seem to compile the test program.  Guessing...)"
8831         rp="What is the size of your file offsets (in bytes)?"
8832         . ./myread
8833         lseeksize="$ans"
8834 fi
8835 $rm -f try.c try
8836
8837 : see what type file positions are declared as in the library
8838 rp="What is the type for file position used by fsetpos()?"
8839 set fpos_t fpostype long stdio.h sys/types.h
8840 eval $typedef_ask
8841
8842 echo " "
8843 case "$fpostype" in
8844 *_t) zzz="$fpostype"    ;;
8845 *)   zzz="fpos_t"       ;;
8846 esac
8847 echo "Checking the size of $zzz..." >&4 
8848 cat > try.c <<EOCP
8849 #include <sys/types.h>
8850 #include <stdio.h>
8851 #$i_stdlib I_STDLIB
8852 #ifdef I_STDLIB
8853 #include <stdlib.h>
8854 #endif
8855 int main() {
8856     printf("%d\n", (int)sizeof($fpostype));
8857     exit(0);
8858 }
8859 EOCP
8860 set try
8861 if eval $compile_ok; then
8862         yyy=`$run ./try`
8863         case "$yyy" in
8864         '')     fpossize=4
8865                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8866                 ;;
8867         *)      fpossize=$yyy
8868                 echo "Your $zzz is $fpossize bytes long."
8869                 ;;
8870         esac
8871 else
8872         dflt="$longsize"
8873         echo " " >&4
8874         echo "(I can't compile the test program.  Guessing...)" >&4
8875         rp="What is the size of your file positions (in bytes)?"
8876         . ./myread
8877         fpossize="$ans"
8878 fi
8879
8880 # Backward compatibility (uselfs is deprecated).
8881 case "$uselfs" in
8882 "$define"|true|[yY]*)
8883         cat <<EOM >&4
8884
8885 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8886 EOM
8887         uselargefiles="$define"
8888         ;;
8889 esac                          
8890
8891 case "$lseeksize:$fpossize" in
8892 8:8) cat <<EOM
8893
8894 You can have files larger than 2 gigabytes.
8895 EOM
8896    val="$define" ;;
8897 *)    case "$uselargefiles" in
8898    "$undef"|false|[nN]*) dflt='n' ;;
8899    *)   dflt='y' ;;
8900    esac
8901    cat <<EOM
8902
8903 Perl can be built to understand large files (files larger than 2 gigabytes)
8904 on some systems.  To do so, Configure can be run with -Duselargefiles.
8905
8906 If this doesn't make any sense to you, just accept the default '$dflt'.
8907 EOM
8908    rp='Try to understand large files, if available?'
8909    . ./myread
8910    case "$ans" in
8911    y|Y)         val="$define" ;;
8912    *)           val="$undef"  ;;
8913    esac
8914    ;;
8915 esac
8916 set uselargefiles
8917 eval $setvar
8918 : Look for a hint-file generated 'call-back-unit'.  If the
8919 : user has specified that a large files perl is to be built,
8920 : we may need to set or change some other defaults.
8921 if $test -f uselargefiles.cbu; then
8922         echo "Your platform has some specific hints regarding large file builds, using them..."
8923         . ./uselargefiles.cbu
8924 fi
8925 case "$uselargefiles" in
8926 "$define")
8927         if $test -f uselargefiles.cbu; then
8928                 echo " "
8929                 echo "Rechecking to see how big your file offsets are..." >&4
8930                 $cat >try.c <<EOCP
8931 #include <sys/types.h>
8932 #include <stdio.h>
8933 int main()
8934 {
8935     printf("%d\n", (int)sizeof($lseektype));
8936     return(0); 
8937 }
8938 EOCP
8939                 set try
8940                 if eval $compile_ok; then
8941                         lseeksize=`$run ./try`
8942                         $echo "Your file offsets are now $lseeksize bytes long."
8943                 else
8944                         dflt="$lseeksize"
8945                         echo " "
8946                         echo "(I can't seem to compile the test program.  Guessing...)"
8947                         rp="What is the size of your file offsets (in bytes)?"
8948                         . ./myread
8949                         lseeksize="$ans"
8950                 fi
8951                 case "$fpostype" in
8952                 *_t) zzz="$fpostype"    ;;
8953                 *)   zzz="fpos_t"       ;;
8954                 esac
8955                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8956                 $cat > try.c <<EOCP
8957 #include <sys/types.h>
8958 #include <stdio.h>
8959 #$i_stdlib I_STDLIB
8960 #ifdef I_STDLIB
8961 #include <stdlib.h>
8962 #endif
8963 int main() {
8964     printf("%d\n", (int)sizeof($fpostype));
8965     return(0);
8966 }
8967 EOCP
8968                 set try
8969                 if eval $compile_ok; then
8970                         yyy=`$run ./try`
8971                         dflt="$lseeksize"
8972                         case "$yyy" in
8973                         '')     echo " "
8974                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8975                                 ;;
8976                         *)      fpossize=$yyy
8977                                 echo " $fpossize bytes." >&4
8978                                 ;;
8979                         esac
8980                 else
8981                         dflt="$fpossize"
8982                         echo " "
8983                         echo "(I can't compile the test program.  Guessing...)" >&4
8984                         rp="What is the size of your file positions (in bytes)?"
8985                         . ./myread
8986                         fpossize="$ans"
8987                 fi
8988                 $rm -f try.c try
8989         fi
8990         ;;
8991 esac
8992
8993 case "$vendorprefix" in
8994 '')     d_vendorbin="$undef"
8995         vendorbin=''
8996         vendorbinexp=''
8997         ;;
8998 *)      d_vendorbin="$define"
8999         : determine where vendor-supplied executables go.
9000         case "$vendorbin" in
9001         '') dflt=$vendorprefix/bin ;;
9002         *)      dflt="$vendorbin" ;;
9003         esac
9004         fn=d~+
9005         rp='Pathname for the vendor-supplied executables directory?'
9006         . ./getfile
9007         vendorbin="$ans"
9008         vendorbinexp="$ansexp"
9009         ;;
9010 esac
9011 prefixvar=vendorbin
9012 . ./installprefix
9013
9014 case "$vendorprefix" in
9015 '')     vendorhtml1dir=''
9016         vendorhtml1direxp=''
9017         ;;
9018 *)      : determine where vendor-supplied html pages go.
9019         : There is no standard location, so try to copy the previously-selected
9020         : directory structure for the core html pages.
9021         : XXX Better default suggestions would be welcome.
9022         case "$vendorhtml1dir" in
9023         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9024         *)      dflt=$vendorhtml1dir ;;
9025         esac
9026         case "$dflt" in
9027         ''|' ') dflt=none ;;
9028         esac
9029         fn=dn+~
9030         rp='Pathname for the vendor-supplied html pages?'
9031         . ./getfile
9032         vendorhtml1dir="$ans"
9033         vendorhtml1direxp="$ansexp"
9034         ;;
9035 esac
9036 : Use ' ' for none so value is preserved next time through Configure
9037 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9038 prefixvar=vendorhtml1dir
9039 . ./installprefix
9040
9041 case "$vendorprefix" in
9042 '')     vendorhtml3dir=''
9043         vendorhtml3direxp=''
9044         ;;
9045 *)      : determine where vendor-supplied module html pages go.
9046         : There is no standard location, so try to copy the previously-selected
9047         : directory structure for the core html pages.
9048         : XXX Better default suggestions would be welcome.
9049         case "$vendorhtml3dir" in
9050         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9051         *)      dflt=$vendorhtml3dir ;;
9052         esac
9053         case "$dflt" in
9054         ''|' ') dflt=none ;;
9055         esac
9056         fn=dn+~
9057         rp='Pathname for the vendor-supplied html pages?'
9058         . ./getfile
9059         vendorhtml3dir="$ans"
9060         vendorhtml3direxp="$ansexp"
9061         ;;
9062 esac
9063 : Use ' ' for none so value is preserved next time through Configure
9064 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9065 prefixvar=vendorhtml3dir
9066 . ./installprefix
9067
9068 case "$vendorprefix" in
9069 '')     vendorman1dir=''
9070         vendorman1direxp=''
9071         ;;
9072 *)      : determine where vendor-supplied manual pages go.
9073         case "$vendorman1dir" in
9074         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9075         *)      dflt=$vendorman1dir ;;
9076         esac
9077         case "$dflt" in
9078         ''|' ') dflt=none ;;
9079         esac
9080         fn=nd~+
9081         rp='Pathname for the vendor-supplied manual section 1 pages?'
9082         . ./getfile
9083         vendorman1dir="$ans"
9084         vendorman1direxp="$ansexp"
9085         ;;
9086 esac
9087 : Use ' ' for none so value is preserved next time through Configure
9088 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9089 prefixvar=vendorman1dir
9090 . ./installprefix
9091
9092 case "$vendorprefix" in
9093 '')     vendorman3dir=''
9094         vendorman3direxp=''
9095         ;;
9096 *)      : determine where vendor-supplied module manual pages go.
9097         case "$vendorman3dir" in
9098         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9099         *)      dflt=$vendorman3dir ;;
9100         esac
9101         case "$dflt" in
9102         ''|' ') dflt=none ;;
9103         esac
9104         fn=nd~+
9105         rp='Pathname for the vendor-supplied manual section 3 pages?'
9106         . ./getfile
9107         vendorman3dir="$ans"
9108         vendorman3direxp="$ansexp"
9109         ;;
9110 esac
9111 : Use ' ' for none so value is preserved next time through Configure
9112 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9113 prefixvar=vendorman3dir
9114 . ./installprefix
9115
9116 case "$vendorprefix" in
9117 '')     d_vendorscript="$undef"
9118         vendorscript=''
9119         vendorscriptexp=''
9120         ;;
9121 *)      d_vendorscript="$define"
9122         : determine where vendor-supplied scripts go.
9123         case "$vendorscript" in
9124         '')     dflt=$vendorprefix/script
9125                 $test -d $dflt || dflt=$vendorbin ;;
9126         *)  dflt="$vendorscript" ;;
9127         esac
9128         $cat <<EOM
9129
9130 The installation process will create a directory for 
9131 vendor-supplied scripts.
9132
9133 EOM
9134         fn=d~+
9135         rp='Pathname for the vendor-supplied scripts directory?'
9136         . ./getfile
9137         vendorscript="$ans"
9138         vendorscriptexp="$ansexp"
9139         ;;
9140 esac
9141 prefixvar=vendorscript
9142 . ./installprefix
9143
9144 : see if qgcvt exists
9145 set qgcvt d_qgcvt
9146 eval $inlibc
9147
9148 echo " "
9149
9150 if $test X"$d_longdbl" = X"$define"; then
9151
9152 echo "Checking how to print long doubles..." >&4
9153
9154 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9155         $cat >try.c <<'EOCP'
9156 #include <sys/types.h>
9157 #include <stdio.h>
9158 int main() {
9159   double d = 123.456;
9160   printf("%.3f\n", d);
9161 }
9162 EOCP
9163         set try
9164         if eval $compile; then
9165                 yyy=`$run ./try`
9166                 case "$yyy" in
9167                 123.456)
9168                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9169                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9170                         echo "We will use %f."
9171                         ;;
9172                 esac
9173         fi
9174 fi
9175
9176 if $test X"$sPRIfldbl" = X; then
9177         $cat >try.c <<'EOCP'
9178 #include <sys/types.h>
9179 #include <stdio.h>
9180 int main() {
9181   long double d = 123.456;
9182   printf("%.3Lf\n", d);
9183 }
9184 EOCP
9185         set try
9186         if eval $compile; then
9187                 yyy=`$run ./try`
9188                 case "$yyy" in
9189                 123.456)
9190                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9191                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9192                         echo "We will use %Lf."
9193                         ;;
9194                 esac
9195         fi
9196 fi
9197
9198 if $test X"$sPRIfldbl" = X; then
9199         $cat >try.c <<'EOCP'
9200 #include <sys/types.h>
9201 #include <stdio.h>
9202 int main() {
9203   long double d = 123.456;
9204   printf("%.3llf\n", d);
9205 }
9206 EOCP
9207         set try
9208         if eval $compile; then
9209                 yyy=`$run ./try`
9210                 case "$yyy" in
9211                 123.456)
9212                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9213                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9214                         echo "We will use %llf."
9215                         ;;
9216                 esac
9217         fi
9218 fi
9219
9220 if $test X"$sPRIfldbl" = X; then
9221         $cat >try.c <<'EOCP'
9222 #include <sys/types.h>
9223 #include <stdio.h>
9224 int main() {
9225   long double d = 123.456;
9226   printf("%.3lf\n", d);
9227 }
9228 EOCP
9229         set try
9230         if eval $compile; then
9231                 yyy=`$run ./try`
9232                 case "$yyy" in
9233                 123.456)
9234                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9235                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9236                         echo "We will use %lf."
9237                         ;;
9238                 esac
9239         fi
9240 fi
9241
9242 if $test X"$sPRIfldbl" = X; then
9243         echo "Cannot figure out how to print long doubles." >&4
9244 else
9245         sSCNfldbl=$sPRIfldbl    # expect consistency
9246 fi
9247
9248 $rm -f try try.*
9249
9250 fi # d_longdbl
9251
9252 case "$sPRIfldbl" in
9253 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9254         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9255         d_SCNfldbl="$undef";
9256         ;;
9257 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9258         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9259         d_SCNfldbl="$define";
9260         ;;
9261 esac
9262
9263 : Check how to convert floats to strings.
9264
9265 if test "X$d_Gconvert" = X; then
9266
9267 echo " "
9268 echo "Checking for an efficient way to convert floats to strings."
9269 echo " " > try.c
9270 case "$uselongdouble" in
9271 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9272 esac
9273 case "$d_longdbl" in
9274 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9275 esac
9276 case "$d_PRIgldbl" in
9277 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9278 esac
9279 $cat >>try.c <<EOP
9280 #ifdef TRY_gconvert
9281 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9282 char *myname = "gconvert";
9283 #endif
9284 #ifdef TRY_gcvt
9285 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9286 char *myname = "gcvt";
9287 #endif
9288 #ifdef TRY_qgcvt
9289 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9290 char *myname = "qgcvt";
9291 #define DOUBLETYPE long double
9292 #endif
9293 #ifdef TRY_sprintf
9294 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9295 #ifdef HAS_PRIgldbl
9296 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9297 #else
9298 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9299 #endif
9300 #else
9301 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9302 #endif
9303 char *myname = "sprintf";
9304 #endif
9305
9306 #ifndef DOUBLETYPE
9307 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9308 #define DOUBLETYPE long double
9309 #else
9310 #define DOUBLETYPE double
9311 #endif
9312 #endif
9313
9314 #include <stdio.h>
9315
9316 #define I_STDLIB $i_stdlib
9317 #ifdef I_STDLIB
9318 #include <stdlib.h>
9319 #endif
9320
9321 int
9322 checkit(expect, got)
9323 char *expect;
9324 char *got;
9325 {
9326     if (strcmp(expect, got)) {
9327                 printf("%s oddity:  Expected %s, got %s\n",
9328                         myname, expect, got);
9329                 exit(1);
9330         }
9331 }
9332
9333 int main()
9334
9335         char buf[64]; 
9336         buf[63] = '\0';
9337
9338         /* This must be 1st test on (which?) platform */
9339         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9340         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9341         checkit("0.1", buf);
9342
9343         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9344         checkit("0.01", buf);
9345
9346         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9347         checkit("0.001", buf);
9348
9349         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9350         checkit("0.0001", buf);
9351
9352         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9353         if (strlen(buf) > 5)
9354             checkit("9e-005", buf); /* for Microsoft ?? */
9355         else
9356             checkit("9e-05", buf);
9357
9358         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9359         checkit("1", buf);
9360
9361         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9362         checkit("1.1", buf);
9363
9364         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9365         checkit("1.01", buf);
9366
9367         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9368         checkit("1.001", buf);
9369
9370         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9371         checkit("1.0001", buf);
9372
9373         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9374         checkit("1.00001", buf);
9375
9376         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9377         checkit("1.000001", buf);
9378
9379         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9380         checkit("0", buf);
9381
9382         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9383         checkit("-1", buf);
9384
9385         /* Some Linux gcvt's give 1.e+5 here. */
9386         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9387         checkit("100000", buf);
9388         
9389         /* Some Linux gcvt's give -1.e+5 here. */
9390         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9391         checkit("-100000", buf);
9392
9393         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9394         checkit("123.456", buf);
9395
9396         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9397         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9398         /* 34 should be enough to scare even long double
9399          * places into using the e notation. */
9400         if (strlen(buf) > 5)
9401             checkit("1e+034", buf); /* for Microsoft */
9402         else
9403             checkit("1e+34", buf);
9404
9405         /* For Perl, if you add additional tests here, also add them to
9406          * t/base/num.t for benefit of platforms not using Configure or
9407          * overriding d_Gconvert */
9408
9409         exit(0);
9410 }
9411 EOP
9412 : first add preferred functions to our list
9413 xxx_list=""
9414 for xxx_convert in $gconvert_preference; do
9415     case $xxx_convert in
9416     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9417     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9418     esac 
9419 done
9420 : then add any others
9421 for xxx_convert in gconvert gcvt sprintf; do
9422     case "$xxx_list" in
9423     *$xxx_convert*) ;;
9424     *) xxx_list="$xxx_list $xxx_convert" ;;
9425     esac 
9426 done
9427
9428 case "$d_longdbl$uselongdouble" in
9429 "$define$define")
9430     : again, add prefered functions to our list first
9431     xxx_ld_list=""
9432     for xxx_convert in $gconvert_ld_preference; do
9433         case $xxx_convert in
9434         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9435         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9436         esac
9437     done
9438     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9439     for xxx_convert in qgcvt sprintf $xxx_list; do
9440         case "$xxx_ld_list" in
9441         $xxx_convert*|*" $xxx_convert"*) ;;
9442         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9443         esac
9444     done
9445     : if sprintf cannot do long doubles, move it to the end
9446     if test "$d_PRIgldbl" != "$define"; then
9447         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9448     fi
9449     : if no qgcvt, remove it
9450     if test "$d_qgcvt" != "$define"; then
9451         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9452     fi
9453     : use the ld_list
9454     xxx_list="$xxx_ld_list"
9455     ;;
9456 esac
9457
9458 for xxx_convert in $xxx_list; do
9459         echo "Trying $xxx_convert..."
9460         $rm -f try try$_o
9461         set try -DTRY_$xxx_convert
9462         if eval $compile; then
9463                 echo "$xxx_convert() found." >&4
9464                 if $run ./try; then
9465                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9466                         break;
9467                 else
9468                         echo "...But $xxx_convert didn't work as I expected."
9469                         xxx_convert=''
9470                 fi
9471         else
9472                 echo "$xxx_convert NOT found." >&4
9473         fi
9474 done
9475
9476 if test X$xxx_convert = X; then
9477     echo "*** WHOA THERE!!! ***" >&4
9478     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9479     xxx_convert=sprintf
9480 fi
9481
9482 case "$xxx_convert" in
9483 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9484 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9485 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9486 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9487    "$define$define$define")
9488       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9489    "$define$define$undef")
9490       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9491    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9492    esac
9493    ;;  
9494 esac
9495
9496 fi
9497
9498 : see if _fwalk exists
9499 set fwalk d__fwalk
9500 eval $inlibc
9501
9502 : Initialize h_fcntl
9503 h_fcntl=false
9504
9505 : Initialize h_sysfile
9506 h_sysfile=false
9507
9508 : access call always available on UNIX
9509 set access d_access
9510 eval $inlibc
9511
9512 : locate the flags for 'access()'
9513 case "$d_access" in
9514 "$define")
9515         echo " "
9516         $cat >access.c <<EOCP
9517 #include <sys/types.h>
9518 #ifdef I_FCNTL
9519 #include <fcntl.h>
9520 #endif
9521 #ifdef I_SYS_FILE
9522 #include <sys/file.h>
9523 #endif
9524 #ifdef I_UNISTD
9525 #include <unistd.h>
9526 #endif
9527 #$i_stdlib I_STDLIB
9528 #ifdef I_STDLIB
9529 #include <stdlib.h>
9530 #endif
9531 int main() {
9532         exit(R_OK);
9533 }
9534 EOCP
9535         : check sys/file.h first, no particular reason here
9536         if $test `./findhdr sys/file.h` && \
9537                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9538                 h_sysfile=true;
9539                 echo "<sys/file.h> defines the *_OK access constants." >&4
9540         elif $test `./findhdr fcntl.h` && \
9541                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9542                 h_fcntl=true;
9543                 echo "<fcntl.h> defines the *_OK access constants." >&4
9544         elif $test `./findhdr unistd.h` && \
9545                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9546                 echo "<unistd.h> defines the *_OK access constants." >&4
9547         else
9548                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9549         fi
9550         ;;
9551 esac
9552 $rm -f access*
9553
9554 : see if accessx exists
9555 set accessx d_accessx
9556 eval $inlibc
9557
9558 : see if aintl exists
9559 set aintl d_aintl
9560 eval $inlibc
9561
9562 : see if alarm exists
9563 set alarm d_alarm
9564 eval $inlibc
9565
9566 : see if POSIX threads are available
9567 set pthread.h i_pthread
9568 eval $inhdr
9569
9570 : define a fucntion to check prototypes
9571 $cat > protochk <<EOSH
9572 $startsh
9573 cc="$cc"
9574 optimize="$optimize"
9575 ccflags="$ccflags"
9576 prototype="$prototype"
9577 define="$define"
9578 rm=$rm
9579 usethreads=$usethreads
9580 i_pthread=$i_pthread
9581 pthread_h_first=$pthread_h_first
9582 EOSH
9583
9584 $cat >> protochk <<'EOSH'
9585
9586 $rm -f try.c
9587 foo="$1"
9588 shift
9589 while test $# -ge 2; do
9590         case "$1" in
9591                 $define) echo "#include <$2>" >> try.c ;;
9592                 literal) echo "$2" >> try.c ;;
9593         esac
9594     # Extra magic for the benefit of systems that need pthread.h
9595     # to be included early to correctly detect threadsafe functions.
9596     # Such functions must guarantee themselves, though, that the usethreads
9597     # and i_pthread have been defined, before calling protochk.
9598     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9599         echo "#include <pthread.h>" >> try.c
9600         pthread_h_done=yes
9601     fi
9602     shift 2
9603 done
9604 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9605 cat >> try.c <<'EOCP'
9606 #ifdef CAN_PROTOTYPE
9607 #define _(args) args
9608 #else
9609 #define _(args) ()
9610 #endif
9611 EOCP
9612 echo "$foo" >> try.c
9613 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9614 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9615 status=$?
9616 $rm -f try.[co]
9617 exit $status
9618 EOSH
9619 chmod +x protochk
9620 $eunicefix protochk
9621
9622 hasproto='varname=$1; func=$2; shift; shift;
9623 while $test $# -ge 2; do
9624         case "$1" in
9625         $define) echo "#include <$2>";;
9626         esac ;
9627     shift 2;
9628 done > try.c;
9629 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9630 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9631         echo "$func() prototype found.";
9632         val="$define";
9633 else
9634         echo "$func() prototype NOT found.";
9635         val="$undef";
9636 fi;
9637 set $varname;
9638 eval $setvar;
9639 $rm -f try.c tryout.c'
9640
9641 : see if sys/types.h has to be included
9642 set sys/types.h i_systypes
9643 eval $inhdr
9644
9645 : see if sys/select.h has to be included
9646 set sys/select.h i_sysselct
9647 eval $inhdr
9648
9649 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9650 while $test $# -ge 2; do
9651         case "$1" in
9652         $define) echo "#include <$2>";;
9653         esac ;
9654     shift 2;
9655 done > try.c;
9656 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9657 set try;
9658 if eval $compile; then
9659         val="$define";
9660 else
9661         val="$undef";
9662 fi;
9663 set $varname;
9664 eval $setvar;
9665 $rm -f try.c try.o'
9666
9667 : see if we should include time.h, sys/time.h, or both
9668 echo " "
9669 if test "X$timeincl" = X; then
9670         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9671         $echo $n "I'm now running the test program...$c"
9672         $cat >try.c <<EOCP
9673 #include <sys/types.h>
9674 #ifdef I_TIME
9675 #include <time.h>
9676 #endif
9677 #ifdef I_SYSTIME
9678 #ifdef SYSTIMEKERNEL
9679 #define KERNEL
9680 #endif
9681 #include <sys/time.h>
9682 #endif
9683 #ifdef I_SYSSELECT
9684 #include <sys/select.h>
9685 #endif
9686 #$i_stdlib I_STDLIB
9687 #ifdef I_STDLIB
9688 #include <stdlib.h>
9689 #endif
9690 int main()
9691 {
9692         struct tm foo;
9693 #ifdef S_TIMEVAL
9694         struct timeval bar;
9695 #endif
9696 #ifdef S_TIMEZONE
9697         struct timezone tzp;
9698 #endif
9699         if (foo.tm_sec == foo.tm_sec)
9700                 exit(0);
9701 #ifdef S_TIMEVAL
9702         if (bar.tv_sec == bar.tv_sec)
9703                 exit(0);
9704 #endif
9705         exit(1);
9706 }
9707 EOCP
9708         flags=''
9709         for s_timezone in '-DS_TIMEZONE' ''; do
9710         sysselect=''
9711         for s_timeval in '-DS_TIMEVAL' ''; do
9712         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9713         for i_time in '' '-DI_TIME'; do
9714         for i_systime in '-DI_SYSTIME' ''; do
9715                 case "$flags" in
9716                 '') $echo $n ".$c"
9717                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9718                         if eval $compile; then
9719                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9720                                 shift
9721                                 flags="$*"
9722                                 echo " "
9723                                 $echo $n "Succeeded with $flags$c"
9724                         fi
9725                         ;;
9726                 esac
9727         done
9728         done
9729         done
9730         done
9731         done
9732         timeincl=''
9733         echo " "
9734         case "$flags" in
9735         *SYSTIMEKERNEL*) i_systimek="$define"
9736                 timeincl=`./findhdr sys/time.h`
9737                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9738         *) i_systimek="$undef";;
9739         esac
9740         case "$flags" in
9741         *I_TIME*) i_time="$define"
9742                 timeincl=`./findhdr time.h`" $timeincl"
9743                 echo "We'll include <time.h>." >&4;;
9744         *) i_time="$undef";;
9745         esac
9746         case "$flags" in
9747         *I_SYSTIME*) i_systime="$define"
9748                 timeincl=`./findhdr sys/time.h`" $timeincl"
9749                 echo "We'll include <sys/time.h>." >&4;;
9750         *) i_systime="$undef";;
9751         esac
9752         $rm -f try.c try
9753 fi
9754 : see if struct tm knows about tm_zone
9755 case "$i_systime$i_time" in
9756 *$define*) 
9757         echo " "
9758         echo "Checking to see if your struct tm has tm_zone field..." >&4
9759         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9760         eval $hasfield
9761         ;;
9762 *)      val="$undef"
9763         set d_tm_tm_zone
9764         eval $setvar
9765         ;;
9766 esac
9767 case "$d_tm_tm_zone" in
9768 "$define")      echo "Yes, it does."   ;;
9769 *)              echo "No, it doesn't." ;;
9770 esac
9771 : see if struct tm knows about tm_gmtoff
9772 case "$i_systime$i_time" in
9773 *$define*) 
9774         echo " "
9775         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9776         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9777         eval $hasfield
9778         ;;
9779 *)      val="$undef"
9780         set d_tm_tm_gmtoff
9781         eval $setvar
9782         ;;
9783 esac
9784 case "$d_tm_tm_gmtoff" in
9785 "$define")      echo "Yes, it does."   ;;
9786 *)              echo "No, it doesn't." ;;
9787 esac
9788
9789 : see if asctime_r exists
9790 set asctime_r d_asctime_r
9791 eval $inlibc
9792 case "$d_asctime_r" in
9793 "$define")
9794         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9795         case "$d_asctime_r_proto:$usethreads" in
9796         ":define")      d_asctime_r_proto=define
9797                 set d_asctime_r_proto asctime_r $hdrs
9798                 eval $hasproto ;;
9799         *)      ;;
9800         esac
9801         case "$d_asctime_r_proto" in
9802         define)
9803         case "$asctime_r_proto" in
9804         ''|0) try='char* asctime_r(const struct tm*, char*);'
9805         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9806         esac
9807         case "$asctime_r_proto" in
9808         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9809         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9810         esac
9811         case "$asctime_r_proto" in
9812         ''|0) try='int asctime_r(const struct tm*, char*);'
9813         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9814         esac
9815         case "$asctime_r_proto" in
9816         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9817         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9818         esac
9819         case "$asctime_r_proto" in
9820         ''|0)   d_asctime_r=undef
9821                 asctime_r_proto=0
9822                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9823         * )     case "$asctime_r_proto" in
9824                 REENTRANT_PROTO*) ;;
9825                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9826                 esac
9827                 echo "Prototype: $try" ;;
9828         esac
9829         ;;
9830         *)      case "$usethreads" in
9831                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9832                 esac
9833                 d_asctime_r=undef
9834                 asctime_r_proto=0
9835                 ;;
9836         esac
9837         ;;
9838 *)      asctime_r_proto=0
9839         ;;
9840 esac
9841
9842 : see if atolf exists
9843 set atolf d_atolf
9844 eval $inlibc
9845
9846 : see if atoll exists
9847 set atoll d_atoll
9848 eval $inlibc
9849
9850 : Look for GCC-style attribute format
9851 case "$d_attribute_format" in
9852 '')
9853 echo " "
9854 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9855 $cat >attrib.c <<'EOCP'
9856 #include <stdio.h>
9857 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9858 EOCP
9859 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9860         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9861                 echo "Your C compiler doesn't support __attribute__((format))."
9862                 val="$undef"
9863         else
9864                 echo "Your C compiler supports __attribute__((format))."
9865                 val="$define"
9866         fi
9867 else
9868         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9869         val="$undef"
9870 fi
9871 ;;
9872 *) val="$d_attribute_format" ;;
9873 esac
9874 set d_attribute_format
9875 eval $setvar
9876 $rm -f attrib*
9877
9878 : Look for GCC-style attribute malloc
9879 case "$d_attribute_malloc" in
9880 '')
9881 echo " "
9882 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9883 $cat >attrib.c <<'EOCP'
9884 #include <stdio.h>
9885 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9886 EOCP
9887 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9888         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9889                 echo "Your C compiler doesn't support __attribute__((malloc))."
9890                 val="$undef"
9891         else
9892                 echo "Your C compiler supports __attribute__((malloc))."
9893                 val="$define"
9894         fi
9895 else
9896         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9897         val="$undef"
9898 fi
9899 ;;
9900 *) val="$d_attribute_malloc" ;;
9901 esac
9902 set d_attribute_malloc
9903 eval $setvar
9904 $rm -f attrib*
9905
9906 : Look for GCC-style attribute nonnull
9907 case "$d_attribute_nonnull" in
9908 '')
9909 echo " "
9910 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9911 $cat >attrib.c <<'EOCP'
9912 #include <stdio.h>
9913 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9914 EOCP
9915 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9916         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9917                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9918                 val="$undef"
9919         else
9920                 echo "Your C compiler supports __attribute__((nonnull))."
9921                 val="$define"
9922         fi
9923 else
9924         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9925         val="$undef"
9926 fi
9927 ;;
9928 *) val="$d_attribute_nonnull" ;;
9929 esac
9930 set d_attribute_nonnull
9931 eval $setvar
9932 $rm -f attrib*
9933
9934 : Look for GCC-style attribute noreturn
9935 case "$d_attribute_noreturn" in
9936 '')
9937 echo " "
9938 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9939 $cat >attrib.c <<'EOCP'
9940 #include <stdio.h>
9941 void fall_over_dead( void ) __attribute__((noreturn));
9942 EOCP
9943 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9944         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9945                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9946                 val="$undef"
9947         else
9948                 echo "Your C compiler supports __attribute__((noreturn))."
9949                 val="$define"
9950         fi
9951 else
9952         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9953         val="$undef"
9954 fi
9955 ;;
9956 *) val="$d_attribute_noreturn" ;;
9957 esac
9958 set d_attribute_noreturn
9959 eval $setvar
9960 $rm -f attrib*
9961
9962 : Look for GCC-style attribute pure
9963 case "$d_attribute_pure" in
9964 '')
9965 echo " "
9966 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
9967 $cat >attrib.c <<'EOCP'
9968 #include <stdio.h>
9969 int square( int n ) __attribute__((pure));
9970 EOCP
9971 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9972         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9973                 echo "Your C compiler doesn't support __attribute__((pure))."
9974                 val="$undef"
9975         else
9976                 echo "Your C compiler supports __attribute__((pure))."
9977                 val="$define"
9978         fi
9979 else
9980         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9981         val="$undef"
9982 fi
9983 ;;
9984 *) val="$d_attribute_pure" ;;
9985 esac
9986 set d_attribute_pure
9987 eval $setvar
9988 $rm -f attrib*
9989
9990 : Look for GCC-style attribute unused
9991 case "$d_attribute_unused" in
9992 '')
9993 echo " "
9994 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
9995 $cat >attrib.c <<'EOCP'
9996 #include <stdio.h>
9997 int do_something( int dummy __attribute__((unused)), int n );
9998 EOCP
9999 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10000         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10001                 echo "Your C compiler doesn't support __attribute__((unused))."
10002                 val="$undef"
10003         else
10004                 echo "Your C compiler supports __attribute__((unused))."
10005                 val="$define"
10006         fi
10007 else
10008         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10009         val="$undef"
10010 fi
10011 ;;
10012 *) val="$d_attribute_unused" ;;
10013 esac
10014 set d_attribute_unused
10015 eval $setvar
10016 $rm -f attrib*
10017
10018 : Look for GCC-style attribute warn_unused_result
10019 case "$d_attribute_warn_unused_result" in
10020 '')
10021 echo " "
10022 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10023 $cat >attrib.c <<'EOCP'
10024 #include <stdio.h>
10025 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10026 EOCP
10027 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10028         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10029                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10030                 val="$undef"
10031         else
10032                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10033                 val="$define"
10034         fi
10035 else
10036         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10037         val="$undef"
10038 fi
10039 ;;
10040 *) val="$d_attribute_warn_unused_result" ;;
10041 esac
10042 set d_attribute_warn_unused_result
10043 eval $setvar
10044 $rm -f attrib*
10045
10046 : see if bcmp exists
10047 set bcmp d_bcmp
10048 eval $inlibc
10049
10050 : see if bcopy exists
10051 set bcopy d_bcopy
10052 eval $inlibc
10053
10054 : see if this is a unistd.h system
10055 set unistd.h i_unistd
10056 eval $inhdr
10057
10058 : see if getpgrp exists
10059 set getpgrp d_getpgrp
10060 eval $inlibc
10061
10062 case "$d_getpgrp" in
10063 "$define")
10064         echo " "
10065         echo "Checking to see which flavor of getpgrp is in use..."
10066         $cat >try.c <<EOP
10067 #$i_unistd I_UNISTD
10068 #include <sys/types.h>
10069 #ifdef I_UNISTD
10070 #  include <unistd.h>
10071 #endif
10072 #$i_stdlib I_STDLIB
10073 #ifdef I_STDLIB
10074 #include <stdlib.h>
10075 #endif
10076 int main()
10077 {
10078         if (getuid() == 0) {
10079                 printf("(I see you are running Configure as super-user...)\n");
10080                 setuid(1);
10081         }
10082 #ifdef TRY_BSD_PGRP
10083         if (getpgrp(1) == 0)
10084                 exit(0);
10085 #else
10086         if (getpgrp() > 0)
10087                 exit(0);
10088 #endif
10089         exit(1);
10090 }
10091 EOP
10092         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10093                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10094                 val="$define"
10095         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10096                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10097                 val="$undef"
10098         else
10099                 echo "I can't seem to compile and run the test program."
10100                 if ./usg; then
10101                         xxx="a USG one, i.e. you use getpgrp()."
10102                 else
10103                         # SVR4 systems can appear rather BSD-ish.
10104                         case "$i_unistd" in
10105                         $undef)
10106                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10107                                 val="$define"
10108                                 ;;
10109                         $define)
10110                                 xxx="probably a USG one, i.e. you use getpgrp()."
10111                                 val="$undef"
10112                                 ;;
10113                         esac
10114                 fi
10115                 echo "Assuming your getpgrp is $xxx" >&4
10116         fi
10117         ;;
10118 *) val="$undef";;
10119 esac
10120 set d_bsdgetpgrp
10121 eval $setvar
10122 $rm -f try try.*
10123
10124 : see if setpgrp exists
10125 set setpgrp d_setpgrp
10126 eval $inlibc
10127
10128 case "$d_setpgrp" in
10129 "$define")
10130         echo " "
10131         echo "Checking to see which flavor of setpgrp is in use..."
10132         $cat >try.c <<EOP
10133 #$i_unistd I_UNISTD
10134 #include <sys/types.h>
10135 #ifdef I_UNISTD
10136 #  include <unistd.h>
10137 #endif
10138 #$i_stdlib I_STDLIB
10139 #ifdef I_STDLIB
10140 #include <stdlib.h>
10141 #endif
10142 int main()
10143 {
10144         if (getuid() == 0) {
10145                 printf("(I see you are running Configure as super-user...)\n");
10146                 setuid(1);
10147         }
10148 #ifdef TRY_BSD_PGRP
10149         if (-1 == setpgrp(1, 1))
10150                 exit(0);
10151 #else
10152         if (setpgrp() != -1)
10153                 exit(0);
10154 #endif
10155         exit(1);
10156 }
10157 EOP
10158         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10159                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10160                 val="$define"
10161         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10162                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10163                 val="$undef"
10164         else
10165                 echo "(I can't seem to compile and run the test program.)"
10166                 if ./usg; then
10167                         xxx="a USG one, i.e. you use setpgrp()."
10168                 else
10169                         # SVR4 systems can appear rather BSD-ish.
10170                         case "$i_unistd" in
10171                         $undef)
10172                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10173                                 val="$define"
10174                                 ;;
10175                         $define)
10176                                 xxx="probably a USG one, i.e. you use setpgrp()."
10177                                 val="$undef"
10178                                 ;;
10179                         esac
10180                 fi
10181                 echo "Assuming your setpgrp is $xxx" >&4
10182         fi
10183         ;;
10184 *) val="$undef";;
10185 esac
10186 set d_bsdsetpgrp
10187 eval $setvar
10188 $rm -f try try.*
10189 : Look for GCC-style __builtin_choose_expr
10190 case "$d_builtin_choose_expr" in
10191 '')
10192     echo " "
10193     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10194     $cat >try.c <<'EOCP'
10195 #include <assert.h>
10196 #include <stdlib.h>
10197 #include <stdio.h>
10198
10199 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10200
10201 int main(void) {
10202     assert( SYRINX(1) == 2112 );
10203     assert( SYRINX(1) != 5150 );
10204     assert( SYRINX(0) == 5150 );
10205     assert( SYRINX(0) != 2112 );
10206     puts( "All good!" );
10207     exit(0);
10208 }
10209
10210 EOCP
10211     set try
10212     if eval $compile; then
10213         echo "Your C compiler supports __builtin_choose_expr."
10214         val="$define"
10215     else
10216         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10217         val="$undef"
10218     fi
10219 ;;
10220 *) val="$d_builtin_choose_expr" ;;
10221 esac
10222
10223 set d_builtin_choose_expr
10224 eval $setvar
10225 $rm -f try.* try core core.try.*
10226
10227 : Look for GCC-style __builtin_expect
10228 case "$d_builtin_expect" in
10229 '')
10230     echo " "
10231     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10232     $cat >builtin.c <<'EOCP'
10233 int main(void) {
10234     int n = 50;
10235     if ( __builtin_expect(n, 0) ) n = 1;
10236 }
10237 EOCP
10238     set try
10239     if eval $compile; then
10240         echo "Your C compiler supports __builtin_choose_expr."
10241         val="$define"
10242     else
10243         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10244         val="$undef"
10245     fi
10246     ;;
10247 *) val="$d_builtin_expect" ;;
10248 esac
10249
10250 set d_builtin_expect
10251 eval $setvar
10252 $rm -f try.* try core core.try.*
10253
10254 : see if bzero exists
10255 set bzero d_bzero
10256 eval $inlibc
10257
10258 : see if signal is declared as pointer to function returning int or void
10259 echo " "
10260 xxx=`./findhdr signal.h`
10261 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10262 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10263         echo "You have int (*signal())() instead of void." >&4
10264         val="$undef"
10265 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10266         echo "You have void (*signal())()." >&4
10267         val="$define"
10268 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10269         echo "You have int (*signal())() instead of void." >&4
10270         val="$undef"
10271 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10272         echo "You have void (*signal())()." >&4
10273         val="$define"
10274 else
10275         case "$d_voidsig" in
10276         '')
10277         echo "I can't determine whether signal handler returns void or int..." >&4
10278                 dflt=void
10279                 rp="What type does your signal handler return?"
10280                 . ./myread
10281                 case "$ans" in
10282                 v*) val="$define";;
10283                 *) val="$undef";;
10284                 esac;;
10285         "$define")
10286                 echo "As you already told me, signal handler returns void." >&4
10287                 val="$define"
10288                 ;;
10289         *)      echo "As you already told me, signal handler returns int." >&4
10290                 val="$undef"
10291                 ;;
10292         esac
10293 fi
10294 set d_voidsig
10295 eval $setvar
10296 case "$d_voidsig" in
10297 "$define") signal_t="void";;
10298 *) signal_t="int";;
10299 esac
10300 $rm -f $$.tmp
10301
10302 : check for ability to cast large floats to 32-bit ints.
10303 echo " "
10304 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10305 if $test "$intsize" -ge 4; then
10306         xxx=int
10307 else
10308         xxx=long
10309 fi
10310 $cat >try.c <<EOCP
10311 #include <stdio.h>
10312 #$i_stdlib I_STDLIB
10313 #ifdef I_STDLIB
10314 #include <stdlib.h>
10315 #endif
10316 #include <sys/types.h>
10317 #include <signal.h>
10318 $signal_t blech(s) int s; { exit(3); }
10319 int main()
10320 {
10321         $xxx i32;
10322         double f, g;
10323         int result = 0;
10324         char str[16];
10325         signal(SIGFPE, blech);
10326
10327         /* Don't let compiler optimize the test away.  Store the number 
10328            in a writable string for gcc to pass to sscanf under HP/UX.
10329         */
10330         sprintf(str, "2147483647");
10331         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10332         g = 10 * f;
10333         i32  = ($xxx) g;
10334
10335         /* x86 processors will probably give 0x8000 0000, which is a
10336            sign change.  We don't want that.  We want to mimic SPARC
10337            behavior here, which is to preserve the sign and give
10338            back 0x7fff ffff.
10339         */
10340         if (i32 != ($xxx) f)
10341                 result |= 1;
10342         exit(result);
10343 }
10344 EOCP
10345 set try
10346 if eval $compile_ok; then
10347         $run ./try
10348         yyy=$?
10349 else
10350         echo "(I can't seem to compile the test program--assuming it can't)"
10351         yyy=1
10352 fi
10353 case "$yyy" in
10354 0)      val="$define"
10355         echo "Yup, it can."
10356         ;;
10357 *)      val="$undef"
10358         echo "Nope, it can't."
10359         ;;
10360 esac
10361 set d_casti32
10362 eval $setvar
10363 $rm -f try try.*
10364
10365 : check for ability to cast negative floats to unsigned
10366 echo " "
10367 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10368 $cat >try.c <<EOCP
10369 #include <stdio.h>
10370 #$i_stdlib I_STDLIB
10371 #ifdef I_STDLIB
10372 #include <stdlib.h>
10373 #endif
10374 #include <sys/types.h>
10375 #include <signal.h>
10376 $signal_t blech(s) int s; { exit(7); }
10377 $signal_t blech_in_list(s) int s; { exit(4); }
10378 unsigned long dummy_long(p) unsigned long p; { return p; }
10379 unsigned int dummy_int(p) unsigned int p; { return p; }
10380 unsigned short dummy_short(p) unsigned short p; { return p; }
10381 int main()
10382 {
10383         double f;
10384         unsigned long along;
10385         unsigned int aint;
10386         unsigned short ashort;
10387         int result = 0;
10388         char str[16];
10389         
10390         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10391            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10392            optimized the whole file away
10393         */
10394         /* Store the number in a writable string for gcc to pass to 
10395            sscanf under HP/UX.
10396         */
10397         sprintf(str, "-123");
10398         sscanf(str, "%lf", &f);  /* f = -123.; */
10399
10400         signal(SIGFPE, blech);
10401         along = (unsigned long)f;
10402         aint = (unsigned int)f;
10403         ashort = (unsigned short)f;
10404         if (along != (unsigned long)-123)
10405                 result |= 1;
10406         if (aint != (unsigned int)-123)
10407                 result |= 1;
10408         if (ashort != (unsigned short)-123)
10409                 result |= 1;
10410         sprintf(str, "1073741824.");
10411         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10412         f = f + f;
10413         along = 0;
10414         along = (unsigned long)f;
10415         if (along != 0x80000000)
10416                 result |= 2;
10417         f -= 1.;
10418         along = 0;
10419         along = (unsigned long)f;
10420         if (along != 0x7fffffff)
10421                 result |= 1;
10422         f += 2.;
10423         along = 0;
10424         along = (unsigned long)f;
10425         if (along != 0x80000001)
10426                 result |= 2;
10427         if (result)
10428                 exit(result);
10429         signal(SIGFPE, blech_in_list);
10430         sprintf(str, "123.");
10431         sscanf(str, "%lf", &f);  /* f = 123.; */
10432         along = dummy_long((unsigned long)f);
10433         aint = dummy_int((unsigned int)f);
10434         ashort = dummy_short((unsigned short)f);
10435         if (along != (unsigned long)123)
10436                 result |= 4;
10437         if (aint != (unsigned int)123)
10438                 result |= 4;
10439         if (ashort != (unsigned short)123)
10440                 result |= 4;
10441         exit(result);
10442
10443 }
10444 EOCP
10445 set try
10446 if eval $compile_ok; then
10447         $run ./try
10448         castflags=$?
10449 else
10450         echo "(I can't seem to compile the test program--assuming it can't)"
10451         castflags=7
10452 fi
10453 case "$castflags" in
10454 0)      val="$define"
10455         echo "Yup, it can."
10456         ;;
10457 *)      val="$undef"
10458         echo "Nope, it can't."
10459         ;;
10460 esac
10461 set d_castneg
10462 eval $setvar
10463 $rm -f try.*
10464
10465 : see if vprintf exists
10466 echo " "
10467 if set vprintf val -f d_vprintf; eval $csym; $val; then
10468         echo 'vprintf() found.' >&4
10469         val="$define"
10470         $cat >try.c <<EOF
10471 #include <varargs.h>
10472 #$i_stdlib I_STDLIB
10473 #ifdef I_STDLIB
10474 #include <stdlib.h>
10475 #endif
10476
10477 int main() { xxx("foo"); }
10478
10479 xxx(va_alist)
10480 va_dcl
10481 {
10482         va_list args;
10483         char buf[10];
10484
10485         va_start(args);
10486         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10487 }
10488 EOF
10489         set try
10490         if eval $compile && $run ./try; then
10491                 echo "Your vsprintf() returns (int)." >&4
10492                 val2="$undef"
10493         else
10494                 echo "Your vsprintf() returns (char*)." >&4
10495                 val2="$define"
10496         fi
10497 else
10498         echo 'vprintf() NOT found.' >&4
10499                 val="$undef"
10500                 val2="$undef"
10501 fi
10502 $rm -f try try.*
10503 set d_vprintf
10504 eval $setvar
10505 val=$val2
10506 set d_charvspr
10507 eval $setvar
10508
10509 : see if chown exists
10510 set chown d_chown
10511 eval $inlibc
10512
10513 : see if chroot exists
10514 set chroot d_chroot
10515 eval $inlibc
10516
10517 : see if chsize exists
10518 set chsize d_chsize
10519 eval $inlibc
10520
10521 : see if class exists
10522 set class d_class
10523 eval $inlibc
10524
10525 : see if clearenv exists
10526 set clearenv d_clearenv
10527 eval $inlibc
10528
10529 hasstruct='varname=$1; struct=$2; shift; shift;
10530 while $test $# -ge 2; do
10531         case "$1" in
10532         $define) echo "#include <$2>";;
10533         esac ;
10534     shift 2;
10535 done > try.c;
10536 echo "int main () { struct $struct foo; }" >> try.c;
10537 set try;
10538 if eval $compile; then
10539         val="$define";
10540 else
10541         val="$undef";
10542 fi;
10543 set $varname;
10544 eval $setvar;
10545 $rm -f try.c try.o'
10546
10547 socketlib=''
10548 sockethdr=''
10549 : see whether socket exists
10550 echo " "
10551 $echo $n "Hmm... $c" >&4
10552 if set socket val -f d_socket; eval $csym; $val; then
10553         echo "Looks like you have Berkeley networking support." >&4
10554         d_socket="$define"
10555         if set setsockopt val -f; eval $csym; $val; then
10556                 d_oldsock="$undef"
10557         else
10558                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10559                 d_oldsock="$define"
10560         fi
10561 else
10562         if $contains socklib libc.list >/dev/null 2>&1; then
10563                 echo "Looks like you have Berkeley networking support." >&4
10564                 d_socket="$define"
10565                 : we will have to assume that it supports the 4.2 BSD interface
10566                 d_oldsock="$undef"
10567         else
10568                 echo "You don't have Berkeley networking in libc$_a..." >&4
10569                 if test "X$d_socket" = "X$define"; then
10570                    echo "...but you seem to believe that you have sockets." >&4
10571                 else
10572                         for net in net socket
10573                         do
10574                                 if test -f /usr/lib/lib$net$_a; then
10575                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10576                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10577                                         if $contains socket libc.list >/dev/null 2>&1; then
10578                                                 d_socket="$define"
10579                                                 socketlib="-l$net"
10580                                                 case "$net" in
10581                                                 net)
10582                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10583                                                         sockethdr="-I/usr/netinclude"
10584                                                         ;;
10585                                                 esac
10586                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10587                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10588                                                         d_oldsock="$undef"
10589                                                 else
10590                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10591                                                         d_oldsock="$define"
10592                                                 fi
10593                                                 break
10594                                         fi
10595                                 fi
10596                         done
10597                         if test "X$d_socket" != "X$define"; then
10598                            echo "or anywhere else I see." >&4
10599                            d_socket="$undef"
10600                            d_oldsock="$undef"
10601                         fi
10602                 fi
10603         fi
10604 fi
10605
10606 : see if socketpair exists
10607 set socketpair d_sockpair
10608 eval $inlibc
10609
10610
10611 echo " "
10612 echo "Checking the availability of certain socket constants..." >&4
10613 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10614         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10615         $cat >try.c <<EOF
10616 #include <sys/types.h>
10617 #include <sys/socket.h>
10618 int main() {
10619     int i = $ENUM;
10620 }
10621 EOF
10622         val="$undef"
10623         set try; if eval $compile; then
10624                 val="$define"
10625         fi
10626         set d_${enum}; eval $setvar
10627         $rm -f try.c try
10628 done
10629
10630 : see if this is a sys/uio.h system
10631 set sys/uio.h i_sysuio
10632 eval $inhdr
10633
10634
10635 echo " "
10636 echo "Checking to see if your system supports struct cmsghdr..." >&4
10637 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10638 eval $hasstruct
10639 case "$d_cmsghdr_s" in
10640 "$define")      echo "Yes, it does."   ;;
10641 *)              echo "No, it doesn't." ;;
10642 esac
10643
10644
10645 : check for const keyword
10646 echo " "
10647 echo 'Checking to see if your C compiler knows about "const"...' >&4
10648 $cat >const.c <<'EOCP'
10649 typedef struct spug { int drokk; } spug;
10650 int main()
10651 {
10652         const char *foo;
10653         const spug y;
10654 }
10655 EOCP
10656 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10657         val="$define"
10658         echo "Yup, it does."
10659 else
10660         val="$undef"
10661         echo "Nope, it doesn't."
10662 fi
10663 set d_const
10664 eval $setvar
10665
10666 : see if copysignl exists
10667 set copysignl d_copysignl
10668 eval $inlibc
10669
10670 : see if crypt exists
10671 echo " "
10672 set crypt d_crypt
10673 eval $inlibc
10674 case "$d_crypt" in
10675 $define) cryptlib='' ;;
10676 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10677                 echo 'crypt() found.' >&4
10678                 val="$define"
10679                 cryptlib=''
10680         else
10681                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10682                 if $test -z "$cryptlib"; then
10683                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10684                 else
10685                         cryptlib=-lcrypt
10686                 fi
10687                 if $test -z "$cryptlib"; then
10688                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10689                 else
10690                         cryptlib=-lcrypt
10691                 fi
10692                 if $test -z "$cryptlib"; then
10693                         cryptlib=`./loc libcrypt$_a "" $libpth`
10694                 else
10695                         cryptlib=-lcrypt
10696                 fi
10697                 if $test -z "$cryptlib"; then
10698                         echo 'crypt() NOT found.' >&4
10699                         val="$undef"
10700                 else
10701                         val="$define"
10702                 fi
10703         fi
10704         set d_crypt
10705         eval $setvar
10706         ;;
10707 esac
10708
10709 : see if this is a crypt.h system
10710 set crypt.h i_crypt
10711 eval $inhdr
10712
10713 : see if crypt_r exists
10714 set crypt_r d_crypt_r
10715 eval $inlibc
10716 case "$d_crypt_r" in
10717 "$define")
10718         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10719         case "$d_crypt_r_proto:$usethreads" in
10720         ":define")      d_crypt_r_proto=define
10721                 set d_crypt_r_proto crypt_r $hdrs
10722                 eval $hasproto ;;
10723         *)      ;;
10724         esac
10725         case "$d_crypt_r_proto" in
10726         define)
10727         case "$crypt_r_proto" in
10728         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10729         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10730         esac
10731         case "$crypt_r_proto" in
10732         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10733         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10734         esac
10735         case "$crypt_r_proto" in
10736         ''|0)   d_crypt_r=undef
10737                 crypt_r_proto=0
10738                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10739         * )     case "$crypt_r_proto" in
10740                 REENTRANT_PROTO*) ;;
10741                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10742                 esac
10743                 echo "Prototype: $try" ;;
10744         esac
10745         ;;
10746         *)      case "$usethreads" in
10747                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10748                 esac
10749                 d_crypt_r=undef
10750                 crypt_r_proto=0
10751                 ;;
10752         esac
10753         ;;
10754 *)      crypt_r_proto=0
10755         ;;
10756 esac
10757
10758 : get csh whereabouts
10759 case "$csh" in
10760 'csh') val="$undef" ;;
10761 *) val="$define" ;;
10762 esac
10763 set d_csh
10764 eval $setvar
10765 : Respect a hint or command line value for full_csh.
10766 case "$full_csh" in
10767 '') full_csh=$csh ;;
10768 esac
10769
10770 : see if ctermid_r exists
10771 set ctermid_r d_ctermid_r
10772 eval $inlibc
10773 case "$d_ctermid_r" in
10774 "$define")
10775         hdrs="$i_systypes sys/types.h define stdio.h "
10776         case "$d_ctermid_r_proto:$usethreads" in
10777         ":define")      d_ctermid_r_proto=define
10778                 set d_ctermid_r_proto ctermid_r $hdrs
10779                 eval $hasproto ;;
10780         *)      ;;
10781         esac
10782         case "$d_ctermid_r_proto" in
10783         define)
10784         case "$ctermid_r_proto" in
10785         ''|0) try='char* ctermid_r(char*);'
10786         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10787         esac
10788         case "$ctermid_r_proto" in
10789         ''|0)   d_ctermid_r=undef
10790                 ctermid_r_proto=0
10791                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10792         * )     case "$ctermid_r_proto" in
10793                 REENTRANT_PROTO*) ;;
10794                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10795                 esac
10796                 echo "Prototype: $try" ;;
10797         esac
10798         ;;
10799         *)      case "$usethreads" in
10800                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10801                 esac
10802                 d_ctermid_r=undef
10803                 ctermid_r_proto=0
10804                 ;;
10805         esac
10806         ;;
10807 *)      ctermid_r_proto=0
10808         ;;
10809 esac
10810
10811 : see if ctime_r exists
10812 set ctime_r d_ctime_r
10813 eval $inlibc
10814 case "$d_ctime_r" in
10815 "$define")
10816         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10817         case "$d_ctime_r_proto:$usethreads" in
10818         ":define")      d_ctime_r_proto=define
10819                 set d_ctime_r_proto ctime_r $hdrs
10820                 eval $hasproto ;;
10821         *)      ;;
10822         esac
10823         case "$d_ctime_r_proto" in
10824         define)
10825         case "$ctime_r_proto" in
10826         ''|0) try='char* ctime_r(const time_t*, char*);'
10827         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10828         esac
10829         case "$ctime_r_proto" in
10830         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10831         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10832         esac
10833         case "$ctime_r_proto" in
10834         ''|0) try='int ctime_r(const time_t*, char*);'
10835         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10836         esac
10837         case "$ctime_r_proto" in
10838         ''|0) try='int ctime_r(const time_t*, char*, int);'
10839         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10840         esac
10841         case "$ctime_r_proto" in
10842         ''|0)   d_ctime_r=undef
10843                 ctime_r_proto=0
10844                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10845         * )     case "$ctime_r_proto" in
10846                 REENTRANT_PROTO*) ;;
10847                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10848                 esac
10849                 echo "Prototype: $try" ;;
10850         esac
10851         ;;
10852         *)      case "$usethreads" in
10853                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10854                 esac
10855                 d_ctime_r=undef
10856                 ctime_r_proto=0
10857                 ;;
10858         esac
10859         ;;
10860 *)      ctime_r_proto=0
10861         ;;
10862 esac
10863
10864 : see if cuserid exists
10865 set cuserid d_cuserid
10866 eval $inlibc
10867
10868 : see if this is a limits.h system
10869 set limits.h i_limits
10870 eval $inhdr
10871
10872 : see if this is a float.h system
10873 set float.h i_float
10874 eval $inhdr
10875
10876 : See if number of significant digits in a double precision number is known
10877 echo " "
10878 $cat >dbl_dig.c <<EOM
10879 #$i_limits I_LIMITS
10880 #$i_float I_FLOAT
10881 #ifdef I_LIMITS
10882 #include <limits.h>
10883 #endif
10884 #ifdef I_FLOAT
10885 #include <float.h>
10886 #endif
10887 #ifdef DBL_DIG
10888 printf("Contains DBL_DIG");
10889 #endif
10890 EOM
10891 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10892 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10893         echo "DBL_DIG found." >&4
10894         val="$define"
10895 else
10896         echo "DBL_DIG NOT found." >&4
10897         val="$undef"
10898 fi
10899 $rm -f dbl_dig.?
10900 set d_dbl_dig
10901 eval $setvar
10902
10903 : see if dbm.h is available
10904 : see if dbmclose exists
10905 set dbmclose d_dbmclose
10906 eval $inlibc
10907
10908 case "$d_dbmclose" in
10909 $define)
10910         set dbm.h i_dbm
10911         eval $inhdr
10912         case "$i_dbm" in
10913         $define)
10914                 val="$undef"
10915                 set i_rpcsvcdbm
10916                 eval $setvar
10917                 ;;
10918         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10919                 eval $inhdr
10920                 ;;
10921         esac
10922         ;;
10923 *)      echo "We won't be including <dbm.h>"
10924         val="$undef"
10925         set i_dbm
10926         eval $setvar
10927         val="$undef"
10928         set i_rpcsvcdbm
10929         eval $setvar
10930         ;;
10931 esac
10932
10933 : see if prototype for dbminit is available
10934 echo " "
10935 set d_dbminitproto dbminit $i_dbm dbm.h
10936 eval $hasproto
10937
10938 : see if difftime exists
10939 set difftime d_difftime
10940 eval $inlibc
10941
10942 : see if this is a dirent system
10943 echo " "
10944 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10945         val="$define"
10946         echo "<dirent.h> found." >&4
10947 else
10948         val="$undef"
10949         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10950                 echo "<sys/dir.h> found." >&4
10951                 echo " "
10952         else
10953                 xinc=`./findhdr sys/ndir.h`
10954         fi
10955         echo "<dirent.h> NOT found." >&4
10956 fi
10957 set i_dirent
10958 eval $setvar
10959
10960 : Look for type of directory structure.
10961 echo " "
10962 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10963
10964 case "$direntrytype" in
10965 ''|' ')
10966         case "$i_dirent" in
10967         $define) guess1='struct dirent' ;;
10968         *) guess1='struct direct'  ;;
10969         esac
10970         ;;
10971 *)      guess1="$direntrytype"
10972         ;;
10973 esac
10974
10975 case "$guess1" in
10976 'struct dirent') guess2='struct direct' ;;
10977 *) guess2='struct dirent' ;;
10978 esac
10979                 
10980 if $contains "$guess1" try.c >/dev/null 2>&1; then
10981         direntrytype="$guess1"
10982         echo "Your directory entries are $direntrytype." >&4
10983 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10984         direntrytype="$guess2"
10985         echo "Your directory entries seem to be $direntrytype." >&4
10986 else
10987         echo "I don't recognize your system's directory entries." >&4
10988         rp="What type is used for directory entries on this system?"
10989         dflt="$guess1"
10990         . ./myread
10991         direntrytype="$ans"
10992 fi
10993 $rm -f try.c
10994
10995
10996 : see if the directory entry stores field length
10997 echo " "
10998 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10999 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11000         echo "Good, your directory entry keeps length information in d_namlen." >&4
11001         val="$define"
11002 else
11003         echo "Your directory entry does not know about the d_namlen field." >&4
11004         val="$undef"
11005 fi
11006 set d_dirnamlen
11007 eval $setvar
11008 $rm -f try.c
11009
11010 : see if this is an sysdir system
11011 set sys/dir.h i_sysdir
11012 eval $inhdr
11013
11014 : see if this is an sysndir system
11015 set sys/ndir.h i_sysndir
11016 eval $inhdr
11017
11018 : Look for dirfd
11019 echo " "
11020 $cat >dirfd.c <<EOM
11021 #include <stdio.h>
11022 #$i_stdlib I_STDLIB
11023 #ifdef I_STDLIB
11024 #include <stdlib.h>
11025 #endif
11026 #$i_dirent I_DIRENT             /**/
11027 #$i_sysdir I_SYS_DIR            /**/
11028 #$i_sysndir I_SYS_NDIR          /**/
11029 #$i_systypes I_SYS_TYPES        /**/
11030 #if defined(I_SYS_TYPES)
11031 #include <sys/types.h>
11032 #endif
11033 #if defined(I_DIRENT)
11034 #include <dirent.h>
11035 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11036 #include <sys/dir.h>
11037 #endif
11038 #else
11039 #ifdef I_SYS_NDIR
11040 #include <sys/ndir.h>
11041 #else
11042 #ifdef I_SYS_DIR
11043 #ifdef hp9000s500
11044 #include <ndir.h>       /* may be wrong in the future */
11045 #else
11046 #include <sys/dir.h>
11047 #endif
11048 #endif
11049 #endif
11050 #endif 
11051 int main() {
11052         DIR *dirp = opendir(".");
11053         if (dirfd(dirp) >= 0)
11054                 exit(0);
11055         else
11056                 exit(1);
11057 }
11058 EOM
11059 val=$undef
11060 set dirfd
11061 if eval $compile; then
11062         val="$define"
11063 fi
11064 case "$val" in
11065 $define)        echo "dirfd() found." >&4       ;;
11066 *)              echo "dirfd() NOT found." >&4   ;;
11067 esac
11068 set d_dirfd
11069 eval $setvar
11070 $rm -f dirfd*
11071
11072 : see if dlerror exists
11073 xxx_runnm="$runnm"
11074 runnm=false
11075 set dlerror d_dlerror
11076 eval $inlibc
11077 runnm="$xxx_runnm"
11078
11079 : see if dlfcn is available
11080 set dlfcn.h i_dlfcn
11081 eval $inhdr
11082
11083 case "$usedl" in
11084 $define|y|true)
11085         $cat << EOM
11086
11087 On a few systems, the dynamically loaded modules that perl generates and uses
11088 will need a different extension than shared libs. The default will probably
11089 be appropriate.
11090
11091 EOM
11092         case "$dlext" in
11093         '')     dflt="$so" ;;
11094         *)      dflt="$dlext" ;;
11095         esac
11096         rp='What is the extension of dynamically loaded modules'
11097         . ./myread
11098         dlext="$ans"
11099         ;;
11100 *)
11101         dlext="none"
11102         ;;
11103 esac
11104
11105 : Check if dlsym need a leading underscore
11106 echo " "
11107 val="$undef"
11108
11109 case "$dlsrc" in
11110 dl_dlopen.xs)
11111         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11112         $cat >dyna.c <<'EOM'
11113 fred () { }
11114 EOM
11115
11116 $cat >fred.c<<EOM
11117
11118 #include <stdio.h>
11119 #$i_stdlib I_STDLIB
11120 #ifdef I_STDLIB
11121 #include <stdlib.h>
11122 #endif
11123 #$i_dlfcn I_DLFCN
11124 #ifdef I_DLFCN
11125 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11126 #else
11127 #include <sys/types.h>
11128 #include <nlist.h>
11129 #include <link.h>
11130 #endif
11131
11132 extern int fred() ;
11133
11134 int main()
11135 {
11136     void * handle ;
11137     void * symbol ;
11138 #ifndef RTLD_LAZY
11139     int mode = 1 ;
11140 #else
11141     int mode = RTLD_LAZY ;
11142 #endif
11143     handle = dlopen("./dyna.$dlext", mode) ;
11144     if (handle == NULL) {
11145         printf ("1\n") ;
11146         fflush (stdout) ;
11147         exit(0);
11148     }
11149     symbol = dlsym(handle, "fred") ;
11150     if (symbol == NULL) {
11151         /* try putting a leading underscore */
11152         symbol = dlsym(handle, "_fred") ;
11153         if (symbol == NULL) {
11154             printf ("2\n") ;
11155             fflush (stdout) ;
11156             exit(0);
11157         }
11158         printf ("3\n") ;
11159     }
11160     else
11161         printf ("4\n") ;
11162     fflush (stdout) ;
11163     exit(0);
11164 }
11165 EOM
11166         : Call the object file tmp-dyna.o in case dlext=o.
11167         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11168                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11169                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11170                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11171                 xxx=`$run ./fred`
11172                 case $xxx in
11173                 1)      echo "Test program failed using dlopen." >&4
11174                         echo "Perhaps you should not use dynamic loading." >&4;;
11175                 2)      echo "Test program failed using dlsym." >&4
11176                         echo "Perhaps you should not use dynamic loading." >&4;;
11177                 3)      echo "dlsym needs a leading underscore" >&4
11178                         val="$define" ;;
11179                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11180                 esac
11181         else
11182                 echo "I can't compile and run the test program." >&4
11183                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11184         fi
11185         ;;
11186 esac
11187                 
11188 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11189
11190 set d_dlsymun
11191 eval $setvar
11192
11193 : see if drand48_r exists
11194 set drand48_r d_drand48_r
11195 eval $inlibc
11196 case "$d_drand48_r" in
11197 "$define")
11198         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11199         case "$d_drand48_r_proto:$usethreads" in
11200         ":define")      d_drand48_r_proto=define
11201                 set d_drand48_r_proto drand48_r $hdrs
11202                 eval $hasproto ;;
11203         *)      ;;
11204         esac
11205         case "$d_drand48_r_proto" in
11206         define)
11207         case "$drand48_r_proto" in
11208         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11209         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11210         esac
11211         case "$drand48_r_proto" in
11212         ''|0)   d_drand48_r=undef
11213                 drand48_r_proto=0
11214                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11215         * )     case "$drand48_r_proto" in
11216                 REENTRANT_PROTO*) ;;
11217                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11218                 esac
11219                 echo "Prototype: $try" ;;
11220         esac
11221         ;;
11222         *)      case "$usethreads" in
11223                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11224                 esac
11225                 d_drand48_r=undef
11226                 drand48_r_proto=0
11227                 ;;
11228         esac
11229         ;;
11230 *)      drand48_r_proto=0
11231         ;;
11232 esac
11233
11234 : see if prototype for drand48 is available
11235 echo " "
11236 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11237 eval $hasproto
11238
11239 : see if dup2 exists
11240 set dup2 d_dup2
11241 eval $inlibc
11242
11243 : see if eaccess exists
11244 set eaccess d_eaccess
11245 eval $inlibc
11246
11247 : see if endgrent exists
11248 set endgrent d_endgrent
11249 eval $inlibc
11250
11251 : see if this is an grp system
11252 set grp.h i_grp
11253 eval $inhdr
11254
11255 case "$i_grp" in
11256 $define)
11257         xxx=`./findhdr grp.h`
11258         $cppstdin $cppflags $cppminus < $xxx >$$.h
11259
11260         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11261                 val="$define"
11262         else
11263                 val="$undef"
11264         fi
11265         set d_grpasswd
11266         eval $setvar
11267
11268         $rm -f $$.h
11269         ;;
11270 *)
11271         val="$undef";
11272         set d_grpasswd; eval $setvar
11273         ;;
11274 esac
11275
11276 : see if endgrent_r exists
11277 set endgrent_r d_endgrent_r
11278 eval $inlibc
11279 case "$d_endgrent_r" in
11280 "$define")
11281         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11282         case "$d_endgrent_r_proto:$usethreads" in
11283         ":define")      d_endgrent_r_proto=define
11284                 set d_endgrent_r_proto endgrent_r $hdrs
11285                 eval $hasproto ;;
11286         *)      ;;
11287         esac
11288         case "$d_endgrent_r_proto" in
11289         define)
11290         case "$endgrent_r_proto" in
11291         ''|0) try='int endgrent_r(FILE**);'
11292         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11293         esac
11294         case "$endgrent_r_proto" in
11295         ''|0) try='void endgrent_r(FILE**);'
11296         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11297         esac
11298         case "$endgrent_r_proto" in
11299         ''|0)   d_endgrent_r=undef
11300                 endgrent_r_proto=0
11301                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11302         * )     case "$endgrent_r_proto" in
11303                 REENTRANT_PROTO*) ;;
11304                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11305                 esac
11306                 echo "Prototype: $try" ;;
11307         esac
11308         ;;
11309         *)      case "$usethreads" in
11310                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11311                 esac
11312                 d_endgrent_r=undef
11313                 endgrent_r_proto=0
11314                 ;;
11315         esac
11316         ;;
11317 *)      endgrent_r_proto=0
11318         ;;
11319 esac
11320
11321 : see if endhostent exists
11322 set endhostent d_endhent
11323 eval $inlibc
11324
11325 : see if this is a netdb.h system
11326 set netdb.h i_netdb
11327 eval $inhdr
11328
11329 : see if endhostent_r exists
11330 set endhostent_r d_endhostent_r
11331 eval $inlibc
11332 case "$d_endhostent_r" in
11333 "$define")
11334         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11335         case "$d_endhostent_r_proto:$usethreads" in
11336         ":define")      d_endhostent_r_proto=define
11337                 set d_endhostent_r_proto endhostent_r $hdrs
11338                 eval $hasproto ;;
11339         *)      ;;
11340         esac
11341         case "$d_endhostent_r_proto" in
11342         define)
11343         case "$endhostent_r_proto" in
11344         ''|0) try='int endhostent_r(struct hostent_data*);'
11345         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11346         esac
11347         case "$endhostent_r_proto" in
11348         ''|0) try='void endhostent_r(struct hostent_data*);'
11349         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11350         esac
11351         case "$endhostent_r_proto" in
11352         ''|0)   d_endhostent_r=undef
11353                 endhostent_r_proto=0
11354                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11355         * )     case "$endhostent_r_proto" in
11356                 REENTRANT_PROTO*) ;;
11357                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11358                 esac
11359                 echo "Prototype: $try" ;;
11360         esac
11361         ;;
11362         *)      case "$usethreads" in
11363                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11364                 esac
11365                 d_endhostent_r=undef
11366                 endhostent_r_proto=0
11367                 ;;
11368         esac
11369         ;;
11370 *)      endhostent_r_proto=0
11371         ;;
11372 esac
11373
11374 : see if endnetent exists
11375 set endnetent d_endnent
11376 eval $inlibc
11377
11378 : see if endnetent_r exists
11379 set endnetent_r d_endnetent_r
11380 eval $inlibc
11381 case "$d_endnetent_r" in
11382 "$define")
11383         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11384         case "$d_endnetent_r_proto:$usethreads" in
11385         ":define")      d_endnetent_r_proto=define
11386                 set d_endnetent_r_proto endnetent_r $hdrs
11387                 eval $hasproto ;;
11388         *)      ;;
11389         esac
11390         case "$d_endnetent_r_proto" in
11391         define)
11392         case "$endnetent_r_proto" in
11393         ''|0) try='int endnetent_r(struct netent_data*);'
11394         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11395         esac
11396         case "$endnetent_r_proto" in
11397         ''|0) try='void endnetent_r(struct netent_data*);'
11398         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11399         esac
11400         case "$endnetent_r_proto" in
11401         ''|0)   d_endnetent_r=undef
11402                 endnetent_r_proto=0
11403                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11404         * )     case "$endnetent_r_proto" in
11405                 REENTRANT_PROTO*) ;;
11406                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11407                 esac
11408                 echo "Prototype: $try" ;;
11409         esac
11410         ;;
11411         *)      case "$usethreads" in
11412                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11413                 esac
11414                 d_endnetent_r=undef
11415                 endnetent_r_proto=0
11416                 ;;
11417         esac
11418         ;;
11419 *)      endnetent_r_proto=0
11420         ;;
11421 esac
11422
11423 : see if endprotoent exists
11424 set endprotoent d_endpent
11425 eval $inlibc
11426
11427 : see if endprotoent_r exists
11428 set endprotoent_r d_endprotoent_r
11429 eval $inlibc
11430 case "$d_endprotoent_r" in
11431 "$define")
11432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11433         case "$d_endprotoent_r_proto:$usethreads" in
11434         ":define")      d_endprotoent_r_proto=define
11435                 set d_endprotoent_r_proto endprotoent_r $hdrs
11436                 eval $hasproto ;;
11437         *)      ;;
11438         esac
11439         case "$d_endprotoent_r_proto" in
11440         define)
11441         case "$endprotoent_r_proto" in
11442         ''|0) try='int endprotoent_r(struct protoent_data*);'
11443         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11444         esac
11445         case "$endprotoent_r_proto" in
11446         ''|0) try='void endprotoent_r(struct protoent_data*);'
11447         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11448         esac
11449         case "$endprotoent_r_proto" in
11450         ''|0)   d_endprotoent_r=undef
11451                 endprotoent_r_proto=0
11452                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11453         * )     case "$endprotoent_r_proto" in
11454                 REENTRANT_PROTO*) ;;
11455                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11456                 esac
11457                 echo "Prototype: $try" ;;
11458         esac
11459         ;;
11460         *)      case "$usethreads" in
11461                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11462                 esac
11463                 d_endprotoent_r=undef
11464                 endprotoent_r_proto=0
11465                 ;;
11466         esac
11467         ;;
11468 *)      endprotoent_r_proto=0
11469         ;;
11470 esac
11471
11472 : see if endpwent exists
11473 set endpwent d_endpwent
11474 eval $inlibc
11475
11476 : see if this is a pwd.h system
11477 set pwd.h i_pwd
11478 eval $inhdr
11479
11480 case "$i_pwd" in
11481 $define)
11482         xxx=`./findhdr pwd.h`
11483         $cppstdin $cppflags $cppminus < $xxx >$$.h
11484
11485         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11486                 val="$define"
11487         else
11488                 val="$undef"
11489         fi
11490         set d_pwquota
11491         eval $setvar
11492
11493         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11494                 val="$define"
11495         else
11496                 val="$undef"
11497         fi
11498         set d_pwage
11499         eval $setvar
11500
11501         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11502                 val="$define"
11503         else
11504                 val="$undef"
11505         fi
11506         set d_pwchange
11507         eval $setvar
11508
11509         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11510                 val="$define"
11511         else
11512                 val="$undef"
11513         fi
11514         set d_pwclass
11515         eval $setvar
11516
11517         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11518                 val="$define"
11519         else
11520                 val="$undef"
11521         fi
11522         set d_pwexpire
11523         eval $setvar
11524
11525         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11526                 val="$define"
11527         else
11528                 val="$undef"
11529         fi
11530         set d_pwcomment
11531         eval $setvar
11532
11533         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11534                 val="$define"
11535         else
11536                 val="$undef"
11537         fi
11538         set d_pwgecos
11539         eval $setvar
11540
11541         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11542                 val="$define"
11543         else
11544                 val="$undef"
11545         fi
11546         set d_pwpasswd
11547         eval $setvar
11548
11549         $rm -f $$.h
11550         ;;
11551 *)
11552         val="$undef"; 
11553         set d_pwquota; eval $setvar
11554         set d_pwage; eval $setvar
11555         set d_pwchange; eval $setvar
11556         set d_pwclass; eval $setvar
11557         set d_pwexpire; eval $setvar
11558         set d_pwcomment; eval $setvar
11559         set d_pwgecos; eval $setvar
11560         set d_pwpasswd; eval $setvar
11561         ;;
11562 esac
11563
11564 : see if endpwent_r exists
11565 set endpwent_r d_endpwent_r
11566 eval $inlibc
11567 case "$d_endpwent_r" in
11568 "$define")
11569         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11570         case "$d_endpwent_r_proto:$usethreads" in
11571         ":define")      d_endpwent_r_proto=define
11572                 set d_endpwent_r_proto endpwent_r $hdrs
11573                 eval $hasproto ;;
11574         *)      ;;
11575         esac
11576         case "$d_endpwent_r_proto" in
11577         define)
11578         case "$endpwent_r_proto" in
11579         ''|0) try='int endpwent_r(FILE**);'
11580         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11581         esac
11582         case "$endpwent_r_proto" in
11583         ''|0) try='void endpwent_r(FILE**);'
11584         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11585         esac
11586         case "$endpwent_r_proto" in
11587         ''|0)   d_endpwent_r=undef
11588                 endpwent_r_proto=0
11589                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11590         * )     case "$endpwent_r_proto" in
11591                 REENTRANT_PROTO*) ;;
11592                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11593                 esac
11594                 echo "Prototype: $try" ;;
11595         esac
11596         ;;
11597         *)      case "$usethreads" in
11598                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11599                 esac
11600                 d_endpwent_r=undef
11601                 endpwent_r_proto=0
11602                 ;;
11603         esac
11604         ;;
11605 *)      endpwent_r_proto=0
11606         ;;
11607 esac
11608
11609 : see if endservent exists
11610 set endservent d_endsent
11611 eval $inlibc
11612
11613 : see if endservent_r exists
11614 set endservent_r d_endservent_r
11615 eval $inlibc
11616 case "$d_endservent_r" in
11617 "$define")
11618         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11619         case "$d_endservent_r_proto:$usethreads" in
11620         ":define")      d_endservent_r_proto=define
11621                 set d_endservent_r_proto endservent_r $hdrs
11622                 eval $hasproto ;;
11623         *)      ;;
11624         esac
11625         case "$d_endservent_r_proto" in
11626         define)
11627         case "$endservent_r_proto" in
11628         ''|0) try='int endservent_r(struct servent_data*);'
11629         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11630         esac
11631         case "$endservent_r_proto" in
11632         ''|0) try='void endservent_r(struct servent_data*);'
11633         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11634         esac
11635         case "$endservent_r_proto" in
11636         ''|0)   d_endservent_r=undef
11637                 endservent_r_proto=0
11638                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11639         * )     case "$endservent_r_proto" in
11640                 REENTRANT_PROTO*) ;;
11641                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11642                 esac
11643                 echo "Prototype: $try" ;;
11644         esac
11645         ;;
11646         *)      case "$usethreads" in
11647                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11648                 esac
11649                 d_endservent_r=undef
11650                 endservent_r_proto=0
11651                 ;;
11652         esac
11653         ;;
11654 *)      endservent_r_proto=0
11655         ;;
11656 esac
11657
11658 : Locate the flags for 'open()'
11659 echo " "
11660 $cat >try.c <<EOCP
11661 #include <sys/types.h>
11662 #ifdef I_FCNTL
11663 #include <fcntl.h>
11664 #endif
11665 #ifdef I_SYS_FILE
11666 #include <sys/file.h>
11667 #endif
11668 #$i_stdlib I_STDLIB
11669 #ifdef I_STDLIB
11670 #include <stdlib.h>
11671 #endif
11672 int main() {
11673         if(O_RDONLY);
11674 #ifdef O_TRUNC
11675         exit(0);
11676 #else
11677         exit(1);
11678 #endif
11679 }
11680 EOCP
11681 : check sys/file.h first to get FREAD on Sun
11682 if $test `./findhdr sys/file.h` && \
11683                 set try -DI_SYS_FILE && eval $compile; then
11684         h_sysfile=true;
11685         echo "<sys/file.h> defines the O_* constants..." >&4
11686         if $run ./try; then
11687                 echo "and you have the 3 argument form of open()." >&4
11688                 val="$define"
11689         else
11690                 echo "but not the 3 argument form of open().  Oh, well." >&4
11691                 val="$undef"
11692         fi
11693 elif $test `./findhdr fcntl.h` && \
11694                 set try -DI_FCNTL && eval $compile; then
11695         h_fcntl=true;
11696         echo "<fcntl.h> defines the O_* constants..." >&4
11697         if $run ./try; then
11698                 echo "and you have the 3 argument form of open()." >&4
11699                 val="$define"
11700         else
11701                 echo "but not the 3 argument form of open().  Oh, well." >&4
11702                 val="$undef"
11703         fi
11704 else
11705         val="$undef"
11706         echo "I can't find the O_* constant definitions!  You got problems." >&4
11707 fi
11708 set d_open3
11709 eval $setvar
11710 $rm -f try try.*
11711
11712 : see which of string.h or strings.h is needed
11713 echo " "
11714 strings=`./findhdr string.h`
11715 if $test "$strings" && $test -r "$strings"; then
11716         echo "Using <string.h> instead of <strings.h>." >&4
11717         val="$define"
11718 else
11719         val="$undef"
11720         strings=`./findhdr strings.h`
11721         if $test "$strings" && $test -r "$strings"; then
11722                 echo "Using <strings.h> instead of <string.h>." >&4
11723         else
11724                 echo "No string header found -- You'll surely have problems." >&4
11725         fi
11726 fi
11727 set i_string
11728 eval $setvar
11729 case "$i_string" in
11730 "$undef") strings=`./findhdr strings.h`;;
11731 *)        strings=`./findhdr string.h`;;
11732 esac
11733
11734 : see if this is a sys/file.h system
11735 val=''
11736 set sys/file.h val
11737 eval $inhdr
11738
11739 : do we need to include sys/file.h ?
11740 case "$val" in
11741 "$define")
11742         echo " "
11743         if $h_sysfile; then
11744                 val="$define"
11745                 echo "We'll be including <sys/file.h>." >&4
11746         else
11747                 val="$undef"
11748                 echo "We won't be including <sys/file.h>." >&4
11749         fi
11750         ;;
11751 *)
11752         h_sysfile=false
11753         ;;
11754 esac
11755 set i_sysfile
11756 eval $setvar
11757
11758 : see if fcntl.h is there
11759 val=''
11760 set fcntl.h val
11761 eval $inhdr
11762
11763 : see if we can include fcntl.h
11764 case "$val" in
11765 "$define")
11766         echo " "
11767         if $h_fcntl; then
11768                 val="$define"
11769                 echo "We'll be including <fcntl.h>." >&4
11770         else
11771                 val="$undef"
11772                 if $h_sysfile; then
11773         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11774                 else
11775                         echo "We won't be including <fcntl.h>." >&4
11776                 fi
11777         fi
11778         ;;
11779 *)
11780         h_fcntl=false
11781         val="$undef"
11782         ;;
11783 esac
11784 set i_fcntl
11785 eval $setvar
11786
11787 : check for non-blocking I/O stuff
11788 case "$h_sysfile" in
11789 true) echo "#include <sys/file.h>" > head.c;;
11790 *)
11791        case "$h_fcntl" in
11792        true) echo "#include <fcntl.h>" > head.c;;
11793        *) echo "#include <sys/fcntl.h>" > head.c;;
11794        esac
11795        ;;
11796 esac
11797 echo " "
11798 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11799 case "$o_nonblock" in
11800 '')
11801         $cat head.c > try.c
11802         $cat >>try.c <<EOCP
11803 #include <stdio.h>
11804 #$i_stdlib I_STDLIB
11805 #ifdef I_STDLIB
11806 #include <stdlib.h>
11807 #endif
11808 #$i_fcntl I_FCNTL
11809 #ifdef I_FCNTL
11810 #include <fcntl.h>
11811 #endif
11812 int main() {
11813 #ifdef O_NONBLOCK
11814         printf("O_NONBLOCK\n");
11815         exit(0);
11816 #endif
11817 #ifdef O_NDELAY
11818         printf("O_NDELAY\n");
11819         exit(0);
11820 #endif
11821 #ifdef FNDELAY
11822         printf("FNDELAY\n");
11823         exit(0);
11824 #endif
11825         exit(0);
11826 }
11827 EOCP
11828         set try
11829         if eval $compile_ok; then
11830                 o_nonblock=`$run ./try`
11831                 case "$o_nonblock" in
11832                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11833                 *) echo "Seems like we can use $o_nonblock.";;
11834                 esac
11835         else
11836                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11837         fi
11838         ;;
11839 *) echo "Using $hint value $o_nonblock.";;
11840 esac
11841 $rm -f try try.* .out core
11842
11843 echo " "
11844 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11845 case "$eagain" in
11846 '')
11847         $cat head.c > try.c
11848         $cat >>try.c <<EOCP
11849 #include <errno.h>
11850 #include <sys/types.h>
11851 #include <signal.h>
11852 #include <stdio.h> 
11853 #$i_stdlib I_STDLIB
11854 #ifdef I_STDLIB
11855 #include <stdlib.h>
11856 #endif
11857 #$i_fcntl I_FCNTL
11858 #ifdef I_FCNTL
11859 #include <fcntl.h>
11860 #endif
11861 #define MY_O_NONBLOCK $o_nonblock
11862 #ifndef errno  /* XXX need better Configure test */
11863 extern int errno;
11864 #endif
11865 #$i_unistd I_UNISTD
11866 #ifdef I_UNISTD
11867 #include <unistd.h>
11868 #endif
11869 #$i_string I_STRING
11870 #ifdef I_STRING
11871 #include <string.h>
11872 #else
11873 #include <strings.h>
11874 #endif
11875 $signal_t blech(x) int x; { exit(3); }
11876 EOCP
11877         $cat >> try.c <<'EOCP'
11878 int main()
11879 {
11880         int pd[2];
11881         int pu[2];
11882         char buf[1];
11883         char string[100];
11884
11885         pipe(pd);       /* Down: child -> parent */
11886         pipe(pu);       /* Up: parent -> child */
11887         if (0 != fork()) {
11888                 int ret;
11889                 close(pd[1]);   /* Parent reads from pd[0] */
11890                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11891 #ifdef F_SETFL
11892                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11893                         exit(1);
11894 #else
11895                 exit(4);
11896 #endif
11897                 signal(SIGALRM, blech);
11898                 alarm(5);
11899                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11900                         exit(2);
11901                 sprintf(string, "%d\n", ret);
11902                 write(2, string, strlen(string));
11903                 alarm(0);
11904 #ifdef EAGAIN
11905                 if (errno == EAGAIN) {
11906                         printf("EAGAIN\n");
11907                         goto ok;
11908                 }
11909 #endif
11910 #ifdef EWOULDBLOCK
11911                 if (errno == EWOULDBLOCK)
11912                         printf("EWOULDBLOCK\n");
11913 #endif
11914         ok:
11915                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11916                 sleep(2);                               /* Give it time to close our pipe */
11917                 alarm(5);
11918                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11919                 alarm(0);
11920                 sprintf(string, "%d\n", ret);
11921                 write(4, string, strlen(string));
11922                 exit(0);
11923         }
11924
11925         close(pd[0]);                   /* We write to pd[1] */
11926         close(pu[1]);                   /* We read from pu[0] */
11927         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11928         close(pd[1]);                   /* Pipe pd is now fully closed! */
11929         exit(0);                                /* Bye bye, thank you for playing! */
11930 }
11931 EOCP
11932         set try
11933         if eval $compile_ok; then
11934                 echo "$startsh" >mtry
11935                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11936                 chmod +x mtry
11937                 ./mtry >/dev/null 2>&1
11938                 case $? in
11939                 0) eagain=`$cat try.out`;;
11940                 1) echo "Could not perform non-blocking setting!";;
11941                 2) echo "I did a successful read() for something that was not there!";;
11942                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11943                 4) echo "Could not find F_SETFL!";;
11944                 *) echo "Something terribly wrong happened during testing.";;
11945                 esac
11946                 rd_nodata=`$cat try.ret`
11947                 echo "A read() system call with no data present returns $rd_nodata."
11948                 case "$rd_nodata" in
11949                 0|-1) ;;
11950                 *)
11951                         echo "(That's peculiar, fixing that to be -1.)"
11952                         rd_nodata=-1
11953                         ;;
11954                 esac
11955                 case "$eagain" in
11956                 '')
11957                         echo "Forcing errno EAGAIN on read() with no data available."
11958                         eagain=EAGAIN
11959                         ;;
11960                 *)
11961                         echo "Your read() sets errno to $eagain when no data is available."
11962                         ;;
11963                 esac
11964                 status=`$cat try.err`
11965                 case "$status" in
11966                 0) echo "And it correctly returns 0 to signal EOF.";;
11967                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11968                 *) echo "However, your read() returns '$status' on EOF??";;
11969                 esac
11970                 val="$define"
11971                 if test "$status" = "$rd_nodata"; then
11972                         echo "WARNING: you can't distinguish between EOF and no data!"
11973                         val="$undef"
11974                 fi
11975         else
11976                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11977                 eagain=EAGAIN
11978         fi
11979         set d_eofnblk
11980         eval $setvar
11981         ;;
11982 *)
11983         echo "Using $hint value $eagain."
11984         echo "Your read() returns $rd_nodata when no data is present."
11985         case "$d_eofnblk" in
11986         "$define") echo "And you can see EOF because read() returns 0.";;
11987         "$undef") echo "But you can't see EOF status from read() returned value.";;
11988         *)
11989                 echo "(Assuming you can't see EOF status from read anyway.)"
11990                 d_eofnblk=$undef
11991                 ;;
11992         esac
11993         ;;
11994 esac
11995 $rm -f try try.* .out core head.c mtry
11996
11997 : see if _ptr and _cnt from stdio act std
11998 echo " "
11999
12000 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12001         echo "(Looks like you have stdio.h from BSD.)"
12002         case "$stdio_ptr" in
12003         '') stdio_ptr='((fp)->_p)'
12004                 ptr_lval=$define
12005                 ;;
12006         *)      ptr_lval=$d_stdio_ptr_lval;;
12007         esac
12008         case "$stdio_cnt" in
12009         '') stdio_cnt='((fp)->_r)'
12010                 cnt_lval=$define
12011                 ;;
12012         *)      cnt_lval=$d_stdio_cnt_lval;;
12013         esac
12014         case "$stdio_base" in
12015         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12016         esac
12017         case "$stdio_bufsiz" in
12018         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12019         esac
12020 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12021         echo "(Looks like you have stdio.h from Linux.)"
12022         case "$stdio_ptr" in
12023         '') stdio_ptr='((fp)->_IO_read_ptr)'
12024                 ptr_lval=$define
12025                 ;;
12026         *)      ptr_lval=$d_stdio_ptr_lval;;
12027         esac
12028         case "$stdio_cnt" in
12029         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12030                 cnt_lval=$undef
12031                 ;;
12032         *)      cnt_lval=$d_stdio_cnt_lval;;
12033         esac
12034         case "$stdio_base" in
12035         '') stdio_base='((fp)->_IO_read_base)';;
12036         esac
12037         case "$stdio_bufsiz" in
12038         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12039         esac
12040 else
12041         case "$stdio_ptr" in
12042         '') stdio_ptr='((fp)->_ptr)'
12043                 ptr_lval=$define
12044                 ;;
12045         *)      ptr_lval=$d_stdio_ptr_lval;;
12046         esac
12047         case "$stdio_cnt" in
12048         '') stdio_cnt='((fp)->_cnt)'
12049                 cnt_lval=$define
12050                 ;;
12051         *)      cnt_lval=$d_stdio_cnt_lval;;
12052         esac
12053         case "$stdio_base" in
12054         '') stdio_base='((fp)->_base)';;
12055         esac
12056         case "$stdio_bufsiz" in
12057         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12058         esac
12059 fi
12060
12061 : test whether _ptr and _cnt really work
12062 echo "Checking how std your stdio is..." >&4
12063 $cat >try.c <<EOP
12064 #include <stdio.h>
12065 #$i_stdlib I_STDLIB
12066 #ifdef I_STDLIB
12067 #include <stdlib.h>
12068 #endif
12069 #define FILE_ptr(fp)    $stdio_ptr
12070 #define FILE_cnt(fp)    $stdio_cnt
12071 int main() {
12072         FILE *fp = fopen("try.c", "r");
12073         char c = getc(fp);
12074         if (
12075                 18 <= FILE_cnt(fp) &&
12076                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12077         )
12078                 exit(0);
12079         exit(1);
12080 }
12081 EOP
12082 val="$undef"
12083 set try
12084 if eval $compile && $to try.c; then
12085         if $run ./try; then
12086                 echo "Your stdio acts pretty std."
12087                 val="$define"
12088         else
12089                 echo "Your stdio isn't very std."
12090         fi
12091 else
12092         echo "Your stdio doesn't appear very std."
12093 fi
12094 $rm -f try.c try
12095
12096 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12097 # direct buffer manipulation no longer works.  The Configure tests
12098 # should be changed to correctly detect this, but until then,
12099 # the following check should at least let perl compile and run.
12100 # (This quick fix should be updated before 5.8.1.)
12101 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12102 # A. Dougherty, June 3, 2002.
12103 case "$d_gnulibc" in
12104 $define)
12105         case "$gnulibc_version" in
12106         2.[01]*)  ;;
12107         2.2) ;;
12108         2.2.[0-9]) ;;
12109         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12110                 val="$undef"
12111                 ;;
12112         esac
12113         ;;
12114 esac
12115 set d_stdstdio
12116 eval $setvar
12117
12118 : Can _ptr be used as an lvalue?
12119 case "$d_stdstdio$ptr_lval" in
12120 $define$define) val=$define ;;
12121 *) val=$undef ;;
12122 esac
12123 set d_stdio_ptr_lval
12124 eval $setvar
12125
12126 : Can _cnt be used as an lvalue?
12127 case "$d_stdstdio$cnt_lval" in
12128 $define$define) val=$define ;;
12129 *) val=$undef ;;
12130 esac
12131 set d_stdio_cnt_lval
12132 eval $setvar
12133
12134
12135 : test whether setting _ptr sets _cnt as a side effect
12136 d_stdio_ptr_lval_sets_cnt="$undef"
12137 d_stdio_ptr_lval_nochange_cnt="$undef"
12138 case "$d_stdio_ptr_lval$d_stdstdio" in
12139 $define$define)
12140         echo "Checking to see what happens if we set the stdio ptr..." >&4
12141 $cat >try.c <<EOP
12142 #include <stdio.h>
12143 /* Can we scream? */
12144 /* Eat dust sed :-) */
12145 /* In the buffer space, no one can hear you scream. */
12146 #$i_stdlib I_STDLIB
12147 #ifdef I_STDLIB
12148 #include <stdlib.h>
12149 #endif
12150 #define FILE_ptr(fp)    $stdio_ptr
12151 #define FILE_cnt(fp)    $stdio_cnt
12152 #include <sys/types.h>
12153 int main() {
12154         FILE *fp = fopen("try.c", "r");
12155         int c;
12156         char *ptr;
12157         size_t cnt;
12158         if (!fp) {
12159             puts("Fail even to read");
12160             exit(1);
12161         }
12162         c = getc(fp); /* Read away the first # */
12163         if (c == EOF) {
12164             puts("Fail even to read");
12165             exit(1);
12166         }
12167         if (!(
12168                 18 <= FILE_cnt(fp) &&
12169                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12170         )) {
12171                 puts("Fail even to read");
12172                 exit (1);
12173         }
12174         ptr = (char*) FILE_ptr(fp);
12175         cnt = (size_t)FILE_cnt(fp);
12176
12177         FILE_ptr(fp) += 42;
12178
12179         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12180                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12181                 exit (1);
12182         }
12183         if (FILE_cnt(fp) <= 20) {
12184                 printf ("Fail (<20 chars to test)");
12185                 exit (1);
12186         }
12187         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12188                 puts("Fail compare");
12189                 exit (1);
12190         }
12191         if (cnt == FILE_cnt(fp)) {
12192                 puts("Pass_unchanged");
12193                 exit (0);
12194         }       
12195         if (FILE_cnt(fp) == (cnt - 42)) {
12196                 puts("Pass_changed");
12197                 exit (0);
12198         }
12199         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12200         return 1;
12201
12202 }
12203 EOP
12204         set try
12205         if eval $compile && $to try.c; then
12206                 case `$run ./try` in
12207                 Pass_changed)
12208                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12209                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12210                 Pass_unchanged)
12211                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12212                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12213                 Fail*)
12214                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12215                 *)
12216                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12217         esac
12218         else
12219                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12220         fi
12221         $rm -f try.c try
12222         ;;
12223 esac
12224
12225 : see if _base is also standard
12226 val="$undef"
12227 case "$d_stdstdio" in
12228 $define)
12229         $cat >try.c <<EOP
12230 #include <stdio.h>
12231 #$i_stdlib I_STDLIB
12232 #ifdef I_STDLIB
12233 #include <stdlib.h>
12234 #endif
12235 #define FILE_base(fp)   $stdio_base
12236 #define FILE_bufsiz(fp) $stdio_bufsiz
12237 int main() {
12238         FILE *fp = fopen("try.c", "r");
12239         char c = getc(fp);
12240         if (
12241                 19 <= FILE_bufsiz(fp) &&
12242                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12243         )
12244                 exit(0);
12245         exit(1);
12246 }
12247 EOP
12248         set try
12249         if eval $compile && $to try.c; then
12250                 if $run ./try; then
12251                         echo "And its _base field acts std."
12252                         val="$define"
12253                 else
12254                         echo "But its _base field isn't std."
12255                 fi
12256         else
12257                 echo "However, it seems to be lacking the _base field."
12258         fi
12259         $rm -f try.c try
12260         ;;
12261 esac
12262 set d_stdiobase
12263 eval $setvar
12264
12265 : see if fast_stdio exists
12266 val="$undef"
12267 case "$d_stdstdio:$d_stdio_ptr_lval" in
12268 "$define:$define")
12269         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12270         *$define*)
12271                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12272                 val="$define"
12273                 ;;
12274         esac
12275         ;;
12276 esac
12277 set d_faststdio
12278 eval $setvar
12279
12280
12281
12282 : see if fchdir exists
12283 set fchdir d_fchdir
12284 eval $inlibc
12285
12286 : see if fchmod exists
12287 set fchmod d_fchmod
12288 eval $inlibc
12289
12290 : see if fchown exists
12291 set fchown d_fchown
12292 eval $inlibc
12293
12294 : see if this is an fcntl system
12295 set fcntl d_fcntl
12296 eval $inlibc
12297
12298 echo " "
12299 : See if fcntl-based locking works.
12300 $cat >try.c <<EOCP
12301 #$i_stdlib I_STDLIB
12302 #ifdef I_STDLIB
12303 #include <stdlib.h>
12304 #endif
12305 #include <unistd.h>
12306 #include <fcntl.h>
12307 #include <signal.h>
12308 $signal_t blech(x) int x; { exit(3); }
12309 int main() {
12310 #if defined(F_SETLK) && defined(F_SETLKW)
12311      struct flock flock;
12312      int retval, fd;
12313      fd = open("try.c", O_RDONLY);
12314      flock.l_type = F_RDLCK;
12315      flock.l_whence = SEEK_SET;
12316      flock.l_start = flock.l_len = 0;
12317      signal(SIGALRM, blech);
12318      alarm(10);
12319      retval = fcntl(fd, F_SETLK, &flock);
12320      close(fd);
12321      (retval < 0 ? exit(2) : exit(0));
12322 #else
12323      exit(2);
12324 #endif
12325 }
12326 EOCP
12327 echo "Checking if fcntl-based file locking works... "
12328 case "$d_fcntl" in
12329 "$define")
12330         set try
12331         if eval $compile_ok; then
12332                 if $run ./try; then
12333                         echo "Yes, it seems to work."
12334                         val="$define"
12335                 else
12336                         echo "Nope, it didn't work."
12337                         val="$undef"
12338                         case "$?" in
12339                         3) $cat >&4 <<EOM
12340 ***
12341 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12342 *** This is (almost) impossible.
12343 *** If your NFS lock daemons are not feeling well, something like
12344 *** this may happen, please investigate.  Cannot continue, aborting.
12345 ***
12346 EOM
12347                                 exit 1
12348                                 ;;
12349                         esac
12350                 fi
12351         else
12352                 echo "I'm unable to compile the test program, so I'll assume not."
12353                 val="$undef"
12354         fi
12355         ;;
12356 *) val="$undef";
12357         echo "Nope, since you don't even have fcntl()."
12358         ;;
12359 esac
12360 set d_fcntl_can_lock
12361 eval $setvar
12362 $rm -f try*
12363
12364
12365 : check for fd_set items
12366 $cat <<EOM
12367
12368 Checking to see how well your C compiler handles fd_set and friends ...
12369 EOM
12370 $cat >try.c <<EOCP
12371 #$i_stdlib I_STDLIB
12372 #ifdef I_STDLIB
12373 #include <stdlib.h>
12374 #endif
12375 #$i_systime I_SYS_TIME
12376 #$i_sysselct I_SYS_SELECT
12377 #$d_socket HAS_SOCKET
12378 #include <sys/types.h>
12379 #ifdef HAS_SOCKET
12380 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12381 #endif
12382 #ifdef I_SYS_TIME
12383 #include <sys/time.h>
12384 #endif
12385 #ifdef I_SYS_SELECT
12386 #include <sys/select.h>
12387 #endif
12388 int main() {
12389         fd_set fds;
12390
12391 #ifdef TRYBITS
12392         if(fds.fds_bits);
12393 #endif
12394
12395 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12396         exit(0);
12397 #else
12398         exit(1);
12399 #endif
12400 }
12401 EOCP
12402 set try -DTRYBITS
12403 if eval $compile; then
12404         d_fds_bits="$define"
12405         d_fd_set="$define"
12406         echo "Well, your system knows about the normal fd_set typedef..." >&4
12407         if $run ./try; then
12408                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12409                 d_fd_macros="$define"
12410         else
12411                 $cat >&4 <<'EOM'
12412 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12413 EOM
12414                 d_fd_macros="$undef"
12415         fi
12416 else
12417         $cat <<'EOM'
12418 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12419 EOM
12420         set try
12421         if eval $compile; then
12422                 d_fds_bits="$undef"
12423                 d_fd_set="$define"
12424                 echo "Well, your system has some sort of fd_set available..." >&4
12425                 if $run ./try; then
12426                         echo "and you have the normal fd_set macros." >&4
12427                         d_fd_macros="$define"
12428                 else
12429                         $cat <<'EOM'
12430 but not the normal fd_set macros!  Gross!  More work for me...
12431 EOM
12432                         d_fd_macros="$undef"
12433                 fi
12434         else
12435         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12436                 d_fd_set="$undef"
12437                 d_fds_bits="$undef"
12438                 d_fd_macros="$undef"
12439         fi
12440 fi
12441 $rm -f try try.*
12442
12443 : see if fgetpos exists
12444 set fgetpos d_fgetpos
12445 eval $inlibc
12446
12447 : see if finite exists
12448 set finite d_finite
12449 eval $inlibc
12450
12451 : see if finitel exists
12452 set finitel d_finitel
12453 eval $inlibc
12454
12455 : see if flock exists
12456 set flock d_flock
12457 eval $inlibc
12458
12459 : see if prototype for flock is available
12460 echo " "
12461 set d_flockproto flock $i_sysfile sys/file.h
12462 eval $hasproto
12463
12464 : see if fork exists
12465 set fork d_fork
12466 eval $inlibc
12467
12468 : see if fp_class exists
12469 set fp_class d_fp_class
12470 eval $inlibc
12471
12472 : see if pathconf exists
12473 set pathconf d_pathconf
12474 eval $inlibc
12475
12476 : see if fpathconf exists
12477 set fpathconf d_fpathconf
12478 eval $inlibc
12479
12480 : see if fpclass exists
12481 set fpclass d_fpclass
12482 eval $inlibc
12483
12484 : see if fpclassify exists
12485 set fpclassify d_fpclassify
12486 eval $inlibc
12487
12488 : see if fpclassl exists
12489 set fpclassl d_fpclassl
12490 eval $inlibc
12491
12492
12493 : check for fpos64_t
12494 echo " "
12495 echo "Checking to see if you have fpos64_t..." >&4
12496 $cat >try.c <<EOCP
12497 #include <stdio.h>
12498 int main() { fpos64_t x = 7; }
12499 EOCP
12500 set try
12501 if eval $compile; then
12502         val="$define"
12503         echo "You have fpos64_t."
12504 else
12505         val="$undef"
12506         echo "You do not have fpos64_t."
12507         case "$fpossize" in
12508         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12509         esac
12510 fi
12511 $rm -f try.* try
12512 set d_fpos64_t
12513 eval $setvar
12514
12515 : see if frexpl exists
12516 set frexpl d_frexpl
12517 eval $inlibc
12518
12519 : see if this is a sys/param system
12520 set sys/param.h i_sysparam
12521 eval $inhdr
12522
12523 : see if this is a sys/mount.h system
12524 set sys/mount.h i_sysmount
12525 eval $inhdr
12526
12527
12528 echo " "
12529 echo "Checking to see if your system supports struct fs_data..." >&4
12530 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12531 eval $hasstruct
12532 case "$d_fs_data_s" in
12533 "$define")      echo "Yes, it does."   ;;
12534 *)              echo "No, it doesn't." ;;
12535 esac
12536
12537 : see if fseeko exists
12538 set fseeko d_fseeko
12539 eval $inlibc
12540 case "$longsize" in
12541 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12542 esac
12543
12544 : see if fsetpos exists
12545 set fsetpos d_fsetpos
12546 eval $inlibc
12547
12548
12549 : see if fstatfs exists
12550 set fstatfs d_fstatfs
12551 eval $inlibc
12552
12553
12554 : see if statvfs exists
12555 set statvfs d_statvfs
12556 eval $inlibc
12557
12558 : see if fstatvfs exists
12559 set fstatvfs d_fstatvfs
12560 eval $inlibc
12561
12562
12563 : see if fsync exists
12564 set fsync d_fsync
12565 eval $inlibc
12566
12567 : see if ftello exists
12568 set ftello d_ftello
12569 eval $inlibc
12570 case "$longsize" in
12571 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12572 esac
12573
12574 d_futimes="$undef"
12575 : check for a working futimes
12576 echo " "
12577 echo "Checking for a working futimes()" >&4
12578 $cat >try.c <<EOCP
12579 #include <stdio.h>
12580 #include <sys/time.h>
12581 #include <errno.h>
12582 #include <fcntl.h>
12583
12584 int main ()
12585 {
12586     int fd, rv;
12587     fd = open ("try.c", O_RDWR);
12588     if (-1 == fd) exit (1);
12589     rv = futimes (fd, NULL);
12590     exit (rv == -1 ? errno : 0);
12591 }
12592 EOCP
12593 set try
12594 if eval $compile; then
12595     `$run ./try`
12596     rc=$?
12597     case "$rc" in
12598         0)  echo "Yes, it does" >&4
12599             d_futimes="$define"
12600             ;;
12601         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12602             ;;
12603     esac
12604 else
12605     echo "No, it does not (probably harmless)\n" >&4
12606 fi
12607 $rm -f try.* try core core.try.*
12608
12609 : see if getcwd exists
12610 set getcwd d_getcwd
12611 eval $inlibc
12612
12613 : see if getespwnam exists
12614 set getespwnam d_getespwnam
12615 eval $inlibc
12616
12617
12618 : see if getfsstat exists
12619 set getfsstat d_getfsstat
12620 eval $inlibc
12621
12622 : see if getgrent exists
12623 set getgrent d_getgrent
12624 eval $inlibc
12625
12626 : see if getgrent_r exists
12627 set getgrent_r d_getgrent_r
12628 eval $inlibc
12629 case "$d_getgrent_r" in
12630 "$define")
12631         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12632         case "$d_getgrent_r_proto:$usethreads" in
12633         ":define")      d_getgrent_r_proto=define
12634                 set d_getgrent_r_proto getgrent_r $hdrs
12635                 eval $hasproto ;;
12636         *)      ;;
12637         esac
12638         case "$d_getgrent_r_proto" in
12639         define)
12640         case "$getgrent_r_proto" in
12641         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12642         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12643         esac
12644         case "$getgrent_r_proto" in
12645         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12646         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12647         esac
12648         case "$getgrent_r_proto" in
12649         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12650         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12651         esac
12652         case "$getgrent_r_proto" in
12653         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12654         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12655         esac
12656         case "$getgrent_r_proto" in
12657         ''|0) try='int getgrent_r(struct group*, char*, int);'
12658         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12659         esac
12660         case "$getgrent_r_proto" in
12661         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12662         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12663         esac
12664         case "$getgrent_r_proto" in
12665         ''|0)   d_getgrent_r=undef
12666                 getgrent_r_proto=0
12667                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12668         * )     case "$getgrent_r_proto" in
12669                 REENTRANT_PROTO*) ;;
12670                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12671                 esac
12672                 echo "Prototype: $try" ;;
12673         esac
12674         ;;
12675         *)      case "$usethreads" in
12676                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12677                 esac
12678                 d_getgrent_r=undef
12679                 getgrent_r_proto=0
12680                 ;;
12681         esac
12682         ;;
12683 *)      getgrent_r_proto=0
12684         ;;
12685 esac
12686
12687 : see if getgrgid_r exists
12688 set getgrgid_r d_getgrgid_r
12689 eval $inlibc
12690 case "$d_getgrgid_r" in
12691 "$define")
12692         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12693         case "$d_getgrgid_r_proto:$usethreads" in
12694         ":define")      d_getgrgid_r_proto=define
12695                 set d_getgrgid_r_proto getgrgid_r $hdrs
12696                 eval $hasproto ;;
12697         *)      ;;
12698         esac
12699         case "$d_getgrgid_r_proto" in
12700         define)
12701         case "$getgrgid_r_proto" in
12702         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12703         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12704         esac
12705         case "$getgrgid_r_proto" in
12706         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12707         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12708         esac
12709         case "$getgrgid_r_proto" in
12710         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12711         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12712         esac
12713         case "$getgrgid_r_proto" in
12714         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12715         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12716         esac
12717         case "$getgrgid_r_proto" in
12718         ''|0)   d_getgrgid_r=undef
12719                 getgrgid_r_proto=0
12720                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12721         * )     case "$getgrgid_r_proto" in
12722                 REENTRANT_PROTO*) ;;
12723                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12724                 esac
12725                 echo "Prototype: $try" ;;
12726         esac
12727         ;;
12728         *)      case "$usethreads" in
12729                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12730                 esac
12731                 d_getgrgid_r=undef
12732                 getgrgid_r_proto=0
12733                 ;;
12734         esac
12735         ;;
12736 *)      getgrgid_r_proto=0
12737         ;;
12738 esac
12739
12740 : see if getgrnam_r exists
12741 set getgrnam_r d_getgrnam_r
12742 eval $inlibc
12743 case "$d_getgrnam_r" in
12744 "$define")
12745         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12746         case "$d_getgrnam_r_proto:$usethreads" in
12747         ":define")      d_getgrnam_r_proto=define
12748                 set d_getgrnam_r_proto getgrnam_r $hdrs
12749                 eval $hasproto ;;
12750         *)      ;;
12751         esac
12752         case "$d_getgrnam_r_proto" in
12753         define)
12754         case "$getgrnam_r_proto" in
12755         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12756         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12757         esac
12758         case "$getgrnam_r_proto" in
12759         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12760         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12761         esac
12762         case "$getgrnam_r_proto" in
12763         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12764         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12765         esac
12766         case "$getgrnam_r_proto" in
12767         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12768         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12769         esac
12770         case "$getgrnam_r_proto" in
12771         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12772         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12773         esac
12774         case "$getgrnam_r_proto" in
12775         ''|0)   d_getgrnam_r=undef
12776                 getgrnam_r_proto=0
12777                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12778         * )     case "$getgrnam_r_proto" in
12779                 REENTRANT_PROTO*) ;;
12780                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12781                 esac
12782                 echo "Prototype: $try" ;;
12783         esac
12784         ;;
12785         *)      case "$usethreads" in
12786                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12787                 esac
12788                 d_getgrnam_r=undef
12789                 getgrnam_r_proto=0
12790                 ;;
12791         esac
12792         ;;
12793 *)      getgrnam_r_proto=0
12794         ;;
12795 esac
12796
12797 : see if gethostbyaddr exists
12798 set gethostbyaddr d_gethbyaddr
12799 eval $inlibc
12800
12801 : see if gethostbyname exists
12802 set gethostbyname d_gethbyname
12803 eval $inlibc
12804
12805 : see if gethostent exists
12806 set gethostent d_gethent
12807 eval $inlibc
12808
12809 : see how we will look up host name
12810 echo " "
12811 call=''
12812 if set gethostname val -f d_gethname; eval $csym; $val; then
12813         echo 'gethostname() found.' >&4
12814         d_gethname="$define"
12815         call=gethostname
12816 fi
12817 if set uname val -f d_uname; eval $csym; $val; then
12818         if ./xenix; then
12819                 $cat <<'EOM'
12820 uname() was found, but you're running xenix, and older versions of xenix
12821 have a broken uname(). If you don't really know whether your xenix is old
12822 enough to have a broken system call, use the default answer.
12823
12824 EOM
12825                 dflt=y
12826                 case "$d_uname" in
12827                 "$define") dflt=n;;
12828                 esac
12829                 rp='Is your uname() broken?'
12830                 . ./myread
12831                 case "$ans" in
12832                 n*) d_uname="$define"; call=uname;;
12833                 esac
12834         else
12835                 echo 'uname() found.' >&4
12836                 d_uname="$define"
12837                 case "$call" in
12838                 '') call=uname ;;
12839                 esac
12840         fi
12841 fi
12842 case "$d_gethname" in
12843 '') d_gethname="$undef";;
12844 esac
12845 case "$d_uname" in
12846 '') d_uname="$undef";;
12847 esac
12848 case "$d_uname$d_gethname" in
12849 *define*)
12850         dflt=n
12851         cat <<EOM
12852  
12853 Every now and then someone has a $call() that lies about the hostname
12854 but can't be fixed for political or economic reasons.  If you wish, I can
12855 pretend $call() isn't there and maybe compute hostname at run-time
12856 thanks to the '$phostname' command.
12857
12858 EOM
12859         rp="Shall I ignore $call() from now on?"
12860         . ./myread
12861         case "$ans" in
12862         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12863         esac;;
12864 esac
12865 case "$phostname" in
12866 '') aphostname='';;
12867 *) case "$aphostname" in
12868         /*) ;;
12869         *) set X $phostname
12870                 shift
12871                 file=$1
12872                 shift
12873                 file=`./loc $file $file $pth`
12874                 aphostname=`echo $file $*`
12875                 ;;
12876         esac
12877         ;;
12878 esac
12879 case "$d_uname$d_gethname" in
12880 *define*) ;;
12881 *)
12882         case "$phostname" in
12883         '')
12884                 echo "There will be no way for $package to get your hostname." >&4;;
12885         *)
12886         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12887                 ;;
12888         esac;;
12889 esac
12890 case "$d_phostname" in
12891 '') d_phostname="$undef";;
12892 esac
12893
12894 : see if gethostbyaddr_r exists
12895 set gethostbyaddr_r d_gethostbyaddr_r
12896 eval $inlibc
12897 case "$d_gethostbyaddr_r" in
12898 "$define")
12899         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12900         case "$d_gethostbyaddr_r_proto:$usethreads" in
12901         ":define")      d_gethostbyaddr_r_proto=define
12902                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12903                 eval $hasproto ;;
12904         *)      ;;
12905         esac
12906         case "$d_gethostbyaddr_r_proto" in
12907         define)
12908         case "$gethostbyaddr_r_proto" in
12909         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12910         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12911         esac
12912         case "$gethostbyaddr_r_proto" in
12913         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12914         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12915         esac
12916         case "$gethostbyaddr_r_proto" in
12917         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12918         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12919         esac
12920         case "$gethostbyaddr_r_proto" in
12921         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12922         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12923         esac
12924         case "$gethostbyaddr_r_proto" in
12925         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12926         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12927         esac
12928         case "$gethostbyaddr_r_proto" in
12929         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12930         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12931         esac
12932         case "$gethostbyaddr_r_proto" in
12933         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12934         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12935         esac
12936         case "$gethostbyaddr_r_proto" in
12937         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12938         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12939         esac
12940         case "$gethostbyaddr_r_proto" in
12941         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12942         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12943         esac
12944         case "$gethostbyaddr_r_proto" in
12945         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12946         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12947         esac
12948         case "$gethostbyaddr_r_proto" in
12949         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12950         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12951         esac
12952         case "$gethostbyaddr_r_proto" in
12953         ''|0)   d_gethostbyaddr_r=undef
12954                 gethostbyaddr_r_proto=0
12955                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12956         * )     case "$gethostbyaddr_r_proto" in
12957                 REENTRANT_PROTO*) ;;
12958                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12959                 esac
12960                 echo "Prototype: $try" ;;
12961         esac
12962         ;;
12963         *)      case "$usethreads" in
12964                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12965                 esac
12966                 d_gethostbyaddr_r=undef
12967                 gethostbyaddr_r_proto=0
12968                 ;;
12969         esac
12970         ;;
12971 *)      gethostbyaddr_r_proto=0
12972         ;;
12973 esac
12974
12975 : see if gethostbyname_r exists
12976 set gethostbyname_r d_gethostbyname_r
12977 eval $inlibc
12978 case "$d_gethostbyname_r" in
12979 "$define")
12980         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12981         case "$d_gethostbyname_r_proto:$usethreads" in
12982         ":define")      d_gethostbyname_r_proto=define
12983                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12984                 eval $hasproto ;;
12985         *)      ;;
12986         esac
12987         case "$d_gethostbyname_r_proto" in
12988         define)
12989         case "$gethostbyname_r_proto" in
12990         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12991         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12992         esac
12993         case "$gethostbyname_r_proto" in
12994         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12995         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12996         esac
12997         case "$gethostbyname_r_proto" in
12998         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12999         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13000         esac
13001         case "$gethostbyname_r_proto" in
13002         ''|0)   d_gethostbyname_r=undef
13003                 gethostbyname_r_proto=0
13004                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13005         * )     case "$gethostbyname_r_proto" in
13006                 REENTRANT_PROTO*) ;;
13007                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13008                 esac
13009                 echo "Prototype: $try" ;;
13010         esac
13011         ;;
13012         *)      case "$usethreads" in
13013                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13014                 esac
13015                 d_gethostbyname_r=undef
13016                 gethostbyname_r_proto=0
13017                 ;;
13018         esac
13019         ;;
13020 *)      gethostbyname_r_proto=0
13021         ;;
13022 esac
13023
13024 : see if gethostent_r exists
13025 set gethostent_r d_gethostent_r
13026 eval $inlibc
13027 case "$d_gethostent_r" in
13028 "$define")
13029         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13030         case "$d_gethostent_r_proto:$usethreads" in
13031         ":define")      d_gethostent_r_proto=define
13032                 set d_gethostent_r_proto gethostent_r $hdrs
13033                 eval $hasproto ;;
13034         *)      ;;
13035         esac
13036         case "$d_gethostent_r_proto" in
13037         define)
13038         case "$gethostent_r_proto" in
13039         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13040         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13041         esac
13042         case "$gethostent_r_proto" in
13043         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13044         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13045         esac
13046         case "$gethostent_r_proto" in
13047         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13048         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13049         esac
13050         case "$gethostent_r_proto" in
13051         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13052         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13053         esac
13054         case "$gethostent_r_proto" in
13055         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13056         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13057         esac
13058         case "$gethostent_r_proto" in
13059         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13060         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13061         esac
13062         case "$gethostent_r_proto" in
13063         ''|0)   d_gethostent_r=undef
13064                 gethostent_r_proto=0
13065                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13066         * )     case "$gethostent_r_proto" in
13067                 REENTRANT_PROTO*) ;;
13068                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13069                 esac
13070                 echo "Prototype: $try" ;;
13071         esac
13072         ;;
13073         *)      case "$usethreads" in
13074                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13075                 esac
13076                 d_gethostent_r=undef
13077                 gethostent_r_proto=0
13078                 ;;
13079         esac
13080         ;;
13081 *)      gethostent_r_proto=0
13082         ;;
13083 esac
13084
13085 : see if prototypes for various gethostxxx netdb.h functions are available
13086 echo " "
13087 set d_gethostprotos gethostent $i_netdb netdb.h
13088 eval $hasproto
13089
13090 : see if getitimer exists
13091 set getitimer d_getitimer
13092 eval $inlibc
13093
13094 : see if getlogin exists
13095 set getlogin d_getlogin
13096 eval $inlibc
13097
13098 : see if getlogin_r exists
13099 set getlogin_r d_getlogin_r
13100 eval $inlibc
13101 case "$d_getlogin_r" in
13102 "$define")
13103         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13104         case "$d_getlogin_r_proto:$usethreads" in
13105         ":define")      d_getlogin_r_proto=define
13106                 set d_getlogin_r_proto getlogin_r $hdrs
13107                 eval $hasproto ;;
13108         *)      ;;
13109         esac
13110         case "$d_getlogin_r_proto" in
13111         define)
13112         case "$getlogin_r_proto" in
13113         ''|0) try='int getlogin_r(char*, size_t);'
13114         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13115         esac
13116         case "$getlogin_r_proto" in
13117         ''|0) try='int getlogin_r(char*, int);'
13118         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13119         esac
13120         case "$getlogin_r_proto" in
13121         ''|0) try='char* getlogin_r(char*, size_t);'
13122         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13123         esac
13124         case "$getlogin_r_proto" in
13125         ''|0) try='char* getlogin_r(char*, int);'
13126         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13127         esac
13128         case "$getlogin_r_proto" in
13129         ''|0)   d_getlogin_r=undef
13130                 getlogin_r_proto=0
13131                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13132         * )     case "$getlogin_r_proto" in
13133                 REENTRANT_PROTO*) ;;
13134                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13135                 esac
13136                 echo "Prototype: $try" ;;
13137         esac
13138         ;;
13139         *)      case "$usethreads" in
13140                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13141                 esac
13142                 d_getlogin_r=undef
13143                 getlogin_r_proto=0
13144                 ;;
13145         esac
13146         ;;
13147 *)      getlogin_r_proto=0
13148         ;;
13149 esac
13150
13151 : see if getmnt exists
13152 set getmnt d_getmnt
13153 eval $inlibc
13154
13155 : see if getmntent exists
13156 set getmntent d_getmntent
13157 eval $inlibc
13158
13159 : see if getnetbyaddr exists
13160 set getnetbyaddr d_getnbyaddr
13161 eval $inlibc
13162
13163 : see if getnetbyname exists
13164 set getnetbyname d_getnbyname
13165 eval $inlibc
13166
13167 : see if getnetent exists
13168 set getnetent d_getnent
13169 eval $inlibc
13170
13171 : see if getnetbyaddr_r exists
13172 set getnetbyaddr_r d_getnetbyaddr_r
13173 eval $inlibc
13174 case "$d_getnetbyaddr_r" in
13175 "$define")
13176         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13177         case "$d_getnetbyaddr_r_proto:$usethreads" in
13178         ":define")      d_getnetbyaddr_r_proto=define
13179                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13180                 eval $hasproto ;;
13181         *)      ;;
13182         esac
13183         case "$d_getnetbyaddr_r_proto" in
13184         define)
13185         case "$getnetbyaddr_r_proto" in
13186         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13187         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13188         esac
13189         case "$getnetbyaddr_r_proto" in
13190         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13191         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13192         esac
13193         case "$getnetbyaddr_r_proto" in
13194         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13195         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13196         esac
13197         case "$getnetbyaddr_r_proto" in
13198         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13199         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13200         esac
13201         case "$getnetbyaddr_r_proto" in
13202         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13203         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13204         esac
13205         case "$getnetbyaddr_r_proto" in
13206         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13207         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13208         esac
13209         case "$getnetbyaddr_r_proto" in
13210         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13211         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13212         esac
13213         case "$getnetbyaddr_r_proto" in
13214         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13215         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13216         esac
13217         case "$getnetbyaddr_r_proto" in
13218         ''|0)   d_getnetbyaddr_r=undef
13219                 getnetbyaddr_r_proto=0
13220                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13221         * )     case "$getnetbyaddr_r_proto" in
13222                 REENTRANT_PROTO*) ;;
13223                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13224                 esac
13225                 echo "Prototype: $try" ;;
13226         esac
13227         ;;
13228         *)      case "$usethreads" in
13229                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13230                 esac
13231                 d_getnetbyaddr_r=undef
13232                 getnetbyaddr_r_proto=0
13233                 ;;
13234         esac
13235         ;;
13236 *)      getnetbyaddr_r_proto=0
13237         ;;
13238 esac
13239
13240 : see if getnetbyname_r exists
13241 set getnetbyname_r d_getnetbyname_r
13242 eval $inlibc
13243 case "$d_getnetbyname_r" in
13244 "$define")
13245         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13246         case "$d_getnetbyname_r_proto:$usethreads" in
13247         ":define")      d_getnetbyname_r_proto=define
13248                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13249                 eval $hasproto ;;
13250         *)      ;;
13251         esac
13252         case "$d_getnetbyname_r_proto" in
13253         define)
13254         case "$getnetbyname_r_proto" in
13255         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13256         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13257         esac
13258         case "$getnetbyname_r_proto" in
13259         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13260         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13261         esac
13262         case "$getnetbyname_r_proto" in
13263         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13264         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13265         esac
13266         case "$getnetbyname_r_proto" in
13267         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13268         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13269         esac
13270         case "$getnetbyname_r_proto" in
13271         ''|0)   d_getnetbyname_r=undef
13272                 getnetbyname_r_proto=0
13273                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13274         * )     case "$getnetbyname_r_proto" in
13275                 REENTRANT_PROTO*) ;;
13276                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13277                 esac
13278                 echo "Prototype: $try" ;;
13279         esac
13280         ;;
13281         *)      case "$usethreads" in
13282                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13283                 esac
13284                 d_getnetbyname_r=undef
13285                 getnetbyname_r_proto=0
13286                 ;;
13287         esac
13288         ;;
13289 *)      getnetbyname_r_proto=0
13290         ;;
13291 esac
13292
13293 : see if getnetent_r exists
13294 set getnetent_r d_getnetent_r
13295 eval $inlibc
13296 case "$d_getnetent_r" in
13297 "$define")
13298         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13299         case "$d_getnetent_r_proto:$usethreads" in
13300         ":define")      d_getnetent_r_proto=define
13301                 set d_getnetent_r_proto getnetent_r $hdrs
13302                 eval $hasproto ;;
13303         *)      ;;
13304         esac
13305         case "$d_getnetent_r_proto" in
13306         define)
13307         case "$getnetent_r_proto" in
13308         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13309         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13310         esac
13311         case "$getnetent_r_proto" in
13312         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13313         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13314         esac
13315         case "$getnetent_r_proto" in
13316         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13317         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13318         esac
13319         case "$getnetent_r_proto" in
13320         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13321         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13322         esac
13323         case "$getnetent_r_proto" in
13324         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13325         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13326         esac
13327         case "$getnetent_r_proto" in
13328         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13329         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13330         esac
13331         case "$getnetent_r_proto" in
13332         ''|0)   d_getnetent_r=undef
13333                 getnetent_r_proto=0
13334                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13335         * )     case "$getnetent_r_proto" in
13336                 REENTRANT_PROTO*) ;;
13337                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13338                 esac
13339                 echo "Prototype: $try" ;;
13340         esac
13341         ;;
13342         *)      case "$usethreads" in
13343                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13344                 esac
13345                 d_getnetent_r=undef
13346                 getnetent_r_proto=0
13347                 ;;
13348         esac
13349         ;;
13350 *)      getnetent_r_proto=0
13351         ;;
13352 esac
13353
13354 : see if prototypes for various getnetxxx netdb.h functions are available
13355 echo " "
13356 set d_getnetprotos getnetent $i_netdb netdb.h
13357 eval $hasproto
13358
13359 : see if getpagesize exists
13360 set getpagesize d_getpagsz
13361 eval $inlibc
13362
13363
13364 : see if getprotobyname exists
13365 set getprotobyname d_getpbyname
13366 eval $inlibc
13367
13368 : see if getprotobynumber exists
13369 set getprotobynumber d_getpbynumber
13370 eval $inlibc
13371
13372 : see if getprotoent exists
13373 set getprotoent d_getpent
13374 eval $inlibc
13375
13376 : see if getpgid exists
13377 set getpgid d_getpgid
13378 eval $inlibc
13379
13380 : see if getpgrp2 exists
13381 set getpgrp2 d_getpgrp2
13382 eval $inlibc
13383
13384 : see if getppid exists
13385 set getppid d_getppid
13386 eval $inlibc
13387
13388 : see if getpriority exists
13389 set getpriority d_getprior
13390 eval $inlibc
13391
13392 : see if getprotobyname_r exists
13393 set getprotobyname_r d_getprotobyname_r
13394 eval $inlibc
13395 case "$d_getprotobyname_r" in
13396 "$define")
13397         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13398         case "$d_getprotobyname_r_proto:$usethreads" in
13399         ":define")      d_getprotobyname_r_proto=define
13400                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13401                 eval $hasproto ;;
13402         *)      ;;
13403         esac
13404         case "$d_getprotobyname_r_proto" in
13405         define)
13406         case "$getprotobyname_r_proto" in
13407         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13408         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13409         esac
13410         case "$getprotobyname_r_proto" in
13411         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13412         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13413         esac
13414         case "$getprotobyname_r_proto" in
13415         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13416         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13417         esac
13418         case "$getprotobyname_r_proto" in
13419         ''|0)   d_getprotobyname_r=undef
13420                 getprotobyname_r_proto=0
13421                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13422         * )     case "$getprotobyname_r_proto" in
13423                 REENTRANT_PROTO*) ;;
13424                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13425                 esac
13426                 echo "Prototype: $try" ;;
13427         esac
13428         ;;
13429         *)      case "$usethreads" in
13430                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13431                 esac
13432                 d_getprotobyname_r=undef
13433                 getprotobyname_r_proto=0
13434                 ;;
13435         esac
13436         ;;
13437 *)      getprotobyname_r_proto=0
13438         ;;
13439 esac
13440
13441 : see if getprotobynumber_r exists
13442 set getprotobynumber_r d_getprotobynumber_r
13443 eval $inlibc
13444 case "$d_getprotobynumber_r" in
13445 "$define")
13446         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13447         case "$d_getprotobynumber_r_proto:$usethreads" in
13448         ":define")      d_getprotobynumber_r_proto=define
13449                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13450                 eval $hasproto ;;
13451         *)      ;;
13452         esac
13453         case "$d_getprotobynumber_r_proto" in
13454         define)
13455         case "$getprotobynumber_r_proto" in
13456         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13457         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13458         esac
13459         case "$getprotobynumber_r_proto" in
13460         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13461         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13462         esac
13463         case "$getprotobynumber_r_proto" in
13464         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13465         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13466         esac
13467         case "$getprotobynumber_r_proto" in
13468         ''|0)   d_getprotobynumber_r=undef
13469                 getprotobynumber_r_proto=0
13470                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13471         * )     case "$getprotobynumber_r_proto" in
13472                 REENTRANT_PROTO*) ;;
13473                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13474                 esac
13475                 echo "Prototype: $try" ;;
13476         esac
13477         ;;
13478         *)      case "$usethreads" in
13479                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13480                 esac
13481                 d_getprotobynumber_r=undef
13482                 getprotobynumber_r_proto=0
13483                 ;;
13484         esac
13485         ;;
13486 *)      getprotobynumber_r_proto=0
13487         ;;
13488 esac
13489
13490 : see if getprotoent_r exists
13491 set getprotoent_r d_getprotoent_r
13492 eval $inlibc
13493 case "$d_getprotoent_r" in
13494 "$define")
13495         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13496         case "$d_getprotoent_r_proto:$usethreads" in
13497         ":define")      d_getprotoent_r_proto=define
13498                 set d_getprotoent_r_proto getprotoent_r $hdrs
13499                 eval $hasproto ;;
13500         *)      ;;
13501         esac
13502         case "$d_getprotoent_r_proto" in
13503         define)
13504         case "$getprotoent_r_proto" in
13505         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13506         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13507         esac
13508         case "$getprotoent_r_proto" in
13509         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13510         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13511         esac
13512         case "$getprotoent_r_proto" in
13513         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13514         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13515         esac
13516         case "$getprotoent_r_proto" in
13517         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13518         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13519         esac
13520         case "$getprotoent_r_proto" in
13521         ''|0)   d_getprotoent_r=undef
13522                 getprotoent_r_proto=0
13523                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13524         * )     case "$getprotoent_r_proto" in
13525                 REENTRANT_PROTO*) ;;
13526                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13527                 esac
13528                 echo "Prototype: $try" ;;
13529         esac
13530         ;;
13531         *)      case "$usethreads" in
13532                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13533                 esac
13534                 d_getprotoent_r=undef
13535                 getprotoent_r_proto=0
13536                 ;;
13537         esac
13538         ;;
13539 *)      getprotoent_r_proto=0
13540         ;;
13541 esac
13542
13543 : see if prototypes for various getprotoxxx netdb.h functions are available
13544 echo " "
13545 set d_getprotoprotos getprotoent $i_netdb netdb.h
13546 eval $hasproto
13547
13548 : see if getprpwnam exists
13549 set getprpwnam d_getprpwnam
13550 eval $inlibc
13551
13552 : see if getpwent exists
13553 set getpwent d_getpwent
13554 eval $inlibc
13555
13556 : see if getpwent_r exists
13557 set getpwent_r d_getpwent_r
13558 eval $inlibc
13559 case "$d_getpwent_r" in
13560 "$define")
13561         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13562         case "$d_getpwent_r_proto:$usethreads" in
13563         ":define")      d_getpwent_r_proto=define
13564                 set d_getpwent_r_proto getpwent_r $hdrs
13565                 eval $hasproto ;;
13566         *)      ;;
13567         esac
13568         case "$d_getpwent_r_proto" in
13569         define)
13570         case "$getpwent_r_proto" in
13571         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13572         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13573         esac
13574         case "$getpwent_r_proto" in
13575         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13576         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13577         esac
13578         case "$getpwent_r_proto" in
13579         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13580         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13581         esac
13582         case "$getpwent_r_proto" in
13583         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13584         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13585         esac
13586         case "$getpwent_r_proto" in
13587         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13588         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13589         esac
13590         case "$getpwent_r_proto" in
13591         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13592         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13593         esac
13594         case "$getpwent_r_proto" in
13595         ''|0)   d_getpwent_r=undef
13596                 getpwent_r_proto=0
13597                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13598         * )     case "$getpwent_r_proto" in
13599                 REENTRANT_PROTO*) ;;
13600                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13601                 esac
13602                 echo "Prototype: $try" ;;
13603         esac
13604         ;;
13605         *)      case "$usethreads" in
13606                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13607                 esac
13608                 d_getpwent_r=undef
13609                 getpwent_r_proto=0
13610                 ;;
13611         esac
13612         ;;
13613 *)      getpwent_r_proto=0
13614         ;;
13615 esac
13616
13617 : see if getpwnam_r exists
13618 set getpwnam_r d_getpwnam_r
13619 eval $inlibc
13620 case "$d_getpwnam_r" in
13621 "$define")
13622         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13623         case "$d_getpwnam_r_proto:$usethreads" in
13624         ":define")      d_getpwnam_r_proto=define
13625                 set d_getpwnam_r_proto getpwnam_r $hdrs
13626                 eval $hasproto ;;
13627         *)      ;;
13628         esac
13629         case "$d_getpwnam_r_proto" in
13630         define)
13631         case "$getpwnam_r_proto" in
13632         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13633         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13634         esac
13635         case "$getpwnam_r_proto" in
13636         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13637         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13638         esac
13639         case "$getpwnam_r_proto" in
13640         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13641         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13642         esac
13643         case "$getpwnam_r_proto" in
13644         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13645         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13646         esac
13647         case "$getpwnam_r_proto" in
13648         ''|0)   d_getpwnam_r=undef
13649                 getpwnam_r_proto=0
13650                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13651         * )     case "$getpwnam_r_proto" in
13652                 REENTRANT_PROTO*) ;;
13653                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13654                 esac
13655                 echo "Prototype: $try" ;;
13656         esac
13657         ;;
13658         *)      case "$usethreads" in
13659                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13660                 esac
13661                 d_getpwnam_r=undef
13662                 getpwnam_r_proto=0
13663                 ;;
13664         esac
13665         ;;
13666 *)      getpwnam_r_proto=0
13667         ;;
13668 esac
13669
13670 : see if getpwuid_r exists
13671 set getpwuid_r d_getpwuid_r
13672 eval $inlibc
13673 case "$d_getpwuid_r" in
13674 "$define")
13675         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13676         case "$d_getpwuid_r_proto:$usethreads" in
13677         ":define")      d_getpwuid_r_proto=define
13678                 set d_getpwuid_r_proto getpwuid_r $hdrs
13679                 eval $hasproto ;;
13680         *)      ;;
13681         esac
13682         case "$d_getpwuid_r_proto" in
13683         define)
13684         case "$getpwuid_r_proto" in
13685         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13686         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13687         esac
13688         case "$getpwuid_r_proto" in
13689         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13690         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13691         esac
13692         case "$getpwuid_r_proto" in
13693         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13694         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13695         esac
13696         case "$getpwuid_r_proto" in
13697         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13698         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13699         esac
13700         case "$getpwuid_r_proto" in
13701         ''|0)   d_getpwuid_r=undef
13702                 getpwuid_r_proto=0
13703                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13704         * )     case "$getpwuid_r_proto" in
13705                 REENTRANT_PROTO*) ;;
13706                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13707                 esac
13708                 echo "Prototype: $try" ;;
13709         esac
13710         ;;
13711         *)      case "$usethreads" in
13712                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13713                 esac
13714                 d_getpwuid_r=undef
13715                 getpwuid_r_proto=0
13716                 ;;
13717         esac
13718         ;;
13719 *)      getpwuid_r_proto=0
13720         ;;
13721 esac
13722
13723
13724 : see if getservbyname exists
13725 set getservbyname d_getsbyname
13726 eval $inlibc
13727
13728 : see if getservbyport exists
13729 set getservbyport d_getsbyport
13730 eval $inlibc
13731
13732 : see if getservent exists
13733 set getservent d_getsent
13734 eval $inlibc
13735
13736 : see if getservbyname_r exists
13737 set getservbyname_r d_getservbyname_r
13738 eval $inlibc
13739 case "$d_getservbyname_r" in
13740 "$define")
13741         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13742         case "$d_getservbyname_r_proto:$usethreads" in
13743         ":define")      d_getservbyname_r_proto=define
13744                 set d_getservbyname_r_proto getservbyname_r $hdrs
13745                 eval $hasproto ;;
13746         *)      ;;
13747         esac
13748         case "$d_getservbyname_r_proto" in
13749         define)
13750         case "$getservbyname_r_proto" in
13751         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13752         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13753         esac
13754         case "$getservbyname_r_proto" in
13755         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13756         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13757         esac
13758         case "$getservbyname_r_proto" in
13759         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13760         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13761         esac
13762         case "$getservbyname_r_proto" in
13763         ''|0)   d_getservbyname_r=undef
13764                 getservbyname_r_proto=0
13765                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13766         * )     case "$getservbyname_r_proto" in
13767                 REENTRANT_PROTO*) ;;
13768                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13769                 esac
13770                 echo "Prototype: $try" ;;
13771         esac
13772         ;;
13773         *)      case "$usethreads" in
13774                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13775                 esac
13776                 d_getservbyname_r=undef
13777                 getservbyname_r_proto=0
13778                 ;;
13779         esac
13780         ;;
13781 *)      getservbyname_r_proto=0
13782         ;;
13783 esac
13784
13785 : see if getservbyport_r exists
13786 set getservbyport_r d_getservbyport_r
13787 eval $inlibc
13788 case "$d_getservbyport_r" in
13789 "$define")
13790         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13791         case "$d_getservbyport_r_proto:$usethreads" in
13792         ":define")      d_getservbyport_r_proto=define
13793                 set d_getservbyport_r_proto getservbyport_r $hdrs
13794                 eval $hasproto ;;
13795         *)      ;;
13796         esac
13797         case "$d_getservbyport_r_proto" in
13798         define)
13799         case "$getservbyport_r_proto" in
13800         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13801         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13802         esac
13803         case "$getservbyport_r_proto" in
13804         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13805         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13806         esac
13807         case "$getservbyport_r_proto" in
13808         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13809         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13810         esac
13811         case "$getservbyport_r_proto" in
13812         ''|0)   d_getservbyport_r=undef
13813                 getservbyport_r_proto=0
13814                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13815         * )     case "$getservbyport_r_proto" in
13816                 REENTRANT_PROTO*) ;;
13817                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13818                 esac
13819                 echo "Prototype: $try" ;;
13820         esac
13821         ;;
13822         *)      case "$usethreads" in
13823                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13824                 esac
13825                 d_getservbyport_r=undef
13826                 getservbyport_r_proto=0
13827                 ;;
13828         esac
13829         ;;
13830 *)      getservbyport_r_proto=0
13831         ;;
13832 esac
13833
13834 : see if getservent_r exists
13835 set getservent_r d_getservent_r
13836 eval $inlibc
13837 case "$d_getservent_r" in
13838 "$define")
13839         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13840         case "$d_getservent_r_proto:$usethreads" in
13841         ":define")      d_getservent_r_proto=define
13842                 set d_getservent_r_proto getservent_r $hdrs
13843                 eval $hasproto ;;
13844         *)      ;;
13845         esac
13846         case "$d_getservent_r_proto" in
13847         define)
13848         case "$getservent_r_proto" in
13849         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13850         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13851         esac
13852         case "$getservent_r_proto" in
13853         ''|0) try='int getservent_r(struct servent*, char*, int);'
13854         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13855         esac
13856         case "$getservent_r_proto" in
13857         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13858         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13859         esac
13860         case "$getservent_r_proto" in
13861         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13862         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13863         esac
13864         case "$getservent_r_proto" in
13865         ''|0)   d_getservent_r=undef
13866                 getservent_r_proto=0
13867                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13868         * )     case "$getservent_r_proto" in
13869                 REENTRANT_PROTO*) ;;
13870                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13871                 esac
13872                 echo "Prototype: $try" ;;
13873         esac
13874         ;;
13875         *)      case "$usethreads" in
13876                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13877                 esac
13878                 d_getservent_r=undef
13879                 getservent_r_proto=0
13880                 ;;
13881         esac
13882         ;;
13883 *)      getservent_r_proto=0
13884         ;;
13885 esac
13886
13887 : see if prototypes for various getservxxx netdb.h functions are available
13888 echo " "
13889 set d_getservprotos getservent $i_netdb netdb.h
13890 eval $hasproto
13891
13892 : see if getspnam exists
13893 set getspnam d_getspnam
13894 eval $inlibc
13895
13896 : see if this is a shadow.h system
13897 set shadow.h i_shadow
13898 eval $inhdr
13899
13900 : see if getspnam_r exists
13901 set getspnam_r d_getspnam_r
13902 eval $inlibc
13903 case "$d_getspnam_r" in
13904 "$define")
13905         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13906         case "$d_getspnam_r_proto:$usethreads" in
13907         ":define")      d_getspnam_r_proto=define
13908                 set d_getspnam_r_proto getspnam_r $hdrs
13909                 eval $hasproto ;;
13910         *)      ;;
13911         esac
13912         case "$d_getspnam_r_proto" in
13913         define)
13914         case "$getspnam_r_proto" in
13915         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13916         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13917         esac
13918         case "$getspnam_r_proto" in
13919         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13920         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13921         esac
13922         case "$getspnam_r_proto" in
13923         ''|0)   d_getspnam_r=undef
13924                 getspnam_r_proto=0
13925                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13926         * )     case "$getspnam_r_proto" in
13927                 REENTRANT_PROTO*) ;;
13928                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13929                 esac
13930                 echo "Prototype: $try" ;;
13931         esac
13932         ;;
13933         *)      case "$usethreads" in
13934                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13935                 esac
13936                 d_getspnam_r=undef
13937                 getspnam_r_proto=0
13938                 ;;
13939         esac
13940         ;;
13941 *)      getspnam_r_proto=0
13942         ;;
13943 esac
13944
13945 : see if gettimeofday or ftime exists
13946 set gettimeofday d_gettimeod
13947 eval $inlibc
13948 case "$d_gettimeod" in
13949 "$undef")
13950         set ftime d_ftime 
13951         eval $inlibc
13952         ;;
13953 *)
13954         val="$undef"; set d_ftime; eval $setvar
13955         ;;
13956 esac
13957 case "$d_gettimeod$d_ftime" in
13958 "$undef$undef")
13959         echo " "
13960         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13961         ;;
13962 esac
13963
13964 : see if gmtime_r exists
13965 set gmtime_r d_gmtime_r
13966 eval $inlibc
13967 case "$d_gmtime_r" in
13968 "$define")
13969         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13970         case "$d_gmtime_r_proto:$usethreads" in
13971         ":define")      d_gmtime_r_proto=define
13972                 set d_gmtime_r_proto gmtime_r $hdrs
13973                 eval $hasproto ;;
13974         *)      ;;
13975         esac
13976         case "$d_gmtime_r_proto" in
13977         define)
13978         case "$gmtime_r_proto" in
13979         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13980         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13981         esac
13982         case "$gmtime_r_proto" in
13983         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13984         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13985         esac
13986         case "$gmtime_r_proto" in
13987         ''|0)   d_gmtime_r=undef
13988                 gmtime_r_proto=0
13989                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13990         * )     case "$gmtime_r_proto" in
13991                 REENTRANT_PROTO*) ;;
13992                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13993                 esac
13994                 echo "Prototype: $try" ;;
13995         esac
13996         ;;
13997         *)      case "$usethreads" in
13998                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13999                 esac
14000                 d_gmtime_r=undef
14001                 gmtime_r_proto=0
14002                 ;;
14003         esac
14004         ;;
14005 *)      gmtime_r_proto=0
14006         ;;
14007 esac
14008
14009 : see if hasmntopt exists
14010 set hasmntopt d_hasmntopt
14011 eval $inlibc
14012
14013 : see if this is a netinet/in.h or sys/in.h system
14014 set netinet/in.h i_niin sys/in.h i_sysin
14015 eval $inhdr
14016
14017 : see if arpa/inet.h has to be included
14018 set arpa/inet.h i_arpainet
14019 eval $inhdr
14020
14021 : see if htonl --and friends-- exists
14022 val=''
14023 set htonl val
14024 eval $inlibc
14025
14026 : Maybe they are macros.
14027 case "$val" in
14028 $undef)
14029         $cat >htonl.c <<EOM
14030 #include <stdio.h>
14031 #include <sys/types.h>
14032 #$i_niin I_NETINET_IN
14033 #$i_sysin I_SYS_IN
14034 #$i_arpainet I_ARPA_INET
14035 #ifdef I_NETINET_IN
14036 #include <netinet/in.h>
14037 #endif
14038 #ifdef I_SYS_IN
14039 #include <sys/in.h>
14040 #endif
14041 #ifdef I_ARPA_INET
14042 #include <arpa/inet.h>
14043 #endif
14044 #ifdef htonl
14045 printf("Defined as a macro.");
14046 #endif
14047 EOM
14048         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14049         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14050                 val="$define"
14051                 echo "But it seems to be defined as a macro." >&4
14052         fi
14053         $rm -f htonl.?
14054         ;;
14055 esac
14056 set d_htonl
14057 eval $setvar
14058
14059 : see if ilogbl exists
14060 set ilogbl d_ilogbl
14061 eval $inlibc
14062
14063 : index or strchr
14064 echo " "
14065 if set index val -f; eval $csym; $val; then
14066         if set strchr val -f d_strchr; eval $csym; $val; then
14067                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14068                         val="$define"
14069                         vali="$undef"
14070                         echo "strchr() found." >&4
14071                 else
14072                         val="$undef"
14073                         vali="$define"
14074                         echo "index() found." >&4
14075                 fi
14076         else
14077                 val="$undef"
14078                 vali="$define"
14079                 echo "index() found." >&4
14080         fi
14081 else
14082         if set strchr val -f d_strchr; eval $csym; $val; then
14083                 val="$define"
14084                 vali="$undef"
14085                 echo "strchr() found." >&4
14086         else
14087                 echo "No index() or strchr() found!" >&4
14088                 val="$undef"
14089                 vali="$undef"
14090         fi
14091 fi
14092 set d_strchr; eval $setvar
14093 val="$vali"
14094 set d_index; eval $setvar
14095
14096 : check whether inet_aton exists
14097 set inet_aton d_inetaton
14098 eval $inlibc
14099
14100 : Look for isascii
14101 echo " "
14102 $cat >isascii.c <<EOCP
14103 #include <stdio.h>
14104 #include <ctype.h>
14105 #$i_stdlib I_STDLIB
14106 #ifdef I_STDLIB
14107 #include <stdlib.h>
14108 #endif
14109 int main() {
14110         int c = 'A';
14111         if (isascii(c))
14112                 exit(0);
14113         else
14114                 exit(1);
14115 }
14116 EOCP
14117 set isascii
14118 if eval $compile; then
14119         echo "isascii() found." >&4
14120         val="$define"
14121 else
14122         echo "isascii() NOT found." >&4
14123         val="$undef"
14124 fi
14125 set d_isascii
14126 eval $setvar
14127 $rm -f isascii*
14128
14129 : see if isfinite exists
14130 set isfinite d_isfinite
14131 eval $inlibc
14132
14133 : see if isinf exists
14134 set isinf d_isinf
14135 eval $inlibc
14136
14137 : see if isnan exists
14138 set isnan d_isnan
14139 eval $inlibc
14140
14141 : see if isnanl exists
14142 set isnanl d_isnanl
14143 eval $inlibc
14144
14145 : see if killpg exists
14146 set killpg d_killpg
14147 eval $inlibc
14148
14149 : see if lchown exists
14150 echo " "
14151 $cat > try.c <<'EOCP'
14152 /* System header to define __stub macros and hopefully few prototypes,
14153     which can conflict with char lchown(); below.  */
14154 #include <assert.h>
14155 /* Override any gcc2 internal prototype to avoid an error.  */
14156 /* We use char because int might match the return type of a gcc2
14157    builtin and then its argument prototype would still apply.  */
14158 char lchown();
14159 int main() {
14160     /*  The GNU C library defines this for functions which it implements
14161         to always fail with ENOSYS.  Some functions are actually named
14162         something starting with __ and the normal name is an alias.  */
14163 #if defined (__stub_lchown) || defined (__stub___lchown)
14164 choke me
14165 #else
14166 lchown();
14167 #endif
14168 ; return 0; }
14169 EOCP
14170 set try
14171 if eval $compile; then
14172     $echo "lchown() found." >&4
14173     val="$define"
14174 else
14175     $echo "lchown() NOT found." >&4
14176     val="$undef"
14177 fi
14178 set d_lchown
14179 eval $setvar
14180
14181 : See if number of significant digits in a double precision number is known
14182 echo " "
14183 $cat >ldbl_dig.c <<EOM
14184 #$i_limits I_LIMITS
14185 #$i_float I_FLOAT
14186 #ifdef I_LIMITS
14187 #include <limits.h>
14188 #endif
14189 #ifdef I_FLOAT
14190 #include <float.h>
14191 #endif
14192 #ifdef LDBL_DIG
14193 printf("Contains LDBL_DIG");
14194 #endif
14195 EOM
14196 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14197 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14198         echo "LDBL_DIG found." >&4
14199         val="$define"
14200 else
14201         echo "LDBL_DIG NOT found." >&4
14202         val="$undef"
14203 fi
14204 $rm -f ldbl_dig.?
14205 set d_ldbl_dig
14206 eval $setvar
14207
14208 : see if this is a math.h system
14209 set math.h i_math
14210 eval $inhdr
14211
14212 d_libm_lib_version="$undef"
14213 case $i_math in
14214     $define)
14215         : check to see if math.h defines _LIB_VERSION
14216         echo " "
14217         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14218         $cat >try.c <<EOCP
14219 #include <unistd.h>
14220 #include <math.h>
14221 int main (int argc, char *argv[])
14222 {
14223     printf ("%d\n", _LIB_VERSION);
14224     return (0);
14225     } /* main */
14226 EOCP
14227         set try
14228         if eval $compile; then
14229             foo=`$run ./try`
14230             echo "Yes, it does ($foo)" >&4
14231             d_libm_lib_version="$define"
14232         else
14233             echo "No, it does not (probably harmless)\n" >&4
14234             fi
14235         $rm -f try.* try core core.try.*
14236         ;;
14237
14238     esac
14239
14240 : see if link exists
14241 set link d_link
14242 eval $inlibc
14243
14244 : see if localtime_r exists
14245 set localtime_r d_localtime_r
14246 eval $inlibc
14247 case "$d_localtime_r" in
14248 "$define")
14249         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14250         case "$d_localtime_r_proto:$usethreads" in
14251         ":define")      d_localtime_r_proto=define
14252                 set d_localtime_r_proto localtime_r $hdrs
14253                 eval $hasproto ;;
14254         *)      ;;
14255         esac
14256         case "$d_localtime_r_proto" in
14257         define)
14258         case "$localtime_r_proto" in
14259         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14260         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14261         esac
14262         case "$localtime_r_proto" in
14263         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14264         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14265         esac
14266         case "$localtime_r_proto" in
14267         ''|0)   d_localtime_r=undef
14268                 localtime_r_proto=0
14269                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14270         * )     case "$localtime_r_proto" in
14271                 REENTRANT_PROTO*) ;;
14272                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14273                 esac
14274                 echo "Prototype: $try" ;;
14275         esac
14276         ;;
14277         *)      case "$usethreads" in
14278                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14279                 esac
14280                 d_localtime_r=undef
14281                 localtime_r_proto=0
14282                 ;;
14283         esac
14284         ;;
14285 *)      localtime_r_proto=0
14286         ;;
14287 esac
14288
14289 : see if localeconv exists
14290 set localeconv d_locconv
14291 eval $inlibc
14292
14293 : see if lockf exists
14294 set lockf d_lockf
14295 eval $inlibc
14296
14297 : see if prototype for lseek is available
14298 echo " "
14299 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14300 eval $hasproto
14301
14302 : see if lstat exists
14303 set lstat d_lstat
14304 eval $inlibc
14305
14306 : see if madvise exists
14307 set madvise d_madvise
14308 eval $inlibc
14309
14310 : see if malloc_size exists
14311 set malloc_size d_malloc_size
14312 eval $inlibc
14313
14314 : see if malloc_size_good exists
14315 set malloc_good_size d_malloc_good_size
14316 eval $inlibc
14317
14318 : see if mblen exists
14319 set mblen d_mblen
14320 eval $inlibc
14321
14322 : see if mbstowcs exists
14323 set mbstowcs d_mbstowcs
14324 eval $inlibc
14325
14326 : see if mbtowc exists
14327 set mbtowc d_mbtowc
14328 eval $inlibc
14329
14330 : see if memchr exists
14331 set memchr d_memchr
14332 eval $inlibc
14333
14334 : see if memcmp exists
14335 set memcmp d_memcmp
14336 eval $inlibc
14337
14338 : see if memcpy exists
14339 set memcpy d_memcpy
14340 eval $inlibc
14341
14342 : see if memmove exists
14343 set memmove d_memmove
14344 eval $inlibc
14345
14346 : see if memset exists
14347 set memset d_memset
14348 eval $inlibc
14349
14350 : see if mkdir exists
14351 set mkdir d_mkdir
14352 eval $inlibc
14353
14354 : see if mkdtemp exists
14355 set mkdtemp d_mkdtemp
14356 eval $inlibc
14357
14358 : see if mkfifo exists
14359 set mkfifo d_mkfifo
14360 eval $inlibc
14361
14362 : see if mkstemp exists
14363 set mkstemp d_mkstemp
14364 eval $inlibc
14365
14366 : see if mkstemps exists
14367 set mkstemps d_mkstemps
14368 eval $inlibc
14369
14370 : see if mktime exists
14371 set mktime d_mktime
14372 eval $inlibc
14373
14374 : see if this is a sys/mman.h system
14375 set sys/mman.h i_sysmman
14376 eval $inhdr
14377
14378 : see if mmap exists
14379 set mmap d_mmap
14380 eval $inlibc
14381 : see what shmat returns
14382 : default to something harmless
14383 mmaptype='void *'
14384 case "$i_sysmman$d_mmap" in
14385 "$define$define")
14386         $cat >mmap.c <<'END'
14387 #include <sys/mman.h>
14388 void *mmap();
14389 END
14390         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14391                 mmaptype='void *'
14392         else
14393                 mmaptype='caddr_t'
14394         fi
14395         echo "and it returns ($mmaptype)." >&4
14396         ;;
14397 esac
14398
14399
14400
14401 : see if sqrtl exists
14402 set sqrtl d_sqrtl
14403 eval $inlibc
14404
14405 : see if scalbnl exists
14406 set scalbnl d_scalbnl
14407 eval $inlibc
14408
14409 : see if modfl exists
14410 set modfl d_modfl
14411 eval $inlibc
14412
14413 : see if prototype for modfl is available
14414 echo " "
14415 set d_modflproto modfl $i_math math.h
14416 eval $hasproto
14417
14418 d_modfl_pow32_bug="$undef"
14419
14420 case "$d_longdbl$d_modfl" in
14421 $define$define)
14422         $cat <<EOM
14423 Checking to see whether your modfl() is okay for large values...
14424 EOM
14425 $cat >try.c <<EOCP
14426 #include <math.h> 
14427 #include <stdio.h>
14428 EOCP
14429 if $test "X$d_modflproto" != "X$define"; then
14430         $cat >>try.c <<EOCP
14431 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14432 long double modfl (long double, long double *);
14433 EOCP
14434 fi
14435 $cat >>try.c <<EOCP
14436 int main() {
14437     long double nv = 4294967303.15;
14438     long double v, w;
14439     v = modfl(nv, &w);         
14440 #ifdef __GLIBC__
14441     printf("glibc");
14442 #endif
14443     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14444     return 0;
14445 }
14446 EOCP
14447         case "$osname:$gccversion" in
14448         aix:)   saveccflags="$ccflags"
14449                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14450         esac
14451         set try
14452         if eval $compile; then
14453                 foo=`$run ./try`
14454                 case "$foo" in
14455                 *" 4294967303.150000 1.150000 4294967302.000000")
14456                         echo >&4 "Your modfl() is broken for large values."
14457                         d_modfl_pow32_bug="$define"
14458                         case "$foo" in
14459                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14460                         ;;
14461                         esac
14462                         ;;
14463                 *" 4294967303.150000 0.150000 4294967303.000000")
14464                         echo >&4 "Your modfl() seems okay for large values."
14465                         ;;
14466                 *)      echo >&4 "I don't understand your modfl() at all."
14467                         d_modfl="$undef"
14468                         ;;
14469                 esac
14470                 $rm -f try.* try core core.try.*
14471         else
14472                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14473                 d_modfl="$undef"
14474         fi
14475         case "$osname:$gccversion" in
14476         aix:)   ccflags="$saveccflags" ;; # restore
14477         esac
14478         ;;
14479 esac
14480
14481 if $test "$uselongdouble" = "$define"; then
14482     message=""
14483     if $test "$d_sqrtl" != "$define"; then
14484         message="$message sqrtl"
14485     fi
14486     if $test "$d_modfl" != "$define"; then
14487         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14488             echo "You have both aintl and copysignl, so I can emulate modfl."
14489         else
14490             message="$message modfl"
14491         fi
14492     fi
14493     if $test "$d_frexpl" != "$define"; then
14494         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14495             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14496         else
14497             message="$message frexpl"
14498         fi
14499     fi
14500
14501     if $test "$message" != ""; then
14502         $cat <<EOM >&4
14503
14504 *** You requested the use of long doubles but you do not seem to have
14505 *** the following mathematical functions needed for long double support:
14506 ***    $message
14507 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14508 *** Cannot continue, aborting.
14509
14510 EOM
14511
14512         exit 1
14513     fi
14514 fi
14515
14516 : see if mprotect exists
14517 set mprotect d_mprotect
14518 eval $inlibc
14519
14520 : see if msgctl exists
14521 set msgctl d_msgctl
14522 eval $inlibc
14523
14524 : see if msgget exists
14525 set msgget d_msgget
14526 eval $inlibc
14527
14528 : see if msgsnd exists
14529 set msgsnd d_msgsnd
14530 eval $inlibc
14531
14532 : see if msgrcv exists
14533 set msgrcv d_msgrcv
14534 eval $inlibc
14535
14536 : see how much of the 'msg*(2)' library is present.
14537 h_msg=true
14538 echo " "
14539 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14540 *"$undef"*) h_msg=false;;
14541 esac
14542 case "$osname" in
14543 freebsd)
14544     case "`ipcs 2>&1`" in
14545     "SVID messages"*"not configured"*)
14546         echo "Your $osname does not have the msg*(2) configured." >&4
14547         h_msg=false
14548         val="$undef"
14549         set msgctl d_msgctl
14550         eval $setvar
14551         set msgget d_msgget
14552         eval $setvar
14553         set msgsnd d_msgsnd
14554         eval $setvar
14555         set msgrcv d_msgrcv
14556         eval $setvar
14557         ;;
14558     esac
14559     ;;
14560 esac
14561 : we could also check for sys/ipc.h ...
14562 if $h_msg && $test `./findhdr sys/msg.h`; then
14563         echo "You have the full msg*(2) library." >&4
14564         val="$define"
14565 else
14566         echo "You don't have the full msg*(2) library." >&4
14567         val="$undef"
14568 fi
14569 set d_msg
14570 eval $setvar
14571
14572
14573 echo " "
14574 echo "Checking to see if your system supports struct msghdr..." >&4
14575 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14576 eval $hasstruct
14577 case "$d_msghdr_s" in
14578 "$define")      echo "Yes, it does."   ;;
14579 *)              echo "No, it doesn't." ;;
14580 esac
14581
14582
14583 : see if msync exists
14584 set msync d_msync
14585 eval $inlibc
14586
14587 : see if munmap exists
14588 set munmap d_munmap
14589 eval $inlibc
14590
14591 : see if nice exists
14592 set nice d_nice
14593 eval $inlibc
14594
14595 : see if this is a langinfo.h system
14596 set langinfo.h i_langinfo
14597 eval $inhdr
14598
14599 : see if nl_langinfo exists
14600 set nl_langinfo d_nl_langinfo
14601 eval $inlibc
14602
14603 : check for length of character
14604 echo " "
14605 case "$charsize" in
14606 '')
14607         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14608         $cat >try.c <<EOCP
14609 #include <stdio.h>
14610 #$i_stdlib I_STDLIB
14611 #ifdef I_STDLIB
14612 #include <stdlib.h>
14613 #endif
14614 int main()
14615 {
14616     printf("%d\n", (int)sizeof(char));
14617     exit(0);
14618 }
14619 EOCP
14620         set try
14621         if eval $compile_ok; then
14622                 dflt=`$run ./try`
14623         else
14624                 dflt='1'
14625                 echo "(I can't seem to compile the test program.  Guessing...)"
14626         fi
14627         ;;
14628 *)
14629         dflt="$charsize"
14630         ;;
14631 esac
14632 rp="What is the size of a character (in bytes)?"
14633 . ./myread
14634 charsize="$ans"
14635 $rm -f try.c try
14636
14637 : check for volatile keyword
14638 echo " "
14639 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14640 $cat >try.c <<'EOCP'
14641 int main()
14642 {
14643         typedef struct _goo_struct goo_struct;
14644         goo_struct * volatile goo = ((goo_struct *)0);
14645         struct _goo_struct {
14646                 long long_int;
14647                 int reg_int;
14648                 char char_var;
14649         };
14650         typedef unsigned short foo_t;
14651         char *volatile foo;
14652         volatile int bar;
14653         volatile foo_t blech;
14654         foo = foo;
14655 }
14656 EOCP
14657 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14658         val="$define"
14659         echo "Yup, it does."
14660 else
14661         val="$undef"
14662         echo "Nope, it doesn't."
14663 fi
14664 set d_volatile
14665 eval $setvar
14666 $rm -f try.*
14667
14668
14669 echo " "
14670 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14671
14672 case "$use64bitint:$d_quad:$quadtype" in
14673 define:define:?*)
14674         ivtype="$quadtype"
14675         uvtype="$uquadtype"
14676         ivsize=8
14677         uvsize=8
14678         ;;
14679 *)      ivtype="long"
14680         uvtype="unsigned long"
14681         ivsize=$longsize
14682         uvsize=$longsize
14683         ;;
14684 esac
14685
14686 case "$uselongdouble:$d_longdbl" in
14687 define:define)
14688         nvtype="long double"
14689         nvsize=$longdblsize
14690         ;;
14691 *)      nvtype=double
14692         nvsize=$doublesize
14693         ;;
14694 esac
14695
14696 $echo "(IV will be "$ivtype", $ivsize bytes)"
14697 $echo "(UV will be "$uvtype", $uvsize bytes)"
14698 $echo "(NV will be "$nvtype", $nvsize bytes)"
14699
14700 $cat >try.c <<EOCP
14701 #$i_inttypes I_INTTYPES
14702 #ifdef I_INTTYPES
14703 #include <inttypes.h>
14704 #endif
14705 #include <stdio.h>
14706 int main() {
14707 #ifdef INT8
14708    int8_t i =  INT8_MAX;
14709   uint8_t u = UINT8_MAX;
14710   printf("int8_t\n");
14711 #endif
14712 #ifdef INT16
14713    int16_t i =  INT16_MAX;
14714   uint16_t i = UINT16_MAX;
14715   printf("int16_t\n");
14716 #endif
14717 #ifdef INT32
14718    int32_t i =  INT32_MAX;
14719   uint32_t u = UINT32_MAX;
14720   printf("int32_t\n");
14721 #endif
14722 }
14723 EOCP
14724
14725 case "$i8type" in
14726 '')     case "$charsize" in
14727         1)      i8type=char
14728                 u8type="unsigned char"
14729                 i8size=$charsize
14730                 u8size=$charsize
14731                 ;;
14732         esac
14733         ;;
14734 esac
14735 case "$i8type" in
14736 '')     set try -DINT8
14737         if eval $compile; then
14738                 case "`$run ./try`" in
14739                 int8_t) i8type=int8_t
14740                         u8type=uint8_t
14741                         i8size=1
14742                         u8size=1
14743                         ;;
14744                 esac
14745         fi
14746         ;;
14747 esac
14748 case "$i8type" in
14749 '')     if $test $charsize -ge 1; then
14750                 i8type=char
14751                 u8type="unsigned char"
14752                 i8size=$charsize
14753                 u8size=$charsize
14754         fi
14755         ;;
14756 esac
14757
14758 case "$i16type" in
14759 '')     case "$shortsize" in
14760         2)      i16type=short
14761                 u16type="unsigned short"
14762                 i16size=$shortsize
14763                 u16size=$shortsize
14764                 ;;
14765         esac
14766         ;;
14767 esac
14768 case "$i16type" in
14769 '')     set try -DINT16
14770         if eval $compile; then
14771                 case "`$run ./try`" in
14772                 int16_t)
14773                         i16type=int16_t
14774                         u16type=uint16_t
14775                         i16size=2
14776                         u16size=2
14777                         ;;
14778                 esac
14779         fi
14780         ;;
14781 esac
14782 case "$i16type" in
14783 '')     if $test $shortsize -ge 2; then
14784                 i16type=short
14785                 u16type="unsigned short"
14786                 i16size=$shortsize
14787                 u16size=$shortsize
14788         fi
14789         ;;
14790 esac
14791
14792 case "$i32type" in
14793 '')     case "$longsize" in
14794         4)      i32type=long
14795                 u32type="unsigned long"
14796                 i32size=$longsize
14797                 u32size=$longsize
14798                 ;;
14799         *)      case "$intsize" in
14800                 4)      i32type=int
14801                         u32type="unsigned int"
14802                         i32size=$intsize
14803                         u32size=$intsize
14804                         ;;
14805                 esac
14806                 ;;
14807         esac
14808         ;;
14809 esac
14810 case "$i32type" in
14811 '')     set try -DINT32
14812         if eval $compile; then
14813                 case "`$run ./try`" in
14814                 int32_t)
14815                         i32type=int32_t
14816                         u32type=uint32_t
14817                         i32size=4
14818                         u32size=4
14819                         ;;
14820                 esac
14821         fi
14822         ;;
14823 esac
14824 case "$i32type" in
14825 '')     if $test $intsize -ge 4; then
14826                 i32type=int
14827                 u32type="unsigned int"
14828                 i32size=$intsize
14829                 u32size=$intsize
14830         fi
14831         ;;
14832 esac
14833
14834 case "$i64type" in
14835 '')     case "$d_quad:$quadtype" in
14836         define:?*)
14837                 i64type="$quadtype"
14838                 u64type="$uquadtype"
14839                 i64size=8
14840                 u64size=8
14841                 ;;
14842         esac
14843         ;;
14844 esac
14845
14846 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14847 : volatile so that the compiler has to store it out to memory.
14848 if test X"$d_volatile" = X"$define"; then
14849         volatile=volatile
14850 fi
14851 $cat <<EOP >try.c
14852 #include <stdio.h>
14853 #$i_stdlib I_STDLIB
14854 #ifdef I_STDLIB
14855 #include <stdlib.h>
14856 #endif
14857 #include <sys/types.h>
14858 #include <signal.h>
14859 #ifdef SIGFPE
14860 $volatile int bletched = 0;
14861 $signal_t blech(s) int s; { bletched = 1; }
14862 #endif
14863 int main() {
14864     $uvtype u = 0;
14865     $nvtype d;
14866     int     n = 8 * $uvsize;
14867     int     i;
14868 #ifdef SIGFPE
14869     signal(SIGFPE, blech);
14870 #endif
14871
14872     for (i = 0; i < n; i++) {
14873       u = u << 1 | ($uvtype)1;
14874       d = ($nvtype)u;
14875       if (($uvtype)d != u)
14876         break;
14877       if (d <= 0)
14878         break;
14879       d = ($nvtype)(u - 1);
14880       if (($uvtype)d != (u - 1))
14881         break;
14882 #ifdef SIGFPE
14883       if (bletched) {
14884         break;
14885 #endif
14886       } 
14887     }
14888     printf("%d\n", ((i == n) ? -n : i));
14889     exit(0);
14890 }
14891 EOP
14892 set try
14893
14894 d_nv_preserves_uv="$undef"
14895 if eval $compile; then
14896         nv_preserves_uv_bits="`$run ./try`"
14897 fi
14898 case "$nv_preserves_uv_bits" in
14899 \-[1-9]*)       
14900         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14901         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14902         d_nv_preserves_uv="$define"
14903         ;;
14904 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14905         d_nv_preserves_uv="$undef" ;;
14906 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14907         nv_preserves_uv_bits="$undef" ;;
14908 esac
14909
14910 $rm -f try.* try
14911
14912 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14913 : volatile so that the compiler has to store it out to memory.
14914 if test X"$d_volatile" = X"$define"; then
14915         volatile=volatile
14916 fi
14917 $cat <<EOP >try.c
14918 #include <stdio.h>
14919 #$i_stdlib I_STDLIB
14920 #ifdef I_STDLIB
14921 #include <stdlib.h>
14922 #endif
14923 #$i_string I_STRING
14924 #ifdef I_STRING
14925 #  include <string.h>
14926 #else
14927 #  include <strings.h>
14928 #endif
14929 #include <sys/types.h>
14930 #include <signal.h>
14931 #ifdef SIGFPE
14932 $volatile int bletched = 0;
14933 $signal_t blech(s) int s; { bletched = 1; }
14934 #endif
14935
14936 int checkit($nvtype d, char *where) {
14937     unsigned char *p = (char *)&d;
14938     unsigned char *end = p + sizeof(d);
14939     int fail = 0;
14940
14941     while (p < end)
14942         fail += *p++;
14943
14944     if (!fail)
14945         return 0;
14946
14947     p = (char *)&d;
14948     printf("No - %s: 0x", where);
14949     while (p < end)
14950         printf ("%02X", *p++);
14951     printf("\n");
14952     return 1;
14953 }
14954
14955 int main(int argc, char **argv) {
14956     $nvtype d = 0.0;
14957     int fail = 0;
14958     fail += checkit(d, "0.0");
14959
14960     /* The compiler shouldn't be assuming that bletched is 0  */
14961     d = bletched;
14962
14963     fail += checkit(d, "bleched");
14964
14965 #ifdef SIGFPE
14966     signal(SIGFPE, blech);
14967 #endif
14968
14969     /* Paranoia - the compiler should have no way of knowing that ANSI says
14970        that argv[argc] will always be NULL.  Actually, if it did assume this it
14971        would be buggy, as this is C and main() can be called from elsewhere in
14972        the program.  */
14973     d = argv[argc] ? 1 : 0;
14974
14975     if (d) {
14976         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14977     }
14978
14979     fail += checkit(d, "ternary");
14980
14981     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14982
14983     if (d != 0.0) {
14984         printf("No - memset doesn't give 0.0\n");
14985         /* This might just blow up:  */
14986         printf("(gives %g)\n", d);
14987         return 1;
14988     }
14989     
14990 #ifdef SIGFPE
14991     if (bletched) {
14992         printf("No - something bleched\n");
14993         return 1;
14994     }
14995 #endif
14996     if (fail) {
14997       printf("No - %d fail(s)\n", fail);
14998       return 1;
14999     }
15000     printf("Yes\n");
15001     return 0;
15002 }
15003 EOP
15004 set try
15005
15006 d_nv_zero_is_allbits_zero="$undef"
15007 if eval $compile; then
15008     xxx="`$run ./try`"
15009     case "$?" in
15010         0)
15011             case "$xxx" in
15012                 Yes)  cat >&4 <<EOM
15013 0.0 is represented as all bits zero in memory
15014 EOM
15015                     d_nv_zero_is_allbits_zero="$define"
15016                     ;;
15017                 *)  cat >&4 <<EOM
15018 0.0 is not represented as all bits zero in memory
15019 EOM
15020                     d_nv_zero_is_allbits_zero="$undef"
15021                     ;;
15022             esac
15023             ;;
15024         *)  cat >&4 <<EOM
15025 0.0 is not represented as all bits zero in memory
15026 EOM
15027             d_nv_zero_is_allbits_zero="$undef"
15028             ;;
15029     esac
15030 fi
15031
15032 $rm -f try.* try
15033
15034
15035 : check for off64_t
15036 echo " "
15037 echo "Checking to see if you have off64_t..." >&4
15038 $cat >try.c <<EOCP
15039 #include <sys/types.h>
15040 #include <unistd.h>
15041 int main() { off64_t x = 7; }
15042 EOCP
15043 set try
15044 if eval $compile; then
15045         val="$define"
15046         echo "You have off64_t."
15047 else
15048         val="$undef"
15049         echo "You do not have off64_t."
15050         case "$lseeksize" in
15051         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15052         esac
15053 fi
15054 $rm -f try.* try
15055 set d_off64_t
15056 eval $setvar
15057
15058 : how to create joinable pthreads
15059 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15060         echo " "
15061         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15062         $cat >try.c <<'EOCP'
15063 #include <pthread.h>
15064 int main() {
15065     int detachstate = JOINABLE;
15066 }
15067 EOCP
15068         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15069         if eval $compile; then
15070                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15071                 val="$undef" # Yes, undef.
15072                 set d_old_pthread_create_joinable
15073                 eval $setvar
15074                 val=""
15075                 set old_pthread_create_joinable
15076                 eval $setvar
15077         else
15078                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15079                 if eval $compile; then
15080                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15081                         val="$define"
15082                         set d_old_pthread_create_joinable
15083                         eval $setvar
15084                         val=PTHREAD_CREATE_UNDETACHED
15085                         set old_pthread_create_joinable
15086                         eval $setvar
15087                 else            
15088                         set try -DJOINABLE=__UNDETACHED
15089                         if eval $compile; then
15090                                 echo "You seem to use __UNDETACHED." >&4
15091                                 val="$define"
15092                                 set d_old_pthread_create_joinable
15093                                 eval $setvar
15094                                 val=__UNDETACHED
15095                                 set old_pthread_create_joinable
15096                                 eval $setvar
15097                         else
15098                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15099                                 val="$define"
15100                                 set d_old_pthread_create_joinable
15101                                 eval $setvar
15102                                 val=0
15103                                 set old_pthread_create_joinable
15104                                 eval $setvar
15105                         fi
15106                 fi
15107         fi
15108         $rm -f try try.*
15109 else
15110     d_old_pthread_create_joinable="$undef"
15111     old_pthread_create_joinable=""
15112 fi
15113
15114 : see if pause exists
15115 set pause d_pause
15116 eval $inlibc
15117
15118 : see if pipe exists
15119 set pipe d_pipe
15120 eval $inlibc
15121
15122 : see if poll exists
15123 set poll d_poll
15124 eval $inlibc
15125
15126 : see if readlink exists
15127 set readlink d_readlink
15128 eval $inlibc
15129
15130 echo " "
15131 procselfexe=''
15132 val="$undef"
15133 case "$d_readlink" in
15134 "$define")
15135         if $issymlink /proc/self/exe ; then
15136                 $ls -l /proc/self/exe > reflect
15137                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15138                         echo "You have Linux-like /proc/self/exe."
15139                         procselfexe='"/proc/self/exe"'
15140                         val="$define"
15141                 fi
15142         fi
15143         if $issymlink /proc/curproc/file ; then
15144                 $ls -l /proc/curproc/file > reflect
15145                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15146                         echo "You have BSD-like /proc/curproc/file."
15147                         procselfexe='"/proc/curproc/file"'
15148                         val="$define"
15149                 fi
15150         fi
15151         ;;
15152 esac
15153 $rm -f reflect
15154 set d_procselfexe
15155 eval $setvar
15156
15157 : see whether the pthread_atfork exists
15158 $cat >try.c <<EOP
15159 #include <pthread.h>
15160 #include <stdio.h>
15161 int main() {
15162 #ifdef  PTHREAD_ATFORK
15163         pthread_atfork(NULL,NULL,NULL);
15164 #endif
15165 }
15166 EOP
15167
15168 : see if pthread_atfork exists
15169 set try -DPTHREAD_ATFORK
15170 if eval $compile; then
15171     val="$define"
15172 else
15173     val="$undef"
15174 fi
15175 case "$usethreads" in
15176 $define)
15177         case "$val" in
15178         $define) echo 'pthread_atfork found.' >&4        ;;
15179         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15180         esac
15181 esac
15182 set d_pthread_atfork
15183 eval $setvar
15184
15185 : see if pthread_attr_setscope exists
15186 set pthread_attr_setscope d_pthread_attr_setscope
15187 eval $inlibc
15188
15189
15190 : see whether the various POSIXish _yields exist
15191 $cat >try.c <<EOP
15192 #include <pthread.h>
15193 #include <stdio.h>
15194 int main() {
15195 #ifdef SCHED_YIELD
15196         sched_yield();
15197 #else
15198 #ifdef PTHREAD_YIELD
15199         pthread_yield();
15200 #else
15201 #ifdef PTHREAD_YIELD_NULL
15202         pthread_yield(NULL);
15203 #endif
15204 #endif
15205 #endif
15206 }
15207 EOP
15208 : see if sched_yield exists
15209 set try -DSCHED_YIELD
15210 if eval $compile; then
15211     val="$define"
15212     sched_yield='sched_yield()'
15213 else
15214     val="$undef"
15215 fi
15216 case "$usethreads" in
15217 $define)
15218         case "$val" in
15219         $define) echo 'sched_yield() found.' >&4        ;;
15220         *)       echo 'sched_yield() NOT found.' >&4    ;;
15221         esac
15222 esac
15223 set d_sched_yield
15224 eval $setvar
15225
15226 : see if pthread_yield exists
15227 set try -DPTHREAD_YIELD
15228 if eval $compile; then
15229     val="$define"
15230     case "$sched_yield" in
15231     '') sched_yield='pthread_yield()' ;;
15232     esac
15233 else
15234     set try -DPTHREAD_YIELD_NULL
15235     if eval $compile; then
15236         val="$define"
15237         case "$sched_yield" in
15238         '') sched_yield='pthread_yield(NULL)' ;;
15239         esac
15240     else
15241         val="$undef"
15242     fi
15243 fi
15244 case "$usethreads" in
15245 $define)
15246         case "$val" in
15247         $define) echo 'pthread_yield() found.' >&4      ;;
15248         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15249         esac
15250         ;;
15251 esac
15252 set d_pthread_yield
15253 eval $setvar
15254
15255 case "$sched_yield" in
15256 '') sched_yield=undef ;;
15257 esac
15258
15259 $rm -f try try.*
15260
15261 : see if random_r exists
15262 set random_r d_random_r
15263 eval $inlibc
15264 case "$d_random_r" in
15265 "$define")
15266         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15267         case "$d_random_r_proto:$usethreads" in
15268         ":define")      d_random_r_proto=define
15269                 set d_random_r_proto random_r $hdrs
15270                 eval $hasproto ;;
15271         *)      ;;
15272         esac
15273         case "$d_random_r_proto" in
15274         define)
15275         case "$random_r_proto" in
15276         ''|0) try='int random_r(int*, struct random_data*);'
15277         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15278         esac
15279         case "$random_r_proto" in
15280         ''|0) try='int random_r(long*, struct random_data*);'
15281         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15282         esac
15283         case "$random_r_proto" in
15284         ''|0) try='int random_r(struct random_data*, int32_t*);'
15285         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15286         esac
15287         case "$random_r_proto" in
15288         ''|0)   d_random_r=undef
15289                 random_r_proto=0
15290                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15291         * )     case "$random_r_proto" in
15292                 REENTRANT_PROTO*) ;;
15293                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15294                 esac
15295                 echo "Prototype: $try" ;;
15296         esac
15297         ;;
15298         *)      case "$usethreads" in
15299                 define) echo "random_r has no prototype, not using it." >&4 ;;
15300                 esac
15301                 d_random_r=undef
15302                 random_r_proto=0
15303                 ;;
15304         esac
15305         ;;
15306 *)      random_r_proto=0
15307         ;;
15308 esac
15309
15310 : see if readdir and friends exist
15311 set readdir d_readdir
15312 eval $inlibc
15313 set seekdir d_seekdir
15314 eval $inlibc
15315 set telldir d_telldir
15316 eval $inlibc
15317 set rewinddir d_rewinddir
15318 eval $inlibc
15319
15320 : see if readdir64_r exists
15321 set readdir64_r d_readdir64_r
15322 eval $inlibc
15323 case "$d_readdir64_r" in
15324 "$define")
15325         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15326         case "$d_readdir64_r_proto:$usethreads" in
15327         ":define")      d_readdir64_r_proto=define
15328                 set d_readdir64_r_proto readdir64_r $hdrs
15329                 eval $hasproto ;;
15330         *)      ;;
15331         esac
15332         case "$d_readdir64_r_proto" in
15333         define)
15334         case "$readdir64_r_proto" in
15335         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15336         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15337         esac
15338         case "$readdir64_r_proto" in
15339         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15340         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15341         esac
15342         case "$readdir64_r_proto" in
15343         ''|0)   d_readdir64_r=undef
15344                 readdir64_r_proto=0
15345                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15346         * )     case "$readdir64_r_proto" in
15347                 REENTRANT_PROTO*) ;;
15348                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15349                 esac
15350                 echo "Prototype: $try" ;;
15351         esac
15352         ;;
15353         *)      case "$usethreads" in
15354                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15355                 esac
15356                 d_readdir64_r=undef
15357                 readdir64_r_proto=0
15358                 ;;
15359         esac
15360         ;;
15361 *)      readdir64_r_proto=0
15362         ;;
15363 esac
15364
15365 : see if readdir_r exists
15366 set readdir_r d_readdir_r
15367 eval $inlibc
15368 case "$d_readdir_r" in
15369 "$define")
15370         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15371         case "$d_readdir_r_proto:$usethreads" in
15372         ":define")      d_readdir_r_proto=define
15373                 set d_readdir_r_proto readdir_r $hdrs
15374                 eval $hasproto ;;
15375         *)      ;;
15376         esac
15377         case "$d_readdir_r_proto" in
15378         define)
15379         case "$readdir_r_proto" in
15380         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15381         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15382         esac
15383         case "$readdir_r_proto" in
15384         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15385         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15386         esac
15387         case "$readdir_r_proto" in
15388         ''|0)   d_readdir_r=undef
15389                 readdir_r_proto=0
15390                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15391         * )     case "$readdir_r_proto" in
15392                 REENTRANT_PROTO*) ;;
15393                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15394                 esac
15395                 echo "Prototype: $try" ;;
15396         esac
15397         ;;
15398         *)      case "$usethreads" in
15399                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15400                 esac
15401                 d_readdir_r=undef
15402                 readdir_r_proto=0
15403                 ;;
15404         esac
15405         ;;
15406 *)      readdir_r_proto=0
15407         ;;
15408 esac
15409
15410 : see if readv exists
15411 set readv d_readv
15412 eval $inlibc
15413
15414 : see if recvmsg exists
15415 set recvmsg d_recvmsg
15416 eval $inlibc
15417
15418 : see if rename exists
15419 set rename d_rename
15420 eval $inlibc
15421
15422 : see if rmdir exists
15423 set rmdir d_rmdir
15424 eval $inlibc
15425
15426 : see if memory.h is available.
15427 val=''
15428 set memory.h val
15429 eval $inhdr
15430
15431 : See if it conflicts with string.h
15432 case "$val" in
15433 $define)
15434         case "$strings" in
15435         '') ;;
15436         *)
15437                 $cppstdin $cppflags $cppminus < $strings > mem.h
15438                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15439                         echo " "
15440                         echo "We won't be including <memory.h>."
15441                         val="$undef"
15442                 fi
15443                 $rm -f mem.h
15444                 ;;
15445         esac
15446 esac
15447 set i_memory
15448 eval $setvar
15449
15450 : can bcopy handle overlapping blocks?
15451 echo " "
15452 val="$undef"
15453 case "$d_memmove" in
15454 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15455 *)      case "$d_bcopy" in
15456         "$define")
15457                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15458                 $cat >try.c <<EOCP
15459 #$i_memory I_MEMORY
15460 #$i_stdlib I_STDLIB
15461 #$i_string I_STRING
15462 #$i_unistd I_UNISTD
15463 EOCP
15464         $cat >>try.c <<'EOCP'
15465 #include <stdio.h>
15466 #ifdef I_MEMORY
15467 #  include <memory.h>
15468 #endif
15469 #ifdef I_STDLIB
15470 #  include <stdlib.h>
15471 #endif
15472 #ifdef I_STRING
15473 #  include <string.h>
15474 #else
15475 #  include <strings.h>
15476 #endif
15477 #ifdef I_UNISTD
15478 #  include <unistd.h>  /* Needed for NetBSD */
15479 #endif
15480 int main()
15481 {
15482 char buf[128], abc[128];
15483 char *b;
15484 int len;
15485 int off;
15486 int align;
15487
15488 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15489    try to store the string in read-only memory. */
15490 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15491
15492 for (align = 7; align >= 0; align--) {
15493         for (len = 36; len; len--) {
15494                 b = buf+align;
15495                 bcopy(abc, b, len);
15496                 for (off = 1; off <= len; off++) {
15497                         bcopy(b, b+off, len);
15498                         bcopy(b+off, b, len);
15499                         if (bcmp(b, abc, len))
15500                                 exit(1);
15501                 }
15502         }
15503 }
15504 exit(0);
15505 }
15506 EOCP
15507                 set try
15508                 if eval $compile_ok; then
15509                         if ./try 2>/dev/null; then
15510                                 echo "Yes, it can."
15511                                 val="$define"
15512                         else
15513                                 echo "It can't, sorry."
15514                         fi
15515                 else
15516                         echo "(I can't compile the test program, so we'll assume not...)"
15517                 fi
15518                 ;;
15519         esac
15520         $rm -f try.* try core
15521         ;;
15522 esac
15523 set d_safebcpy
15524 eval $setvar
15525
15526 : can memcpy handle overlapping blocks?
15527 echo " "
15528 val="$undef"
15529 case "$d_memmove" in
15530 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15531 *)      case "$d_memcpy" in
15532         "$define")
15533                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15534                 $cat >try.c <<EOCP
15535 #$i_memory I_MEMORY
15536 #$i_stdlib I_STDLIB
15537 #$i_string I_STRING
15538 #$i_unistd I_UNISTD
15539 EOCP
15540         $cat >>try.c <<'EOCP'
15541 #include <stdio.h>
15542 #ifdef I_MEMORY
15543 #  include <memory.h>
15544 #endif
15545 #ifdef I_STDLIB
15546 #  include <stdlib.h>
15547 #endif
15548 #ifdef I_STRING
15549 #  include <string.h>
15550 #else
15551 #  include <strings.h>
15552 #endif
15553 #ifdef I_UNISTD
15554 #  include <unistd.h>  /* Needed for NetBSD */
15555 #endif
15556 int main()
15557 {
15558 char buf[128], abc[128];
15559 char *b;
15560 int len;
15561 int off;
15562 int align;
15563
15564 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15565    try to store the string in read-only memory. */
15566 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15567
15568 for (align = 7; align >= 0; align--) {
15569         for (len = 36; len; len--) {
15570                 b = buf+align;
15571                 memcpy(b, abc, len);
15572                 for (off = 1; off <= len; off++) {
15573                         memcpy(b+off, b, len);
15574                         memcpy(b, b+off, len);
15575                         if (memcmp(b, abc, len))
15576                                 exit(1);
15577                 }
15578         }
15579 }
15580 exit(0);
15581 }
15582 EOCP
15583                 set try
15584                 if eval $compile_ok; then
15585                         if ./try 2>/dev/null; then
15586                                 echo "Yes, it can."
15587                                 val="$define"
15588                         else
15589                                 echo "It can't, sorry."
15590                         fi
15591                 else
15592                         echo "(I can't compile the test program, so we'll assume not...)"
15593                 fi
15594                 ;;
15595         esac
15596         $rm -f try.* try core
15597         ;;
15598 esac
15599 set d_safemcpy
15600 eval $setvar
15601
15602 : can memcmp be trusted to compare relative magnitude?
15603 val="$undef"
15604 case "$d_memcmp" in
15605 "$define")
15606         echo " "
15607         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15608         $cat >try.c <<EOCP
15609 #$i_memory I_MEMORY
15610 #$i_stdlib I_STDLIB
15611 #$i_string I_STRING
15612 #$i_unistd I_UNISTD
15613 EOCP
15614         $cat >>try.c <<'EOCP'
15615 #include <stdio.h>
15616 #ifdef I_MEMORY
15617 #  include <memory.h>
15618 #endif
15619 #ifdef I_STDLIB
15620 #  include <stdlib.h>
15621 #endif
15622 #ifdef I_STRING
15623 #  include <string.h>
15624 #else
15625 #  include <strings.h>
15626 #endif
15627 #ifdef I_UNISTD
15628 #  include <unistd.h>  /* Needed for NetBSD */
15629 #endif
15630 int main()
15631 {
15632 char a = -1;
15633 char b = 0;
15634 if ((a < b) && memcmp(&a, &b, 1) < 0)
15635         exit(1);
15636 exit(0);
15637 }
15638 EOCP
15639         set try
15640         if eval $compile_ok; then
15641                 if $run ./try 2>/dev/null; then
15642                         echo "Yes, it can."
15643                         val="$define"
15644                 else
15645                         echo "No, it can't (it uses signed chars)."
15646                 fi
15647         else
15648                 echo "(I can't compile the test program, so we'll assume not...)"
15649         fi
15650         ;;
15651 esac
15652 $rm -f try.* try core
15653 set d_sanemcmp
15654 eval $setvar
15655
15656 : see if prototype for sbrk is available
15657 echo " "
15658 set d_sbrkproto sbrk $i_unistd unistd.h
15659 eval $hasproto
15660
15661 : see if select exists
15662 set select d_select
15663 eval $inlibc
15664
15665 : see if semctl exists
15666 set semctl d_semctl
15667 eval $inlibc
15668
15669 : see if semget exists
15670 set semget d_semget
15671 eval $inlibc
15672
15673 : see if semop exists
15674 set semop d_semop
15675 eval $inlibc
15676
15677 : see how much of the 'sem*(2)' library is present.
15678 h_sem=true
15679 echo " "
15680 case "$d_semctl$d_semget$d_semop" in
15681 *"$undef"*) h_sem=false;;
15682 esac
15683 case "$osname" in
15684 freebsd)
15685     case "`ipcs 2>&1`" in
15686     "SVID messages"*"not configured"*)
15687         echo "Your $osname does not have the sem*(2) configured." >&4
15688         h_sem=false
15689         val="$undef"
15690         set semctl d_semctl
15691         eval $setvar
15692         set semget d_semget
15693         eval $setvar
15694         set semop d_semop
15695         eval $setvar
15696         ;;
15697     esac
15698     ;;
15699 esac
15700 : we could also check for sys/ipc.h ...
15701 if $h_sem && $test `./findhdr sys/sem.h`; then
15702         echo "You have the full sem*(2) library." >&4
15703         val="$define"
15704 else
15705         echo "You don't have the full sem*(2) library." >&4
15706         val="$undef"
15707 fi
15708 set d_sem
15709 eval $setvar
15710
15711 : see whether sys/sem.h defines union semun
15712 echo " "
15713 $cat > try.c <<'END'
15714 #include <sys/types.h>
15715 #include <sys/ipc.h>
15716 #include <sys/sem.h>
15717 int main () { union semun semun; semun.buf = 0; }
15718 END
15719 set try
15720 if eval $compile; then
15721     echo "You have union semun in <sys/sem.h>." >&4
15722     val="$define"
15723 else
15724     echo "You do not have union semun in <sys/sem.h>." >&4
15725     val="$undef"
15726 fi
15727 $rm -f try try.c
15728 set d_union_semun
15729 eval $setvar
15730
15731 : see how to do semctl IPC_STAT
15732 case "$d_sem" in
15733 $define)
15734     echo " "
15735     $cat > try.h <<END
15736 #ifndef S_IRUSR
15737 #   ifdef S_IREAD
15738 #       define S_IRUSR S_IREAD
15739 #       define S_IWUSR S_IWRITE
15740 #       define S_IXUSR S_IEXEC
15741 #   else
15742 #       define S_IRUSR 0400
15743 #       define S_IWUSR 0200
15744 #       define S_IXUSR 0100
15745 #   endif
15746 #   define S_IRGRP (S_IRUSR>>3)
15747 #   define S_IWGRP (S_IWUSR>>3)
15748 #   define S_IXGRP (S_IXUSR>>3)
15749 #   define S_IROTH (S_IRUSR>>6)
15750 #   define S_IWOTH (S_IWUSR>>6)
15751 #   define S_IXOTH (S_IXUSR>>6)
15752 #endif
15753 #ifndef S_IRWXU
15754 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15755 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15756 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15757 #endif
15758 END
15759     : see whether semctl IPC_STAT can use union semun
15760     case "$d_semctl_semun" in
15761     '')
15762       val="$undef"
15763       $cat > try.c <<END
15764 #include <sys/types.h>
15765 #include <sys/ipc.h>
15766 #include <sys/sem.h>
15767 #include <sys/stat.h>
15768 #include <stdio.h>
15769 #include <errno.h>
15770 #include "try.h"
15771 #ifndef errno
15772 extern int errno;
15773 #endif
15774 #$d_union_semun HAS_UNION_SEMUN
15775 int main() {
15776     union semun
15777 #ifndef HAS_UNION_SEMUN
15778     {
15779         int val;
15780         struct semid_ds *buf;
15781         unsigned short *array;
15782     }
15783 #endif
15784     arg;
15785     int sem, st;
15786
15787 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15788     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15789     if (sem > -1) {
15790         struct semid_ds argbuf;
15791         arg.buf = &argbuf;
15792 #       ifdef IPC_STAT
15793         st = semctl(sem, 0, IPC_STAT, arg);
15794         if (st == 0)
15795             printf("semun\n");
15796         else
15797 #       endif /* IPC_STAT */
15798             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15799 #       ifdef IPC_RMID
15800         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15801 #       endif /* IPC_RMID */
15802             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15803     } else
15804 #endif /* IPC_PRIVATE && ... */
15805         printf("semget failed: errno = %d\n", errno);
15806   return 0;
15807 }
15808 END
15809       set try
15810       if eval $compile; then
15811           xxx=`$run ./try`
15812           case "$xxx" in
15813           semun) val="$define" ;;
15814           esac
15815       fi
15816       $rm -f try try.c
15817       set d_semctl_semun
15818       eval $setvar
15819       ;;
15820     esac
15821     case "$d_semctl_semun" in
15822     $define)
15823         echo "You can use union semun for semctl IPC_STAT." >&4
15824         also='also'
15825         ;;
15826     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15827         also=''
15828         ;;
15829     esac
15830
15831     : see whether semctl IPC_STAT can use struct semid_ds pointer
15832     case "$d_semctl_semid_ds" in
15833     '')
15834       val="$undef"
15835       $cat > try.c <<'END'
15836 #include <sys/types.h>
15837 #include <sys/ipc.h>
15838 #include <sys/sem.h>
15839 #include <sys/stat.h>
15840 #include "try.h"
15841 #include <stdio.h>
15842 #include <errno.h>
15843 #ifndef errno
15844 extern int errno;
15845 #endif
15846 int main() {
15847     struct semid_ds arg;
15848     int sem, st;
15849
15850 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15851     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15852     if (sem > -1) {
15853 #       ifdef IPC_STAT
15854         st = semctl(sem, 0, IPC_STAT, &arg);
15855         if (st == 0)
15856             printf("semid_ds\n");
15857         else
15858 #       endif /* IPC_STAT */
15859             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15860 #       ifdef IPC_RMID
15861         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15862 #       endif /* IPC_RMID */
15863             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15864     } else
15865 #endif /* IPC_PRIVATE && ... */
15866         printf("semget failed: errno = %d\n", errno);
15867
15868     return 0;
15869 }
15870 END
15871       set try
15872       if eval $compile; then
15873           xxx=`$run ./try`
15874           case "$xxx" in
15875           semid_ds) val="$define" ;;
15876           esac
15877       fi
15878       $rm -f try try.c
15879       set d_semctl_semid_ds
15880       eval $setvar
15881       ;;
15882     esac
15883     case "$d_semctl_semid_ds" in
15884     $define)
15885         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15886         ;;
15887     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15888         ;;
15889     esac
15890     $rm -f try.h
15891     ;;
15892 *)  val="$undef"
15893
15894     # We do not have the full sem*(2) library, so assume we can not
15895     # use either.
15896
15897     set d_semctl_semun
15898     eval $setvar
15899
15900     set d_semctl_semid_ds
15901     eval $setvar
15902     ;;
15903 esac
15904
15905 : see if sendmsg exists
15906 set sendmsg d_sendmsg
15907 eval $inlibc
15908
15909 : see if setegid exists
15910 set setegid d_setegid
15911 eval $inlibc
15912
15913 : see if seteuid exists
15914 set seteuid d_seteuid
15915 eval $inlibc
15916
15917 : see if setgrent exists
15918 set setgrent d_setgrent
15919 eval $inlibc
15920
15921 : see if setgrent_r exists
15922 set setgrent_r d_setgrent_r
15923 eval $inlibc
15924 case "$d_setgrent_r" in
15925 "$define")
15926         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15927         case "$d_setgrent_r_proto:$usethreads" in
15928         ":define")      d_setgrent_r_proto=define
15929                 set d_setgrent_r_proto setgrent_r $hdrs
15930                 eval $hasproto ;;
15931         *)      ;;
15932         esac
15933         case "$d_setgrent_r_proto" in
15934         define)
15935         case "$setgrent_r_proto" in
15936         ''|0) try='int setgrent_r(FILE**);'
15937         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15938         esac
15939         case "$setgrent_r_proto" in
15940         ''|0) try='void setgrent_r(FILE**);'
15941         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15942         esac
15943         case "$setgrent_r_proto" in
15944         ''|0)   d_setgrent_r=undef
15945                 setgrent_r_proto=0
15946                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15947         * )     case "$setgrent_r_proto" in
15948                 REENTRANT_PROTO*) ;;
15949                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15950                 esac
15951                 echo "Prototype: $try" ;;
15952         esac
15953         ;;
15954         *)      case "$usethreads" in
15955                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15956                 esac
15957                 d_setgrent_r=undef
15958                 setgrent_r_proto=0
15959                 ;;
15960         esac
15961         ;;
15962 *)      setgrent_r_proto=0
15963         ;;
15964 esac
15965
15966 : see if sethostent exists
15967 set sethostent d_sethent
15968 eval $inlibc
15969
15970 : see if sethostent_r exists
15971 set sethostent_r d_sethostent_r
15972 eval $inlibc
15973 case "$d_sethostent_r" in
15974 "$define")
15975         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15976         case "$d_sethostent_r_proto:$usethreads" in
15977         ":define")      d_sethostent_r_proto=define
15978                 set d_sethostent_r_proto sethostent_r $hdrs
15979                 eval $hasproto ;;
15980         *)      ;;
15981         esac
15982         case "$d_sethostent_r_proto" in
15983         define)
15984         case "$sethostent_r_proto" in
15985         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15986         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15987         esac
15988         case "$sethostent_r_proto" in
15989         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15990         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15991         esac
15992         case "$sethostent_r_proto" in
15993         ''|0)   d_sethostent_r=undef
15994                 sethostent_r_proto=0
15995                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15996         * )     case "$sethostent_r_proto" in
15997                 REENTRANT_PROTO*) ;;
15998                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15999                 esac
16000                 echo "Prototype: $try" ;;
16001         esac
16002         ;;
16003         *)      case "$usethreads" in
16004                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16005                 esac
16006                 d_sethostent_r=undef
16007                 sethostent_r_proto=0
16008                 ;;
16009         esac
16010         ;;
16011 *)      sethostent_r_proto=0
16012         ;;
16013 esac
16014
16015 : see if setitimer exists
16016 set setitimer d_setitimer
16017 eval $inlibc
16018
16019 : see if setlinebuf exists
16020 set setlinebuf d_setlinebuf
16021 eval $inlibc
16022
16023 : see if setlocale exists
16024 set setlocale d_setlocale
16025 eval $inlibc
16026
16027 : see if locale.h is available
16028 set locale.h i_locale
16029 eval $inhdr
16030
16031 : see if setlocale_r exists
16032 set setlocale_r d_setlocale_r
16033 eval $inlibc
16034 case "$d_setlocale_r" in
16035 "$define")
16036         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16037         case "$d_setlocale_r_proto:$usethreads" in
16038         ":define")      d_setlocale_r_proto=define
16039                 set d_setlocale_r_proto setlocale_r $hdrs
16040                 eval $hasproto ;;
16041         *)      ;;
16042         esac
16043         case "$d_setlocale_r_proto" in
16044         define)
16045         case "$setlocale_r_proto" in
16046         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16047         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16048         esac
16049         case "$setlocale_r_proto" in
16050         ''|0)   d_setlocale_r=undef
16051                 setlocale_r_proto=0
16052                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16053         * )     case "$setlocale_r_proto" in
16054                 REENTRANT_PROTO*) ;;
16055                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16056                 esac
16057                 echo "Prototype: $try" ;;
16058         esac
16059         ;;
16060         *)      case "$usethreads" in
16061                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16062                 esac
16063                 d_setlocale_r=undef
16064                 setlocale_r_proto=0
16065                 ;;
16066         esac
16067         ;;
16068 *)      setlocale_r_proto=0
16069         ;;
16070 esac
16071
16072 : see if setnetent exists
16073 set setnetent d_setnent
16074 eval $inlibc
16075
16076 : see if setnetent_r exists
16077 set setnetent_r d_setnetent_r
16078 eval $inlibc
16079 case "$d_setnetent_r" in
16080 "$define")
16081         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16082         case "$d_setnetent_r_proto:$usethreads" in
16083         ":define")      d_setnetent_r_proto=define
16084                 set d_setnetent_r_proto setnetent_r $hdrs
16085                 eval $hasproto ;;
16086         *)      ;;
16087         esac
16088         case "$d_setnetent_r_proto" in
16089         define)
16090         case "$setnetent_r_proto" in
16091         ''|0) try='int setnetent_r(int, struct netent_data*);'
16092         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16093         esac
16094         case "$setnetent_r_proto" in
16095         ''|0) try='void setnetent_r(int, struct netent_data*);'
16096         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16097         esac
16098         case "$setnetent_r_proto" in
16099         ''|0)   d_setnetent_r=undef
16100                 setnetent_r_proto=0
16101                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16102         * )     case "$setnetent_r_proto" in
16103                 REENTRANT_PROTO*) ;;
16104                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16105                 esac
16106                 echo "Prototype: $try" ;;
16107         esac
16108         ;;
16109         *)      case "$usethreads" in
16110                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16111                 esac
16112                 d_setnetent_r=undef
16113                 setnetent_r_proto=0
16114                 ;;
16115         esac
16116         ;;
16117 *)      setnetent_r_proto=0
16118         ;;
16119 esac
16120
16121 : see if setprotoent exists
16122 set setprotoent d_setpent
16123 eval $inlibc
16124
16125 : see if setpgid exists
16126 set setpgid d_setpgid
16127 eval $inlibc
16128
16129 : see if setpgrp2 exists
16130 set setpgrp2 d_setpgrp2
16131 eval $inlibc
16132
16133 : see if setpriority exists
16134 set setpriority d_setprior
16135 eval $inlibc
16136
16137 : see if setproctitle exists
16138 set setproctitle d_setproctitle
16139 eval $inlibc
16140
16141 : see if setprotoent_r exists
16142 set setprotoent_r d_setprotoent_r
16143 eval $inlibc
16144 case "$d_setprotoent_r" in
16145 "$define")
16146         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16147         case "$d_setprotoent_r_proto:$usethreads" in
16148         ":define")      d_setprotoent_r_proto=define
16149                 set d_setprotoent_r_proto setprotoent_r $hdrs
16150                 eval $hasproto ;;
16151         *)      ;;
16152         esac
16153         case "$d_setprotoent_r_proto" in
16154         define)
16155         case "$setprotoent_r_proto" in
16156         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16157         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16158         esac
16159         case "$setprotoent_r_proto" in
16160         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16161         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16162         esac
16163         case "$setprotoent_r_proto" in
16164         ''|0)   d_setprotoent_r=undef
16165                 setprotoent_r_proto=0
16166                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16167         * )     case "$setprotoent_r_proto" in
16168                 REENTRANT_PROTO*) ;;
16169                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16170                 esac
16171                 echo "Prototype: $try" ;;
16172         esac
16173         ;;
16174         *)      case "$usethreads" in
16175                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16176                 esac
16177                 d_setprotoent_r=undef
16178                 setprotoent_r_proto=0
16179                 ;;
16180         esac
16181         ;;
16182 *)      setprotoent_r_proto=0
16183         ;;
16184 esac
16185
16186 : see if setpwent exists
16187 set setpwent d_setpwent
16188 eval $inlibc
16189
16190 : see if setpwent_r exists
16191 set setpwent_r d_setpwent_r
16192 eval $inlibc
16193 case "$d_setpwent_r" in
16194 "$define")
16195         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16196         case "$d_setpwent_r_proto:$usethreads" in
16197         ":define")      d_setpwent_r_proto=define
16198                 set d_setpwent_r_proto setpwent_r $hdrs
16199                 eval $hasproto ;;
16200         *)      ;;
16201         esac
16202         case "$d_setpwent_r_proto" in
16203         define)
16204         case "$setpwent_r_proto" in
16205         ''|0) try='int setpwent_r(FILE**);'
16206         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16207         esac
16208         case "$setpwent_r_proto" in
16209         ''|0) try='void setpwent_r(FILE**);'
16210         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16211         esac
16212         case "$setpwent_r_proto" in
16213         ''|0)   d_setpwent_r=undef
16214                 setpwent_r_proto=0
16215                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16216         * )     case "$setpwent_r_proto" in
16217                 REENTRANT_PROTO*) ;;
16218                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16219                 esac
16220                 echo "Prototype: $try" ;;
16221         esac
16222         ;;
16223         *)      case "$usethreads" in
16224                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16225                 esac
16226                 d_setpwent_r=undef
16227                 setpwent_r_proto=0
16228                 ;;
16229         esac
16230         ;;
16231 *)      setpwent_r_proto=0
16232         ;;
16233 esac
16234
16235 : see if setregid exists
16236 set setregid d_setregid
16237 eval $inlibc
16238 set setresgid d_setresgid
16239 eval $inlibc
16240
16241 : see if setreuid exists
16242 set setreuid d_setreuid
16243 eval $inlibc
16244 set setresuid d_setresuid
16245 eval $inlibc
16246
16247 : see if setrgid exists
16248 set setrgid d_setrgid
16249 eval $inlibc
16250
16251 : see if setruid exists
16252 set setruid d_setruid
16253 eval $inlibc
16254
16255 : see if setservent exists
16256 set setservent d_setsent
16257 eval $inlibc
16258
16259 : see if setservent_r exists
16260 set setservent_r d_setservent_r
16261 eval $inlibc
16262 case "$d_setservent_r" in
16263 "$define")
16264         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16265         case "$d_setservent_r_proto:$usethreads" in
16266         ":define")      d_setservent_r_proto=define
16267                 set d_setservent_r_proto setservent_r $hdrs
16268                 eval $hasproto ;;
16269         *)      ;;
16270         esac
16271         case "$d_setservent_r_proto" in
16272         define)
16273         case "$setservent_r_proto" in
16274         ''|0) try='int setservent_r(int, struct servent_data*);'
16275         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16276         esac
16277         case "$setservent_r_proto" in
16278         ''|0) try='void setservent_r(int, struct servent_data*);'
16279         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16280         esac
16281         case "$setservent_r_proto" in
16282         ''|0)   d_setservent_r=undef
16283                 setservent_r_proto=0
16284                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16285         * )     case "$setservent_r_proto" in
16286                 REENTRANT_PROTO*) ;;
16287                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16288                 esac
16289                 echo "Prototype: $try" ;;
16290         esac
16291         ;;
16292         *)      case "$usethreads" in
16293                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16294                 esac
16295                 d_setservent_r=undef
16296                 setservent_r_proto=0
16297                 ;;
16298         esac
16299         ;;
16300 *)      setservent_r_proto=0
16301         ;;
16302 esac
16303
16304 : see if setsid exists
16305 set setsid d_setsid
16306 eval $inlibc
16307
16308 : see if setvbuf exists
16309 set setvbuf d_setvbuf
16310 eval $inlibc
16311
16312 : see if sfio.h is available
16313 set sfio.h i_sfio
16314 eval $inhdr
16315
16316
16317 : see if sfio library is available
16318 case "$i_sfio" in
16319 $define)
16320         val=''
16321         set sfreserve val
16322         eval $inlibc
16323         ;;
16324 *)
16325         val="$undef"
16326         ;;
16327 esac
16328 : Ok, but do we want to use it.
16329 case "$val" in
16330 $define)
16331         case "$usesfio" in
16332         true|$define|[yY]*) dflt='y';;
16333         *) dflt='n';;
16334         esac
16335         echo "$package can use the sfio library, but it is experimental."
16336         case "$useperlio" in
16337         "$undef")
16338             echo "For sfio also the PerlIO abstraction layer is needed."
16339             echo "Earlier you said you wouldn't want that."
16340             ;;
16341         esac
16342         rp="You seem to have sfio available, do you want to try using it?"
16343         . ./myread
16344         case "$ans" in
16345         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16346                 useperlio="$define"
16347                 val="$define"
16348                 ;;
16349         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16350                 val="$undef"
16351                 ;;
16352         esac
16353         ;;
16354 *)      case "$usesfio" in
16355         true|$define|[yY]*)
16356                 echo "Sorry, cannot find sfio on this machine." >&4
16357                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16358                 val="$undef"
16359                 ;;
16360         esac
16361         ;;
16362 esac
16363 set d_sfio
16364 eval $setvar
16365 case "$d_sfio" in
16366 $define) usesfio='true';;
16367 *) usesfio='false';;
16368 esac
16369 case "$d_sfio" in
16370 $define) ;;
16371 *)      : Remove sfio from list of libraries to use
16372         case "$libs" in
16373         *-lsfio*)
16374                 echo "Removing unneeded -lsfio from library list" >&4
16375                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16376                 shift
16377                 libs="$*"
16378                 echo "libs = $libs" >&4
16379                 ;;
16380         esac
16381 ;;
16382 esac
16383
16384
16385 : see if shmctl exists
16386 set shmctl d_shmctl
16387 eval $inlibc
16388
16389 : see if shmget exists
16390 set shmget d_shmget
16391 eval $inlibc
16392
16393 : see if shmat exists
16394 set shmat d_shmat
16395 eval $inlibc
16396 : see what shmat returns
16397 case "$d_shmat" in
16398 "$define")
16399         $cat >shmat.c <<'END'
16400 #include <sys/shm.h>
16401 void *shmat();
16402 END
16403         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16404                 shmattype='void *'
16405         else
16406                 shmattype='char *'
16407         fi
16408         echo "and it returns ($shmattype)." >&4
16409         : see if a prototype for shmat is available
16410         xxx=`./findhdr sys/shm.h`
16411         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16412         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16413                 val="$define"
16414         else
16415                 val="$undef"
16416         fi
16417         $rm -f shmat.[co]
16418         ;;
16419 *)
16420         val="$undef"
16421         ;;
16422 esac
16423 set d_shmatprototype
16424 eval $setvar
16425
16426 : see if shmdt exists
16427 set shmdt d_shmdt
16428 eval $inlibc
16429
16430 : see how much of the 'shm*(2)' library is present.
16431 h_shm=true
16432 echo " "
16433 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16434 *"$undef"*) h_shm=false;;
16435 esac
16436 case "$osname" in
16437 freebsd)
16438     case "`ipcs 2>&1`" in
16439     "SVID shared memory"*"not configured"*)
16440         echo "Your $osname does not have the shm*(2) configured." >&4
16441         h_shm=false
16442         val="$undef"
16443         set shmctl d_shmctl
16444         evat $setvar
16445         set shmget d_shmget
16446         evat $setvar
16447         set shmat d_shmat
16448         evat $setvar
16449         set shmdt d_shmdt
16450         evat $setvar
16451         ;;
16452     esac
16453     ;;
16454 esac
16455 : we could also check for sys/ipc.h ...
16456 if $h_shm && $test `./findhdr sys/shm.h`; then
16457         echo "You have the full shm*(2) library." >&4
16458         val="$define"
16459 else
16460         echo "You don't have the full shm*(2) library." >&4
16461         val="$undef"
16462 fi
16463 set d_shm
16464 eval $setvar
16465
16466 echo " "
16467 : see if we have sigaction
16468 if set sigaction val -f d_sigaction; eval $csym; $val; then
16469         echo 'sigaction() found.' >&4
16470         $cat > try.c <<EOP
16471 #include <stdio.h>
16472 #include <sys/types.h>
16473 #include <signal.h>
16474 #$i_stdlib I_STDLIB
16475 #ifdef I_STDLIB
16476 #include <stdlib.h>
16477 #endif
16478 int main()
16479 {
16480     struct sigaction act, oact;
16481     act.sa_flags = 0;
16482     oact.sa_handler = 0;
16483     /* so that act and oact are used */
16484     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16485 }
16486 EOP
16487         set try
16488         if eval $compile_ok; then
16489                 val="$define"
16490         else
16491                 echo "But you don't seem to have a useable struct sigaction." >&4
16492                 val="$undef"
16493         fi
16494 else
16495         echo 'sigaction NOT found.' >&4
16496         val="$undef"
16497 fi
16498 set d_sigaction; eval $setvar
16499 $rm -f try try$_o try.c
16500
16501 : see if sigprocmask exists
16502 set sigprocmask d_sigprocmask
16503 eval $inlibc
16504
16505 : see if sigsetjmp exists
16506 echo " "
16507 case "$d_sigsetjmp" in
16508 '')
16509         $cat >try.c <<EOP
16510 #include <setjmp.h>
16511 #$i_stdlib I_STDLIB
16512 #ifdef I_STDLIB
16513 #include <stdlib.h>
16514 #endif
16515 sigjmp_buf env;
16516 int set = 1;
16517 int main()
16518 {
16519         if (sigsetjmp(env,1))
16520                 exit(set);
16521         set = 0;
16522         siglongjmp(env, 1);
16523         exit(1);
16524 }
16525 EOP
16526         set try
16527         if eval $compile; then
16528                 if $run ./try >/dev/null 2>&1; then
16529                         echo "POSIX sigsetjmp found." >&4
16530                         val="$define"
16531                 else
16532                         $cat >&4 <<EOM
16533 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16534 I'll ignore them.
16535 EOM
16536                         val="$undef"
16537                 fi
16538         else
16539                 echo "sigsetjmp not found." >&4
16540                 val="$undef"
16541         fi
16542         ;;
16543 *) val="$d_sigsetjmp"
16544         case "$d_sigsetjmp" in
16545         $define) echo "POSIX sigsetjmp found." >&4;;
16546         $undef) echo "sigsetjmp not found." >&4;;
16547         esac
16548         ;;
16549 esac
16550 set d_sigsetjmp
16551 eval $setvar
16552 $rm -f try.c try
16553
16554 : see if snprintf exists
16555 set snprintf d_snprintf
16556 eval $inlibc
16557
16558 : see if vsnprintf exists
16559 set vsnprintf d_vsnprintf
16560 eval $inlibc
16561
16562 case "$d_snprintf-$d_vsnprintf" in
16563 "$define-$define")
16564     $cat <<EOM
16565 Checking whether your snprintf() and vsnprintf() work okay...
16566 EOM
16567     $cat >try.c <<'EOCP'
16568 /* v?snprintf testing logic courtesy of Russ Allbery.
16569  * According to C99:
16570  * - if the buffer is too short it still must be \0-terminated
16571  * - if the buffer is too short the potentially required length
16572  *   must be returned and not -1
16573  * - if the buffer is NULL the potentially required length
16574  *   must be returned and not -1 or core dump
16575  */
16576 #include <stdio.h>
16577 #include <stdarg.h>
16578
16579 char buf[2];
16580
16581 int test (char *format, ...)
16582 {
16583     va_list args;
16584     int count;
16585
16586     va_start (args, format);
16587     count = vsnprintf (buf, sizeof buf, format, args);
16588     va_end (args);
16589     return count;
16590 }
16591
16592 int main ()
16593 {
16594     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16595              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16596 }
16597 EOCP
16598     set try
16599     if eval $compile; then
16600         `$run ./try`
16601         case "$?" in
16602         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16603         *) cat <<EOM >&4
16604 Your snprintf() and snprintf() don't seem to be working okay.
16605 EOM
16606            d_snprintf="$undef"
16607            d_vsnprintf="$undef"
16608            ;;
16609         esac
16610     else
16611         echo "(I can't seem to compile the test program--assuming they don't)"
16612         d_snprintf="$undef"
16613         d_vsnprintf="$undef"
16614     fi
16615     $rm -f try.* try core core.try.*
16616     ;;
16617 esac
16618
16619 : see if sockatmark exists
16620 set sockatmark d_sockatmark
16621 eval $inlibc
16622
16623 : see if prototype for sockatmark is available
16624 echo " "
16625 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16626 eval $hasproto
16627
16628 : see if socks5_init exists
16629 set socks5_init d_socks5_init
16630 eval $inlibc
16631
16632 : see if sprintf returns the length of the string in the buffer as per ANSI
16633 $echo "Checking whether sprintf returns the length of the string..." >&4
16634 $cat <<EOP >try.c
16635 #include <stdio.h>
16636 #$i_stdlib I_STDLIB
16637 #ifdef I_STDLIB
16638 #include <stdlib.h>
16639 #endif
16640 #$i_string I_STRING
16641 #ifdef I_STRING
16642 #  include <string.h>
16643 #else
16644 #  include <strings.h>
16645 #endif
16646 #$i_math I_MATH
16647 #ifdef I_MATH
16648 #include <math.h>
16649 #endif
16650
16651 char buffer[256];
16652
16653 int check (size_t expect, int test) {
16654   size_t got = strlen(buffer);
16655   if (expect == got)
16656     return 0;
16657
16658   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16659        test, buffer);
16660   exit (test);
16661 }
16662
16663 int main(int argc, char **argv) {
16664   int test = 0;
16665
16666   check(sprintf(buffer, ""), ++test);
16667   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16668   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16669
16670   return 0;
16671 }
16672 EOP
16673 set try
16674
16675 d_sprintf_returns_strlen="$undef"
16676 if eval $compile; then
16677     xxx="`$run ./try`"
16678     case "$?" in
16679         0) cat >&4 <<EOM
16680 sprintf returns the length of the string (as ANSI says it should)
16681 EOM
16682         d_sprintf_returns_strlen="$define"
16683         ;;
16684         *) cat >&4 <<EOM
16685 sprintf does not return the length of the string (how old is this system?)
16686 EOM
16687         d_sprintf_returns_strlen="$undef"
16688         ;;
16689     esac
16690 fi
16691
16692 $rm -f try.* try
16693
16694 : see if srand48_r exists
16695 set srand48_r d_srand48_r
16696 eval $inlibc
16697 case "$d_srand48_r" in
16698 "$define")
16699         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16700         case "$d_srand48_r_proto:$usethreads" in
16701         ":define")      d_srand48_r_proto=define
16702                 set d_srand48_r_proto srand48_r $hdrs
16703                 eval $hasproto ;;
16704         *)      ;;
16705         esac
16706         case "$d_srand48_r_proto" in
16707         define)
16708         case "$srand48_r_proto" in
16709         ''|0) try='int srand48_r(long, struct drand48_data*);'
16710         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16711         esac
16712         case "$srand48_r_proto" in
16713         ''|0)   d_srand48_r=undef
16714                 srand48_r_proto=0
16715                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16716         * )     case "$srand48_r_proto" in
16717                 REENTRANT_PROTO*) ;;
16718                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16719                 esac
16720                 echo "Prototype: $try" ;;
16721         esac
16722         ;;
16723         *)      case "$usethreads" in
16724                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16725                 esac
16726                 d_srand48_r=undef
16727                 srand48_r_proto=0
16728                 ;;
16729         esac
16730         ;;
16731 *)      srand48_r_proto=0
16732         ;;
16733 esac
16734
16735 : see if srandom_r exists
16736 set srandom_r d_srandom_r
16737 eval $inlibc
16738 case "$d_srandom_r" in
16739 "$define")
16740         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16741         case "$d_srandom_r_proto:$usethreads" in
16742         ":define")      d_srandom_r_proto=define
16743                 set d_srandom_r_proto srandom_r $hdrs
16744                 eval $hasproto ;;
16745         *)      ;;
16746         esac
16747         case "$d_srandom_r_proto" in
16748         define)
16749         case "$srandom_r_proto" in
16750         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16751         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16752         esac
16753         case "$srandom_r_proto" in
16754         ''|0)   d_srandom_r=undef
16755                 srandom_r_proto=0
16756                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16757         * )     case "$srandom_r_proto" in
16758                 REENTRANT_PROTO*) ;;
16759                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16760                 esac
16761                 echo "Prototype: $try" ;;
16762         esac
16763         ;;
16764         *)      case "$usethreads" in
16765                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16766                 esac
16767                 d_srandom_r=undef
16768                 srandom_r_proto=0
16769                 ;;
16770         esac
16771         ;;
16772 *)      srandom_r_proto=0
16773         ;;
16774 esac
16775
16776 : see if prototype for setresgid is available
16777 echo " "
16778 set d_sresgproto setresgid $i_unistd unistd.h
16779 eval $hasproto
16780
16781 : see if prototype for setresuid is available
16782 echo " "
16783 set d_sresuproto setresuid $i_unistd unistd.h
16784 eval $hasproto
16785
16786 : see if sys/stat.h is available
16787 set sys/stat.h i_sysstat
16788 eval $inhdr
16789
16790
16791 : see if stat knows about block sizes
16792 echo " "
16793 echo "Checking to see if your struct stat has st_blocks field..." >&4
16794 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16795 eval $hasfield
16796
16797
16798 : see if this is a sys/vfs.h system
16799 set sys/vfs.h i_sysvfs
16800 eval $inhdr
16801
16802
16803 : see if this is a sys/statfs.h system
16804 set sys/statfs.h i_sysstatfs
16805 eval $inhdr
16806
16807
16808 echo " "
16809 echo "Checking to see if your system supports struct statfs..." >&4
16810 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
16811 eval $hasstruct
16812 case "$d_statfs_s" in
16813 "$define")      echo "Yes, it does."   ;;
16814 *)              echo "No, it doesn't." ;;
16815 esac
16816
16817
16818
16819 : see if struct statfs knows about f_flags
16820 case "$d_statfs_s" in
16821 define) 
16822         echo " "
16823         echo "Checking to see if your struct statfs has f_flags field..." >&4
16824         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
16825         eval $hasfield
16826         ;;
16827 *)      val="$undef"
16828         set d_statfs_f_flags
16829         eval $setvar
16830         ;;
16831 esac
16832 case "$d_statfs_f_flags" in
16833 "$define")      echo "Yes, it does."   ;;
16834 *)              echo "No, it doesn't." ;;
16835 esac
16836
16837 $cat >&4 <<EOM
16838 Checking how to access stdio streams by file descriptor number...
16839 EOM
16840 case "$stdio_stream_array" in
16841 '')     $cat >try.c <<EOCP
16842 #include <stdio.h>
16843 int main() {
16844   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16845     printf("yes\n");
16846 }
16847 EOCP
16848         for s in _iob __iob __sF
16849         do
16850                 set try -DSTDIO_STREAM_ARRAY=$s
16851                 if eval $compile; then
16852                         case "`$run ./try`" in
16853                         yes)    stdio_stream_array=$s; break ;;
16854                         esac
16855                 fi
16856         done
16857         $rm -f try.* try$exe_ext
16858 esac
16859 case "$stdio_stream_array" in
16860 '')     $cat >&4 <<EOM
16861 I can't figure out how to access stdio streams by file descriptor number.
16862 EOM
16863         d_stdio_stream_array="$undef"
16864         ;;
16865 *)      $cat >&4 <<EOM
16866 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16867 EOM
16868         d_stdio_stream_array="$define"
16869         ;;
16870 esac
16871
16872 : see if strcoll exists
16873 set strcoll d_strcoll
16874 eval $inlibc
16875
16876 : check for structure copying
16877 echo " "
16878 echo "Checking to see if your C compiler can copy structs..." >&4
16879 $cat >try.c <<'EOCP'
16880 int main()
16881 {
16882         struct blurfl {
16883                 int dyick;
16884         } foo, bar;
16885
16886         foo = bar;
16887 }
16888 EOCP
16889 if $cc -c try.c >/dev/null 2>&1 ; then
16890         val="$define"
16891         echo "Yup, it can."
16892 else
16893         val="$undef"
16894         echo "Nope, it can't."
16895 fi
16896 set d_strctcpy
16897 eval $setvar
16898 $rm -f try.*
16899
16900 : see if strerror and/or sys_errlist[] exist
16901 echo " "
16902 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16903     if set strerror val -f d_strerror; eval $csym; $val; then
16904                 echo 'strerror() found.' >&4
16905                 d_strerror="$define"
16906                 d_strerrm='strerror(e)'
16907                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16908                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16909                         d_syserrlst="$define"
16910                 else
16911                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16912                         d_syserrlst="$undef"
16913                 fi
16914     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16915                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16916                 echo 'strerror() found in string header.' >&4
16917                 d_strerror="$define"
16918                 d_strerrm='strerror(e)'
16919                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16920                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16921                                 d_syserrlst="$define"
16922                 else
16923                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16924                         d_syserrlst="$undef"
16925                 fi
16926     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16927                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16928                 d_strerror="$undef"
16929                 d_syserrlst="$define"
16930                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16931     else
16932                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16933                 d_strerror="$undef"
16934                 d_syserrlst="$undef"
16935                 d_strerrm='"unknown"'
16936     fi
16937 fi
16938
16939 : see if strerror_r exists
16940 set strerror_r d_strerror_r
16941 eval $inlibc
16942 case "$d_strerror_r" in
16943 "$define")
16944         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16945         case "$d_strerror_r_proto:$usethreads" in
16946         ":define")      d_strerror_r_proto=define
16947                 set d_strerror_r_proto strerror_r $hdrs
16948                 eval $hasproto ;;
16949         *)      ;;
16950         esac
16951         case "$d_strerror_r_proto" in
16952         define)
16953         case "$strerror_r_proto" in
16954         ''|0) try='int strerror_r(int, char*, size_t);'
16955         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16956         esac
16957         case "$strerror_r_proto" in
16958         ''|0) try='int strerror_r(int, char*, int);'
16959         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16960         esac
16961         case "$strerror_r_proto" in
16962         ''|0) try='char* strerror_r(int, char*, size_t);'
16963         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16964         esac
16965         case "$strerror_r_proto" in
16966         ''|0)   d_strerror_r=undef
16967                 strerror_r_proto=0
16968                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16969         * )     case "$strerror_r_proto" in
16970                 REENTRANT_PROTO*) ;;
16971                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16972                 esac
16973                 echo "Prototype: $try" ;;
16974         esac
16975         ;;
16976         *)      case "$usethreads" in
16977                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16978                 esac
16979                 d_strerror_r=undef
16980                 strerror_r_proto=0
16981                 ;;
16982         esac
16983         ;;
16984 *)      strerror_r_proto=0
16985         ;;
16986 esac
16987
16988 : see if strftime exists
16989 set strftime d_strftime
16990 eval $inlibc
16991
16992 : see if strlcat exists
16993 set strlcat d_strlcat
16994 eval $inlibc
16995
16996 : see if strlcpy exists
16997 set strlcpy d_strlcpy
16998 eval $inlibc
16999
17000 : see if strtod exists
17001 set strtod d_strtod
17002 eval $inlibc
17003
17004 : see if strtol exists
17005 set strtol d_strtol
17006 eval $inlibc
17007
17008 : see if strtold exists
17009 set strtold d_strtold
17010 eval $inlibc
17011
17012 : see if strtoll exists
17013 set strtoll d_strtoll
17014 eval $inlibc
17015
17016 case "$d_longlong-$d_strtoll" in
17017 "$define-$define")
17018         $cat <<EOM
17019 Checking whether your strtoll() works okay...
17020 EOM
17021         $cat >try.c <<'EOCP'
17022 #include <errno.h>
17023 #ifdef __hpux
17024 #define strtoll __strtoll
17025 #endif
17026 #ifdef __EMX__
17027 #define strtoll _strtoll
17028 #endif
17029 #include <stdio.h>
17030 extern long long int strtoll(char *s, char **, int); 
17031 static int bad = 0;
17032 int check(char *s, long long ell, int een) {
17033         long long gll;
17034         errno = 0;
17035         gll = strtoll(s, 0, 10);
17036         if (!((gll == ell) && (errno == een)))
17037                 bad++;
17038 }
17039 int main() {
17040         check(" 1",                                      1LL, 0);
17041         check(" 0",                                      0LL, 0);
17042         check("-1",                                     -1LL, 0);
17043         check("-9223372036854775808", -9223372036854775808LL, 0);
17044         check("-9223372036854775808", -9223372036854775808LL, 0);
17045         check(" 9223372036854775807",  9223372036854775807LL, 0);
17046         check("-9223372036854775808", -9223372036854775808LL, 0);
17047         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17048         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17049         if (!bad)
17050                 printf("ok\n");
17051 }
17052 EOCP
17053         set try
17054         if eval $compile; then
17055                 yyy=`$run ./try`
17056                 case "$yyy" in
17057                 ok) echo "Your strtoll() seems to be working okay." ;;
17058                 *) cat <<EOM >&4
17059 Your strtoll() doesn't seem to be working okay.
17060 EOM
17061                    d_strtoll="$undef"
17062                    ;;
17063                 esac
17064         else
17065                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17066                 d_strtoll="$undef"
17067         fi
17068         ;;
17069 esac
17070
17071 : see if strtoq exists
17072 set strtoq d_strtoq
17073 eval $inlibc
17074
17075 : see if strtoul exists
17076 set strtoul d_strtoul
17077 eval $inlibc
17078
17079 case "$d_strtoul" in
17080 "$define")
17081         $cat <<EOM
17082 Checking whether your strtoul() works okay...
17083 EOM
17084         $cat >try.c <<'EOCP'
17085 #include <errno.h>
17086 #include <stdio.h>
17087 extern unsigned long int strtoul(char *s, char **, int); 
17088 static int bad = 0;
17089 void check(char *s, unsigned long eul, int een) {
17090         unsigned long gul;
17091         errno = 0;
17092         gul = strtoul(s, 0, 10);
17093         if (!((gul == eul) && (errno == een)))
17094                 bad++;
17095 }
17096 int main() {
17097         check(" 1", 1L, 0);
17098         check(" 0", 0L, 0);
17099 EOCP
17100         case "$longsize" in
17101         8)
17102             $cat >>try.c <<'EOCP'
17103         check("18446744073709551615", 18446744073709551615UL, 0);
17104         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17105 #if 0 /* strtoul() for /^-/ strings is undefined. */
17106         check("-1", 18446744073709551615UL, 0);
17107         check("-18446744073709551614", 2, 0);
17108         check("-18446744073709551615", 1, 0);
17109         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17110         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17111 #endif
17112 EOCP
17113                 ;;
17114         4)
17115                     $cat >>try.c <<'EOCP'
17116         check("4294967295", 4294967295UL, 0);
17117         check("4294967296", 4294967295UL, ERANGE);
17118 #if 0 /* strtoul() for /^-/ strings is undefined. */
17119         check("-1", 4294967295UL, 0);
17120         check("-4294967294", 2, 0);
17121         check("-4294967295", 1, 0);
17122         check("-4294967296", 4294967295UL, ERANGE);
17123         check("-4294967297", 4294967295UL, ERANGE);
17124 #endif
17125 EOCP
17126                 ;;
17127         *)
17128 : Should we write these tests to be more portable by sprintf-ing
17129 : ~0 and then manipulating that char string as input for strtol?
17130                 ;;
17131         esac
17132         $cat >>try.c <<'EOCP'
17133         if (!bad)
17134                 printf("ok\n");
17135         return 0;
17136 }
17137 EOCP
17138         set try
17139         if eval $compile; then
17140                 case "`$run ./try`" in
17141                 ok) echo "Your strtoul() seems to be working okay." ;;
17142                 *) cat <<EOM >&4
17143 Your strtoul() doesn't seem to be working okay.
17144 EOM
17145                    d_strtoul="$undef"
17146                    ;;
17147                 esac
17148         fi
17149         ;;
17150 esac
17151
17152 : see if strtoull exists
17153 set strtoull d_strtoull
17154 eval $inlibc
17155
17156 case "$d_longlong-$d_strtoull" in
17157 "$define-$define")
17158         $cat <<EOM
17159 Checking whether your strtoull() works okay...
17160 EOM
17161         $cat >try.c <<'EOCP'
17162 #include <errno.h>
17163 #ifdef __hpux
17164 #define strtoull __strtoull
17165 #endif
17166 #include <stdio.h>
17167 extern unsigned long long int strtoull(char *s, char **, int); 
17168 static int bad = 0;
17169 int check(char *s, long long eull, int een) {
17170         long long gull;
17171         errno = 0;
17172         gull = strtoull(s, 0, 10);
17173         if (!((gull == eull) && (errno == een)))
17174                 bad++;
17175 }
17176 int main() {
17177         check(" 1",                                        1LL, 0);
17178         check(" 0",                                        0LL, 0);
17179         check("18446744073709551615",  18446744073709551615ULL, 0);
17180         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17181 #if 0 /* strtoull() for /^-/ strings is undefined. */
17182         check("-1",                    18446744073709551615ULL, 0);
17183         check("-18446744073709551614",                     2LL, 0);
17184         check("-18446744073709551615",                     1LL, 0);
17185         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17186         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17187 #endif
17188         if (!bad)
17189                 printf("ok\n");
17190 }
17191 EOCP
17192         set try
17193         if eval $compile; then
17194                 case "`$run ./try`" in
17195                 ok) echo "Your strtoull() seems to be working okay." ;;
17196                 *) cat <<EOM >&4
17197 Your strtoull() doesn't seem to be working okay.
17198 EOM
17199                    d_strtoull="$undef"
17200                    ;;
17201                 esac
17202         fi
17203         ;;
17204 esac
17205
17206 : see if strtouq exists
17207 set strtouq d_strtouq
17208 eval $inlibc
17209
17210 case "$d_strtouq" in
17211 "$define")
17212         $cat <<EOM
17213 Checking whether your strtouq() works okay...
17214 EOM
17215         $cat >try.c <<'EOCP'
17216 #include <errno.h>
17217 #include <stdio.h>
17218 extern unsigned long long int strtouq(char *s, char **, int); 
17219 static int bad = 0;
17220 void check(char *s, unsigned long long eull, int een) {
17221         unsigned long long gull;
17222         errno = 0;
17223         gull = strtouq(s, 0, 10);
17224         if (!((gull == eull) && (errno == een)))
17225                 bad++;
17226 }
17227 int main() {
17228         check(" 1",                                        1LL, 0);
17229         check(" 0",                                        0LL, 0);
17230         check("18446744073709551615",  18446744073709551615ULL, 0);
17231         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17232 #if 0 /* strtouq() for /^-/ strings is undefined. */
17233         check("-1",                    18446744073709551615ULL, 0);
17234         check("-18446744073709551614",                     2LL, 0);
17235         check("-18446744073709551615",                     1LL, 0);
17236         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17237         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17238 #endif
17239         if (!bad)
17240                 printf("ok\n");
17241         return 0;
17242 }
17243 EOCP
17244         set try
17245         if eval $compile; then
17246                 case "`$run ./try`" in
17247                 ok) echo "Your strtouq() seems to be working okay." ;;
17248                 *) cat <<EOM >&4
17249 Your strtouq() doesn't seem to be working okay.
17250 EOM
17251                    d_strtouq="$undef"
17252                    ;;
17253                 esac
17254         fi
17255         ;;
17256 esac
17257
17258 : see if strxfrm exists
17259 set strxfrm d_strxfrm
17260 eval $inlibc
17261
17262 : see if symlink exists
17263 set symlink d_symlink
17264 eval $inlibc
17265
17266 : see if syscall exists
17267 set syscall d_syscall
17268 eval $inlibc
17269
17270 : see if prototype for syscall is available
17271 echo " "
17272 set d_syscallproto syscall $i_unistd unistd.h
17273 eval $hasproto
17274
17275 : see if sysconf exists
17276 set sysconf d_sysconf
17277 eval $inlibc
17278
17279 : see if system exists
17280 set system d_system
17281 eval $inlibc
17282
17283 : see if tcgetpgrp exists
17284 set tcgetpgrp d_tcgetpgrp
17285 eval $inlibc
17286
17287 : see if tcsetpgrp exists
17288 set tcsetpgrp d_tcsetpgrp
17289 eval $inlibc
17290
17291 : see if prototype for telldir is available
17292 echo " "
17293 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17294 eval $hasproto
17295
17296 : see if time exists
17297 echo " "
17298 if test "X$d_time" = X -o X"$timetype" = X; then
17299     if set time val -f d_time; eval $csym; $val; then
17300                 echo 'time() found.' >&4
17301                 val="$define"
17302                 rp="What is the type returned by time() on this system?"
17303                 set time_t timetype long stdio.h sys/types.h
17304                 eval $typedef_ask
17305     else
17306                 echo 'time() not found, hope that will do.' >&4
17307                 val="$undef"
17308                 timetype='int';
17309     fi
17310     set d_time
17311     eval $setvar
17312 fi
17313
17314 : see if this is a sys/times.h system
17315 set sys/times.h i_systimes
17316 eval $inhdr
17317
17318 : see if times exists
17319 echo " "
17320 if set times val -f d_times; eval $csym; $val; then
17321         echo 'times() found.' >&4
17322         d_times="$define"
17323         inc=''
17324         case "$i_systimes" in
17325         "$define") inc='sys/times.h';;
17326         esac
17327         rp="What is the type returned by times() on this system?"
17328         set clock_t clocktype long stdio.h sys/types.h $inc
17329         eval $typedef_ask
17330 else
17331         echo 'times() NOT found, hope that will do.' >&4
17332         d_times="$undef"
17333         clocktype='int'
17334 fi
17335
17336 : see if tmpnam_r exists
17337 set tmpnam_r d_tmpnam_r
17338 eval $inlibc
17339 case "$d_tmpnam_r" in
17340 "$define")
17341         hdrs="$i_systypes sys/types.h define stdio.h "
17342         case "$d_tmpnam_r_proto:$usethreads" in
17343         ":define")      d_tmpnam_r_proto=define
17344                 set d_tmpnam_r_proto tmpnam_r $hdrs
17345                 eval $hasproto ;;
17346         *)      ;;
17347         esac
17348         case "$d_tmpnam_r_proto" in
17349         define)
17350         case "$tmpnam_r_proto" in
17351         ''|0) try='char* tmpnam_r(char*);'
17352         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17353         esac
17354         case "$tmpnam_r_proto" in
17355         ''|0)   d_tmpnam_r=undef
17356                 tmpnam_r_proto=0
17357                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17358         * )     case "$tmpnam_r_proto" in
17359                 REENTRANT_PROTO*) ;;
17360                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17361                 esac
17362                 echo "Prototype: $try" ;;
17363         esac
17364         ;;
17365         *)      case "$usethreads" in
17366                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17367                 esac
17368                 d_tmpnam_r=undef
17369                 tmpnam_r_proto=0
17370                 ;;
17371         esac
17372         ;;
17373 *)      tmpnam_r_proto=0
17374         ;;
17375 esac
17376
17377 : see if truncate exists
17378 set truncate d_truncate
17379 eval $inlibc
17380
17381 : see if ttyname_r exists
17382 set ttyname_r d_ttyname_r
17383 eval $inlibc
17384 case "$d_ttyname_r" in
17385 "$define")
17386         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17387         case "$d_ttyname_r_proto:$usethreads" in
17388         ":define")      d_ttyname_r_proto=define
17389                 set d_ttyname_r_proto ttyname_r $hdrs
17390                 eval $hasproto ;;
17391         *)      ;;
17392         esac
17393         case "$d_ttyname_r_proto" in
17394         define)
17395         case "$ttyname_r_proto" in
17396         ''|0) try='int ttyname_r(int, char*, size_t);'
17397         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17398         esac
17399         case "$ttyname_r_proto" in
17400         ''|0) try='int ttyname_r(int, char*, int);'
17401         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17402         esac
17403         case "$ttyname_r_proto" in
17404         ''|0) try='char* ttyname_r(int, char*, int);'
17405         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17406         esac
17407         case "$ttyname_r_proto" in
17408         ''|0)   d_ttyname_r=undef
17409                 ttyname_r_proto=0
17410                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17411         * )     case "$ttyname_r_proto" in
17412                 REENTRANT_PROTO*) ;;
17413                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17414                 esac
17415                 echo "Prototype: $try" ;;
17416         esac
17417         ;;
17418         *)      case "$usethreads" in
17419                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17420                 esac
17421                 d_ttyname_r=undef
17422                 ttyname_r_proto=0
17423                 ;;
17424         esac
17425         ;;
17426 *)      ttyname_r_proto=0
17427         ;;
17428 esac
17429
17430 : see if tzname[] exists
17431 echo " "
17432 if set tzname val -a d_tzname; eval $csym; $val; then
17433         val="$define"
17434         echo 'tzname[] found.' >&4
17435 else
17436         val="$undef"
17437         echo 'tzname[] NOT found.' >&4
17438 fi
17439 set d_tzname
17440 eval $setvar
17441
17442 case "$osname" in
17443 next|rhapsody|darwin) multiarch="$define" ;;
17444 esac
17445 case "$multiarch" in
17446 ''|[nN]*) multiarch="$undef" ;;
17447 esac
17448
17449 : check for ordering of bytes in a UV
17450 echo " "
17451 case "$usecrosscompile$multiarch" in
17452 *$define*)
17453         $cat <<EOM
17454 You seem to be either cross-compiling or doing a multiarchitecture build,
17455 skipping the byteorder check.
17456
17457 EOM
17458         byteorder='ffff'
17459         ;;
17460 *)
17461         case "$byteorder" in
17462         '')
17463                 $cat <<'EOM'
17464 In the following, larger digits indicate more significance.  A big-endian
17465 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17466 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17467 machines may have weird orders like 3412.  A Cray will report 87654321,
17468 an Alpha will report 12345678. If the test program works the default is
17469 probably right.
17470 I'm now running the test program...
17471 EOM
17472                 $cat >try.c <<EOCP
17473 #include <stdio.h>
17474 #$i_stdlib I_STDLIB
17475 #ifdef I_STDLIB
17476 #include <stdlib.h>
17477 #endif
17478 #include <sys/types.h>
17479 typedef $uvtype UV;
17480 int main()
17481 {
17482         int i;
17483         union {
17484                 UV l;
17485                 char c[$uvsize];
17486         } u;
17487
17488         if ($uvsize > 4)
17489                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17490         else
17491                 u.l = (UV)0x04030201;
17492         for (i = 0; i < $uvsize; i++)
17493                 printf("%c", u.c[i]+'0');
17494         printf("\n");
17495         exit(0);
17496 }
17497 EOCP
17498                 xxx_prompt=y
17499                 set try
17500                 if eval $compile && ./try > /dev/null; then
17501                         dflt=`$run ./try`
17502                         case "$dflt" in
17503                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17504                                 echo "(The test program ran ok.)"
17505                                 echo "byteorder=$dflt"
17506                                 xxx_prompt=n
17507                         ;;
17508                         ????|????????) echo "(The test program ran ok.)" ;;
17509                         *) echo "(The test program didn't run right for some reason.)" ;;
17510                         esac
17511                 else
17512                         dflt='4321'
17513                         cat <<'EOM'
17514 (I can't seem to compile the test program.  Guessing big-endian...)
17515 EOM
17516                 fi
17517                 case "$xxx_prompt" in
17518                 y)
17519                         rp="What is the order of bytes in $uvtype?"
17520                         . ./myread
17521                         byteorder="$ans"
17522                         ;;
17523                 *)      byteorder=$dflt
17524                         ;;
17525                 esac
17526                 ;;
17527         esac
17528         $rm -f try.c try
17529         ;;
17530 esac
17531
17532
17533 $cat <<EOM
17534
17535 Checking to see whether you can access character data unalignedly...
17536 EOM
17537 case "$d_u32align" in
17538 '')   $cat >try.c <<EOCP
17539 #include <stdio.h>
17540 #$i_stdlib I_STDLIB
17541 #ifdef I_STDLIB
17542 #include <stdlib.h>
17543 #endif
17544 #define U32 $u32type
17545 #define BYTEORDER 0x$byteorder
17546 #define U8 $u8type
17547 #include <signal.h>
17548 #ifdef SIGBUS
17549 $signal_t bletch(s) int s; { exit(4); }
17550 #endif
17551 int main() {
17552 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17553     U8 buf[8];
17554     U32 *up;
17555     int i;
17556
17557     if (sizeof(U32) != 4) {
17558         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17559         exit(1);
17560     }
17561
17562     fflush(stdout);
17563
17564 #ifdef SIGBUS
17565     signal(SIGBUS, bletch);
17566 #endif
17567
17568     buf[0] = 0;
17569     buf[1] = 0;
17570     buf[2] = 0;
17571     buf[3] = 1;
17572     buf[4] = 0;
17573     buf[5] = 0;
17574     buf[6] = 0;
17575     buf[7] = 1;
17576
17577     for (i = 0; i < 4; i++) {
17578         up = (U32*)(buf + i);
17579         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17580                (*up == 1 << (8*(3-i)))  /* little-endian */
17581               )
17582            )
17583         {
17584             printf("read failed (%x)\n", *up);
17585             exit(2);
17586         }
17587     }
17588
17589     /* write test */
17590     for (i = 0; i < 4; i++) {
17591         up = (U32*)(buf + i);
17592         *up = 0xBeef;
17593         if (*up != 0xBeef) {
17594             printf("write failed (%x)\n", *up);
17595             exit(3);
17596         }
17597     }
17598
17599     exit(0);
17600 #else
17601     printf("1\n");
17602     exit(1);
17603 #endif
17604     return 0;
17605 }
17606 EOCP
17607 set try
17608 if eval $compile_ok; then
17609         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17610         $run ./try 2>&1 >/dev/null
17611         case "$?" in
17612         0)      cat >&4 <<EOM
17613 You can access character data pretty unalignedly.
17614 EOM
17615                 d_u32align="$undef"
17616                 ;;
17617         *)      cat >&4 <<EOM
17618 It seems that you must access character data in an aligned manner.
17619 EOM
17620                 d_u32align="$define"
17621                 ;;
17622         esac
17623 else
17624         rp='Can you access character data at unaligned addresses?'
17625         dflt='n'
17626         . ./myread
17627         case "$ans" in
17628         [yY]*)  d_u32align="$undef"  ;;
17629         *)      d_u32align="$define" ;;
17630         esac
17631 fi
17632 $rm -f core core.try.* try.core
17633 ;;
17634 esac
17635
17636 : see if ualarm exists
17637 set ualarm d_ualarm
17638 eval $inlibc
17639
17640 : see if umask exists
17641 set umask d_umask
17642 eval $inlibc
17643
17644 : see if unordered exists
17645 set unordered d_unordered
17646 eval $inlibc
17647
17648 : see if unsetenv exists
17649 set unsetenv d_unsetenv
17650 eval $inlibc
17651
17652 : see if usleep exists
17653 set usleep d_usleep
17654 eval $inlibc
17655
17656 : see if prototype for usleep is available
17657 echo " "
17658 set d_usleepproto usleep $i_unistd unistd.h
17659 eval $hasproto
17660
17661 : see if ustat exists
17662 set ustat d_ustat
17663 eval $inlibc
17664
17665 : backward compatibility for d_hvfork
17666 if test X$d_hvfork != X; then
17667         d_vfork="$d_hvfork"
17668         d_hvfork=''
17669 fi
17670 : see if there is a vfork
17671 val=''
17672 set vfork val
17673 eval $inlibc
17674
17675 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17676 : perl on Solaris 2.x, and probably elsewhere.
17677 case "$val" in
17678 $define)
17679         echo " "
17680         case "$usevfork" in
17681         false) dflt='n';;
17682         *) dflt='y';;
17683         esac
17684         cat <<'EOM'
17685  
17686 Perl can only use a vfork() that doesn't suffer from strict
17687 restrictions on calling functions or modifying global data in
17688 the child.  For example, glibc-2.1 contains such a vfork()
17689 that is unsuitable.  If your system provides a proper fork()
17690 call, chances are that you do NOT want perl to use vfork().
17691
17692 EOM
17693         rp="Do you still want to use vfork()?"
17694         . ./myread
17695         case "$ans" in
17696         y|Y) ;;
17697         *)
17698                 echo "Ok, we won't use vfork()."
17699                 val="$undef"
17700                 ;;
17701         esac
17702         ;;
17703 esac
17704 set d_vfork
17705 eval $setvar
17706 case "$d_vfork" in
17707 $define) usevfork='true';;
17708 *) usevfork='false';;
17709 esac
17710
17711 : see if closedir exists
17712 set closedir d_closedir
17713 eval $inlibc
17714
17715 case "$d_closedir" in
17716 "$define")
17717         echo " "
17718         echo "Checking whether closedir() returns a status..." >&4
17719         cat > try.c <<EOM
17720 #$i_dirent I_DIRENT             /**/
17721 #$i_sysdir I_SYS_DIR            /**/
17722 #$i_sysndir I_SYS_NDIR          /**/
17723 #$i_systypes I_SYS_TYPES        /**/
17724
17725 #if defined(I_SYS_TYPES)
17726 #include <sys/types.h>
17727 #endif
17728 #if defined(I_DIRENT)
17729 #include <dirent.h>
17730 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17731 #include <sys/dir.h>
17732 #endif
17733 #else
17734 #ifdef I_SYS_NDIR
17735 #include <sys/ndir.h>
17736 #else
17737 #ifdef I_SYS_DIR
17738 #ifdef hp9000s500
17739 #include <ndir.h>       /* may be wrong in the future */
17740 #else
17741 #include <sys/dir.h>
17742 #endif
17743 #endif
17744 #endif
17745 #endif 
17746 int main() { return closedir(opendir(".")); }
17747 EOM
17748         set try
17749         if eval $compile_ok; then
17750                 if $run ./try > /dev/null 2>&1 ; then
17751                         echo "Yes, it does."
17752                         val="$undef"
17753                 else
17754                         echo "No, it doesn't."
17755                         val="$define"
17756                 fi
17757         else
17758                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17759                 val="$define"
17760         fi
17761         ;;
17762 *)
17763         val="$undef";
17764         ;;
17765 esac
17766 set d_void_closedir
17767 eval $setvar
17768 $rm -f try try.*
17769 : see if there is a wait4
17770 set wait4 d_wait4
17771 eval $inlibc
17772
17773 : see if waitpid exists
17774 set waitpid d_waitpid
17775 eval $inlibc
17776
17777 : see if wcstombs exists
17778 set wcstombs d_wcstombs
17779 eval $inlibc
17780
17781 : see if wctomb exists
17782 set wctomb d_wctomb
17783 eval $inlibc
17784
17785 : see if writev exists
17786 set writev d_writev
17787 eval $inlibc
17788
17789 : preserve RCS keywords in files with variable substitution, grrr
17790 Date='$Date'
17791 Id='$Id'
17792 Log='$Log'
17793 RCSfile='$RCSfile'
17794 Revision='$Revision'
17795
17796 : check for alignment requirements
17797 echo " "
17798 case "$usecrosscompile$multiarch" in
17799 *$define*)
17800         $cat <<EOM
17801 You seem to be either cross-compiling or doing a multiarchitecture build,
17802 skipping the memory alignment check.
17803
17804 EOM
17805         case "$alignbytes" in
17806         '') alignbytes=8 ;;
17807         esac
17808         ;;
17809 *)
17810         case "$alignbytes" in
17811         '') echo "Checking alignment constraints..." >&4
17812                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17813                         $cat >try.c <<'EOCP'
17814 typedef long double NV;
17815 EOCP
17816                 else
17817                         $cat >try.c <<'EOCP'
17818 typedef double NV;
17819 EOCP
17820                 fi
17821                 $cat >>try.c <<'EOCP'
17822 #include <stdio.h>
17823 struct foobar {
17824         char foo;
17825         NV bar;
17826 } try_algn;
17827 int main()
17828 {
17829     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17830     return(0);
17831 }
17832 EOCP
17833                 set try
17834                 if eval $compile_ok; then
17835                         dflt=`$run ./try`
17836                 else
17837                         dflt='8'
17838                         echo "(I can't seem to compile the test program...)"
17839                 fi
17840                 ;;
17841         *) dflt="$alignbytes"
17842                 ;;
17843         esac
17844         rp="Doubles must be aligned on a how-many-byte boundary?"
17845         . ./myread
17846         alignbytes="$ans"
17847         $rm -f try.c try
17848         ;;
17849 esac
17850
17851
17852 : set the base revision
17853 baserev=5.0
17854
17855 : how do we concatenate cpp tokens here?
17856 echo " "
17857 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17858 $cat >cpp_stuff.c <<'EOCP'
17859 #define RCAT(a,b)a/**/b
17860 #define ACAT(a,b)a ## b
17861 RCAT(Rei,ser)
17862 ACAT(Cir,cus)
17863 EOCP
17864 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17865 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17866         echo "Oh!  Smells like ANSI's been here." >&4
17867         echo "We can catify or stringify, separately or together!"
17868         cpp_stuff=42
17869 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17870         echo "Ah, yes!  The good old days!" >&4
17871         echo "However, in the good old days we don't know how to stringify and"
17872         echo "catify at the same time."
17873         cpp_stuff=1
17874 else
17875         $cat >&4 <<EOM
17876 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17877 You're going to have to edit the values of CAT[2-5] in config.h...
17878 EOM
17879         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17880 fi
17881 $rm -f cpp_stuff.*
17882
17883 : see if this is a db.h system
17884 set db.h i_db
17885 eval $inhdr
17886
17887 case "$i_db" in
17888 $define)
17889         : Check db version.
17890         echo " "
17891         echo "Checking Berkeley DB version ..." >&4
17892         $cat >try.c <<EOCP
17893 #$d_const HASCONST
17894 #ifndef HASCONST
17895 #define const
17896 #endif
17897 #include <sys/types.h>
17898 #include <stdio.h>
17899 #$i_stdlib I_STDLIB
17900 #ifdef I_STDLIB
17901 #include <stdlib.h>
17902 #endif
17903 #include <db.h>
17904 int main(int argc, char *argv[])
17905 {
17906 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17907     int Major, Minor, Patch ;
17908     unsigned long Version ;
17909     (void)db_version(&Major, &Minor, &Patch) ;
17910     if (argc == 2) {
17911         printf("%d %d %d %d %d %d\n",
17912                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17913                Major, Minor, Patch);
17914         exit(0);
17915     }
17916     printf("You have Berkeley DB Version 2 or greater.\n");
17917
17918     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17919                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17920     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17921                 Major, Minor, Patch) ;
17922
17923     /* check that db.h & libdb are compatible */
17924     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17925         printf("db.h and libdb are incompatible.\n") ;
17926         exit(3);        
17927     }
17928
17929     printf("db.h and libdb are compatible.\n") ;
17930
17931     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17932                 + DB_VERSION_PATCH ;
17933
17934     /* needs to be >= 2.3.4 */
17935     if (Version < 2003004) {
17936     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17937         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17938         exit(2);        
17939     }
17940
17941     exit(0);
17942 #else
17943 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17944     if (argc == 2) {
17945         printf("1 0 0\n");
17946         exit(0);
17947     }
17948     printf("You have Berkeley DB Version 1.\n");
17949     exit(0);    /* DB version < 2: the coast is clear. */
17950 #else
17951     exit(1);    /* <db.h> not Berkeley DB? */
17952 #endif
17953 #endif
17954 }
17955 EOCP
17956         set try
17957         if eval $compile_ok && $run ./try; then
17958                 echo 'Looks OK.' >&4
17959                 set `$run ./try 1`
17960                 db_version_major=$1
17961                 db_version_minor=$2
17962                 db_version_patch=$3
17963         else
17964                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17965                 i_db=$undef
17966                 case " $libs " in
17967                 *"-ldb "*)
17968                         : Remove db from list of libraries to use
17969                         echo "Removing unusable -ldb from library list" >&4
17970                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17971                         shift
17972                         libs="$*"
17973                         echo "libs = $libs" >&4
17974                         ;;
17975                 esac
17976         fi
17977         $rm -f try.*
17978         ;;
17979 esac
17980
17981 case "$i_db" in
17982 define)
17983         : Check the return type needed for hash 
17984         echo " "
17985         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17986         $cat >try.c <<EOCP
17987 #$d_const HASCONST
17988 #ifndef HASCONST
17989 #define const
17990 #endif
17991 #include <sys/types.h>
17992 #include <db.h>
17993
17994 #ifndef DB_VERSION_MAJOR
17995 u_int32_t hash_cb (ptr, size)
17996 const void *ptr;
17997 size_t size;
17998 {
17999 }
18000 HASHINFO info;
18001 int main()
18002 {
18003         info.hash = hash_cb;
18004 }
18005 #endif
18006 EOCP
18007         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18008                 if $contains warning try.out >>/dev/null 2>&1 ; then
18009                         db_hashtype='int'
18010                 else
18011                         db_hashtype='u_int32_t'
18012                 fi
18013         else
18014                 : XXX Maybe we should just give up here.
18015                 db_hashtype=u_int32_t
18016                 $cat try.out >&4
18017                 echo "Help:  I can't seem to compile the db test program." >&4
18018                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18019         fi
18020         $rm -f try.*
18021         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18022         ;;
18023 *)      db_hashtype=u_int32_t
18024         ;;
18025 esac
18026 case "$i_db" in
18027 define)
18028         : Check the return type needed for prefix 
18029         echo " "
18030         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18031         cat >try.c <<EOCP
18032 #$d_const HASCONST
18033 #ifndef HASCONST
18034 #define const
18035 #endif
18036 #include <sys/types.h>
18037 #include <db.h>
18038
18039 #ifndef DB_VERSION_MAJOR
18040 size_t prefix_cb (key1, key2)
18041 const DBT *key1;
18042 const DBT *key2;
18043 {
18044 }
18045 BTREEINFO info;
18046 int main()
18047 {
18048         info.prefix = prefix_cb;
18049 }
18050 #endif
18051 EOCP
18052         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18053                 if $contains warning try.out >>/dev/null 2>&1 ; then
18054                         db_prefixtype='int'
18055                 else
18056                         db_prefixtype='size_t'
18057                 fi
18058         else
18059                 db_prefixtype='size_t'
18060                 : XXX Maybe we should just give up here.
18061                 $cat try.out >&4
18062                 echo "Help:  I can't seem to compile the db test program." >&4
18063                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18064         fi
18065         $rm -f try.*
18066         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18067         ;;
18068 *)      db_prefixtype='size_t'
18069         ;;
18070 esac
18071
18072
18073 : How can we generate normalized random numbers ?
18074 echo " "
18075 echo "Looking for a random number function..." >&4
18076 case "$randfunc" in
18077 '')
18078         if set drand48 val -f; eval $csym; $val; then
18079                 dflt="drand48"
18080                 echo "Good, found drand48()." >&4
18081         elif set random val -f; eval $csym; $val; then
18082                 dflt="random"
18083                 echo "OK, found random()." >&4
18084         else
18085                 dflt="rand"
18086                 echo "Yick, looks like I have to use rand()." >&4
18087         fi
18088         echo " "
18089         ;;
18090 *)
18091         dflt="$randfunc"
18092         ;;
18093 esac
18094 cont=true
18095
18096 case "$ccflags" in
18097 *-Dmy_rand=*|*-Dmy_srand=*)
18098         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18099         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18100         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18101         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18102         ;;
18103 esac
18104
18105 while $test "$cont"; do
18106         rp="Use which function to generate random numbers?"
18107         . ./myread
18108         if $test "$ans" = "$dflt"; then
18109                 : null
18110         else
18111                 randbits=''
18112         fi
18113         randfunc="$ans"
18114         if set $ans val -f; eval $csym; $val; then
18115                 cont=''
18116         else
18117                 dflt=y
18118                 rp="I cannot find function $ans. Use that name anyway?"
18119                 . ./myread
18120                 dflt=rand
18121                 case "$ans" in
18122                         [yY]*) cont='';;
18123                 esac
18124         fi
18125         case "$cont" in
18126         '')
18127                 case "$randfunc" in
18128                 drand48)
18129                         drand01="drand48()"
18130                         seedfunc="srand48"
18131                         randbits=48
18132                         randseedtype=long
18133                         ;;
18134                 rand|random)
18135                         case "$randbits" in
18136                         '')
18137 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18138                                 $cat >try.c <<EOCP
18139 #$i_unistd I_UNISTD
18140 #$i_stdlib I_STDLIB
18141 #include <stdio.h>
18142 #ifdef I_UNISTD
18143 #  include <unistd.h>
18144 #endif
18145 #ifdef I_STDLIB
18146 #  include <stdlib.h>
18147 #endif
18148 int main()
18149 {
18150         register int i;
18151         register unsigned long tmp;
18152         register unsigned long max = 0L;
18153
18154         for (i = 1000; i; i--) {
18155                 tmp = (unsigned long) $randfunc();
18156                 if (tmp > max) max = tmp;
18157         }
18158         for (i = 0; max; i++)
18159                 max /= 2;
18160         printf("%d\n",i);
18161 }
18162 EOCP
18163                                 set try
18164                                 if eval $compile_ok; then
18165                                         dflt=`try`
18166                                 else
18167                                         dflt='?'
18168                                         echo "(I can't seem to compile the test program...)"
18169                                 fi
18170                                 ;;
18171                         *)
18172                                 dflt="$randbits"
18173                                 ;;
18174                         esac
18175                         rp="How many bits does your $randfunc() function produce?"
18176                         . ./myread
18177                         randbits="$ans"
18178                         $rm -f try.c try
18179                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18180                         seedfunc="s$randfunc"
18181                         randseedtype=unsigned
18182                         ;;
18183                 *)
18184                         dflt="31"
18185                         rp="How many bits does your $randfunc() function produce?"
18186                         . ./myread
18187                         randbits="$ans"
18188                         seedfunc="s$randfunc"
18189                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18190                         if set $seedfunc val -f; eval $csym; $val; then
18191                                 echo "(Using $seedfunc() to seed random generator)"
18192                         else
18193                                 echo "(Warning: no $seedfunc() to seed random generator)"
18194                                 seedfunc=rand
18195                         fi
18196                         randseedtype=unsigned
18197                         ;;
18198                 esac
18199                 ;;
18200         esac
18201 done
18202
18203 echo " "
18204 echo "Determining whether or not we are on an EBCDIC system..." >&4
18205 $cat >try.c <<'EOM'
18206 int main()
18207 {
18208   if ('M'==0xd4) return 0;
18209   return 1;
18210 }
18211 EOM
18212
18213 val=$undef
18214 set try
18215 if eval $compile_ok; then
18216         if $run ./try; then
18217                 echo "You seem to speak EBCDIC." >&4
18218                 val="$define"
18219         else
18220                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18221         fi
18222 else
18223         echo "I'm unable to compile the test program." >&4
18224         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18225 fi
18226 $rm -f try try.*
18227 set ebcdic
18228 eval $setvar
18229
18230 echo " "
18231 $cat >&4 <<EOM
18232 Checking how to flush all pending stdio output...
18233 EOM
18234 # I only know how to find the first 32 possibly open files on SunOS.
18235 # See also hints/sunos_4_1.sh and util.c  --AD
18236 case "$osname" in
18237 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18238 esac
18239 $cat >>try.c <<EOCP
18240 #include <stdio.h>
18241 #$i_stdlib I_STDLIB
18242 #ifdef I_STDLIB
18243 #include <stdlib.h>
18244 #endif
18245 #$i_unistd I_UNISTD
18246 #ifdef I_UNISTD
18247 # include <unistd.h>
18248 #endif
18249 #$d_sysconf HAS_SYSCONF
18250 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18251 #ifdef HAS_STDIO_STREAM_ARRAY
18252 # define STDIO_STREAM_ARRAY $stdio_stream_array
18253 #endif
18254 int main() {
18255   FILE* p;
18256   unlink("try.out");
18257   p = fopen("try.out", "w");
18258 #ifdef TRY_FPUTC
18259   fputc('x', p);
18260 #else
18261 # ifdef TRY_FPRINTF
18262   fprintf(p, "x");
18263 # endif
18264 #endif
18265 #ifdef TRY_FFLUSH_NULL
18266   fflush(NULL);
18267 #endif
18268 #ifdef TRY_FFLUSH_ALL
18269   {
18270     long open_max = -1;
18271 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18272     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18273 # else
18274 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18275     open_max = sysconf(_SC_OPEN_MAX);
18276 #  else
18277 #   ifdef FOPEN_MAX
18278     open_max = FOPEN_MAX;
18279 #   else
18280 #    ifdef OPEN_MAX
18281     open_max = OPEN_MAX;
18282 #    else
18283 #     ifdef _NFILE
18284     open_max = _NFILE;
18285 #     endif
18286 #    endif
18287 #   endif
18288 #  endif
18289 # endif 
18290 # ifdef HAS_STDIO_STREAM_ARRAY
18291     if (open_max > 0) {
18292       long i;
18293       for (i = 0; i < open_max; i++)
18294             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18295                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18296                 STDIO_STREAM_ARRAY[i]._flag)
18297                 fflush(&STDIO_STREAM_ARRAY[i]);
18298     }   
18299   }
18300 # endif
18301 #endif
18302   _exit(42);
18303 }
18304 EOCP
18305 : first we have to find out how _not_ to flush
18306 $to try.c
18307 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18308     output=''
18309     set try -DTRY_FPUTC
18310     if eval $compile; then
18311             $run ./try 2>/dev/null
18312             code="$?"
18313             $from try.out
18314             if $test ! -s try.out -a "X$code" = X42; then
18315                 output=-DTRY_FPUTC
18316             fi
18317     fi
18318     case "$output" in
18319     '')
18320             set try -DTRY_FPRINTF
18321             if eval $compile; then
18322                     $run ./try 2>/dev/null
18323                     code="$?"
18324                     $from try.out
18325                     if $test ! -s try.out -a "X$code" = X42; then
18326                         output=-DTRY_FPRINTF
18327                     fi
18328             fi
18329         ;;
18330     esac
18331 fi
18332 : check for fflush NULL behaviour
18333 case "$fflushNULL" in
18334 '')     set try -DTRY_FFLUSH_NULL $output
18335         if eval $compile; then
18336                 $run ./try 2>/dev/null
18337                 code="$?"
18338                 $from try.out
18339                 if $test -s try.out -a "X$code" = X42; then
18340                         fflushNULL="`$cat try.out`"
18341                 else
18342                         if $test "X$code" != X42; then
18343                                 $cat >&4 <<EOM
18344 (If this test failed, don't worry, we'll try another method shortly.)
18345 EOM
18346                         fi
18347                 fi
18348         fi
18349         $rm -f core try.core core.try.*
18350         case "$fflushNULL" in
18351         x)      $cat >&4 <<EOM
18352 Your fflush(NULL) works okay for output streams.
18353 Let's see if it clobbers input pipes...
18354 EOM
18355 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18356 # bug that improperly flushes the input end of pipes.  So we avoid the
18357 # autoflush on fork/system/exec support for now. :-(
18358 $cat >tryp.c <<EOCP
18359 #include <stdio.h>
18360 int
18361 main(int argc, char **argv)
18362 {
18363     char buf[1024];
18364     int i;
18365     char *bp = buf;
18366     while (1) {
18367         while ((i = getc(stdin)) != -1
18368                && (*bp++ = i) != '\n'
18369                && bp < &buf[1024])
18370         /* DO NOTHING */ ;
18371         *bp = '\0';
18372         fprintf(stdout, "%s", buf);
18373         fflush(NULL);
18374         if (i == -1)
18375             return 0;
18376         bp = buf;
18377     }
18378 }
18379 EOCP
18380                 fflushNULL="$define"
18381                 set tryp
18382                 if eval $compile; then
18383                     $rm -f tryp.out
18384                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18385                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18386                        $cat >&4 <<EOM
18387 fflush(NULL) seems to behave okay with input streams.
18388 EOM
18389                         fflushNULL="$define"
18390                     else
18391                         $cat >&4 <<EOM
18392 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18393 EOM
18394                         fflushNULL="$undef"
18395                     fi
18396                 fi
18397                 $rm -f core tryp.c tryp.core core.tryp.*
18398                 ;;
18399         '')     $cat >&4 <<EOM
18400 Your fflush(NULL) isn't working (contrary to ANSI C).
18401 EOM
18402                 fflushNULL="$undef"
18403                 ;;
18404         *)      $cat >&4 <<EOM
18405 Cannot figure out whether your fflush(NULL) works or not.
18406 I'm assuming it doesn't (contrary to ANSI C).
18407 EOM
18408                 fflushNULL="$undef"
18409                 ;;
18410         esac
18411         ;;
18412 $define|true|[yY]*)
18413         fflushNULL="$define"
18414         ;;
18415 *)
18416         fflushNULL="$undef"
18417         ;;
18418 esac
18419 : check explicit looping only if NULL did not work, and if the pipe
18420 : bug does not show up on an explicit flush too
18421 case "$fflushNULL" in
18422 "$undef")
18423         $cat >tryp.c <<EOCP
18424 #include <stdio.h>
18425 int
18426 main(int argc, char **argv)
18427 {
18428     char buf[1024];
18429     int i;
18430     char *bp = buf;
18431     while (1) {
18432         while ((i = getc(stdin)) != -1
18433                && (*bp++ = i) != '\n'
18434                && bp < &buf[1024])
18435         /* DO NOTHING */ ;
18436         *bp = '\0';
18437         fprintf(stdout, "%s", buf);
18438         fflush(stdin);
18439         if (i == -1)
18440             return 0;
18441         bp = buf;
18442     }
18443 }
18444 EOCP
18445         set tryp
18446         if eval $compile; then
18447             $rm -f tryp.out
18448             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18449             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18450                $cat >&4 <<EOM
18451 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18452 EOM
18453                 : now check for fflushall behaviour
18454                 case "$fflushall" in
18455                 '')     set try -DTRY_FFLUSH_ALL $output
18456                         if eval $compile; then
18457                                 $cat >&4 <<EOM
18458 (Now testing the other method--but note that this also may fail.)
18459 EOM
18460                                 $run ./try 2>/dev/null
18461                                 code=$?
18462                                 $from try.out
18463                                 if $test -s try.out -a "X$code" = X42; then
18464                                         fflushall="`$cat try.out`"
18465                                 fi
18466                         fi
18467                         $rm -f core try.core core.try.*
18468                         case "$fflushall" in
18469                         x)      $cat >&4 <<EOM
18470 Whew. Flushing explicitly all the stdio streams works.
18471 EOM
18472                                 fflushall="$define"
18473                                 ;;
18474                         '')     $cat >&4 <<EOM
18475 Sigh. Flushing explicitly all the stdio streams doesn't work.
18476 EOM
18477                                 fflushall="$undef"
18478                                 ;;
18479                         *)      $cat >&4 <<EOM
18480 Cannot figure out whether flushing stdio streams explicitly works or not.
18481 I'm assuming it doesn't.
18482 EOM
18483                                 fflushall="$undef"
18484                                 ;;
18485                         esac
18486                         ;;
18487                 "$define"|true|[yY]*)
18488                         fflushall="$define"
18489                         ;;
18490                 *)
18491                         fflushall="$undef"
18492                         ;;
18493                 esac
18494             else
18495                 $cat >&4 <<EOM
18496 All is futile.  Even fflush(stdin) clobbers input pipes!
18497 EOM
18498                 fflushall="$undef"
18499             fi
18500         else
18501             fflushall="$undef"
18502         fi
18503         $rm -f core tryp.c tryp.core core.tryp.*
18504         ;;
18505 *)      fflushall="$undef"
18506         ;;
18507 esac
18508
18509 case "$fflushNULL$fflushall" in
18510 undefundef)
18511         $cat <<EOM
18512 OK, I give up.  I cannot figure out how to flush pending stdio output.
18513 We won't be flushing handles at all before fork/exec/popen.
18514 EOM
18515         ;;
18516 esac
18517 $rm -f try.* try$exe_ext
18518
18519 : Store the full pathname to the ar program for use in the C program
18520 : Respect a hint or command line value for full_ar.
18521 case "$full_ar" in
18522 '') full_ar=$ar ;;
18523 esac
18524
18525 : Store the full pathname to the sed program for use in the C program
18526 full_sed=$sed
18527
18528 : see what type gids are declared as in the kernel
18529 echo " "
18530 echo "Looking for the type for group ids returned by getgid()."
18531 set gid_t gidtype xxx stdio.h sys/types.h
18532 eval $typedef
18533 case "$gidtype" in
18534 xxx)
18535         xxx=`./findhdr sys/user.h`
18536         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18537         case $1 in
18538         unsigned) dflt="$1 $2" ;;
18539         *) dflt="$1" ;;
18540         esac
18541         ;;
18542 *) dflt="$gidtype";;
18543 esac
18544 case "$gidtype" in
18545 gid_t) echo "gid_t found." ;;
18546 *)      rp="What is the type for group ids returned by getgid()?"
18547         . ./myread
18548         gidtype="$ans"
18549         ;;
18550 esac
18551
18552 echo " "
18553 case "$gidtype" in
18554 *_t) zzz="$gidtype"     ;;
18555 *)   zzz="gid"          ;;
18556 esac
18557 echo "Checking the size of $zzz..." >&4 
18558 cat > try.c <<EOCP
18559 #include <sys/types.h>
18560 #include <stdio.h>
18561 #$i_stdlib I_STDLIB
18562 #ifdef I_STDLIB
18563 #include <stdlib.h>
18564 #endif
18565 int main() {
18566     printf("%d\n", (int)sizeof($gidtype));
18567     exit(0);
18568 }
18569 EOCP
18570 set try
18571 if eval $compile_ok; then
18572         yyy=`$run ./try`
18573         case "$yyy" in
18574         '')     gidsize=4
18575                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18576                 ;;
18577         *)      gidsize=$yyy
18578                 echo "Your $zzz is $gidsize bytes long."
18579                 ;;
18580         esac
18581 else
18582         gidsize=4
18583         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18584 fi
18585
18586
18587 echo " "
18588 case "$gidtype" in
18589 *_t) zzz="$gidtype"     ;;
18590 *)   zzz="gid"          ;;
18591 esac
18592 echo "Checking the sign of $zzz..." >&4 
18593 cat > try.c <<EOCP
18594 #include <sys/types.h>
18595 #include <stdio.h>
18596 int main() {
18597         $gidtype foo = -1;
18598         if (foo < 0)
18599                 printf("-1\n");
18600         else
18601                 printf("1\n");
18602 }
18603 EOCP
18604 set try
18605 if eval $compile; then
18606         yyy=`$run ./try`
18607         case "$yyy" in
18608         '')     gidsign=1
18609                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18610                 ;;
18611         *)      gidsign=$yyy
18612                 case "$gidsign" in
18613                  1) echo "Your $zzz is unsigned." ;;
18614                 -1) echo "Your $zzz is signed."   ;;
18615                 esac
18616                 ;;
18617         esac
18618 else
18619         gidsign=1
18620         echo "(I can't compile the test program--guessing unsigned.)" >&4
18621 fi
18622
18623
18624 echo " "
18625
18626 if $test X"$quadtype" != X; then
18627
18628 echo "Checking how to print 64-bit integers..." >&4
18629
18630 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18631         $cat >try.c <<'EOCP'
18632 #include <sys/types.h>
18633 #include <stdio.h>
18634 int main() {
18635   int q = 12345678901;
18636   printf("%ld\n", q);
18637 }
18638 EOCP
18639         set try
18640         if eval $compile; then
18641                 yyy=`$run ./try`
18642                 case "$yyy" in
18643                 12345678901)
18644                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18645                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18646                         echo "We will use %d."
18647                         ;;
18648                 esac
18649         fi
18650 fi
18651
18652 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18653         $cat >try.c <<'EOCP'
18654 #include <sys/types.h>
18655 #include <stdio.h>
18656 int main() {
18657   long q = 12345678901;
18658   printf("%ld\n", q);
18659 }
18660 EOCP
18661         set try
18662         if eval $compile; then
18663                 yyy=`$run ./try`
18664                 case "$yyy" in
18665                 12345678901)
18666                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18667                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18668                         echo "We will use %ld."
18669                         ;;
18670                 esac
18671         fi
18672 fi
18673
18674 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18675         $cat >try.c <<'EOCP'
18676 #include <sys/types.h>
18677 #include <inttypes.h>
18678 #include <stdio.h>
18679 int main() {
18680   int64_t q = 12345678901;
18681   printf("%" PRId64 "\n", q);
18682 }
18683 EOCP
18684         set try
18685         if eval $compile; then
18686                 yyy=`$run ./try`
18687                 case "$yyy" in
18688                 12345678901)
18689                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18690                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18691                         echo "We will use the C9X style."
18692                         ;;
18693                 esac
18694         fi
18695 fi
18696
18697 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18698         $cat >try.c <<EOCP
18699 #include <sys/types.h>
18700 #include <stdio.h>
18701 int main() {
18702   $quadtype q = 12345678901;
18703   printf("%Ld\n", q);
18704 }
18705 EOCP
18706         set try
18707         if eval $compile; then
18708                 yyy=`$run ./try`
18709                 case "$yyy" in
18710                 12345678901)
18711                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18712                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18713                         echo "We will use %Ld."
18714                         ;;
18715                 esac
18716         fi
18717 fi
18718
18719 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18720         $cat >try.c <<'EOCP'
18721 #include <sys/types.h>
18722 #include <stdio.h>
18723 int main() {
18724   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18725   printf("%lld\n", q);
18726 }
18727 EOCP
18728         set try
18729         if eval $compile; then
18730                 yyy=`$run ./try`
18731                 case "$yyy" in
18732                 12345678901)
18733                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18734                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18735                         echo "We will use the %lld style."
18736                         ;;
18737                 esac
18738         fi
18739 fi
18740
18741 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18742         $cat >try.c <<EOCP
18743 #include <sys/types.h>
18744 #include <stdio.h>
18745 int main() {
18746   $quadtype q = 12345678901;
18747   printf("%qd\n", q);
18748 }
18749 EOCP
18750         set try
18751         if eval $compile; then
18752                 yyy=`$run ./try`
18753                 case "$yyy" in
18754                 12345678901)
18755                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18756                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18757                         echo "We will use %qd."
18758                         ;;
18759                 esac
18760         fi
18761 fi
18762
18763 if $test X"$sPRId64" = X; then
18764         echo "Cannot figure out how to print 64-bit integers." >&4
18765 fi
18766
18767 $rm -f try try.*
18768
18769 fi
18770
18771 case "$sPRId64" in
18772 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18773         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18774         ;;
18775 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18776         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18777         ;;
18778 esac
18779
18780
18781 echo " "
18782 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18783
18784 if $test X"$ivsize" = X8; then
18785         ivdformat="$sPRId64"
18786         uvuformat="$sPRIu64"
18787         uvoformat="$sPRIo64"
18788         uvxformat="$sPRIx64"
18789         uvXUformat="$sPRIXU64"
18790 else
18791         if $test X"$ivsize" = X"$longsize"; then
18792                 ivdformat='"ld"'
18793                 uvuformat='"lu"'
18794                 uvoformat='"lo"'
18795                 uvxformat='"lx"'
18796                 uvXUformat='"lX"'
18797         else
18798                 if $test X"$ivsize" = X"$intsize"; then
18799                         ivdformat='"d"'
18800                         uvuformat='"u"'
18801                         uvoformat='"o"'
18802                         uvxformat='"x"'
18803                         uvXUformat='"X"'
18804                 else
18805                         : far out
18806                         if $test X"$ivsize" = X"$shortsize"; then
18807                                 ivdformat='"hd"'
18808                                 uvuformat='"hu"'
18809                                 uvoformat='"ho"'
18810                                 uvxformat='"hx"'
18811                                 uvXUformat='"hX"'
18812                         fi
18813                 fi
18814         fi
18815 fi
18816
18817 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18818         nveformat="$sPRIeldbl"
18819         nvfformat="$sPRIfldbl"
18820         nvgformat="$sPRIgldbl"
18821         nvEUformat="$sPRIEUldbl"
18822         nvFUformat="$sPRIFUldbl"
18823         nvGUformat="$sPRIGUldbl"
18824 else
18825         nveformat='"e"'
18826         nvfformat='"f"'
18827         nvgformat='"g"'
18828         nvEUformat='"E"'
18829         nvFUformat='"F"'
18830         nvGUformat='"G"'
18831 fi
18832
18833 case "$ivdformat" in
18834 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18835     exit 1
18836     ;;
18837 esac
18838
18839
18840 echo " "
18841 $echo "Checking the format string to be used for gids..." >&4
18842
18843 case "$gidsign" in
18844 -1)     if $test X"$gidsize" = X"$ivsize"; then
18845                 gidformat="$ivdformat"
18846         else
18847                 if $test X"$gidsize" = X"$longsize"; then
18848                         gidformat='"ld"'
18849                 else
18850                         if $test X"$gidsize" = X"$intsize"; then
18851                                 gidformat='"d"'
18852                         else
18853                                 if $test X"$gidsize" = X"$shortsize"; then
18854                                         gidformat='"hd"'
18855                                 fi
18856                         fi
18857                 fi
18858         fi
18859         ;;
18860 *)      if $test X"$gidsize" = X"$uvsize"; then
18861                 gidformat="$uvuformat"
18862         else
18863                 if $test X"$gidsize" = X"$longsize"; then
18864                         gidformat='"lu"'
18865                 else
18866                         if $test X"$gidsize" = X"$intsize"; then
18867                                 gidformat='"u"'
18868                         else
18869                                 if $test X"$gidsize" = X"$shortsize"; then
18870                                         gidformat='"hu"'
18871                                 fi
18872                         fi
18873                 fi
18874         fi
18875         ;;
18876 esac
18877
18878 : see if getgroups exists
18879 set getgroups d_getgrps
18880 eval $inlibc
18881
18882 : see if setgroups exists
18883 set setgroups d_setgrps
18884 eval $inlibc
18885
18886
18887 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18888 echo " "
18889 case "$d_getgrps$d_setgrps" in
18890 *define*)
18891         case "$groupstype" in
18892         '') dflt="$gidtype" ;;
18893         *)  dflt="$groupstype" ;;
18894         esac
18895         $cat <<EOM
18896 What type of pointer is the second argument to getgroups() and setgroups()?
18897 Usually this is the same as group ids, $gidtype, but not always.
18898
18899 EOM
18900         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18901         . ./myread
18902         groupstype="$ans"
18903         ;;
18904 *)  groupstype="$gidtype";;
18905 esac
18906
18907
18908 case "$mad" in
18909 $define|true|[yY]*)     dflt='y' ;;
18910 *)                      dflt='n' ;;
18911 esac
18912 cat <<EOM
18913
18914 Would you like to build with Misc Attribute Decoration? This is development
18915 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18916 overhead on the interpreter.
18917
18918 If this doesn't make any sense to you, just accept the default '$dflt'.
18919 EOM
18920 rp='Build Perl with MAD?'
18921 . ./myread
18922 case "$ans" in
18923 y|Y)    val="$define"
18924         madlyh='madly.h madly.act madly.tab'
18925         madlysrc='madly.c'
18926         madlyobj="madly$_o" ;;
18927 *)      val="$undef"
18928         madlyh=''
18929         madlysrc=''
18930         madlyobj='' ;;
18931 esac
18932 set mad
18933 eval $setvar
18934
18935 echo " "
18936 echo "Checking if your $make program sets \$(MAKE)..." >&4
18937 case "$make_set_make" in
18938 '')
18939         $sed 's/^X //' > testmake.mak << 'EOF'
18940 Xall:
18941 X       @echo 'maketemp="$(MAKE)"'
18942 EOF
18943         case "`$make -f testmake.mak 2>/dev/null`" in
18944         *maketemp=*) make_set_make='#' ;;
18945         *)      make_set_make="MAKE=$make" ;;
18946         esac
18947         $rm -f testmake.mak
18948         ;;
18949 esac
18950 case "$make_set_make" in
18951 '#') echo "Yup, it does.";;
18952 *) echo "Nope, it doesn't.";;
18953 esac
18954
18955 : see what type is used for mode_t
18956 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18957 set mode_t modetype int stdio.h sys/types.h
18958 eval $typedef_ask
18959
18960 : see if stdarg is available
18961 echo " "
18962 if $test `./findhdr stdarg.h`; then
18963         echo "<stdarg.h> found." >&4
18964         valstd="$define"
18965 else
18966         echo "<stdarg.h> NOT found." >&4
18967         valstd="$undef"
18968 fi
18969
18970 : see if varags is available
18971 echo " "
18972 if $test `./findhdr varargs.h`; then
18973         echo "<varargs.h> found." >&4
18974 else
18975         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18976 fi
18977
18978 : set up the varargs testing programs
18979 $cat > varargs.c <<EOP
18980 #ifdef I_STDARG
18981 #include <stdarg.h>
18982 #endif
18983 #ifdef I_VARARGS
18984 #include <varargs.h>
18985 #endif
18986
18987 #ifdef I_STDARG
18988 int f(char *p, ...)
18989 #else
18990 int f(va_alist)
18991 va_dcl
18992 #endif
18993 {
18994         va_list ap;
18995 #ifndef I_STDARG
18996         char *p;
18997 #endif
18998 #ifdef I_STDARG
18999         va_start(ap,p);
19000 #else
19001         va_start(ap);
19002         p = va_arg(ap, char *);
19003 #endif
19004         va_end(ap);
19005 }
19006 EOP
19007 $cat > varargs <<EOP
19008 $startsh
19009 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19010         echo "true"
19011 else
19012         echo "false"
19013 fi
19014 $rm -f varargs$_o
19015 EOP
19016 chmod +x varargs
19017
19018 : now check which varargs header should be included
19019 echo " "
19020 i_varhdr=''
19021 case "$valstd" in
19022 "$define")
19023         if `./varargs I_STDARG`; then
19024                 val='stdarg.h'
19025         elif `./varargs I_VARARGS`; then
19026                 val='varargs.h'
19027         fi
19028         ;;
19029 *)
19030         if `./varargs I_VARARGS`; then
19031                 val='varargs.h'
19032         fi
19033         ;;
19034 esac
19035 case "$val" in
19036 '')
19037 echo "I could not find the definition for va_dcl... You have problems..." >&4
19038         val="$undef"; set i_stdarg; eval $setvar
19039         val="$undef"; set i_varargs; eval $setvar
19040         ;;
19041 *) 
19042         set i_varhdr
19043         eval $setvar
19044         case "$i_varhdr" in
19045         stdarg.h)
19046                 val="$define"; set i_stdarg; eval $setvar
19047                 val="$undef"; set i_varargs; eval $setvar
19048                 ;;
19049         varargs.h)
19050                 val="$undef"; set i_stdarg; eval $setvar
19051                 val="$define"; set i_varargs; eval $setvar
19052                 ;;
19053         esac
19054         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19055 esac
19056 $rm -f varargs*
19057
19058 : see if we need va_copy
19059 echo " "
19060 case "$i_stdarg" in
19061 "$define")
19062         $cat >try.c <<EOCP
19063 #include <stdarg.h>
19064 #include <stdio.h>
19065 #$i_stdlib I_STDLIB
19066 #ifdef I_STDLIB
19067 #include <stdlib.h>
19068 #endif
19069 #include <signal.h>
19070
19071 int
19072 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19073 {
19074   return vfprintf(f, fmt, *valp);
19075 }
19076  
19077 int    
19078 myvfprintf(FILE *f, const  char *fmt, va_list val)
19079 {
19080   return ivfprintf(f, fmt, &val);
19081 }
19082       
19083 int
19084 myprintf(char *fmt, ...) 
19085 {
19086   va_list val;
19087   va_start(val, fmt);
19088   return myvfprintf(stdout, fmt, val); 
19089 }         
19090
19091 int
19092 main(int ac, char **av)
19093 {
19094   signal(SIGSEGV, exit);
19095
19096   myprintf("%s%cs all right, then\n", "that", '\'');                            
19097   exit(0);      
19098 }
19099 EOCP
19100         set try
19101         if eval $compile && $run ./try 2>&1 >/dev/null; then
19102                 case "`$run ./try`" in
19103                 "that's all right, then")
19104                         okay=yes
19105                         ;;
19106                 esac
19107         fi
19108         case "$okay" in
19109         yes)    echo "It seems that you don't need va_copy()." >&4
19110                 need_va_copy="$undef"
19111                 ;;
19112         *)      echo "It seems that va_copy() or similar will be needed." >&4
19113                 need_va_copy="$define"
19114                 ;;
19115         esac
19116         $rm -f try.* core core.* *.core *.core.*
19117         ;;
19118 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19119         ;;
19120 esac
19121
19122 : see what type is used for size_t
19123 rp="What is the type used for the length parameter for string functions?"
19124 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19125 eval $typedef_ask
19126
19127 : check for type of arguments to gethostbyaddr. 
19128 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19129         case "$d_gethbyaddr" in
19130         $define)
19131                 $cat <<EOM
19132
19133 Checking to see what type of arguments are accepted by gethostbyaddr().
19134 EOM
19135                 hdrs="$define sys/types.h
19136                         $d_socket sys/socket.h 
19137                         $i_niin netinet/in.h 
19138                         $i_netdb netdb.h
19139                         $i_unistd unistd.h"
19140                 : The first arg can 'char *' or 'void *'
19141                 : The second arg is some of integral type
19142                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19143                         for yyy in size_t long int; do
19144                                 case "$netdb_host_type" in
19145                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19146                                         if ./protochk "$try" $hdrs; then
19147                                                 echo "Your system accepts $xxx for the first arg."
19148                                                 echo "...and $yyy for the second arg."
19149                                                 netdb_host_type="$xxx"
19150                                                 netdb_hlen_type="$yyy"
19151                                         fi
19152                                         ;;
19153                                 esac
19154                         done
19155                 done
19156                 : In case none of those worked, prompt the user.
19157                 case "$netdb_host_type" in
19158                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19159                         dflt='char *'
19160                         . ./myread
19161                         netdb_host_type=$ans
19162                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19163                         dflt="$sizetype"
19164                         . ./myread
19165                         netdb_hlen_type=$ans
19166                         ;;
19167                 esac
19168                 ;;
19169         *)      : no gethostbyaddr, so pick harmless defaults
19170                 netdb_host_type='char *'
19171                 netdb_hlen_type="$sizetype"
19172                 ;;
19173         esac
19174         # Remove the "const" if needed. -- but then we'll have a 
19175         # prototype clash!
19176         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19177 fi
19178
19179 : check for type of argument to gethostbyname. 
19180 if test "X$netdb_name_type" = X ; then
19181         case "$d_gethbyname" in
19182         $define)
19183                 $cat <<EOM
19184
19185 Checking to see what type of argument is accepted by gethostbyname().
19186 EOM
19187                 hdrs="$define sys/types.h
19188                         $d_socket sys/socket.h 
19189                         $i_niin netinet/in.h 
19190                         $i_netdb netdb.h
19191                         $i_unistd unistd.h"
19192                 for xxx in "const char *" "char *"; do
19193                         case "$netdb_name_type" in
19194                         '')     try="extern struct hostent *gethostbyname($xxx);"
19195                                 if ./protochk "$try" $hdrs; then
19196                                         echo "Your system accepts $xxx."
19197                                         netdb_name_type="$xxx"
19198                                 fi
19199                                 ;;
19200                         esac
19201                 done
19202                 : In case none of those worked, prompt the user.
19203                 case "$netdb_name_type" in
19204                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19205                         dflt='char *'
19206                         . ./myread
19207                         netdb_name_type=$ans
19208                         ;;
19209                 esac
19210                 ;;
19211         *)      : no gethostbyname, so pick harmless default
19212                 netdb_name_type='char *'
19213                 ;;
19214         esac
19215 fi
19216
19217 : check for type of 1st argument to getnetbyaddr. 
19218 if test "X$netdb_net_type" = X ; then
19219         case "$d_getnbyaddr" in
19220         $define)
19221                 $cat <<EOM
19222
19223 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19224 EOM
19225                 hdrs="$define sys/types.h
19226                         $d_socket sys/socket.h 
19227                         $i_niin netinet/in.h 
19228                         $i_netdb netdb.h
19229                         $i_unistd unistd.h"
19230                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19231                         case "$netdb_net_type" in
19232                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19233                                 if ./protochk "$try" $hdrs; then
19234                                         echo "Your system accepts $xxx."
19235                                         netdb_net_type="$xxx"
19236                                 fi
19237                                 ;;
19238                         esac
19239                 done
19240                 : In case none of those worked, prompt the user.
19241                 case "$netdb_net_type" in
19242                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19243                         dflt='long'
19244                         . ./myread
19245                         netdb_net_type=$ans
19246                         ;;
19247                 esac
19248                 ;;
19249         *)      : no getnetbyaddr, so pick harmless default
19250                 netdb_net_type='long'
19251                 ;;
19252         esac
19253 fi
19254 : locate the preferred pager for this system
19255 fn=f/
19256 case "$pager" in
19257 '')
19258         dflt=''
19259         case "$pg" in
19260         /*) dflt=$pg;;
19261         [a-zA-Z]:/*) dflt=$pg;;
19262         esac
19263         case "$more" in
19264         /*) dflt=$more;;
19265         [a-zA-Z]:/*) dflt=$more;;
19266         esac
19267         case "$less" in
19268         /*) dflt=$less;;
19269         [a-zA-Z]:/*) dflt=$less;;
19270         esac
19271         case "$dflt" in
19272         '') dflt=/usr/ucb/more;;
19273         esac
19274         ;;
19275 *)      dflt="$pager"
19276         : Instruct ./getfile to trust the hinted or previous pager value,
19277         : even if it does not begin with a slash.  For example, on os2,
19278         : pager might be cmd /c more.  See comments in UU/getfile.
19279         fn="f/($pager)"
19280         ;;
19281 esac
19282 echo " "
19283 rp='What pager is used on your system?'
19284 . ./getfile
19285 pager="$ans"
19286
19287 : see what type pids are declared as in the kernel
19288 rp="What is the type of process ids on this system?"
19289 set pid_t pidtype int stdio.h sys/types.h
19290 eval $typedef_ask
19291
19292 : see if ar generates random libraries by itself
19293 echo " "
19294 echo "Checking how to generate random libraries on your machine..." >&4
19295 echo 'int bar1() { return bar2(); }' > bar1.c
19296 echo 'int bar2() { return 2; }' > bar2.c
19297 $cat > foo.c <<EOP
19298 #$i_stdlib I_STDLIB
19299 #ifdef I_STDLIB
19300 #include <stdlib.h>
19301 #endif
19302 int main() { printf("%d\n", bar1()); exit(0); }
19303 EOP
19304 $cc $ccflags -c bar1.c >/dev/null 2>&1
19305 $cc $ccflags -c bar2.c >/dev/null 2>&1
19306 $cc $ccflags -c foo.c >/dev/null 2>&1
19307 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19308 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19309         $run ./foobar >/dev/null 2>&1; then
19310         echo "$ar appears to generate random libraries itself."
19311         orderlib=false
19312         if [ "X$ranlib" = "X" ]; then
19313             ranlib=":"
19314         fi
19315 elif $ar s bar$_a >/dev/null 2>&1 &&
19316         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19317         $run ./foobar >/dev/null 2>&1; then
19318                 echo "a table of contents needs to be added with '$ar s'."
19319                 orderlib=false
19320                 ranlib="$ar s"
19321 elif $ar ts bar$_a >/dev/null 2>&1 &&
19322         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19323         $run ./foobar >/dev/null 2>&1; then
19324                 echo "a table of contents needs to be added with '$ar ts'."
19325                 orderlib=false
19326                 ranlib="$ar ts"
19327 else
19328         case "$ranlib" in
19329         :) ranlib='';;
19330         '')
19331                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19332                 $test -f $ranlib || ranlib=''
19333                 ;;
19334         esac
19335         if $test -n "$ranlib"; then
19336                 echo "your system has '$ranlib'; we'll use that."
19337                 orderlib=false
19338         else
19339                 echo "your system doesn't seem to support random libraries"
19340                 echo "so we'll use lorder and tsort to order the libraries."
19341                 orderlib=true
19342                 ranlib=":"
19343         fi
19344 fi
19345 $rm -f foo* bar*
19346
19347 : check for type of arguments to select. 
19348 case "$selecttype" in
19349 '') case "$d_select" in
19350         $define)
19351                 echo " "
19352                 $cat <<EOM
19353 Checking to see what type of arguments are accepted by select().
19354 EOM
19355                 hdrs="$define sys/types.h
19356                         $i_systime sys/time.h 
19357                         $i_sysselct sys/select.h
19358                         $d_socket sys/socket.h"
19359                 : The first arg can be int, unsigned, or size_t
19360                 : The last arg may or may not be 'const'
19361                 val=''
19362                 : void pointer has been seen but using that
19363                 : breaks the selectminbits test
19364                 for xxx in 'fd_set *' 'int *'; do
19365                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19366                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19367                                         case "$val" in
19368                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19369                                                 if ./protochk "$try" $hdrs; then
19370                                                         echo "Your system accepts $xxx."
19371                                                         val="$xxx"
19372                                                 fi
19373                                                 ;;
19374                                         esac
19375                                 done
19376                         done
19377                 done
19378                 case "$val" in
19379                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19380                         case "$d_fd_set" in
19381                                 $define) dflt="fd_set *" ;;
19382                                 *)              dflt="int *" ;;
19383                         esac
19384                         . ./myread
19385                         val=$ans
19386                         ;;
19387                 esac
19388                 selecttype="$val"
19389                 ;;
19390         *)      : no select, so pick a harmless default
19391                 selecttype='int *'
19392                 ;;
19393         esac
19394         ;;
19395 esac
19396
19397 : check for the select 'width'
19398 case "$selectminbits" in
19399 '') safebits=`expr $ptrsize \* 8`
19400     case "$d_select" in
19401         $define)
19402                 $cat <<EOM
19403
19404 Checking to see on how many bits at a time your select() operates...
19405 EOM
19406                 $cat >try.c <<EOCP
19407 #include <sys/types.h>
19408 #$i_time I_TIME
19409 #$i_systime I_SYS_TIME
19410 #$i_systimek I_SYS_TIME_KERNEL
19411 #ifdef I_TIME
19412 #   include <time.h>
19413 #endif
19414 #ifdef I_SYS_TIME
19415 #   ifdef I_SYS_TIME_KERNEL
19416 #       define KERNEL
19417 #   endif
19418 #   include <sys/time.h>
19419 #   ifdef I_SYS_TIME_KERNEL
19420 #       undef KERNEL
19421 #   endif
19422 #endif
19423 #$i_sysselct I_SYS_SELECT
19424 #ifdef I_SYS_SELECT
19425 #include <sys/select.h>
19426 #endif
19427 #$d_socket HAS_SOCKET
19428 #ifdef HAS_SOCKET
19429 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19430 #endif
19431 #include <stdio.h>
19432 #$i_stdlib I_STDLIB
19433 #ifdef I_STDLIB
19434 #include <stdlib.h>
19435 #endif
19436 $selecttype b;
19437 #define S sizeof(*(b))
19438 #define MINBITS 64
19439 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19440 #define NBITS  (NBYTES * 8)
19441 int main() {
19442     char *s = malloc(NBYTES);
19443     struct timeval t;
19444     int i;
19445     FILE* fp;
19446     int fd;
19447
19448     if (!s)
19449         exit(1);
19450     fclose(stdin);
19451     fp = fopen("try.c", "r");
19452     if (fp == 0)
19453       exit(2);
19454     fd = fileno(fp);
19455     if (fd < 0)
19456       exit(3);
19457     b = ($selecttype)s;
19458     for (i = 0; i < NBITS; i++)
19459         FD_SET(i, b);
19460     t.tv_sec  = 0;
19461     t.tv_usec = 0;
19462     select(fd + 1, b, 0, 0, &t);
19463     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19464     free(s);
19465     printf("%d\n", i + 1);
19466     return 0;
19467 }
19468 EOCP
19469                 set try
19470                 if eval $compile_ok; then
19471                         selectminbits=`$run ./try`
19472                         case "$selectminbits" in
19473                         '')     cat >&4 <<EOM
19474 Cannot figure out on how many bits at a time your select() operates.
19475 I'll play safe and guess it is $safebits bits.
19476 EOM
19477                                 selectminbits=$safebits
19478                                 bits="$safebits bits"
19479                                 ;;
19480                         1)      bits="1 bit" ;;
19481                         *)      bits="$selectminbits bits" ;;
19482                         esac
19483                         echo "Your select() operates on $bits at a time." >&4
19484                 else
19485                         rp='What is the minimum number of bits your select() operates on?'
19486                         case "$byteorder" in
19487                         12345678)       dflt=64 ;;
19488                         1234)           dflt=32 ;;
19489                         *)              dflt=1  ;;
19490                         esac
19491                         . ./myread
19492                         val=$ans
19493                         selectminbits="$val"
19494                 fi
19495                 $rm -f try.* try
19496                 ;;
19497         *)      : no select, so pick a harmless default
19498                 selectminbits=$safebits
19499                 ;;
19500         esac
19501         ;;
19502 esac
19503
19504 : Trace out the files included by signal.h, then look for SIGxxx names.
19505 : Remove SIGARRAYSIZE used by HPUX.
19506 : Remove SIGSTKSIZE used by Linux.
19507 : Remove SIGSTKSZ used by Posix.
19508 : Remove SIGTYP void lines used by OS2.
19509 : Some cpps, like os390, dont give the file name anywhere
19510 if [ "X$fieldn" = X ]; then
19511         : Just make some guesses.  We check them later.
19512         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19513 else
19514         xxx=`echo '#include <signal.h>' |
19515         $cppstdin $cppminus $cppflags 2>/dev/null |
19516         $grep '^[       ]*#.*include' | 
19517         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19518 fi
19519 : Check this list of files to be sure we have parsed the cpp output ok.
19520 : This will also avoid potentially non-existent files, such 
19521 : as ../foo/bar.h
19522 xxxfiles=''
19523 for xx in $xxx /dev/null ; do
19524         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19525 done
19526 : If we have found no files, at least try signal.h
19527 case "$xxxfiles" in
19528 '')     xxxfiles=`./findhdr signal.h` ;;
19529 esac
19530 xxx=`awk '
19531 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19532         print substr($2, 4, 20)
19533 }
19534 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19535         print substr($3, 4, 20)
19536 }' $xxxfiles`
19537 : Append some common names just in case the awk scan failed.
19538 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19539 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19540 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19541 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19542 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19543
19544 : generate a few handy files for later
19545 $cat > signal.c <<EOCP
19546 #include <sys/types.h>
19547 #include <signal.h>
19548 #$i_stdlib I_STDLIB
19549 #ifdef I_STDLIB
19550 #include <stdlib.h>
19551 #endif
19552 #include <stdio.h>
19553 int main() {
19554
19555 /* Strange style to avoid deeply-nested #if/#else/#endif */
19556 #ifndef NSIG
19557 #  ifdef _NSIG
19558 #    define NSIG (_NSIG)
19559 #  endif
19560 #endif
19561
19562 #ifndef NSIG
19563 #  ifdef SIGMAX
19564 #    define NSIG (SIGMAX+1)
19565 #  endif
19566 #endif
19567
19568 #ifndef NSIG
19569 #  ifdef SIG_MAX
19570 #    define NSIG (SIG_MAX+1)
19571 #  endif
19572 #endif
19573
19574 #ifndef NSIG
19575 #  ifdef _SIG_MAX
19576 #    define NSIG (_SIG_MAX+1)
19577 #  endif
19578 #endif
19579
19580 #ifndef NSIG
19581 #  ifdef MAXSIG
19582 #    define NSIG (MAXSIG+1)
19583 #  endif
19584 #endif
19585
19586 #ifndef NSIG
19587 #  ifdef MAX_SIG
19588 #    define NSIG (MAX_SIG+1)
19589 #  endif
19590 #endif
19591
19592 #ifndef NSIG
19593 #  ifdef SIGARRAYSIZE
19594 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19595 #  endif
19596 #endif
19597
19598 #ifndef NSIG
19599 #  ifdef _sys_nsig
19600 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19601 #  endif
19602 #endif
19603
19604 /* Default to some arbitrary number that's big enough to get most
19605    of the common signals.
19606 */
19607 #ifndef NSIG
19608 #    define NSIG 50
19609 #endif
19610
19611 printf("NSIG %d\n", NSIG);
19612
19613 #ifndef JUST_NSIG
19614
19615 EOCP
19616
19617 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19618 {
19619         printf "#ifdef SIG"; printf $1; printf "\n"
19620         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19621         printf $1; printf ");\n"
19622         printf "#endif\n"
19623 }
19624 END {
19625         printf "#endif /* JUST_NSIG */\n";
19626         printf "exit(0);\n}\n";
19627 }
19628 ' >>signal.c
19629 $cat >signal.awk <<'EOP'
19630 BEGIN { ndups = 0 }
19631 $1 ~ /^NSIG$/ { nsig = $2 }
19632 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19633     if ($2 > maxsig) { maxsig = $2 }
19634     if (sig_name[$2]) {
19635         dup_name[ndups] = $1
19636         dup_num[ndups] = $2
19637         ndups++ 
19638     }
19639     else {
19640         sig_name[$2] = $1
19641         sig_num[$2] = $2
19642     }
19643 }
19644 END { 
19645     if (nsig == 0) {
19646         nsig = maxsig + 1
19647     }
19648     printf("NSIG %d\n", nsig);
19649     for (n = 1; n < nsig; n++) {
19650         if (sig_name[n]) {
19651             printf("%s %d\n", sig_name[n], sig_num[n])
19652         }
19653         else {
19654             printf("NUM%d %d\n", n, n) 
19655         }
19656     }
19657     for (n = 0; n < ndups; n++) {
19658         printf("%s %d\n", dup_name[n], dup_num[n])
19659     }
19660 }
19661 EOP
19662 $cat >signal_cmd <<EOS
19663 $startsh
19664 if $test -s signal.lst; then
19665     echo "Using your existing signal.lst file"
19666         exit 0
19667 fi
19668 xxx="$xxx"
19669 EOS
19670 $cat >>signal_cmd <<'EOS'
19671
19672 set signal
19673 if eval $compile_ok; then
19674         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19675 else
19676         echo "(I can't seem be able to compile the whole test program)" >&4
19677         echo "(I'll try it in little pieces.)" >&4
19678         set signal -DJUST_NSIG
19679         if eval $compile_ok; then
19680                 $run ./signal$_exe > signal.nsg
19681                 $cat signal.nsg
19682         else
19683                 echo "I can't seem to figure out how many signals you have." >&4
19684                 echo "Guessing 50." >&4
19685                 echo 'NSIG 50' > signal.nsg
19686         fi
19687         : Now look at all the signal names, one at a time.
19688         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19689                 $cat > signal.c <<EOCP
19690 #include <sys/types.h>
19691 #include <signal.h>
19692 #include <stdio.h>
19693 int main() {
19694 printf("$xx %d\n", SIG${xx});
19695 return 0;
19696 }
19697 EOCP
19698                 set signal
19699                 if eval $compile; then
19700                         echo "SIG${xx} found."
19701                         $run ./signal$_exe  >> signal.ls1
19702                 else
19703                         echo "SIG${xx} NOT found."
19704                 fi
19705         done
19706         if $test -s signal.ls1; then
19707                 $cat signal.nsg signal.ls1 |
19708                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19709         fi
19710
19711 fi
19712 if $test -s signal.lst; then
19713         :
19714 else
19715         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19716         echo 'kill -l' >signal
19717         set X `csh -f <signal`
19718         $rm -f signal
19719         shift
19720         case $# in
19721         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19722         esac
19723         echo $@ | $tr ' ' $trnl | \
19724             $awk '{ printf "%s %d\n", $1, ++s; }
19725                   END { printf "NSIG %d\n", ++s }' >signal.lst
19726 fi
19727 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19728 EOS
19729 chmod a+x signal_cmd
19730 $eunicefix signal_cmd
19731
19732 : generate list of signal names
19733 echo " "
19734 case "$sig_name_init" in
19735 '') doinit=yes ;;
19736 *)  case "$sig_num_init" in
19737     ''|*,*) doinit=yes ;;
19738     esac ;;
19739 esac
19740 case "$doinit" in
19741 yes)
19742         echo "Generating a list of signal names and numbers..." >&4
19743         . ./signal_cmd
19744         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19745         sig_name=`$awk 'BEGIN { printf "ZERO " }
19746                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19747         sig_num=`$awk  'BEGIN { printf "0 " }
19748                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19749         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19750                              !/^NSIG/   { printf "\"%s\", ", $1 }
19751                              END        { printf "0\n" }' signal.lst`
19752         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19753                              !/^NSIG/   { printf "%d, ", $2}
19754                              END        { printf "0\n"}' signal.lst`
19755         ;;
19756 esac
19757 echo "The following $sig_count signals are available:"
19758 echo " "
19759 echo $sig_name | $awk \
19760 'BEGIN { linelen = 0 }
19761 {
19762         for (i = 1; i <= NF; i++) {
19763                 name = "SIG" $i " "
19764                 linelen = linelen + length(name)
19765                 if (linelen > 70) {
19766                         printf "\n"
19767                         linelen = length(name)
19768                 }
19769                 printf "%s", name
19770         }
19771         printf "\n"
19772 }'
19773 sig_size=`echo $sig_name | awk '{print NF}'`
19774 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19775
19776 echo " "
19777 case "$sizetype" in
19778 *_t) zzz="$sizetype"    ;;
19779 *)   zzz="filesize"     ;;
19780 esac
19781 echo "Checking the size of $zzz..." >&4 
19782 cat > try.c <<EOCP
19783 #include <sys/types.h>
19784 #include <stdio.h>
19785 #$i_stdlib I_STDLIB
19786 #ifdef I_STDLIB
19787 #include <stdlib.h>
19788 #endif
19789 int main() {
19790     printf("%d\n", (int)sizeof($sizetype));
19791     exit(0);
19792 }
19793 EOCP
19794 set try
19795 if eval $compile_ok; then
19796         yyy=`$run ./try`
19797         case "$yyy" in
19798         '')     sizesize=4
19799                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19800                 ;;
19801         *)      sizesize=$yyy
19802                 echo "Your $zzz size is $sizesize bytes."
19803                 ;;
19804         esac
19805 else
19806         sizesize=4
19807         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19808 fi
19809
19810
19811 : check for socklen_t
19812 echo " "
19813 echo "Checking to see if you have socklen_t..." >&4
19814 $cat >try.c <<EOCP
19815 #include <sys/types.h>
19816 #$d_socket HAS_SOCKET
19817 #ifdef HAS_SOCKET
19818 #include <sys/socket.h>
19819 #endif
19820 int main() { socklen_t x = 16; }
19821 EOCP
19822 set try
19823 if eval $compile; then
19824         val="$define"
19825         echo "You have socklen_t."
19826 else
19827         val="$undef"
19828         echo "You do not have socklen_t."
19829         case "$sizetype" in
19830         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19831         esac
19832 fi
19833 $rm -f try try.*
19834 set d_socklen_t
19835 eval $setvar
19836
19837 : see if this is a socks.h system
19838 set socks.h i_socks
19839 eval $inhdr
19840
19841 : check for type of the size argument to socket calls
19842 case "$d_socket" in
19843 "$define")
19844         $cat <<EOM
19845
19846 Checking to see what type is the last argument of accept().
19847 EOM
19848         yyy=''
19849         case "$d_socklen_t" in
19850         "$define") yyy="$yyy socklen_t"
19851         esac
19852         yyy="$yyy $sizetype int long unsigned"
19853         for xxx in $yyy; do
19854                 case "$socksizetype" in
19855                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19856                         case "$usesocks" in
19857                         "$define")
19858                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19859                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19860                                         socksizetype="$xxx"
19861                                 fi
19862                                 ;;
19863                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19864                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19865                                         socksizetype="$xxx"
19866                                 fi
19867                                 ;;
19868                         esac
19869                         ;;
19870                 esac
19871         done
19872 : In case none of those worked, prompt the user.
19873         case "$socksizetype" in
19874         '')     rp='What is the type for socket address structure sizes?'
19875                 dflt='int'
19876                 . ./myread
19877                 socksizetype=$ans
19878                 ;;
19879         esac
19880         ;;
19881 *)      : no sockets, so pick relatively harmless default
19882         socksizetype='int'
19883         ;;
19884 esac
19885
19886 : see what type is used for signed size_t
19887 set ssize_t ssizetype int stdio.h sys/types.h
19888 eval $typedef
19889 dflt="$ssizetype"
19890 $cat > try.c <<EOM
19891 #include <stdio.h>
19892 #$i_stdlib I_STDLIB
19893 #ifdef I_STDLIB
19894 #include <stdlib.h>
19895 #endif
19896 #include <sys/types.h>
19897 #define Size_t $sizetype
19898 #define SSize_t $dflt
19899 int main()
19900 {
19901         if (sizeof(Size_t) == sizeof(SSize_t))
19902                 printf("$dflt\n");
19903         else if (sizeof(Size_t) == sizeof(int))
19904                 printf("int\n");
19905         else 
19906                 printf("long\n");
19907         exit(0);
19908 }
19909 EOM
19910 echo " "
19911 set try
19912 if eval $compile_ok && $run ./try > /dev/null; then
19913         ssizetype=`$run ./try`
19914         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19915 else
19916         $cat >&4 <<EOM
19917 Help! I can't compile and run the ssize_t test program: please enlighten me!
19918 (This is probably a misconfiguration in your system or libraries, and
19919 you really ought to fix it.  Still, I'll try anyway.)
19920
19921 I need a type that is the same size as $sizetype, but is guaranteed to
19922 be signed.  Common values are ssize_t, int and long.
19923
19924 EOM
19925         rp="What signed type is the same size as $sizetype?"
19926         . ./myread
19927         ssizetype="$ans"
19928 fi
19929 $rm -f try try.*
19930
19931 : see what type of char stdio uses.
19932 echo " "
19933 echo '#include <stdio.h>' > stdio.c
19934 $cppstdin $cppminus < stdio.c > stdioh
19935 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19936         echo "Your stdio uses unsigned chars." >&4
19937         stdchar="unsigned char"
19938 else
19939         echo "Your stdio uses signed chars." >&4
19940         stdchar="char"
19941 fi
19942 $rm -f stdio.* stdioh
19943
19944 : see what type uids are declared as in the kernel
19945 echo " "
19946 echo "Looking for the type for user ids returned by getuid()."
19947 set uid_t uidtype xxx stdio.h sys/types.h
19948 eval $typedef
19949 case "$uidtype" in
19950 xxx)
19951         xxx=`./findhdr sys/user.h`
19952         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19953         case $1 in
19954         unsigned) dflt="$1 $2" ;;
19955         *) dflt="$1" ;;
19956         esac
19957         ;;
19958 *) dflt="$uidtype";;
19959 esac
19960 case "$uidtype" in
19961 uid_t)  echo "uid_t found." ;;
19962 *)      rp="What is the type for user ids returned by getuid()?"
19963         . ./myread
19964         uidtype="$ans"
19965         ;;
19966 esac
19967
19968 echo " "
19969 case "$uidtype" in
19970 *_t) zzz="$uidtype"     ;;
19971 *)   zzz="uid"          ;;
19972 esac
19973 echo "Checking the size of $zzz..." >&4 
19974 cat > try.c <<EOCP
19975 #include <sys/types.h>
19976 #include <stdio.h>
19977 #$i_stdlib I_STDLIB
19978 #ifdef I_STDLIB
19979 #include <stdlib.h>
19980 #endif
19981 int main() {
19982     printf("%d\n", (int)sizeof($uidtype));
19983     exit(0);
19984 }
19985 EOCP
19986 set try
19987 if eval $compile_ok; then
19988         yyy=`$run ./try`
19989         case "$yyy" in
19990         '')     uidsize=4
19991                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19992                 ;;
19993         *)      uidsize=$yyy
19994                 echo "Your $zzz is $uidsize bytes long."
19995                 ;;
19996         esac
19997 else
19998         uidsize=4
19999         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20000 fi
20001
20002 echo " "
20003 case "$uidtype" in
20004 *_t) zzz="$uidtype"     ;;
20005 *)   zzz="uid"          ;;
20006 esac
20007 echo "Checking the sign of $zzz..." >&4
20008 cat > try.c <<EOCP
20009 #include <sys/types.h>
20010 #include <stdio.h>
20011 int main() {
20012         $uidtype foo = -1;
20013         if (foo < 0)
20014                 printf("-1\n");
20015         else
20016                 printf("1\n");
20017 }
20018 EOCP
20019 set try
20020 if eval $compile; then
20021         yyy=`$run ./try`
20022         case "$yyy" in
20023         '')     uidsign=1
20024                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20025                 ;;
20026         *)      uidsign=$yyy
20027                 case "$uidsign" in
20028                  1) echo "Your $zzz is unsigned." ;;
20029                 -1) echo "Your $zzz is signed."   ;;
20030                 esac
20031                 ;;
20032         esac
20033 else
20034         uidsign=1
20035         echo "(I can't compile the test program--guessing unsigned.)" >&4
20036 fi
20037
20038
20039
20040 echo " "
20041 $echo "Checking the format string to be used for uids..." >&4
20042
20043 case "$uidsign" in
20044 -1)     if $test X"$uidsize" = X"$ivsize"; then
20045                 uidformat="$ivdformat"
20046         else
20047                 if $test X"$uidsize" = X"$longsize"; then
20048                         uidformat='"ld"'
20049                 else
20050                         if $test X"$uidsize" = X"$intsize"; then
20051                                 uidformat='"d"'
20052                         else
20053                                 if $test X"$uidsize" = X"$shortsize"; then
20054                                         uidformat='"hd"'
20055                                 fi
20056                         fi
20057                 fi
20058         fi
20059         ;;
20060 *)      if $test X"$uidsize" = X"$uvsize"; then
20061                 uidformat="$uvuformat"
20062         else
20063                 if $test X"$uidsize" = X"$longsize"; then
20064                         uidformat='"lu"'
20065                 else
20066                         if $test X"$uidsize" = X"$intsize"; then
20067                                 uidformat='"u"'
20068                         else
20069                                 if $test X"$uidsize" = X"$shortsize"; then
20070                                         uidformat='"hu"'
20071                                 fi
20072                         fi
20073                 fi
20074         fi
20075         ;;
20076 esac
20077
20078
20079 case "$usesitecustomize" in
20080     $define|true|[Yy]*)
20081         usesitecustomize="$define"
20082         ;;
20083     *)
20084         usesitecustomize="$undef"
20085         ;;
20086     esac
20087
20088 : determine compiler compiler
20089 case "$yacc" in
20090 '')
20091         dflt=yacc;;
20092 *)
20093         dflt="$yacc";;
20094 esac
20095 echo " "
20096 comp='yacc'
20097 if $test -f "$byacc$_exe"; then
20098         dflt="$byacc"
20099         comp="byacc or $comp"
20100 fi
20101 if $test -f "$bison$_exe"; then
20102         comp="$comp or bison -y"
20103 fi
20104 rp="Which compiler compiler ($comp) shall I use?"
20105 . ./myread
20106 yacc="$ans"
20107 case "$yacc" in
20108 *bis*)
20109         case "$yacc" in
20110         *-y*) ;;
20111         *)
20112                 yacc="$yacc -y"
20113                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20114                 ;;
20115         esac
20116         ;;
20117 esac
20118
20119 : see if this is a fp.h system
20120 set fp.h i_fp
20121 eval $inhdr
20122
20123 : see if this is a fp_class.h system
20124 set fp_class.h i_fp_class
20125 eval $inhdr
20126
20127 : see if this is a ieeefp.h system
20128 case "$i_ieeefp" in
20129 '' ) set ieeefp.h i_ieeefp
20130      eval $inhdr
20131      ;;
20132 esac
20133
20134 : see if this is a libutil.h system
20135 set libutil.h i_libutil
20136 eval $inhdr
20137
20138 : see if mach cthreads are available
20139 if test "X$usethreads" = "X$define"; then
20140         set mach/cthreads.h i_machcthr
20141         eval $inhdr
20142 else
20143         i_machcthr="$undef"
20144 fi
20145
20146
20147
20148 : see if this is a mntent.h system
20149 set mntent.h i_mntent
20150 eval $inhdr
20151
20152 : see if ndbm.h is available
20153 set ndbm.h t_ndbm
20154 eval $inhdr
20155
20156 case "$t_ndbm" in
20157 $undef)
20158     # Some Linux distributions such as RedHat 7.1 put the
20159     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20160     if $test -f /usr/include/gdbm/ndbm.h; then
20161         echo '<gdbm/ndbm.h> found.'
20162         ccflags="$ccflags -I/usr/include/gdbm"
20163         cppflags="$cppflags -I/usr/include/gdbm"
20164         t_ndbm=$define
20165     fi
20166     ;;
20167 esac
20168
20169 case "$t_ndbm" in
20170 $define)
20171         : see if dbm_open exists
20172         set dbm_open d_dbm_open
20173         eval $inlibc
20174         case "$d_dbm_open" in
20175         $undef)
20176                 t_ndbm="$undef"
20177                 echo "We won't be including <ndbm.h>"
20178                 ;;
20179         esac
20180         ;;
20181 esac
20182 val="$t_ndbm"
20183 set i_ndbm
20184 eval $setvar
20185
20186 : see if net/errno.h is available
20187 val=''
20188 set net/errno.h val
20189 eval $inhdr
20190
20191 : Unfortunately, it causes problems on some systems.  Arrgh.
20192 case "$val" in
20193 $define)
20194         cat > try.c <<'EOM'
20195 #include <stdio.h>
20196 #include <errno.h>
20197 #include <net/errno.h>
20198 int func()
20199 {
20200         return ENOTSOCK;
20201 }
20202 EOM
20203         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20204                 echo "We'll be including <net/errno.h>." >&4
20205         else
20206                 echo "We won't be including <net/errno.h>." >&4
20207                 val="$undef"
20208         fi
20209         $rm -f try.* try
20210         ;;
20211 esac
20212 set i_neterrno
20213 eval $setvar
20214
20215 : see if netinet/tcp.h is available
20216 set netinet/tcp.h i_netinettcp
20217 eval $inhdr
20218
20219 : see if this is a poll.h system
20220 set poll.h i_poll
20221 eval $inhdr
20222
20223 : see if this is a prot.h system
20224 set prot.h i_prot
20225 eval $inhdr
20226
20227 echo " "
20228 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20229 $cat <<'EOSH' > Cppsym.know
20230 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20231 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20232 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20233 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20234 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20235 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20236 bull c cadmus clipper CMU COFF COMPILER_VERSION
20237 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20238 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20239 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20240 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20241 GLIBC GLIBC_MINOR
20242 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20243 H3050R H3050RX hbullx20 hcx host_mips
20244 hp200 hp300 hp700 HP700 hp800 hp9000
20245 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20246 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20247 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20248 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20249 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20250 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20251 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20252 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20253 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20254 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20255 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20256 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20257 MATH_HAS_NO_SIDE_EFFECTS
20258 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20259 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20260 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20261 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20262 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20263 NetBSD news1500 news1700 news1800 news1900 news3700
20264 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20265 ns32016 ns32332 ns32k nsc32000
20266 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20267 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20268 pc532 pdp11 PGC PIC plexus PORTAR posix
20269 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20270 POSIX_C_SOURCE POSIX_SOURCE POWER
20271 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20272 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20273 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20274 sony sony_news sonyrisc sparc sparclite spectrum
20275 stardent stdc STDC_EXT stratos sun sun3 sun386
20276 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20277 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20278 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20279 sysV68 sysV88 Tek4132 Tek4300 titan
20280 TM3200 TM5400 TM5600
20281 tower tower32 tower32_200 tower32_600 tower32_700
20282 tower32_800 tower32_850 tss
20283 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20284 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20285 unix UNIX95 UNIX99 unixpc unos
20286 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20287 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20288 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20289 USGr4 USGr4_2
20290 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20291 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20292 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20293 z8000
20294 EOSH
20295 # Maybe put other stuff here too.
20296 cat <<EOSH >>Cppsym.know
20297 $osname
20298 EOSH
20299 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20300 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20301 $cat Cppsym.know > Cppsym.c
20302 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20303 $rm -f Cppsym.a Cppsym.b Cppsym.c
20304 cat <<EOSH > Cppsym
20305 $startsh
20306 if $test \$# -gt 0; then
20307     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20308     if $test -s Cppsym.got; then
20309         $rm -f Cppsym.got
20310         exit 0
20311     fi
20312     $rm -f Cppsym.got
20313     exit 1
20314 else
20315     $tr " " "$trnl" | ./Cppsym.try
20316     exit 0
20317 fi
20318 EOSH
20319 chmod +x Cppsym
20320 $eunicefix Cppsym
20321 cat <<EOSH > Cppsym.try
20322 $startsh
20323 cat <<'EOCP' > try.c
20324 #include <stdio.h>
20325 #if cpp_stuff == 1
20326 #define STRINGIFY(a)    "a"
20327 #endif
20328 #if cpp_stuff == 42
20329 #define StGiFy(a)  #a
20330 #define STRINGIFY(a)    StGiFy(a)
20331 #endif
20332 #if $cpp_stuff != 1 && $cpp_stuff != 42
20333 #   include "Bletch: How does this C preprocessor stringify macros?"
20334 #endif
20335 int main() {
20336 EOCP
20337 $awk \\
20338 EOSH
20339 cat <<'EOSH' >> Cppsym.try
20340 'length($1) > 0 {
20341     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20342     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20343     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20344     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20345 }'       >> try.c
20346 echo 'return 0;}' >> try.c
20347 EOSH
20348 cat <<EOSH >> Cppsym.try
20349 ccflags="$ccflags"
20350 case "$osname-$gccversion" in
20351 irix-) ccflags="\$ccflags -woff 1178" ;;
20352 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20353 esac
20354 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20355 EOSH
20356 chmod +x Cppsym.try
20357 $eunicefix Cppsym.try
20358 ./Cppsym < Cppsym.know > Cppsym.true
20359 : Add in any linux cpp "predefined macros":
20360 case "$osname::$gccversion" in
20361   *linux*::*.*)
20362     tHdrH=_tmpHdr
20363     rm -f $tHdrH'.h' $tHdrH
20364     touch $tHdrH'.h'
20365     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20366        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20367        if [ -s $tHdrH'_cppsym.real' ]; then
20368           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20369        fi
20370     fi
20371     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20372   ;;
20373 esac
20374 : now check the C compiler for additional symbols
20375 postprocess_cc_v=''
20376 case "$osname" in
20377 aix) postprocess_cc_v="|$tr , ' '" ;;
20378 esac
20379 $cat >ccsym <<EOS
20380 $startsh
20381 $cat >tmp.c <<EOF
20382 extern int foo;
20383 EOF
20384 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20385 do
20386         case "\$i" in
20387         -D*) echo "\$i" | $sed 's/^-D//';;
20388         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20389         esac
20390 done
20391 $rm -f try.c
20392 EOS
20393 postprocess_cc_v=''
20394 chmod +x ccsym
20395 $eunicefix ccsym
20396 ./ccsym > ccsym1.raw
20397 if $test -s ccsym1.raw; then
20398        $sort ccsym1.raw | $uniq >ccsym.raw
20399 else
20400        mv ccsym1.raw ccsym.raw
20401 fi
20402
20403 $awk '/\=/ { print $0; next }
20404         { print $0"=1" }' ccsym.raw >ccsym.list
20405 $comm -13 Cppsym.true ccsym.list >ccsym.own
20406 $comm -12 Cppsym.true ccsym.list >ccsym.com
20407 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20408 also=''
20409 if $test -z ccsym.raw; then
20410         echo "Your C compiler doesn't seem to define any symbols!" >&4
20411         echo " "
20412         echo "However, your C preprocessor defines the following symbols:"
20413         $cat Cppsym.true
20414         ccsymbols=''
20415         cppsymbols=`$cat Cppsym.true`
20416         cppsymbols=`echo $cppsymbols`
20417         cppccsymbols="$cppsymbols"
20418 else
20419         if $test -s ccsym.com; then
20420                 echo "Your C compiler and pre-processor define these symbols:"
20421                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20422                 also='also '
20423                 symbols='ones'
20424                 cppccsymbols=`$cat ccsym.com`
20425                 cppccsymbols=`echo $cppccsymbols`
20426                 $test "$silent" || sleep 1
20427         fi
20428         if $test -s ccsym.cpp; then
20429                 $test "$also" && echo " "
20430                 echo "Your C pre-processor ${also}defines the following symbols:"
20431                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20432                 also='further '
20433                 cppsymbols=`$cat ccsym.cpp`
20434                 cppsymbols=`echo $cppsymbols`
20435                 $test "$silent" || sleep 1
20436         fi
20437         if $test -s ccsym.own; then
20438                 $test "$also" && echo " "
20439                 echo "Your C compiler ${also}defines the following cpp symbols:"
20440                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20441                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20442                 ccsymbols=`$cat ccsym.own`
20443                 ccsymbols=`echo $ccsymbols`
20444                 $test "$silent" || sleep 1
20445         fi
20446 fi
20447
20448 : see if this is a termio system
20449 val="$undef"
20450 val2="$undef"
20451 val3="$undef"
20452 if $test `./findhdr termios.h`; then
20453         set tcsetattr i_termios
20454         eval $inlibc
20455         val3="$i_termios"
20456 fi
20457 echo " "
20458 case "$val3" in
20459 "$define") echo "You have POSIX termios.h... good!" >&4;;
20460 *) if ./Cppsym pyr; then
20461                 case "`/bin/universe`" in
20462                 ucb) if $test `./findhdr sgtty.h`; then
20463                                 val2="$define"
20464                                 echo "<sgtty.h> found." >&4
20465                         else
20466                                 echo "System is pyramid with BSD universe."
20467                                 echo "<sgtty.h> not found--you could have problems." >&4
20468                         fi;;
20469                 *) if $test `./findhdr termio.h`; then
20470                                 val="$define"
20471                                 echo "<termio.h> found." >&4
20472                         else
20473                                 echo "System is pyramid with USG universe."
20474                                 echo "<termio.h> not found--you could have problems." >&4
20475                         fi;;
20476                 esac
20477         elif ./usg; then
20478                 if $test `./findhdr termio.h`; then
20479                         echo "<termio.h> found." >&4
20480                         val="$define"
20481                 elif $test `./findhdr sgtty.h`; then
20482                         echo "<sgtty.h> found." >&4
20483                         val2="$define"
20484                 else
20485 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20486                 fi
20487         else
20488                 if $test `./findhdr sgtty.h`; then
20489                         echo "<sgtty.h> found." >&4
20490                         val2="$define"
20491                 elif $test `./findhdr termio.h`; then
20492                         echo "<termio.h> found." >&4
20493                         val="$define"
20494                 else
20495 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20496                 fi
20497         fi;;
20498 esac
20499 set i_termio; eval $setvar
20500 val=$val2; set i_sgtty; eval $setvar
20501 val=$val3; set i_termios; eval $setvar
20502
20503 : see if stddef is available
20504 set stddef.h i_stddef
20505 eval $inhdr
20506
20507 : see if this is a sunmath.h system
20508 set sunmath.h i_sunmath
20509 eval $inhdr
20510
20511 : see if sys/access.h is available
20512 set sys/access.h i_sysaccess
20513 eval $inhdr
20514
20515 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20516 set sys/filio.h i_sysfilio
20517 eval $inhdr
20518 echo " "
20519 if $test `./findhdr sys/ioctl.h`; then
20520         val="$define"
20521         echo '<sys/ioctl.h> found.' >&4
20522 else
20523         val="$undef"
20524         if $test $i_sysfilio = "$define"; then
20525             echo '<sys/ioctl.h> NOT found.' >&4
20526         else
20527                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20528                 $test $i_termio = "$define" && xxx="termio.h"
20529                 $test $i_termios = "$define" && xxx="termios.h"
20530 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20531         fi
20532 fi
20533 set i_sysioctl
20534 eval $setvar
20535
20536 : see if socket ioctl defs are in sys/sockio.h
20537 echo " "
20538 xxx=`./findhdr sys/sockio.h`
20539 if $test "$xxx"; then
20540         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20541                 val="$define"
20542                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20543         else
20544                 val="$undef"
20545                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20546         fi
20547 else
20548         val="$undef"
20549         $cat <<EOM
20550 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20551 EOM
20552 fi
20553 set i_syssockio
20554 eval $setvar
20555
20556
20557 : see if this is a syslog.h system
20558 set syslog.h i_syslog
20559 eval $inhdr
20560
20561
20562 : see if this is a sys/mode.h system
20563 set sys/mode.h i_sysmode
20564 eval $inhdr
20565
20566 : see if sys/resource.h has to be included
20567 set sys/resource.h i_sysresrc
20568 eval $inhdr
20569
20570 : see if sys/security.h is available
20571 set sys/security.h i_syssecrt
20572 eval $inhdr
20573
20574 : see if this is a sys/statvfs.h system
20575 set sys/statvfs.h i_sysstatvfs
20576 eval $inhdr
20577
20578 : see if this is a sys/un.h system
20579 set sys/un.h i_sysun
20580 eval $inhdr
20581
20582
20583 : see if this is a sys/utsname.h system
20584 set sys/utsname.h i_sysutsname
20585 eval $inhdr
20586
20587 : see if this is a syswait system
20588 set sys/wait.h i_syswait
20589 eval $inhdr
20590
20591 : see if this is a ustat.h system
20592 set ustat.h i_ustat
20593 eval $inhdr
20594
20595 : see if this is an utime system
20596 set utime.h i_utime
20597 eval $inhdr
20598
20599 : see if this is a values.h system
20600 set values.h i_values
20601 eval $inhdr
20602
20603 : see if this is a vfork system
20604 case "$d_vfork" in
20605 "$define")
20606         set vfork.h i_vfork
20607         eval $inhdr
20608         ;;
20609 *)
20610         i_vfork="$undef"
20611         ;;
20612 esac
20613
20614 : see if gdbm.h is available
20615 set gdbm.h t_gdbm
20616 eval $inhdr
20617 case "$t_gdbm" in
20618 $define)
20619         : see if gdbm_open exists
20620         set gdbm_open d_gdbm_open
20621         eval $inlibc
20622         case "$d_gdbm_open" in
20623         $undef)
20624                 t_gdbm="$undef"
20625                 echo "We won't be including <gdbm.h>"
20626                 ;;
20627         esac
20628         ;;
20629 esac
20630 val="$t_gdbm"
20631 set i_gdbm
20632 eval $setvar
20633
20634 echo " "
20635 echo "Looking for extensions..." >&4
20636 : If we are using the old config.sh, known_extensions may contain
20637 : old or inaccurate or duplicate values.
20638 known_extensions=''
20639 nonxs_extensions=''
20640 : We do not use find because it might not be available.
20641 : We do not just use MANIFEST because the user may have dropped
20642 : some additional extensions into the source tree and expect them
20643 : to be built.
20644
20645 : Function to recursively find available extensions, ignoring DynaLoader
20646 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20647 find_extensions='
20648     for xxx in *; do
20649        case "$xxx" in
20650            DynaLoader|dynaload) ;;
20651            *)
20652            if $test -f $xxx/$xxx.xs; then
20653                known_extensions="$known_extensions $1$xxx";
20654            elif $test -f $xxx/Makefile.PL; then
20655                nonxs_extensions="$nonxs_extensions $1$xxx";
20656            else
20657                if $test -d $xxx -a $# -lt 10; then
20658                    set $1$xxx/ $*;
20659                    cd "$xxx";
20660                    eval $find_extensions;
20661                    cd ..;
20662                    shift;
20663                fi;
20664            fi
20665            ;;
20666        esac;
20667     done'
20668 tdir=`pwd`
20669 cd "$rsrc/ext"
20670 set X
20671 shift
20672 eval $find_extensions
20673 # Special case:  Add in threads/shared since it is not picked up by the
20674 # recursive find above (and adding in general recursive finding breaks
20675 # SDBM_File/sdbm).  A.D.  10/25/2001.
20676 known_extensions="$known_extensions threads/shared"
20677 set X $nonxs_extensions
20678 shift
20679 nonxs_extensions="$*"
20680 set X $known_extensions
20681 shift
20682 known_extensions="$*"
20683 cd "$tdir"
20684
20685 : Now see which are supported on this system.
20686 avail_ext=''
20687 for xxx in $known_extensions ; do
20688         case "$xxx" in
20689         DB_File|db_file)
20690                 case "$i_db" in
20691                 $define) avail_ext="$avail_ext $xxx" ;;
20692                 esac
20693                 ;;
20694         GDBM_File|gdbm_fil)
20695                 case "$i_gdbm" in 
20696                 $define) avail_ext="$avail_ext $xxx" ;;
20697                 esac
20698                 ;;
20699         I18N/Langinfo|i18n_lan)
20700                 case "$i_langinfo$d_nl_langinfo" in 
20701                 $define$define) avail_ext="$avail_ext $xxx" ;;
20702                 esac
20703                 ;;
20704         NDBM_File|ndbm_fil)
20705                 case "$i_ndbm" in
20706                 $define)
20707                     case "$osname-$use64bitint" in
20708                     hpux-define)
20709                         case "$libs" in
20710                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20711                         esac
20712                         ;;
20713                     *) avail_ext="$avail_ext $xxx" ;;
20714                     esac
20715                     ;;
20716                 esac
20717                 ;;
20718         ODBM_File|odbm_fil) 
20719                 case "${i_dbm}${i_rpcsvcdbm}" in
20720                 *"${define}"*)
20721                     case "$osname-$use64bitint" in
20722                     hpux-define)
20723                         case "$libs" in
20724                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20725                         esac
20726                         ;;
20727                     *) avail_ext="$avail_ext $xxx" ;;
20728                     esac
20729                     ;;
20730                 esac
20731                 ;;
20732         POSIX|posix)
20733                 case "$useposix" in
20734                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20735                 esac
20736                 ;;
20737         Opcode|opcode)
20738                 case "$useopcode" in
20739                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20740                 esac
20741                 ;;
20742         Socket|socket)
20743                 case "$d_socket" in 
20744                 true|$define|y)
20745                     case "$osname" in
20746                     beos) ;; # not unless BONE
20747                     *) avail_ext="$avail_ext $xxx" ;;
20748                     esac
20749                     ;;
20750                 esac
20751                 ;;
20752         Sys/Syslog|sys/syslog)
20753                 : XXX syslog requires socket
20754                 case "$d_socket" in 
20755                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20756                 esac
20757                 ;;
20758         Thread|thread)
20759                 case "$usethreads" in
20760                 true|$define|y)
20761                         case "$useithreads" in
20762                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20763                         esac
20764                 esac
20765                 ;;
20766         XS/APItest|xs/apitest)
20767                 # This is just for testing.  Skip it unless we have dynamic loading.
20768
20769                 case "$usedl" in
20770                 $define) avail_ext="$avail_ext $xxx" ;;
20771                 esac
20772                 ;;
20773         XS/Typemap|xs/typemap)
20774                 # This is just for testing.  Skip it unless we have dynamic loading.
20775                 case "$usedl" in
20776                 $define) avail_ext="$avail_ext $xxx" ;;
20777                 esac
20778                 ;;
20779         threads|threads/shared)
20780                 # threads and threads::shared are special cases.
20781                 # To stop people from asking "Perl 5.8.0 was supposed
20782                 # to have this new fancy threads implementation but my
20783                 # perl doesn't have it" and from people trying to
20784                 # (re)install the threads module using CPAN.pm and
20785                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20786                 # the threads.pm and threads/shared.pm will always be
20787                 # there, croaking informatively ("you need to rebuild
20788                 # all of Perl with threads, sorry") when threads haven't
20789                 # been compiled in.
20790                 # --jhi
20791                 avail_ext="$avail_ext $xxx"
20792                 ;;
20793         IPC/SysV|ipc/sysv)
20794                 : XXX Do we need a useipcsysv variable here
20795                 case "${d_msg}${d_sem}${d_shm}" in 
20796                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20797                 esac
20798                 ;;
20799         *)      avail_ext="$avail_ext $xxx"
20800                 ;;
20801         esac
20802 done
20803
20804 set X $avail_ext
20805 shift
20806 avail_ext="$*"
20807
20808 case "$onlyextensions" in
20809 '') ;;
20810 *)  keepextensions=''
20811     echo "You have requested that only certains extensions be included..." >&4
20812     for i in $onlyextensions; do
20813         case " $avail_ext " in
20814         *" $i "*)
20815             echo "Keeping extension $i."
20816             keepextensions="$keepextensions $i"
20817             ;;
20818         *) echo "Ignoring extension $i." ;;
20819         esac
20820     done
20821     avail_ext="$keepextensions"
20822     ;;
20823 esac
20824
20825 case "$noextensions" in
20826 '') ;;
20827 *)  keepextensions=''
20828     echo "You have requested that certain extensions be ignored..." >&4
20829     for i in $avail_ext; do
20830         case " $noextensions " in
20831         *" $i "*) echo "Ignoring extension $i." ;;
20832         *) echo "Keeping extension $i.";
20833            keepextensions="$keepextensions $i"
20834            ;;
20835         esac
20836     done
20837     avail_ext="$keepextensions"
20838     ;;
20839 esac
20840
20841 : Now see which nonxs extensions are supported on this system.
20842 : For now assume all are.
20843 nonxs_ext=''
20844 for xxx in $nonxs_extensions ; do
20845         case "$xxx" in
20846         *)      nonxs_ext="$nonxs_ext $xxx"
20847                 ;;
20848         esac
20849 done
20850
20851 set X $nonxs_ext
20852 shift
20853 nonxs_ext="$*"
20854
20855 case $usedl in
20856 $define)
20857         $cat <<EOM
20858 A number of extensions are supplied with $package.  You may choose to
20859 compile these extensions for dynamic loading (the default), compile
20860 them into the $package executable (static loading), or not include
20861 them at all.  Answer "none" to include no extensions.
20862 Note that DynaLoader is always built and need not be mentioned here.
20863
20864 EOM
20865         case "$dynamic_ext" in
20866         '')
20867                 : Exclude those listed in static_ext
20868                 dflt=''
20869                 for xxx in $avail_ext; do
20870                         case " $static_ext " in
20871                         *" $xxx "*) ;;
20872                         *) dflt="$dflt $xxx" ;;
20873                         esac
20874                 done
20875                 set X $dflt
20876                 shift
20877                 dflt="$*"
20878                 ;;
20879         *)      dflt="$dynamic_ext"
20880                 # Perhaps we are reusing an old out-of-date config.sh.
20881                 case "$hint" in
20882                 previous)
20883                         if test X"$dynamic_ext" != X"$avail_ext"; then
20884                                 $cat <<EOM
20885 NOTICE:  Your previous config.sh list may be incorrect. 
20886 The extensions now available to you are 
20887         ${avail_ext}
20888 but the default list from your previous config.sh is
20889         ${dynamic_ext} 
20890
20891 EOM
20892                         fi
20893                         ;;
20894                 esac
20895                 ;;
20896         esac
20897         case "$dflt" in
20898         '')     dflt=none;;
20899         esac
20900         rp="What extensions do you wish to load dynamically?"
20901         . ./myread
20902         case "$ans" in
20903         none) dynamic_ext=' ' ;;
20904         *) dynamic_ext="$ans" ;;
20905         esac
20906
20907         case "$static_ext" in
20908         '')
20909                 : Exclude those already listed in dynamic linking
20910                 dflt=''
20911                 for xxx in $avail_ext; do
20912                         case " $dynamic_ext " in
20913                         *" $xxx "*) ;;
20914                         *) dflt="$dflt $xxx" ;;
20915                         esac
20916                 done
20917                 set X $dflt
20918                 shift
20919                 dflt="$*"
20920                 ;;
20921         *)  dflt="$static_ext" 
20922                 ;;
20923         esac
20924
20925         case "$dflt" in
20926         '')     dflt=none;;
20927         esac
20928         rp="What extensions do you wish to load statically?"
20929         . ./myread
20930         case "$ans" in
20931         none) static_ext=' ' ;;
20932         *) static_ext="$ans" ;;
20933         esac
20934         ;;
20935 *)
20936         $cat <<EOM
20937 A number of extensions are supplied with $package.  Answer "none" 
20938 to include no extensions. 
20939 Note that DynaLoader is always built and need not be mentioned here.
20940
20941 EOM
20942         case "$static_ext" in
20943         '') dflt="$avail_ext" ;;
20944         *)      dflt="$static_ext"
20945                 # Perhaps we are reusing an old out-of-date config.sh.
20946                 case "$hint" in
20947                 previous)
20948                         if test X"$static_ext" != X"$avail_ext"; then
20949                                 $cat <<EOM
20950 NOTICE:  Your previous config.sh list may be incorrect. 
20951 The extensions now available to you are 
20952         ${avail_ext}
20953 but the default list from your previous config.sh is
20954         ${static_ext} 
20955
20956 EOM
20957                         fi
20958                         ;;
20959                 esac
20960                 ;;
20961         esac
20962         : Exclude those that are not xs extensions
20963         case "$dflt" in
20964         '')     dflt=none;;
20965         esac
20966         rp="What extensions do you wish to include?"
20967         . ./myread
20968         case "$ans" in
20969         none) static_ext=' ' ;;
20970         *) static_ext="$ans" ;;
20971         esac
20972         ;;
20973 esac
20974 #        
20975 # Encode is a special case.  If we are building Encode as a static
20976 # extension, we need to explicitly list its subextensions as well.
20977 # For other nested extensions, this is handled automatically by
20978 # the appropriate Makefile.PL.
20979 case " $static_ext " in
20980         *" Encode "*) # Add the subextensions of Encode
20981         cd "$rsrc/ext"
20982         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20983                 static_ext="$static_ext Encode/$xxx"
20984         done
20985         cd "$tdir"
20986         ;;
20987 esac
20988
20989 set X $dynamic_ext $static_ext $nonxs_ext
20990 shift
20991 extensions="$*"
20992
20993 # Sanity check:  We require an extension suitable for use with
20994 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20995 # should show up as failures in the test suite, but it's helpful to
20996 # catch them now.) The 'extensions' list is normally sorted
20997 # alphabetically, so we need to accept either
20998 #    DB_File ... Fcntl ... IO  ....
20999 # or something like
21000 #    Fcntl ... NDBM_File ... IO  ....
21001 case " $extensions"  in
21002 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21003 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21004 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21005 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21006    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21007    ;;
21008 esac
21009
21010 : Remove libraries needed only for extensions
21011 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21012 : The exception is SunOS 4.x, which needs them.
21013 case "${osname}X${osvers}" in
21014 sunos*X4*)
21015     perllibs="$libs"
21016     ;;
21017 *) case "$usedl" in
21018     $define|true|[yY]*)
21019             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21020             shift
21021             perllibs="$*"
21022             ;;
21023     *)  perllibs="$libs"
21024             ;;
21025     esac
21026     ;;
21027 esac
21028
21029 : Remove build directory name from cppstdin so it can be used from
21030 : either the present location or the final installed location.
21031 echo " "
21032 : Get out of the UU directory to get correct path name.
21033 cd ..
21034 case "$cppstdin" in
21035 `pwd`/cppstdin)
21036         echo "Stripping down cppstdin path name"
21037         cppstdin=cppstdin
21038         ;;
21039 esac
21040 cd UU
21041
21042 : end of configuration questions
21043 echo " "
21044 echo "End of configuration questions."
21045 echo " "
21046
21047 : back to where it started
21048 if test -d ../UU; then
21049         cd ..
21050 fi
21051
21052 : configuration may be patched via a 'config.arch' file
21053 if $test -f config.arch; then
21054         echo "I see a config.arch file, loading it."
21055         . ./config.arch
21056 fi
21057
21058 : configuration may be patched via a 'config.over' file
21059 if $test -f config.over; then
21060         echo " "
21061         dflt=y
21062         rp='I see a config.over file.  Do you wish to load it?'
21063         . UU/myread
21064         case "$ans" in
21065         n*) echo "OK, I'll ignore it.";;
21066         *)      . ./config.over
21067                 echo "Configuration override changes have been loaded."
21068                 ;;
21069         esac
21070 fi
21071
21072 : in case they want portability, strip down executable paths
21073 case "$d_portable" in
21074 "$define")
21075         echo " "
21076         echo "Stripping down executable paths..." >&4
21077         for file in $loclist $trylist; do
21078                 eval temp=\$$file
21079                 eval $file=`basename $temp`
21080         done
21081         ;;
21082 esac
21083
21084 : create config.sh file
21085 echo " "
21086 echo "Creating config.sh..." >&4
21087 $spitshell <<EOT >config.sh
21088 $startsh
21089 #
21090 # This file was produced by running the Configure script. It holds all the
21091 # definitions figured out by Configure. Should you modify one of these values,
21092 # do not forget to propagate your changes by running "Configure -der". You may
21093 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21094 #
21095
21096 # Package name      : $package
21097 # Source directory  : $src
21098 # Configuration time: $cf_time
21099 # Configured by     : $cf_by
21100 # Target system     : $myuname
21101
21102 Author='$Author'
21103 Date='$Date'
21104 Header='$Header'
21105 Id='$Id'
21106 Locker='$Locker'
21107 Log='$Log'
21108 Mcc='$Mcc'
21109 RCSfile='$RCSfile'
21110 Revision='$Revision'
21111 Source='$Source'
21112 State='$State'
21113 _a='$_a'
21114 _exe='$_exe'
21115 _o='$_o'
21116 afs='$afs'
21117 afsroot='$afsroot'
21118 alignbytes='$alignbytes'
21119 ansi2knr='$ansi2knr'
21120 aphostname='$aphostname'
21121 api_revision='$api_revision'
21122 api_subversion='$api_subversion'
21123 api_version='$api_version'
21124 api_versionstring='$api_versionstring'
21125 ar='$ar'
21126 archlib='$archlib'
21127 archlibexp='$archlibexp'
21128 archname64='$archname64'
21129 archname='$archname'
21130 archobjs='$archobjs'
21131 asctime_r_proto='$asctime_r_proto'
21132 awk='$awk'
21133 baserev='$baserev'
21134 bash='$bash'
21135 bin='$bin'
21136 binexp='$binexp'
21137 bison='$bison'
21138 byacc='$byacc'
21139 byteorder='$byteorder'
21140 c='$c'
21141 castflags='$castflags'
21142 cat='$cat'
21143 cc='$cc'
21144 cccdlflags='$cccdlflags'
21145 ccdlflags='$ccdlflags'
21146 ccflags='$ccflags'
21147 ccflags_uselargefiles='$ccflags_uselargefiles'
21148 ccname='$ccname'
21149 ccsymbols='$ccsymbols'
21150 ccversion='$ccversion'
21151 cf_by='$cf_by'
21152 cf_email='$cf_email'
21153 cf_time='$cf_time'
21154 charsize='$charsize'
21155 chgrp='$chgrp'
21156 chmod='$chmod'
21157 chown='$chown'
21158 clocktype='$clocktype'
21159 comm='$comm'
21160 compress='$compress'
21161 contains='$contains'
21162 cp='$cp'
21163 cpio='$cpio'
21164 cpp='$cpp'
21165 cpp_stuff='$cpp_stuff'
21166 cppccsymbols='$cppccsymbols'
21167 cppflags='$cppflags'
21168 cpplast='$cpplast'
21169 cppminus='$cppminus'
21170 cpprun='$cpprun'
21171 cppstdin='$cppstdin'
21172 cppsymbols='$cppsymbols'
21173 crypt_r_proto='$crypt_r_proto'
21174 cryptlib='$cryptlib'
21175 csh='$csh'
21176 ctermid_r_proto='$ctermid_r_proto'
21177 ctime_r_proto='$ctime_r_proto'
21178 d_Gconvert='$d_Gconvert'
21179 d_PRIEUldbl='$d_PRIEUldbl'
21180 d_PRIFUldbl='$d_PRIFUldbl'
21181 d_PRIGUldbl='$d_PRIGUldbl'
21182 d_PRIXU64='$d_PRIXU64'
21183 d_PRId64='$d_PRId64'
21184 d_PRIeldbl='$d_PRIeldbl'
21185 d_PRIfldbl='$d_PRIfldbl'
21186 d_PRIgldbl='$d_PRIgldbl'
21187 d_PRIi64='$d_PRIi64'
21188 d_PRIo64='$d_PRIo64'
21189 d_PRIu64='$d_PRIu64'
21190 d_PRIx64='$d_PRIx64'
21191 d_SCNfldbl='$d_SCNfldbl'
21192 d__fwalk='$d__fwalk'
21193 d_access='$d_access'
21194 d_accessx='$d_accessx'
21195 d_aintl='$d_aintl'
21196 d_alarm='$d_alarm'
21197 d_archlib='$d_archlib'
21198 d_asctime_r='$d_asctime_r'
21199 d_atolf='$d_atolf'
21200 d_atoll='$d_atoll'
21201 d_attribute_format='$d_attribute_format'
21202 d_attribute_malloc='$d_attribute_malloc'
21203 d_attribute_nonnull='$d_attribute_nonnull'
21204 d_attribute_noreturn='$d_attribute_noreturn'
21205 d_attribute_pure='$d_attribute_pure'
21206 d_attribute_unused='$d_attribute_unused'
21207 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21208 d_bcmp='$d_bcmp'
21209 d_bcopy='$d_bcopy'
21210 d_bsd='$d_bsd'
21211 d_bsdgetpgrp='$d_bsdgetpgrp'
21212 d_bsdsetpgrp='$d_bsdsetpgrp'
21213 d_builtin_choose_expr='$d_builtin_choose_expr'
21214 d_builtin_expect='$d_builtin_expect'
21215 d_bzero='$d_bzero'
21216 d_casti32='$d_casti32'
21217 d_castneg='$d_castneg'
21218 d_charvspr='$d_charvspr'
21219 d_chown='$d_chown'
21220 d_chroot='$d_chroot'
21221 d_chsize='$d_chsize'
21222 d_class='$d_class'
21223 d_clearenv='$d_clearenv'
21224 d_closedir='$d_closedir'
21225 d_cmsghdr_s='$d_cmsghdr_s'
21226 d_const='$d_const'
21227 d_copysignl='$d_copysignl'
21228 d_crypt='$d_crypt'
21229 d_crypt_r='$d_crypt_r'
21230 d_csh='$d_csh'
21231 d_ctermid_r='$d_ctermid_r'
21232 d_ctime_r='$d_ctime_r'
21233 d_cuserid='$d_cuserid'
21234 d_dbl_dig='$d_dbl_dig'
21235 d_dbminitproto='$d_dbminitproto'
21236 d_difftime='$d_difftime'
21237 d_dirfd='$d_dirfd'
21238 d_dirnamlen='$d_dirnamlen'
21239 d_dlerror='$d_dlerror'
21240 d_dlopen='$d_dlopen'
21241 d_dlsymun='$d_dlsymun'
21242 d_dosuid='$d_dosuid'
21243 d_drand48_r='$d_drand48_r'
21244 d_drand48proto='$d_drand48proto'
21245 d_dup2='$d_dup2'
21246 d_eaccess='$d_eaccess'
21247 d_endgrent='$d_endgrent'
21248 d_endgrent_r='$d_endgrent_r'
21249 d_endhent='$d_endhent'
21250 d_endhostent_r='$d_endhostent_r'
21251 d_endnent='$d_endnent'
21252 d_endnetent_r='$d_endnetent_r'
21253 d_endpent='$d_endpent'
21254 d_endprotoent_r='$d_endprotoent_r'
21255 d_endpwent='$d_endpwent'
21256 d_endpwent_r='$d_endpwent_r'
21257 d_endsent='$d_endsent'
21258 d_endservent_r='$d_endservent_r'
21259 d_eofnblk='$d_eofnblk'
21260 d_eunice='$d_eunice'
21261 d_faststdio='$d_faststdio'
21262 d_fchdir='$d_fchdir'
21263 d_fchmod='$d_fchmod'
21264 d_fchown='$d_fchown'
21265 d_fcntl='$d_fcntl'
21266 d_fcntl_can_lock='$d_fcntl_can_lock'
21267 d_fd_macros='$d_fd_macros'
21268 d_fd_set='$d_fd_set'
21269 d_fds_bits='$d_fds_bits'
21270 d_fgetpos='$d_fgetpos'
21271 d_finite='$d_finite'
21272 d_finitel='$d_finitel'
21273 d_flexfnam='$d_flexfnam'
21274 d_flock='$d_flock'
21275 d_flockproto='$d_flockproto'
21276 d_fork='$d_fork'
21277 d_fp_class='$d_fp_class'
21278 d_fpathconf='$d_fpathconf'
21279 d_fpclass='$d_fpclass'
21280 d_fpclassify='$d_fpclassify'
21281 d_fpclassl='$d_fpclassl'
21282 d_fpos64_t='$d_fpos64_t'
21283 d_frexpl='$d_frexpl'
21284 d_fs_data_s='$d_fs_data_s'
21285 d_fseeko='$d_fseeko'
21286 d_fsetpos='$d_fsetpos'
21287 d_fstatfs='$d_fstatfs'
21288 d_fstatvfs='$d_fstatvfs'
21289 d_fsync='$d_fsync'
21290 d_ftello='$d_ftello'
21291 d_ftime='$d_ftime'
21292 d_futimes='$d_futimes'
21293 d_getcwd='$d_getcwd'
21294 d_getespwnam='$d_getespwnam'
21295 d_getfsstat='$d_getfsstat'
21296 d_getgrent='$d_getgrent'
21297 d_getgrent_r='$d_getgrent_r'
21298 d_getgrgid_r='$d_getgrgid_r'
21299 d_getgrnam_r='$d_getgrnam_r'
21300 d_getgrps='$d_getgrps'
21301 d_gethbyaddr='$d_gethbyaddr'
21302 d_gethbyname='$d_gethbyname'
21303 d_gethent='$d_gethent'
21304 d_gethname='$d_gethname'
21305 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21306 d_gethostbyname_r='$d_gethostbyname_r'
21307 d_gethostent_r='$d_gethostent_r'
21308 d_gethostprotos='$d_gethostprotos'
21309 d_getitimer='$d_getitimer'
21310 d_getlogin='$d_getlogin'
21311 d_getlogin_r='$d_getlogin_r'
21312 d_getmnt='$d_getmnt'
21313 d_getmntent='$d_getmntent'
21314 d_getnbyaddr='$d_getnbyaddr'
21315 d_getnbyname='$d_getnbyname'
21316 d_getnent='$d_getnent'
21317 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21318 d_getnetbyname_r='$d_getnetbyname_r'
21319 d_getnetent_r='$d_getnetent_r'
21320 d_getnetprotos='$d_getnetprotos'
21321 d_getpagsz='$d_getpagsz'
21322 d_getpbyname='$d_getpbyname'
21323 d_getpbynumber='$d_getpbynumber'
21324 d_getpent='$d_getpent'
21325 d_getpgid='$d_getpgid'
21326 d_getpgrp2='$d_getpgrp2'
21327 d_getpgrp='$d_getpgrp'
21328 d_getppid='$d_getppid'
21329 d_getprior='$d_getprior'
21330 d_getprotobyname_r='$d_getprotobyname_r'
21331 d_getprotobynumber_r='$d_getprotobynumber_r'
21332 d_getprotoent_r='$d_getprotoent_r'
21333 d_getprotoprotos='$d_getprotoprotos'
21334 d_getprpwnam='$d_getprpwnam'
21335 d_getpwent='$d_getpwent'
21336 d_getpwent_r='$d_getpwent_r'
21337 d_getpwnam_r='$d_getpwnam_r'
21338 d_getpwuid_r='$d_getpwuid_r'
21339 d_getsbyname='$d_getsbyname'
21340 d_getsbyport='$d_getsbyport'
21341 d_getsent='$d_getsent'
21342 d_getservbyname_r='$d_getservbyname_r'
21343 d_getservbyport_r='$d_getservbyport_r'
21344 d_getservent_r='$d_getservent_r'
21345 d_getservprotos='$d_getservprotos'
21346 d_getspnam='$d_getspnam'
21347 d_getspnam_r='$d_getspnam_r'
21348 d_gettimeod='$d_gettimeod'
21349 d_gmtime_r='$d_gmtime_r'
21350 d_gnulibc='$d_gnulibc'
21351 d_grpasswd='$d_grpasswd'
21352 d_hasmntopt='$d_hasmntopt'
21353 d_htonl='$d_htonl'
21354 d_ilogbl='$d_ilogbl'
21355 d_inc_version_list="$d_inc_version_list"
21356 d_index='$d_index'
21357 d_inetaton='$d_inetaton'
21358 d_int64_t='$d_int64_t'
21359 d_isascii='$d_isascii'
21360 d_isfinite='$d_isfinite'
21361 d_isinf='$d_isinf'
21362 d_isnan='$d_isnan'
21363 d_isnanl='$d_isnanl'
21364 d_killpg='$d_killpg'
21365 d_lchown='$d_lchown'
21366 d_ldbl_dig='$d_ldbl_dig'
21367 d_libm_lib_version='$d_libm_lib_version'
21368 d_link='$d_link'
21369 d_localtime_r='$d_localtime_r'
21370 d_locconv='$d_locconv'
21371 d_lockf='$d_lockf'
21372 d_longdbl='$d_longdbl'
21373 d_longlong='$d_longlong'
21374 d_lseekproto='$d_lseekproto'
21375 d_lstat='$d_lstat'
21376 d_madvise='$d_madvise'
21377 d_malloc_good_size='$d_malloc_good_size'
21378 d_malloc_size='$d_malloc_size'
21379 d_mblen='$d_mblen'
21380 d_mbstowcs='$d_mbstowcs'
21381 d_mbtowc='$d_mbtowc'
21382 d_memchr='$d_memchr'
21383 d_memcmp='$d_memcmp'
21384 d_memcpy='$d_memcpy'
21385 d_memmove='$d_memmove'
21386 d_memset='$d_memset'
21387 d_mkdir='$d_mkdir'
21388 d_mkdtemp='$d_mkdtemp'
21389 d_mkfifo='$d_mkfifo'
21390 d_mkstemp='$d_mkstemp'
21391 d_mkstemps='$d_mkstemps'
21392 d_mktime='$d_mktime'
21393 d_mmap='$d_mmap'
21394 d_modfl='$d_modfl'
21395 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21396 d_modflproto='$d_modflproto'
21397 d_mprotect='$d_mprotect'
21398 d_msg='$d_msg'
21399 d_msg_ctrunc='$d_msg_ctrunc'
21400 d_msg_dontroute='$d_msg_dontroute'
21401 d_msg_oob='$d_msg_oob'
21402 d_msg_peek='$d_msg_peek'
21403 d_msg_proxy='$d_msg_proxy'
21404 d_msgctl='$d_msgctl'
21405 d_msgget='$d_msgget'
21406 d_msghdr_s='$d_msghdr_s'
21407 d_msgrcv='$d_msgrcv'
21408 d_msgsnd='$d_msgsnd'
21409 d_msync='$d_msync'
21410 d_munmap='$d_munmap'
21411 d_mymalloc='$d_mymalloc'
21412 d_nice='$d_nice'
21413 d_nl_langinfo='$d_nl_langinfo'
21414 d_nv_preserves_uv='$d_nv_preserves_uv'
21415 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21416 d_off64_t='$d_off64_t'
21417 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21418 d_oldpthreads='$d_oldpthreads'
21419 d_oldsock='$d_oldsock'
21420 d_open3='$d_open3'
21421 d_pathconf='$d_pathconf'
21422 d_pause='$d_pause'
21423 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21424 d_phostname='$d_phostname'
21425 d_pipe='$d_pipe'
21426 d_poll='$d_poll'
21427 d_portable='$d_portable'
21428 d_procselfexe='$d_procselfexe'
21429 d_pthread_atfork='$d_pthread_atfork'
21430 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21431 d_pthread_yield='$d_pthread_yield'
21432 d_pwage='$d_pwage'
21433 d_pwchange='$d_pwchange'
21434 d_pwclass='$d_pwclass'
21435 d_pwcomment='$d_pwcomment'
21436 d_pwexpire='$d_pwexpire'
21437 d_pwgecos='$d_pwgecos'
21438 d_pwpasswd='$d_pwpasswd'
21439 d_pwquota='$d_pwquota'
21440 d_qgcvt='$d_qgcvt'
21441 d_quad='$d_quad'
21442 d_random_r='$d_random_r'
21443 d_readdir64_r='$d_readdir64_r'
21444 d_readdir='$d_readdir'
21445 d_readdir_r='$d_readdir_r'
21446 d_readlink='$d_readlink'
21447 d_readv='$d_readv'
21448 d_recvmsg='$d_recvmsg'
21449 d_rename='$d_rename'
21450 d_rewinddir='$d_rewinddir'
21451 d_rmdir='$d_rmdir'
21452 d_safebcpy='$d_safebcpy'
21453 d_safemcpy='$d_safemcpy'
21454 d_sanemcmp='$d_sanemcmp'
21455 d_sbrkproto='$d_sbrkproto'
21456 d_scalbnl='$d_scalbnl'
21457 d_sched_yield='$d_sched_yield'
21458 d_scm_rights='$d_scm_rights'
21459 d_seekdir='$d_seekdir'
21460 d_select='$d_select'
21461 d_sem='$d_sem'
21462 d_semctl='$d_semctl'
21463 d_semctl_semid_ds='$d_semctl_semid_ds'
21464 d_semctl_semun='$d_semctl_semun'
21465 d_semget='$d_semget'
21466 d_semop='$d_semop'
21467 d_sendmsg='$d_sendmsg'
21468 d_setegid='$d_setegid'
21469 d_seteuid='$d_seteuid'
21470 d_setgrent='$d_setgrent'
21471 d_setgrent_r='$d_setgrent_r'
21472 d_setgrps='$d_setgrps'
21473 d_sethent='$d_sethent'
21474 d_sethostent_r='$d_sethostent_r'
21475 d_setitimer='$d_setitimer'
21476 d_setlinebuf='$d_setlinebuf'
21477 d_setlocale='$d_setlocale'
21478 d_setlocale_r='$d_setlocale_r'
21479 d_setnent='$d_setnent'
21480 d_setnetent_r='$d_setnetent_r'
21481 d_setpent='$d_setpent'
21482 d_setpgid='$d_setpgid'
21483 d_setpgrp2='$d_setpgrp2'
21484 d_setpgrp='$d_setpgrp'
21485 d_setprior='$d_setprior'
21486 d_setproctitle='$d_setproctitle'
21487 d_setprotoent_r='$d_setprotoent_r'
21488 d_setpwent='$d_setpwent'
21489 d_setpwent_r='$d_setpwent_r'
21490 d_setregid='$d_setregid'
21491 d_setresgid='$d_setresgid'
21492 d_setresuid='$d_setresuid'
21493 d_setreuid='$d_setreuid'
21494 d_setrgid='$d_setrgid'
21495 d_setruid='$d_setruid'
21496 d_setsent='$d_setsent'
21497 d_setservent_r='$d_setservent_r'
21498 d_setsid='$d_setsid'
21499 d_setvbuf='$d_setvbuf'
21500 d_sfio='$d_sfio'
21501 d_shm='$d_shm'
21502 d_shmat='$d_shmat'
21503 d_shmatprototype='$d_shmatprototype'
21504 d_shmctl='$d_shmctl'
21505 d_shmdt='$d_shmdt'
21506 d_shmget='$d_shmget'
21507 d_sigaction='$d_sigaction'
21508 d_sigprocmask='$d_sigprocmask'
21509 d_sigsetjmp='$d_sigsetjmp'
21510 d_sitearch='$d_sitearch'
21511 d_snprintf='$d_snprintf'
21512 d_sockatmark='$d_sockatmark'
21513 d_sockatmarkproto='$d_sockatmarkproto'
21514 d_socket='$d_socket'
21515 d_socklen_t='$d_socklen_t'
21516 d_sockpair='$d_sockpair'
21517 d_socks5_init='$d_socks5_init'
21518 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21519 d_sqrtl='$d_sqrtl'
21520 d_srand48_r='$d_srand48_r'
21521 d_srandom_r='$d_srandom_r'
21522 d_sresgproto='$d_sresgproto'
21523 d_sresuproto='$d_sresuproto'
21524 d_statblks='$d_statblks'
21525 d_statfs_f_flags='$d_statfs_f_flags'
21526 d_statfs_s='$d_statfs_s'
21527 d_statvfs='$d_statvfs'
21528 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21529 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21530 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21531 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21532 d_stdio_stream_array='$d_stdio_stream_array'
21533 d_stdiobase='$d_stdiobase'
21534 d_stdstdio='$d_stdstdio'
21535 d_strchr='$d_strchr'
21536 d_strcoll='$d_strcoll'
21537 d_strctcpy='$d_strctcpy'
21538 d_strerrm='$d_strerrm'
21539 d_strerror='$d_strerror'
21540 d_strerror_r='$d_strerror_r'
21541 d_strftime='$d_strftime'
21542 d_strlcat='$d_strlcat'
21543 d_strlcpy='$d_strlcpy'
21544 d_strtod='$d_strtod'
21545 d_strtol='$d_strtol'
21546 d_strtold='$d_strtold'
21547 d_strtoll='$d_strtoll'
21548 d_strtoq='$d_strtoq'
21549 d_strtoul='$d_strtoul'
21550 d_strtoull='$d_strtoull'
21551 d_strtouq='$d_strtouq'
21552 d_strxfrm='$d_strxfrm'
21553 d_suidsafe='$d_suidsafe'
21554 d_symlink='$d_symlink'
21555 d_syscall='$d_syscall'
21556 d_syscallproto='$d_syscallproto'
21557 d_sysconf='$d_sysconf'
21558 d_sysernlst='$d_sysernlst'
21559 d_syserrlst='$d_syserrlst'
21560 d_system='$d_system'
21561 d_tcgetpgrp='$d_tcgetpgrp'
21562 d_tcsetpgrp='$d_tcsetpgrp'
21563 d_telldir='$d_telldir'
21564 d_telldirproto='$d_telldirproto'
21565 d_time='$d_time'
21566 d_times='$d_times'
21567 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21568 d_tm_tm_zone='$d_tm_tm_zone'
21569 d_tmpnam_r='$d_tmpnam_r'
21570 d_truncate='$d_truncate'
21571 d_ttyname_r='$d_ttyname_r'
21572 d_tzname='$d_tzname'
21573 d_u32align='$d_u32align'
21574 d_ualarm='$d_ualarm'
21575 d_umask='$d_umask'
21576 d_uname='$d_uname'
21577 d_union_semun='$d_union_semun'
21578 d_unordered='$d_unordered'
21579 d_unsetenv='$d_unsetenv'
21580 d_usleep='$d_usleep'
21581 d_usleepproto='$d_usleepproto'
21582 d_ustat='$d_ustat'
21583 d_vendorarch='$d_vendorarch'
21584 d_vendorbin='$d_vendorbin'
21585 d_vendorlib='$d_vendorlib'
21586 d_vendorscript='$d_vendorscript'
21587 d_vfork='$d_vfork'
21588 d_void_closedir='$d_void_closedir'
21589 d_voidsig='$d_voidsig'
21590 d_voidtty='$d_voidtty'
21591 d_volatile='$d_volatile'
21592 d_vprintf='$d_vprintf'
21593 d_vsnprintf='$d_vsnprintf'
21594 d_wait4='$d_wait4'
21595 d_waitpid='$d_waitpid'
21596 d_wcstombs='$d_wcstombs'
21597 d_wctomb='$d_wctomb'
21598 d_writev='$d_writev'
21599 d_xenix='$d_xenix'
21600 date='$date'
21601 db_hashtype='$db_hashtype'
21602 db_prefixtype='$db_prefixtype'
21603 db_version_major='$db_version_major'
21604 db_version_minor='$db_version_minor'
21605 db_version_patch='$db_version_patch'
21606 defvoidused='$defvoidused'
21607 direntrytype='$direntrytype'
21608 dlext='$dlext'
21609 dlsrc='$dlsrc'
21610 doublesize='$doublesize'
21611 drand01='$drand01'
21612 drand48_r_proto='$drand48_r_proto'
21613 dynamic_ext='$dynamic_ext'
21614 eagain='$eagain'
21615 ebcdic='$ebcdic'
21616 echo='$echo'
21617 egrep='$egrep'
21618 emacs='$emacs'
21619 endgrent_r_proto='$endgrent_r_proto'
21620 endhostent_r_proto='$endhostent_r_proto'
21621 endnetent_r_proto='$endnetent_r_proto'
21622 endprotoent_r_proto='$endprotoent_r_proto'
21623 endpwent_r_proto='$endpwent_r_proto'
21624 endservent_r_proto='$endservent_r_proto'
21625 eunicefix='$eunicefix'
21626 exe_ext='$exe_ext'
21627 expr='$expr'
21628 extensions='$extensions'
21629 extras='$extras'
21630 fflushNULL='$fflushNULL'
21631 fflushall='$fflushall'
21632 find='$find'
21633 firstmakefile='$firstmakefile'
21634 flex='$flex'
21635 fpossize='$fpossize'
21636 fpostype='$fpostype'
21637 freetype='$freetype'
21638 from='$from'
21639 full_ar='$full_ar'
21640 full_csh='$full_csh'
21641 full_sed='$full_sed'
21642 gccansipedantic='$gccansipedantic'
21643 gccosandvers='$gccosandvers'
21644 gccversion='$gccversion'
21645 getgrent_r_proto='$getgrent_r_proto'
21646 getgrgid_r_proto='$getgrgid_r_proto'
21647 getgrnam_r_proto='$getgrnam_r_proto'
21648 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21649 gethostbyname_r_proto='$gethostbyname_r_proto'
21650 gethostent_r_proto='$gethostent_r_proto'
21651 getlogin_r_proto='$getlogin_r_proto'
21652 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21653 getnetbyname_r_proto='$getnetbyname_r_proto'
21654 getnetent_r_proto='$getnetent_r_proto'
21655 getprotobyname_r_proto='$getprotobyname_r_proto'
21656 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21657 getprotoent_r_proto='$getprotoent_r_proto'
21658 getpwent_r_proto='$getpwent_r_proto'
21659 getpwnam_r_proto='$getpwnam_r_proto'
21660 getpwuid_r_proto='$getpwuid_r_proto'
21661 getservbyname_r_proto='$getservbyname_r_proto'
21662 getservbyport_r_proto='$getservbyport_r_proto'
21663 getservent_r_proto='$getservent_r_proto'
21664 getspnam_r_proto='$getspnam_r_proto'
21665 gidformat='$gidformat'
21666 gidsign='$gidsign'
21667 gidsize='$gidsize'
21668 gidtype='$gidtype'
21669 glibpth='$glibpth'
21670 gmake='$gmake'
21671 gmtime_r_proto='$gmtime_r_proto'
21672 gnulibc_version='$gnulibc_version'
21673 grep='$grep'
21674 groupcat='$groupcat'
21675 groupstype='$groupstype'
21676 gzip='$gzip'
21677 h_fcntl='$h_fcntl'
21678 h_sysfile='$h_sysfile'
21679 hint='$hint'
21680 hostcat='$hostcat'
21681 html1dir='$html1dir'
21682 html1direxp='$html1direxp'
21683 html3dir='$html3dir'
21684 html3direxp='$html3direxp'
21685 i16size='$i16size'
21686 i16type='$i16type'
21687 i32size='$i32size'
21688 i32type='$i32type'
21689 i64size='$i64size'
21690 i64type='$i64type'
21691 i8size='$i8size'
21692 i8type='$i8type'
21693 i_arpainet='$i_arpainet'
21694 i_bsdioctl='$i_bsdioctl'
21695 i_crypt='$i_crypt'
21696 i_db='$i_db'
21697 i_dbm='$i_dbm'
21698 i_dirent='$i_dirent'
21699 i_dld='$i_dld'
21700 i_dlfcn='$i_dlfcn'
21701 i_fcntl='$i_fcntl'
21702 i_float='$i_float'
21703 i_fp='$i_fp'
21704 i_fp_class='$i_fp_class'
21705 i_gdbm='$i_gdbm'
21706 i_grp='$i_grp'
21707 i_ieeefp='$i_ieeefp'
21708 i_inttypes='$i_inttypes'
21709 i_langinfo='$i_langinfo'
21710 i_libutil='$i_libutil'
21711 i_limits='$i_limits'
21712 i_locale='$i_locale'
21713 i_machcthr='$i_machcthr'
21714 i_malloc='$i_malloc'
21715 i_math='$i_math'
21716 i_memory='$i_memory'
21717 i_mntent='$i_mntent'
21718 i_ndbm='$i_ndbm'
21719 i_netdb='$i_netdb'
21720 i_neterrno='$i_neterrno'
21721 i_netinettcp='$i_netinettcp'
21722 i_niin='$i_niin'
21723 i_poll='$i_poll'
21724 i_prot='$i_prot'
21725 i_pthread='$i_pthread'
21726 i_pwd='$i_pwd'
21727 i_rpcsvcdbm='$i_rpcsvcdbm'
21728 i_sfio='$i_sfio'
21729 i_sgtty='$i_sgtty'
21730 i_shadow='$i_shadow'
21731 i_socks='$i_socks'
21732 i_stdarg='$i_stdarg'
21733 i_stddef='$i_stddef'
21734 i_stdlib='$i_stdlib'
21735 i_string='$i_string'
21736 i_sunmath='$i_sunmath'
21737 i_sysaccess='$i_sysaccess'
21738 i_sysdir='$i_sysdir'
21739 i_sysfile='$i_sysfile'
21740 i_sysfilio='$i_sysfilio'
21741 i_sysin='$i_sysin'
21742 i_sysioctl='$i_sysioctl'
21743 i_syslog='$i_syslog'
21744 i_sysmman='$i_sysmman'
21745 i_sysmode='$i_sysmode'
21746 i_sysmount='$i_sysmount'
21747 i_sysndir='$i_sysndir'
21748 i_sysparam='$i_sysparam'
21749 i_sysresrc='$i_sysresrc'
21750 i_syssecrt='$i_syssecrt'
21751 i_sysselct='$i_sysselct'
21752 i_syssockio='$i_syssockio'
21753 i_sysstat='$i_sysstat'
21754 i_sysstatfs='$i_sysstatfs'
21755 i_sysstatvfs='$i_sysstatvfs'
21756 i_systime='$i_systime'
21757 i_systimek='$i_systimek'
21758 i_systimes='$i_systimes'
21759 i_systypes='$i_systypes'
21760 i_sysuio='$i_sysuio'
21761 i_sysun='$i_sysun'
21762 i_sysutsname='$i_sysutsname'
21763 i_sysvfs='$i_sysvfs'
21764 i_syswait='$i_syswait'
21765 i_termio='$i_termio'
21766 i_termios='$i_termios'
21767 i_time='$i_time'
21768 i_unistd='$i_unistd'
21769 i_ustat='$i_ustat'
21770 i_utime='$i_utime'
21771 i_values='$i_values'
21772 i_varargs='$i_varargs'
21773 i_varhdr='$i_varhdr'
21774 i_vfork='$i_vfork'
21775 ignore_versioned_solibs='$ignore_versioned_solibs'
21776 inc_version_list='$inc_version_list'
21777 inc_version_list_init='$inc_version_list_init'
21778 incpath='$incpath'
21779 inews='$inews'
21780 installarchlib='$installarchlib'
21781 installbin='$installbin'
21782 installhtml1dir='$installhtml1dir'
21783 installhtml3dir='$installhtml3dir'
21784 installman1dir='$installman1dir'
21785 installman3dir='$installman3dir'
21786 installprefix='$installprefix'
21787 installprefixexp='$installprefixexp'
21788 installprivlib='$installprivlib'
21789 installscript='$installscript'
21790 installsitearch='$installsitearch'
21791 installsitebin='$installsitebin'
21792 installsitehtml1dir='$installsitehtml1dir'
21793 installsitehtml3dir='$installsitehtml3dir'
21794 installsitelib='$installsitelib'
21795 installsiteman1dir='$installsiteman1dir'
21796 installsiteman3dir='$installsiteman3dir'
21797 installsitescript='$installsitescript'
21798 installstyle='$installstyle'
21799 installusrbinperl='$installusrbinperl'
21800 installvendorarch='$installvendorarch'
21801 installvendorbin='$installvendorbin'
21802 installvendorhtml1dir='$installvendorhtml1dir'
21803 installvendorhtml3dir='$installvendorhtml3dir'
21804 installvendorlib='$installvendorlib'
21805 installvendorman1dir='$installvendorman1dir'
21806 installvendorman3dir='$installvendorman3dir'
21807 installvendorscript='$installvendorscript'
21808 intsize='$intsize'
21809 issymlink='$issymlink'
21810 ivdformat='$ivdformat'
21811 ivsize='$ivsize'
21812 ivtype='$ivtype'
21813 known_extensions='$known_extensions'
21814 ksh='$ksh'
21815 ld='$ld'
21816 lddlflags='$lddlflags'
21817 ldflags='$ldflags'
21818 ldflags_uselargefiles='$ldflags_uselargefiles'
21819 ldlibpthname='$ldlibpthname'
21820 less='$less'
21821 lib_ext='$lib_ext'
21822 libc='$libc'
21823 libperl='$libperl'
21824 libpth='$libpth'
21825 libs='$libs'
21826 libsdirs='$libsdirs'
21827 libsfiles='$libsfiles'
21828 libsfound='$libsfound'
21829 libspath='$libspath'
21830 libswanted='$libswanted'
21831 libswanted_uselargefiles='$libswanted_uselargefiles'
21832 line='$line'
21833 lint='$lint'
21834 lkflags='$lkflags'
21835 ln='$ln'
21836 lns='$lns'
21837 localtime_r_proto='$localtime_r_proto'
21838 locincpth='$locincpth'
21839 loclibpth='$loclibpth'
21840 longdblsize='$longdblsize'
21841 longlongsize='$longlongsize'
21842 longsize='$longsize'
21843 lp='$lp'
21844 lpr='$lpr'
21845 ls='$ls'
21846 lseeksize='$lseeksize'
21847 lseektype='$lseektype'
21848 mad='$mad'
21849 mail='$mail'
21850 mailx='$mailx'
21851 make='$make'
21852 make_set_make='$make_set_make'
21853 mallocobj='$mallocobj'
21854 mallocsrc='$mallocsrc'
21855 madlyh='$madlyh'
21856 madlyobj='$madlyobj'
21857 madlysrc='$madlysrc'
21858 malloctype='$malloctype'
21859 man1dir='$man1dir'
21860 man1direxp='$man1direxp'
21861 man1ext='$man1ext'
21862 man3dir='$man3dir'
21863 man3direxp='$man3direxp'
21864 man3ext='$man3ext'
21865 mips_type='$mips_type'
21866 mistrustnm='$mistrustnm'
21867 mkdir='$mkdir'
21868 mmaptype='$mmaptype'
21869 modetype='$modetype'
21870 more='$more'
21871 multiarch='$multiarch'
21872 mv='$mv'
21873 myarchname='$myarchname'
21874 mydomain='$mydomain'
21875 myhostname='$myhostname'
21876 myuname='$myuname'
21877 n='$n'
21878 need_va_copy='$need_va_copy'
21879 netdb_hlen_type='$netdb_hlen_type'
21880 netdb_host_type='$netdb_host_type'
21881 netdb_name_type='$netdb_name_type'
21882 netdb_net_type='$netdb_net_type'
21883 nm='$nm'
21884 nm_opt='$nm_opt'
21885 nm_so_opt='$nm_so_opt'
21886 nonxs_ext='$nonxs_ext'
21887 nroff='$nroff'
21888 nvEUformat='$nvEUformat'
21889 nvFUformat='$nvFUformat'
21890 nvGUformat='$nvGUformat'
21891 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21892 nveformat='$nveformat'
21893 nvfformat='$nvfformat'
21894 nvgformat='$nvgformat'
21895 nvsize='$nvsize'
21896 nvtype='$nvtype'
21897 o_nonblock='$o_nonblock'
21898 obj_ext='$obj_ext'
21899 old_pthread_create_joinable='$old_pthread_create_joinable'
21900 optimize='$optimize'
21901 orderlib='$orderlib'
21902 osname='$osname'
21903 osvers='$osvers'
21904 otherlibdirs='$otherlibdirs'
21905 package='$package'
21906 pager='$pager'
21907 passcat='$passcat'
21908 patchlevel='$patchlevel'
21909 path_sep='$path_sep'
21910 perl5='$perl5'
21911 perl='$perl'
21912 perl_patchlevel='$perl_patchlevel'
21913 perladmin='$perladmin'
21914 perllibs='$perllibs'
21915 perlpath='$perlpath'
21916 pg='$pg'
21917 phostname='$phostname'
21918 pidtype='$pidtype'
21919 plibpth='$plibpth'
21920 pmake='$pmake'
21921 pr='$pr'
21922 prefix='$prefix'
21923 prefixexp='$prefixexp'
21924 privlib='$privlib'
21925 privlibexp='$privlibexp'
21926 procselfexe='$procselfexe'
21927 prototype='$prototype'
21928 ptrsize='$ptrsize'
21929 quadkind='$quadkind'
21930 quadtype='$quadtype'
21931 randbits='$randbits'
21932 randfunc='$randfunc'
21933 random_r_proto='$random_r_proto'
21934 randseedtype='$randseedtype'
21935 ranlib='$ranlib'
21936 rd_nodata='$rd_nodata'
21937 readdir64_r_proto='$readdir64_r_proto'
21938 readdir_r_proto='$readdir_r_proto'
21939 revision='$revision'
21940 rm='$rm'
21941 rmail='$rmail'
21942 run='$run'
21943 runnm='$runnm'
21944 sPRIEUldbl='$sPRIEUldbl'
21945 sPRIFUldbl='$sPRIFUldbl'
21946 sPRIGUldbl='$sPRIGUldbl'
21947 sPRIXU64='$sPRIXU64'
21948 sPRId64='$sPRId64'
21949 sPRIeldbl='$sPRIeldbl'
21950 sPRIfldbl='$sPRIfldbl'
21951 sPRIgldbl='$sPRIgldbl'
21952 sPRIi64='$sPRIi64'
21953 sPRIo64='$sPRIo64'
21954 sPRIu64='$sPRIu64'
21955 sPRIx64='$sPRIx64'
21956 sSCNfldbl='$sSCNfldbl'
21957 sched_yield='$sched_yield'
21958 scriptdir='$scriptdir'
21959 scriptdirexp='$scriptdirexp'
21960 sed='$sed'
21961 seedfunc='$seedfunc'
21962 selectminbits='$selectminbits'
21963 selecttype='$selecttype'
21964 sendmail='$sendmail'
21965 setgrent_r_proto='$setgrent_r_proto'
21966 sethostent_r_proto='$sethostent_r_proto'
21967 setlocale_r_proto='$setlocale_r_proto'
21968 setnetent_r_proto='$setnetent_r_proto'
21969 setprotoent_r_proto='$setprotoent_r_proto'
21970 setpwent_r_proto='$setpwent_r_proto'
21971 setservent_r_proto='$setservent_r_proto'
21972 sh='$sh'
21973 shar='$shar'
21974 sharpbang='$sharpbang'
21975 shmattype='$shmattype'
21976 shortsize='$shortsize'
21977 shrpenv='$shrpenv'
21978 shsharp='$shsharp'
21979 sig_count='$sig_count'
21980 sig_name='$sig_name'
21981 sig_name_init='$sig_name_init'
21982 sig_num='$sig_num'
21983 sig_num_init='$sig_num_init'
21984 sig_size='$sig_size'
21985 signal_t='$signal_t'
21986 sitearch='$sitearch'
21987 sitearchexp='$sitearchexp'
21988 sitebin='$sitebin'
21989 sitebinexp='$sitebinexp'
21990 sitehtml1dir='$sitehtml1dir'
21991 sitehtml1direxp='$sitehtml1direxp'
21992 sitehtml3dir='$sitehtml3dir'
21993 sitehtml3direxp='$sitehtml3direxp'
21994 sitelib='$sitelib'
21995 sitelib_stem='$sitelib_stem'
21996 sitelibexp='$sitelibexp'
21997 siteman1dir='$siteman1dir'
21998 siteman1direxp='$siteman1direxp'
21999 siteman3dir='$siteman3dir'
22000 siteman3direxp='$siteman3direxp'
22001 siteprefix='$siteprefix'
22002 siteprefixexp='$siteprefixexp'
22003 sitescript='$sitescript'
22004 sitescriptexp='$sitescriptexp'
22005 sizesize='$sizesize'
22006 sizetype='$sizetype'
22007 sleep='$sleep'
22008 smail='$smail'
22009 so='$so'
22010 sockethdr='$sockethdr'
22011 socketlib='$socketlib'
22012 socksizetype='$socksizetype'
22013 sort='$sort'
22014 spackage='$spackage'
22015 spitshell='$spitshell'
22016 srand48_r_proto='$srand48_r_proto'
22017 srandom_r_proto='$srandom_r_proto'
22018 src='$src'
22019 ssizetype='$ssizetype'
22020 startperl='$startperl'
22021 startsh='$startsh'
22022 static_ext='$static_ext'
22023 stdchar='$stdchar'
22024 stdio_base='$stdio_base'
22025 stdio_bufsiz='$stdio_bufsiz'
22026 stdio_cnt='$stdio_cnt'
22027 stdio_filbuf='$stdio_filbuf'
22028 stdio_ptr='$stdio_ptr'
22029 stdio_stream_array='$stdio_stream_array'
22030 strerror_r_proto='$strerror_r_proto'
22031 strings='$strings'
22032 submit='$submit'
22033 subversion='$subversion'
22034 sysman='$sysman'
22035 tail='$tail'
22036 tar='$tar'
22037 targetarch='$targetarch'
22038 tbl='$tbl'
22039 tee='$tee'
22040 test='$test'
22041 timeincl='$timeincl'
22042 timetype='$timetype'
22043 tmpnam_r_proto='$tmpnam_r_proto'
22044 to='$to'
22045 touch='$touch'
22046 tr='$tr'
22047 trnl='$trnl'
22048 troff='$troff'
22049 ttyname_r_proto='$ttyname_r_proto'
22050 u16size='$u16size'
22051 u16type='$u16type'
22052 u32size='$u32size'
22053 u32type='$u32type'
22054 u64size='$u64size'
22055 u64type='$u64type'
22056 u8size='$u8size'
22057 u8type='$u8type'
22058 uidformat='$uidformat'
22059 uidsign='$uidsign'
22060 uidsize='$uidsize'
22061 uidtype='$uidtype'
22062 uname='$uname'
22063 uniq='$uniq'
22064 uquadtype='$uquadtype'
22065 use5005threads='$use5005threads'
22066 use64bitall='$use64bitall'
22067 use64bitint='$use64bitint'
22068 usecrosscompile='$usecrosscompile'
22069 usedl='$usedl'
22070 usefaststdio='$usefaststdio'
22071 useithreads='$useithreads'
22072 uselargefiles='$uselargefiles'
22073 uselongdouble='$uselongdouble'
22074 usemallocwrap='$usemallocwrap'
22075 usemorebits='$usemorebits'
22076 usemultiplicity='$usemultiplicity'
22077 usemymalloc='$usemymalloc'
22078 usenm='$usenm'
22079 useopcode='$useopcode'
22080 useperlio='$useperlio'
22081 useposix='$useposix'
22082 usereentrant='$usereentrant'
22083 initialinstalllocation="$initialinstalllocation"
22084 userelocatableinc='$userelocatableinc'
22085 usesfio='$usesfio'
22086 useshrplib='$useshrplib'
22087 usesitecustomize='$usesitecustomize'
22088 usesocks='$usesocks'
22089 usethreads='$usethreads'
22090 usevendorprefix='$usevendorprefix'
22091 usevfork='$usevfork'
22092 usrinc='$usrinc'
22093 uuname='$uuname'
22094 uvXUformat='$uvXUformat'
22095 uvoformat='$uvoformat'
22096 uvsize='$uvsize'
22097 uvtype='$uvtype'
22098 uvuformat='$uvuformat'
22099 uvxformat='$uvxformat'
22100 vendorarch='$vendorarch'
22101 vendorarchexp='$vendorarchexp'
22102 vendorbin='$vendorbin'
22103 vendorbinexp='$vendorbinexp'
22104 vendorhtml1dir='$vendorhtml1dir'
22105 vendorhtml1direxp='$vendorhtml1direxp'
22106 vendorhtml3dir='$vendorhtml3dir'
22107 vendorhtml3direxp='$vendorhtml3direxp'
22108 vendorlib='$vendorlib'
22109 vendorlib_stem='$vendorlib_stem'
22110 vendorlibexp='$vendorlibexp'
22111 vendorman1dir='$vendorman1dir'
22112 vendorman1direxp='$vendorman1direxp'
22113 vendorman3dir='$vendorman3dir'
22114 vendorman3direxp='$vendorman3direxp'
22115 vendorprefix='$vendorprefix'
22116 vendorprefixexp='$vendorprefixexp'
22117 vendorscript='$vendorscript'
22118 vendorscriptexp='$vendorscriptexp'
22119 version='$version'
22120 version_patchlevel_string='$version_patchlevel_string'
22121 versiononly='$versiononly'
22122 vi='$vi'
22123 voidflags='$voidflags'
22124 xlibpth='$xlibpth'
22125 yacc='$yacc'
22126 yaccflags='$yaccflags'
22127 zcat='$zcat'
22128 zip='$zip'
22129 EOT
22130
22131 : Add in command line options if available
22132 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22133
22134 : add special variables
22135 $test -f $src/patchlevel.h && \
22136 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22137 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22138 echo "PERL_CONFIG_SH=true" >>config.sh
22139
22140 : propagate old symbols
22141 if $test -f UU/config.sh; then
22142         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22143         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22144         $sort | $uniq -u >UU/oldsyms
22145         set X `cat UU/oldsyms`
22146         shift
22147         case $# in
22148         0) ;;
22149         *)
22150                 cat <<EOM
22151 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22152 EOM
22153                 echo "# Variables propagated from previous config.sh file." >>config.sh
22154                 for sym in `cat UU/oldsyms`; do
22155                         echo "    Propagating $hint variable "'$'"$sym..."
22156                         eval 'tmp="$'"${sym}"'"'
22157                         echo "$tmp" | \
22158                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22159                 done
22160                 ;;
22161         esac
22162 fi
22163
22164 : Finish up by extracting the .SH files
22165 case "$alldone" in
22166 exit)
22167         $rm -rf UU
22168         echo "Extraction done."
22169         exit 0
22170         ;;
22171 cont)
22172         ;;
22173 '')
22174         dflt=''
22175         nostick=true
22176         $cat <<EOM
22177
22178 If you'd like to make any changes to the config.sh file before I begin
22179 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22180
22181 EOM
22182         rp="Press return or use a shell escape to edit config.sh:"
22183         . UU/myread
22184         nostick=''
22185         case "$ans" in
22186         '') ;;
22187         *) : in case they cannot read
22188                 sh 1>&4 -c "$ans";;
22189         esac
22190         ;;
22191 esac
22192
22193 : if this fails, just run all the .SH files by hand
22194 . ./config.sh
22195
22196 echo " "
22197 exec 1>&4
22198 pwd=`pwd`
22199 . ./UU/extract
22200 cd "$pwd"
22201
22202 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22203         dflt=y
22204         case "$silent" in
22205         true) ;;
22206         *)
22207                 $cat <<EOM
22208
22209 Now you need to generate make dependencies by running "$make depend".
22210 You might prefer to run it in background: "$make depend > makedepend.out &"
22211 It can take a while, so you might not want to run it right now.
22212
22213 EOM
22214                 ;;
22215         esac
22216         rp="Run $make depend now?"
22217         . UU/myread
22218         case "$ans" in
22219         y*)
22220                 $make depend && echo "Now you must run '$make'."
22221                 ;;
22222         *)
22223                 echo "You must run '$make depend' then '$make'."
22224                 ;;
22225         esac
22226 elif test -f [Mm]akefile; then
22227         echo " "
22228         echo "Now you must run a $make."
22229 else
22230         echo "Configure done."
22231 fi
22232
22233 if $test -f Policy.sh; then
22234     $cat <<EOM
22235
22236 If you compile $package on a different machine or from a different object
22237 directory, copy the Policy.sh file from this object directory to the
22238 new one before you run Configure -- this will help you with most of
22239 the policy defaults.
22240
22241 EOM
22242 fi
22243 if $test -f config.msg; then
22244     echo "Hmm.  I also noted the following information while running:"
22245     echo " "
22246     $cat config.msg >&4
22247     $rm -f config.msg
22248 fi
22249 $rm -f kit*isdone ark*isdone
22250 $rm -rf UU
22251
22252 : End of Configure
22253