Support for __builtin_expect and __builtin_choose_expr
[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 Fri Mar  3 17:34:44 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 installprefix=''
925 installprefixexp=''
926 installstyle=''
927 installusrbinperl=''
928 intsize=''
929 longsize=''
930 shortsize=''
931 issymlink=''
932 libc=''
933 ldlibpthname=''
934 libperl=''
935 shrpenv=''
936 useshrplib=''
937 glibpth=''
938 libpth=''
939 loclibpth=''
940 plibpth=''
941 xlibpth=''
942 ignore_versioned_solibs=''
943 libs=''
944 libsdirs=''
945 libsfiles=''
946 libsfound=''
947 libspath=''
948 lns=''
949 d_PRIEUldbl=''
950 d_PRIFUldbl=''
951 d_PRIGUldbl=''
952 d_PRIeldbl=''
953 d_PRIfldbl=''
954 d_PRIgldbl=''
955 d_SCNfldbl=''
956 sPRIEUldbl=''
957 sPRIFUldbl=''
958 sPRIGUldbl=''
959 sPRIeldbl=''
960 sPRIfldbl=''
961 sPRIgldbl=''
962 sSCNfldbl=''
963 lseeksize=''
964 lseektype=''
965 make_set_make=''
966 d_mymalloc=''
967 freetype=''
968 mallocobj=''
969 mallocsrc=''
970 malloctype=''
971 usemallocwrap=''
972 usemymalloc=''
973 installman1dir=''
974 man1dir=''
975 man1direxp=''
976 man1ext=''
977 installman3dir=''
978 man3dir=''
979 man3direxp=''
980 man3ext=''
981 modetype=''
982 multiarch=''
983 mydomain=''
984 myhostname=''
985 phostname=''
986 c=''
987 n=''
988 d_eofnblk=''
989 eagain=''
990 o_nonblock=''
991 rd_nodata=''
992 need_va_copy=''
993 netdb_hlen_type=''
994 netdb_host_type=''
995 netdb_name_type=''
996 netdb_net_type=''
997 groupcat=''
998 hostcat=''
999 passcat=''
1000 orderlib=''
1001 ranlib=''
1002 d_perl_otherlibdirs=''
1003 otherlibdirs=''
1004 package=''
1005 spackage=''
1006 pager=''
1007 api_revision=''
1008 api_subversion=''
1009 api_version=''
1010 api_versionstring=''
1011 patchlevel=''
1012 perl_patchlevel=''
1013 revision=''
1014 subversion=''
1015 version=''
1016 version_patchlevel_string=''
1017 perl5=''
1018 perladmin=''
1019 perlpath=''
1020 d_nv_preserves_uv=''
1021 d_nv_zero_is_allbits_zero=''
1022 i16size=''
1023 i16type=''
1024 i32size=''
1025 i32type=''
1026 i64size=''
1027 i64type=''
1028 i8size=''
1029 i8type=''
1030 ivsize=''
1031 ivtype=''
1032 nv_preserves_uv_bits=''
1033 nvsize=''
1034 nvtype=''
1035 u16size=''
1036 u16type=''
1037 u32size=''
1038 u32type=''
1039 u64size=''
1040 u64type=''
1041 u8size=''
1042 u8type=''
1043 uvsize=''
1044 uvtype=''
1045 ivdformat=''
1046 nvEUformat=''
1047 nvFUformat=''
1048 nvGUformat=''
1049 nveformat=''
1050 nvfformat=''
1051 nvgformat=''
1052 uvXUformat=''
1053 uvoformat=''
1054 uvuformat=''
1055 uvxformat=''
1056 pidtype=''
1057 prefix=''
1058 prefixexp=''
1059 installprivlib=''
1060 privlib=''
1061 privlibexp=''
1062 prototype=''
1063 ptrsize=''
1064 d_PRIXU64=''
1065 d_PRId64=''
1066 d_PRIi64=''
1067 d_PRIo64=''
1068 d_PRIu64=''
1069 d_PRIx64=''
1070 sPRIXU64=''
1071 sPRId64=''
1072 sPRIi64=''
1073 sPRIo64=''
1074 sPRIu64=''
1075 sPRIx64=''
1076 d_quad=''
1077 quadkind=''
1078 quadtype=''
1079 uquadtype=''
1080 drand01=''
1081 randbits=''
1082 randfunc=''
1083 randseedtype=''
1084 seedfunc=''
1085 installscript=''
1086 scriptdir=''
1087 scriptdirexp=''
1088 selectminbits=''
1089 selecttype=''
1090 sh=''
1091 sig_count=''
1092 sig_name=''
1093 sig_name_init=''
1094 sig_num=''
1095 sig_num_init=''
1096 sig_size=''
1097 installsitearch=''
1098 sitearch=''
1099 sitearchexp=''
1100 installsitebin=''
1101 sitebin=''
1102 sitebinexp=''
1103 installsitehtml1dir=''
1104 sitehtml1dir=''
1105 sitehtml1direxp=''
1106 installsitehtml3dir=''
1107 sitehtml3dir=''
1108 sitehtml3direxp=''
1109 installsitelib=''
1110 sitelib=''
1111 sitelib_stem=''
1112 sitelibexp=''
1113 installsiteman1dir=''
1114 siteman1dir=''
1115 siteman1direxp=''
1116 installsiteman3dir=''
1117 siteman3dir=''
1118 siteman3direxp=''
1119 siteprefix=''
1120 siteprefixexp=''
1121 installsitescript=''
1122 sitescript=''
1123 sitescriptexp=''
1124 sizesize=''
1125 sizetype=''
1126 so=''
1127 socksizetype=''
1128 sharpbang=''
1129 shsharp=''
1130 spitshell=''
1131 src=''
1132 ssizetype=''
1133 startperl=''
1134 startsh=''
1135 stdchar=''
1136 d_stdio_stream_array=''
1137 stdio_stream_array=''
1138 sysman=''
1139 trnl=''
1140 uidformat=''
1141 uidsign=''
1142 uidsize=''
1143 uidtype=''
1144 archname64=''
1145 use64bitall=''
1146 use64bitint=''
1147 usefaststdio=''
1148 ccflags_uselargefiles=''
1149 ldflags_uselargefiles=''
1150 libswanted_uselargefiles=''
1151 uselargefiles=''
1152 uselongdouble=''
1153 usemorebits=''
1154 usemultiplicity=''
1155 nm_opt=''
1156 nm_so_opt=''
1157 runnm=''
1158 usenm=''
1159 useperlio=''
1160 userelocatableinc=''
1161 usesocks=''
1162 d_oldpthreads=''
1163 use5005threads=''
1164 useithreads=''
1165 usereentrant=''
1166 usethreads=''
1167 incpath=''
1168 mips_type=''
1169 usrinc=''
1170 d_vendorarch=''
1171 installvendorarch=''
1172 vendorarch=''
1173 vendorarchexp=''
1174 d_vendorbin=''
1175 installvendorbin=''
1176 vendorbin=''
1177 vendorbinexp=''
1178 installvendorhtml1dir=''
1179 vendorhtml1dir=''
1180 vendorhtml1direxp=''
1181 installvendorhtml3dir=''
1182 vendorhtml3dir=''
1183 vendorhtml3direxp=''
1184 d_vendorlib=''
1185 installvendorlib=''
1186 vendorlib=''
1187 vendorlib_stem=''
1188 vendorlibexp=''
1189 installvendorman1dir=''
1190 vendorman1dir=''
1191 vendorman1direxp=''
1192 installvendorman3dir=''
1193 vendorman3dir=''
1194 vendorman3direxp=''
1195 usevendorprefix=''
1196 vendorprefix=''
1197 vendorprefixexp=''
1198 d_vendorscript=''
1199 installvendorscript=''
1200 vendorscript=''
1201 vendorscriptexp=''
1202 versiononly=''
1203 defvoidused=''
1204 voidflags=''
1205 yacc=''
1206 yaccflags=''
1207 CONFIG=''
1208
1209 define='define'
1210 undef='undef'
1211 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1212 rmlist=''
1213
1214 : We must find out about Eunice early
1215 eunicefix=':'
1216 if test -f /etc/unixtovms; then
1217         eunicefix=/etc/unixtovms
1218 fi
1219 if test -f /etc/unixtovms.exe; then
1220         eunicefix=/etc/unixtovms.exe
1221 fi
1222
1223 : Set executable suffix now -- needed before hints available
1224 if test -f "/libs/version.library"; then
1225 : Amiga OS
1226     _exe=""
1227 elif test -f "/system/gnu_library/bin/ar.pm"; then
1228 : Stratus VOS
1229     _exe=".pm"
1230 elif test -n "$DJGPP"; then
1231 : DOS DJGPP
1232     _exe=".exe"
1233 elif test -d c:/. -o -n "$is_os2" ; then
1234 : OS/2 or cygwin
1235     _exe=".exe"
1236 fi
1237
1238 i_whoami=''
1239 ccname=''
1240 ccversion=''
1241 perllibs=''
1242 : set useposix=false in your hint file to disable the POSIX extension.
1243 useposix=true
1244 : set useopcode=false in your hint file to disable the Opcode extension.
1245 useopcode=true
1246 : Trailing extension.  Override this in a hint file, if needed.
1247 : Extra object files, if any, needed on this platform.
1248 archobjs=''
1249 archname=''
1250 : Possible local include directories to search.
1251 : Set locincpth to "" in a hint file to defeat local include searches.
1252 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1253 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1254 :
1255 : no include file wanted by default
1256 inclwanted=''
1257
1258 groupstype=''
1259 libnames=''
1260 : change the next line if compiling for Xenix/286 on Xenix/386
1261 xlibpth='/usr/lib/386 /lib/386'
1262 : Possible local library directories to search.
1263 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1264 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1265
1266 : general looking path for locating libraries
1267 glibpth="/lib /usr/lib $xlibpth"
1268 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1269 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1270 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1271
1272 : Private path used by Configure to find libraries.  Its value
1273 : is prepended to libpth. This variable takes care of special
1274 : machines, like the mips.  Usually, it should be empty.
1275 plibpth=''
1276
1277 : default library list
1278 libswanted=''
1279 : some systems want to use only the non-versioned libso:s
1280 ignore_versioned_solibs=''
1281 siteman1dir=''
1282 siteman3dir=''
1283 sitescript=''
1284 archname64=''
1285 ccflags_uselargefiles=''
1286 ldflags_uselargefiles=''
1287 libswanted_uselargefiles=''
1288 : set usemultiplicity on the Configure command line to enable multiplicity.
1289 : set usesocks on the Configure command line to enable socks.
1290 : set usethreads on the Configure command line to enable threads.
1291 usereentrant='undef'
1292 : full support for void wanted by default
1293 defvoidused=15
1294
1295 : List of libraries we want.
1296 : If anyone needs extra -lxxx, put those in a hint file.
1297 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1298 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1299 : We probably want to search /usr/shlib before most other libraries.
1300 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1301 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1302 glibpth="/usr/shlib $glibpth"
1303 : Do not use vfork unless overridden by a hint file.
1304 usevfork=false
1305
1306 : Find the basic shell for Bourne shell scripts
1307 case "$sh" in
1308 '')
1309         case "$SYSTYPE" in
1310         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1311         *) xxx='/bin/sh';;
1312         esac
1313         if test -f "$xxx"; then
1314                 sh="$xxx"
1315         else
1316                 : Build up a list and do a single loop so we can 'break' out.
1317                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1318                 for xxx in sh bash ksh pdksh ash; do
1319                         for p in $pth; do
1320                                 try="$try ${p}/${xxx}"
1321                         done
1322                 done
1323                 for xxx in $try; do
1324                         if test -f "$xxx"; then
1325                                 sh="$xxx";
1326                                 break
1327                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1328                                 sh="$xxx";
1329                                 break
1330                         elif test -f "$xxx.exe"; then
1331                                 sh="$xxx";
1332                                 break
1333                         fi
1334                 done
1335         fi
1336         ;;
1337 esac
1338
1339 case "$sh" in
1340 '')     cat >&2 <<EOM
1341 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1342
1343 Usually it's in /bin/sh.  How did you even get this far?
1344 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1345 we'll try to straighten this all out.
1346 EOM
1347         exit 1
1348         ;;
1349 esac
1350
1351 : see if sh knows # comments
1352 if `$sh -c '#' >/dev/null 2>&1`; then
1353         shsharp=true
1354         spitshell=cat
1355         xcat=/bin/cat
1356         test -f $xcat$_exe || xcat=/usr/bin/cat
1357         if test ! -f $xcat$_exe; then
1358                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1359                         if test -f $p/cat$_exe; then
1360                                 xcat=$p/cat
1361                                 break
1362                         fi
1363                 done
1364                 if test ! -f $xcat$_exe; then
1365                         echo "Can't find cat anywhere!"
1366                         exit 1
1367                 fi
1368         fi
1369         echo "#!$xcat" >sharp
1370         $eunicefix sharp
1371         chmod +x sharp
1372         ./sharp > today
1373         if test -s today; then
1374                 sharpbang='#!'
1375         else
1376                 echo "#! $xcat" > sharp
1377                 $eunicefix sharp
1378                 chmod +x sharp
1379                 ./sharp > today
1380                 if test -s today; then
1381                         sharpbang='#! '
1382                 else
1383                         sharpbang=': use '
1384                 fi
1385         fi
1386 else
1387         echo " "
1388         echo "Your $sh doesn't grok # comments--I will strip them later on."
1389         shsharp=false
1390         cd ..
1391         echo "exec grep -v '^[  ]*#'" >spitshell
1392         chmod +x spitshell
1393         $eunicefix spitshell
1394         spitshell=`pwd`/spitshell
1395         cd UU
1396         echo "I presume that if # doesn't work, #! won't work either!"
1397         sharpbang=': use '
1398 fi
1399 rm -f sharp today
1400
1401 : figure out how to guarantee sh startup
1402 case "$startsh" in
1403 '') startsh=${sharpbang}${sh} ;;
1404 *)
1405 esac
1406 cat >sharp <<EOSS
1407 $startsh
1408 set abc
1409 test "$?abc" != 1
1410 EOSS
1411
1412 chmod +x sharp
1413 $eunicefix sharp
1414 if ./sharp; then
1415         : echo "Yup, it does."
1416 else
1417         echo "Hmm... '$startsh' does not guarantee sh startup..."
1418         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1419 fi
1420 rm -f sharp
1421
1422
1423 : Save command line options in file UU/cmdline.opt for later use in
1424 : generating config.sh.
1425 cat > cmdline.opt <<EOSH
1426 # Configure command line arguments.
1427 config_arg0='$0'
1428 config_args='$*'
1429 config_argc=$#
1430 EOSH
1431 argn=1
1432 args_exp=''
1433 args_sep=''
1434 for arg in "$@"; do
1435         cat >>cmdline.opt <<EOSH
1436 config_arg$argn='$arg'
1437 EOSH
1438         # Extreme backslashitis: replace each ' by '"'"'
1439         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1440 $arg
1441 EOC
1442         arg_exp=`cat cmdl.opt`
1443         args_exp="$args_exp$args_sep'$arg_exp'"
1444         argn=`expr $argn + 1`
1445         args_sep=' '
1446 done
1447 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1448 # used by ./hints/os2.sh
1449 rm -f cmdl.opt
1450
1451 : produce awk script to parse command line options
1452 cat >options.awk <<'EOF'
1453 BEGIN {
1454         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1455
1456         len = length(optstr);
1457         for (i = 1; i <= len; i++) {
1458                 c = substr(optstr, i, 1);
1459                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1460                 if (a == ":") {
1461                         arg[c] = 1;
1462                         i++;
1463                 }
1464                 opt[c] = 1;
1465         }
1466 }
1467 {
1468         expect = 0;
1469         str = $0;
1470         if (substr(str, 1, 1) != "-") {
1471                 printf("'%s'\n", str);
1472                 next;
1473         }
1474         len = length($0);
1475         for (i = 2; i <= len; i++) {
1476                 c = substr(str, i, 1);
1477                 if (!opt[c]) {
1478                         printf("-%s\n", substr(str, i));
1479                         next;
1480                 }
1481                 printf("-%s\n", c);
1482                 if (arg[c]) {
1483                         if (i < len)
1484                                 printf("'%s'\n", substr(str, i + 1));
1485                         else
1486                                 expect = 1;
1487                         next;
1488                 }
1489         }
1490 }
1491 END {
1492         if (expect)
1493                 print "?";
1494 }
1495 EOF
1496
1497 : process the command line options
1498 set X `for arg in "$@"; do echo "X$arg"; done |
1499         sed -e s/X// | awk -f options.awk`
1500 eval "set $*"
1501 shift
1502 rm -f options.awk
1503
1504 : set up default values
1505 fastread=''
1506 reuseval=false
1507 config_sh=''
1508 alldone=''
1509 error=''
1510 silent=''
1511 extractsh=''
1512 override=''
1513 knowitall=''
1514 rm -f optdef.sh posthint.sh
1515 cat >optdef.sh <<EOS
1516 $startsh
1517 EOS
1518
1519
1520 : option parsing
1521 while test $# -gt 0; do
1522         case "$1" in
1523         -d) shift; fastread=yes;;
1524         -e) shift; alldone=cont;;
1525         -f)
1526                 shift
1527                 cd ..
1528                 if test -r "$1"; then
1529                         config_sh="$1"
1530                 else
1531                         echo "$me: cannot read config file $1." >&2
1532                         error=true
1533                 fi
1534                 cd UU
1535                 shift;;
1536         -h) shift; error=true;;
1537         -r) shift; reuseval=true;;
1538         -s) shift; silent=true; realsilent=true;;
1539         -E) shift; alldone=exit;;
1540         -K) shift; knowitall=true;;
1541         -O) shift; override=true;;
1542         -S) shift; silent=true; extractsh=true;;
1543         -D)
1544                 shift
1545                 case "$1" in
1546                 *=)
1547                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1548                         echo "$me: ignoring -D $1" >&2
1549                         ;;
1550                 *=*) echo "$1" | \
1551                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1552                 *) echo "$1='define'" >> optdef.sh;;
1553                 esac
1554                 shift
1555                 ;;
1556         -U)
1557                 shift
1558                 case "$1" in
1559                 *=) echo "$1" >> optdef.sh;;
1560                 *=*)
1561                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1562                         echo "$me: ignoring -U $1" >&2
1563                         ;;
1564                 *) echo "$1='undef'" >> optdef.sh;;
1565                 esac
1566                 shift
1567                 ;;
1568         -A)
1569             shift
1570             xxx=''
1571             yyy="$1"
1572             zzz=''
1573             uuu=undef
1574             case "$yyy" in
1575             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1576                  case "$zzz" in
1577                  *:*) zzz='' ;;
1578                  *)   xxx=append
1579                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1580                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1581                  esac
1582                  ;;
1583             esac
1584             case "$xxx" in
1585             '')  case "$yyy" in
1586                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1587                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1588                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1589                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1590                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1591                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1592                  esac
1593                  ;;       
1594             esac
1595             case "$xxx" in
1596             append)
1597                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1598             clear)
1599                 echo "$yyy=''"                  >> posthint.sh ;;
1600             define)
1601                 case "$zzz" in
1602                 '') zzz=define ;;
1603                 esac
1604                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1605             eval)
1606                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1607             prepend)
1608                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1609             undef)
1610                 case "$zzz" in
1611                 '') zzz="$uuu" ;;
1612                 esac
1613                 echo "$yyy=$zzz"                >> posthint.sh ;;
1614             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1615             esac
1616             shift
1617             ;;
1618         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1619             exit 0;;
1620         --) break;;
1621         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1622         *) break;;
1623         esac
1624 done
1625
1626 case "$error" in
1627 true)
1628         cat >&2 <<EOM
1629 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1630                  [-U symbol] [-U symbol=] [-A command:symbol...]
1631   -d : use defaults for all answers.
1632   -e : go on without questioning past the production of config.sh.
1633   -f : specify an alternate default configuration file.
1634   -h : print this help message and exit (with an error status).
1635   -r : reuse C symbols value if possible (skips costly nm extraction).
1636   -s : silent mode, only echoes questions and essential information.
1637   -D : define symbol to have some value:
1638          -D symbol         symbol gets the value 'define'
1639          -D symbol=value   symbol gets the value 'value'
1640   -E : stop at the end of questions, after having produced config.sh.
1641   -K : do not use unless you know what you are doing.
1642   -O : let -D and -U override definitions from loaded configuration file.
1643   -S : perform variable substitutions on all .SH files (can mix with -f)
1644   -U : undefine symbol:
1645          -U symbol    symbol gets the value 'undef'
1646          -U symbol=   symbol gets completely empty
1647   -A : manipulate symbol after the platform specific hints have been applied:
1648          -A symbol=value                append " "value to symbol
1649          -A append:symbol=value         append value to symbol
1650          -A define:symbol=value         define symbol to have value
1651          -A clear:symbol                define symbol to be ''
1652          -A define:symbol               define symbol to be 'define'
1653          -A eval:symbol=value           define symbol to be eval of value
1654          -A prepend:symbol=value        prepend value to symbol
1655          -A undef:symbol                define symbol to be 'undef'
1656          -A undef:symbol=               define symbol to be ''
1657   -V : print version number and exit (with a zero status).
1658 EOM
1659         exit 1
1660         ;;
1661 esac
1662
1663 : Sanity checks
1664 case "$fastread$alldone" in
1665 yescont|yesexit) ;;
1666 *)
1667         case "$extractsh" in
1668         true) ;;
1669         *)
1670                 if test ! -t 0; then
1671                         echo "Say 'sh Configure', not 'sh <Configure'"
1672                         exit 1
1673                 fi
1674                 ;;
1675         esac
1676         ;;
1677 esac
1678
1679 exec 4>&1
1680 case "$silent" in
1681 true) exec 1>/dev/null;;
1682 esac
1683
1684 : run the defines and the undefines, if any, but leave the file out there...
1685 touch optdef.sh
1686 . ./optdef.sh
1687 : create the posthint manipulation script and leave the file out there...
1688 touch posthint.sh
1689
1690 : set package name
1691 package=perl5
1692 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1693 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1694 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1695 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1696 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1697 esac
1698
1699 : Some greps do not return status, grrr.
1700 echo "grimblepritz" >grimble
1701 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1702         contains=contains
1703 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1704         contains=grep
1705 else
1706         contains=contains
1707 fi
1708 rm -f grimble
1709 : the following should work in any shell
1710 case "$contains" in
1711 contains*)
1712         echo " "
1713         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1714         cat >contains <<'EOSS'
1715 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1716 EOSS
1717 chmod +x contains
1718 esac
1719
1720 : Find the path to the source tree
1721 case "$src" in
1722 '') case "$0" in
1723     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1724          case "$src" in
1725          /*)    ;;
1726          .)     ;;
1727          *)     src=`cd ../$src && pwd` ;;
1728          esac
1729          ;;
1730     *)   src='.';;
1731     esac;;
1732 esac
1733 case "$src" in
1734 '')     src=/
1735         rsrc=/
1736         ;;
1737 /*) rsrc="$src";;
1738 *) rsrc="../$src";;
1739 esac
1740 if test -f $rsrc/Configure && \
1741         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1742 then
1743    : found it, so we are ok.
1744 else
1745         rsrc=''
1746         for src in . .. ../.. ../../.. ../../../..; do
1747                 if test -f ../$src/Configure && \
1748                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1749                 then
1750                         rsrc=../$src
1751                         break
1752                 fi
1753         done
1754 fi
1755 case "$rsrc" in
1756 '')
1757         cat <<EOM >&4
1758
1759 Sorry, I can't seem to locate the source dir for $package.  Please start
1760 Configure with an explicit path -- i.e. /some/path/Configure.
1761
1762 EOM
1763         exit 1
1764         ;;
1765 ../.)   rsrc='..';;
1766 *)
1767         echo " "
1768         echo "Sources for $package found in \"$src\"." >&4
1769         ;;
1770 esac
1771
1772 : script used to extract .SH files with variable substitutions
1773 cat >extract <<'EOS'
1774 PERL_CONFIG_SH=true
1775 echo "Doing variable substitutions on .SH files..."
1776 if test -f MANIFEST; then
1777         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1778 else
1779         echo "(Looking for .SH files under the source directory.)"
1780         set x `(cd "$src"; find . -name "*.SH" -print)`
1781 fi
1782 shift
1783 case $# in
1784 0) set x `(cd "$src"; echo *.SH)`; shift;;
1785 esac
1786 if test ! -f "$src/$1"; then
1787         shift
1788 fi
1789 mkdir_p='
1790 name=$1;
1791 create="";
1792 while test $name; do
1793         if test ! -d "$name"; then
1794                 create="$name $create";
1795                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1796                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1797         else
1798                 name="";
1799         fi;
1800 done;
1801 for file in $create; do
1802         mkdir $file;
1803 done
1804 '
1805 for file in $*; do
1806         case "$src" in
1807         ".")
1808                 case "$file" in
1809                 */*)
1810                         dir=`expr X$file : 'X\(.*\)/'`
1811                         file=`expr X$file : 'X.*/\(.*\)'`
1812                         (cd "$dir" && . ./$file)
1813                         ;;
1814                 *)
1815                         . ./$file
1816                         ;;
1817                 esac
1818                 ;;
1819         *)
1820                 case "$file" in
1821                 */*)
1822                         dir=`expr X$file : 'X\(.*\)/'`
1823                         file=`expr X$file : 'X.*/\(.*\)'`
1824                         (set x $dir; shift; eval $mkdir_p)
1825                         sh <"$src/$dir/$file"
1826                         ;;
1827                 *)
1828                         sh <"$src/$file"
1829                         ;;
1830                 esac
1831                 ;;
1832         esac
1833 done
1834 if test -f "$src/config_h.SH"; then
1835         if test ! -f config.h; then
1836         : oops, they left it out of MANIFEST, probably, so do it anyway.
1837         . "$src/config_h.SH"
1838         fi
1839 fi
1840 EOS
1841
1842 : extract files and exit if asked to do so
1843 case "$extractsh" in
1844 true)
1845         case "$realsilent" in
1846         true) ;;
1847         *) exec 1>&4;;
1848         esac
1849         case "$config_sh" in
1850         '') config_sh='config.sh';;
1851         esac
1852         echo " "
1853         echo "Fetching answers from $config_sh..."
1854         cd ..
1855         . $config_sh
1856         test "$override" && . ./optdef.sh
1857         echo " "
1858         . UU/extract
1859         rm -rf UU
1860         echo "Extraction done."
1861         exit 0
1862         ;;
1863 esac
1864
1865 : Eunice requires " " instead of "", can you believe it
1866 echo " "
1867 : Here we go...
1868 echo "Beginning of configuration questions for $package."
1869
1870 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1871
1872 : first determine how to suppress newline on echo command
1873 echo " "
1874 echo "Checking echo to see how to suppress newlines..."
1875 (echo "hi there\c" ; echo " ") >.echotmp
1876 if $contains c .echotmp >/dev/null 2>&1 ; then
1877         echo "...using -n."
1878         n='-n'
1879         c=''
1880 else
1881         cat <<'EOM'
1882 ...using \c
1883 EOM
1884         n=''
1885         c='\c'
1886 fi
1887 echo $n "The star should be here-->$c"
1888 echo '*'
1889 rm -f .echotmp
1890
1891 : Now test for existence of everything in MANIFEST
1892 echo " "
1893 if test -f "$rsrc/MANIFEST"; then
1894         echo "First let's make sure your kit is complete.  Checking..." >&4
1895         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1896         rm -f missing
1897         tmppwd=`pwd`
1898         for filelist in x??; do
1899                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1900         done
1901         if test -s missing; then
1902                 cat missing >&4
1903                 cat >&4 <<'EOM'
1904
1905 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1906
1907 You have the option of continuing the configuration process, despite the
1908 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1909 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1910 and contact the author (perlbug@perl.org).
1911
1912 EOM
1913                 echo $n "Continue? [n] $c" >&4
1914                 read ans
1915                 case "$ans" in
1916                 y*)
1917                         echo "Continuing..." >&4
1918                         rm -f missing
1919                         ;;
1920                 *)
1921                         echo "ABORTING..." >&4
1922                         kill $$
1923                         ;;
1924                 esac
1925         else
1926                 echo "Looks good..."
1927         fi
1928 else
1929         echo "There is no MANIFEST file.  I hope your kit is complete !"
1930 fi
1931 rm -f missing x??
1932
1933 echo " "
1934 : Find the appropriate value for a newline for tr
1935 if test -n "$DJGPP"; then
1936        trnl='\012'
1937 fi
1938 if test X"$trnl" = X; then
1939         case "`echo foo|tr '\n' x 2>/dev/null`" in
1940         foox) trnl='\n' ;;
1941         esac
1942 fi
1943 if test X"$trnl" = X; then
1944         case "`echo foo|tr '\012' x 2>/dev/null`" in
1945         foox) trnl='\012' ;;
1946         esac
1947 fi
1948 if test X"$trnl" = X; then
1949        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1950        fooxy) trnl='\n\r' ;;
1951        esac
1952 fi
1953 if test X"$trnl" = X; then
1954         cat <<EOM >&2
1955
1956 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1957
1958 EOM
1959         exit 1
1960 fi
1961
1962 : compute the number of columns on the terminal for proper question formatting
1963 case "$COLUMNS" in
1964 '') COLUMNS='80';;
1965 esac
1966
1967 : set up the echo used in my read
1968 myecho="case \"\$xxxm\" in
1969 '') echo $n \"\$rp $c\" >&4;;
1970 *) case \"\$rp\" in
1971         '') echo $n \"[\$xxxm] $c\";;
1972         *)
1973                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1974                         echo \"\$rp\" >&4
1975                         echo $n \"[\$xxxm] $c\" >&4
1976                 else
1977                         echo $n \"\$rp [\$xxxm] $c\" >&4
1978                 fi
1979                 ;;
1980         esac;;
1981 esac"
1982
1983 : now set up to do reads with possible shell escape and default assignment
1984 cat <<EOSC >myread
1985 $startsh
1986 xxxm=\$dflt
1987 $myecho
1988 ans='!'
1989 case "\$fastread" in
1990 yes) case "\$dflt" in
1991         '') ;;
1992         *) ans='';
1993                 case "\$silent-\$rp" in
1994                 true-) ;;
1995                 *) echo " " >&4;;
1996                 esac;;
1997         esac;;
1998 *) case "\$silent" in
1999         true) case "\$rp" in
2000                 '') ans='';;
2001                 esac;;
2002         esac;;
2003 esac
2004 while expr "X\$ans" : "X!" >/dev/null; do
2005         read answ
2006         set x \$xxxm
2007         shift
2008         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2009         case  "\$answ" in
2010         "!")
2011                 sh 1>&4
2012                 echo " "
2013                 $myecho
2014                 ;;
2015         !*)
2016                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2017                 shift
2018                 sh 1>&4 -c "\$*"
2019                 echo " "
2020                 $myecho
2021                 ;;
2022         "\$ans")
2023                 case "\$ans" in
2024                 \\&*)
2025                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2026                         shift
2027                         case "\$1" in
2028                         -d)
2029                                 fastread=yes
2030                                 echo "(OK, I'll run with -d after this question.)" >&4
2031                                 ;;
2032                         -*)
2033                                 echo "*** Sorry, \$1 not supported yet." >&4
2034                                 ;;
2035                         esac
2036                         $myecho
2037                         ans=!
2038                         ;;
2039                 esac;;
2040         *)
2041                 case "\$aok" in
2042                 y)
2043                         echo "*** Substitution done -- please confirm."
2044                         xxxm="\$ans"
2045                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2046                         xxxm="\$ans"
2047                         ans=!
2048                         ;;
2049                 *)
2050                         echo "*** Error -- try again."
2051                         ans=!
2052                         ;;
2053                 esac
2054                 $myecho
2055                 ;;
2056         esac
2057         case "\$ans\$xxxm\$nostick" in
2058         '')
2059                 ans=!
2060                 $myecho
2061                 ;;
2062         esac
2063 done
2064 case "\$ans" in
2065 '') ans="\$xxxm";;
2066 esac
2067 EOSC
2068
2069 : create .config dir to save info across Configure sessions
2070 test -d ../.config || mkdir ../.config
2071 cat >../.config/README <<EOF
2072 This directory created by Configure to save information that should
2073 persist across sessions for $package.
2074
2075 You may safely delete it if you wish.
2076 EOF
2077
2078 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2079 case "$usedevel" in
2080 $define|true|[yY]*) ;;
2081 *) case "$xversion" in
2082    *[13579])
2083         cat >&4 <<EOH
2084 *** WHOA THERE!!! ***
2085
2086     This is an UNSTABLE DEVELOPMENT release.
2087     The version of this $package distribution is $xversion, that is, odd,
2088     (as opposed to even) and that signifies a development release.
2089     If you want a maintenance release, you want an even-numbered version.
2090
2091     Do ***NOT*** install this into production use.
2092     Data corruption and crashes are possible.
2093
2094     It is most seriously suggested that you do not continue any further
2095     unless you want to help in developing and debugging Perl.
2096
2097     If you *still* want to build perl, you can answer 'y' now,
2098     or pass -Dusedevel to Configure.
2099
2100 EOH
2101         rp='Do you really want to continue?'
2102         dflt='n'
2103         . ./myread
2104         case "$ans" in
2105         [yY]) echo >&4 "Okay, continuing."
2106               usedevel="$define" ;;
2107         *) echo >&4 "Okay, bye."
2108            exit 1
2109            ;;
2110         esac
2111         ;;
2112     esac
2113     ;;
2114 esac
2115 case "$usedevel" in
2116 $define|true|[yY]*)
2117         case "$versiononly" in
2118         '') versiononly="$define" ;;
2119         esac
2120         case "$installusrbinperl" in
2121         '') installusrbinperl="$undef" ;;
2122         esac
2123         ;;
2124 esac
2125
2126 : general instructions
2127 needman=true
2128 firsttime=true
2129 user=`(logname) 2>/dev/null`
2130 case "$user" in
2131 '') user=`whoami 2>&1`;;
2132 esac
2133 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2134         firsttime=false
2135         echo " "
2136         rp='Would you like to see the instructions?'
2137         dflt=n
2138         . ./myread
2139         case "$ans" in
2140         [yY]*) ;;
2141         *) needman=false;;
2142         esac
2143 fi
2144 if $needman; then
2145         cat <<EOH
2146
2147 This installation shell script will examine your system and ask you questions
2148 to determine how the perl5 package should be installed. If you get
2149 stuck on a question, you may use a ! shell escape to start a subshell or
2150 execute a command.  Many of the questions will have default answers in square
2151 brackets; typing carriage return will give you the default.
2152
2153 On some of the questions which ask for file or directory names you are allowed
2154 to use the ~name construct to specify the login directory belonging to "name",
2155 even if you don't have a shell which knows about that.  Questions where this is
2156 allowed will be marked "(~name ok)".
2157
2158 EOH
2159         rp=''
2160         dflt='Type carriage return to continue'
2161         . ./myread
2162         cat <<'EOH'
2163
2164 The prompter used in this script allows you to use shell variables and
2165 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2166 in the default answer, as if the default line was a set of arguments given to a
2167 script shell.  This means you may also use $* to repeat the whole default line,
2168 so you do not have to re-type everything to add something to the default.
2169
2170 Everytime there is a substitution, you will have to confirm.  If there is an
2171 error (e.g. an unmatched backtick), the default answer will remain unchanged
2172 and you will be prompted again.
2173
2174 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2175 the questions and use the computed defaults (or the previous answers if there
2176 was already a config.sh file). Type 'Configure -h' for a list of options.
2177 You may also start interactively and then answer '& -d' at any prompt to turn
2178 on the non-interactive behaviour for the remainder of the execution.
2179
2180 EOH
2181         . ./myread
2182         cat <<EOH
2183
2184 Much effort has been expended to ensure that this shell script will run on any
2185 Unix system.  If despite that it blows up on yours, your best bet is to edit
2186 Configure and run it again.  If you can't run Configure for some reason,
2187 you'll have to generate a config.sh file by hand.  Whatever problems you
2188 have, let me (perlbug@perl.org) know how I blew it.
2189
2190 This installation script affects things in two ways:
2191
2192 1) it may do direct variable substitutions on some of the files included
2193    in this kit.
2194 2) it builds a config.h file for inclusion in C programs.  You may edit
2195    any of these files as the need arises after running this script.
2196
2197 If you make a mistake on a question, there is no easy way to back up to it
2198 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2199 files.  Configure will offer to let you do this before it runs the SH files.
2200
2201 EOH
2202         dflt='Type carriage return to continue'
2203         . ./myread
2204         case "$firsttime" in
2205         true) echo $user >>../.config/instruct;;
2206         esac
2207 fi
2208
2209 : find out where common programs are
2210 echo " "
2211 echo "Locating common programs..." >&4
2212 cat <<EOSC >loc
2213 $startsh
2214 case \$# in
2215 0) exit 1;;
2216 esac
2217 thing=\$1
2218 shift
2219 dflt=\$1
2220 shift
2221 for dir in \$*; do
2222         case "\$thing" in
2223         .)
2224         if test -d \$dir/\$thing; then
2225                 echo \$dir
2226                 exit 0
2227         fi
2228         ;;
2229         *)
2230         for thisthing in \$dir/\$thing; do
2231                 : just loop through to pick last item
2232         done
2233         if test -f \$thisthing; then
2234                 echo \$thisthing
2235                 exit 0
2236         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2237                 echo \$thisthing
2238                 exit 0
2239         elif test -f \$dir/\$thing.exe; then
2240                 if test -n "$DJGPP"; then
2241                         echo \$dir/\$thing.exe
2242                 elif test "$eunicefix" != ":"; then
2243                         : on Eunice apparently
2244                         echo \$dir/\$thing
2245                         exit 0
2246                 fi
2247                 exit 0
2248         fi
2249         ;;
2250         esac
2251 done
2252 echo \$dflt
2253 exit 1
2254 EOSC
2255 chmod +x loc
2256 $eunicefix loc
2257 loclist="
2258 awk
2259 cat
2260 chmod
2261 comm
2262 cp
2263 echo
2264 expr
2265 grep
2266 ls
2267 mkdir
2268 rm
2269 sed
2270 sort
2271 touch
2272 tr
2273 uniq
2274 "
2275 trylist="
2276 Mcc
2277 ar
2278 bison
2279 byacc
2280 cpp
2281 csh
2282 date
2283 egrep
2284 gmake
2285 gzip
2286 less
2287 ln
2288 make
2289 more
2290 nm
2291 nroff
2292 pg
2293 test
2294 uname
2295 zip
2296 "
2297 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2298 pth="$pth /lib /usr/lib"
2299 for file in $loclist; do
2300         eval xxx=\$$file
2301         case "$xxx" in
2302         /*|?:[\\/]*)
2303                 if test -f "$xxx"; then
2304                         : ok
2305                 else
2306                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2307                         xxx=`./loc $file $file $pth`
2308                 fi
2309                 ;;
2310         '') xxx=`./loc $file $file $pth`;;
2311         *) xxx=`./loc $xxx $xxx $pth`;;
2312         esac
2313         eval $file=$xxx$_exe
2314         eval _$file=$xxx
2315         case "$xxx" in
2316         /*)
2317                 echo $file is in $xxx.
2318                 ;;
2319         ?:[\\/]*)
2320                 echo $file is in $xxx.
2321                 ;;
2322         *)
2323                 echo "I don't know where '$file' is, and my life depends on it." >&4
2324                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2325                 exit 1
2326                 ;;
2327         esac
2328 done
2329 echo " "
2330 echo "Don't worry if any of the following aren't found..."
2331 say=offhand
2332 for file in $trylist; do
2333         eval xxx=\$$file
2334         case "$xxx" in
2335         /*|?:[\\/]*)
2336                 if test -f "$xxx"; then
2337                         : ok
2338                 else
2339                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2340                         xxx=`./loc $file $file $pth`
2341                 fi
2342                 ;;
2343         '') xxx=`./loc $file $file $pth`;;
2344         *) xxx=`./loc $xxx $xxx $pth`;;
2345         esac
2346         eval $file=$xxx$_exe
2347         eval _$file=$xxx
2348         case "$xxx" in
2349         /*)
2350                 echo $file is in $xxx.
2351                 ;;
2352         ?:[\\/]*)
2353                 echo $file is in $xxx.
2354                 ;;
2355         *)
2356                 echo "I don't see $file out there, $say."
2357                 say=either
2358                 ;;
2359         esac
2360 done
2361 case "$egrep" in
2362 egrep)
2363         echo "Substituting grep for egrep."
2364         egrep=$grep
2365         _egrep=$grep
2366         ;;
2367 esac
2368 case "$ln" in
2369 ln)
2370         echo "Substituting cp for ln."
2371         ln=$cp
2372         _ln=$cp
2373         ;;
2374 esac
2375 case "$make" in
2376 make)   
2377         case "$gmake" in
2378         gmake)
2379         echo "I can't find make or gmake, and my life depends on it." >&4
2380         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2381         exit 1
2382         ;;
2383         esac
2384         ;;
2385 esac    
2386 case "$gmake" in
2387 gmake)  ;;
2388 *)      # We can't have osname yet.
2389         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2390                 # Assume that gmake, if found, is definitely GNU make
2391                 # and prefer it over the system make.
2392                 echo "Substituting gmake for make."
2393                 make=$gmake
2394                 _make=$gmake
2395         fi
2396         ;;
2397 esac
2398 case "$test" in
2399 test)
2400         echo "Hopefully test is built into your sh."
2401         ;;
2402 *)
2403         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2404                 echo "Using the test built into your sh."
2405                 test=test
2406                 _test=test
2407         fi
2408         ;;
2409 esac
2410 case "$echo" in
2411 echo)
2412         echo "Hopefully echo is built into your sh."
2413         ;;
2414 '') ;;
2415 *)
2416         echo " "
2417 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2418         $echo $n "hi there$c" >foo1
2419         echo $n "hi there$c" >foo2
2420         if cmp foo1 foo2 >/dev/null 2>&1; then
2421                 echo "They are compatible.  In fact, they may be identical."
2422         else
2423                 case "$n" in
2424                 '-n') n='' c='\c';;
2425                 *) n='-n' c='';;
2426                 esac
2427                 cat <<FOO
2428 They are not compatible!  You are probably running ksh on a non-USG system.
2429 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2430 have echo built in and we may have to run some Bourne shell scripts.  That
2431 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2432
2433 FOO
2434                 $echo $n "The star should be here-->$c"
2435                 $echo "*"
2436         fi
2437         $rm -f foo1 foo2
2438         ;;
2439 esac
2440
2441 cat <<EOS >trygcc
2442 $startsh
2443 EOS
2444 cat <<'EOSC' >>trygcc
2445 case "$cc" in
2446 '') ;;
2447 *)  $rm -f try try.*
2448     $cat >try.c <<EOM
2449 int main(int argc, char *argv[]) {
2450   return 0;
2451 }
2452 EOM
2453     if $cc -o try $ccflags $ldflags try.c; then
2454        :
2455     else
2456         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2457         despair=yes
2458         trygcc=yes
2459         case "$cc" in
2460         *gcc*) trygcc=no ;;
2461         esac
2462         case "`$cc -v -c try.c 2>&1`" in
2463         *gcc*) trygcc=no ;;
2464         esac
2465         if $test X"$trygcc" = Xyes; then
2466             if gcc -o try -c try.c; then
2467                 echo " "
2468                 echo "You seem to have a working gcc, though." >&4
2469                 rp="Would you like to use it?"
2470                 dflt=y
2471                 if $test -f myread; then
2472                     . ./myread
2473                 else
2474                     if $test -f UU/myread; then
2475                         . ./UU/myread
2476                     else
2477                         echo "Cannot find myread, sorry.  Aborting." >&2
2478                         exit 1
2479                     fi
2480                 fi  
2481                 case "$ans" in
2482                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2483                        if $test -f usethreads.cbu; then
2484                            $cat >&4 <<EOM 
2485
2486 *** However, any setting of the C compiler flags (e.g. for thread support)
2487 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2488 *** (together with e.g. -Dusethreads).
2489
2490 EOM
2491                        fi;;
2492                 esac
2493             fi
2494         fi
2495     fi
2496     $rm -f try try.*
2497     ;;
2498 esac
2499 EOSC
2500
2501 cat <<EOS >checkcc
2502 $startsh
2503 EOS
2504 cat <<'EOSC' >>checkcc
2505 case "$cc" in        
2506 '') ;;
2507 *)  $rm -f try try.*              
2508     $cat >try.c <<EOM
2509 int main(int argc, char *argv[]) {
2510   return 0;
2511 }
2512 EOM
2513     if $cc -o try $ccflags $ldflags try.c; then
2514        :
2515     else
2516         if $test X"$despair" = Xyes; then
2517            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2518         fi
2519         $cat >&4 <<EOM         
2520 You need to find a working C compiler.
2521 Either (purchase and) install the C compiler supplied by your OS vendor,
2522 or for a free C compiler try http://gcc.gnu.org/
2523 I cannot continue any further, aborting.
2524 EOM
2525         exit 1
2526     fi
2527     $rm -f try try.*
2528     ;;
2529 esac
2530 EOSC
2531
2532 : determine whether symbolic links are supported
2533 echo " "
2534 $touch blurfl
2535 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2536         echo "Symbolic links are supported." >&4
2537         lns="$ln -s"
2538 else
2539         echo "Symbolic links are NOT supported." >&4
2540         lns="$ln"
2541 fi
2542 $rm -f blurfl sym
2543
2544 : determine whether symbolic links are supported
2545 echo " "
2546 case "$lns" in
2547 *"ln"*" -s")
2548         echo "Checking how to test for symbolic links..." >&4
2549         $lns blurfl sym
2550         if $test "X$issymlink" = X; then
2551                 case "$newsh" in
2552                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2553                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2554                 esac
2555                 if test $? = 0; then
2556                         issymlink="test -h"
2557                 else
2558                         echo "Your builtin 'test -h' may be broken." >&4
2559                         case "$test" in
2560                         /*)     ;;
2561                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2562                                 for p in $pth
2563                                 do
2564                                         if test -f "$p/$test"; then
2565                                                 test="$p/$test"
2566                                                 break
2567                                         fi
2568                                 done
2569                                 ;;
2570                         esac
2571                         case "$test" in
2572                         /*)
2573                                 echo "Trying external '$test -h'." >&4
2574                                 issymlink="$test -h"
2575                                 if $test ! -h sym >/dev/null 2>&1; then
2576                                         echo "External '$test -h' is broken, too." >&4
2577                                         issymlink=''
2578                                 fi
2579                                 ;;
2580                         *)      issymlink='' ;;
2581                         esac
2582                 fi              
2583         fi
2584         if $test "X$issymlink" = X; then
2585                 if $test -L sym 2>/dev/null; then
2586                         issymlink="$test -L"
2587                         echo "The builtin '$test -L' worked." >&4
2588                 fi
2589         fi
2590         if $test "X$issymlink" != X; then
2591                 echo "You can test for symbolic links with '$issymlink'." >&4
2592         else
2593                 echo "I do not know how you can test for symbolic links." >&4
2594         fi
2595         $rm -f blurfl sym
2596         ;;
2597 *)      echo "No symbolic links, so not testing for their testing..." >&4
2598         ;;
2599 esac
2600 echo " "
2601
2602
2603 case "$mksymlinks" in
2604 $define|true|[yY]*)
2605         case "$src" in
2606         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2607                 exit 1
2608                 ;;
2609         *)      case "$lns:$issymlink" in
2610                 *"ln"*" -s:"*"test -"?)
2611                         echo "Creating the symbolic links..." >&4
2612                         echo "(First creating the subdirectories...)" >&4
2613                         cd ..
2614                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2615                                 read directory
2616                                 test -z "$directory" && break
2617                                 mkdir -p $directory
2618                         done
2619                         # Sanity check 1.
2620                         if test ! -d t/base; then
2621                                 echo "Failed to create the subdirectories.  Aborting." >&4
2622                                 exit 1
2623                         fi
2624                         echo "(Then creating the symlinks...)" >&4
2625                         awk '{print $1}' $src/MANIFEST | while true; do
2626                                 read filename
2627                                 test -z "$filename" && break
2628                                 if test -f $filename; then
2629                                         if $issymlink $filename; then
2630                                                 rm -f $filename
2631                                         fi
2632                                 fi
2633                                 if test -f $filename; then
2634                                         echo "$filename already exists, not symlinking."
2635                                 else
2636                                         ln -s $src/$filename $filename
2637                                 fi
2638                         done
2639                         # Sanity check 2.
2640                         if test ! -f t/base/lex.t; then
2641                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2642                                 exit 1
2643                         fi
2644                         cd UU
2645                         ;;
2646                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2647                         ;;
2648                 esac
2649                 ;;
2650         esac
2651         ;;
2652 esac
2653
2654
2655 case "$usecrosscompile" in
2656 $define|true|[yY]*)
2657         $echo "Cross-compiling..."
2658         croak=''
2659         case "$cc" in
2660         *-*-gcc) # A cross-compiling gcc, probably.
2661             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2662             ar=$targetarch-ar
2663             # leave out ld, choosing it is more complex
2664             nm=$targetarch-nm
2665             ranlib=$targetarch-ranlib
2666             $echo 'extern int foo;' > try.c
2667             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2668             shift
2669             if $test $# -gt 0; then
2670                 incpth="$incpth $*"
2671                 incpth="`$echo $incpth|$sed 's/^ //'`"
2672                 echo "Guessing incpth '$incpth'." >&4
2673                 for i in $*; do
2674                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2675                     if $test -d $j; then
2676                         libpth="$libpth $j"
2677                     fi
2678                 done   
2679                 libpth="`$echo $libpth|$sed 's/^ //'`"
2680                 echo "Guessing libpth '$libpth'." >&4
2681             fi
2682             $rm -f try.c
2683             ;;
2684         esac
2685         case "$targetarch" in
2686         '') echo "Targetarch not defined." >&4; croak=y ;;
2687         *)  echo "Using targetarch $targetarch." >&4 ;;
2688         esac
2689         case "$incpth" in
2690         '') echo "Incpth not defined." >&4; croak=y ;;
2691         *)  echo "Using incpth '$incpth'." >&4 ;;
2692         esac
2693         case "$libpth" in
2694         '') echo "Libpth not defined." >&4; croak=y ;;
2695         *)  echo "Using libpth '$libpth'." >&4 ;;
2696         esac
2697         case "$usrinc" in
2698         '') for i in $incpth; do
2699                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2700                     usrinc=$i
2701                     echo "Guessing usrinc $usrinc." >&4
2702                     break
2703                 fi
2704             done
2705             case "$usrinc" in
2706             '') echo "Usrinc not defined." >&4; croak=y ;;
2707             esac
2708             ;;
2709         *)  echo "Using usrinc $usrinc." >&4 ;;
2710         esac
2711         case "$targethost" in
2712         '') echo "Targethost not defined." >&4; croak=y ;;
2713         *)  echo "Using targethost $targethost." >&4
2714         esac
2715         locincpth=' '
2716         loclibpth=' '
2717         case "$croak" in
2718         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2719         esac
2720         case "$src" in
2721         /*) run=$src/Cross/run
2722             targetmkdir=$src/Cross/mkdir
2723             to=$src/Cross/to
2724             from=$src/Cross/from
2725             ;;
2726         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2727             run=$pwd/Cross/run
2728             targetmkdir=$pwd/Cross/mkdir
2729             to=$pwd/Cross/to
2730             from=$pwd/Cross/from
2731             ;;
2732         esac
2733         case "$targetrun" in
2734         '') targetrun=ssh ;;
2735         esac
2736         case "$targetto" in
2737         '') targetto=scp ;;
2738         esac
2739         case "$targetfrom" in
2740         '') targetfrom=scp ;;
2741         esac
2742         run=$run-$targetrun
2743         to=$to-$targetto
2744         from=$from-$targetfrom
2745         case "$targetdir" in
2746         '')  targetdir=/tmp
2747              echo "Guessing targetdir $targetdir." >&4
2748              ;;
2749         esac
2750         case "$targetuser" in
2751         '')  targetuser=root
2752              echo "Guessing targetuser $targetuser." >&4
2753              ;;
2754         esac
2755         case "$targetfrom" in
2756         scp)    q=-q ;;
2757         *)      q='' ;;
2758         esac
2759         case "$targetrun" in
2760         ssh|rsh)
2761             cat >$run <<EOF
2762 #!/bin/sh
2763 case "\$1" in
2764 -cwd)
2765   shift
2766   cwd=\$1
2767   shift
2768   ;;
2769 esac
2770 case "\$cwd" in
2771 '') cwd=$targetdir ;;
2772 esac
2773 exe=\$1
2774 shift
2775 if $test ! -f \$exe.xok; then
2776   $to \$exe
2777   $touch \$exe.xok
2778 fi
2779 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2780 EOF
2781             ;;
2782         *)  echo "Unknown targetrun '$targetrun'" >&4
2783             exit 1
2784             ;;
2785         esac
2786         case "$targetmkdir" in
2787         */Cross/mkdir)
2788             cat >$targetmkdir <<EOF
2789 #!/bin/sh
2790 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2791 EOF
2792             $chmod a+rx $targetmkdir
2793             ;;
2794         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2795             exit 1
2796             ;;
2797         esac
2798         case "$targetto" in
2799         scp|rcp)
2800             cat >$to <<EOF
2801 #!/bin/sh
2802 for f in \$@
2803 do
2804   case "\$f" in
2805   /*)
2806     $targetmkdir \`dirname \$f\`
2807     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2808     ;;
2809   *)
2810     $targetmkdir $targetdir/\`dirname \$f\`
2811     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2812     ;;
2813   esac
2814 done
2815 exit 0
2816 EOF
2817             ;;
2818         cp) cat >$to <<EOF
2819 #!/bin/sh
2820 for f in \$@
2821 do
2822   case "\$f" in
2823   /*)
2824     $mkdir -p $targetdir/\`dirname \$f\`
2825     $cp \$f $targetdir/\$f || exit 1
2826     ;;
2827   *)
2828     $targetmkdir $targetdir/\`dirname \$f\`
2829     $cp \$f $targetdir/\$f || exit 1
2830     ;;
2831   esac
2832 done
2833 exit 0
2834 EOF
2835             ;;
2836         *)  echo "Unknown targetto '$targetto'" >&4
2837             exit 1
2838             ;;
2839         esac
2840         case "$targetfrom" in
2841         scp|rcp)
2842           cat >$from <<EOF
2843 #!/bin/sh
2844 for f in \$@
2845 do
2846   $rm -f \$f
2847   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2848 done
2849 exit 0
2850 EOF
2851             ;;
2852         cp) cat >$from <<EOF
2853 #!/bin/sh
2854 for f in \$@
2855 do
2856   $rm -f \$f
2857   cp $targetdir/\$f . || exit 1
2858 done
2859 exit 0
2860 EOF
2861             ;;
2862         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2863             exit 1
2864             ;;
2865         esac
2866         if $test ! -f $run; then
2867             echo "Target 'run' script '$run' not found." >&4
2868         else
2869             $chmod a+rx $run
2870         fi
2871         if $test ! -f $to; then
2872             echo "Target 'to' script '$to' not found." >&4
2873         else
2874             $chmod a+rx $to
2875         fi
2876         if $test ! -f $from; then
2877             echo "Target 'from' script '$from' not found." >&4
2878         else
2879             $chmod a+rx $from
2880         fi
2881         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2882             exit 1
2883         fi
2884         cat >&4 <<EOF
2885 Using '$run' for remote execution,
2886 and '$from' and '$to'
2887 for remote file transfer.
2888 EOF
2889         ;;
2890 *)      run=''
2891         to=:
2892         from=:
2893         usecrosscompile='undef'
2894         targetarch=''
2895         ;;
2896 esac
2897
2898 : see whether [:lower:] and [:upper:] are supported character classes
2899 echo " "
2900 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2901 ABYZ)
2902         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2903         up='[:upper:]'
2904         low='[:lower:]'
2905         ;;
2906 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2907         # (0xd9 and 0xe2), therefore that is a nice testing point.
2908         if test "X$up" = X -o "X$low" = X; then
2909             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2910             rs) up='[A-Z]'
2911                 low='[a-z]'
2912                 ;;
2913             esac
2914         fi
2915         if test "X$up" = X -o "X$low" = X; then
2916             case "`echo RS | $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 | od -x 2>/dev/null`" in
2924             *D9E2*|*d9e2*)
2925                 echo "Hey, this might be EBCDIC." >&4
2926                 if test "X$up" = X -o "X$low" = X; then
2927                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2928                     rs) up='[A-IJ-RS-Z]'
2929                         low='[a-ij-rs-z]'
2930                         ;;
2931                     esac
2932                 fi
2933                 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                 ;;
2941             esac
2942         fi
2943 esac
2944 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2945 rs)
2946     echo "Using $up and $low to convert case." >&4
2947     ;;
2948 *)
2949     echo "I don't know how to translate letters from upper to lower case." >&4
2950     echo "Your tr is not acting any way I know of." >&4
2951     exit 1
2952     ;;
2953 esac
2954 : set up the translation script tr, must be called with ./tr of course
2955 cat >tr <<EOSC
2956 $startsh
2957 case "\$1\$2" in
2958 '[A-Z][a-z]') exec $tr '$up' '$low';;
2959 '[a-z][A-Z]') exec $tr '$low' '$up';;
2960 esac
2961 exec $tr "\$@"
2962 EOSC
2963 chmod +x tr
2964 $eunicefix tr
2965
2966 : Try to determine whether config.sh was made on this system
2967 case "$config_sh" in
2968 '')
2969 myuname=`$uname -a 2>/dev/null`
2970 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2971 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2972 # because the A-Z/a-z are not consecutive.
2973 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2974         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2975 newmyuname="$myuname"
2976 dflt=n
2977 case "$knowitall" in
2978 '')
2979         if test -f ../config.sh; then
2980                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2981                         eval "`grep myuname= ../config.sh`"
2982                 fi
2983                 if test "X$myuname" = "X$newmyuname"; then
2984                         dflt=y
2985                 fi
2986         fi
2987         ;;
2988 *) dflt=y;;
2989 esac
2990
2991 : Get old answers from old config file if Configure was run on the
2992 : same system, otherwise use the hints.
2993 hint=default
2994 cd ..
2995 if test -f config.sh; then
2996         echo " "
2997         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2998         . UU/myread
2999         case "$ans" in
3000         n*|N*) echo "OK, I'll ignore it."
3001                 mv config.sh config.sh.old
3002                 myuname="$newmyuname"
3003                 ;;
3004         *)  echo "Fetching default answers from your old config.sh file..." >&4
3005                 tmp_n="$n"
3006                 tmp_c="$c"
3007                 tmp_sh="$sh"
3008                 . ./config.sh
3009                 cp config.sh UU
3010                 n="$tmp_n"
3011                 c="$tmp_c"
3012                 : Older versions did not always set $sh.  Catch re-use of such
3013                 : an old config.sh.
3014                 case "$sh" in
3015                 '') sh="$tmp_sh" ;;
3016                 esac
3017                 hint=previous
3018                 ;;
3019         esac
3020 fi
3021 . ./UU/checkcc
3022 if test ! -f config.sh; then
3023         $cat <<EOM
3024
3025 First time through, eh?  I have some defaults handy for some systems
3026 that need some extra help getting the Configure answers right:
3027
3028 EOM
3029         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3030         dflt=''
3031         : Half the following guesses are probably wrong... If you have better
3032         : tests or hints, please send them to perlbug@perl.org
3033         : The metaconfig authors would also appreciate a copy...
3034         $test -f /irix && osname=irix
3035         $test -f /xenix && osname=sco_xenix
3036         $test -f /dynix && osname=dynix
3037         $test -f /dnix && osname=dnix
3038         $test -f /lynx.os && osname=lynxos
3039         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3040         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3041         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3042         $test -f /bin/mips && /bin/mips && osname=mips
3043         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3044                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3045         $test -d /usr/apollo/bin && osname=apollo
3046         $test -f /etc/saf/_sactab && osname=svr4
3047         $test -d /usr/include/minix && osname=minix
3048         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3049         if $test -d /MachTen -o -d /MachTen_Folder; then
3050                 osname=machten
3051                 if $test -x /sbin/version; then
3052                         osvers=`/sbin/version | $awk '{print $2}' |
3053                         $sed -e 's/[A-Za-z]$//'`
3054                 elif $test -x /usr/etc/version; then
3055                         osvers=`/usr/etc/version | $awk '{print $2}' |
3056                         $sed -e 's/[A-Za-z]$//'`
3057                 else
3058                         osvers="$2.$3"
3059                 fi
3060         fi
3061
3062         $test -f /sys/posix.dll &&
3063                 $test -f /usr/bin/what &&
3064                 set X `/usr/bin/what /sys/posix.dll` &&
3065                 $test "$3" = UWIN &&
3066                 osname=uwin &&
3067                 osvers="$5"
3068
3069         if $test -f $uname; then
3070                 set X $myuname
3071                 shift
3072
3073                 case "$5" in
3074                 fps*) osname=fps ;;
3075                 mips*)
3076                         case "$4" in
3077                         umips) osname=umips ;;
3078                         *) osname=mips ;;
3079                         esac;;
3080                 [23]100) osname=mips ;;
3081                 next*) osname=next ;;
3082                 i386*)
3083                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3084                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3085                                 osname='sco'
3086                                 osvers=$tmp
3087                         elif $test -f /etc/kconfig; then
3088                                 osname=isc
3089                                 if test "$lns" = "$ln -s"; then
3090                                         osvers=4
3091                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3092                                         osvers=3
3093                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3094                                         osvers=2
3095                                 fi
3096                         fi
3097                         tmp=''
3098                         ;;
3099                 pc*)
3100                         if test -n "$DJGPP"; then
3101                                 osname=dos
3102                                 osvers=djgpp
3103                         fi
3104                         ;;
3105                 esac
3106
3107                 case "$1" in
3108                 aix) osname=aix
3109                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3110                         case "$tmp" in
3111                         # oslevel can fail with:
3112                         # oslevel: Unable to acquire lock.
3113                         *not\ found) osvers="$4"."$3" ;;
3114                         '<3240'|'<>3240') osvers=3.2.0 ;;
3115                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3116                         '=3250'|'>3250') osvers=3.2.5 ;;
3117                         *) osvers=$tmp;;
3118                         esac
3119                         ;;
3120                 bsd386) osname=bsd386
3121                         osvers=`$uname -r`
3122                         ;;
3123                 cygwin*) osname=cygwin
3124                         osvers="$3"
3125                         ;;
3126                 *dc.osx) osname=dcosx
3127                         osvers="$3"
3128                         ;;
3129                 dnix) osname=dnix
3130                         osvers="$3"
3131                         ;;
3132                 domainos) osname=apollo
3133                         osvers="$3"
3134                         ;;
3135                 dgux)   osname=dgux
3136                         osvers="$3"
3137                         ;;
3138                 dragonfly) osname=dragonfly
3139                         osvers="$3"
3140                         ;;
3141                 dynixptx*) osname=dynixptx
3142                         osvers=`echo "$4"|sed 's/^v//'`
3143                         ;;
3144                 freebsd) osname=freebsd
3145                         osvers="$3" ;;
3146                 genix)  osname=genix ;;
3147                 gnu)    osname=gnu
3148                         osvers="$3" ;;
3149                 hp*)    osname=hpux
3150                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3151                         ;;
3152                 irix*)  osname=irix
3153                         case "$3" in
3154                         4*) osvers=4 ;;
3155                         5*) osvers=5 ;;
3156                         *)      osvers="$3" ;;
3157                         esac
3158                         ;;
3159                 linux)  osname=linux
3160                         case "$3" in
3161                         *)      osvers="$3" ;;
3162                         esac
3163                         ;;
3164                 MiNT)   osname=mint
3165                         ;;
3166                 netbsd*) osname=netbsd
3167                         osvers="$3"
3168                         ;;
3169                 news-os) osvers="$3"
3170                         case "$3" in
3171                         4*) osname=newsos4 ;;
3172                         *) osname=newsos ;;
3173                         esac
3174                         ;;
3175                 next*) osname=next ;;
3176                 nonstop-ux) osname=nonstopux ;;
3177                 openbsd) osname=openbsd
3178                         osvers="$3"
3179                         ;;
3180                 os2)    osname=os2
3181                         osvers="$4"
3182                         ;;
3183                 POSIX-BC | posix-bc ) osname=posix-bc
3184                         osvers="$3"
3185                         ;;
3186                 powerux | power_ux | powermax_os | powermaxos | \
3187                 powerunix | power_unix) osname=powerux
3188                         osvers="$3"
3189                         ;;
3190                 qnx) osname=qnx
3191                         osvers="$4"
3192                         ;;
3193                 solaris) osname=solaris
3194                         case "$3" in
3195                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3196                         *)      osvers="$3" ;;
3197                         esac
3198                         ;;
3199                 sunos) osname=sunos
3200                         case "$3" in
3201                         5*) osname=solaris
3202                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3203                         *)      osvers="$3" ;;
3204                         esac
3205                         ;;
3206                 titanos) osname=titanos
3207                         case "$3" in
3208                         1*) osvers=1 ;;
3209                         2*) osvers=2 ;;
3210                         3*) osvers=3 ;;
3211                         4*) osvers=4 ;;
3212                         *)      osvers="$3" ;;
3213                         esac
3214                         ;;
3215                 ultrix) osname=ultrix
3216                         osvers="$3"
3217                         ;;
3218                 osf1|mls+)      case "$5" in
3219                                 alpha)
3220                                         osname=dec_osf
3221                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3222                                         case "$osvers" in
3223                                         [1-9].[0-9]*) ;;
3224                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3225                                         esac
3226                                         ;;
3227                         hp*)    osname=hp_osf1  ;;
3228                         mips)   osname=mips_osf1 ;;
3229                         esac
3230                         ;;
3231                 # UnixWare 7.1.2 is known as Open UNIX 8
3232                 openunix|unixware) osname=svr5
3233                         osvers="$4"
3234                         ;;
3235                 uts)    osname=uts
3236                         osvers="$3"
3237                         ;;
3238                 vos) osvers="$3"
3239                         ;;
3240                 $2) case "$osname" in
3241                         *isc*) ;;
3242                         *freebsd*) ;;
3243                         svr*)
3244                                 : svr4.x or possibly later
3245                                 case "svr$3" in
3246                                 ${osname}*)
3247                                         osname=svr$3
3248                                         osvers=$4
3249                                         ;;
3250                                 esac
3251                                 case "$osname" in
3252                                 svr4.0)
3253                                         : Check for ESIX
3254                                         if test -f /stand/boot ; then
3255                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3256                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3257                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3258                                                         if test -n "$isesix"; then
3259                                                                 osname=esix4
3260                                                         fi
3261                                                 fi
3262                                         fi
3263                                         ;;
3264                                 esac
3265                                 ;;
3266                         *)      if test -f /etc/systemid; then
3267                                         osname=sco
3268                                         set `echo $3 | $sed 's/\./ /g'` $4
3269                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3270                                                 osvers=$1.$2.$3
3271                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3272                                                 osvers=$1.$2
3273                                         elif $test -f $src/hints/sco_$1.sh; then
3274                                                 osvers=$1
3275                                         fi
3276                                 else
3277                                         case "$osname" in
3278                                         '') : Still unknown.  Probably a generic Sys V.
3279                                                 osname="sysv"
3280                                                 osvers="$3"
3281                                                 ;;
3282                                         esac
3283                                 fi
3284                                 ;;
3285                         esac
3286                         ;;
3287                 *)      case "$osname" in
3288                         '') : Still unknown.  Probably a generic BSD.
3289                                 osname="$1"
3290                                 osvers="$3"
3291                                 ;;
3292                         esac
3293                         ;;
3294                 esac
3295         else
3296                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3297                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3298                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3299                                 osname=news_os
3300                         fi
3301                         $rm -f UU/kernel.what
3302                 elif test -d c:/. -o -n "$is_os2" ; then
3303                         set X $myuname
3304                         osname=os2
3305                         osvers="$5"
3306                 fi
3307         fi
3308
3309         case "$targetarch" in
3310         '') ;;
3311         *)  hostarch=$osname
3312             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3313             osvers=''
3314             ;;
3315         esac
3316
3317         : Now look for a hint file osname_osvers, unless one has been
3318         : specified already.
3319         case "$hintfile" in
3320         ''|' ')
3321                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3322                 : Also try without trailing minor version numbers.
3323                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3324                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3325                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3326                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3327                 case "$file" in
3328                 '') dflt=none ;;
3329                 *)  case "$osvers" in
3330                         '') dflt=$file
3331                                 ;;
3332                         *)  if $test -f $src/hints/$file.sh ; then
3333                                         dflt=$file
3334                                 elif $test -f $src/hints/$xfile.sh ; then
3335                                         dflt=$xfile
3336                                 elif $test -f $src/hints/$xxfile.sh ; then
3337                                         dflt=$xxfile
3338                                 elif $test -f $src/hints/$xxxfile.sh ; then
3339                                         dflt=$xxxfile
3340                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3341                                         dflt=$xxxxfile
3342                                 elif $test -f "$src/hints/${osname}.sh" ; then
3343                                         dflt="${osname}"
3344                                 else
3345                                         dflt=none
3346                                 fi
3347                                 ;;
3348                         esac
3349                         ;;
3350                 esac
3351                 if $test -f Policy.sh ; then
3352                         case "$dflt" in
3353                         *Policy*) ;;
3354                         none) dflt="Policy" ;;
3355                         *) dflt="Policy $dflt" ;;
3356                         esac
3357                 fi
3358                 ;;
3359         *)
3360                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3361                 ;;
3362         esac
3363
3364         if $test -f Policy.sh ; then
3365                 $cat <<EOM
3366
3367 There's also a Policy hint file available, which should make the
3368 site-specific (policy) questions easier to answer.
3369 EOM
3370
3371         fi
3372
3373         $cat <<EOM
3374
3375 You may give one or more space-separated answers, or "none" if appropriate.
3376 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3377 is a good thing.  DO NOT give a wrong version or a wrong OS.
3378
3379 EOM
3380
3381         rp="Which of these apply, if any?"
3382         . UU/myread
3383         tans=$ans
3384         for file in $tans; do
3385                 if $test X$file = XPolicy -a -f Policy.sh; then
3386                         . Policy.sh
3387                         $cat Policy.sh >> UU/config.sh
3388                 elif $test -f $src/hints/$file.sh; then
3389                         . $src/hints/$file.sh
3390                         $cat $src/hints/$file.sh >> UU/config.sh
3391                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3392                         : nothing
3393                 else
3394                         : Give one chance to correct a possible typo.
3395                         echo "$file.sh does not exist"
3396                         dflt=$file
3397                         rp="hint to use instead?"
3398                         . UU/myread
3399                         for file in $ans; do
3400                                 if $test -f "$src/hints/$file.sh"; then
3401                                         . $src/hints/$file.sh
3402                                         $cat $src/hints/$file.sh >> UU/config.sh
3403                                 elif $test X$ans = X -o X$ans = Xnone ; then
3404                                         : nothing
3405                                 else
3406                                         echo "$file.sh does not exist -- ignored."
3407                                 fi
3408                         done
3409                 fi
3410         done
3411
3412         hint=recommended
3413         : Remember our hint file for later.
3414         if $test -f "$src/hints/$file.sh" ; then
3415                 hintfile="$file"
3416         else
3417                 hintfile=''
3418         fi
3419 fi
3420 cd UU
3421 ;;
3422 *)
3423         echo " "
3424         echo "Fetching default answers from $config_sh..." >&4
3425         tmp_n="$n"
3426         tmp_c="$c"
3427         cd ..
3428         cp $config_sh config.sh 2>/dev/null
3429         chmod +w config.sh
3430         . ./config.sh
3431         cd UU
3432         cp ../config.sh .
3433         n="$tmp_n"
3434         c="$tmp_c"
3435         hint=previous
3436         ;;
3437 esac
3438 test "$override" && . ./optdef.sh
3439
3440 : Restore computed paths
3441 for file in $loclist $trylist; do
3442         eval $file="\$_$file"
3443 done
3444
3445 cat << EOM
3446
3447 Configure uses the operating system name and version to set some defaults.
3448 The default value is probably right if the name rings a bell. Otherwise,
3449 since spelling matters for me, either accept the default or answer "none"
3450 to leave it blank.
3451
3452 EOM
3453 case "$osname" in
3454         ''|' ')
3455                 case "$hintfile" in
3456                 ''|' '|none) dflt=none ;;
3457                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3458                 esac
3459                 ;;
3460         *) dflt="$osname" ;;
3461 esac
3462 rp="Operating system name?"
3463 . ./myread
3464 case "$ans" in
3465 none)  osname='' ;;
3466 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3467 esac
3468 echo " "
3469 case "$osvers" in
3470         ''|' ')
3471                 case "$hintfile" in
3472                 ''|' '|none) dflt=none ;;
3473                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3474                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3475                         case "$dflt" in
3476                         ''|' ') dflt=none ;;
3477                         esac
3478                         ;;
3479                 esac
3480                 ;;
3481         *) dflt="$osvers" ;;
3482 esac
3483 rp="Operating system version?"
3484 . ./myread
3485 case "$ans" in
3486 none)  osvers='' ;;
3487 *) osvers="$ans" ;;
3488 esac
3489
3490
3491 . ./posthint.sh
3492
3493 : who configured the system
3494 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3495 case "$cf_by" in
3496 "")
3497         cf_by=`(logname) 2>/dev/null`
3498         case "$cf_by" in
3499         "")
3500                 cf_by=`(whoami) 2>/dev/null`
3501                 case "$cf_by" in
3502                 "") cf_by=unknown ;;
3503                 esac ;;
3504         esac ;;
3505 esac
3506
3507 : set up the script used to warn in case of inconsistency
3508 cat <<EOS >whoa
3509 $startsh
3510 EOS
3511 cat <<'EOSC' >>whoa
3512 dflt=y
3513 echo " "
3514 echo "*** WHOA THERE!!! ***" >&4
3515 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3516 rp="    Keep the $hint value?"
3517 . ./myread
3518 case "$ans" in
3519 y) td=$was; tu=$was;;
3520 esac
3521 EOSC
3522
3523 : function used to set $1 to $val
3524 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3525 case "$val$was" in
3526 $define$undef) . ./whoa; eval "$var=\$td";;
3527 $undef$define) . ./whoa; eval "$var=\$tu";;
3528 *) eval "$var=$val";;
3529 esac'
3530
3531 case "$usesocks" in
3532 $define|true|[yY]*)     dflt='y';;
3533 *) dflt='n';;
3534 esac
3535 cat <<EOM
3536
3537 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3538 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3539 to use the PerlIO abstraction layer, this will be implicitly selected.
3540
3541 If this doesn't make any sense to you, just accept the default '$dflt'.
3542 EOM
3543 rp='Build Perl for SOCKS?'
3544 . ./myread
3545 case "$ans" in
3546 y|Y)    val="$define" ;;     
3547 *)      val="$undef" ;;
3548 esac
3549 set usesocks
3550 eval $setvar
3551
3552 case "$usesocks" in
3553 $define|true|[yY]*) useperlio="$define";;
3554 esac
3555
3556 case "$useperlio" in
3557 $define|true|[yY]*|'')  dflt='y';;
3558 *) dflt='n';;
3559 esac
3560 cat <<EOM
3561
3562 Previous version of $package used the standard IO mechanisms as
3563 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3564 alternate IO mechanisms via the PerlIO abstraction layer, but the
3565 stdio mechanism is still available if needed.  The abstraction layer
3566 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3567 Using PerlIO with sfio may cause problems with some extension modules.
3568
3569 If this doesn't make any sense to you, just accept the default '$dflt'.
3570 EOM
3571 rp='Use the PerlIO abstraction layer?'
3572 . ./myread
3573 case "$ans" in
3574 y|Y) 
3575         val="$define"
3576         ;;
3577 *)      
3578         echo "Ok, doing things the stdio way."
3579         val="$undef"
3580         ;;
3581 esac
3582 set useperlio
3583 eval $setvar 
3584
3585 case "$usesocks" in
3586 $define|true|[yY]*)
3587         case "$useperlio" in
3588         $define|true|[yY]*) ;;
3589         *)      cat >&4 <<EOM
3590
3591 You are using the SOCKS proxy protocol library which means that you
3592 should also use the PerlIO layer.  You may be headed for trouble.
3593
3594 EOM
3595                 ;;
3596         esac
3597         ;;
3598 esac
3599
3600         
3601 case "$usethreads" in
3602 $define|true|[yY]*)     dflt='y';;
3603 *)     # Catch case where user specified ithreads or 5005threads but
3604        # forgot -Dusethreads (A.D. 4/2002)
3605        case "$useithreads$use5005threads" in
3606        *$define*)      
3607                 case "$useperlio" in
3608                 "$define")      dflt='y' ;;
3609                 *)              dflt='n' ;;
3610                 esac
3611                 ;;
3612        *)       dflt='n';;
3613        esac
3614        ;;
3615 esac
3616 cat <<EOM
3617
3618 Perl can be built to take advantage of threads on some systems.
3619 To do so, Configure can be run with -Dusethreads.
3620
3621 Note that Perl built with threading support runs slightly slower
3622 and uses more memory than plain Perl. The current implementation
3623 is believed to be stable, but it is fairly new, and so should be
3624 treated with caution.
3625
3626 If this doesn't make any sense to you, just accept the default '$dflt'.
3627 EOM
3628 rp='Build a threading Perl?'
3629 . ./myread
3630 case "$ans" in
3631 y|Y)    val="$define" ;;
3632 *)      val="$undef" ;;
3633 esac
3634 set usethreads
3635 eval $setvar
3636
3637 case "$usethreads" in
3638 $define)
3639         $cat <<EOM
3640
3641 Since release 5.6, Perl has had two different threading implementations,
3642 the newer interpreter-based version (ithreads) with one interpreter per
3643 thread, and the older 5.005 version (5005threads).
3644 The 5005threads version is effectively unmaintained and will probably be
3645 removed in Perl 5.10, so there should be no need to build a Perl using it
3646 unless needed for backwards compatibility with some existing 5.005threads
3647 code.
3648
3649 EOM
3650         : Default to ithreads unless overridden on command line or with
3651         : old config.sh
3652         dflt='y'
3653         case "$use5005threads" in
3654                 $define|true|[yY]*) dflt='n';;
3655         esac
3656         case "$useithreads" in
3657                 $undef|false|[nN]*) dflt='n';;
3658         esac
3659         rp='Use the newer interpreter-based ithreads?'
3660         . ./myread
3661         case "$ans" in
3662         y|Y)    val="$define" ;;
3663         *)      val="$undef" ;;
3664         esac
3665         set useithreads
3666         eval $setvar
3667         : Now set use5005threads to the opposite value.
3668         case "$useithreads" in
3669         $define) val="$undef" ;;
3670         *) val="$define" ;;
3671         esac
3672         set use5005threads
3673         eval $setvar
3674         ;;
3675 *)
3676         useithreads="$undef"
3677         use5005threads="$undef"
3678         ;;
3679 esac
3680
3681 case "$useithreads$use5005threads" in
3682 "$define$define")
3683         $cat >&4 <<EOM
3684
3685 You cannot have both the ithreads and the 5.005 threads enabled
3686 at the same time.  Disabling the 5.005 threads since they are
3687 much less stable than the ithreads.
3688
3689 EOM
3690         use5005threads="$undef"
3691         ;;
3692 esac
3693
3694 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3695         cat >&4 <<EOF
3696 ***
3697 *** To build with ithreads you must also use the PerlIO layer.
3698 *** Cannot continue, aborting.
3699 ***
3700 EOF
3701         exit 1
3702 fi
3703
3704 case "$d_oldpthreads" in
3705 '')     : Configure tests would be welcome here.  For now, assume undef.
3706         val="$undef" ;;
3707 *)      val="$d_oldpthreads" ;;
3708 esac
3709 set d_oldpthreads
3710 eval $setvar
3711
3712
3713 : Look for a hint-file generated 'call-back-unit'.  If the
3714 : user has specified that a threading perl is to be built,
3715 : we may need to set or change some other defaults.
3716 if $test -f usethreads.cbu; then
3717     echo "Your platform has some specific hints regarding threaded builds, using them..."
3718     . ./usethreads.cbu
3719 else
3720     case "$usethreads" in
3721         "$define"|true|[yY]*)
3722                 $cat <<EOM
3723 (Your platform does not have any specific hints for threaded builds.
3724  Assuming POSIX threads, then.)
3725 EOM
3726         ;;
3727     esac
3728 fi
3729
3730 cat <<EOM
3731
3732 Perl can be built so that multiple Perl interpreters can coexist
3733 within the same Perl executable.
3734 EOM
3735
3736 case "$useithreads" in
3737 $define)
3738         cat <<EOM
3739 This multiple interpreter support is required for interpreter-based threads.
3740 EOM
3741         val="$define"
3742         ;;
3743 *)      case "$usemultiplicity" in
3744         $define|true|[yY]*)     dflt='y';;
3745         *) dflt='n';;
3746         esac
3747         echo " "
3748         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3749         rp='Build Perl for multiplicity?'
3750         . ./myread
3751         case "$ans" in
3752         y|Y)    val="$define" ;;
3753         *)      val="$undef" ;;
3754         esac
3755         ;;
3756 esac
3757 set usemultiplicity
3758 eval $setvar
3759
3760
3761 case "$usemorebits" in
3762 "$define"|true|[yY]*)
3763         use64bitint="$define"
3764         uselongdouble="$define"
3765         usemorebits="$define"
3766         ;;
3767 *)      usemorebits="$undef"
3768         ;;
3769 esac
3770
3771 : make some quick guesses about what we are up against
3772 echo " "
3773 $echo $n "Hmm...  $c"
3774 echo exit 1 >bsd
3775 echo exit 1 >usg
3776 echo exit 1 >v7
3777 echo exit 1 >osf1
3778 echo exit 1 >eunice
3779 echo exit 1 >xenix
3780 echo exit 1 >venix
3781 echo exit 1 >os2
3782 d_bsd="$undef"
3783 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3784 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3785 then
3786         echo "Looks kind of like an OSF/1 system, but we'll see..."
3787         echo exit 0 >osf1
3788 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3789         xxx=`./loc addbib blurfl $pth`
3790         if $test -f $xxx; then
3791         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3792                 echo exit 0 >bsd
3793                 echo exit 0 >usg
3794         else
3795                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3796                         echo "Looks kind of like an extended USG system, but we'll see..."
3797                 else
3798                         echo "Looks kind of like a USG system, but we'll see..."
3799                 fi
3800                 echo exit 0 >usg
3801         fi
3802 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3803         echo "Looks kind of like a BSD system, but we'll see..."
3804         d_bsd="$define"
3805         echo exit 0 >bsd
3806 else
3807         echo "Looks kind of like a Version 7 system, but we'll see..."
3808         echo exit 0 >v7
3809 fi
3810 case "$eunicefix" in
3811 *unixtovms*)
3812         $cat <<'EOI'
3813 There is, however, a strange, musty smell in the air that reminds me of
3814 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3815 EOI
3816         echo exit 0 >eunice
3817         d_eunice="$define"
3818 : it so happens the Eunice I know will not run shell scripts in Unix format
3819         ;;
3820 *)
3821         echo " "
3822         echo "Congratulations.  You aren't running Eunice."
3823         d_eunice="$undef"
3824         ;;
3825 esac
3826 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3827 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3828 : semicolon as a patch separator
3829 case "$p_" in
3830 :) ;;
3831 *)
3832         $cat <<'EOI'
3833 I have the feeling something is not exactly right, however...don't tell me...
3834 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3835 (Or you may be running DOS with DJGPP.)
3836 EOI
3837         echo exit 0 >os2
3838         ;;
3839 esac
3840 if test -f /xenix; then
3841         echo "Actually, this looks more like a XENIX system..."
3842         echo exit 0 >xenix
3843         d_xenix="$define"
3844 else
3845         echo " "
3846         echo "It's not Xenix..."
3847         d_xenix="$undef"
3848 fi
3849 chmod +x xenix
3850 $eunicefix xenix
3851 if test -f /venix; then
3852         echo "Actually, this looks more like a VENIX system..."
3853         echo exit 0 >venix
3854 else
3855         echo " "
3856         if ./xenix; then
3857                 : null
3858         else
3859                 echo "Nor is it Venix..."
3860         fi
3861 fi
3862 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3863 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3864 $rm -f foo
3865
3866 case "$cc" in
3867 '') dflt=cc;;
3868 *) dflt="$cc";;
3869 esac
3870 rp="Use which C compiler?"
3871 . ./myread
3872 cc="$ans"
3873
3874 : See if they have not cc but they do have gcc
3875 . ./trygcc
3876 : Look for a hint-file generated 'call-back-unit'.  Now that the
3877 : user has specified the compiler, we may need to set or change some
3878 : other defaults.
3879 if $test -f cc.cbu; then
3880     . ./cc.cbu
3881 fi
3882 . ./checkcc
3883
3884 echo " "
3885 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3886 $cat >try.c <<EOM
3887 #include <stdio.h>
3888 int main() {
3889 #ifdef __GNUC__
3890 #ifdef __VERSION__
3891         printf("%s\n", __VERSION__);
3892 #else
3893         printf("%s\n", "1");
3894 #endif
3895 #endif
3896         return(0);
3897 }
3898 EOM
3899 if $cc -o try $ccflags $ldflags try.c; then
3900         gccversion=`$run ./try`
3901         case "$gccversion" in
3902         '') echo "You are not using GNU cc." ;;
3903         *)  echo "You are using GNU cc $gccversion."
3904             ccname=gcc
3905             ;;
3906         esac
3907 else
3908         echo " "
3909         echo "*** WHOA THERE!!! ***" >&4
3910         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3911         case "$knowitall" in
3912         '')
3913         echo "    You'd better start hunting for one and let me know about it." >&4
3914                 exit 1
3915                 ;;
3916         esac
3917 fi
3918 $rm -f try try.*
3919 case "$gccversion" in
3920 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3921 esac
3922 case "$gccversion" in
3923 '') gccosandvers='' ;;
3924 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3925    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3926    gccshortvers=''
3927    case "$gccosandvers" in
3928    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3929    $osname$osvers) ;; # looking good
3930    $osname*) cat <<EOM >&4
3931
3932 *** WHOA THERE!!! ***
3933
3934     Your gcc has not been compiled for the exact release of
3935     your operating system ($gccosandvers versus $osname$osvers).
3936
3937     In general it is a good idea to keep gcc synchronized with
3938     the operating system because otherwise serious problems
3939     may ensue when trying to compile software, like Perl.
3940
3941     I'm trying to be optimistic here, though, and will continue.
3942     If later during the configuration and build icky compilation
3943     problems appear (headerfile conflicts being the most common
3944     manifestation), I suggest reinstalling the gcc to match
3945     your operating system release.
3946
3947 EOM
3948       ;;
3949    *) gccosandvers='' ;; # failed to parse, better be silent
3950    esac
3951    ;;
3952 esac
3953 case "$ccname" in
3954 '') ccname="$cc" ;;
3955 esac
3956
3957 # gcc 3.* complain about adding -Idirectories that they already know about,
3958 # so we will take those off from locincpth.
3959 case "$gccversion" in
3960 3*)
3961     echo "main(){}">try.c
3962     for incdir in $locincpth; do
3963        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3964              grep '^c[cp]p*[01]: warning: changing search order '`
3965        if test "X$warn" != X; then
3966            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3967        fi
3968     done
3969     $rm -f try try.*
3970 esac
3971
3972 : decide how portable to be.  Allow command line overrides.
3973 case "$d_portable" in
3974 "$undef") ;;
3975 *)      d_portable="$define" ;;
3976 esac
3977
3978 : set up shell script to do ~ expansion
3979 cat >filexp <<EOSS
3980 $startsh
3981 : expand filename
3982 case "\$1" in
3983  ~/*|~)
3984         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3985         ;;
3986  ~*)
3987         if $test -f /bin/csh; then
3988                 /bin/csh -f -c "glob \$1"
3989                 failed=\$?
3990                 echo ""
3991                 exit \$failed
3992         else
3993                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3994                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3995                 if $test ! -d "\$dir"; then
3996                         me=\`basename \$0\`
3997                         echo "\$me: can't locate home directory for: \$name" >&2
3998                         exit 1
3999                 fi
4000                 case "\$1" in
4001                 */*)
4002                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4003                         ;;
4004                 *)
4005                         echo \$dir
4006                         ;;
4007                 esac
4008         fi
4009         ;;
4010 *)
4011         echo \$1
4012         ;;
4013 esac
4014 EOSS
4015 chmod +x filexp
4016 $eunicefix filexp
4017
4018 : now set up to get a file name
4019 cat <<EOS >getfile
4020 $startsh
4021 EOS
4022 cat <<'EOSC' >>getfile
4023 tilde=''
4024 fullpath=''
4025 already=''
4026 skip=''
4027 none_ok=''
4028 exp_file=''
4029 nopath_ok=''
4030 orig_rp="$rp"
4031 orig_dflt="$dflt"
4032 case "$gfpth" in
4033 '') gfpth='.' ;;
4034 esac
4035
4036 case "$fn" in
4037 *\(*)
4038         : getfile will accept an answer from the comma-separated list
4039         : enclosed in parentheses even if it does not meet other criteria.
4040         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4041         fn=`echo $fn | sed 's/(.*)//'`
4042         ;;
4043 esac
4044
4045 case "$fn" in
4046 *:*)
4047         loc_file=`expr $fn : '.*:\(.*\)'`
4048         fn=`expr $fn : '\(.*\):.*'`
4049         ;;
4050 esac
4051
4052 case "$fn" in
4053 *~*) tilde=true;;
4054 esac
4055 case "$fn" in
4056 */*) fullpath=true;;
4057 esac
4058 case "$fn" in
4059 *+*) skip=true;;
4060 esac
4061 case "$fn" in
4062 *n*) none_ok=true;;
4063 esac
4064 case "$fn" in
4065 *e*) exp_file=true;;
4066 esac
4067 case "$fn" in
4068 *p*) nopath_ok=true;;
4069 esac
4070
4071 case "$fn" in
4072 *f*) type='File';;
4073 *d*) type='Directory';;
4074 *l*) type='Locate';;
4075 esac
4076
4077 what="$type"
4078 case "$what" in
4079 Locate) what='File';;
4080 esac
4081
4082 case "$exp_file" in
4083 '')
4084         case "$d_portable" in
4085         "$define") ;;
4086         *) exp_file=true;;
4087         esac
4088         ;;
4089 esac
4090
4091 cd ..
4092 while test "$type"; do
4093         redo=''
4094         rp="$orig_rp"
4095         dflt="$orig_dflt"
4096         case "$tilde" in
4097         true) rp="$rp (~name ok)";;
4098         esac
4099         . UU/myread
4100         if test -f UU/getfile.ok && \
4101                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4102         then
4103                 value="$ans"
4104                 ansexp="$ans"
4105                 break
4106         fi
4107         case "$ans" in
4108         none)
4109                 value=''
4110                 ansexp=''
4111                 case "$none_ok" in
4112                 true) type='';;
4113                 esac
4114                 ;;
4115         *)
4116                 case "$tilde" in
4117                 '') value="$ans"
4118                         ansexp="$ans";;
4119                 *)
4120                         value=`UU/filexp $ans`
4121                         case $? in
4122                         0)
4123                                 if test "$ans" != "$value"; then
4124                                         echo "(That expands to $value on this system.)"
4125                                 fi
4126                                 ;;
4127                         *) value="$ans";;
4128                         esac
4129                         ansexp="$value"
4130                         case "$exp_file" in
4131                         '') value="$ans";;
4132                         esac
4133                         ;;
4134                 esac
4135                 case "$fullpath" in
4136                 true)
4137                         case "$ansexp" in
4138                         /*) value="$ansexp" ;;
4139                         [a-zA-Z]:/*) value="$ansexp" ;;
4140                         *)
4141                                 redo=true
4142                                 case "$already" in
4143                                 true)
4144                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4145                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4146                                         ;;
4147                                 *)
4148                                 echo "Please give a full path name, starting with slash." >&4
4149                                         case "$tilde" in
4150                                         true)
4151                                 echo "Note that using ~name is ok provided it expands well." >&4
4152                                                 already=true
4153                                                 ;;
4154                                         esac
4155                                 esac
4156                                 ;;
4157                         esac
4158                         ;;
4159                 esac
4160                 case "$redo" in
4161                 '')
4162                         case "$type" in
4163                         File)
4164                                 for fp in $gfpth; do
4165                                         if test "X$fp" = X.; then
4166                                             pf="$ansexp"
4167                                         else    
4168                                             pf="$fp/$ansexp"
4169                                         fi
4170                                         if test -f "$pf"; then
4171                                                 type=''
4172                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4173                                         then
4174                                                 echo "($value is not a plain file, but that's ok.)"
4175                                                 type=''
4176                                         fi
4177                                         if test X"$type" = X; then
4178                                             value="$pf"
4179                                             break
4180                                         fi
4181                                 done
4182                                 ;;
4183                         Directory)
4184                                 for fp in $gfpth; do
4185                                         if test "X$fp" = X.; then
4186                                             dir="$ans"
4187                                             direxp="$ansexp"
4188                                         else    
4189                                             dir="$fp/$ansexp"
4190                                             direxp="$fp/$ansexp"
4191                                         fi
4192                                         if test -d "$direxp"; then
4193                                                 type=''
4194                                                 value="$dir"
4195                                                 break
4196                                         fi
4197                                 done
4198                                 ;;
4199                         Locate)
4200                                 if test -d "$ansexp"; then
4201                                         echo "(Looking for $loc_file in directory $value.)"
4202                                         value="$value/$loc_file"
4203                                         ansexp="$ansexp/$loc_file"
4204                                 fi
4205                                 if test -f "$ansexp"; then
4206                                         type=''
4207                                 fi
4208                                 case "$nopath_ok" in
4209                                 true)   case "$value" in
4210                                         */*) ;;
4211                                         *)      echo "Assuming $value will be in people's path."
4212                                                 type=''
4213                                                 ;;
4214                                         esac
4215                                         ;;
4216                                 esac
4217                                 ;;
4218                         esac
4219
4220                         case "$skip" in
4221                         true) type='';
4222                         esac
4223
4224                         case "$type" in
4225                         '') ;;
4226                         *)
4227                                 if test "$fastread" = yes; then
4228                                         dflt=y
4229                                 else
4230                                         dflt=n
4231                                 fi
4232                                 rp="$what $value doesn't exist.  Use that name anyway?"
4233                                 . UU/myread
4234                                 dflt=''
4235                                 case "$ans" in
4236                                 y*) type='';;
4237                                 *) echo " ";;
4238                                 esac
4239                                 ;;
4240                         esac
4241                         ;;
4242                 esac
4243                 ;;
4244         esac
4245 done
4246 cd UU
4247 ans="$value"
4248 rp="$orig_rp"
4249 dflt="$orig_dflt"
4250 rm -f getfile.ok
4251 test "X$gfpthkeep" != Xy && gfpth=""
4252 EOSC
4253
4254 : What should the include directory be ?
4255 echo " "
4256 $echo $n "Hmm...  $c"
4257 dflt='/usr/include'
4258 incpath=''
4259 mips_type=''
4260 if $test -f /bin/mips && /bin/mips; then
4261         echo "Looks like a MIPS system..."
4262         $cat >usr.c <<'EOCP'
4263 #ifdef SYSTYPE_BSD43
4264 /bsd43
4265 #endif
4266 EOCP
4267         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4268                 dflt='/bsd43/usr/include'
4269                 incpath='/bsd43'
4270                 mips_type='BSD 4.3'
4271         else
4272                 mips_type='System V'
4273         fi
4274         $rm -f usr.c usr.out
4275         echo "and you're compiling with the $mips_type compiler and libraries."
4276         xxx_prompt=y
4277         echo "exit 0" >mips
4278 else
4279         echo "Doesn't look like a MIPS system."
4280         xxx_prompt=n
4281         echo "exit 1" >mips
4282 fi
4283 chmod +x mips
4284 $eunicefix mips
4285 case "$usrinc" in
4286 '') ;;
4287 *) dflt="$usrinc";;
4288 esac
4289 case "$xxx_prompt" in
4290 y)      fn=d/
4291         echo " "
4292         rp='Where are the include files you want to use?'
4293         . ./getfile
4294         usrinc="$ans"
4295         ;;
4296 *)      usrinc="$dflt"
4297         ;;
4298 esac
4299
4300 : see how we invoke the C preprocessor
4301 echo " "
4302 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4303 cat <<'EOT' >testcpp.c
4304 #define ABC abc
4305 #define XYZ xyz
4306 ABC.XYZ
4307 EOT
4308 cd ..
4309 if test ! -f cppstdin; then
4310         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4311                 # AIX cc -E doesn't show the absolute headerfile
4312                 # locations but we'll cheat by using the -M flag.
4313                 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
4314         else
4315                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4316         fi
4317 else
4318         echo "Keeping your $hint cppstdin wrapper."
4319 fi
4320 chmod 755 cppstdin
4321 wrapper=`pwd`/cppstdin
4322 ok='false'
4323 cd UU
4324
4325 if $test "X$cppstdin" != "X" && \
4326         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4327         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4328 then
4329         echo "You used to use $cppstdin $cppminus so we'll use that again."
4330         case "$cpprun" in
4331         '') echo "But let's see if we can live without a wrapper..." ;;
4332         *)
4333                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4334                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4335                 then
4336                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4337                         ok='true'
4338                 else
4339                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4340                 fi
4341                 ;;
4342         esac
4343 else
4344         case "$cppstdin" in
4345         '') ;;
4346         *)
4347                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4348                 ;;
4349         esac
4350 fi
4351
4352 if $ok; then
4353         : nothing
4354 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4355         $cc -E <testcpp.c >testcpp.out 2>&1; \
4356         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4357         echo "Yup, it does."
4358         x_cpp="$cc -E"
4359         x_minus='';
4360 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4361         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4362         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4363         echo "Yup, it does."
4364         x_cpp="$cc -E"
4365         x_minus='-';
4366 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4367         $cc -P <testcpp.c >testcpp.out 2>&1; \
4368         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4369         echo "Yipee, that works!"
4370         x_cpp="$cc -P"
4371         x_minus='';
4372 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4373         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4374         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4375         echo "At long last!"
4376         x_cpp="$cc -P"
4377         x_minus='-';
4378 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4379         $cpp <testcpp.c >testcpp.out 2>&1; \
4380         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4381         echo "It works!"
4382         x_cpp="$cpp"
4383         x_minus='';
4384 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4385         $cpp - <testcpp.c >testcpp.out 2>&1; \
4386         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4387         echo "Hooray, it works!  I was beginning to wonder."
4388         x_cpp="$cpp"
4389         x_minus='-';
4390 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4391         $wrapper <testcpp.c >testcpp.out 2>&1; \
4392         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4393         x_cpp="$wrapper"
4394         x_minus=''
4395         echo "Eureka!"
4396 else
4397         dflt=''
4398         rp="No dice.  I can't find a C preprocessor.  Name one:"
4399         . ./myread
4400         x_cpp="$ans"
4401         x_minus=''
4402         $x_cpp <testcpp.c >testcpp.out 2>&1
4403         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4404                 echo "OK, that will do." >&4
4405         else
4406 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4407                 exit 1
4408         fi
4409 fi
4410
4411 case "$ok" in
4412 false)
4413         cppstdin="$x_cpp"
4414         cppminus="$x_minus"
4415         cpprun="$x_cpp"
4416         cpplast="$x_minus"
4417         set X $x_cpp
4418         shift
4419         case "$1" in
4420         "$cpp")
4421                 echo "Perhaps can we force $cc -E using a wrapper..."
4422                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4423                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4424                 then
4425                         echo "Yup, we can."
4426                         cppstdin="$wrapper"
4427                         cppminus='';
4428                 else
4429                         echo "Nope, we'll have to live without it..."
4430                 fi
4431                 ;;
4432         esac
4433         case "$cpprun" in
4434         "$wrapper")
4435                 cpprun=''
4436                 cpplast=''
4437                 ;;
4438         esac
4439         ;;
4440 esac
4441
4442 case "$cppstdin" in
4443 "$wrapper"|'cppstdin') ;;
4444 *) $rm -f $wrapper;;
4445 esac
4446 $rm -f testcpp.c testcpp.out
4447
4448 : Set private lib path
4449 case "$plibpth" in
4450 '') if ./mips; then
4451                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4452         fi;;
4453 esac
4454 case "$libpth" in
4455 ' ') dlist='';;
4456 '') dlist="$loclibpth $plibpth $glibpth";;
4457 *) dlist="$libpth";;
4458 esac
4459
4460 : Now check and see which directories actually exist, avoiding duplicates
4461 libpth=''
4462 for xxx in $dlist
4463 do
4464     if $test -d $xxx; then
4465                 case " $libpth " in
4466                 *" $xxx "*) ;;
4467                 *) libpth="$libpth $xxx";;
4468                 esac
4469     fi
4470 done
4471 $cat <<'EOM'
4472
4473 Some systems have incompatible or broken versions of libraries.  Among
4474 the directories listed in the question below, please remove any you
4475 know not to be holding relevant libraries, and add any that are needed.
4476 Say "none" for none.
4477
4478 EOM
4479 case "$libpth" in
4480 '') dflt='none';;
4481 *)
4482         set X $libpth
4483         shift
4484         dflt=${1+"$@"}
4485         ;;
4486 esac
4487 rp="Directories to use for library searches?"
4488 . ./myread
4489 case "$ans" in
4490 none) libpth=' ';;
4491 *) libpth="$ans";;
4492 esac
4493
4494 : compute shared library extension
4495 case "$so" in
4496 '')
4497         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4498                 dflt='sl'
4499         else
4500                 dflt='so'
4501         fi
4502         ;;
4503 *) dflt="$so";;
4504 esac
4505 $cat <<EOM
4506
4507 On some systems, shared libraries may be available.  Answer 'none' if
4508 you want to suppress searching of shared libraries for the remainder
4509 of this configuration.
4510
4511 EOM
4512 rp='What is the file extension used for shared libraries?'
4513 . ./myread
4514 so="$ans"
4515
4516 : Define several unixisms.
4517 : Hints files or command line option can be used to override them.
4518 : The convoluted testing is in case hints files set either the old
4519 : or the new name.
4520 case "$_exe" in
4521 '')     case "$exe_ext" in
4522         '')     ;;
4523         *)      _exe="$exe_ext" ;;
4524         esac
4525         ;;
4526 esac
4527 case "$_a" in
4528 '')     case "$lib_ext" in
4529     '') _a='.a';;
4530         *)      _a="$lib_ext" ;;
4531         esac
4532         ;;
4533 esac
4534 case "$_o" in
4535 '') case "$obj_ext" in
4536         '')     _o='.o';;
4537         *)      _o="$obj_ext";;
4538         esac
4539         ;;
4540 esac
4541 case "$p_" in
4542 '') case "$path_sep" in
4543         '')     p_=':';;
4544         *)      p_="$path_sep";;
4545         esac
4546         ;;
4547 esac
4548 exe_ext=$_exe
4549 lib_ext=$_a
4550 obj_ext=$_o
4551 path_sep=$p_
4552
4553 : Which makefile gets called first.  This is used by make depend.
4554 case "$firstmakefile" in
4555 '') firstmakefile='makefile';;
4556 esac
4557
4558 case "$ccflags" in
4559 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4560 esac
4561
4562 case "$uselongdouble" in
4563 $define|true|[yY]*)     dflt='y';;
4564 *) dflt='n';;
4565 esac
4566 cat <<EOM
4567
4568 Perl can be built to take advantage of long doubles which
4569 (if available) may give more accuracy and range for floating point numbers.
4570
4571 If this doesn't make any sense to you, just accept the default '$dflt'.
4572 EOM
4573 rp='Try to use long doubles if available?'
4574 . ./myread
4575 case "$ans" in
4576 y|Y)    val="$define"   ;;
4577 *)      val="$undef"    ;;
4578 esac
4579 set uselongdouble
4580 eval $setvar
4581
4582 case "$uselongdouble" in
4583 true|[yY]*) uselongdouble="$define" ;;
4584 esac
4585
4586 : Look for a hint-file generated 'call-back-unit'.  If the
4587 : user has specified that long doubles should be used,
4588 : we may need to set or change some other defaults.
4589 if $test -f uselongdouble.cbu; then
4590     echo "Your platform has some specific hints regarding long doubles, using them..."
4591     . ./uselongdouble.cbu
4592 else
4593     case "$uselongdouble" in
4594         $define)
4595                 $cat <<EOM
4596 (Your platform does not have any specific hints for long doubles.)
4597 EOM
4598         ;;
4599     esac
4600 fi
4601
4602 : Looking for optional libraries
4603 echo " "
4604 echo "Checking for optional libraries..." >&4
4605 case "$libs" in
4606 ' '|'') dflt='';;
4607 *) dflt="$libs";;
4608 esac
4609 case "$libswanted" in
4610 '') libswanted='c_s';;
4611 esac
4612 case "$usesocks" in
4613 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4614 esac
4615 libsfound=''
4616 libsfiles=''
4617 libsdirs=''
4618 libspath=''
4619 for thisdir in $libpth $xlibpth; do
4620   test -d $thisdir && libspath="$libspath $thisdir"
4621 done
4622 for thislib in $libswanted; do
4623         for thisdir in $libspath; do
4624             xxx=''
4625             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4626                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4627                 $test -f "$xxx" && eval $libscheck
4628                 $test -f "$xxx" && libstyle=shared
4629             fi
4630             if test ! -f "$xxx"; then
4631                 xxx=$thisdir/lib$thislib.$so
4632                 $test -f "$xxx" && eval $libscheck
4633                 $test -f "$xxx" && libstyle=shared
4634             fi  
4635             if test ! -f "$xxx"; then
4636                 xxx=$thisdir/lib$thislib$_a
4637                 $test -f "$xxx" && eval $libscheck
4638                 $test -f "$xxx" && libstyle=static
4639             fi
4640             if test ! -f "$xxx"; then
4641                 xxx=$thisdir/$thislib$_a
4642                 $test -f "$xxx" && eval $libscheck
4643                 $test -f "$xxx" && libstyle=static
4644             fi
4645             if test ! -f "$xxx"; then
4646                 xxx=$thisdir/lib${thislib}_s$_a
4647                 $test -f "$xxx" && eval $libscheck
4648                 $test -f "$xxx" && libstyle=static
4649                 $test -f "$xxx" && thislib=${thislib}_s
4650             fi
4651             if test ! -f "$xxx"; then
4652                 xxx=$thisdir/Slib$thislib$_a
4653                 $test -f "$xxx" && eval $libscheck
4654                 $test -f "$xxx" && libstyle=static
4655             fi
4656             if $test -f "$xxx"; then
4657                 case "$libstyle" in
4658                 shared) echo "Found -l$thislib (shared)." ;;
4659                 static) echo "Found -l$thislib." ;;
4660                 *)      echo "Found -l$thislib ($libstyle)." ;;
4661                 esac
4662                 case " $dflt " in
4663                 *"-l$thislib "*);;
4664                 *) dflt="$dflt -l$thislib"
4665                    libsfound="$libsfound $xxx"
4666                    yyy=`basename $xxx`
4667                    libsfiles="$libsfiles $yyy"
4668                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4669                    case " $libsdirs " in
4670                    *" $yyy "*) ;;
4671                    *) libsdirs="$libsdirs $yyy" ;;
4672                    esac
4673                    ;;
4674                 esac
4675                 break
4676             fi  
4677         done
4678         if $test ! -f "$xxx"; then
4679             echo "No -l$thislib."
4680         fi
4681 done
4682 set X $dflt
4683 shift
4684 dflt="$*"
4685 case "$libs" in
4686 '') dflt="$dflt";;
4687 *) dflt="$libs";;
4688 esac
4689 case "$dflt" in
4690 ' '|'') dflt='none';;
4691 esac
4692
4693 $cat <<EOM
4694
4695 In order to compile $package on your machine, a number of libraries
4696 are usually needed.  Include any other special libraries here as well.
4697 Say "none" for none.  The default list is almost always right.
4698 EOM
4699
4700 echo " "
4701 rp="What libraries to use?"
4702 . ./myread
4703 case "$ans" in
4704 none) libs=' ';;
4705 *) libs="$ans";;
4706 esac
4707
4708 : determine optimization, if desired, or use for debug flag also
4709 case "$optimize" in
4710 ' '|$undef) dflt='none';;
4711 '') dflt='-O';;
4712 *) dflt="$optimize";;
4713 esac
4714 $cat <<EOH
4715
4716 By default, $package compiles with the -O flag to use the optimizer.
4717 Alternately, you might want to use the symbolic debugger, which uses
4718 the -g flag (on traditional Unix systems).  Either flag can be
4719 specified here.  To use neither flag, specify the word "none".
4720
4721 EOH
4722 rp="What optimizer/debugger flag should be used?"
4723 . ./myread
4724 optimize="$ans"
4725 case "$optimize" in
4726 'none') optimize=" ";;
4727 esac
4728
4729 dflt=''
4730 : We will not override a previous value, but we might want to
4731 : augment a hint file
4732 case "$hint" in
4733 default|recommended)
4734         case "$gccversion" in
4735         1*) dflt='-fpcc-struct-return' ;;
4736         esac
4737         case "$optimize" in
4738         *-g*) dflt="$dflt -DDEBUGGING";;
4739         esac
4740         case "$gccversion" in
4741         2*) if test -d /etc/conf/kconfig.d &&
4742                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4743                 then
4744                         # Interactive Systems (ISC) POSIX mode.
4745                         dflt="$dflt -posix"
4746                 fi
4747                 ;;
4748         esac
4749         case "$gccversion" in
4750         1*) ;;
4751         2.[0-8]*) ;;
4752         ?*)     echo " "
4753                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4754                 echo 'int main(void) { return 0; }' > gcctest.c
4755                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4756                         echo "Yes, it does." 2>&1
4757                         case "$ccflags" in
4758                         *strict-aliasing*)
4759                                 echo "Leaving current flags $ccflags alone." 2>&1
4760                                 ;;
4761                         *) dflt="$dflt -fno-strict-aliasing" ;;
4762                         esac
4763                 else
4764                         echo "Nope, it doesn't, but that's ok." 2>&1
4765                 fi
4766                 ;;
4767         esac
4768         # For gcc, adding -pipe speeds up compilations for some, but apparently
4769         # some assemblers can't read from stdin.  (It also slows down compilations
4770         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4771         case "$gccversion" in
4772         ?*)     echo " "
4773                 echo "Checking if your compiler accepts -pipe" 2>&1
4774                 echo 'int main(void) { return 0; }' > gcctest.c
4775                 if $cc -pipe -o gcctest gcctest.c; then
4776                         echo "Yes, it does." 2>&1
4777                         case "$ccflags" in
4778                         *-pipe*)
4779                                 echo "Leaving current flags $ccflags alone." 2>&1
4780                                 ;;
4781                         *) dflt="$dflt -pipe" ;;
4782                         esac
4783                 else
4784                         echo "Nope, it doesn't, but that's ok." 2>&1
4785                 fi
4786
4787                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4788                 echo 'int main(void) { return 0; }' > gcctest.c
4789                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4790                         echo "Yes, it does." 2>&1
4791                         case "$ccflags" in
4792                         *-Wdeclaration-after-statement*)
4793                                 echo "Leaving current flags $ccflags alone." 2>&1
4794                                 ;;
4795                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4796                         esac
4797                 else
4798                         echo "Nope, it doesn't, but that's ok." 2>&1
4799                 fi
4800                 ;;
4801         esac
4802         ;;
4803 esac
4804
4805 case "$mips_type" in
4806 *BSD*|'') inclwanted="$locincpth $usrinc";;
4807 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4808 esac
4809 for thisincl in $inclwanted; do
4810         if $test -d $thisincl; then
4811                 if $test x$thisincl != x$usrinc; then
4812                         case "$dflt" in
4813                         *" -I$thisincl "*);;
4814                         *) dflt="$dflt -I$thisincl ";;
4815                         esac
4816                 fi
4817         fi
4818 done
4819
4820 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4821         xxx=true;
4822 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4823         xxx=true;
4824 else
4825         xxx=false;
4826 fi;
4827 if $xxx; then
4828         case "$dflt" in
4829         *$2*);;
4830         *) dflt="$dflt -D$2";;
4831         esac;
4832 fi'
4833
4834 set signal.h LANGUAGE_C; eval $inctest
4835
4836 case "$usesocks" in
4837 $define)
4838         ccflags="$ccflags -DSOCKS"
4839         ;;
4840 esac
4841
4842 case "$hint" in
4843 default|recommended) dflt="$ccflags $dflt" ;;
4844 *) dflt="$ccflags";;
4845 esac
4846
4847 case "$dflt" in
4848 ''|' ') dflt=none;;
4849 esac
4850
4851 $cat <<EOH
4852
4853 Your C compiler may want other flags.  For this question you should include
4854 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4855 but you should NOT include libraries or ld flags like -lwhatever.  If you
4856 want $package to honor its debug switch, you should include -DDEBUGGING here.
4857 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4858
4859 To use no flags, specify the word "none".
4860
4861 EOH
4862 set X $dflt
4863 shift
4864 dflt=${1+"$@"}
4865 rp="Any additional cc flags?"
4866 . ./myread
4867 case "$ans" in
4868 none) ccflags='';;
4869 *) ccflags="$ans";;
4870 esac
4871
4872 : the following weeds options from ccflags that are of no interest to cpp
4873 case "$cppflags" in
4874 '') cppflags="$ccflags" ;;
4875 *)  cppflags="$cppflags $ccflags" ;;
4876 esac
4877 case "$gccversion" in
4878 1*) cppflags="$cppflags -D__GNUC__"
4879 esac
4880 case "$mips_type" in
4881 '');;
4882 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4883 esac
4884 case "$cppflags" in
4885 '');;
4886 *)
4887         echo " "
4888         echo "Let me guess what the preprocessor flags are..." >&4
4889         set X $cppflags
4890         shift
4891         cppflags=''
4892         $cat >cpp.c <<'EOM'
4893 #define BLURFL foo
4894
4895 BLURFL xx LFRULB
4896 EOM
4897         previous=''
4898         for flag in $*
4899         do
4900                 case "$flag" in
4901                 -*) ftry="$flag";;
4902                 *) ftry="$previous $flag";;
4903                 esac
4904                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4905                         >cpp1.out 2>/dev/null && \
4906                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4907                         >cpp2.out 2>/dev/null && \
4908                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4909                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4910                 then
4911                         cppflags="$cppflags $ftry"
4912                         previous=''
4913                 else
4914                         previous="$flag"
4915                 fi
4916         done
4917         set X $cppflags
4918         shift
4919         cppflags=${1+"$@"}
4920         case "$cppflags" in
4921         *-*)  echo "They appear to be: $cppflags";;
4922         esac
4923         $rm -f cpp.c cpp?.out
4924         ;;
4925 esac
4926
4927 : flags used in final linking phase
4928 case "$ldflags" in
4929 '') if ./venix; then
4930                 dflt='-i -z'
4931         else
4932                 dflt=''
4933         fi
4934         case "$ccflags" in
4935         *-posix*) dflt="$dflt -posix" ;;
4936         esac
4937         ;;
4938 *) dflt="$ldflags";;
4939 esac
4940
4941 : Try to guess additional flags to pick up local libraries.
4942 for thislibdir in $libpth; do
4943         case " $loclibpth " in
4944         *" $thislibdir "*)
4945                 case "$dflt " in
4946                 *"-L$thislibdir "*) ;;
4947                 *)  dflt="$dflt -L$thislibdir" ;;
4948                 esac
4949                 ;;
4950         esac
4951 done
4952
4953 case "$dflt" in
4954 '') dflt='none' ;;
4955 esac
4956
4957 $cat <<EOH
4958
4959 Your C linker may need flags.  For this question you should
4960 include -L/whatever and any other flags used by the C linker, but you
4961 should NOT include libraries like -lwhatever.
4962
4963 Make sure you include the appropriate -L/path flags if your C linker
4964 does not normally search all of the directories you specified above,
4965 namely
4966         $libpth
4967 To use no flags, specify the word "none".
4968
4969 EOH
4970
4971 rp="Any additional ld flags (NOT including libraries)?"
4972 . ./myread
4973 case "$ans" in
4974 none) ldflags='';;
4975 *) ldflags="$ans";;
4976 esac
4977 rmlist="$rmlist pdp11"
4978
4979 : coherency check
4980 echo " "
4981 echo "Checking your choice of C compiler and flags for coherency..." >&4
4982 $cat > try.c <<'EOF'
4983 #include <stdio.h>
4984 int main() { printf("Ok\n"); return(0); }
4985 EOF
4986 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4987 shift
4988 $cat >try.msg <<'EOM'
4989 I've tried to compile and run the following simple program:
4990
4991 EOM
4992 $cat try.c >> try.msg
4993
4994 $cat >> try.msg <<EOM
4995
4996 I used the command:
4997
4998         $*
4999         $run ./try
5000
5001 and I got the following output:
5002
5003 EOM
5004 dflt=y
5005 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5006         if $sh -c "$run ./try" >>try.msg 2>&1; then
5007                 xxx=`$run ./try`
5008                 case "$xxx" in
5009                 "Ok") dflt=n ;;
5010                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5011                         case " $libs " in
5012                         *" -lsfio "*)
5013                                 cat >> try.msg <<'EOQS'
5014 If $libs contains -lsfio, and sfio is mis-configured, then it
5015 sometimes (apparently) runs and exits with a 0 status, but with no
5016 output!  It may have to do with sfio's use of _exit vs. exit.
5017
5018 EOQS
5019                                 rp="You have a big problem.  Shall I abort Configure"
5020                                 dflt=y
5021                                 ;;
5022                         esac
5023                         ;;
5024                 esac
5025         else
5026                 echo "The program compiled OK, but exited with status $?." >>try.msg
5027                 rp="You have a problem.  Shall I abort Configure"
5028                 dflt=y
5029         fi
5030 else
5031         echo "I can't compile the test program." >>try.msg
5032         rp="You have a BIG problem.  Shall I abort Configure"
5033         dflt=y
5034 fi
5035 case "$dflt" in
5036 y)
5037         $cat try.msg >&4
5038         case "$knowitall" in
5039         '')
5040                 echo "(The supplied flags or libraries might be incorrect.)"
5041                 ;;
5042         *) dflt=n;;
5043         esac
5044         echo " "
5045         . ./myread
5046         case "$ans" in
5047         n*|N*) ;;
5048         *)      echo "Ok.  Stopping Configure." >&4
5049                 exit 1
5050                 ;;
5051         esac
5052         ;;
5053 n) echo "OK, that should do.";;
5054 esac
5055 $rm -f try try.* core
5056
5057 : define a shorthand compile call
5058 compile='
5059 mc_file=$1;
5060 shift;
5061 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5062 : define a shorthand compile call for compilations that should be ok.
5063 compile_ok='
5064 mc_file=$1;
5065 shift;
5066 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5067
5068 : determine filename position in cpp output
5069 echo " "
5070 echo "Computing filename position in cpp output for #include directives..." >&4
5071 case "$osname" in
5072 vos) testaccess=-e ;;
5073 *)   testaccess=-r ;;
5074 esac
5075 echo '#include <stdio.h>' > foo.c
5076 $cat >fieldn <<EOF
5077 $startsh
5078 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5079 $grep '^[       ]*#.*stdio\.h' | \
5080 while read cline; do
5081         pos=1
5082         set \$cline
5083         while $test \$# -gt 0; do
5084                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5085                         echo "\$pos"
5086                         exit 0
5087                 fi
5088                 shift
5089                 pos=\`expr \$pos + 1\`
5090         done
5091 done
5092 EOF
5093 chmod +x fieldn
5094 fieldn=`./fieldn`
5095 $rm -f foo.c fieldn
5096 case $fieldn in
5097 '') pos='???';;
5098 1) pos=first;;
5099 2) pos=second;;
5100 3) pos=third;;
5101 *) pos="${fieldn}th";;
5102 esac
5103 echo "Your cpp writes the filename in the $pos field of the line."
5104
5105 case "$osname" in
5106 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5107 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5108 *)   cppfilter='' ;;
5109 esac
5110 : locate header file
5111 $cat >findhdr <<EOF
5112 $startsh
5113 wanted=\$1
5114 name=''
5115 for usrincdir in $usrinc
5116 do
5117         if test -f \$usrincdir/\$wanted; then
5118                 echo "\$usrincdir/\$wanted"
5119                 exit 0
5120         fi
5121 done
5122 awkprg='{ print \$$fieldn }'
5123 echo "#include <\$wanted>" > foo\$\$.c
5124 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5125 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5126 while read cline; do
5127         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5128         case "\$name" in
5129         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5130         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5131         *) exit 2;;
5132         esac;
5133 done;
5134 #
5135 # status = 0: grep returned 0 lines, case statement not executed
5136 # status = 1: headerfile found
5137 # status = 2: while loop executed, no headerfile found
5138 #
5139 status=\$?
5140 $rm -f foo\$\$.c;
5141 if test \$status -eq 1; then
5142         exit 0;
5143 fi
5144 exit 1
5145 EOF
5146 chmod +x findhdr
5147
5148 : define an alternate in-header-list? function
5149 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5150 cont=true; xxf="echo \"<\$1> found.\" >&4";
5151 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5152 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5153 esac;
5154 case $# in 4) instead=instead;; *) instead="at last";; esac;
5155 while $test "$cont"; do
5156         xxx=`./findhdr $1`
5157         var=$2; eval "was=\$$2";
5158         if $test "$xxx" && $test -r "$xxx";
5159         then eval $xxf;
5160         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5161                 cont="";
5162         else eval $xxnf;
5163         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5164         set $yyy; shift; shift; yyy=$@;
5165         case $# in 0) cont="";;
5166         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5167                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5168         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5169                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5170         esac;
5171 done;
5172 while $test "$yyy";
5173 do set $yyy; var=$2; eval "was=\$$2";
5174         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5175         set $yyy; shift; shift; yyy=$@;
5176 done'
5177
5178 : see if stdlib is available
5179 set stdlib.h i_stdlib
5180 eval $inhdr
5181
5182 : check for lengths of integral types
5183 echo " "
5184 case "$intsize" in
5185 '')
5186         echo "Checking to see how big your integers are..." >&4
5187         $cat >try.c <<EOCP
5188 #include <stdio.h>
5189 #$i_stdlib I_STDLIB
5190 #ifdef I_STDLIB
5191 #include <stdlib.h>
5192 #endif
5193 int main()
5194 {
5195         printf("intsize=%d;\n", (int)sizeof(int));
5196         printf("longsize=%d;\n", (int)sizeof(long));
5197         printf("shortsize=%d;\n", (int)sizeof(short));
5198         exit(0);
5199 }
5200 EOCP
5201         set try
5202         if eval $compile_ok && $run ./try > /dev/null; then
5203                 eval `$run ./try`
5204                 echo "Your integers are $intsize bytes long."
5205                 echo "Your long integers are $longsize bytes long."
5206                 echo "Your short integers are $shortsize bytes long."
5207         else
5208                 $cat >&4 <<EOM
5209 !
5210 Help! I can't compile and run the intsize test program: please enlighten me!
5211 (This is probably a misconfiguration in your system or libraries, and
5212 you really ought to fix it.  Still, I'll try anyway.)
5213 !
5214 EOM
5215                 dflt=4
5216                 rp="What is the size of an integer (in bytes)?"
5217                 . ./myread
5218                 intsize="$ans"
5219                 dflt=$intsize
5220                 rp="What is the size of a long integer (in bytes)?"
5221                 . ./myread
5222                 longsize="$ans"
5223                 dflt=2
5224                 rp="What is the size of a short integer (in bytes)?"
5225                 . ./myread
5226                 shortsize="$ans"
5227         fi
5228         ;;
5229 esac
5230 $rm -f try try.*
5231
5232 : check for long long
5233 echo " "
5234 echo "Checking to see if you have long long..." >&4
5235 echo 'int main() { long long x = 7; return 0; }' > try.c
5236 set try
5237 if eval $compile; then
5238         val="$define"
5239         echo "You have long long."
5240 else
5241         val="$undef"
5242         echo "You do not have long long."
5243 fi
5244 $rm try.*
5245 set d_longlong
5246 eval $setvar
5247
5248 : check for length of long long
5249 case "${d_longlong}${longlongsize}" in
5250 $define)
5251         echo " "
5252         echo "Checking to see how big your long longs are..." >&4
5253         $cat >try.c <<'EOCP'
5254 #include <stdio.h>
5255 int main()
5256 {
5257     printf("%d\n", (int)sizeof(long long));
5258     return(0);
5259 }
5260 EOCP
5261         set try
5262         if eval $compile_ok; then
5263                 longlongsize=`$run ./try`
5264                 echo "Your long longs are $longlongsize bytes long."
5265         else
5266                 dflt='8'
5267                 echo " "
5268                 echo "(I can't seem to compile the test program.  Guessing...)"
5269                 rp="What is the size of a long long (in bytes)?"
5270                 . ./myread
5271                 longlongsize="$ans"
5272         fi
5273         if $test "X$longsize" = "X$longlongsize"; then
5274                 echo "(That isn't any different from an ordinary long.)"
5275         fi      
5276         ;;
5277 esac
5278 $rm -f try.* try
5279
5280 : see if inttypes.h is available
5281 : we want a real compile instead of Inhdr because some systems
5282 : have an inttypes.h which includes non-existent headers
5283 echo " "
5284 $cat >try.c <<EOCP
5285 #include <inttypes.h>
5286 int main() {
5287         static int32_t foo32 = 0x12345678;
5288 }
5289 EOCP
5290 set try
5291 if eval $compile; then
5292         echo "<inttypes.h> found." >&4
5293         val="$define"
5294 else
5295         echo "<inttypes.h> NOT found." >&4
5296         val="$undef"
5297 fi
5298 $rm -f try.c try
5299 set i_inttypes
5300 eval $setvar
5301
5302 : check for int64_t
5303 echo " "
5304 echo "Checking to see if you have int64_t..." >&4
5305 $cat >try.c <<EOCP
5306 #include <sys/types.h>
5307 #$i_inttypes I_INTTYPES
5308 #ifdef I_INTTYPES
5309 #include <inttypes.h>
5310 #endif
5311 int main() { int64_t x = 7; }
5312 EOCP
5313 set try
5314 if eval $compile; then
5315         val="$define"
5316         echo "You have int64_t."
5317 else
5318         val="$undef"
5319         echo "You do not have int64_t."
5320 fi
5321 $rm -f try try.*
5322 set d_int64_t
5323 eval $setvar
5324
5325
5326 echo " "
5327 echo "Checking which 64-bit integer type we could use..." >&4
5328
5329 case "$intsize" in
5330 8) val=int
5331    set quadtype
5332    eval $setvar
5333    val='"unsigned int"'
5334    set uquadtype
5335    eval $setvar
5336    quadkind=1
5337    ;;
5338 *) case "$longsize" in
5339    8) val=long
5340       set quadtype
5341       eval $setvar
5342       val='"unsigned long"'
5343       set uquadtype
5344       eval $setvar
5345       quadkind=2
5346       ;;
5347    *) case "$d_longlong:$longlongsize" in
5348       define:8)
5349         val='"long long"'
5350         set quadtype
5351         eval $setvar
5352         val='"unsigned long long"'
5353         set uquadtype
5354         eval $setvar
5355         quadkind=3
5356         ;;
5357       *) case "$d_int64_t" in
5358          define)
5359            val=int64_t
5360            set quadtype
5361            eval $setvar
5362            val=uint64_t
5363            set uquadtype
5364            eval $setvar
5365            quadkind=4
5366            ;;
5367          esac
5368          ;;
5369       esac
5370       ;;
5371    esac
5372    ;;
5373 esac
5374
5375 case "$quadtype" in
5376 '')     echo "Alas, no 64-bit integer types in sight." >&4
5377         d_quad="$undef"
5378         ;;
5379 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5380         d_quad="$define"
5381         ;;
5382 esac
5383
5384
5385 case "$uselonglong" in
5386 "$define"|true|[yY]*)
5387         cat <<EOM >&4
5388
5389 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5390 EOM
5391         use64bitint="$define"
5392         ;;
5393 esac                          
5394 case "$use64bits" in
5395 "$define"|true|[yY]*)
5396         cat <<EOM >&4
5397
5398 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5399 EOM
5400         use64bitint="$define"
5401         ;;
5402 esac                          
5403 case "$use64bitints" in
5404 "$define"|true|[yY]*)
5405         cat <<EOM >&4
5406
5407 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5408 EOM
5409         use64bitint="$define"
5410         ;;
5411 esac                          
5412 case "$use64bitsint" in
5413 "$define"|true|[yY]*)
5414         cat <<EOM >&4
5415
5416 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5417 EOM
5418         use64bitint="$define"
5419         ;;
5420 esac                          
5421 case "$uselonglongs" in
5422 "$define"|true|[yY]*)
5423         cat <<EOM >&4
5424
5425 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5426 EOM
5427         use64bitint="$define"
5428         ;;
5429 esac                          
5430 case "$use64bitsall" in
5431 "$define"|true|[yY]*)
5432         cat <<EOM >&4
5433
5434 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5435 EOM
5436         use64bitall="$define"
5437         ;;
5438 esac                          
5439
5440 case "$ccflags" in
5441 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5442 esac
5443 case "$use64bitall" in
5444 "$define"|true|[yY]*) use64bitint="$define" ;;
5445 esac
5446
5447 case "$longsize" in
5448 8) cat <<EOM
5449
5450 You have natively 64-bit long integers.
5451 EOM
5452    val="$define"
5453    ;;
5454 *) case "$use64bitint" in
5455    "$define"|true|[yY]*) dflt='y';;
5456    *) dflt='n';;
5457    esac
5458    case "$d_quad" in
5459    "$define") ;;
5460    *) dflt='n' ;;
5461    esac
5462    cat <<EOM
5463
5464 Perl can be built to take advantage of 64-bit integer types
5465 on some systems.  To do so, Configure can be run with -Duse64bitint.
5466 Choosing this option will most probably introduce binary incompatibilities.
5467
5468 If this doesn't make any sense to you, just accept the default '$dflt'.
5469 (The default has been chosen based on your configuration.)
5470 EOM
5471    rp='Try to use 64-bit integers, if available?'
5472    . ./myread
5473    case "$ans" in
5474    [yY]*) val="$define" ;;
5475    *)     val="$undef"  ;;
5476    esac
5477    ;;
5478 esac
5479 set use64bitint
5480 eval $setvar
5481
5482 case "$use64bitall" in
5483 "$define"|true|[yY]*) dflt='y' ;;
5484 *) case "$longsize" in
5485    8) dflt='y' ;;
5486    *) dflt='n' ;;
5487    esac
5488    ;;
5489 esac    
5490 cat <<EOM
5491
5492 You may also choose to try maximal 64-bitness.  It means using as much
5493 64-bitness as possible on the platform.  This in turn means even more
5494 binary incompatibilities.  On the other hand, your platform may not
5495 have any more 64-bitness available than what you already have chosen.
5496
5497 If this doesn't make any sense to you, just accept the default '$dflt'.
5498 (The default has been chosen based on your configuration.)
5499 EOM
5500 rp='Try to use maximal 64-bit support, if available?'
5501 . ./myread
5502 case "$ans" in
5503 [yY]*) val="$define" ;;
5504 *)     val="$undef"  ;;
5505 esac
5506 set use64bitall
5507 eval $setvar
5508 case "$use64bitall" in
5509 "$define")
5510         case "$use64bitint" in
5511         "$undef")
5512                 cat <<EOM
5513
5514 Since you have chosen a maximally 64-bit build, I'm also turning on
5515 the use of 64-bit integers.
5516 EOM
5517                 use64bitint="$define" ;;
5518         esac
5519         ;;
5520 esac
5521
5522 : Look for a hint-file generated 'call-back-unit'.  If the
5523 : user has specified that a 64-bit perl is to be built,
5524 : we may need to set or change some other defaults.
5525 if $test -f use64bitint.cbu; then
5526         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5527         . ./use64bitint.cbu
5528 fi
5529 case "$use64bitint" in
5530 "$define"|true|[yY]*)
5531         case "$longsize" in
5532         4) case "$archname64" in
5533            '') archname64=64int ;;
5534            esac
5535            ;;
5536         esac
5537         ;;
5538 esac
5539
5540 : Look for a hint-file generated 'call-back-unit'.  If the
5541 : user has specified that a maximally 64-bit perl is to be built,
5542 : we may need to set or change some other defaults.
5543 if $test -f use64bitall.cbu; then
5544         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5545         . ./use64bitall.cbu
5546 fi
5547 case "$use64bitall" in
5548 "$define"|true|[yY]*)
5549         case "$longsize" in
5550         4) case "$archname64" in
5551            ''|64int) archname64=64all ;;
5552            esac
5553            ;;
5554         esac
5555         ;;
5556 esac
5557
5558 case "$d_quad:$use64bitint" in
5559 $undef:$define)
5560         cat >&4 <<EOF
5561
5562 *** You have chosen to use 64-bit integers,
5563 *** but none can be found.
5564 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5565 *** Cannot continue, aborting.
5566
5567 EOF
5568         exit 1
5569         ;;
5570 esac
5571
5572 : check for length of double
5573 echo " "
5574 case "$doublesize" in
5575 '')
5576         echo "Checking to see how big your double precision numbers are..." >&4
5577         $cat >try.c <<EOCP
5578 #include <stdio.h>
5579 #$i_stdlib I_STDLIB
5580 #ifdef I_STDLIB
5581 #include <stdlib.h>
5582 #endif
5583 int main()
5584 {
5585     printf("%d\n", (int)sizeof(double));
5586     exit(0);
5587 }
5588 EOCP
5589         set try
5590         if eval $compile_ok; then
5591                 doublesize=`$run ./try`
5592                 echo "Your double is $doublesize bytes long."
5593         else
5594                 dflt='8'
5595                 echo "(I can't seem to compile the test program.  Guessing...)"
5596                 rp="What is the size of a double precision number (in bytes)?"
5597                 . ./myread
5598                 doublesize="$ans"
5599         fi
5600         ;;
5601 esac
5602 $rm -f try.c try
5603
5604 : check for long doubles
5605 echo " "
5606 echo "Checking to see if you have long double..." >&4
5607 echo 'int main() { long double x = 7.0; }' > try.c
5608 set try
5609 if eval $compile; then
5610         val="$define"
5611         echo "You have long double."
5612 else
5613         val="$undef"
5614         echo "You do not have long double."
5615 fi
5616 $rm try.*
5617 set d_longdbl
5618 eval $setvar
5619
5620 : check for length of long double
5621 case "${d_longdbl}${longdblsize}" in
5622 $define)
5623         echo " "
5624         echo "Checking to see how big your long doubles are..." >&4
5625         $cat >try.c <<'EOCP'
5626 #include <stdio.h>
5627 int main()
5628 {
5629         printf("%d\n", sizeof(long double));
5630 }
5631 EOCP
5632         set try
5633         set try
5634         if eval $compile; then
5635                 longdblsize=`$run ./try`
5636                 echo "Your long doubles are $longdblsize bytes long."
5637         else
5638                 dflt='8'
5639                 echo " "
5640                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5641                 rp="What is the size of a long double (in bytes)?"
5642                 . ./myread
5643                 longdblsize="$ans"
5644         fi
5645         if $test "X$doublesize" = "X$longdblsize"; then
5646                 echo "That isn't any different from an ordinary double."
5647                 echo "I'll keep your setting anyway, but you may see some"
5648                 echo "harmless compilation warnings."
5649         fi      
5650         ;;
5651 esac
5652 $rm -f try.* try
5653
5654 : determine the architecture name
5655 echo " "
5656 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5657         tarch=`arch`"-$osname"
5658 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5659         if uname -m > tmparch 2>&1 ; then
5660                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5661                         -e 's/$/'"-$osname/" tmparch`
5662         else
5663                 tarch="$osname"
5664         fi
5665         $rm -f tmparch
5666 else
5667         tarch="$osname"
5668 fi
5669 case "$myarchname" in
5670 ''|"$tarch") ;;
5671 *)
5672         echo "(Your architecture name used to be $myarchname.)"
5673         archname=''
5674         ;;
5675 esac
5676 case "$targetarch" in
5677 '') ;;
5678 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5679 esac
5680 myarchname="$tarch"
5681 case "$archname" in
5682 '') dflt="$tarch";;
5683 *) dflt="$archname";;
5684 esac
5685 rp='What is your architecture name'
5686 . ./myread
5687 archname="$ans"
5688 case "$usethreads" in
5689 $define)
5690         echo "Threads selected." >&4
5691         case "$archname" in
5692         *-thread*) echo "...and architecture name already has -thread." >&4
5693                 ;;
5694         *)      archname="$archname-thread"
5695                 echo "...setting architecture name to $archname." >&4
5696                 ;;
5697         esac
5698         ;;
5699 esac
5700 case "$usemultiplicity" in
5701 $define)
5702         echo "Multiplicity selected." >&4
5703         case "$archname" in
5704         *-multi*) echo "...and architecture name already has -multi." >&4
5705                 ;;
5706         *)      archname="$archname-multi"
5707                 echo "...setting architecture name to $archname." >&4
5708                 ;;
5709         esac
5710         ;;
5711 esac
5712 case "$use64bitint$use64bitall" in
5713 *"$define"*)
5714         case "$archname64" in
5715         '')
5716                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5717                 ;;
5718         *)
5719                 case "$use64bitint" in
5720                 "$define") echo "64 bit integers selected." >&4 ;;
5721                 esac
5722                 case "$use64bitall" in
5723                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5724                 esac
5725                 case "$archname" in
5726                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5727                         ;;
5728                 *)      archname="$archname-$archname64"
5729                         echo "...setting architecture name to $archname." >&4
5730                         ;;
5731                 esac
5732                 ;;
5733         esac
5734 esac
5735 case "$uselongdouble" in
5736 $define)
5737         echo "Long doubles selected." >&4
5738         case "$longdblsize" in
5739         $doublesize)
5740                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5741                 ;;
5742         *)
5743                 case "$archname" in
5744                 *-ld*) echo "...and architecture name already has -ld." >&4
5745                         ;;
5746                 *)      archname="$archname-ld"
5747                         echo "...setting architecture name to $archname." >&4
5748                         ;;
5749                 esac
5750                 ;;
5751         esac
5752         ;;
5753 esac
5754 case "$useperlio" in
5755 $define)
5756         echo "Perlio selected." >&4
5757         ;;
5758 *)
5759         echo "Perlio not selected, using stdio." >&4
5760         case "$archname" in
5761         *-stdio*) echo "...and architecture name already has -stdio." >&4
5762                 ;;
5763         *)      archname="$archname-stdio"
5764                 echo "...setting architecture name to $archname." >&4
5765                 ;;
5766         esac
5767         ;;
5768 esac
5769 if $test -f archname.cbu; then
5770         echo "Your platform has some specific hints for architecture name, using them..."
5771         . ./archname.cbu
5772 fi
5773
5774 : determine root of directory hierarchy where package will be installed.
5775 case "$prefix" in
5776 '')
5777         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5778         ;;
5779 *?/)
5780         dflt=`echo "$prefix" | sed 's/.$//'`
5781         ;;
5782 *)
5783         dflt="$prefix"
5784         ;;
5785 esac
5786 $cat <<EOM
5787
5788 By default, $package will be installed in $dflt/bin, manual pages
5789 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5790 installation directories. Typically this is something like /usr/local.
5791 If you wish to have binaries under /usr/bin but other parts of the
5792 installation under /usr/local, that's ok: you will be prompted
5793 separately for each of the installation directories, the prefix being
5794 only used to set the defaults.
5795
5796 EOM
5797 fn=d~
5798 rp='Installation prefix to use?'
5799 . ./getfile
5800 oldprefix=''
5801 case "$prefix" in
5802 '') ;;
5803 *)
5804         case "$ans" in
5805         "$prefix") ;;
5806         *) oldprefix="$prefix";;
5807         esac
5808         ;;
5809 esac
5810 prefix="$ans"
5811 prefixexp="$ansexp"
5812
5813 case "$afsroot" in
5814 '')     afsroot=/afs ;;
5815 *)      afsroot=$afsroot ;;
5816 esac
5817
5818 : is AFS running?
5819 echo " "
5820 case "$afs" in
5821 $define|true)   afs=true ;;
5822 $undef|false)   afs=false ;;
5823 *)      if test -d $afsroot; then
5824                 afs=true
5825         else
5826                 afs=false
5827         fi
5828         ;;
5829 esac
5830 if $afs; then
5831         echo "AFS may be running... I'll be extra cautious then..." >&4
5832 else
5833         echo "AFS does not seem to be running..." >&4
5834 fi
5835
5836 : determine installation prefix for where package is to be installed.
5837 if $afs; then 
5838 $cat <<EOM
5839
5840 Since you are running AFS, I need to distinguish the directory in which
5841 files will reside from the directory in which they are installed (and from
5842 which they are presumably copied to the former directory by occult means).
5843
5844 EOM
5845         case "$installprefix" in
5846         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5847         *) dflt="$installprefix";;
5848         esac
5849 else
5850 $cat <<EOM
5851
5852 In some special cases, particularly when building $package for distribution,
5853 it is convenient to distinguish the directory in which files should be
5854 installed from the directory ($prefix) in which they will
5855 eventually reside.  For most users, these two directories are the same.
5856
5857 EOM
5858         case "$installprefix" in
5859         '') dflt=$prefix ;;
5860         *) dflt=$installprefix;;
5861         esac
5862 fi
5863 fn=d~
5864 rp='What installation prefix should I use for installing files?'
5865 . ./getfile
5866 installprefix="$ans"
5867 installprefixexp="$ansexp"
5868
5869 : set the prefixit variable, to compute a suitable default value
5870 prefixit='case "$3" in
5871 ""|none)
5872         case "$oldprefix" in
5873         "") eval "$1=\"\$$2\"";;
5874         *)
5875                 case "$3" in
5876                 "") eval "$1=";;
5877                 none)
5878                         eval "tp=\"\$$2\"";
5879                         case "$tp" in
5880                         ""|" ") eval "$1=\"\$$2\"";;
5881                         *) eval "$1=";;
5882                         esac;;
5883                 esac;;
5884         esac;;
5885 *)
5886         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5887         case "$tp" in
5888         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5889         /*-$oldprefix/*|\~*-$oldprefix/*)
5890                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5891         *) eval "$1=\"\$$2\"";;
5892         esac;;
5893 esac'
5894
5895 : get the patchlevel
5896 echo " "
5897 echo "Getting the current patchlevel..." >&4
5898 if $test -r $rsrc/patchlevel.h;then
5899         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5900         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5901         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5902         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5903         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5904         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5905         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5906 else
5907         revision=0
5908         patchlevel=0
5909         subversion=0
5910         api_revision=0
5911         api_version=0
5912         api_subversion=0
5913         perl_patchlevel=0
5914         $echo "(You do not have patchlevel.h.  Eek.)"
5915 fi
5916 if $test -r $rsrc/.patch ; then
5917         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5918                 perl_patchlevel=`cat $rsrc/.patch`
5919         fi
5920 fi
5921 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5922 version_patchlevel_string="version $patchlevel subversion $subversion"
5923 case "$perl_patchlevel" in
5924 0|'') ;;
5925 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5926 esac
5927
5928 $echo "(You have $package $version_patchlevel_string.)"
5929
5930 case "$osname" in
5931 dos|vms)
5932         : XXX Should be a Configure test for double-dots in filenames.
5933         version=`echo $revision $patchlevel $subversion | \
5934                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5935         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5936                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5937         ;;
5938 *)
5939         version=`echo $revision $patchlevel $subversion | \
5940                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5941         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5942                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5943         ;;
5944 esac
5945 : Special case the 5.005_xx maintenance series, which used 5.005
5946 : without any subversion label as a subdirectory in $sitelib
5947 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5948         api_versionstring='5.005'
5949 fi
5950
5951 : determine installation style
5952 : For now, try to deduce it from prefix unless it is already set.
5953 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5954 case "$installstyle" in
5955 '')     case "$prefix" in
5956                 *perl*) dflt='lib';;
5957                 *) dflt='lib/perl5' ;;
5958         esac
5959         ;;
5960 *)      dflt="$installstyle" ;;
5961 esac
5962 : Probably not worth prompting for this since we prompt for all
5963 : the directories individually, and the prompt would be too long and
5964 : confusing anyway.
5965 installstyle=$dflt
5966
5967 : determine where private library files go
5968 : Usual default is /usr/local/lib/perl5/$version.
5969 : Also allow things like /opt/perl/lib/$version, since 
5970 : /opt/perl/lib/perl5... would be redundant.
5971 : The default "style" setting is made in installstyle.U
5972 case "$installstyle" in
5973 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5974 *)       set dflt privlib lib/$version ;;
5975 esac
5976 eval $prefixit
5977 $cat <<EOM
5978
5979 There are some auxiliary files for $package that need to be put into a
5980 private library directory that is accessible by everyone.
5981
5982 EOM
5983 fn=d~+
5984 rp='Pathname where the private library files will reside?'
5985 . ./getfile
5986 privlib="$ans"
5987 privlibexp="$ansexp"
5988 : Change installation prefix, if necessary.
5989 if $test X"$prefix" != X"$installprefix"; then
5990         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5991 else
5992         installprivlib="$privlibexp"
5993 fi
5994
5995 : set the prefixup variable, to restore leading tilda escape
5996 prefixup='case "$prefixexp" in
5997 "$prefix") ;;
5998 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5999 esac'
6000
6001 : determine where public architecture dependent libraries go
6002 set archlib archlib
6003 eval $prefixit
6004 : privlib default is /usr/local/lib/$package/$version
6005 : archlib default is /usr/local/lib/$package/$version/$archname
6006 : privlib may have an optional trailing /share.
6007 tdflt=`echo $privlib | $sed 's,/share$,,'`
6008 tdflt=$tdflt/$archname
6009 case "$archlib" in
6010 '')     dflt=$tdflt
6011         ;;
6012 *)      dflt="$archlib"
6013     ;;
6014 esac
6015 $cat <<EOM
6016
6017 $spackage contains architecture-dependent library files.  If you are
6018 sharing libraries in a heterogeneous environment, you might store
6019 these files in a separate location.  Otherwise, you can just include
6020 them with the rest of the public library files.
6021
6022 EOM
6023 fn=d+~
6024 rp='Where do you want to put the public architecture-dependent libraries?'
6025 . ./getfile
6026 archlib="$ans"
6027 archlibexp="$ansexp"
6028 if $test X"$archlib" = X"$privlib"; then
6029         d_archlib="$undef"
6030 else
6031         d_archlib="$define"
6032 fi
6033 : Change installation prefix, if necessary.
6034 if $test X"$prefix" != X"$installprefix"; then
6035         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6036 else
6037         installarchlib="$archlibexp"
6038 fi
6039
6040 : see if setuid scripts can be secure
6041 $cat <<EOM
6042
6043 Some kernels have a bug that prevents setuid #! scripts from being
6044 secure.  Some sites have disabled setuid #! scripts because of this.
6045
6046 First let's decide if your kernel supports secure setuid #! scripts.
6047 (If setuid #! scripts would be secure but have been disabled anyway,
6048 don't say that they are secure if asked.)
6049
6050 EOM
6051
6052 val="$undef"
6053 if $test -d /dev/fd; then
6054         echo "#!$ls" >reflect
6055         chmod +x,u+s reflect
6056         ./reflect >flect 2>&1
6057         if $contains "/dev/fd" flect >/dev/null; then
6058                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6059                 val="$define"
6060         else
6061                 $cat <<EOM
6062 If you are not sure if they are secure, I can check but I'll need a
6063 username and password different from the one you are using right now.
6064 If you don't have such a username or don't want me to test, simply
6065 enter 'none'.
6066
6067 EOM
6068                 rp='Other username to test security of setuid scripts with?'
6069                 dflt='none'
6070                 . ./myread
6071                 case "$ans" in
6072                 n|none)
6073                         case "$d_suidsafe" in
6074                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6075                                 dflt=n;;
6076                         "$undef")
6077                                 echo "Well, the $hint value is *not* secure." >&4
6078                                 dflt=n;;
6079                         *)      echo "Well, the $hint value *is* secure." >&4
6080                                 dflt=y;;
6081                         esac
6082                         ;;
6083                 *)
6084                         $rm -f reflect flect
6085                         echo "#!$ls" >reflect
6086                         chmod +x,u+s reflect
6087                         echo >flect
6088                         chmod a+w flect
6089                         echo '"su" will (probably) prompt you for '"$ans's password."
6090                         su $ans -c './reflect >flect'
6091                         if $contains "/dev/fd" flect >/dev/null; then
6092                                 echo "Okay, it looks like setuid scripts are secure." >&4
6093                                 dflt=y
6094                         else
6095                                 echo "I don't think setuid scripts are secure." >&4
6096                                 dflt=n
6097                         fi
6098                         ;;
6099                 esac
6100                 rp='Does your kernel have *secure* setuid scripts?'
6101                 . ./myread
6102                 case "$ans" in
6103                 [yY]*)  val="$define";;
6104                 *)      val="$undef";;
6105                 esac
6106         fi
6107 else
6108         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6109         echo "(That's for file descriptors, not floppy disks.)"
6110         val="$undef"
6111 fi
6112 set d_suidsafe
6113 eval $setvar
6114
6115 $rm -f reflect flect
6116
6117 : now see if they want to do setuid emulation
6118 echo " "
6119 val="$undef"
6120 case "$d_suidsafe" in
6121 "$define")
6122         val="$undef"
6123         echo "No need to emulate SUID scripts since they are secure here." >&4
6124         ;;
6125 *)
6126         $cat <<EOM
6127 Some systems have disabled setuid scripts, especially systems where
6128 setuid scripts cannot be secure.  On systems where setuid scripts have
6129 been disabled, the setuid/setgid bits on scripts are currently
6130 useless.  It is possible for $package to detect those bits and emulate
6131 setuid/setgid in a secure fashion.  This emulation will only work if
6132 setuid scripts have been disabled in your kernel.
6133
6134 EOM
6135         case "$d_dosuid" in
6136         "$define") dflt=y ;;
6137         *) dflt=n ;;
6138         esac
6139         rp="Do you want to do setuid/setgid emulation?"
6140         . ./myread
6141         case "$ans" in
6142         [yY]*)  val="$define";;
6143         *)      val="$undef";;
6144         esac
6145         ;;
6146 esac
6147 set d_dosuid
6148 eval $setvar
6149
6150 : see if this is a malloc.h system
6151 : we want a real compile instead of Inhdr because some systems have a
6152 : malloc.h that just gives a compile error saying to use stdlib.h instead
6153 echo " "
6154 $cat >try.c <<EOCP
6155 #include <stdlib.h>
6156 #include <malloc.h>
6157 int main () { return 0; }
6158 EOCP
6159 set try
6160 if eval $compile; then
6161     echo "<malloc.h> found." >&4
6162     val="$define"
6163 else
6164     echo "<malloc.h> NOT found." >&4
6165     val="$undef"
6166 fi
6167 $rm -f try.c try
6168 set i_malloc
6169 eval $setvar
6170
6171 : check for void type
6172 echo " "
6173 echo "Checking to see how well your C compiler groks the void type..." >&4
6174 case "$voidflags" in
6175 '')
6176         $cat >try.c <<EOCP
6177 #$i_stdlib I_STDLIB
6178 #ifdef I_STDLIB
6179 #include <stdlib.h>
6180 #endif
6181 #if TRY & 1
6182 void sub() {
6183 #else
6184 sub() {
6185 #endif
6186         extern void moo();      /* function returning void */
6187         void (*goo)();          /* ptr to func returning void */
6188 #if TRY & 8
6189         void *hue;              /* generic ptr */
6190 #endif
6191 #if TRY & 2
6192         void (*foo[10])();
6193 #endif
6194
6195 #if TRY & 4
6196         if(goo == moo) {
6197                 exit(0);
6198         }
6199 #endif
6200         exit(0);
6201 }
6202 int main() { sub(); }
6203 EOCP
6204         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6205                 voidflags=$defvoidused
6206         echo "Good.  It appears to support void to the level $package wants.">&4
6207                 if $contains warning .out >/dev/null 2>&1; then
6208                         echo "However, you might get some warnings that look like this:"
6209                         $cat .out
6210                 fi
6211         else
6212 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6213                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6214                         echo "It supports 1..."
6215                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6216                                 echo "It also supports 2..."
6217                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6218                                         voidflags=7
6219                                         echo "And it supports 4 but not 8 definitely."
6220                                 else
6221                                         echo "It doesn't support 4..."
6222                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6223                                                 voidflags=11
6224                                                 echo "But it supports 8."
6225                                         else
6226                                                 voidflags=3
6227                                                 echo "Neither does it support 8."
6228                                         fi
6229                                 fi
6230                         else
6231                                 echo "It does not support 2..."
6232                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6233                                         voidflags=13
6234                                         echo "But it supports 4 and 8."
6235                                 else
6236                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6237                                                 voidflags=5
6238                                                 echo "And it supports 4 but has not heard about 8."
6239                                         else
6240                                                 echo "However it supports 8 but not 4."
6241                                         fi
6242                                 fi
6243                         fi
6244                 else
6245                         echo "There is no support at all for void."
6246                         voidflags=0
6247                 fi
6248         fi
6249 esac
6250 case "$voidflags" in
6251 "$defvoidused") ;;
6252 *)      $cat >&4 <<'EOM'
6253   Support flag bits are:
6254     1: basic void declarations.
6255     2: arrays of pointers to functions returning void.
6256     4: operations between pointers to and addresses of void functions.
6257     8: generic void pointers.
6258 EOM
6259         dflt="$voidflags";
6260         rp="Your void support flags add up to what?"
6261         . ./myread
6262         voidflags="$ans"
6263         ;;
6264 esac
6265 $rm -f try.* .out
6266
6267 : check for length of pointer
6268 echo " "
6269 case "$ptrsize" in
6270 '')
6271         echo "Checking to see how big your pointers are..." >&4
6272         if test "$voidflags" -gt 7; then
6273                 echo '#define VOID_PTR char *' > try.c
6274         else
6275                 echo '#define VOID_PTR void *' > try.c
6276         fi
6277         $cat >>try.c <<EOCP
6278 #include <stdio.h>
6279 #$i_stdlib I_STDLIB
6280 #ifdef I_STDLIB
6281 #include <stdlib.h>
6282 #endif
6283 int main()
6284 {
6285     printf("%d\n", (int)sizeof(VOID_PTR));
6286     exit(0);
6287 }
6288 EOCP
6289         set try
6290         if eval $compile_ok; then
6291                 ptrsize=`$run ./try`
6292                 echo "Your pointers are $ptrsize bytes long."
6293         else
6294                 dflt='4'
6295                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6296                 rp="What is the size of a pointer (in bytes)?"
6297                 . ./myread
6298                 ptrsize="$ans"
6299         fi
6300         ;;
6301 esac
6302 $rm -f try.c try
6303 case "$use64bitall" in
6304 "$define"|true|[yY]*)
6305         case "$ptrsize" in
6306         4)      cat <<EOM >&4
6307
6308 *** You have chosen a maximally 64-bit build,
6309 *** but your pointers are only 4 bytes wide.
6310 *** Please rerun Configure without -Duse64bitall.
6311 EOM
6312                 case "$d_quad" in
6313                 define)
6314                         cat <<EOM >&4
6315 *** Since you have quads, you could possibly try with -Duse64bitint.
6316 EOM
6317                         ;;
6318                 esac
6319                 cat <<EOM >&4
6320 *** Cannot continue, aborting.
6321
6322 EOM
6323
6324                 exit 1
6325                 ;;
6326         esac
6327         ;;
6328 esac
6329
6330
6331 : determine whether to use malloc wrapping
6332 echo " "
6333 case "$usemallocwrap" in
6334 [yY]*|true|$define)     dflt='y' ;;
6335 [nN]*|false|$undef)     dflt='n' ;;
6336 *)      case "$usedevel" in
6337         [yY]*|true|$define)     dflt='y' ;;
6338         *) dflt='n' ;;
6339         esac
6340         ;;
6341 esac
6342 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6343 . ./myread
6344 usemallocwrap="$ans"
6345 case "$ans" in
6346 y*|true)
6347         usemallocwrap="$define" ;;
6348 *)
6349         usemallocwrap="$undef" ;;
6350 esac
6351
6352 : determine which malloc to compile in
6353 echo " "
6354 case "$usemymalloc" in
6355 [yY]*|true|$define)     dflt='y' ;;
6356 [nN]*|false|$undef)     dflt='n' ;;
6357 *)      case "$ptrsize" in
6358         4) dflt='y' ;;
6359         *) dflt='n' ;;
6360         esac
6361         ;;
6362 esac
6363 rp="Do you wish to attempt to use the malloc that comes with $package?"
6364 . ./myread
6365 usemymalloc="$ans"
6366 case "$ans" in
6367 y*|true)
6368         usemymalloc='y'
6369         mallocsrc='malloc.c'
6370         mallocobj="malloc$_o"
6371         d_mymalloc="$define"
6372         case "$libs" in
6373         *-lmalloc*)
6374                 : Remove malloc from list of libraries to use
6375                 echo "Removing unneeded -lmalloc from library list" >&4
6376                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6377                 shift
6378                 libs="$*"
6379                 echo "libs = $libs" >&4
6380                 ;;
6381         esac
6382         ;;
6383 *)
6384         usemymalloc='n'
6385         mallocsrc=''
6386         mallocobj=''
6387         d_mymalloc="$undef"
6388         ;;
6389 esac
6390
6391 : compute the return types of malloc and free
6392 echo " "
6393 $cat >malloc.c <<END
6394 #$i_malloc I_MALLOC
6395 #$i_stdlib I_STDLIB
6396 #include <stdio.h>
6397 #include <sys/types.h>
6398 #ifdef I_MALLOC
6399 #include <malloc.h>
6400 #endif
6401 #ifdef I_STDLIB
6402 #include <stdlib.h>
6403 #endif
6404 #ifdef TRY_MALLOC
6405 void *malloc();
6406 #endif
6407 #ifdef TRY_FREE
6408 void free();
6409 #endif
6410 END
6411 case "$malloctype" in
6412 '')
6413         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6414                 malloctype='void *'
6415         else
6416                 malloctype='char *'
6417         fi
6418         ;;
6419 esac
6420 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6421
6422 case "$freetype" in
6423 '')
6424         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6425                 freetype='void'
6426         else
6427                 freetype='int'
6428         fi
6429         ;;
6430 esac
6431 echo "Your system uses $freetype free(), it would seem." >&4
6432 $rm -f malloc.[co]
6433 $cat <<EOM
6434
6435 After $package is installed, you may wish to install various
6436 add-on modules and utilities.  Typically, these add-ons will
6437 be installed under $prefix with the rest
6438 of this package.  However, you may wish to install such add-ons
6439 elsewhere under a different prefix.
6440
6441 If you do not wish to put everything under a single prefix, that's
6442 ok.  You will be prompted for the individual locations; this siteprefix
6443 is only used to suggest the defaults.
6444
6445 The default should be fine for most people.
6446
6447 EOM
6448 fn=d~+
6449 rp='Installation prefix to use for add-on modules and utilities?'
6450 : XXX Here might be another good place for an installstyle setting.
6451 case "$siteprefix" in
6452 '') dflt=$prefix ;;
6453 *)  dflt=$siteprefix ;;
6454 esac
6455 . ./getfile
6456 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6457 oldsiteprefix=''
6458 case "$siteprefix" in
6459 '') ;;
6460 *)      case "$ans" in
6461         "$prefix") ;;
6462         *) oldsiteprefix="$prefix";;
6463         esac
6464         ;;
6465 esac
6466 siteprefix="$ans"
6467 siteprefixexp="$ansexp"
6468
6469 : determine where site specific libraries go.
6470 : Usual default is /usr/local/lib/perl5/site_perl/$version
6471 : The default "style" setting is made in installstyle.U
6472 : XXX No longer works with Prefixit stuff.
6473 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6474 case "$sitelib" in
6475 '') case "$installstyle" in
6476         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6477         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6478         esac
6479         ;;
6480 *)      dflt="$sitelib"
6481         ;;
6482 esac
6483 $cat <<EOM
6484
6485 The installation process will create a directory for
6486 site-specific extensions and modules.  Most users find it convenient
6487 to place all site-specific files in this directory rather than in the
6488 main distribution directory.
6489
6490 EOM
6491 fn=d~+
6492 rp='Pathname for the site-specific library files?'
6493 . ./getfile
6494 sitelib="$ans"
6495 sitelibexp="$ansexp"
6496 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6497 : Change installation prefix, if necessary.
6498 if $test X"$prefix" != X"$installprefix"; then
6499         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6500 else
6501         installsitelib="$sitelibexp"
6502 fi
6503
6504 : determine where site specific architecture-dependent libraries go.
6505 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6506 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6507 : sitelib may have an optional trailing /share.
6508 case "$sitearch" in
6509 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6510         dflt="$dflt/$archname"
6511         ;;
6512 *)      dflt="$sitearch"
6513         ;;
6514 esac
6515 set sitearch sitearch none
6516 eval $prefixit
6517 $cat <<EOM
6518
6519 The installation process will also create a directory for
6520 architecture-dependent site-specific extensions and modules.
6521
6522 EOM
6523 fn=d~+
6524 rp='Pathname for the site-specific architecture-dependent library files?'
6525 . ./getfile
6526 sitearch="$ans"
6527 sitearchexp="$ansexp"
6528 : Change installation prefix, if necessary.
6529 if $test X"$prefix" != X"$installprefix"; then
6530         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6531 else
6532         installsitearch="$sitearchexp"
6533 fi
6534
6535 $cat <<EOM
6536
6537 The installation process will also create a directory for
6538 vendor-supplied add-ons.  Vendors who supply perl with their system
6539 may find it convenient to place all vendor-supplied files in this
6540 directory rather than in the main distribution directory.  This will
6541 ease upgrades between binary-compatible maintenance versions of perl.
6542
6543 Of course you may also use these directories in whatever way you see
6544 fit.  For example, you might use them to access modules shared over a
6545 company-wide network.
6546
6547 The default answer should be fine for most people.
6548 This causes further questions about vendor add-ons to be skipped
6549 and no vendor-specific directories will be configured for perl.
6550
6551 EOM
6552 rp='Do you want to configure vendor-specific add-on directories?'
6553 case "$usevendorprefix" in
6554 define|true|[yY]*) dflt=y ;;
6555 *)      : User may have set vendorprefix directly on Configure command line.
6556         case "$vendorprefix" in
6557         ''|' ') dflt=n ;;
6558         *)      dflt=y ;;
6559         esac
6560         ;;
6561 esac
6562 . ./myread
6563 case "$ans" in
6564 [yY]*)  fn=d~+
6565         rp='Installation prefix to use for vendor-supplied add-ons?'
6566         case "$vendorprefix" in
6567         '') dflt='' ;;
6568         *)  dflt=$vendorprefix ;;
6569         esac
6570         . ./getfile
6571         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6572         oldvendorprefix=''
6573         case "$vendorprefix" in
6574         '') ;;
6575         *)      case "$ans" in
6576                 "$prefix") ;;
6577                 *) oldvendorprefix="$prefix";;
6578                 esac
6579                 ;;
6580         esac
6581         usevendorprefix="$define"
6582         vendorprefix="$ans"
6583         vendorprefixexp="$ansexp"
6584         ;;
6585 *)      usevendorprefix="$undef"
6586         vendorprefix=''
6587         vendorprefixexp=''
6588         ;;
6589 esac
6590
6591 case "$vendorprefix" in
6592 '')     d_vendorlib="$undef"
6593         vendorlib=''
6594         vendorlibexp=''
6595         ;;
6596 *)      d_vendorlib="$define"
6597         : determine where vendor-supplied modules go.
6598         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6599         case "$vendorlib" in
6600         '')
6601                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6602                 case "$installstyle" in
6603                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6604                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6605                 esac
6606                 ;;
6607         *)      dflt="$vendorlib"
6608                 ;;
6609         esac
6610         fn=d~+
6611         rp='Pathname for the vendor-supplied library files?'
6612         . ./getfile
6613         vendorlib="$ans"
6614         vendorlibexp="$ansexp"
6615         ;;
6616 esac
6617 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6618 : Change installation prefix, if necessary.
6619 if $test X"$prefix" != X"$installprefix"; then
6620         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6621 else
6622         installvendorlib="$vendorlibexp"
6623 fi
6624
6625 case "$vendorprefix" in
6626 '')     d_vendorarch="$undef"
6627         vendorarch=''
6628         vendorarchexp=''
6629         ;;
6630 *)      d_vendorarch="$define"
6631         : determine where vendor-supplied architecture-dependent libraries go.
6632         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6633         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6634         : vendorlib may have an optional trailing /share.
6635         case "$vendorarch" in
6636         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6637                 dflt="$dflt/$archname"
6638                 ;;
6639         *)      dflt="$vendorarch" ;;
6640         esac
6641         fn=d~+
6642         rp='Pathname for vendor-supplied architecture-dependent files?'
6643         . ./getfile
6644         vendorarch="$ans"
6645         vendorarchexp="$ansexp"
6646         ;;
6647 esac
6648 : Change installation prefix, if necessary.
6649 if $test X"$prefix" != X"$installprefix"; then
6650         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6651 else
6652         installvendorarch="$vendorarchexp"
6653 fi
6654
6655 : Final catch-all directories to search
6656 $cat <<EOM
6657
6658 Lastly, you can have perl look in other directories for extensions and
6659 modules in addition to those already specified.
6660 These directories will be searched after 
6661         $sitearch 
6662         $sitelib 
6663 EOM
6664 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6665 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6666 echo ' '
6667 case "$otherlibdirs" in
6668 ''|' ') dflt='none' ;;
6669 *)      dflt="$otherlibdirs" ;;
6670 esac
6671 $cat <<EOM
6672 Enter a colon-separated set of extra paths to include in perl's @INC
6673 search path, or enter 'none' for no extra paths.
6674
6675 EOM
6676
6677 rp='Colon-separated list of additional directories for perl to search?'
6678 . ./myread
6679 case "$ans" in
6680 ' '|''|none)    otherlibdirs=' ' ;;     
6681 *)      otherlibdirs="$ans" ;;
6682 esac
6683 case "$otherlibdirs" in
6684 ' ') val=$undef ;;
6685 *)      val=$define ;;
6686 esac
6687 set d_perl_otherlibdirs
6688 eval $setvar
6689
6690 : Cruising for prototypes
6691 echo " "
6692 echo "Checking out function prototypes..." >&4
6693 $cat >prototype.c <<EOCP
6694 #$i_stdlib I_STDLIB
6695 #ifdef I_STDLIB
6696 #include <stdlib.h>
6697 #endif
6698 int main(int argc, char *argv[]) {
6699         exit(0);}
6700 EOCP
6701 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6702         echo "Your C compiler appears to support function prototypes."
6703         val="$define"
6704 else
6705         echo "Your C compiler doesn't seem to understand function prototypes."
6706         val="$undef"
6707 fi
6708 set prototype
6709 eval $setvar
6710 $rm -f prototype*
6711
6712 case "$prototype" in
6713 "$define") ;;
6714 *)      ansi2knr='ansi2knr'
6715         echo " "
6716         cat <<EOM >&4
6717
6718 $me:  FATAL ERROR:
6719 This version of $package can only be compiled by a compiler that 
6720 understands function prototypes.  Unfortunately, your C compiler 
6721         $cc $ccflags
6722 doesn't seem to understand them.  Sorry about that.
6723
6724 If GNU cc is available for your system, perhaps you could try that instead.  
6725
6726 Eventually, we hope to support building Perl with pre-ANSI compilers.
6727 If you would like to help in that effort, please contact <perlbug@perl.org>.
6728
6729 Aborting Configure now.
6730 EOM
6731         exit 2
6732         ;;
6733 esac
6734
6735 : determine where public executables go
6736 echo " "
6737 set dflt bin bin
6738 eval $prefixit
6739 fn=d~
6740 rp='Pathname where the public executables will reside?'
6741 . ./getfile
6742 if $test "X$ansexp" != "X$binexp"; then
6743         installbin=''
6744 fi
6745 bin="$ans"
6746 binexp="$ansexp"
6747 : Change installation prefix, if necessary.
6748 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6749 if $test X"$prefix" != X"$installprefix"; then
6750         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6751 else
6752         installbin="$binexp"
6753 fi
6754
6755 echo " "
6756 case "$extras" in
6757 '') dflt='n';;
6758 *) dflt='y';;
6759 esac
6760 cat <<EOM
6761 Perl can be built with extra modules or bundles of modules which
6762 will be fetched from the CPAN and installed alongside Perl.
6763
6764 Notice that you will need access to the CPAN; either via the Internet,
6765 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6766 be asked later to configure the CPAN.pm module which will in turn do
6767 the installation of the rest of the extra modules or bundles.)
6768
6769 Notice also that if the modules require any external software such as
6770 libraries and headers (the libz library and the zlib.h header for the
6771 Compress::Zlib module, for example) you MUST have any such software
6772 already installed, this configuration process will NOT install such
6773 things for you.
6774
6775 If this doesn't make any sense to you, just accept the default '$dflt'.
6776 EOM
6777 rp='Install any extra modules (y or n)?'
6778 . ./myread
6779 case "$ans" in
6780 y|Y)
6781         cat <<EOM
6782
6783 Please list any extra modules or bundles to be installed from CPAN,
6784 with spaces between the names.  The names can be in any format the
6785 'install' command of CPAN.pm will understand.  (Answer 'none',
6786 without the quotes, to install no extra modules or bundles.)
6787 EOM
6788         rp='Extras?'
6789         dflt="$extras"
6790         . ./myread
6791         extras="$ans"
6792 esac
6793 case "$extras" in
6794 ''|'none')
6795         val=''
6796         $rm -f ../extras.lst
6797         ;;
6798 *)      echo "(Saving the list of extras for later...)"
6799         echo "$extras" > ../extras.lst
6800         val="'$extras'"
6801         ;;
6802 esac
6803 set extras
6804 eval $setvar
6805 echo " "
6806
6807 : determine where html pages for programs go
6808 set html1dir html1dir none
6809 eval $prefixit
6810 $cat <<EOM
6811
6812 If you wish to install html files for programs in $spackage, indicate 
6813 the appropriate directory here.  To skip installing html files,
6814 answer "none".
6815 EOM
6816 case "$html1dir" in
6817 ''|none|$undef|' ') dflt=none ;;
6818 *) dflt=$html1dir ;;
6819 esac
6820 fn=dn+~
6821 rp="Directory for the main $spackage html pages?"
6822 . ./getfile
6823 html1dir="$ans"
6824 html1direxp="$ansexp"
6825 : Use ' ' for none so value is preserved next time through Configure
6826 $test X"$html1dir" = "X" && html1dir=' '
6827 : Change installation prefix, if necessary.
6828 if $test X"$prefix" != X"$installprefix"; then
6829         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6830 else
6831         installhtml1dir="$html1direxp"
6832 fi
6833
6834 : determine where html pages for libraries and modules go
6835 set html3dir html3dir none
6836 eval $prefixit
6837 $cat <<EOM
6838
6839 If you wish to install html files for modules associated with $spackage,
6840 indicate the appropriate directory here.  To skip installing html files,
6841 answer "none".
6842 EOM
6843 : There is no obvious default.  If they have specified html1dir, then
6844 : try to key off that, possibly changing .../html1 into .../html3.
6845 case "$html3dir" in
6846 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6847 *) dflt=$html3dir ;;
6848 esac
6849 fn=dn+~
6850 rp="Directory for the $spackage module html pages?"
6851 . ./getfile
6852 html3dir="$ans"
6853 html3direxp="$ansexp"
6854 : Use ' ' for none so value is preserved next time through Configure
6855 $test X"$html3dir" = "X" && html3dir=' '
6856 : Change installation prefix, if necessary.
6857 if $test X"$prefix" != X"$installprefix"; then
6858         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6859 else
6860         installhtml3dir="$html3direxp"
6861 fi
6862
6863 : Find perl5.005 or later.
6864 echo "Looking for a previously installed perl5.005 or later... "
6865 case "$perl5" in
6866 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6867                 : Check if this perl is recent and can load a simple module
6868                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6869                         perl5=$tdir/perl
6870                         break;
6871                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6872                         perl5=$tdir/perl5
6873                         break;
6874                 fi
6875         done
6876         ;;
6877 *)      perl5="$perl5"
6878         ;;
6879 esac
6880 case "$perl5" in
6881 '')     echo "None found.  That's ok.";;
6882 *)      echo "Using $perl5." ;;
6883 esac
6884
6885 : Determine list of previous versions to include in @INC
6886 $cat > getverlist <<EOPL
6887 #!$perl5 -w
6888 use File::Basename;
6889 \$api_versionstring = "$api_versionstring";
6890 \$version = "$version";
6891 \$stem = "$sitelib_stem";
6892 \$archname = "$archname";
6893 EOPL
6894         $cat >> getverlist <<'EOPL'
6895 # Can't have leading @ because metaconfig interprets it as a command!
6896 ;@inc_version_list=();
6897 # XXX Redo to do opendir/readdir? 
6898 if (-d $stem) {
6899     chdir($stem);
6900     ;@candidates = glob("5.*");
6901 }
6902 else {
6903     ;@candidates = ();
6904 }
6905
6906 # XXX ToDo:  These comparisons must be reworked when two-digit
6907 # subversions come along, so that 5.7.10 compares as greater than
6908 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6909 # widespread that we can use the built-in version vectors rather
6910 # than reinventing them here.  For 5.6.0, however, we must
6911 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6912 foreach $d (@candidates) {
6913     if ($d lt $version) {
6914         if ($d ge $api_versionstring) {
6915             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6916         }
6917         elsif ($d ge "5.005") {
6918             unshift(@inc_version_list, grep { -d } $d);
6919         }
6920     }
6921     else {
6922         # Skip newer version.  I.e. don't look in
6923         # 5.7.0 if we're installing 5.6.1.
6924     }
6925 }
6926
6927 if (@inc_version_list) {
6928     print join(' ', @inc_version_list);
6929 }
6930 else {
6931     # Blank space to preserve value for next Configure run.
6932     print " ";
6933 }
6934 EOPL
6935 chmod +x getverlist
6936 case "$inc_version_list" in
6937 '')     if test -x "$perl5$exe_ext"; then
6938                 dflt=`$perl5 getverlist`
6939         else
6940                 dflt='none'
6941         fi
6942         ;;
6943 $undef) dflt='none' ;;
6944 *)  eval dflt=\"$inc_version_list\" ;;
6945 esac
6946 case "$dflt" in
6947 ''|' ') dflt=none ;;
6948 esac
6949 case "$dflt" in
6950 5.005) dflt=none ;;
6951 esac
6952 $cat <<EOM
6953
6954 In order to ease the process of upgrading, this version of perl 
6955 can be configured to use modules built and installed with earlier 
6956 versions of perl that were installed under $prefix.  Specify here
6957 the list of earlier versions that this version of perl should check.
6958 If Configure detected no earlier versions of perl installed under
6959 $prefix, then the list will be empty.  Answer 'none' to tell perl
6960 to not search earlier versions.
6961
6962 The default should almost always be sensible, so if you're not sure,
6963 just accept the default.
6964 EOM
6965
6966 rp='List of earlier versions to include in @INC?'
6967 . ./myread
6968 case "$ans" in
6969 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6970 *) inc_version_list="$ans" ;;
6971 esac
6972 case "$inc_version_list" in
6973 ''|' ') 
6974         inc_version_list_init='0';;
6975 *)      inc_version_list_init=`echo $inc_version_list |
6976                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6977         ;;
6978 esac
6979 $rm -f getverlist
6980
6981 : determine whether to install perl also as /usr/bin/perl
6982
6983 echo " "
6984 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6985         $cat <<EOM
6986 Many scripts expect perl to be installed as /usr/bin/perl.
6987
6988 If you want to, I can install the perl you are about to compile
6989 as /usr/bin/perl (in addition to $bin/perl).
6990 EOM
6991         if test -f /usr/bin/perl; then
6992             $cat <<EOM
6993
6994 However, please note that because you already have a /usr/bin/perl,
6995 overwriting that with a new Perl would very probably cause problems.
6996 Therefore I'm assuming you don't want to do that (unless you insist).
6997
6998 EOM
6999             case "$installusrbinperl" in
7000             "$define"|[yY]*)    dflt='y';;
7001             *)                  dflt='n';;
7002             esac
7003         else
7004             $cat <<EOM
7005
7006 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7007
7008 EOM
7009             case "$installusrbinperl" in
7010             "$undef"|[nN]*)     dflt='n';;
7011             *)                  dflt='y';;
7012             esac
7013         fi
7014         rp="Do you want to install perl as /usr/bin/perl?"
7015         . ./myread
7016         case "$ans" in
7017         [yY]*)  val="$define";;
7018         *)      val="$undef" ;;
7019         esac
7020 else
7021         val="$undef"
7022 fi
7023 set installusrbinperl
7024 eval $setvar
7025
7026 echo " "
7027 echo "Checking for GNU C Library..." >&4
7028 cat >try.c <<'EOCP'
7029 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7030    alone are insufficient to distinguish different versions, such as
7031    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7032    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7033 */
7034 #include <stdio.h>
7035 int main(void)
7036 {
7037 #ifdef __GLIBC__
7038 #   ifdef __GLIBC_MINOR__
7039 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7040 #           include <gnu/libc-version.h>
7041             printf("%s\n",  gnu_get_libc_version());
7042 #       else
7043             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7044 #       endif
7045 #   else
7046         printf("%d\n",  __GLIBC__);
7047 #   endif
7048     return 0;
7049 #else
7050     return 1;
7051 #endif
7052 }
7053 EOCP
7054 set try
7055 if eval $compile_ok && $run ./try > glibc.ver; then
7056         val="$define"
7057         gnulibc_version=`$cat glibc.ver`
7058         echo "You are using the GNU C Library version $gnulibc_version"
7059 else
7060         val="$undef"
7061         gnulibc_version=''
7062         echo "You are not using the GNU C Library"
7063 fi
7064 $rm -f try try.* glibc.ver
7065 set d_gnulibc
7066 eval $setvar
7067
7068 : see if nm is to be used to determine whether a symbol is defined or not
7069 case "$usenm" in
7070 '')
7071         dflt=''
7072         case "$d_gnulibc" in
7073         "$define")
7074                 echo " "
7075                 echo "nm probably won't work on the GNU C Library." >&4
7076                 dflt=n
7077                 ;;
7078         esac
7079         case "$dflt" in
7080         '') 
7081                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7082                         echo " "
7083                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7084                         echo "'nm' won't be sufficient on this sytem." >&4
7085                         dflt=n
7086                 fi
7087                 ;;
7088         esac
7089         case "$dflt" in
7090         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7091                 if $test $dflt -gt 20; then
7092                         dflt=y
7093                 else
7094                         dflt=n
7095                 fi
7096                 ;;
7097         esac
7098         ;;
7099 *)
7100         case "$usenm" in
7101         true|$define) dflt=y;;
7102         *) dflt=n;;
7103         esac
7104         ;;
7105 esac
7106 $cat <<EOM
7107
7108 I can use $nm to extract the symbols from your C libraries. This
7109 is a time consuming task which may generate huge output on the disk (up
7110 to 3 megabytes) but that should make the symbols extraction faster. The
7111 alternative is to skip the 'nm' extraction part and to compile a small
7112 test program instead to determine whether each symbol is present. If
7113 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7114 this may be the best solution.
7115
7116 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7117
7118 EOM
7119 rp="Shall I use $nm to extract C symbols from the libraries?"
7120 . ./myread
7121 case "$ans" in
7122 [Nn]*) usenm=false;;
7123 *) usenm=true;;
7124 esac
7125
7126 runnm=$usenm
7127 case "$reuseval" in
7128 true) runnm=false;;
7129 esac
7130
7131 : nm options which may be necessary
7132 case "$nm_opt" in
7133 '') if $test -f /mach_boot; then
7134                 nm_opt=''       # Mach
7135         elif $test -d /usr/ccs/lib; then
7136                 nm_opt='-p'     # Solaris (and SunOS?)
7137         elif $test -f /dgux; then
7138                 nm_opt='-p'     # DG-UX
7139         elif $test -f /lib64/rld; then
7140                 nm_opt='-p'     # 64-bit Irix
7141         else
7142                 nm_opt=''
7143         fi;;
7144 esac
7145
7146 : nm options which may be necessary for shared libraries but illegal
7147 : for archive libraries.  Thank you, Linux.
7148 case "$nm_so_opt" in
7149 '')     case "$myuname" in
7150         *linux*|gnu*)
7151                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7152                         nm_so_opt='--dynamic'
7153                 fi
7154                 ;;
7155         esac
7156         ;;
7157 esac
7158
7159 case "$runnm" in
7160 true)
7161 : get list of predefined functions in a handy place
7162 echo " "
7163 case "$libc" in
7164 '') libc=unknown
7165         case "$libs" in
7166         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7167         esac
7168         ;;
7169 esac
7170 case "$libs" in
7171 '') ;;
7172 *)  for thislib in $libs; do
7173         case "$thislib" in
7174         -lc|-lc_s)
7175                 : Handle C library specially below.
7176                 ;;
7177         -l*)
7178                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7179                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7180                         :
7181                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7182                         :
7183                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7184                         :
7185                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7186                         :
7187                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7188                         :
7189                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7190                         :
7191                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7192                         :
7193                 else
7194                         try=''
7195                 fi
7196                 libnames="$libnames $try"
7197                 ;;
7198         *) libnames="$libnames $thislib" ;;
7199         esac
7200         done
7201         ;;
7202 esac
7203 xxx=normal
7204 case "$libc" in
7205 unknown)
7206         set /lib/libc.$so
7207         for xxx in $libpth; do
7208                 $test -r $1 || set $xxx/libc.$so
7209                 : The messy sed command sorts on library version numbers.
7210                 $test -r $1 || \
7211                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7212                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7213                                 h
7214                                 s/[0-9][0-9]*/0000&/g
7215                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7216                                 G
7217                                 s/\n/ /' | \
7218                          $sort | $sed -e 's/^.* //'`
7219                 eval set \$$#
7220         done
7221         $test -r $1 || set /usr/ccs/lib/libc.$so
7222         $test -r $1 || set /lib/libsys_s$_a
7223         ;;
7224 *)
7225         set blurfl
7226         ;;
7227 esac
7228 if $test -r "$1"; then
7229         echo "Your (shared) C library seems to be in $1."
7230         libc="$1"
7231 elif $test -r /lib/libc && $test -r /lib/clib; then
7232         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7233         xxx=apollo
7234         libc='/lib/clib /lib/libc'
7235         if $test -r /lib/syslib; then
7236                 echo "(Your math library is in /lib/syslib.)"
7237                 libc="$libc /lib/syslib"
7238         fi
7239 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7240         echo "Your C library seems to be in $libc, as you said before."
7241 elif $test -r $incpath/usr/lib/libc$_a; then
7242         libc=$incpath/usr/lib/libc$_a;
7243         echo "Your C library seems to be in $libc.  That's fine."
7244 elif $test -r /lib/libc$_a; then
7245         libc=/lib/libc$_a;
7246         echo "Your C library seems to be in $libc.  You're normal."
7247 else
7248         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7249                 :
7250         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7251                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7252         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7253                 :
7254         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7255                 :
7256         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7257                 :
7258         else
7259                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7260         fi
7261         if $test -r "$tans"; then
7262                 echo "Your C library seems to be in $tans, of all places."
7263                 libc=$tans
7264         else
7265                 libc='blurfl'
7266         fi
7267 fi
7268 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7269         dflt="$libc"
7270         cat <<EOM
7271
7272 If the guess above is wrong (which it might be if you're using a strange
7273 compiler, or your machine supports multiple models), you can override it here.
7274
7275 EOM
7276 else
7277         dflt=''
7278         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7279         cat >&4 <<EOM
7280 I can't seem to find your C library.  I've looked in the following places:
7281
7282 EOM
7283         $sed 's/^/      /' libpath
7284         cat <<EOM
7285
7286 None of these seems to contain your C library. I need to get its name...
7287
7288 EOM
7289 fi
7290 fn=f
7291 rp='Where is your C library?'
7292 . ./getfile
7293 libc="$ans"
7294
7295 echo " "
7296 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7297 set X `cat libnames`
7298 shift
7299 xxx=files
7300 case $# in 1) xxx=file; esac
7301 echo "Extracting names from the following $xxx for later perusal:" >&4
7302 echo " "
7303 $sed 's/^/      /' libnames >&4
7304 echo " "
7305 $echo $n "This may take a while...$c" >&4
7306
7307 for file in $*; do
7308         case $file in
7309         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7310         *) $nm $nm_opt $file 2>/dev/null;;
7311         esac
7312 done >libc.tmp
7313
7314 $echo $n ".$c"
7315 $grep fprintf libc.tmp > libc.ptf
7316 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7317 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7318 xxx='[ADTSIW]'
7319 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7320         eval $xscan;\
7321         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7322                 eval $xrun
7323 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7324         eval $xscan;\
7325         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7326                 eval $xrun
7327 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7328         eval $xscan;\
7329         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7330                 eval $xrun
7331 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7332         eval $xscan;\
7333         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7334                 eval $xrun
7335 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7336         eval $xscan;\
7337         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7338                 eval $xrun
7339 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7340         eval $xscan;\
7341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342                 eval $xrun
7343 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7344                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7345         eval $xscan;\
7346         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7347                 eval $xrun
7348 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7349         eval $xscan;\
7350         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7351                 eval $xrun
7352 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7353         eval $xscan;\
7354         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355                 eval $xrun
7356 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7357         eval $xscan;\
7358         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7359                 eval $xrun
7360 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7361         eval $xscan;\
7362         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7363                 eval $xrun
7364 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7365         eval $xscan;\
7366         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7367                 eval $xrun
7368 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7369         eval $xscan;\
7370         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7371                 eval $xrun
7372 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7373         eval $xscan;\
7374         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7375                 eval $xrun
7376 else
7377         $nm -p $* 2>/dev/null >libc.tmp
7378         $grep fprintf libc.tmp > libc.ptf
7379         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7380                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7381         then
7382                 nm_opt='-p'
7383                 eval $xrun
7384         else
7385                 echo " "
7386                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7387                 com=''
7388                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7389                         for thisname in $libnames $libc; do
7390                                 $ar t $thisname >>libc.tmp
7391                         done
7392                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7393                         echo "Ok." >&4
7394                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7395                         # Repeat libc to extract forwarders to DLL entries too
7396                         for thisname in $libnames $libc; do
7397                                 $ar tv $thisname >>libc.tmp
7398                                 # Revision 50 of EMX has bug in $ar.
7399                                 # it will not extract forwarders to DLL entries
7400                                 # Use emximp which will extract exactly them.
7401                                 emximp -o tmp.imp $thisname \
7402                                     2>/dev/null && \
7403                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7404                                     < tmp.imp >>libc.tmp
7405                                 $rm tmp.imp
7406                         done
7407                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7408                         echo "Ok." >&4
7409                 else
7410                         echo "$ar didn't seem to work right." >&4
7411                         echo "Maybe this is a Cray...trying bld instead..." >&4
7412                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7413                         then
7414                                 for thisname in $libnames; do
7415                                         bld t $libnames | \
7416                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7417                                         $ar t $thisname >>libc.tmp
7418                                 done
7419                                 echo "Ok." >&4
7420                         else
7421                                 echo "That didn't work either.  Giving up." >&4
7422                                 exit 1
7423                         fi
7424                 fi
7425         fi
7426 fi
7427 nm_extract="$com"
7428 case "$PASE" in
7429 define)
7430     echo " "
7431     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7432     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7433     ;;
7434 *)  if $test -f /lib/syscalls.exp; then
7435         echo " "
7436         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7437         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7438     fi
7439     ;;
7440 esac
7441 ;;
7442 esac
7443 $rm -f libnames libpath
7444
7445 : see if dld is available
7446 set dld.h i_dld
7447 eval $inhdr
7448
7449 : is a C symbol defined?
7450 csym='tlook=$1;
7451 case "$3" in
7452 -v) tf=libc.tmp; tdc="";;
7453 -a) tf=libc.tmp; tdc="[]";;
7454 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7455 esac;
7456 tx=yes;
7457 case "$reuseval-$4" in
7458 true-) ;;
7459 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7460 esac;
7461 case "$tx" in
7462 yes)
7463         tval=false;
7464         if $test "$runnm" = true; then
7465                 if $contains $tlook $tf >/dev/null 2>&1; then
7466                         tval=true;
7467                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7468                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7469                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7470                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7471                         $rm -f try$_exe try.c core core.* try.core;
7472                 fi;
7473         else
7474                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7475                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7476                 $rm -f try$_exe try.c;
7477         fi;
7478         ;;
7479 *)
7480         case "$tval" in
7481         $define) tval=true;;
7482         *) tval=false;;
7483         esac;
7484         ;;
7485 esac;
7486 eval "$2=$tval"'
7487
7488 : define an is-in-libc? function
7489 inlibc='echo " "; td=$define; tu=$undef;
7490 sym=$1; var=$2; eval "was=\$$2";
7491 tx=yes;
7492 case "$reuseval$was" in
7493 true) ;;
7494 true*) tx=no;;
7495 esac;
7496 case "$tx" in
7497 yes)
7498         set $sym tres -f;
7499         eval $csym;
7500         case "$tres" in
7501         true)
7502                 echo "$sym() found." >&4;
7503                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7504         *)
7505                 echo "$sym() NOT found." >&4;
7506                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7507         esac;;
7508 *)
7509         case "$was" in
7510         $define) echo "$sym() found." >&4;;
7511         *) echo "$sym() NOT found." >&4;;
7512         esac;;
7513 esac'
7514
7515 : see if dlopen exists
7516 xxx_runnm="$runnm"
7517 runnm=false
7518 set dlopen d_dlopen
7519 eval $inlibc
7520 runnm="$xxx_runnm"
7521
7522 : determine which dynamic loading, if any, to compile in
7523 echo " "
7524 dldir="ext/DynaLoader"
7525 case "$usedl" in
7526 $define|y|true)
7527         dflt='y'
7528         usedl="$define"
7529         ;;
7530 $undef|n|false)
7531         dflt='n'
7532         usedl="$undef"
7533         ;;
7534 *) 
7535         dflt='n'
7536         case "$d_dlopen" in
7537             $define) dflt='y' ;;
7538         esac
7539         case "$i_dld" in
7540             $define) dflt='y' ;;
7541         esac
7542         : Does a dl_xxx.xs file exist for this operating system
7543         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7544         ;;
7545 esac
7546 rp="Do you wish to use dynamic loading?"
7547 . ./myread
7548 usedl="$ans"
7549 case "$ans" in
7550 y*) usedl="$define"
7551         case "$dlsrc" in
7552         '')
7553                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7554                         dflt="$dldir/dl_${osname}.xs"
7555                 elif $test "$d_dlopen" = "$define" ; then
7556                         dflt="$dldir/dl_dlopen.xs"
7557                 elif $test "$i_dld" = "$define" ; then
7558                         dflt="$dldir/dl_dld.xs"
7559                 else
7560                         dflt=''
7561                 fi
7562                 ;;
7563         *)      dflt="$dldir/$dlsrc"
7564                 ;;
7565         esac
7566     echo "The following dynamic loading files are available:"
7567         : Can not go over to $dldir because getfile has path hard-coded in.
7568         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7569         rp="Source file to use for dynamic loading"
7570         fn="fne"
7571         gfpth="$src"
7572         . ./getfile
7573         usedl="$define"
7574         : emulate basename
7575         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7576
7577         $cat << EOM
7578
7579 Some systems may require passing special flags to $cc -c to
7580 compile modules that will be used to create a shared library.
7581 To use no flags, say "none".
7582
7583 EOM
7584     case "$cccdlflags" in
7585     '') case "$gccversion" in
7586                 '') case "$osname" in
7587                         hpux)   dflt='+z' ;;
7588                         next)   dflt='none' ;;
7589                         irix*)  dflt='-KPIC' ;;
7590                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7591                         sunos)  dflt='-pic' ;;
7592                         *)      dflt='none' ;;
7593                     esac
7594                         ;;
7595                 *)  case "$osname" in
7596                         darwin) dflt='none' ;;
7597                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7598                         *)      dflt='-fpic' ;;
7599                     esac ;;
7600             esac ;;
7601         ' ') dflt='none' ;;
7602     *)  dflt="$cccdlflags" ;;
7603     esac
7604     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7605     . ./myread
7606     case "$ans" in
7607     none) cccdlflags=' ' ;;
7608     *) cccdlflags="$ans" ;;
7609     esac
7610
7611     cat << EOM
7612
7613 Some systems use ld to create libraries that can be dynamically loaded,
7614 while other systems (such as those using ELF) use $cc.
7615
7616 EOM
7617         case "$ld" in
7618         '')     $cat >try.c <<EOM
7619 /* Test for whether ELF binaries are produced */
7620 #include <fcntl.h>
7621 #$i_stdlib I_STDLIB
7622 #ifdef I_STDLIB
7623 #include <stdlib.h>
7624 #endif
7625 int main() {
7626         char b[4];
7627         int i = open("a.out",O_RDONLY);
7628         if(i == -1) 
7629                 exit(1); /* fail */
7630         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7631                 exit(0); /* succeed (yes, it's ELF) */
7632         else
7633                 exit(1); /* fail */
7634 }
7635 EOM
7636                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7637                         cat <<EOM
7638 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7639 EOM
7640                         dflt="$cc"
7641                 else
7642                         echo "I'll use ld to build dynamic libraries."
7643                         dflt='ld'
7644                 fi
7645                 rm -f try.c a.out
7646                 ;;
7647         *)      dflt="$ld"
7648                 ;;
7649         esac
7650
7651     rp="What command should be used to create dynamic libraries?"
7652     . ./myread
7653         ld="$ans"
7654
7655     cat << EOM
7656
7657 Some systems may require passing special flags to $ld to create a
7658 library that can be dynamically loaded.  If your ld flags include
7659 -L/other/path options to locate libraries outside your loader's normal
7660 search path, you may need to specify those -L options here as well.  To
7661 use no flags, say "none".
7662
7663 EOM
7664     case "$lddlflags" in
7665     '') case "$osname" in
7666                         beos) dflt='-nostart' ;;
7667                         hpux) dflt='-b';
7668                               case "$gccversion" in
7669                               '') dflt="$dflt +vnocompatwarnings" ;;
7670                               esac
7671                               ;;        
7672                         linux|irix*|gnu*)       dflt='-shared' ;;
7673                         next)  dflt='none' ;;
7674                         solaris) dflt='-G' ;;
7675                         sunos) dflt='-assert nodefinitions' ;;
7676                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7677                 *)     dflt='none' ;;
7678                         esac
7679                         ;;
7680     *) dflt="$lddlflags" ;;
7681     esac
7682
7683         : Try to guess additional flags to pick up local libraries.
7684         : Be careful not to append to a plain 'none'
7685         case "$dflt" in
7686         none) dflt='' ;;
7687         esac
7688         for thisflag in $ldflags; do
7689                 case "$thisflag" in
7690                 -L*|-R*|-Wl,-R*)
7691                         case " $dflt " in
7692                         *" $thisflag "*) ;;
7693                         *) dflt="$dflt $thisflag" ;;
7694                         esac
7695                         ;;
7696                 esac
7697         done
7698
7699         case "$dflt" in
7700         ''|' ') dflt='none' ;;
7701         esac
7702
7703     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7704     . ./myread
7705     case "$ans" in
7706     none) lddlflags=' ' ;;
7707     *) lddlflags="$ans" ;;
7708     esac
7709
7710         cat <<EOM
7711
7712 Some systems may require passing special flags to $cc to indicate that
7713 the resulting executable will use dynamic linking.  To use no flags,
7714 say "none".
7715
7716 EOM
7717     case "$ccdlflags" in
7718     '') case "$osname" in
7719             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7720             next|sunos) dflt='none' ;;
7721             *)          dflt='none' ;;
7722             esac ;;
7723     ' ')  dflt='none' ;;
7724     *)  dflt="$ccdlflags" ;;
7725     esac
7726     rp="Any special flags to pass to $cc to use dynamic linking?"
7727     . ./myread
7728     case "$ans" in
7729     none) ccdlflags=' ' ;;
7730     *) ccdlflags="$ans" ;;
7731     esac
7732     ;;
7733 *)  usedl="$undef"
7734         ld='ld'
7735     dlsrc='dl_none.xs'
7736     lddlflags=''
7737     ccdlflags=''
7738     ;;
7739 esac
7740
7741 also=''
7742 case "$usedl" in
7743 $undef)
7744         # No dynamic loading being used, so don't bother even to prompt.
7745         useshrplib='false'
7746         ;;
7747 *)      case "$useshrplib" in
7748         '')     case "$osname" in
7749                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7750                         dflt=y
7751                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7752                         ;;
7753                 next*)
7754                         case "$osvers" in
7755                         4*)     dflt=y
7756                                 also='Building a shared libperl is needed for MAB support.'
7757                                 ;;
7758                         *)      dflt=n
7759                                 ;;
7760                         esac
7761                         ;;
7762                 *)      dflt=n
7763                         ;;
7764                 esac
7765                 ;;
7766         $define|true|[Yy]*)
7767                 dflt=y
7768                 ;;
7769         *)      dflt=n
7770                 ;;
7771         esac
7772         $cat << EOM
7773
7774 The perl executable is normally obtained by linking perlmain.c with
7775 libperl${_a}, any static extensions (usually just DynaLoader), and
7776 any other libraries needed on this system (such as -lm, etc.).  Since
7777 your system supports dynamic loading, it is probably possible to build
7778 a shared libperl.$so.  If you will have more than one executable linked
7779 to libperl.$so, this will significantly reduce the size of each
7780 executable, but it may have a noticeable effect on performance.  The
7781 default is probably sensible for your system.
7782 $also
7783
7784 EOM
7785         rp="Build a shared libperl.$so (y/n)"
7786         . ./myread
7787         case "$ans" in
7788         true|$define|[Yy]*)
7789                 useshrplib='true'  ;;
7790         *)      useshrplib='false' ;;
7791         esac
7792         ;;
7793 esac
7794
7795 case "$useshrplib" in
7796 true)
7797         case "$libperl" in
7798         '')
7799                 # Figure out a good name for libperl.so.  Since it gets stored in
7800                 # a version-specific architecture-dependent library, the version
7801                 # number isn't really that important, except for making cc/ld happy.
7802                 #
7803                 # A name such as libperl.so.3.1
7804                 majmin="libperl.$so.$patchlevel.$subversion"
7805                 # A name such as libperl.so.301
7806                 majonly=`echo $patchlevel $subversion |
7807                         $awk '{printf "%d%02d", $1, $2}'`
7808                 majonly=libperl.$so.$majonly
7809                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7810                 # rely on figuring it out from the naming of libc.
7811                 case "${osname}${osvers}" in
7812                 next4*)
7813                         dflt=libperl.5.$so
7814                         # XXX How handle the --version stuff for MAB?
7815                         ;;
7816                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7817                         dflt=libperl.$so
7818                         ;;
7819                 cygwin*) # ld links against an importlib
7820                         dflt=libperl$lib_ext
7821                         ;;
7822                 *)      # Try to guess based on whether libc has major.minor.
7823                         case "$libc" in
7824                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7825                         *libc.$so.[0-9]*) dflt=$majonly ;;
7826                         *)      dflt=libperl.$so ;;
7827                         esac
7828                         ;;
7829                 esac
7830                 ;;
7831         *)      dflt=$libperl
7832                 ;;
7833         esac
7834         cat << EOM
7835
7836 I need to select a good name for the shared libperl.  If your system uses
7837 library names with major and minor numbers, then you might want something
7838 like $majmin.  Alternatively, if your system uses a single version
7839 number for shared libraries, then you might want to use $majonly.
7840 Or, your system might be quite happy with a simple libperl.$so.
7841
7842 Since the shared libperl will get installed into a version-specific
7843 architecture-dependent directory, the version number of the shared perl
7844 library probably isn't important, so the default should be o.k.
7845
7846 EOM
7847         rp='What name do you want to give to the shared libperl?'
7848         . ./myread
7849         libperl=$ans
7850         echo "Ok, I'll use $libperl"
7851         ;;
7852 *)
7853         libperl="libperl${_a}"
7854         ;;
7855 esac
7856
7857 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7858 case "$shrpdir" in
7859 '') ;;
7860 *)      $cat >&4 <<EOM
7861 WARNING:  Use of the shrpdir variable for the installation location of
7862 the shared $libperl is not supported.  It was never documented and
7863 will not work in this version.  Let me (perlbug@perl.org)
7864 know of any problems this may cause.
7865
7866 EOM
7867         case "$shrpdir" in
7868         "$archlibexp/CORE")
7869                 $cat >&4 <<EOM
7870 But your current setting of $shrpdir is
7871 the default anyway, so it's harmless.
7872 EOM
7873                 ;;
7874         *)
7875                 $cat >&4 <<EOM
7876 Further, your current attempted setting of $shrpdir
7877 conflicts with the value of $archlibexp/CORE
7878 that installperl will use.
7879 EOM
7880                 ;;
7881         esac
7882         ;;
7883 esac
7884
7885 # How will the perl executable find the installed shared $libperl?
7886 # Add $xxx to ccdlflags.
7887 # If we can't figure out a command-line option, use $shrpenv to
7888 # set env LD_RUN_PATH.  The main perl makefile uses this.
7889 shrpdir=$archlibexp/CORE
7890 xxx=''
7891 tmp_shrpenv=''
7892 if "$useshrplib"; then
7893     case "$osname" in 
7894         aix)
7895                 # We'll set it in Makefile.SH...
7896                 ;;
7897         solaris)
7898                 xxx="-R $shrpdir"
7899                 ;;
7900         freebsd|netbsd|openbsd|interix|dragonfly)
7901                 xxx="-Wl,-R$shrpdir"
7902                 ;;
7903         bsdos|linux|irix*|dec_osf|gnu*)
7904                 xxx="-Wl,-rpath,$shrpdir"
7905                 ;;
7906         next)
7907                 # next doesn't like the default...
7908                 ;;
7909         beos)
7910                 # beos doesn't like the default, either.
7911                 ;;
7912         hpux*)
7913                 # hpux doesn't like the default, either.
7914                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7915                 ;;
7916         *)
7917                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7918                 ;;
7919         esac
7920         case "$xxx" in
7921         '') ;;
7922         *)      
7923                 # Only add $xxx if it isn't already in ccdlflags.
7924                 case " $ccdlflags " in
7925                 *" $xxx "*)     ;;
7926                 *)      ccdlflags="$ccdlflags $xxx"
7927                         cat <<EOM >&4
7928
7929 Adding $xxx to the flags
7930 passed to $ld so that the perl executable will find the 
7931 installed shared $libperl.
7932
7933 EOM
7934                         ;;
7935                 esac
7936                 ;;
7937         esac
7938 fi
7939 # Fix ccdlflags in AIX for building external extensions.
7940 # (For building Perl itself bare -bE:perl.exp is needed,
7941 #  Makefile.SH takes care of this.)
7942 case "$osname" in
7943 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7944 esac
7945 # Respect a hint or command-line value.
7946 case "$shrpenv" in
7947 '') shrpenv="$tmp_shrpenv" ;;
7948 esac
7949 case "$ldlibpthname" in
7950 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7951 none)   ldlibpthname='' ;;
7952 esac
7953
7954 : determine where manual pages are on this system
7955 echo " "
7956 case "$sysman" in
7957 '') 
7958         syspath='/usr/share/man/man1 /usr/man/man1'
7959         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7960         syspath="$syspath /usr/man/u_man/man1"
7961         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7962         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7963         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7964         sysman=`./loc . /usr/man/man1 $syspath`
7965         ;;
7966 esac
7967 if $test -d "$sysman"; then
7968         echo "System manual is in $sysman." >&4
7969 else
7970         echo "Could not find manual pages in source form." >&4
7971 fi
7972
7973 : determine where manual pages go
7974 set man1dir man1dir none
7975 eval $prefixit
7976 $cat <<EOM
7977
7978 $spackage has manual pages available in source form.
7979 EOM
7980 case "$nroff" in
7981 nroff)
7982         echo "However, you don't have nroff, so they're probably useless to you."
7983         case "$man1dir" in
7984         '') man1dir="none";;
7985         esac;;
7986 esac
7987 echo "If you don't want the manual sources installed, answer 'none'."
7988 case "$man1dir" in
7989 ' ') dflt=none
7990         ;;
7991 '')
7992         lookpath="$prefixexp/share/man/man1"
7993         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7994         lookpath="$lookpath $prefixexp/man/p_man/man1"
7995         lookpath="$lookpath $prefixexp/man/u_man/man1"
7996         lookpath="$lookpath $prefixexp/man/man.1"
7997         case "$sysman" in
7998         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7999         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8000         esac
8001         set dflt
8002         eval $prefixup
8003         ;;
8004 *)  dflt="$man1dir"
8005         ;;
8006 esac
8007 echo " "
8008 fn=dn+~
8009 rp="Where do the main $spackage manual pages (source) go?"
8010 . ./getfile
8011 if $test "X$man1direxp" != "X$ansexp"; then
8012         installman1dir=''
8013 fi
8014 man1dir="$ans"
8015 man1direxp="$ansexp"
8016 case "$man1dir" in
8017 '')     man1dir=' '
8018         installman1dir='';;
8019 esac
8020
8021 : Change installation prefix, if necessary.
8022 if $test X"$prefix" != X"$installprefix"; then
8023         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8024 else
8025         installman1dir="$man1direxp"
8026 fi
8027
8028 : What suffix to use on installed man pages
8029
8030 case "$man1dir" in
8031 ' ')
8032         man1ext='0'
8033         ;;
8034 *)
8035         rp="What suffix should be used for the main $spackage man pages?"
8036         case "$man1ext" in
8037         '')     case "$man1dir" in
8038                 *1)  dflt=1 ;;
8039                 *1p) dflt=1p ;;
8040                 *1pm) dflt=1pm ;;
8041                 *l) dflt=l;;
8042                 *n) dflt=n;;
8043                 *o) dflt=o;;
8044                 *p) dflt=p;;
8045                 *C) dflt=C;;
8046                 *L) dflt=L;;
8047                 *L1) dflt=L1;;
8048                 *) dflt=1;;
8049                 esac
8050                 ;;
8051         *)      dflt="$man1ext";;
8052         esac
8053         . ./myread
8054         man1ext="$ans"
8055         ;;
8056 esac
8057
8058 : see if we can have long filenames
8059 echo " "
8060 first=123456789abcdef
8061 $rm -f $first
8062 if (echo hi >$first) 2>/dev/null; then
8063         if $test -f 123456789abcde; then
8064                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8065                 val="$undef"
8066         else
8067                 echo 'You can have filenames longer than 14 characters.'>&4
8068                 val="$define"
8069         fi
8070 else
8071         $cat <<'EOM'
8072 You can't have filenames longer than 14 chars.
8073 You can't even think about them!
8074 EOM
8075         val="$undef"
8076 fi 
8077 set d_flexfnam
8078 eval $setvar
8079 $rm -rf 123456789abcde*
8080
8081 : determine where library module manual pages go
8082 set man3dir man3dir none
8083 eval $prefixit
8084 $cat <<EOM
8085
8086 $spackage has manual pages for many of the library modules.
8087 EOM
8088
8089 case "$nroff" in
8090 nroff)
8091         $cat <<'EOM'
8092 However, you don't have nroff, so they're probably useless to you.
8093 EOM
8094         case "$man3dir" in
8095         '') man3dir="none";;
8096         esac;;
8097 esac
8098
8099 case "$d_flexfnam" in
8100 undef)
8101         $cat <<'EOM'
8102 However, your system can't handle the long file names like File::Basename.3. 
8103 EOM
8104         case "$man3dir" in
8105         '') man3dir="none";;
8106         esac;;
8107 esac
8108
8109 echo "If you don't want the manual sources installed, answer 'none'."
8110 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8111 case "$man3dir" in
8112 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8113         if $test -d "$privlib/man/man3"; then
8114                 cat <<EOM >&4
8115
8116 WARNING:  Previous versions of perl installed man3 pages into
8117 $privlib/man/man3.  This version will suggest a 
8118 new default of $dflt.  
8119 EOM
8120                 tdflt=$dflt
8121                 dflt='n'
8122                 rp='Do you wish to preserve the old behavior?(y/n)'
8123                 . ./myread
8124                 case "$ans" in
8125                 y*) dflt="$privlib/man/man3" ;;
8126                 *)  dflt=$tdflt ;;
8127                 esac
8128     fi
8129         ;;
8130 *)      dflt="$man3dir" ;;
8131 esac
8132 case "$dflt" in
8133 ' ') dflt=none ;;
8134 esac
8135 echo " "
8136 fn=dn+~
8137 rp="Where do the $package library man pages (source) go?"
8138 . ./getfile
8139 man3dir="$ans"
8140 man3direxp="$ansexp"
8141 case "$man3dir" in
8142 '')     man3dir=' '
8143         installman3dir='';;
8144 esac
8145
8146 : Change installation prefix, if necessary.
8147 if $test X"$prefix" != X"$installprefix"; then
8148         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8149 else
8150         installman3dir="$man3direxp"
8151 fi
8152
8153 : What suffix to use on installed man pages
8154 case "$man3dir" in
8155 ' ')
8156         man3ext='0'
8157         ;;
8158 *)
8159         rp="What suffix should be used for the $package library man pages?"
8160         case "$man3ext" in
8161         '')     case "$man3dir" in
8162                 *3)  dflt=3 ;;
8163                 *3p) dflt=3p ;;
8164                 *3pm) dflt=3pm ;;
8165                 *l) dflt=l;;
8166                 *n) dflt=n;;
8167                 *o) dflt=o;;
8168                 *p) dflt=p;;
8169                 *C) dflt=C;;
8170                 *L) dflt=L;;
8171                 *L3) dflt=L3;;
8172                 *) dflt=3;;
8173                 esac
8174                 ;;
8175         *)      dflt="$man3ext";;
8176         esac
8177         . ./myread
8178         man3ext="$ans"
8179         ;;
8180 esac
8181
8182 : see if we have to deal with yellow pages, now NIS.
8183 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8184         if $test -f /usr/etc/nibindd; then
8185                 echo " "
8186                 echo "I'm fairly confident you're on a NeXT."
8187                 echo " "
8188                 rp='Do you get the hosts file via NetInfo?'
8189                 dflt=y
8190                 case "$hostcat" in
8191                 nidump*) ;;
8192                 '') ;;
8193                 *) dflt=n;;
8194                 esac
8195                 . ./myread
8196                 case "$ans" in
8197                 y*) hostcat='nidump hosts .';;
8198                 *)      case "$hostcat" in
8199                         nidump*) hostcat='';;
8200                         esac
8201                         ;;
8202                 esac
8203         fi
8204         case "$hostcat" in
8205         nidump*) ;;
8206         *)
8207                 case "$hostcat" in
8208                 *ypcat*) dflt=y;;
8209                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8210                                 dflt=y
8211                         else
8212                                 dflt=n
8213                         fi;;
8214                 *) dflt=n;;
8215                 esac
8216                 echo " "
8217                 rp='Are you getting the hosts file via yellow pages?'
8218                 . ./myread
8219                 case "$ans" in
8220                 y*) hostcat='ypcat hosts';;
8221                 *) hostcat='cat /etc/hosts';;
8222                 esac
8223                 ;;
8224         esac
8225 fi
8226 case "$hostcat" in
8227 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8228 esac
8229 case "$groupcat" in
8230 '') test -f /etc/group && groupcat='cat /etc/group';;
8231 esac
8232 case "$passcat" in
8233 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8234 esac
8235
8236 : now get the host name
8237 echo " "
8238 echo "Figuring out host name..." >&4
8239 case "$myhostname" in
8240 '') cont=true
8241         echo 'Maybe "hostname" will work...'
8242         if tans=`sh -c hostname 2>&1` ; then
8243                 myhostname=$tans
8244                 phostname=hostname
8245                 cont=''
8246         fi
8247         ;;
8248 *) cont='';;
8249 esac
8250 if $test "$cont"; then
8251         if ./xenix; then
8252                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8253                 if tans=`cat /etc/systemid 2>&1` ; then
8254                         myhostname=$tans
8255                         phostname='cat /etc/systemid'
8256                         echo "Whadyaknow.  Xenix always was a bit strange..."
8257                         cont=''
8258                 fi
8259         elif $test -r /etc/systemid; then
8260                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8261         fi
8262 fi
8263 if $test "$cont"; then
8264         echo 'No, maybe "uuname -l" will work...'
8265         if tans=`sh -c 'uuname -l' 2>&1` ; then
8266                 myhostname=$tans
8267                 phostname='uuname -l'
8268         else
8269                 echo 'Strange.  Maybe "uname -n" will work...'
8270                 if tans=`sh -c 'uname -n' 2>&1` ; then
8271                         myhostname=$tans
8272                         phostname='uname -n'
8273                 else
8274                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8275                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8276                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8277                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8278                         else
8279                                 case "$myhostname" in
8280                                 '') echo "Does this machine have an identity crisis or something?"
8281                                         phostname='';;
8282                                 *)
8283                                         echo "Well, you said $myhostname before..."
8284                                         phostname='echo $myhostname';;
8285                                 esac
8286                         fi
8287                 fi
8288         fi
8289 fi
8290 case "$myhostname" in
8291 '') myhostname=noname ;;
8292 esac
8293 : you do not want to know about this
8294 set $myhostname
8295 myhostname=$1
8296
8297 : verify guess
8298 if $test "$myhostname" ; then
8299         dflt=y
8300         rp='Your host name appears to be "'$myhostname'".'" Right?"
8301         . ./myread
8302         case "$ans" in
8303         y*) ;;
8304         *) myhostname='';;
8305         esac
8306 fi
8307
8308 : bad guess or no guess
8309 while $test "X$myhostname" = X ; do
8310         dflt=''
8311         rp="Please type the (one word) name of your host:"
8312         . ./myread
8313         myhostname="$ans"
8314 done
8315
8316 : translate upper to lower if necessary
8317 case "$myhostname" in
8318 *[A-Z]*)
8319         echo "(Normalizing case in your host name)"
8320         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8321         ;;
8322 esac
8323
8324 case "$myhostname" in
8325 *.*)
8326         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8327         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8328         echo "(Trimming domain name from host name--host name is now $myhostname)"
8329         ;;
8330 *) case "$mydomain" in
8331         '')
8332                 {
8333                         test "X$hostcat" = "Xypcat hosts" &&
8334                         ypmatch "$myhostname" hosts 2>/dev/null |\
8335                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8336                         $test -s hosts
8337                 } || {
8338                         test "X$hostcat" != "X" &&
8339                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8340                                         /[       ]$myhostname[  . ]/p" > hosts
8341                 }
8342                 tmp_re="[       . ]"
8343                 if $test -f hosts; then
8344                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8345                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8346                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8347                                 hosts | $sort | $uniq | \
8348                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8349                         case `$echo X$dflt` in
8350                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8351                                 dflt=.
8352                                 ;;
8353                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8354                                 ;;
8355                         esac
8356                 else
8357                         echo "(I cannot locate a hosts database anywhere)"
8358                         dflt=.
8359                 fi
8360                 case "$dflt" in
8361                 .)
8362                         tans=`./loc resolv.conf X /etc /usr/etc`
8363                         if $test -f "$tans"; then
8364                                 echo "(Attempting domain name extraction from $tans)"
8365                                 dflt=.`$sed -n -e 's/   / /g' \
8366                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8367                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8368                                 case "$dflt" in
8369                                 .) dflt=.`$sed -n -e 's/        / /g' \
8370                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8371                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8372                                         ;;
8373                                 esac
8374                         fi
8375                         ;;
8376                 esac
8377                 case "$dflt" in
8378                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8379                         dflt=.`sh -c domainname 2>/dev/null`
8380                         case "$dflt" in
8381                         '') dflt='.';;
8382                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8383                         esac
8384                         ;;
8385                 esac
8386                 case "$dflt$osname" in
8387                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8388                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8389                         ;;
8390                 esac
8391                 case "$dflt" in
8392                 .) echo "(Lost all hope -- silly guess then)"
8393                         dflt='.nonet'
8394                         ;;
8395                 esac
8396                 $rm -f hosts
8397                 ;;
8398         *) dflt="$mydomain";;
8399         esac;;
8400 esac
8401 echo " "
8402 rp="What is your domain name?"
8403 . ./myread
8404 tans="$ans"
8405 case "$ans" in
8406 '') ;;
8407 .*) ;;
8408 *) tans=".$tans";;
8409 esac
8410 mydomain="$tans"
8411
8412 : translate upper to lower if necessary
8413 case "$mydomain" in
8414 *[A-Z]*)
8415         echo "(Normalizing case in your domain name)"
8416         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8417         ;;
8418 esac
8419
8420 : a little sanity check here
8421 case "$phostname" in
8422 '') ;;
8423 *)
8424         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8425         $myhostname$mydomain|$myhostname) ;;
8426         *)
8427                 case "$phostname" in
8428                 sed*)
8429                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8430                         ;;
8431                 *)
8432                         echo "(That doesn't agree with your $phostname command, by the way.)"
8433                         ;;
8434                 esac
8435         ;;
8436         esac
8437         ;;
8438 esac
8439
8440 $cat <<EOM
8441
8442 I need to get your e-mail address in Internet format if possible, i.e.
8443 something like user@host.domain. Please answer accurately since I have
8444 no easy means to double check it. The default value provided below
8445 is most probably close to reality but may not be valid from outside
8446 your organization...
8447
8448 EOM
8449 cont=x
8450 while test "$cont"; do
8451         case "$cf_email" in
8452         '') dflt="$cf_by@$myhostname$mydomain";;
8453         *) dflt="$cf_email";;
8454         esac
8455         rp='What is your e-mail address?'
8456         . ./myread
8457         cf_email="$ans"
8458         case "$cf_email" in
8459         *@*.*) cont='' ;;
8460         *)
8461                 rp='Address does not look like an Internet one.  Use it anyway?'
8462                 case "$fastread" in
8463                 yes) dflt=y ;;
8464                 *) dflt=n ;;
8465                 esac
8466                 . ./myread
8467                 case "$ans" in
8468                 y*) cont='' ;;
8469                 *) echo " " ;;
8470                 esac
8471                 ;;
8472         esac
8473 done
8474
8475 $cat <<EOM
8476
8477 If you or somebody else will be maintaining perl at your site, please
8478 fill in the correct e-mail address here so that they may be contacted
8479 if necessary. Currently, the "perlbug" program included with perl
8480 will send mail to this address in addition to perlbug@perl.org. You may
8481 enter "none" for no administrator.
8482
8483 EOM
8484 case "$perladmin" in
8485 '') dflt="$cf_email";;
8486 *) dflt="$perladmin";;
8487 esac
8488 rp='Perl administrator e-mail address'
8489 . ./myread
8490 perladmin="$ans"
8491
8492 : determine whether to only install version-specific parts.
8493 echo " "
8494 $cat <<EOM
8495 Do you want to install only the version-specific parts of the perl
8496 distribution?  Usually you do *not* want to do this.
8497 EOM
8498 case "$versiononly" in
8499 "$define"|[Yy]*|true) dflt='y' ;;
8500 *) dflt='n';
8501 esac
8502 rp="Do you want to install only the version-specific parts of perl?"
8503 . ./myread
8504 case "$ans" in
8505 [yY]*)  val="$define";;
8506 *)      val="$undef" ;;
8507 esac
8508 set versiononly
8509 eval $setvar
8510
8511 case "$versiononly" in
8512 "$define") inc_version_list=''
8513            inc_version_list_init=0
8514            ;;
8515 esac
8516
8517 : figure out how to guarantee perl startup
8518 case "$startperl" in
8519 '')
8520         case "$sharpbang" in
8521         *!)
8522                 $cat <<EOH
8523
8524 I can use the #! construct to start perl on your system. This will
8525 make startup of perl scripts faster, but may cause problems if you
8526 want to share those scripts and perl is not in a standard place
8527 ($binexp/perl) on all your platforms. The alternative is to force
8528 a shell by starting the script with a single ':' character.
8529
8530 EOH
8531                 case "$versiononly" in
8532                 "$define")      dflt="$binexp/perl$version";;  
8533                 *)              dflt="$binexp/perl";;
8534                 esac
8535                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8536                 . ./myread
8537                 case "$ans" in
8538                 none)   startperl=": # use perl";;
8539                 *)      startperl="#!$ans"
8540                         if $test 30 -lt `echo "$ans" | wc -c`; then
8541                                 $cat >&4 <<EOM
8542
8543 WARNING:  Some systems limit the #! command to 32 characters.
8544 If you experience difficulty running Perl scripts with #!, try
8545 installing Perl in a directory with a shorter pathname.
8546
8547 EOM
8548                         fi ;;
8549                 esac
8550                 ;;
8551         *) startperl=": # use perl"
8552                 ;;
8553         esac
8554         ;;
8555 esac
8556 echo "I'll use $startperl to start perl scripts."
8557
8558 : figure best path for perl in scripts
8559 case "$perlpath" in
8560 '')
8561         case "$versiononly" in
8562         "$define")      perlpath="$binexp/perl$version";;
8563         *)              perlpath="$binexp/perl";;
8564         esac
8565         case "$startperl" in
8566         *!*) ;;
8567         *)
8568                 $cat <<EOH
8569
8570 I will use the "eval 'exec'" idiom to start Perl on your system.
8571 I can use the full path of your Perl binary for this purpose, but
8572 doing so may cause problems if you want to share those scripts and
8573 Perl is not always in a standard place ($binexp/perl).
8574
8575 EOH
8576                 dflt="$binexp/perl"
8577                 rp="What path shall I use in \"eval 'exec'\"?"
8578                 . ./myread
8579                 perlpath="$ans"
8580                 ;;
8581         esac
8582         ;;
8583 esac
8584 case "$startperl" in
8585 *!*)    ;;
8586 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8587 esac
8588
8589 : determine where public executable scripts go
8590 set scriptdir scriptdir
8591 eval $prefixit
8592 case "$scriptdir" in
8593 '')
8594         dflt="$bin"
8595         : guess some guesses
8596         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8597         $test -d /usr/share/bin     && dflt=/usr/share/bin
8598         $test -d /usr/local/script  && dflt=/usr/local/script
8599         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8600         $test -d $prefixexp/script  && dflt=$prefixexp/script
8601         set dflt
8602         eval $prefixup
8603         ;;
8604 *)  dflt="$scriptdir"
8605         ;;
8606 esac
8607 $cat <<EOM
8608  
8609 Some installations have a separate directory just for executable scripts so
8610 that they can mount it across multiple architectures but keep the scripts in
8611 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8612 Or you might just lump your scripts in with all your other executables.
8613  
8614 EOM
8615 fn=d~
8616 rp='Where do you keep publicly executable scripts?'
8617 . ./getfile
8618 if $test "X$ansexp" != "X$scriptdirexp"; then
8619         installscript=''
8620 fi
8621 scriptdir="$ans"
8622 scriptdirexp="$ansexp"
8623 : Change installation prefix, if necessary.
8624 if $test X"$prefix" != X"$installprefix"; then
8625         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8626 else
8627         installscript="$scriptdirexp"
8628 fi
8629
8630 : determine where add-on public executables go
8631 case "$sitebin" in
8632 '')     dflt=$siteprefix/bin ;;
8633 *)      dflt=$sitebin ;;
8634 esac
8635 fn=d~
8636 rp='Pathname where the add-on public executables should be installed?'
8637 . ./getfile
8638 sitebin="$ans"
8639 sitebinexp="$ansexp"
8640 : Change installation prefix, if necessary.
8641 if $test X"$prefix" != X"$installprefix"; then
8642         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8643 else
8644         installsitebin="$sitebinexp"
8645 fi
8646
8647 : determine where add-on html pages go
8648 : There is no standard location, so try to copy the previously-selected
8649 : directory structure for the core html pages.
8650 case "$sitehtml1dir" in
8651 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8652 *)     dflt=$sitehtml1dir ;;
8653 esac
8654 case "$dflt" in
8655 ''|' ') dflt=none ;;
8656 esac
8657 fn=dn+~
8658 rp='Pathname where the site-specific html pages should be installed?'
8659 . ./getfile
8660 sitehtml1dir="$ans"
8661 sitehtml1direxp="$ansexp"
8662 : Change installation prefix, if necessary.
8663 if $test X"$prefix" != X"$installprefix"; then
8664         installsitehtml1dir=`echo $sitehtml1direxp | $sed "s#^$prefix#$installprefix#"`
8665 else
8666         installsitehtml1dir="$sitehtml1direxp"
8667 fi
8668
8669 : determine where add-on library html pages go
8670 : There is no standard location, so try to copy the previously-selected
8671 : directory structure for the core html pages.
8672 case "$sitehtml3dir" in
8673 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8674 *)     dflt=$sitehtml3dir ;;
8675 esac
8676 case "$dflt" in
8677 ''|' ') dflt=none ;;
8678 esac
8679 fn=dn+~
8680 rp='Pathname where the site-specific library html pages should be installed?'
8681 . ./getfile
8682 sitehtml3dir="$ans"
8683 sitehtml3direxp="$ansexp"
8684 : Change installation prefix, if necessary.
8685 if $test X"$prefix" != X"$installprefix"; then
8686         installsitehtml3dir=`echo $sitehtml3direxp | $sed "s#^$prefix#$installprefix#"`
8687 else
8688         installsitehtml3dir="$sitehtml3direxp"
8689 fi
8690
8691 : determine where add-on manual pages go
8692 case "$siteman1dir" in
8693 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8694 *)      dflt=$siteman1dir ;;
8695 esac
8696 case "$dflt" in
8697 ''|' ') dflt=none ;;
8698 esac
8699 fn=dn+~
8700 rp='Pathname where the site-specific manual pages should be installed?'
8701 . ./getfile
8702 siteman1dir="$ans"
8703 siteman1direxp="$ansexp"
8704 : Change installation prefix, if necessary.
8705 if $test X"$prefix" != X"$installprefix"; then
8706         installsiteman1dir=`echo $siteman1direxp | $sed "s#^$prefix#$installprefix#"`
8707 else
8708         installsiteman1dir="$siteman1direxp"
8709 fi
8710
8711 : determine where add-on library man pages go
8712 case "$siteman3dir" in
8713 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8714 *)      dflt=$siteman3dir ;;
8715 esac
8716 case "$dflt" in
8717 ''|' ') dflt=none ;;
8718 esac
8719 fn=dn+~
8720 rp='Pathname where the site-specific library manual pages should be installed?'
8721 . ./getfile
8722 siteman3dir="$ans"
8723 siteman3direxp="$ansexp"
8724 : Change installation prefix, if necessary.
8725 if $test X"$prefix" != X"$installprefix"; then
8726         installsiteman3dir=`echo $siteman3direxp | $sed "s#^$prefix#$installprefix#"`
8727 else
8728         installsiteman3dir="$siteman3direxp"
8729 fi
8730
8731 : determine where add-on public executable scripts go
8732 case "$sitescript" in
8733 '')     dflt=$siteprefix/script
8734         $test -d $dflt || dflt=$sitebin ;;
8735 *)  dflt="$sitescript" ;;
8736 esac
8737 fn=d~+
8738 rp='Pathname where add-on public executable scripts should be installed?'
8739 . ./getfile
8740 sitescript="$ans"
8741 sitescriptexp="$ansexp"
8742 : Change installation prefix, if necessary.
8743 if $test X"$prefix" != X"$installprefix"; then
8744         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8745 else
8746         installsitescript="$sitescriptexp"
8747 fi
8748
8749 case "$usefaststdio" in
8750 $define|true|[yY]*|'')
8751         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8752         case "$xversion" in
8753         [68])   dflt='y' ;;
8754         *)      dflt='n' ;;
8755         esac
8756         ;;
8757 *) dflt='n';;
8758 esac
8759 cat <<EOM
8760
8761 Perl can be built to use 'fast stdio', which means using the stdio
8762 library but also directly manipulating the stdio buffers to enable
8763 faster I/O.  Using stdio is better for backward compatibility (especially
8764 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8765 interface has been preferred instead of stdio.
8766
8767 If this doesn't make any sense to you, just accept the default '$dflt'.
8768 EOM
8769 rp='Use the "fast stdio" if available?'
8770 . ./myread
8771 case "$ans" in
8772 y|Y)    val="$define" ;;     
8773 *)      val="$undef" ;;
8774 esac
8775 set usefaststdio
8776 eval $setvar
8777
8778
8779 : define an is-a-typedef? function
8780 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8781 case "$inclist" in
8782 "") inclist="sys/types.h";;
8783 esac;
8784 eval "varval=\$$var";
8785 case "$varval" in
8786 "")
8787         $rm -f temp.c;
8788         for inc in $inclist; do
8789                 echo "#include <$inc>" >>temp.c;
8790         done;
8791         echo "#ifdef $type" >> temp.c;
8792         echo "printf(\"We have $type\");" >> temp.c;
8793         echo "#endif" >> temp.c;
8794         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8795         if $contains $type temp.E >/dev/null 2>&1; then
8796                 eval "$var=\$type";
8797         else
8798                 eval "$var=\$def";
8799         fi;
8800         $rm -f temp.?;;
8801 *) eval "$var=\$varval";;
8802 esac'
8803
8804 : define an is-a-typedef? function that prompts if the type is not available.
8805 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8806 case "$inclist" in
8807 "") inclist="sys/types.h";;
8808 esac;
8809 eval "varval=\$$var";
8810 case "$varval" in
8811 "")
8812         $rm -f temp.c;
8813         for inc in $inclist; do
8814                 echo "#include <$inc>" >>temp.c;
8815         done;
8816         echo "#ifdef $type" >> temp.c;
8817         echo "printf(\"We have $type\");" >> temp.c;
8818         echo "#endif" >> temp.c;
8819         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8820         echo " " ;
8821         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8822         if $contains $type temp.E >/dev/null 2>&1; then
8823                 echo "$type found." >&4;
8824                 eval "$var=\$type";
8825         else
8826                 echo "$type NOT found." >&4;
8827                 dflt="$def";
8828                 . ./myread ;
8829                 eval "$var=\$ans";
8830         fi;
8831         $rm -f temp.?;;
8832 *) eval "$var=\$varval";;
8833 esac'
8834
8835 : see what type lseek is declared as in the kernel
8836 rp="What is the type used for lseek's offset on this system?"
8837 set off_t lseektype long stdio.h sys/types.h
8838 eval $typedef_ask
8839
8840 echo " "
8841 echo "Checking to see how big your file offsets are..." >&4
8842 $cat >try.c <<EOCP
8843 #include <sys/types.h>
8844 #include <stdio.h>
8845 int main()
8846 {
8847     printf("%d\n", (int)sizeof($lseektype));
8848     return(0); 
8849 }
8850 EOCP
8851 set try
8852 if eval $compile_ok; then
8853         lseeksize=`$run ./try`
8854         echo "Your file offsets are $lseeksize bytes long."
8855 else
8856         dflt=$longsize
8857         echo " "
8858         echo "(I can't seem to compile the test program.  Guessing...)"
8859         rp="What is the size of your file offsets (in bytes)?"
8860         . ./myread
8861         lseeksize="$ans"
8862 fi
8863 $rm -f try.c try
8864
8865 : see what type file positions are declared as in the library
8866 rp="What is the type for file position used by fsetpos()?"
8867 set fpos_t fpostype long stdio.h sys/types.h
8868 eval $typedef_ask
8869
8870 echo " "
8871 case "$fpostype" in
8872 *_t) zzz="$fpostype"    ;;
8873 *)   zzz="fpos_t"       ;;
8874 esac
8875 echo "Checking the size of $zzz..." >&4 
8876 cat > try.c <<EOCP
8877 #include <sys/types.h>
8878 #include <stdio.h>
8879 #$i_stdlib I_STDLIB
8880 #ifdef I_STDLIB
8881 #include <stdlib.h>
8882 #endif
8883 int main() {
8884     printf("%d\n", (int)sizeof($fpostype));
8885     exit(0);
8886 }
8887 EOCP
8888 set try
8889 if eval $compile_ok; then
8890         yyy=`$run ./try`
8891         case "$yyy" in
8892         '')     fpossize=4
8893                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8894                 ;;
8895         *)      fpossize=$yyy
8896                 echo "Your $zzz is $fpossize bytes long."
8897                 ;;
8898         esac
8899 else
8900         dflt="$longsize"
8901         echo " " >&4
8902         echo "(I can't compile the test program.  Guessing...)" >&4
8903         rp="What is the size of your file positions (in bytes)?"
8904         . ./myread
8905         fpossize="$ans"
8906 fi
8907
8908 # Backward compatibility (uselfs is deprecated).
8909 case "$uselfs" in
8910 "$define"|true|[yY]*)
8911         cat <<EOM >&4
8912
8913 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8914 EOM
8915         uselargefiles="$define"
8916         ;;
8917 esac                          
8918
8919 case "$lseeksize:$fpossize" in
8920 8:8) cat <<EOM
8921
8922 You can have files larger than 2 gigabytes.
8923 EOM
8924    val="$define" ;;
8925 *)    case "$uselargefiles" in
8926    "$undef"|false|[nN]*) dflt='n' ;;
8927    *)   dflt='y' ;;
8928    esac
8929    cat <<EOM
8930
8931 Perl can be built to understand large files (files larger than 2 gigabytes)
8932 on some systems.  To do so, Configure can be run with -Duselargefiles.
8933
8934 If this doesn't make any sense to you, just accept the default '$dflt'.
8935 EOM
8936    rp='Try to understand large files, if available?'
8937    . ./myread
8938    case "$ans" in
8939    y|Y)         val="$define" ;;
8940    *)           val="$undef"  ;;
8941    esac
8942    ;;
8943 esac
8944 set uselargefiles
8945 eval $setvar
8946 : Look for a hint-file generated 'call-back-unit'.  If the
8947 : user has specified that a large files perl is to be built,
8948 : we may need to set or change some other defaults.
8949 if $test -f uselargefiles.cbu; then
8950         echo "Your platform has some specific hints regarding large file builds, using them..."
8951         . ./uselargefiles.cbu
8952 fi
8953 case "$uselargefiles" in
8954 "$define")
8955         if $test -f uselargefiles.cbu; then
8956                 echo " "
8957                 echo "Rechecking to see how big your file offsets are..." >&4
8958                 $cat >try.c <<EOCP
8959 #include <sys/types.h>
8960 #include <stdio.h>
8961 int main()
8962 {
8963     printf("%d\n", (int)sizeof($lseektype));
8964     return(0); 
8965 }
8966 EOCP
8967                 set try
8968                 if eval $compile_ok; then
8969                         lseeksize=`$run ./try`
8970                         $echo "Your file offsets are now $lseeksize bytes long."
8971                 else
8972                         dflt="$lseeksize"
8973                         echo " "
8974                         echo "(I can't seem to compile the test program.  Guessing...)"
8975                         rp="What is the size of your file offsets (in bytes)?"
8976                         . ./myread
8977                         lseeksize="$ans"
8978                 fi
8979                 case "$fpostype" in
8980                 *_t) zzz="$fpostype"    ;;
8981                 *)   zzz="fpos_t"       ;;
8982                 esac
8983                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8984                 $cat > try.c <<EOCP
8985 #include <sys/types.h>
8986 #include <stdio.h>
8987 #$i_stdlib I_STDLIB
8988 #ifdef I_STDLIB
8989 #include <stdlib.h>
8990 #endif
8991 int main() {
8992     printf("%d\n", (int)sizeof($fpostype));
8993     return(0);
8994 }
8995 EOCP
8996                 set try
8997                 if eval $compile_ok; then
8998                         yyy=`$run ./try`
8999                         dflt="$lseeksize"
9000                         case "$yyy" in
9001                         '')     echo " "
9002                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9003                                 ;;
9004                         *)      fpossize=$yyy
9005                                 echo " $fpossize bytes." >&4
9006                                 ;;
9007                         esac
9008                 else
9009                         dflt="$fpossize"
9010                         echo " "
9011                         echo "(I can't compile the test program.  Guessing...)" >&4
9012                         rp="What is the size of your file positions (in bytes)?"
9013                         . ./myread
9014                         fpossize="$ans"
9015                 fi
9016                 $rm -f try.c try
9017         fi
9018         ;;
9019 esac
9020
9021 # probably will refer to
9022 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
9023 need_relocation=0
9024 userelocatableinc=undef
9025
9026 case "$vendorprefix" in
9027 '')     d_vendorbin="$undef"
9028         vendorbin=''
9029         vendorbinexp=''
9030         ;;
9031 *)      d_vendorbin="$define"
9032         : determine where vendor-supplied executables go.
9033         case "$vendorbin" in
9034         '') dflt=$vendorprefix/bin ;;
9035         *)      dflt="$vendorbin" ;;
9036         esac
9037         fn=d~+
9038         rp='Pathname for the vendor-supplied executables directory?'
9039         . ./getfile
9040         vendorbin="$ans"
9041         vendorbinexp="$ansexp"
9042         ;;
9043 esac
9044 : Change installation prefix, if necessary.
9045 if $test X"$prefix" != X"$installprefix"; then
9046         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9047 else
9048         installvendorbin="$vendorbinexp"
9049 fi
9050
9051 case "$vendorprefix" in
9052 '')     vendorhtml1dir=''
9053         vendorhtml1direxp=''
9054         ;;
9055 *)      : determine where vendor-supplied html pages go.
9056         : There is no standard location, so try to copy the previously-selected
9057         : directory structure for the core html pages.
9058         : XXX Better default suggestions would be welcome.
9059         case "$vendorhtml1dir" in
9060         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9061         *)      dflt=$vendorhtml1dir ;;
9062         esac
9063         case "$dflt" in
9064         ''|' ') dflt=none ;;
9065         esac
9066         fn=dn+~
9067         rp='Pathname for the vendor-supplied html pages?'
9068         . ./getfile
9069         vendorhtml1dir="$ans"
9070         vendorhtml1direxp="$ansexp"
9071         ;;
9072 esac
9073 : Use ' ' for none so value is preserved next time through Configure
9074 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9075 : Change installation prefix, if necessary.
9076 if $test X"$prefix" != X"$installprefix"; then
9077         installvendorhtml1dir=`echo $vendorhtml1direxp | $sed "s#^$prefix#$installprefix#"`
9078 else
9079         installvendorhtml1dir="$vendorhtml1direxp"
9080 fi
9081
9082 case "$vendorprefix" in
9083 '')     vendorhtml3dir=''
9084         vendorhtml3direxp=''
9085         ;;
9086 *)      : determine where vendor-supplied module html pages go.
9087         : There is no standard location, so try to copy the previously-selected
9088         : directory structure for the core html pages.
9089         : XXX Better default suggestions would be welcome.
9090         case "$vendorhtml3dir" in
9091         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9092         *)      dflt=$vendorhtml3dir ;;
9093         esac
9094         case "$dflt" in
9095         ''|' ') dflt=none ;;
9096         esac
9097         fn=dn+~
9098         rp='Pathname for the vendor-supplied html pages?'
9099         . ./getfile
9100         vendorhtml3dir="$ans"
9101         vendorhtml3direxp="$ansexp"
9102         ;;
9103 esac
9104 : Use ' ' for none so value is preserved next time through Configure
9105 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9106 : Change installation prefix, if necessary.
9107 if $test X"$prefix" != X"$installprefix"; then
9108         installvendorhtml3dir=`echo $vendorhtml3direxp | $sed "s#^$prefix#$installprefix#"`
9109 else
9110         installvendorhtml3dir="$vendorhtml3direxp"
9111 fi
9112
9113 case "$vendorprefix" in
9114 '')     vendorman1dir=''
9115         vendorman1direxp=''
9116         ;;
9117 *)      : determine where vendor-supplied manual pages go.
9118         case "$vendorman1dir" in
9119         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9120         *)      dflt=$vendorman1dir ;;
9121         esac
9122         case "$dflt" in
9123         ''|' ') dflt=none ;;
9124         esac
9125         fn=nd~+
9126         rp='Pathname for the vendor-supplied manual section 1 pages?'
9127         . ./getfile
9128         vendorman1dir="$ans"
9129         vendorman1direxp="$ansexp"
9130         ;;
9131 esac
9132 : Use ' ' for none so value is preserved next time through Configure
9133 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9134 : Change installation prefix, if necessary.
9135 if $test X"$prefix" != X"$installprefix"; then
9136         installvendorman1dir=`echo "$vendorman1direxp" | $sed "s#^$prefix#$installprefix#"`
9137 else
9138         installvendorman1dir="$vendorman1direxp"
9139 fi
9140
9141 case "$vendorprefix" in
9142 '')     vendorman3dir=''
9143         vendorman3direxp=''
9144         ;;
9145 *)      : determine where vendor-supplied module manual pages go.
9146         case "$vendorman3dir" in
9147         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9148         *)      dflt=$vendorman3dir ;;
9149         esac
9150         case "$dflt" in
9151         ''|' ') dflt=none ;;
9152         esac
9153         fn=nd~+
9154         rp='Pathname for the vendor-supplied manual section 3 pages?'
9155         . ./getfile
9156         vendorman3dir="$ans"
9157         vendorman3direxp="$ansexp"
9158         ;;
9159 esac
9160 : Use ' ' for none so value is preserved next time through Configure
9161 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9162 : Change installation prefix, if necessary.
9163 if $test X"$prefix" != X"$installprefix"; then
9164         installvendorman3dir=`echo "$vendorman3direxp" | $sed "s#^$prefix#$installprefix#"`
9165 else
9166         installvendorman3dir="$vendorman3direxp"
9167 fi
9168
9169 case "$vendorprefix" in
9170 '')     d_vendorscript="$undef"
9171         vendorscript=''
9172         vendorscriptexp=''
9173         ;;
9174 *)      d_vendorscript="$define"
9175         : determine where vendor-supplied scripts go.
9176         case "$vendorscript" in
9177         '')     dflt=$vendorprefix/script
9178                 $test -d $dflt || dflt=$vendorbin ;;
9179         *)  dflt="$vendorscript" ;;
9180         esac
9181         $cat <<EOM
9182
9183 The installation process will create a directory for 
9184 vendor-supplied scripts.
9185
9186 EOM
9187         fn=d~+
9188         rp='Pathname for the vendor-supplied scripts directory?'
9189         . ./getfile
9190         vendorscript="$ans"
9191         vendorscriptexp="$ansexp"
9192         ;;
9193 esac
9194 : Change installation prefix, if necessary.
9195 if $test X"$prefix" != X"$installprefix"; then
9196         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9197 else
9198         installvendorscript="$vendorscriptexp"
9199 fi
9200
9201 : see if qgcvt exists
9202 set qgcvt d_qgcvt
9203 eval $inlibc
9204
9205 echo " "
9206
9207 if $test X"$d_longdbl" = X"$define"; then
9208
9209 echo "Checking how to print long doubles..." >&4
9210
9211 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9212         $cat >try.c <<'EOCP'
9213 #include <sys/types.h>
9214 #include <stdio.h>
9215 int main() {
9216   double d = 123.456;
9217   printf("%.3f\n", d);
9218 }
9219 EOCP
9220         set try
9221         if eval $compile; then
9222                 yyy=`$run ./try`
9223                 case "$yyy" in
9224                 123.456)
9225                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9226                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9227                         echo "We will use %f."
9228                         ;;
9229                 esac
9230         fi
9231 fi
9232
9233 if $test X"$sPRIfldbl" = X; then
9234         $cat >try.c <<'EOCP'
9235 #include <sys/types.h>
9236 #include <stdio.h>
9237 int main() {
9238   long double d = 123.456;
9239   printf("%.3Lf\n", d);
9240 }
9241 EOCP
9242         set try
9243         if eval $compile; then
9244                 yyy=`$run ./try`
9245                 case "$yyy" in
9246                 123.456)
9247                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9248                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9249                         echo "We will use %Lf."
9250                         ;;
9251                 esac
9252         fi
9253 fi
9254
9255 if $test X"$sPRIfldbl" = X; then
9256         $cat >try.c <<'EOCP'
9257 #include <sys/types.h>
9258 #include <stdio.h>
9259 int main() {
9260   long double d = 123.456;
9261   printf("%.3llf\n", d);
9262 }
9263 EOCP
9264         set try
9265         if eval $compile; then
9266                 yyy=`$run ./try`
9267                 case "$yyy" in
9268                 123.456)
9269                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9270                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9271                         echo "We will use %llf."
9272                         ;;
9273                 esac
9274         fi
9275 fi
9276
9277 if $test X"$sPRIfldbl" = X; then
9278         $cat >try.c <<'EOCP'
9279 #include <sys/types.h>
9280 #include <stdio.h>
9281 int main() {
9282   long double d = 123.456;
9283   printf("%.3lf\n", d);
9284 }
9285 EOCP
9286         set try
9287         if eval $compile; then
9288                 yyy=`$run ./try`
9289                 case "$yyy" in
9290                 123.456)
9291                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9292                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9293                         echo "We will use %lf."
9294                         ;;
9295                 esac
9296         fi
9297 fi
9298
9299 if $test X"$sPRIfldbl" = X; then
9300         echo "Cannot figure out how to print long doubles." >&4
9301 else
9302         sSCNfldbl=$sPRIfldbl    # expect consistency
9303 fi
9304
9305 $rm -f try try.*
9306
9307 fi # d_longdbl
9308
9309 case "$sPRIfldbl" in
9310 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9311         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9312         d_SCNfldbl="$undef";
9313         ;;
9314 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9315         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9316         d_SCNfldbl="$define";
9317         ;;
9318 esac
9319
9320 : Check how to convert floats to strings.
9321
9322 if test "X$d_Gconvert" = X; then
9323
9324 echo " "
9325 echo "Checking for an efficient way to convert floats to strings."
9326 echo " " > try.c
9327 case "$uselongdouble" in
9328 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9329 esac
9330 case "$d_longdbl" in
9331 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9332 esac
9333 case "$d_PRIgldbl" in
9334 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9335 esac
9336 $cat >>try.c <<EOP
9337 #ifdef TRY_gconvert
9338 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9339 char *myname = "gconvert";
9340 #endif
9341 #ifdef TRY_gcvt
9342 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9343 char *myname = "gcvt";
9344 #endif
9345 #ifdef TRY_qgcvt
9346 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9347 char *myname = "qgcvt";
9348 #define DOUBLETYPE long double
9349 #endif
9350 #ifdef TRY_sprintf
9351 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9352 #ifdef HAS_PRIgldbl
9353 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9354 #else
9355 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9356 #endif
9357 #else
9358 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9359 #endif
9360 char *myname = "sprintf";
9361 #endif
9362
9363 #ifndef DOUBLETYPE
9364 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9365 #define DOUBLETYPE long double
9366 #else
9367 #define DOUBLETYPE double
9368 #endif
9369 #endif
9370
9371 #include <stdio.h>
9372
9373 #define I_STDLIB $i_stdlib
9374 #ifdef I_STDLIB
9375 #include <stdlib.h>
9376 #endif
9377
9378 int
9379 checkit(expect, got)
9380 char *expect;
9381 char *got;
9382 {
9383     if (strcmp(expect, got)) {
9384                 printf("%s oddity:  Expected %s, got %s\n",
9385                         myname, expect, got);
9386                 exit(1);
9387         }
9388 }
9389
9390 int main()
9391
9392         char buf[64]; 
9393         buf[63] = '\0';
9394
9395         /* This must be 1st test on (which?) platform */
9396         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9397         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9398         checkit("0.1", buf);
9399
9400         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9401         checkit("0.01", buf);
9402
9403         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9404         checkit("0.001", buf);
9405
9406         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9407         checkit("0.0001", buf);
9408
9409         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9410         if (strlen(buf) > 5)
9411             checkit("9e-005", buf); /* for Microsoft ?? */
9412         else
9413             checkit("9e-05", buf);
9414
9415         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9416         checkit("1", buf);
9417
9418         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9419         checkit("1.1", buf);
9420
9421         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9422         checkit("1.01", buf);
9423
9424         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9425         checkit("1.001", buf);
9426
9427         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9428         checkit("1.0001", buf);
9429
9430         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9431         checkit("1.00001", buf);
9432
9433         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9434         checkit("1.000001", buf);
9435
9436         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9437         checkit("0", buf);
9438
9439         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9440         checkit("-1", buf);
9441
9442         /* Some Linux gcvt's give 1.e+5 here. */
9443         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9444         checkit("100000", buf);
9445         
9446         /* Some Linux gcvt's give -1.e+5 here. */
9447         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9448         checkit("-100000", buf);
9449
9450         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9451         checkit("123.456", buf);
9452
9453         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9454         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9455         /* 34 should be enough to scare even long double
9456          * places into using the e notation. */
9457         if (strlen(buf) > 5)
9458             checkit("1e+034", buf); /* for Microsoft */
9459         else
9460             checkit("1e+34", buf);
9461
9462         /* For Perl, if you add additional tests here, also add them to
9463          * t/base/num.t for benefit of platforms not using Configure or
9464          * overriding d_Gconvert */
9465
9466         exit(0);
9467 }
9468 EOP
9469 : first add preferred functions to our list
9470 xxx_list=""
9471 for xxx_convert in $gconvert_preference; do
9472     case $xxx_convert in
9473     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9474     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9475     esac 
9476 done
9477 : then add any others
9478 for xxx_convert in gconvert gcvt sprintf; do
9479     case "$xxx_list" in
9480     *$xxx_convert*) ;;
9481     *) xxx_list="$xxx_list $xxx_convert" ;;
9482     esac 
9483 done
9484
9485 case "$d_longdbl$uselongdouble" in
9486 "$define$define")
9487     : again, add prefered functions to our list first
9488     xxx_ld_list=""
9489     for xxx_convert in $gconvert_ld_preference; do
9490         case $xxx_convert in
9491         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9492         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9493         esac
9494     done
9495     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9496     for xxx_convert in qgcvt sprintf $xxx_list; do
9497         case "$xxx_ld_list" in
9498         $xxx_convert*|*" $xxx_convert"*) ;;
9499         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9500         esac
9501     done
9502     : if sprintf cannot do long doubles, move it to the end
9503     if test "$d_PRIgldbl" != "$define"; then
9504         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9505     fi
9506     : if no qgcvt, remove it
9507     if test "$d_qgcvt" != "$define"; then
9508         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9509     fi
9510     : use the ld_list
9511     xxx_list="$xxx_ld_list"
9512     ;;
9513 esac
9514
9515 for xxx_convert in $xxx_list; do
9516         echo "Trying $xxx_convert..."
9517         $rm -f try try$_o
9518         set try -DTRY_$xxx_convert
9519         if eval $compile; then
9520                 echo "$xxx_convert() found." >&4
9521                 if $run ./try; then
9522                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9523                         break;
9524                 else
9525                         echo "...But $xxx_convert didn't work as I expected."
9526                         xxx_convert=''
9527                 fi
9528         else
9529                 echo "$xxx_convert NOT found." >&4
9530         fi
9531 done
9532
9533 if test X$xxx_convert = X; then
9534     echo "*** WHOA THERE!!! ***" >&4
9535     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9536     xxx_convert=sprintf
9537 fi
9538
9539 case "$xxx_convert" in
9540 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9541 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9542 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9543 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9544    "$define$define$define")
9545       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9546    "$define$define$undef")
9547       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9548    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9549    esac
9550    ;;  
9551 esac
9552
9553 fi
9554
9555 : see if _fwalk exists
9556 set fwalk d__fwalk
9557 eval $inlibc
9558
9559 : Initialize h_fcntl
9560 h_fcntl=false
9561
9562 : Initialize h_sysfile
9563 h_sysfile=false
9564
9565 : access call always available on UNIX
9566 set access d_access
9567 eval $inlibc
9568
9569 : locate the flags for 'access()'
9570 case "$d_access" in
9571 "$define")
9572         echo " "
9573         $cat >access.c <<EOCP
9574 #include <sys/types.h>
9575 #ifdef I_FCNTL
9576 #include <fcntl.h>
9577 #endif
9578 #ifdef I_SYS_FILE
9579 #include <sys/file.h>
9580 #endif
9581 #ifdef I_UNISTD
9582 #include <unistd.h>
9583 #endif
9584 #$i_stdlib I_STDLIB
9585 #ifdef I_STDLIB
9586 #include <stdlib.h>
9587 #endif
9588 int main() {
9589         exit(R_OK);
9590 }
9591 EOCP
9592         : check sys/file.h first, no particular reason here
9593         if $test `./findhdr sys/file.h` && \
9594                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9595                 h_sysfile=true;
9596                 echo "<sys/file.h> defines the *_OK access constants." >&4
9597         elif $test `./findhdr fcntl.h` && \
9598                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9599                 h_fcntl=true;
9600                 echo "<fcntl.h> defines the *_OK access constants." >&4
9601         elif $test `./findhdr unistd.h` && \
9602                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9603                 echo "<unistd.h> defines the *_OK access constants." >&4
9604         else
9605                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9606         fi
9607         ;;
9608 esac
9609 $rm -f access*
9610
9611 : see if accessx exists
9612 set accessx d_accessx
9613 eval $inlibc
9614
9615 : see if aintl exists
9616 set aintl d_aintl
9617 eval $inlibc
9618
9619 : see if alarm exists
9620 set alarm d_alarm
9621 eval $inlibc
9622
9623 : see if POSIX threads are available
9624 set pthread.h i_pthread
9625 eval $inhdr
9626
9627 : define a fucntion to check prototypes
9628 $cat > protochk <<EOSH
9629 $startsh
9630 cc="$cc"
9631 optimize="$optimize"
9632 ccflags="$ccflags"
9633 prototype="$prototype"
9634 define="$define"
9635 rm=$rm
9636 usethreads=$usethreads
9637 i_pthread=$i_pthread
9638 pthread_h_first=$pthread_h_first
9639 EOSH
9640
9641 $cat >> protochk <<'EOSH'
9642
9643 $rm -f try.c
9644 foo="$1"
9645 shift
9646 while test $# -ge 2; do
9647         case "$1" in
9648                 $define) echo "#include <$2>" >> try.c ;;
9649                 literal) echo "$2" >> try.c ;;
9650         esac
9651     # Extra magic for the benefit of systems that need pthread.h
9652     # to be included early to correctly detect threadsafe functions.
9653     # Such functions must guarantee themselves, though, that the usethreads
9654     # and i_pthread have been defined, before calling protochk.
9655     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9656         echo "#include <pthread.h>" >> try.c
9657         pthread_h_done=yes
9658     fi
9659     shift 2
9660 done
9661 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9662 cat >> try.c <<'EOCP'
9663 #ifdef CAN_PROTOTYPE
9664 #define _(args) args
9665 #else
9666 #define _(args) ()
9667 #endif
9668 EOCP
9669 echo "$foo" >> try.c
9670 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9671 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9672 status=$?
9673 $rm -f try.[co]
9674 exit $status
9675 EOSH
9676 chmod +x protochk
9677 $eunicefix protochk
9678
9679 hasproto='varname=$1; func=$2; shift; shift;
9680 while $test $# -ge 2; do
9681         case "$1" in
9682         $define) echo "#include <$2>";;
9683         esac ;
9684     shift 2;
9685 done > try.c;
9686 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9687 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9688         echo "$func() prototype found.";
9689         val="$define";
9690 else
9691         echo "$func() prototype NOT found.";
9692         val="$undef";
9693 fi;
9694 set $varname;
9695 eval $setvar;
9696 $rm -f try.c tryout.c'
9697
9698 : see if sys/types.h has to be included
9699 set sys/types.h i_systypes
9700 eval $inhdr
9701
9702 : see if sys/select.h has to be included
9703 set sys/select.h i_sysselct
9704 eval $inhdr
9705
9706 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9707 while $test $# -ge 2; do
9708         case "$1" in
9709         $define) echo "#include <$2>";;
9710         esac ;
9711     shift 2;
9712 done > try.c;
9713 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9714 set try;
9715 if eval $compile; then
9716         val="$define";
9717 else
9718         val="$undef";
9719 fi;
9720 set $varname;
9721 eval $setvar;
9722 $rm -f try.c try.o'
9723
9724 : see if we should include time.h, sys/time.h, or both
9725 echo " "
9726 if test "X$timeincl" = X; then
9727         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9728         $echo $n "I'm now running the test program...$c"
9729         $cat >try.c <<EOCP
9730 #include <sys/types.h>
9731 #ifdef I_TIME
9732 #include <time.h>
9733 #endif
9734 #ifdef I_SYSTIME
9735 #ifdef SYSTIMEKERNEL
9736 #define KERNEL
9737 #endif
9738 #include <sys/time.h>
9739 #endif
9740 #ifdef I_SYSSELECT
9741 #include <sys/select.h>
9742 #endif
9743 #$i_stdlib I_STDLIB
9744 #ifdef I_STDLIB
9745 #include <stdlib.h>
9746 #endif
9747 int main()
9748 {
9749         struct tm foo;
9750 #ifdef S_TIMEVAL
9751         struct timeval bar;
9752 #endif
9753 #ifdef S_TIMEZONE
9754         struct timezone tzp;
9755 #endif
9756         if (foo.tm_sec == foo.tm_sec)
9757                 exit(0);
9758 #ifdef S_TIMEVAL
9759         if (bar.tv_sec == bar.tv_sec)
9760                 exit(0);
9761 #endif
9762         exit(1);
9763 }
9764 EOCP
9765         flags=''
9766         for s_timezone in '-DS_TIMEZONE' ''; do
9767         sysselect=''
9768         for s_timeval in '-DS_TIMEVAL' ''; do
9769         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9770         for i_time in '' '-DI_TIME'; do
9771         for i_systime in '-DI_SYSTIME' ''; do
9772                 case "$flags" in
9773                 '') $echo $n ".$c"
9774                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9775                         if eval $compile; then
9776                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9777                                 shift
9778                                 flags="$*"
9779                                 echo " "
9780                                 $echo $n "Succeeded with $flags$c"
9781                         fi
9782                         ;;
9783                 esac
9784         done
9785         done
9786         done
9787         done
9788         done
9789         timeincl=''
9790         echo " "
9791         case "$flags" in
9792         *SYSTIMEKERNEL*) i_systimek="$define"
9793                 timeincl=`./findhdr sys/time.h`
9794                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9795         *) i_systimek="$undef";;
9796         esac
9797         case "$flags" in
9798         *I_TIME*) i_time="$define"
9799                 timeincl=`./findhdr time.h`" $timeincl"
9800                 echo "We'll include <time.h>." >&4;;
9801         *) i_time="$undef";;
9802         esac
9803         case "$flags" in
9804         *I_SYSTIME*) i_systime="$define"
9805                 timeincl=`./findhdr sys/time.h`" $timeincl"
9806                 echo "We'll include <sys/time.h>." >&4;;
9807         *) i_systime="$undef";;
9808         esac
9809         $rm -f try.c try
9810 fi
9811 : see if struct tm knows about tm_zone
9812 case "$i_systime$i_time" in
9813 *$define*) 
9814         echo " "
9815         echo "Checking to see if your struct tm has tm_zone field..." >&4
9816         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9817         eval $hasfield
9818         ;;
9819 *)      val="$undef"
9820         set d_tm_tm_zone
9821         eval $setvar
9822         ;;
9823 esac
9824 case "$d_tm_tm_zone" in
9825 "$define")      echo "Yes, it does."   ;;
9826 *)              echo "No, it doesn't." ;;
9827 esac
9828 : see if struct tm knows about tm_gmtoff
9829 case "$i_systime$i_time" in
9830 *$define*) 
9831         echo " "
9832         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9833         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9834         eval $hasfield
9835         ;;
9836 *)      val="$undef"
9837         set d_tm_tm_gmtoff
9838         eval $setvar
9839         ;;
9840 esac
9841 case "$d_tm_tm_gmtoff" in
9842 "$define")      echo "Yes, it does."   ;;
9843 *)              echo "No, it doesn't." ;;
9844 esac
9845
9846 : see if asctime_r exists
9847 set asctime_r d_asctime_r
9848 eval $inlibc
9849 case "$d_asctime_r" in
9850 "$define")
9851         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9852         case "$d_asctime_r_proto:$usethreads" in
9853         ":define")      d_asctime_r_proto=define
9854                 set d_asctime_r_proto asctime_r $hdrs
9855                 eval $hasproto ;;
9856         *)      ;;
9857         esac
9858         case "$d_asctime_r_proto" in
9859         define)
9860         case "$asctime_r_proto" in
9861         ''|0) try='char* asctime_r(const struct tm*, char*);'
9862         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9863         esac
9864         case "$asctime_r_proto" in
9865         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9866         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9867         esac
9868         case "$asctime_r_proto" in
9869         ''|0) try='int asctime_r(const struct tm*, char*);'
9870         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9871         esac
9872         case "$asctime_r_proto" in
9873         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9874         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9875         esac
9876         case "$asctime_r_proto" in
9877         ''|0)   d_asctime_r=undef
9878                 asctime_r_proto=0
9879                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9880         * )     case "$asctime_r_proto" in
9881                 REENTRANT_PROTO*) ;;
9882                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9883                 esac
9884                 echo "Prototype: $try" ;;
9885         esac
9886         ;;
9887         *)      case "$usethreads" in
9888                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9889                 esac
9890                 d_asctime_r=undef
9891                 asctime_r_proto=0
9892                 ;;
9893         esac
9894         ;;
9895 *)      asctime_r_proto=0
9896         ;;
9897 esac
9898
9899 : see if atolf exists
9900 set atolf d_atolf
9901 eval $inlibc
9902
9903 : see if atoll exists
9904 set atoll d_atoll
9905 eval $inlibc
9906
9907 : Look for GCC-style attribute format
9908 case "$d_attribute_format" in
9909 '')
9910 echo " "
9911 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9912 $cat >attrib.c <<'EOCP'
9913 #include <stdio.h>
9914 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9915 EOCP
9916 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9917         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9918                 echo "Your C compiler doesn't support __attribute__((format))."
9919                 val="$undef"
9920         else
9921                 echo "Your C compiler supports __attribute__((format))."
9922                 val="$define"
9923         fi
9924 else
9925         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9926         val="$undef"
9927 fi
9928 ;;
9929 *) val="$d_attribute_format" ;;
9930 esac
9931 set d_attribute_format
9932 eval $setvar
9933 $rm -f attrib*
9934
9935 : Look for GCC-style attribute malloc
9936 case "$d_attribute_malloc" in
9937 '')
9938 echo " "
9939 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9940 $cat >attrib.c <<'EOCP'
9941 #include <stdio.h>
9942 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9943 EOCP
9944 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9945         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9946                 echo "Your C compiler doesn't support __attribute__((malloc))."
9947                 val="$undef"
9948         else
9949                 echo "Your C compiler supports __attribute__((malloc))."
9950                 val="$define"
9951         fi
9952 else
9953         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9954         val="$undef"
9955 fi
9956 ;;
9957 *) val="$d_attribute_malloc" ;;
9958 esac
9959 set d_attribute_malloc
9960 eval $setvar
9961 $rm -f attrib*
9962
9963 : Look for GCC-style attribute nonnull
9964 case "$d_attribute_nonnull" in
9965 '')
9966 echo " "
9967 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9968 $cat >attrib.c <<'EOCP'
9969 #include <stdio.h>
9970 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9971 EOCP
9972 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9973         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9974                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9975                 val="$undef"
9976         else
9977                 echo "Your C compiler supports __attribute__((nonnull))."
9978                 val="$define"
9979         fi
9980 else
9981         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9982         val="$undef"
9983 fi
9984 ;;
9985 *) val="$d_attribute_nonnull" ;;
9986 esac
9987 set d_attribute_nonnull
9988 eval $setvar
9989 $rm -f attrib*
9990
9991 : Look for GCC-style attribute noreturn
9992 case "$d_attribute_noreturn" in
9993 '')
9994 echo " "
9995 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9996 $cat >attrib.c <<'EOCP'
9997 #include <stdio.h>
9998 void fall_over_dead( void ) __attribute__((noreturn));
9999 EOCP
10000 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10001         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10002                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10003                 val="$undef"
10004         else
10005                 echo "Your C compiler supports __attribute__((noreturn))."
10006                 val="$define"
10007         fi
10008 else
10009         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10010         val="$undef"
10011 fi
10012 ;;
10013 *) val="$d_attribute_noreturn" ;;
10014 esac
10015 set d_attribute_noreturn
10016 eval $setvar
10017 $rm -f attrib*
10018
10019 : Look for GCC-style attribute pure
10020 case "$d_attribute_pure" in
10021 '')
10022 echo " "
10023 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10024 $cat >attrib.c <<'EOCP'
10025 #include <stdio.h>
10026 int square( int n ) __attribute__((pure));
10027 EOCP
10028 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10029         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10030                 echo "Your C compiler doesn't support __attribute__((pure))."
10031                 val="$undef"
10032         else
10033                 echo "Your C compiler supports __attribute__((pure))."
10034                 val="$define"
10035         fi
10036 else
10037         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10038         val="$undef"
10039 fi
10040 ;;
10041 *) val="$d_attribute_pure" ;;
10042 esac
10043 set d_attribute_pure
10044 eval $setvar
10045 $rm -f attrib*
10046
10047 : Look for GCC-style attribute unused
10048 case "$d_attribute_unused" in
10049 '')
10050 echo " "
10051 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10052 $cat >attrib.c <<'EOCP'
10053 #include <stdio.h>
10054 int do_something( int dummy __attribute__((unused)), int n );
10055 EOCP
10056 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10057         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10058                 echo "Your C compiler doesn't support __attribute__((unused))."
10059                 val="$undef"
10060         else
10061                 echo "Your C compiler supports __attribute__((unused))."
10062                 val="$define"
10063         fi
10064 else
10065         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10066         val="$undef"
10067 fi
10068 ;;
10069 *) val="$d_attribute_unused" ;;
10070 esac
10071 set d_attribute_unused
10072 eval $setvar
10073 $rm -f attrib*
10074
10075 : Look for GCC-style attribute warn_unused_result
10076 case "$d_attribute_warn_unused_result" in
10077 '')
10078 echo " "
10079 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10080 $cat >attrib.c <<'EOCP'
10081 #include <stdio.h>
10082 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10083 EOCP
10084 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10085         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10086                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10087                 val="$undef"
10088         else
10089                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10090                 val="$define"
10091         fi
10092 else
10093         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10094         val="$undef"
10095 fi
10096 ;;
10097 *) val="$d_attribute_warn_unused_result" ;;
10098 esac
10099 set d_attribute_warn_unused_result
10100 eval $setvar
10101 $rm -f attrib*
10102
10103 : see if bcmp exists
10104 set bcmp d_bcmp
10105 eval $inlibc
10106
10107 : see if bcopy exists
10108 set bcopy d_bcopy
10109 eval $inlibc
10110
10111 : see if this is a unistd.h system
10112 set unistd.h i_unistd
10113 eval $inhdr
10114
10115 : see if getpgrp exists
10116 set getpgrp d_getpgrp
10117 eval $inlibc
10118
10119 case "$d_getpgrp" in
10120 "$define")
10121         echo " "
10122         echo "Checking to see which flavor of getpgrp is in use..."
10123         $cat >try.c <<EOP
10124 #$i_unistd I_UNISTD
10125 #include <sys/types.h>
10126 #ifdef I_UNISTD
10127 #  include <unistd.h>
10128 #endif
10129 #$i_stdlib I_STDLIB
10130 #ifdef I_STDLIB
10131 #include <stdlib.h>
10132 #endif
10133 int main()
10134 {
10135         if (getuid() == 0) {
10136                 printf("(I see you are running Configure as super-user...)\n");
10137                 setuid(1);
10138         }
10139 #ifdef TRY_BSD_PGRP
10140         if (getpgrp(1) == 0)
10141                 exit(0);
10142 #else
10143         if (getpgrp() > 0)
10144                 exit(0);
10145 #endif
10146         exit(1);
10147 }
10148 EOP
10149         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10150                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10151                 val="$define"
10152         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10153                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10154                 val="$undef"
10155         else
10156                 echo "I can't seem to compile and run the test program."
10157                 if ./usg; then
10158                         xxx="a USG one, i.e. you use getpgrp()."
10159                 else
10160                         # SVR4 systems can appear rather BSD-ish.
10161                         case "$i_unistd" in
10162                         $undef)
10163                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10164                                 val="$define"
10165                                 ;;
10166                         $define)
10167                                 xxx="probably a USG one, i.e. you use getpgrp()."
10168                                 val="$undef"
10169                                 ;;
10170                         esac
10171                 fi
10172                 echo "Assuming your getpgrp is $xxx" >&4
10173         fi
10174         ;;
10175 *) val="$undef";;
10176 esac
10177 set d_bsdgetpgrp
10178 eval $setvar
10179 $rm -f try try.*
10180
10181 : see if setpgrp exists
10182 set setpgrp d_setpgrp
10183 eval $inlibc
10184
10185 case "$d_setpgrp" in
10186 "$define")
10187         echo " "
10188         echo "Checking to see which flavor of setpgrp is in use..."
10189         $cat >try.c <<EOP
10190 #$i_unistd I_UNISTD
10191 #include <sys/types.h>
10192 #ifdef I_UNISTD
10193 #  include <unistd.h>
10194 #endif
10195 #$i_stdlib I_STDLIB
10196 #ifdef I_STDLIB
10197 #include <stdlib.h>
10198 #endif
10199 int main()
10200 {
10201         if (getuid() == 0) {
10202                 printf("(I see you are running Configure as super-user...)\n");
10203                 setuid(1);
10204         }
10205 #ifdef TRY_BSD_PGRP
10206         if (-1 == setpgrp(1, 1))
10207                 exit(0);
10208 #else
10209         if (setpgrp() != -1)
10210                 exit(0);
10211 #endif
10212         exit(1);
10213 }
10214 EOP
10215         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10216                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10217                 val="$define"
10218         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10219                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10220                 val="$undef"
10221         else
10222                 echo "(I can't seem to compile and run the test program.)"
10223                 if ./usg; then
10224                         xxx="a USG one, i.e. you use setpgrp()."
10225                 else
10226                         # SVR4 systems can appear rather BSD-ish.
10227                         case "$i_unistd" in
10228                         $undef)
10229                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10230                                 val="$define"
10231                                 ;;
10232                         $define)
10233                                 xxx="probably a USG one, i.e. you use setpgrp()."
10234                                 val="$undef"
10235                                 ;;
10236                         esac
10237                 fi
10238                 echo "Assuming your setpgrp is $xxx" >&4
10239         fi
10240         ;;
10241 *) val="$undef";;
10242 esac
10243 set d_bsdsetpgrp
10244 eval $setvar
10245 $rm -f try try.*
10246 : Look for GCC-style __builtin_choose_expr
10247 case "$d_builtin_choose_expr" in
10248 '')
10249     echo " "
10250     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10251     $cat >try.c <<'EOCP'
10252 #include <assert.h>
10253 #include <stdlib.h>
10254 #include <stdio.h>
10255
10256 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10257
10258 int main(void) {
10259     assert( SYRINX(1) == 2112 );
10260     assert( SYRINX(1) != 5150 );
10261     assert( SYRINX(0) == 5150 );
10262     assert( SYRINX(0) != 2112 );
10263     puts( "All good!" );
10264     exit(0);
10265 }
10266
10267 EOCP
10268     set try
10269     if eval $compile; then
10270         echo "Your C compiler supports __builtin_choose_expr."
10271         val="$define"
10272     else
10273         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10274         val="$undef"
10275     fi
10276 ;;
10277 *) val="$d_builtin_choose_expr" ;;
10278 esac
10279
10280 set d_builtin_choose_expr
10281 eval $setvar
10282 $rm -f try.* try core core.try.*
10283
10284 : Look for GCC-style __builtin_expect
10285 case "$d_builtin_expect" in
10286 '')
10287     echo " "
10288     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10289     $cat >builtin.c <<'EOCP'
10290 int main(void) {
10291     int n = 50;
10292     if ( __builtin_expect(n, 0) ) n = 1;
10293 }
10294 EOCP
10295     set try
10296     if eval $compile; then
10297         echo "Your C compiler supports __builtin_choose_expr."
10298         val="$define"
10299     else
10300         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10301         val="$undef"
10302     fi
10303     ;;
10304 *) val="$d_builtin_expect" ;;
10305 esac
10306
10307 set d_builtin_expect
10308 eval $setvar
10309 $rm -f try.* try core core.try.*
10310
10311 : see if bzero exists
10312 set bzero d_bzero
10313 eval $inlibc
10314
10315 : see if signal is declared as pointer to function returning int or void
10316 echo " "
10317 xxx=`./findhdr signal.h`
10318 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10319 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10320         echo "You have int (*signal())() instead of void." >&4
10321         val="$undef"
10322 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10323         echo "You have void (*signal())()." >&4
10324         val="$define"
10325 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10326         echo "You have int (*signal())() instead of void." >&4
10327         val="$undef"
10328 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10329         echo "You have void (*signal())()." >&4
10330         val="$define"
10331 else
10332         case "$d_voidsig" in
10333         '')
10334         echo "I can't determine whether signal handler returns void or int..." >&4
10335                 dflt=void
10336                 rp="What type does your signal handler return?"
10337                 . ./myread
10338                 case "$ans" in
10339                 v*) val="$define";;
10340                 *) val="$undef";;
10341                 esac;;
10342         "$define")
10343                 echo "As you already told me, signal handler returns void." >&4
10344                 val="$define"
10345                 ;;
10346         *)      echo "As you already told me, signal handler returns int." >&4
10347                 val="$undef"
10348                 ;;
10349         esac
10350 fi
10351 set d_voidsig
10352 eval $setvar
10353 case "$d_voidsig" in
10354 "$define") signal_t="void";;
10355 *) signal_t="int";;
10356 esac
10357 $rm -f $$.tmp
10358
10359 : check for ability to cast large floats to 32-bit ints.
10360 echo " "
10361 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10362 if $test "$intsize" -ge 4; then
10363         xxx=int
10364 else
10365         xxx=long
10366 fi
10367 $cat >try.c <<EOCP
10368 #include <stdio.h>
10369 #$i_stdlib I_STDLIB
10370 #ifdef I_STDLIB
10371 #include <stdlib.h>
10372 #endif
10373 #include <sys/types.h>
10374 #include <signal.h>
10375 $signal_t blech(s) int s; { exit(3); }
10376 int main()
10377 {
10378         $xxx i32;
10379         double f, g;
10380         int result = 0;
10381         char str[16];
10382         signal(SIGFPE, blech);
10383
10384         /* Don't let compiler optimize the test away.  Store the number 
10385            in a writable string for gcc to pass to sscanf under HP/UX.
10386         */
10387         sprintf(str, "2147483647");
10388         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10389         g = 10 * f;
10390         i32  = ($xxx) g;
10391
10392         /* x86 processors will probably give 0x8000 0000, which is a
10393            sign change.  We don't want that.  We want to mimic SPARC
10394            behavior here, which is to preserve the sign and give
10395            back 0x7fff ffff.
10396         */
10397         if (i32 != ($xxx) f)
10398                 result |= 1;
10399         exit(result);
10400 }
10401 EOCP
10402 set try
10403 if eval $compile_ok; then
10404         $run ./try
10405         yyy=$?
10406 else
10407         echo "(I can't seem to compile the test program--assuming it can't)"
10408         yyy=1
10409 fi
10410 case "$yyy" in
10411 0)      val="$define"
10412         echo "Yup, it can."
10413         ;;
10414 *)      val="$undef"
10415         echo "Nope, it can't."
10416         ;;
10417 esac
10418 set d_casti32
10419 eval $setvar
10420 $rm -f try try.*
10421
10422 : check for ability to cast negative floats to unsigned
10423 echo " "
10424 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10425 $cat >try.c <<EOCP
10426 #include <stdio.h>
10427 #$i_stdlib I_STDLIB
10428 #ifdef I_STDLIB
10429 #include <stdlib.h>
10430 #endif
10431 #include <sys/types.h>
10432 #include <signal.h>
10433 $signal_t blech(s) int s; { exit(7); }
10434 $signal_t blech_in_list(s) int s; { exit(4); }
10435 unsigned long dummy_long(p) unsigned long p; { return p; }
10436 unsigned int dummy_int(p) unsigned int p; { return p; }
10437 unsigned short dummy_short(p) unsigned short p; { return p; }
10438 int main()
10439 {
10440         double f;
10441         unsigned long along;
10442         unsigned int aint;
10443         unsigned short ashort;
10444         int result = 0;
10445         char str[16];
10446         
10447         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10448            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10449            optimized the whole file away
10450         */
10451         /* Store the number in a writable string for gcc to pass to 
10452            sscanf under HP/UX.
10453         */
10454         sprintf(str, "-123");
10455         sscanf(str, "%lf", &f);  /* f = -123.; */
10456
10457         signal(SIGFPE, blech);
10458         along = (unsigned long)f;
10459         aint = (unsigned int)f;
10460         ashort = (unsigned short)f;
10461         if (along != (unsigned long)-123)
10462                 result |= 1;
10463         if (aint != (unsigned int)-123)
10464                 result |= 1;
10465         if (ashort != (unsigned short)-123)
10466                 result |= 1;
10467         sprintf(str, "1073741824.");
10468         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10469         f = f + f;
10470         along = 0;
10471         along = (unsigned long)f;
10472         if (along != 0x80000000)
10473                 result |= 2;
10474         f -= 1.;
10475         along = 0;
10476         along = (unsigned long)f;
10477         if (along != 0x7fffffff)
10478                 result |= 1;
10479         f += 2.;
10480         along = 0;
10481         along = (unsigned long)f;
10482         if (along != 0x80000001)
10483                 result |= 2;
10484         if (result)
10485                 exit(result);
10486         signal(SIGFPE, blech_in_list);
10487         sprintf(str, "123.");
10488         sscanf(str, "%lf", &f);  /* f = 123.; */
10489         along = dummy_long((unsigned long)f);
10490         aint = dummy_int((unsigned int)f);
10491         ashort = dummy_short((unsigned short)f);
10492         if (along != (unsigned long)123)
10493                 result |= 4;
10494         if (aint != (unsigned int)123)
10495                 result |= 4;
10496         if (ashort != (unsigned short)123)
10497                 result |= 4;
10498         exit(result);
10499
10500 }
10501 EOCP
10502 set try
10503 if eval $compile_ok; then
10504         $run ./try
10505         castflags=$?
10506 else
10507         echo "(I can't seem to compile the test program--assuming it can't)"
10508         castflags=7
10509 fi
10510 case "$castflags" in
10511 0)      val="$define"
10512         echo "Yup, it can."
10513         ;;
10514 *)      val="$undef"
10515         echo "Nope, it can't."
10516         ;;
10517 esac
10518 set d_castneg
10519 eval $setvar
10520 $rm -f try.*
10521
10522 : see if vprintf exists
10523 echo " "
10524 if set vprintf val -f d_vprintf; eval $csym; $val; then
10525         echo 'vprintf() found.' >&4
10526         val="$define"
10527         $cat >try.c <<EOF
10528 #include <varargs.h>
10529 #$i_stdlib I_STDLIB
10530 #ifdef I_STDLIB
10531 #include <stdlib.h>
10532 #endif
10533
10534 int main() { xxx("foo"); }
10535
10536 xxx(va_alist)
10537 va_dcl
10538 {
10539         va_list args;
10540         char buf[10];
10541
10542         va_start(args);
10543         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10544 }
10545 EOF
10546         set try
10547         if eval $compile && $run ./try; then
10548                 echo "Your vsprintf() returns (int)." >&4
10549                 val2="$undef"
10550         else
10551                 echo "Your vsprintf() returns (char*)." >&4
10552                 val2="$define"
10553         fi
10554 else
10555         echo 'vprintf() NOT found.' >&4
10556                 val="$undef"
10557                 val2="$undef"
10558 fi
10559 $rm -f try try.*
10560 set d_vprintf
10561 eval $setvar
10562 val=$val2
10563 set d_charvspr
10564 eval $setvar
10565
10566 : see if chown exists
10567 set chown d_chown
10568 eval $inlibc
10569
10570 : see if chroot exists
10571 set chroot d_chroot
10572 eval $inlibc
10573
10574 : see if chsize exists
10575 set chsize d_chsize
10576 eval $inlibc
10577
10578 : see if class exists
10579 set class d_class
10580 eval $inlibc
10581
10582 : see if clearenv exists
10583 set clearenv d_clearenv
10584 eval $inlibc
10585
10586 hasstruct='varname=$1; struct=$2; shift; shift;
10587 while $test $# -ge 2; do
10588         case "$1" in
10589         $define) echo "#include <$2>";;
10590         esac ;
10591     shift 2;
10592 done > try.c;
10593 echo "int main () { struct $struct foo; }" >> try.c;
10594 set try;
10595 if eval $compile; then
10596         val="$define";
10597 else
10598         val="$undef";
10599 fi;
10600 set $varname;
10601 eval $setvar;
10602 $rm -f try.c try.o'
10603
10604 socketlib=''
10605 sockethdr=''
10606 : see whether socket exists
10607 echo " "
10608 $echo $n "Hmm... $c" >&4
10609 if set socket val -f d_socket; eval $csym; $val; then
10610         echo "Looks like you have Berkeley networking support." >&4
10611         d_socket="$define"
10612         if set setsockopt val -f; eval $csym; $val; then
10613                 d_oldsock="$undef"
10614         else
10615                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10616                 d_oldsock="$define"
10617         fi
10618 else
10619         if $contains socklib libc.list >/dev/null 2>&1; then
10620                 echo "Looks like you have Berkeley networking support." >&4
10621                 d_socket="$define"
10622                 : we will have to assume that it supports the 4.2 BSD interface
10623                 d_oldsock="$undef"
10624         else
10625                 echo "You don't have Berkeley networking in libc$_a..." >&4
10626                 if test "X$d_socket" = "X$define"; then
10627                    echo "...but you seem to believe that you have sockets." >&4
10628                 else
10629                         for net in net socket
10630                         do
10631                                 if test -f /usr/lib/lib$net$_a; then
10632                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10633                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10634                                         if $contains socket libc.list >/dev/null 2>&1; then
10635                                                 d_socket="$define"
10636                                                 socketlib="-l$net"
10637                                                 case "$net" in
10638                                                 net)
10639                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10640                                                         sockethdr="-I/usr/netinclude"
10641                                                         ;;
10642                                                 esac
10643                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10644                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10645                                                         d_oldsock="$undef"
10646                                                 else
10647                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10648                                                         d_oldsock="$define"
10649                                                 fi
10650                                                 break
10651                                         fi
10652                                 fi
10653                         done
10654                         if test "X$d_socket" != "X$define"; then
10655                            echo "or anywhere else I see." >&4
10656                            d_socket="$undef"
10657                            d_oldsock="$undef"
10658                         fi
10659                 fi
10660         fi
10661 fi
10662
10663 : see if socketpair exists
10664 set socketpair d_sockpair
10665 eval $inlibc
10666
10667
10668 echo " "
10669 echo "Checking the availability of certain socket constants..." >&4
10670 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10671         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10672         $cat >try.c <<EOF
10673 #include <sys/types.h>
10674 #include <sys/socket.h>
10675 int main() {
10676     int i = $ENUM;
10677 }
10678 EOF
10679         val="$undef"
10680         set try; if eval $compile; then
10681                 val="$define"
10682         fi
10683         set d_${enum}; eval $setvar
10684         $rm -f try.c try
10685 done
10686
10687 : see if this is a sys/uio.h system
10688 set sys/uio.h i_sysuio
10689 eval $inhdr
10690
10691
10692 echo " "
10693 echo "Checking to see if your system supports struct cmsghdr..." >&4
10694 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10695 eval $hasstruct
10696 case "$d_cmsghdr_s" in
10697 "$define")      echo "Yes, it does."   ;;
10698 *)              echo "No, it doesn't." ;;
10699 esac
10700
10701
10702 : check for const keyword
10703 echo " "
10704 echo 'Checking to see if your C compiler knows about "const"...' >&4
10705 $cat >const.c <<'EOCP'
10706 typedef struct spug { int drokk; } spug;
10707 int main()
10708 {
10709         const char *foo;
10710         const spug y;
10711 }
10712 EOCP
10713 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10714         val="$define"
10715         echo "Yup, it does."
10716 else
10717         val="$undef"
10718         echo "Nope, it doesn't."
10719 fi
10720 set d_const
10721 eval $setvar
10722
10723 : see if copysignl exists
10724 set copysignl d_copysignl
10725 eval $inlibc
10726
10727 : see if crypt exists
10728 echo " "
10729 set crypt d_crypt
10730 eval $inlibc
10731 case "$d_crypt" in
10732 $define) cryptlib='' ;;
10733 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10734                 echo 'crypt() found.' >&4
10735                 val="$define"
10736                 cryptlib=''
10737         else
10738                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10739                 if $test -z "$cryptlib"; then
10740                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10741                 else
10742                         cryptlib=-lcrypt
10743                 fi
10744                 if $test -z "$cryptlib"; then
10745                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10746                 else
10747                         cryptlib=-lcrypt
10748                 fi
10749                 if $test -z "$cryptlib"; then
10750                         cryptlib=`./loc libcrypt$_a "" $libpth`
10751                 else
10752                         cryptlib=-lcrypt
10753                 fi
10754                 if $test -z "$cryptlib"; then
10755                         echo 'crypt() NOT found.' >&4
10756                         val="$undef"
10757                 else
10758                         val="$define"
10759                 fi
10760         fi
10761         set d_crypt
10762         eval $setvar
10763         ;;
10764 esac
10765
10766 : see if this is a crypt.h system
10767 set crypt.h i_crypt
10768 eval $inhdr
10769
10770 : see if crypt_r exists
10771 set crypt_r d_crypt_r
10772 eval $inlibc
10773 case "$d_crypt_r" in
10774 "$define")
10775         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10776         case "$d_crypt_r_proto:$usethreads" in
10777         ":define")      d_crypt_r_proto=define
10778                 set d_crypt_r_proto crypt_r $hdrs
10779                 eval $hasproto ;;
10780         *)      ;;
10781         esac
10782         case "$d_crypt_r_proto" in
10783         define)
10784         case "$crypt_r_proto" in
10785         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10786         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10787         esac
10788         case "$crypt_r_proto" in
10789         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10790         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10791         esac
10792         case "$crypt_r_proto" in
10793         ''|0)   d_crypt_r=undef
10794                 crypt_r_proto=0
10795                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10796         * )     case "$crypt_r_proto" in
10797                 REENTRANT_PROTO*) ;;
10798                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10799                 esac
10800                 echo "Prototype: $try" ;;
10801         esac
10802         ;;
10803         *)      case "$usethreads" in
10804                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10805                 esac
10806                 d_crypt_r=undef
10807                 crypt_r_proto=0
10808                 ;;
10809         esac
10810         ;;
10811 *)      crypt_r_proto=0
10812         ;;
10813 esac
10814
10815 : get csh whereabouts
10816 case "$csh" in
10817 'csh') val="$undef" ;;
10818 *) val="$define" ;;
10819 esac
10820 set d_csh
10821 eval $setvar
10822 : Respect a hint or command line value for full_csh.
10823 case "$full_csh" in
10824 '') full_csh=$csh ;;
10825 esac
10826
10827 : see if ctermid_r exists
10828 set ctermid_r d_ctermid_r
10829 eval $inlibc
10830 case "$d_ctermid_r" in
10831 "$define")
10832         hdrs="$i_systypes sys/types.h define stdio.h "
10833         case "$d_ctermid_r_proto:$usethreads" in
10834         ":define")      d_ctermid_r_proto=define
10835                 set d_ctermid_r_proto ctermid_r $hdrs
10836                 eval $hasproto ;;
10837         *)      ;;
10838         esac
10839         case "$d_ctermid_r_proto" in
10840         define)
10841         case "$ctermid_r_proto" in
10842         ''|0) try='char* ctermid_r(char*);'
10843         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10844         esac
10845         case "$ctermid_r_proto" in
10846         ''|0)   d_ctermid_r=undef
10847                 ctermid_r_proto=0
10848                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10849         * )     case "$ctermid_r_proto" in
10850                 REENTRANT_PROTO*) ;;
10851                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10852                 esac
10853                 echo "Prototype: $try" ;;
10854         esac
10855         ;;
10856         *)      case "$usethreads" in
10857                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10858                 esac
10859                 d_ctermid_r=undef
10860                 ctermid_r_proto=0
10861                 ;;
10862         esac
10863         ;;
10864 *)      ctermid_r_proto=0
10865         ;;
10866 esac
10867
10868 : see if ctime_r exists
10869 set ctime_r d_ctime_r
10870 eval $inlibc
10871 case "$d_ctime_r" in
10872 "$define")
10873         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10874         case "$d_ctime_r_proto:$usethreads" in
10875         ":define")      d_ctime_r_proto=define
10876                 set d_ctime_r_proto ctime_r $hdrs
10877                 eval $hasproto ;;
10878         *)      ;;
10879         esac
10880         case "$d_ctime_r_proto" in
10881         define)
10882         case "$ctime_r_proto" in
10883         ''|0) try='char* ctime_r(const time_t*, char*);'
10884         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10885         esac
10886         case "$ctime_r_proto" in
10887         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10888         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10889         esac
10890         case "$ctime_r_proto" in
10891         ''|0) try='int ctime_r(const time_t*, char*);'
10892         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10893         esac
10894         case "$ctime_r_proto" in
10895         ''|0) try='int ctime_r(const time_t*, char*, int);'
10896         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10897         esac
10898         case "$ctime_r_proto" in
10899         ''|0)   d_ctime_r=undef
10900                 ctime_r_proto=0
10901                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10902         * )     case "$ctime_r_proto" in
10903                 REENTRANT_PROTO*) ;;
10904                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10905                 esac
10906                 echo "Prototype: $try" ;;
10907         esac
10908         ;;
10909         *)      case "$usethreads" in
10910                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10911                 esac
10912                 d_ctime_r=undef
10913                 ctime_r_proto=0
10914                 ;;
10915         esac
10916         ;;
10917 *)      ctime_r_proto=0
10918         ;;
10919 esac
10920
10921 : see if cuserid exists
10922 set cuserid d_cuserid
10923 eval $inlibc
10924
10925 : see if this is a limits.h system
10926 set limits.h i_limits
10927 eval $inhdr
10928
10929 : see if this is a float.h system
10930 set float.h i_float
10931 eval $inhdr
10932
10933 : See if number of significant digits in a double precision number is known
10934 echo " "
10935 $cat >dbl_dig.c <<EOM
10936 #$i_limits I_LIMITS
10937 #$i_float I_FLOAT
10938 #ifdef I_LIMITS
10939 #include <limits.h>
10940 #endif
10941 #ifdef I_FLOAT
10942 #include <float.h>
10943 #endif
10944 #ifdef DBL_DIG
10945 printf("Contains DBL_DIG");
10946 #endif
10947 EOM
10948 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10949 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10950         echo "DBL_DIG found." >&4
10951         val="$define"
10952 else
10953         echo "DBL_DIG NOT found." >&4
10954         val="$undef"
10955 fi
10956 $rm -f dbl_dig.?
10957 set d_dbl_dig
10958 eval $setvar
10959
10960 : see if dbm.h is available
10961 : see if dbmclose exists
10962 set dbmclose d_dbmclose
10963 eval $inlibc
10964
10965 case "$d_dbmclose" in
10966 $define)
10967         set dbm.h i_dbm
10968         eval $inhdr
10969         case "$i_dbm" in
10970         $define)
10971                 val="$undef"
10972                 set i_rpcsvcdbm
10973                 eval $setvar
10974                 ;;
10975         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10976                 eval $inhdr
10977                 ;;
10978         esac
10979         ;;
10980 *)      echo "We won't be including <dbm.h>"
10981         val="$undef"
10982         set i_dbm
10983         eval $setvar
10984         val="$undef"
10985         set i_rpcsvcdbm
10986         eval $setvar
10987         ;;
10988 esac
10989
10990 : see if prototype for dbminit is available
10991 echo " "
10992 set d_dbminitproto dbminit $i_dbm dbm.h
10993 eval $hasproto
10994
10995 : see if difftime exists
10996 set difftime d_difftime
10997 eval $inlibc
10998
10999 : see if this is a dirent system
11000 echo " "
11001 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11002         val="$define"
11003         echo "<dirent.h> found." >&4
11004 else
11005         val="$undef"
11006         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11007                 echo "<sys/dir.h> found." >&4
11008                 echo " "
11009         else
11010                 xinc=`./findhdr sys/ndir.h`
11011         fi
11012         echo "<dirent.h> NOT found." >&4
11013 fi
11014 set i_dirent
11015 eval $setvar
11016
11017 : Look for type of directory structure.
11018 echo " "
11019 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11020
11021 case "$direntrytype" in
11022 ''|' ')
11023         case "$i_dirent" in
11024         $define) guess1='struct dirent' ;;
11025         *) guess1='struct direct'  ;;
11026         esac
11027         ;;
11028 *)      guess1="$direntrytype"
11029         ;;
11030 esac
11031
11032 case "$guess1" in
11033 'struct dirent') guess2='struct direct' ;;
11034 *) guess2='struct dirent' ;;
11035 esac
11036                 
11037 if $contains "$guess1" try.c >/dev/null 2>&1; then
11038         direntrytype="$guess1"
11039         echo "Your directory entries are $direntrytype." >&4
11040 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11041         direntrytype="$guess2"
11042         echo "Your directory entries seem to be $direntrytype." >&4
11043 else
11044         echo "I don't recognize your system's directory entries." >&4
11045         rp="What type is used for directory entries on this system?"
11046         dflt="$guess1"
11047         . ./myread
11048         direntrytype="$ans"
11049 fi
11050 $rm -f try.c
11051
11052
11053 : see if the directory entry stores field length
11054 echo " "
11055 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11056 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11057         echo "Good, your directory entry keeps length information in d_namlen." >&4
11058         val="$define"
11059 else
11060         echo "Your directory entry does not know about the d_namlen field." >&4
11061         val="$undef"
11062 fi
11063 set d_dirnamlen
11064 eval $setvar
11065 $rm -f try.c
11066
11067 : see if this is an sysdir system
11068 set sys/dir.h i_sysdir
11069 eval $inhdr
11070
11071 : see if this is an sysndir system
11072 set sys/ndir.h i_sysndir
11073 eval $inhdr
11074
11075 : Look for dirfd
11076 echo " "
11077 $cat >dirfd.c <<EOM
11078 #include <stdio.h>
11079 #$i_stdlib I_STDLIB
11080 #ifdef I_STDLIB
11081 #include <stdlib.h>
11082 #endif
11083 #$i_dirent I_DIRENT             /**/
11084 #$i_sysdir I_SYS_DIR            /**/
11085 #$i_sysndir I_SYS_NDIR          /**/
11086 #$i_systypes I_SYS_TYPES        /**/
11087 #if defined(I_SYS_TYPES)
11088 #include <sys/types.h>
11089 #endif
11090 #if defined(I_DIRENT)
11091 #include <dirent.h>
11092 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11093 #include <sys/dir.h>
11094 #endif
11095 #else
11096 #ifdef I_SYS_NDIR
11097 #include <sys/ndir.h>
11098 #else
11099 #ifdef I_SYS_DIR
11100 #ifdef hp9000s500
11101 #include <ndir.h>       /* may be wrong in the future */
11102 #else
11103 #include <sys/dir.h>
11104 #endif
11105 #endif
11106 #endif
11107 #endif 
11108 int main() {
11109         DIR *dirp = opendir(".");
11110         if (dirfd(dirp) >= 0)
11111                 exit(0);
11112         else
11113                 exit(1);
11114 }
11115 EOM
11116 val=$undef
11117 set dirfd
11118 if eval $compile; then
11119         val="$define"
11120 fi
11121 case "$val" in
11122 $define)        echo "dirfd() found." >&4       ;;
11123 *)              echo "dirfd() NOT found." >&4   ;;
11124 esac
11125 set d_dirfd
11126 eval $setvar
11127 $rm -f dirfd*
11128
11129 : see if dlerror exists
11130 xxx_runnm="$runnm"
11131 runnm=false
11132 set dlerror d_dlerror
11133 eval $inlibc
11134 runnm="$xxx_runnm"
11135
11136 : see if dlfcn is available
11137 set dlfcn.h i_dlfcn
11138 eval $inhdr
11139
11140 case "$usedl" in
11141 $define|y|true)
11142         $cat << EOM
11143
11144 On a few systems, the dynamically loaded modules that perl generates and uses
11145 will need a different extension than shared libs. The default will probably
11146 be appropriate.
11147
11148 EOM
11149         case "$dlext" in
11150         '')     dflt="$so" ;;
11151         *)      dflt="$dlext" ;;
11152         esac
11153         rp='What is the extension of dynamically loaded modules'
11154         . ./myread
11155         dlext="$ans"
11156         ;;
11157 *)
11158         dlext="none"
11159         ;;
11160 esac
11161
11162 : Check if dlsym need a leading underscore
11163 echo " "
11164 val="$undef"
11165
11166 case "$dlsrc" in
11167 dl_dlopen.xs)
11168         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11169         $cat >dyna.c <<'EOM'
11170 fred () { }
11171 EOM
11172
11173 $cat >fred.c<<EOM
11174
11175 #include <stdio.h>
11176 #$i_stdlib I_STDLIB
11177 #ifdef I_STDLIB
11178 #include <stdlib.h>
11179 #endif
11180 #$i_dlfcn I_DLFCN
11181 #ifdef I_DLFCN
11182 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11183 #else
11184 #include <sys/types.h>
11185 #include <nlist.h>
11186 #include <link.h>
11187 #endif
11188
11189 extern int fred() ;
11190
11191 int main()
11192 {
11193     void * handle ;
11194     void * symbol ;
11195 #ifndef RTLD_LAZY
11196     int mode = 1 ;
11197 #else
11198     int mode = RTLD_LAZY ;
11199 #endif
11200     handle = dlopen("./dyna.$dlext", mode) ;
11201     if (handle == NULL) {
11202         printf ("1\n") ;
11203         fflush (stdout) ;
11204         exit(0);
11205     }
11206     symbol = dlsym(handle, "fred") ;
11207     if (symbol == NULL) {
11208         /* try putting a leading underscore */
11209         symbol = dlsym(handle, "_fred") ;
11210         if (symbol == NULL) {
11211             printf ("2\n") ;
11212             fflush (stdout) ;
11213             exit(0);
11214         }
11215         printf ("3\n") ;
11216     }
11217     else
11218         printf ("4\n") ;
11219     fflush (stdout) ;
11220     exit(0);
11221 }
11222 EOM
11223         : Call the object file tmp-dyna.o in case dlext=o.
11224         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11225                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11226                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11227                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11228                 xxx=`$run ./fred`
11229                 case $xxx in
11230                 1)      echo "Test program failed using dlopen." >&4
11231                         echo "Perhaps you should not use dynamic loading." >&4;;
11232                 2)      echo "Test program failed using dlsym." >&4
11233                         echo "Perhaps you should not use dynamic loading." >&4;;
11234                 3)      echo "dlsym needs a leading underscore" >&4
11235                         val="$define" ;;
11236                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11237                 esac
11238         else
11239                 echo "I can't compile and run the test program." >&4
11240                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11241         fi
11242         ;;
11243 esac
11244                 
11245 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11246
11247 set d_dlsymun
11248 eval $setvar
11249
11250 : see if drand48_r exists
11251 set drand48_r d_drand48_r
11252 eval $inlibc
11253 case "$d_drand48_r" in
11254 "$define")
11255         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11256         case "$d_drand48_r_proto:$usethreads" in
11257         ":define")      d_drand48_r_proto=define
11258                 set d_drand48_r_proto drand48_r $hdrs
11259                 eval $hasproto ;;
11260         *)      ;;
11261         esac
11262         case "$d_drand48_r_proto" in
11263         define)
11264         case "$drand48_r_proto" in
11265         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11266         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11267         esac
11268         case "$drand48_r_proto" in
11269         ''|0)   d_drand48_r=undef
11270                 drand48_r_proto=0
11271                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11272         * )     case "$drand48_r_proto" in
11273                 REENTRANT_PROTO*) ;;
11274                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11275                 esac
11276                 echo "Prototype: $try" ;;
11277         esac
11278         ;;
11279         *)      case "$usethreads" in
11280                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11281                 esac
11282                 d_drand48_r=undef
11283                 drand48_r_proto=0
11284                 ;;
11285         esac
11286         ;;
11287 *)      drand48_r_proto=0
11288         ;;
11289 esac
11290
11291 : see if prototype for drand48 is available
11292 echo " "
11293 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11294 eval $hasproto
11295
11296 : see if dup2 exists
11297 set dup2 d_dup2
11298 eval $inlibc
11299
11300 : see if eaccess exists
11301 set eaccess d_eaccess
11302 eval $inlibc
11303
11304 : see if endgrent exists
11305 set endgrent d_endgrent
11306 eval $inlibc
11307
11308 : see if this is an grp system
11309 set grp.h i_grp
11310 eval $inhdr
11311
11312 case "$i_grp" in
11313 $define)
11314         xxx=`./findhdr grp.h`
11315         $cppstdin $cppflags $cppminus < $xxx >$$.h
11316
11317         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11318                 val="$define"
11319         else
11320                 val="$undef"
11321         fi
11322         set d_grpasswd
11323         eval $setvar
11324
11325         $rm -f $$.h
11326         ;;
11327 *)
11328         val="$undef";
11329         set d_grpasswd; eval $setvar
11330         ;;
11331 esac
11332
11333 : see if endgrent_r exists
11334 set endgrent_r d_endgrent_r
11335 eval $inlibc
11336 case "$d_endgrent_r" in
11337 "$define")
11338         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11339         case "$d_endgrent_r_proto:$usethreads" in
11340         ":define")      d_endgrent_r_proto=define
11341                 set d_endgrent_r_proto endgrent_r $hdrs
11342                 eval $hasproto ;;
11343         *)      ;;
11344         esac
11345         case "$d_endgrent_r_proto" in
11346         define)
11347         case "$endgrent_r_proto" in
11348         ''|0) try='int endgrent_r(FILE**);'
11349         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11350         esac
11351         case "$endgrent_r_proto" in
11352         ''|0) try='void endgrent_r(FILE**);'
11353         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11354         esac
11355         case "$endgrent_r_proto" in
11356         ''|0)   d_endgrent_r=undef
11357                 endgrent_r_proto=0
11358                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11359         * )     case "$endgrent_r_proto" in
11360                 REENTRANT_PROTO*) ;;
11361                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11362                 esac
11363                 echo "Prototype: $try" ;;
11364         esac
11365         ;;
11366         *)      case "$usethreads" in
11367                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11368                 esac
11369                 d_endgrent_r=undef
11370                 endgrent_r_proto=0
11371                 ;;
11372         esac
11373         ;;
11374 *)      endgrent_r_proto=0
11375         ;;
11376 esac
11377
11378 : see if endhostent exists
11379 set endhostent d_endhent
11380 eval $inlibc
11381
11382 : see if this is a netdb.h system
11383 set netdb.h i_netdb
11384 eval $inhdr
11385
11386 : see if endhostent_r exists
11387 set endhostent_r d_endhostent_r
11388 eval $inlibc
11389 case "$d_endhostent_r" in
11390 "$define")
11391         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11392         case "$d_endhostent_r_proto:$usethreads" in
11393         ":define")      d_endhostent_r_proto=define
11394                 set d_endhostent_r_proto endhostent_r $hdrs
11395                 eval $hasproto ;;
11396         *)      ;;
11397         esac
11398         case "$d_endhostent_r_proto" in
11399         define)
11400         case "$endhostent_r_proto" in
11401         ''|0) try='int endhostent_r(struct hostent_data*);'
11402         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11403         esac
11404         case "$endhostent_r_proto" in
11405         ''|0) try='void endhostent_r(struct hostent_data*);'
11406         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11407         esac
11408         case "$endhostent_r_proto" in
11409         ''|0)   d_endhostent_r=undef
11410                 endhostent_r_proto=0
11411                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11412         * )     case "$endhostent_r_proto" in
11413                 REENTRANT_PROTO*) ;;
11414                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11415                 esac
11416                 echo "Prototype: $try" ;;
11417         esac
11418         ;;
11419         *)      case "$usethreads" in
11420                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11421                 esac
11422                 d_endhostent_r=undef
11423                 endhostent_r_proto=0
11424                 ;;
11425         esac
11426         ;;
11427 *)      endhostent_r_proto=0
11428         ;;
11429 esac
11430
11431 : see if endnetent exists
11432 set endnetent d_endnent
11433 eval $inlibc
11434
11435 : see if endnetent_r exists
11436 set endnetent_r d_endnetent_r
11437 eval $inlibc
11438 case "$d_endnetent_r" in
11439 "$define")
11440         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11441         case "$d_endnetent_r_proto:$usethreads" in
11442         ":define")      d_endnetent_r_proto=define
11443                 set d_endnetent_r_proto endnetent_r $hdrs
11444                 eval $hasproto ;;
11445         *)      ;;
11446         esac
11447         case "$d_endnetent_r_proto" in
11448         define)
11449         case "$endnetent_r_proto" in
11450         ''|0) try='int endnetent_r(struct netent_data*);'
11451         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11452         esac
11453         case "$endnetent_r_proto" in
11454         ''|0) try='void endnetent_r(struct netent_data*);'
11455         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11456         esac
11457         case "$endnetent_r_proto" in
11458         ''|0)   d_endnetent_r=undef
11459                 endnetent_r_proto=0
11460                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11461         * )     case "$endnetent_r_proto" in
11462                 REENTRANT_PROTO*) ;;
11463                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11464                 esac
11465                 echo "Prototype: $try" ;;
11466         esac
11467         ;;
11468         *)      case "$usethreads" in
11469                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11470                 esac
11471                 d_endnetent_r=undef
11472                 endnetent_r_proto=0
11473                 ;;
11474         esac
11475         ;;
11476 *)      endnetent_r_proto=0
11477         ;;
11478 esac
11479
11480 : see if endprotoent exists
11481 set endprotoent d_endpent
11482 eval $inlibc
11483
11484 : see if endprotoent_r exists
11485 set endprotoent_r d_endprotoent_r
11486 eval $inlibc
11487 case "$d_endprotoent_r" in
11488 "$define")
11489         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11490         case "$d_endprotoent_r_proto:$usethreads" in
11491         ":define")      d_endprotoent_r_proto=define
11492                 set d_endprotoent_r_proto endprotoent_r $hdrs
11493                 eval $hasproto ;;
11494         *)      ;;
11495         esac
11496         case "$d_endprotoent_r_proto" in
11497         define)
11498         case "$endprotoent_r_proto" in
11499         ''|0) try='int endprotoent_r(struct protoent_data*);'
11500         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11501         esac
11502         case "$endprotoent_r_proto" in
11503         ''|0) try='void endprotoent_r(struct protoent_data*);'
11504         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11505         esac
11506         case "$endprotoent_r_proto" in
11507         ''|0)   d_endprotoent_r=undef
11508                 endprotoent_r_proto=0
11509                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11510         * )     case "$endprotoent_r_proto" in
11511                 REENTRANT_PROTO*) ;;
11512                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11513                 esac
11514                 echo "Prototype: $try" ;;
11515         esac
11516         ;;
11517         *)      case "$usethreads" in
11518                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11519                 esac
11520                 d_endprotoent_r=undef
11521                 endprotoent_r_proto=0
11522                 ;;
11523         esac
11524         ;;
11525 *)      endprotoent_r_proto=0
11526         ;;
11527 esac
11528
11529 : see if endpwent exists
11530 set endpwent d_endpwent
11531 eval $inlibc
11532
11533 : see if this is a pwd.h system
11534 set pwd.h i_pwd
11535 eval $inhdr
11536
11537 case "$i_pwd" in
11538 $define)
11539         xxx=`./findhdr pwd.h`
11540         $cppstdin $cppflags $cppminus < $xxx >$$.h
11541
11542         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11543                 val="$define"
11544         else
11545                 val="$undef"
11546         fi
11547         set d_pwquota
11548         eval $setvar
11549
11550         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11551                 val="$define"
11552         else
11553                 val="$undef"
11554         fi
11555         set d_pwage
11556         eval $setvar
11557
11558         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11559                 val="$define"
11560         else
11561                 val="$undef"
11562         fi
11563         set d_pwchange
11564         eval $setvar
11565
11566         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11567                 val="$define"
11568         else
11569                 val="$undef"
11570         fi
11571         set d_pwclass
11572         eval $setvar
11573
11574         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11575                 val="$define"
11576         else
11577                 val="$undef"
11578         fi
11579         set d_pwexpire
11580         eval $setvar
11581
11582         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11583                 val="$define"
11584         else
11585                 val="$undef"
11586         fi
11587         set d_pwcomment
11588         eval $setvar
11589
11590         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11591                 val="$define"
11592         else
11593                 val="$undef"
11594         fi
11595         set d_pwgecos
11596         eval $setvar
11597
11598         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11599                 val="$define"
11600         else
11601                 val="$undef"
11602         fi
11603         set d_pwpasswd
11604         eval $setvar
11605
11606         $rm -f $$.h
11607         ;;
11608 *)
11609         val="$undef"; 
11610         set d_pwquota; eval $setvar
11611         set d_pwage; eval $setvar
11612         set d_pwchange; eval $setvar
11613         set d_pwclass; eval $setvar
11614         set d_pwexpire; eval $setvar
11615         set d_pwcomment; eval $setvar
11616         set d_pwgecos; eval $setvar
11617         set d_pwpasswd; eval $setvar
11618         ;;
11619 esac
11620
11621 : see if endpwent_r exists
11622 set endpwent_r d_endpwent_r
11623 eval $inlibc
11624 case "$d_endpwent_r" in
11625 "$define")
11626         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11627         case "$d_endpwent_r_proto:$usethreads" in
11628         ":define")      d_endpwent_r_proto=define
11629                 set d_endpwent_r_proto endpwent_r $hdrs
11630                 eval $hasproto ;;
11631         *)      ;;
11632         esac
11633         case "$d_endpwent_r_proto" in
11634         define)
11635         case "$endpwent_r_proto" in
11636         ''|0) try='int endpwent_r(FILE**);'
11637         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11638         esac
11639         case "$endpwent_r_proto" in
11640         ''|0) try='void endpwent_r(FILE**);'
11641         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11642         esac
11643         case "$endpwent_r_proto" in
11644         ''|0)   d_endpwent_r=undef
11645                 endpwent_r_proto=0
11646                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11647         * )     case "$endpwent_r_proto" in
11648                 REENTRANT_PROTO*) ;;
11649                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11650                 esac
11651                 echo "Prototype: $try" ;;
11652         esac
11653         ;;
11654         *)      case "$usethreads" in
11655                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11656                 esac
11657                 d_endpwent_r=undef
11658                 endpwent_r_proto=0
11659                 ;;
11660         esac
11661         ;;
11662 *)      endpwent_r_proto=0
11663         ;;
11664 esac
11665
11666 : see if endservent exists
11667 set endservent d_endsent
11668 eval $inlibc
11669
11670 : see if endservent_r exists
11671 set endservent_r d_endservent_r
11672 eval $inlibc
11673 case "$d_endservent_r" in
11674 "$define")
11675         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11676         case "$d_endservent_r_proto:$usethreads" in
11677         ":define")      d_endservent_r_proto=define
11678                 set d_endservent_r_proto endservent_r $hdrs
11679                 eval $hasproto ;;
11680         *)      ;;
11681         esac
11682         case "$d_endservent_r_proto" in
11683         define)
11684         case "$endservent_r_proto" in
11685         ''|0) try='int endservent_r(struct servent_data*);'
11686         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11687         esac
11688         case "$endservent_r_proto" in
11689         ''|0) try='void endservent_r(struct servent_data*);'
11690         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11691         esac
11692         case "$endservent_r_proto" in
11693         ''|0)   d_endservent_r=undef
11694                 endservent_r_proto=0
11695                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11696         * )     case "$endservent_r_proto" in
11697                 REENTRANT_PROTO*) ;;
11698                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11699                 esac
11700                 echo "Prototype: $try" ;;
11701         esac
11702         ;;
11703         *)      case "$usethreads" in
11704                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11705                 esac
11706                 d_endservent_r=undef
11707                 endservent_r_proto=0
11708                 ;;
11709         esac
11710         ;;
11711 *)      endservent_r_proto=0
11712         ;;
11713 esac
11714
11715 : Locate the flags for 'open()'
11716 echo " "
11717 $cat >try.c <<EOCP
11718 #include <sys/types.h>
11719 #ifdef I_FCNTL
11720 #include <fcntl.h>
11721 #endif
11722 #ifdef I_SYS_FILE
11723 #include <sys/file.h>
11724 #endif
11725 #$i_stdlib I_STDLIB
11726 #ifdef I_STDLIB
11727 #include <stdlib.h>
11728 #endif
11729 int main() {
11730         if(O_RDONLY);
11731 #ifdef O_TRUNC
11732         exit(0);
11733 #else
11734         exit(1);
11735 #endif
11736 }
11737 EOCP
11738 : check sys/file.h first to get FREAD on Sun
11739 if $test `./findhdr sys/file.h` && \
11740                 set try -DI_SYS_FILE && eval $compile; then
11741         h_sysfile=true;
11742         echo "<sys/file.h> defines the O_* constants..." >&4
11743         if $run ./try; then
11744                 echo "and you have the 3 argument form of open()." >&4
11745                 val="$define"
11746         else
11747                 echo "but not the 3 argument form of open().  Oh, well." >&4
11748                 val="$undef"
11749         fi
11750 elif $test `./findhdr fcntl.h` && \
11751                 set try -DI_FCNTL && eval $compile; then
11752         h_fcntl=true;
11753         echo "<fcntl.h> defines the O_* constants..." >&4
11754         if $run ./try; then
11755                 echo "and you have the 3 argument form of open()." >&4
11756                 val="$define"
11757         else
11758                 echo "but not the 3 argument form of open().  Oh, well." >&4
11759                 val="$undef"
11760         fi
11761 else
11762         val="$undef"
11763         echo "I can't find the O_* constant definitions!  You got problems." >&4
11764 fi
11765 set d_open3
11766 eval $setvar
11767 $rm -f try try.*
11768
11769 : see which of string.h or strings.h is needed
11770 echo " "
11771 strings=`./findhdr string.h`
11772 if $test "$strings" && $test -r "$strings"; then
11773         echo "Using <string.h> instead of <strings.h>." >&4
11774         val="$define"
11775 else
11776         val="$undef"
11777         strings=`./findhdr strings.h`
11778         if $test "$strings" && $test -r "$strings"; then
11779                 echo "Using <strings.h> instead of <string.h>." >&4
11780         else
11781                 echo "No string header found -- You'll surely have problems." >&4
11782         fi
11783 fi
11784 set i_string
11785 eval $setvar
11786 case "$i_string" in
11787 "$undef") strings=`./findhdr strings.h`;;
11788 *)        strings=`./findhdr string.h`;;
11789 esac
11790
11791 : see if this is a sys/file.h system
11792 val=''
11793 set sys/file.h val
11794 eval $inhdr
11795
11796 : do we need to include sys/file.h ?
11797 case "$val" in
11798 "$define")
11799         echo " "
11800         if $h_sysfile; then
11801                 val="$define"
11802                 echo "We'll be including <sys/file.h>." >&4
11803         else
11804                 val="$undef"
11805                 echo "We won't be including <sys/file.h>." >&4
11806         fi
11807         ;;
11808 *)
11809         h_sysfile=false
11810         ;;
11811 esac
11812 set i_sysfile
11813 eval $setvar
11814
11815 : see if fcntl.h is there
11816 val=''
11817 set fcntl.h val
11818 eval $inhdr
11819
11820 : see if we can include fcntl.h
11821 case "$val" in
11822 "$define")
11823         echo " "
11824         if $h_fcntl; then
11825                 val="$define"
11826                 echo "We'll be including <fcntl.h>." >&4
11827         else
11828                 val="$undef"
11829                 if $h_sysfile; then
11830         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11831                 else
11832                         echo "We won't be including <fcntl.h>." >&4
11833                 fi
11834         fi
11835         ;;
11836 *)
11837         h_fcntl=false
11838         val="$undef"
11839         ;;
11840 esac
11841 set i_fcntl
11842 eval $setvar
11843
11844 : check for non-blocking I/O stuff
11845 case "$h_sysfile" in
11846 true) echo "#include <sys/file.h>" > head.c;;
11847 *)
11848        case "$h_fcntl" in
11849        true) echo "#include <fcntl.h>" > head.c;;
11850        *) echo "#include <sys/fcntl.h>" > head.c;;
11851        esac
11852        ;;
11853 esac
11854 echo " "
11855 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11856 case "$o_nonblock" in
11857 '')
11858         $cat head.c > try.c
11859         $cat >>try.c <<EOCP
11860 #include <stdio.h>
11861 #$i_stdlib I_STDLIB
11862 #ifdef I_STDLIB
11863 #include <stdlib.h>
11864 #endif
11865 #$i_fcntl I_FCNTL
11866 #ifdef I_FCNTL
11867 #include <fcntl.h>
11868 #endif
11869 int main() {
11870 #ifdef O_NONBLOCK
11871         printf("O_NONBLOCK\n");
11872         exit(0);
11873 #endif
11874 #ifdef O_NDELAY
11875         printf("O_NDELAY\n");
11876         exit(0);
11877 #endif
11878 #ifdef FNDELAY
11879         printf("FNDELAY\n");
11880         exit(0);
11881 #endif
11882         exit(0);
11883 }
11884 EOCP
11885         set try
11886         if eval $compile_ok; then
11887                 o_nonblock=`$run ./try`
11888                 case "$o_nonblock" in
11889                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11890                 *) echo "Seems like we can use $o_nonblock.";;
11891                 esac
11892         else
11893                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11894         fi
11895         ;;
11896 *) echo "Using $hint value $o_nonblock.";;
11897 esac
11898 $rm -f try try.* .out core
11899
11900 echo " "
11901 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11902 case "$eagain" in
11903 '')
11904         $cat head.c > try.c
11905         $cat >>try.c <<EOCP
11906 #include <errno.h>
11907 #include <sys/types.h>
11908 #include <signal.h>
11909 #include <stdio.h> 
11910 #$i_stdlib I_STDLIB
11911 #ifdef I_STDLIB
11912 #include <stdlib.h>
11913 #endif
11914 #$i_fcntl I_FCNTL
11915 #ifdef I_FCNTL
11916 #include <fcntl.h>
11917 #endif
11918 #define MY_O_NONBLOCK $o_nonblock
11919 #ifndef errno  /* XXX need better Configure test */
11920 extern int errno;
11921 #endif
11922 #$i_unistd I_UNISTD
11923 #ifdef I_UNISTD
11924 #include <unistd.h>
11925 #endif
11926 #$i_string I_STRING
11927 #ifdef I_STRING
11928 #include <string.h>
11929 #else
11930 #include <strings.h>
11931 #endif
11932 $signal_t blech(x) int x; { exit(3); }
11933 EOCP
11934         $cat >> try.c <<'EOCP'
11935 int main()
11936 {
11937         int pd[2];
11938         int pu[2];
11939         char buf[1];
11940         char string[100];
11941
11942         pipe(pd);       /* Down: child -> parent */
11943         pipe(pu);       /* Up: parent -> child */
11944         if (0 != fork()) {
11945                 int ret;
11946                 close(pd[1]);   /* Parent reads from pd[0] */
11947                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11948 #ifdef F_SETFL
11949                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11950                         exit(1);
11951 #else
11952                 exit(4);
11953 #endif
11954                 signal(SIGALRM, blech);
11955                 alarm(5);
11956                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11957                         exit(2);
11958                 sprintf(string, "%d\n", ret);
11959                 write(2, string, strlen(string));
11960                 alarm(0);
11961 #ifdef EAGAIN
11962                 if (errno == EAGAIN) {
11963                         printf("EAGAIN\n");
11964                         goto ok;
11965                 }
11966 #endif
11967 #ifdef EWOULDBLOCK
11968                 if (errno == EWOULDBLOCK)
11969                         printf("EWOULDBLOCK\n");
11970 #endif
11971         ok:
11972                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11973                 sleep(2);                               /* Give it time to close our pipe */
11974                 alarm(5);
11975                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11976                 alarm(0);
11977                 sprintf(string, "%d\n", ret);
11978                 write(4, string, strlen(string));
11979                 exit(0);
11980         }
11981
11982         close(pd[0]);                   /* We write to pd[1] */
11983         close(pu[1]);                   /* We read from pu[0] */
11984         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11985         close(pd[1]);                   /* Pipe pd is now fully closed! */
11986         exit(0);                                /* Bye bye, thank you for playing! */
11987 }
11988 EOCP
11989         set try
11990         if eval $compile_ok; then
11991                 echo "$startsh" >mtry
11992                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11993                 chmod +x mtry
11994                 ./mtry >/dev/null 2>&1
11995                 case $? in
11996                 0) eagain=`$cat try.out`;;
11997                 1) echo "Could not perform non-blocking setting!";;
11998                 2) echo "I did a successful read() for something that was not there!";;
11999                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12000                 4) echo "Could not find F_SETFL!";;
12001                 *) echo "Something terribly wrong happened during testing.";;
12002                 esac
12003                 rd_nodata=`$cat try.ret`
12004                 echo "A read() system call with no data present returns $rd_nodata."
12005                 case "$rd_nodata" in
12006                 0|-1) ;;
12007                 *)
12008                         echo "(That's peculiar, fixing that to be -1.)"
12009                         rd_nodata=-1
12010                         ;;
12011                 esac
12012                 case "$eagain" in
12013                 '')
12014                         echo "Forcing errno EAGAIN on read() with no data available."
12015                         eagain=EAGAIN
12016                         ;;
12017                 *)
12018                         echo "Your read() sets errno to $eagain when no data is available."
12019                         ;;
12020                 esac
12021                 status=`$cat try.err`
12022                 case "$status" in
12023                 0) echo "And it correctly returns 0 to signal EOF.";;
12024                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12025                 *) echo "However, your read() returns '$status' on EOF??";;
12026                 esac
12027                 val="$define"
12028                 if test "$status" = "$rd_nodata"; then
12029                         echo "WARNING: you can't distinguish between EOF and no data!"
12030                         val="$undef"
12031                 fi
12032         else
12033                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12034                 eagain=EAGAIN
12035         fi
12036         set d_eofnblk
12037         eval $setvar
12038         ;;
12039 *)
12040         echo "Using $hint value $eagain."
12041         echo "Your read() returns $rd_nodata when no data is present."
12042         case "$d_eofnblk" in
12043         "$define") echo "And you can see EOF because read() returns 0.";;
12044         "$undef") echo "But you can't see EOF status from read() returned value.";;
12045         *)
12046                 echo "(Assuming you can't see EOF status from read anyway.)"
12047                 d_eofnblk=$undef
12048                 ;;
12049         esac
12050         ;;
12051 esac
12052 $rm -f try try.* .out core head.c mtry
12053
12054 : see if _ptr and _cnt from stdio act std
12055 echo " "
12056
12057 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12058         echo "(Looks like you have stdio.h from BSD.)"
12059         case "$stdio_ptr" in
12060         '') stdio_ptr='((fp)->_p)'
12061                 ptr_lval=$define
12062                 ;;
12063         *)      ptr_lval=$d_stdio_ptr_lval;;
12064         esac
12065         case "$stdio_cnt" in
12066         '') stdio_cnt='((fp)->_r)'
12067                 cnt_lval=$define
12068                 ;;
12069         *)      cnt_lval=$d_stdio_cnt_lval;;
12070         esac
12071         case "$stdio_base" in
12072         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12073         esac
12074         case "$stdio_bufsiz" in
12075         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12076         esac
12077 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12078         echo "(Looks like you have stdio.h from Linux.)"
12079         case "$stdio_ptr" in
12080         '') stdio_ptr='((fp)->_IO_read_ptr)'
12081                 ptr_lval=$define
12082                 ;;
12083         *)      ptr_lval=$d_stdio_ptr_lval;;
12084         esac
12085         case "$stdio_cnt" in
12086         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12087                 cnt_lval=$undef
12088                 ;;
12089         *)      cnt_lval=$d_stdio_cnt_lval;;
12090         esac
12091         case "$stdio_base" in
12092         '') stdio_base='((fp)->_IO_read_base)';;
12093         esac
12094         case "$stdio_bufsiz" in
12095         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12096         esac
12097 else
12098         case "$stdio_ptr" in
12099         '') stdio_ptr='((fp)->_ptr)'
12100                 ptr_lval=$define
12101                 ;;
12102         *)      ptr_lval=$d_stdio_ptr_lval;;
12103         esac
12104         case "$stdio_cnt" in
12105         '') stdio_cnt='((fp)->_cnt)'
12106                 cnt_lval=$define
12107                 ;;
12108         *)      cnt_lval=$d_stdio_cnt_lval;;
12109         esac
12110         case "$stdio_base" in
12111         '') stdio_base='((fp)->_base)';;
12112         esac
12113         case "$stdio_bufsiz" in
12114         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12115         esac
12116 fi
12117
12118 : test whether _ptr and _cnt really work
12119 echo "Checking how std your stdio is..." >&4
12120 $cat >try.c <<EOP
12121 #include <stdio.h>
12122 #$i_stdlib I_STDLIB
12123 #ifdef I_STDLIB
12124 #include <stdlib.h>
12125 #endif
12126 #define FILE_ptr(fp)    $stdio_ptr
12127 #define FILE_cnt(fp)    $stdio_cnt
12128 int main() {
12129         FILE *fp = fopen("try.c", "r");
12130         char c = getc(fp);
12131         if (
12132                 18 <= FILE_cnt(fp) &&
12133                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12134         )
12135                 exit(0);
12136         exit(1);
12137 }
12138 EOP
12139 val="$undef"
12140 set try
12141 if eval $compile && $to try.c; then
12142         if $run ./try; then
12143                 echo "Your stdio acts pretty std."
12144                 val="$define"
12145         else
12146                 echo "Your stdio isn't very std."
12147         fi
12148 else
12149         echo "Your stdio doesn't appear very std."
12150 fi
12151 $rm -f try.c try
12152
12153 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12154 # direct buffer manipulation no longer works.  The Configure tests
12155 # should be changed to correctly detect this, but until then,
12156 # the following check should at least let perl compile and run.
12157 # (This quick fix should be updated before 5.8.1.)
12158 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12159 # A. Dougherty, June 3, 2002.
12160 case "$d_gnulibc" in
12161 $define)
12162         case "$gnulibc_version" in
12163         2.[01]*)  ;;
12164         2.2) ;;
12165         2.2.[0-9]) ;;
12166         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12167                 val="$undef"
12168                 ;;
12169         esac
12170         ;;
12171 esac
12172 set d_stdstdio
12173 eval $setvar
12174
12175 : Can _ptr be used as an lvalue?
12176 case "$d_stdstdio$ptr_lval" in
12177 $define$define) val=$define ;;
12178 *) val=$undef ;;
12179 esac
12180 set d_stdio_ptr_lval
12181 eval $setvar
12182
12183 : Can _cnt be used as an lvalue?
12184 case "$d_stdstdio$cnt_lval" in
12185 $define$define) val=$define ;;
12186 *) val=$undef ;;
12187 esac
12188 set d_stdio_cnt_lval
12189 eval $setvar
12190
12191
12192 : test whether setting _ptr sets _cnt as a side effect
12193 d_stdio_ptr_lval_sets_cnt="$undef"
12194 d_stdio_ptr_lval_nochange_cnt="$undef"
12195 case "$d_stdio_ptr_lval$d_stdstdio" in
12196 $define$define)
12197         echo "Checking to see what happens if we set the stdio ptr..." >&4
12198 $cat >try.c <<EOP
12199 #include <stdio.h>
12200 /* Can we scream? */
12201 /* Eat dust sed :-) */
12202 /* In the buffer space, no one can hear you scream. */
12203 #$i_stdlib I_STDLIB
12204 #ifdef I_STDLIB
12205 #include <stdlib.h>
12206 #endif
12207 #define FILE_ptr(fp)    $stdio_ptr
12208 #define FILE_cnt(fp)    $stdio_cnt
12209 #include <sys/types.h>
12210 int main() {
12211         FILE *fp = fopen("try.c", "r");
12212         int c;
12213         char *ptr;
12214         size_t cnt;
12215         if (!fp) {
12216             puts("Fail even to read");
12217             exit(1);
12218         }
12219         c = getc(fp); /* Read away the first # */
12220         if (c == EOF) {
12221             puts("Fail even to read");
12222             exit(1);
12223         }
12224         if (!(
12225                 18 <= FILE_cnt(fp) &&
12226                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12227         )) {
12228                 puts("Fail even to read");
12229                 exit (1);
12230         }
12231         ptr = (char*) FILE_ptr(fp);
12232         cnt = (size_t)FILE_cnt(fp);
12233
12234         FILE_ptr(fp) += 42;
12235
12236         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12237                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12238                 exit (1);
12239         }
12240         if (FILE_cnt(fp) <= 20) {
12241                 printf ("Fail (<20 chars to test)");
12242                 exit (1);
12243         }
12244         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12245                 puts("Fail compare");
12246                 exit (1);
12247         }
12248         if (cnt == FILE_cnt(fp)) {
12249                 puts("Pass_unchanged");
12250                 exit (0);
12251         }       
12252         if (FILE_cnt(fp) == (cnt - 42)) {
12253                 puts("Pass_changed");
12254                 exit (0);
12255         }
12256         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12257         return 1;
12258
12259 }
12260 EOP
12261         set try
12262         if eval $compile && $to try.c; then
12263                 case `$run ./try` in
12264                 Pass_changed)
12265                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12266                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12267                 Pass_unchanged)
12268                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12269                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12270                 Fail*)
12271                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12272                 *)
12273                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12274         esac
12275         else
12276                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12277         fi
12278         $rm -f try.c try
12279         ;;
12280 esac
12281
12282 : see if _base is also standard
12283 val="$undef"
12284 case "$d_stdstdio" in
12285 $define)
12286         $cat >try.c <<EOP
12287 #include <stdio.h>
12288 #$i_stdlib I_STDLIB
12289 #ifdef I_STDLIB
12290 #include <stdlib.h>
12291 #endif
12292 #define FILE_base(fp)   $stdio_base
12293 #define FILE_bufsiz(fp) $stdio_bufsiz
12294 int main() {
12295         FILE *fp = fopen("try.c", "r");
12296         char c = getc(fp);
12297         if (
12298                 19 <= FILE_bufsiz(fp) &&
12299                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12300         )
12301                 exit(0);
12302         exit(1);
12303 }
12304 EOP
12305         set try
12306         if eval $compile && $to try.c; then
12307                 if $run ./try; then
12308                         echo "And its _base field acts std."
12309                         val="$define"
12310                 else
12311                         echo "But its _base field isn't std."
12312                 fi
12313         else
12314                 echo "However, it seems to be lacking the _base field."
12315         fi
12316         $rm -f try.c try
12317         ;;
12318 esac
12319 set d_stdiobase
12320 eval $setvar
12321
12322 : see if fast_stdio exists
12323 val="$undef"
12324 case "$d_stdstdio:$d_stdio_ptr_lval" in
12325 "$define:$define")
12326         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12327         *$define*)
12328                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12329                 val="$define"
12330                 ;;
12331         esac
12332         ;;
12333 esac
12334 set d_faststdio
12335 eval $setvar
12336
12337
12338
12339 : see if fchdir exists
12340 set fchdir d_fchdir
12341 eval $inlibc
12342
12343 : see if fchmod exists
12344 set fchmod d_fchmod
12345 eval $inlibc
12346
12347 : see if fchown exists
12348 set fchown d_fchown
12349 eval $inlibc
12350
12351 : see if this is an fcntl system
12352 set fcntl d_fcntl
12353 eval $inlibc
12354
12355 echo " "
12356 : See if fcntl-based locking works.
12357 $cat >try.c <<EOCP
12358 #$i_stdlib I_STDLIB
12359 #ifdef I_STDLIB
12360 #include <stdlib.h>
12361 #endif
12362 #include <unistd.h>
12363 #include <fcntl.h>
12364 #include <signal.h>
12365 $signal_t blech(x) int x; { exit(3); }
12366 int main() {
12367 #if defined(F_SETLK) && defined(F_SETLKW)
12368      struct flock flock;
12369      int retval, fd;
12370      fd = open("try.c", O_RDONLY);
12371      flock.l_type = F_RDLCK;
12372      flock.l_whence = SEEK_SET;
12373      flock.l_start = flock.l_len = 0;
12374      signal(SIGALRM, blech);
12375      alarm(10);
12376      retval = fcntl(fd, F_SETLK, &flock);
12377      close(fd);
12378      (retval < 0 ? exit(2) : exit(0));
12379 #else
12380      exit(2);
12381 #endif
12382 }
12383 EOCP
12384 echo "Checking if fcntl-based file locking works... "
12385 case "$d_fcntl" in
12386 "$define")
12387         set try
12388         if eval $compile_ok; then
12389                 if $run ./try; then
12390                         echo "Yes, it seems to work."
12391                         val="$define"
12392                 else
12393                         echo "Nope, it didn't work."
12394                         val="$undef"
12395                         case "$?" in
12396                         3) $cat >&4 <<EOM
12397 ***
12398 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12399 *** This is (almost) impossible.
12400 *** If your NFS lock daemons are not feeling well, something like
12401 *** this may happen, please investigate.  Cannot continue, aborting.
12402 ***
12403 EOM
12404                                 exit 1
12405                                 ;;
12406                         esac
12407                 fi
12408         else
12409                 echo "I'm unable to compile the test program, so I'll assume not."
12410                 val="$undef"
12411         fi
12412         ;;
12413 *) val="$undef";
12414         echo "Nope, since you don't even have fcntl()."
12415         ;;
12416 esac
12417 set d_fcntl_can_lock
12418 eval $setvar
12419 $rm -f try*
12420
12421
12422 : check for fd_set items
12423 $cat <<EOM
12424
12425 Checking to see how well your C compiler handles fd_set and friends ...
12426 EOM
12427 $cat >try.c <<EOCP
12428 #$i_stdlib I_STDLIB
12429 #ifdef I_STDLIB
12430 #include <stdlib.h>
12431 #endif
12432 #$i_systime I_SYS_TIME
12433 #$i_sysselct I_SYS_SELECT
12434 #$d_socket HAS_SOCKET
12435 #include <sys/types.h>
12436 #ifdef HAS_SOCKET
12437 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12438 #endif
12439 #ifdef I_SYS_TIME
12440 #include <sys/time.h>
12441 #endif
12442 #ifdef I_SYS_SELECT
12443 #include <sys/select.h>
12444 #endif
12445 int main() {
12446         fd_set fds;
12447
12448 #ifdef TRYBITS
12449         if(fds.fds_bits);
12450 #endif
12451
12452 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12453         exit(0);
12454 #else
12455         exit(1);
12456 #endif
12457 }
12458 EOCP
12459 set try -DTRYBITS
12460 if eval $compile; then
12461         d_fds_bits="$define"
12462         d_fd_set="$define"
12463         echo "Well, your system knows about the normal fd_set typedef..." >&4
12464         if $run ./try; then
12465                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12466                 d_fd_macros="$define"
12467         else
12468                 $cat >&4 <<'EOM'
12469 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12470 EOM
12471                 d_fd_macros="$undef"
12472         fi
12473 else
12474         $cat <<'EOM'
12475 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12476 EOM
12477         set try
12478         if eval $compile; then
12479                 d_fds_bits="$undef"
12480                 d_fd_set="$define"
12481                 echo "Well, your system has some sort of fd_set available..." >&4
12482                 if $run ./try; then
12483                         echo "and you have the normal fd_set macros." >&4
12484                         d_fd_macros="$define"
12485                 else
12486                         $cat <<'EOM'
12487 but not the normal fd_set macros!  Gross!  More work for me...
12488 EOM
12489                         d_fd_macros="$undef"
12490                 fi
12491         else
12492         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12493                 d_fd_set="$undef"
12494                 d_fds_bits="$undef"
12495                 d_fd_macros="$undef"
12496         fi
12497 fi
12498 $rm -f try try.*
12499
12500 : see if fgetpos exists
12501 set fgetpos d_fgetpos
12502 eval $inlibc
12503
12504 : see if finite exists
12505 set finite d_finite
12506 eval $inlibc
12507
12508 : see if finitel exists
12509 set finitel d_finitel
12510 eval $inlibc
12511
12512 : see if flock exists
12513 set flock d_flock
12514 eval $inlibc
12515
12516 : see if prototype for flock is available
12517 echo " "
12518 set d_flockproto flock $i_sysfile sys/file.h
12519 eval $hasproto
12520
12521 : see if fork exists
12522 set fork d_fork
12523 eval $inlibc
12524
12525 : see if fp_class exists
12526 set fp_class d_fp_class
12527 eval $inlibc
12528
12529 : see if pathconf exists
12530 set pathconf d_pathconf
12531 eval $inlibc
12532
12533 : see if fpathconf exists
12534 set fpathconf d_fpathconf
12535 eval $inlibc
12536
12537 : see if fpclass exists
12538 set fpclass d_fpclass
12539 eval $inlibc
12540
12541 : see if fpclassify exists
12542 set fpclassify d_fpclassify
12543 eval $inlibc
12544
12545 : see if fpclassl exists
12546 set fpclassl d_fpclassl
12547 eval $inlibc
12548
12549
12550 : check for fpos64_t
12551 echo " "
12552 echo "Checking to see if you have fpos64_t..." >&4
12553 $cat >try.c <<EOCP
12554 #include <stdio.h>
12555 int main() { fpos64_t x = 7; }
12556 EOCP
12557 set try
12558 if eval $compile; then
12559         val="$define"
12560         echo "You have fpos64_t."
12561 else
12562         val="$undef"
12563         echo "You do not have fpos64_t."
12564         case "$fpossize" in
12565         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12566         esac
12567 fi
12568 $rm -f try.* try
12569 set d_fpos64_t
12570 eval $setvar
12571
12572 : see if frexpl exists
12573 set frexpl d_frexpl
12574 eval $inlibc
12575
12576 : see if this is a sys/param system
12577 set sys/param.h i_sysparam
12578 eval $inhdr
12579
12580 : see if this is a sys/mount.h system
12581 set sys/mount.h i_sysmount
12582 eval $inhdr
12583
12584
12585 echo " "
12586 echo "Checking to see if your system supports struct fs_data..." >&4
12587 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12588 eval $hasstruct
12589 case "$d_fs_data_s" in
12590 "$define")      echo "Yes, it does."   ;;
12591 *)              echo "No, it doesn't." ;;
12592 esac
12593
12594 : see if fseeko exists
12595 set fseeko d_fseeko
12596 eval $inlibc
12597 case "$longsize" in
12598 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12599 esac
12600
12601 : see if fsetpos exists
12602 set fsetpos d_fsetpos
12603 eval $inlibc
12604
12605
12606 : see if fstatfs exists
12607 set fstatfs d_fstatfs
12608 eval $inlibc
12609
12610
12611 : see if statvfs exists
12612 set statvfs d_statvfs
12613 eval $inlibc
12614
12615 : see if fstatvfs exists
12616 set fstatvfs d_fstatvfs
12617 eval $inlibc
12618
12619
12620 : see if fsync exists
12621 set fsync d_fsync
12622 eval $inlibc
12623
12624 : see if ftello exists
12625 set ftello d_ftello
12626 eval $inlibc
12627 case "$longsize" in
12628 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12629 esac
12630
12631 d_futimes="$undef"
12632 : check for a working futimes
12633 echo " "
12634 echo "Checking for a working futimes()" >&4
12635 $cat >try.c <<EOCP
12636 #include <stdio.h>
12637 #include <sys/time.h>
12638 #include <errno.h>
12639 #include <fcntl.h>
12640
12641 int main ()
12642 {
12643     int fd, rv;
12644     fd = open ("try.c", O_RDWR);
12645     if (-1 == fd) exit (1);
12646     rv = futimes (fd, NULL);
12647     exit (rv == -1 ? errno : 0);
12648 }
12649 EOCP
12650 set try
12651 if eval $compile; then
12652     `$run ./try`
12653     rc=$?
12654     case "$rc" in
12655         0)  echo "Yes, it does" >&4
12656             d_futimes="$define"
12657             ;;
12658         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12659             ;;
12660     esac
12661 else
12662     echo "No, it does not (probably harmless)\n" >&4
12663 fi
12664 $rm -f try.* try core core.try.*
12665
12666 : see if getcwd exists
12667 set getcwd d_getcwd
12668 eval $inlibc
12669
12670 : see if getespwnam exists
12671 set getespwnam d_getespwnam
12672 eval $inlibc
12673
12674
12675 : see if getfsstat exists
12676 set getfsstat d_getfsstat
12677 eval $inlibc
12678
12679 : see if getgrent exists
12680 set getgrent d_getgrent
12681 eval $inlibc
12682
12683 : see if getgrent_r exists
12684 set getgrent_r d_getgrent_r
12685 eval $inlibc
12686 case "$d_getgrent_r" in
12687 "$define")
12688         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12689         case "$d_getgrent_r_proto:$usethreads" in
12690         ":define")      d_getgrent_r_proto=define
12691                 set d_getgrent_r_proto getgrent_r $hdrs
12692                 eval $hasproto ;;
12693         *)      ;;
12694         esac
12695         case "$d_getgrent_r_proto" in
12696         define)
12697         case "$getgrent_r_proto" in
12698         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12699         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12700         esac
12701         case "$getgrent_r_proto" in
12702         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12703         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12704         esac
12705         case "$getgrent_r_proto" in
12706         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12707         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12708         esac
12709         case "$getgrent_r_proto" in
12710         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12711         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12712         esac
12713         case "$getgrent_r_proto" in
12714         ''|0) try='int getgrent_r(struct group*, char*, int);'
12715         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12716         esac
12717         case "$getgrent_r_proto" in
12718         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12719         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12720         esac
12721         case "$getgrent_r_proto" in
12722         ''|0)   d_getgrent_r=undef
12723                 getgrent_r_proto=0
12724                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12725         * )     case "$getgrent_r_proto" in
12726                 REENTRANT_PROTO*) ;;
12727                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12728                 esac
12729                 echo "Prototype: $try" ;;
12730         esac
12731         ;;
12732         *)      case "$usethreads" in
12733                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12734                 esac
12735                 d_getgrent_r=undef
12736                 getgrent_r_proto=0
12737                 ;;
12738         esac
12739         ;;
12740 *)      getgrent_r_proto=0
12741         ;;
12742 esac
12743
12744 : see if getgrgid_r exists
12745 set getgrgid_r d_getgrgid_r
12746 eval $inlibc
12747 case "$d_getgrgid_r" in
12748 "$define")
12749         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12750         case "$d_getgrgid_r_proto:$usethreads" in
12751         ":define")      d_getgrgid_r_proto=define
12752                 set d_getgrgid_r_proto getgrgid_r $hdrs
12753                 eval $hasproto ;;
12754         *)      ;;
12755         esac
12756         case "$d_getgrgid_r_proto" in
12757         define)
12758         case "$getgrgid_r_proto" in
12759         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12760         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12761         esac
12762         case "$getgrgid_r_proto" in
12763         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12764         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12765         esac
12766         case "$getgrgid_r_proto" in
12767         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12768         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12769         esac
12770         case "$getgrgid_r_proto" in
12771         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12772         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12773         esac
12774         case "$getgrgid_r_proto" in
12775         ''|0)   d_getgrgid_r=undef
12776                 getgrgid_r_proto=0
12777                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12778         * )     case "$getgrgid_r_proto" in
12779                 REENTRANT_PROTO*) ;;
12780                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12781                 esac
12782                 echo "Prototype: $try" ;;
12783         esac
12784         ;;
12785         *)      case "$usethreads" in
12786                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12787                 esac
12788                 d_getgrgid_r=undef
12789                 getgrgid_r_proto=0
12790                 ;;
12791         esac
12792         ;;
12793 *)      getgrgid_r_proto=0
12794         ;;
12795 esac
12796
12797 : see if getgrnam_r exists
12798 set getgrnam_r d_getgrnam_r
12799 eval $inlibc
12800 case "$d_getgrnam_r" in
12801 "$define")
12802         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12803         case "$d_getgrnam_r_proto:$usethreads" in
12804         ":define")      d_getgrnam_r_proto=define
12805                 set d_getgrnam_r_proto getgrnam_r $hdrs
12806                 eval $hasproto ;;
12807         *)      ;;
12808         esac
12809         case "$d_getgrnam_r_proto" in
12810         define)
12811         case "$getgrnam_r_proto" in
12812         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12813         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12814         esac
12815         case "$getgrnam_r_proto" in
12816         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12817         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12818         esac
12819         case "$getgrnam_r_proto" in
12820         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12821         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12822         esac
12823         case "$getgrnam_r_proto" in
12824         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12825         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12826         esac
12827         case "$getgrnam_r_proto" in
12828         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12829         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12830         esac
12831         case "$getgrnam_r_proto" in
12832         ''|0)   d_getgrnam_r=undef
12833                 getgrnam_r_proto=0
12834                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12835         * )     case "$getgrnam_r_proto" in
12836                 REENTRANT_PROTO*) ;;
12837                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12838                 esac
12839                 echo "Prototype: $try" ;;
12840         esac
12841         ;;
12842         *)      case "$usethreads" in
12843                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12844                 esac
12845                 d_getgrnam_r=undef
12846                 getgrnam_r_proto=0
12847                 ;;
12848         esac
12849         ;;
12850 *)      getgrnam_r_proto=0
12851         ;;
12852 esac
12853
12854 : see if gethostbyaddr exists
12855 set gethostbyaddr d_gethbyaddr
12856 eval $inlibc
12857
12858 : see if gethostbyname exists
12859 set gethostbyname d_gethbyname
12860 eval $inlibc
12861
12862 : see if gethostent exists
12863 set gethostent d_gethent
12864 eval $inlibc
12865
12866 : see how we will look up host name
12867 echo " "
12868 call=''
12869 if set gethostname val -f d_gethname; eval $csym; $val; then
12870         echo 'gethostname() found.' >&4
12871         d_gethname="$define"
12872         call=gethostname
12873 fi
12874 if set uname val -f d_uname; eval $csym; $val; then
12875         if ./xenix; then
12876                 $cat <<'EOM'
12877 uname() was found, but you're running xenix, and older versions of xenix
12878 have a broken uname(). If you don't really know whether your xenix is old
12879 enough to have a broken system call, use the default answer.
12880
12881 EOM
12882                 dflt=y
12883                 case "$d_uname" in
12884                 "$define") dflt=n;;
12885                 esac
12886                 rp='Is your uname() broken?'
12887                 . ./myread
12888                 case "$ans" in
12889                 n*) d_uname="$define"; call=uname;;
12890                 esac
12891         else
12892                 echo 'uname() found.' >&4
12893                 d_uname="$define"
12894                 case "$call" in
12895                 '') call=uname ;;
12896                 esac
12897         fi
12898 fi
12899 case "$d_gethname" in
12900 '') d_gethname="$undef";;
12901 esac
12902 case "$d_uname" in
12903 '') d_uname="$undef";;
12904 esac
12905 case "$d_uname$d_gethname" in
12906 *define*)
12907         dflt=n
12908         cat <<EOM
12909  
12910 Every now and then someone has a $call() that lies about the hostname
12911 but can't be fixed for political or economic reasons.  If you wish, I can
12912 pretend $call() isn't there and maybe compute hostname at run-time
12913 thanks to the '$phostname' command.
12914
12915 EOM
12916         rp="Shall I ignore $call() from now on?"
12917         . ./myread
12918         case "$ans" in
12919         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12920         esac;;
12921 esac
12922 case "$phostname" in
12923 '') aphostname='';;
12924 *) case "$aphostname" in
12925         /*) ;;
12926         *) set X $phostname
12927                 shift
12928                 file=$1
12929                 shift
12930                 file=`./loc $file $file $pth`
12931                 aphostname=`echo $file $*`
12932                 ;;
12933         esac
12934         ;;
12935 esac
12936 case "$d_uname$d_gethname" in
12937 *define*) ;;
12938 *)
12939         case "$phostname" in
12940         '')
12941                 echo "There will be no way for $package to get your hostname." >&4;;
12942         *)
12943         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12944                 ;;
12945         esac;;
12946 esac
12947 case "$d_phostname" in
12948 '') d_phostname="$undef";;
12949 esac
12950
12951 : see if gethostbyaddr_r exists
12952 set gethostbyaddr_r d_gethostbyaddr_r
12953 eval $inlibc
12954 case "$d_gethostbyaddr_r" in
12955 "$define")
12956         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12957         case "$d_gethostbyaddr_r_proto:$usethreads" in
12958         ":define")      d_gethostbyaddr_r_proto=define
12959                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12960                 eval $hasproto ;;
12961         *)      ;;
12962         esac
12963         case "$d_gethostbyaddr_r_proto" in
12964         define)
12965         case "$gethostbyaddr_r_proto" in
12966         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12967         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12968         esac
12969         case "$gethostbyaddr_r_proto" in
12970         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12971         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12972         esac
12973         case "$gethostbyaddr_r_proto" in
12974         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12975         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12976         esac
12977         case "$gethostbyaddr_r_proto" in
12978         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12979         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12980         esac
12981         case "$gethostbyaddr_r_proto" in
12982         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12983         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12984         esac
12985         case "$gethostbyaddr_r_proto" in
12986         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12987         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12988         esac
12989         case "$gethostbyaddr_r_proto" in
12990         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12991         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12992         esac
12993         case "$gethostbyaddr_r_proto" in
12994         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12995         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12996         esac
12997         case "$gethostbyaddr_r_proto" in
12998         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12999         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13000         esac
13001         case "$gethostbyaddr_r_proto" in
13002         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13003         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13004         esac
13005         case "$gethostbyaddr_r_proto" in
13006         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13007         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13008         esac
13009         case "$gethostbyaddr_r_proto" in
13010         ''|0)   d_gethostbyaddr_r=undef
13011                 gethostbyaddr_r_proto=0
13012                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13013         * )     case "$gethostbyaddr_r_proto" in
13014                 REENTRANT_PROTO*) ;;
13015                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13016                 esac
13017                 echo "Prototype: $try" ;;
13018         esac
13019         ;;
13020         *)      case "$usethreads" in
13021                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13022                 esac
13023                 d_gethostbyaddr_r=undef
13024                 gethostbyaddr_r_proto=0
13025                 ;;
13026         esac
13027         ;;
13028 *)      gethostbyaddr_r_proto=0
13029         ;;
13030 esac
13031
13032 : see if gethostbyname_r exists
13033 set gethostbyname_r d_gethostbyname_r
13034 eval $inlibc
13035 case "$d_gethostbyname_r" in
13036 "$define")
13037         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13038         case "$d_gethostbyname_r_proto:$usethreads" in
13039         ":define")      d_gethostbyname_r_proto=define
13040                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13041                 eval $hasproto ;;
13042         *)      ;;
13043         esac
13044         case "$d_gethostbyname_r_proto" in
13045         define)
13046         case "$gethostbyname_r_proto" in
13047         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13048         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13049         esac
13050         case "$gethostbyname_r_proto" in
13051         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13052         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13053         esac
13054         case "$gethostbyname_r_proto" in
13055         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13056         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13057         esac
13058         case "$gethostbyname_r_proto" in
13059         ''|0)   d_gethostbyname_r=undef
13060                 gethostbyname_r_proto=0
13061                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13062         * )     case "$gethostbyname_r_proto" in
13063                 REENTRANT_PROTO*) ;;
13064                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13065                 esac
13066                 echo "Prototype: $try" ;;
13067         esac
13068         ;;
13069         *)      case "$usethreads" in
13070                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13071                 esac
13072                 d_gethostbyname_r=undef
13073                 gethostbyname_r_proto=0
13074                 ;;
13075         esac
13076         ;;
13077 *)      gethostbyname_r_proto=0
13078         ;;
13079 esac
13080
13081 : see if gethostent_r exists
13082 set gethostent_r d_gethostent_r
13083 eval $inlibc
13084 case "$d_gethostent_r" in
13085 "$define")
13086         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13087         case "$d_gethostent_r_proto:$usethreads" in
13088         ":define")      d_gethostent_r_proto=define
13089                 set d_gethostent_r_proto gethostent_r $hdrs
13090                 eval $hasproto ;;
13091         *)      ;;
13092         esac
13093         case "$d_gethostent_r_proto" in
13094         define)
13095         case "$gethostent_r_proto" in
13096         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13097         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13098         esac
13099         case "$gethostent_r_proto" in
13100         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13101         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13102         esac
13103         case "$gethostent_r_proto" in
13104         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13105         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13106         esac
13107         case "$gethostent_r_proto" in
13108         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13109         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13110         esac
13111         case "$gethostent_r_proto" in
13112         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13113         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13114         esac
13115         case "$gethostent_r_proto" in
13116         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13117         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13118         esac
13119         case "$gethostent_r_proto" in
13120         ''|0)   d_gethostent_r=undef
13121                 gethostent_r_proto=0
13122                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13123         * )     case "$gethostent_r_proto" in
13124                 REENTRANT_PROTO*) ;;
13125                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13126                 esac
13127                 echo "Prototype: $try" ;;
13128         esac
13129         ;;
13130         *)      case "$usethreads" in
13131                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13132                 esac
13133                 d_gethostent_r=undef
13134                 gethostent_r_proto=0
13135                 ;;
13136         esac
13137         ;;
13138 *)      gethostent_r_proto=0
13139         ;;
13140 esac
13141
13142 : see if prototypes for various gethostxxx netdb.h functions are available
13143 echo " "
13144 set d_gethostprotos gethostent $i_netdb netdb.h
13145 eval $hasproto
13146
13147 : see if getitimer exists
13148 set getitimer d_getitimer
13149 eval $inlibc
13150
13151 : see if getlogin exists
13152 set getlogin d_getlogin
13153 eval $inlibc
13154
13155 : see if getlogin_r exists
13156 set getlogin_r d_getlogin_r
13157 eval $inlibc
13158 case "$d_getlogin_r" in
13159 "$define")
13160         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13161         case "$d_getlogin_r_proto:$usethreads" in
13162         ":define")      d_getlogin_r_proto=define
13163                 set d_getlogin_r_proto getlogin_r $hdrs
13164                 eval $hasproto ;;
13165         *)      ;;
13166         esac
13167         case "$d_getlogin_r_proto" in
13168         define)
13169         case "$getlogin_r_proto" in
13170         ''|0) try='int getlogin_r(char*, size_t);'
13171         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13172         esac
13173         case "$getlogin_r_proto" in
13174         ''|0) try='int getlogin_r(char*, int);'
13175         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13176         esac
13177         case "$getlogin_r_proto" in
13178         ''|0) try='char* getlogin_r(char*, size_t);'
13179         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13180         esac
13181         case "$getlogin_r_proto" in
13182         ''|0) try='char* getlogin_r(char*, int);'
13183         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13184         esac
13185         case "$getlogin_r_proto" in
13186         ''|0)   d_getlogin_r=undef
13187                 getlogin_r_proto=0
13188                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13189         * )     case "$getlogin_r_proto" in
13190                 REENTRANT_PROTO*) ;;
13191                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13192                 esac
13193                 echo "Prototype: $try" ;;
13194         esac
13195         ;;
13196         *)      case "$usethreads" in
13197                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13198                 esac
13199                 d_getlogin_r=undef
13200                 getlogin_r_proto=0
13201                 ;;
13202         esac
13203         ;;
13204 *)      getlogin_r_proto=0
13205         ;;
13206 esac
13207
13208 : see if getmnt exists
13209 set getmnt d_getmnt
13210 eval $inlibc
13211
13212 : see if getmntent exists
13213 set getmntent d_getmntent
13214 eval $inlibc
13215
13216 : see if getnetbyaddr exists
13217 set getnetbyaddr d_getnbyaddr
13218 eval $inlibc
13219
13220 : see if getnetbyname exists
13221 set getnetbyname d_getnbyname
13222 eval $inlibc
13223
13224 : see if getnetent exists
13225 set getnetent d_getnent
13226 eval $inlibc
13227
13228 : see if getnetbyaddr_r exists
13229 set getnetbyaddr_r d_getnetbyaddr_r
13230 eval $inlibc
13231 case "$d_getnetbyaddr_r" in
13232 "$define")
13233         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13234         case "$d_getnetbyaddr_r_proto:$usethreads" in
13235         ":define")      d_getnetbyaddr_r_proto=define
13236                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13237                 eval $hasproto ;;
13238         *)      ;;
13239         esac
13240         case "$d_getnetbyaddr_r_proto" in
13241         define)
13242         case "$getnetbyaddr_r_proto" in
13243         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13244         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13245         esac
13246         case "$getnetbyaddr_r_proto" in
13247         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13248         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13249         esac
13250         case "$getnetbyaddr_r_proto" in
13251         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13252         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13253         esac
13254         case "$getnetbyaddr_r_proto" in
13255         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13256         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13257         esac
13258         case "$getnetbyaddr_r_proto" in
13259         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13260         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13261         esac
13262         case "$getnetbyaddr_r_proto" in
13263         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13264         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13265         esac
13266         case "$getnetbyaddr_r_proto" in
13267         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13268         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13269         esac
13270         case "$getnetbyaddr_r_proto" in
13271         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13272         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13273         esac
13274         case "$getnetbyaddr_r_proto" in
13275         ''|0)   d_getnetbyaddr_r=undef
13276                 getnetbyaddr_r_proto=0
13277                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13278         * )     case "$getnetbyaddr_r_proto" in
13279                 REENTRANT_PROTO*) ;;
13280                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13281                 esac
13282                 echo "Prototype: $try" ;;
13283         esac
13284         ;;
13285         *)      case "$usethreads" in
13286                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13287                 esac
13288                 d_getnetbyaddr_r=undef
13289                 getnetbyaddr_r_proto=0
13290                 ;;
13291         esac
13292         ;;
13293 *)      getnetbyaddr_r_proto=0
13294         ;;
13295 esac
13296
13297 : see if getnetbyname_r exists
13298 set getnetbyname_r d_getnetbyname_r
13299 eval $inlibc
13300 case "$d_getnetbyname_r" in
13301 "$define")
13302         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13303         case "$d_getnetbyname_r_proto:$usethreads" in
13304         ":define")      d_getnetbyname_r_proto=define
13305                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13306                 eval $hasproto ;;
13307         *)      ;;
13308         esac
13309         case "$d_getnetbyname_r_proto" in
13310         define)
13311         case "$getnetbyname_r_proto" in
13312         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13313         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13314         esac
13315         case "$getnetbyname_r_proto" in
13316         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13317         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13318         esac
13319         case "$getnetbyname_r_proto" in
13320         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13321         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13322         esac
13323         case "$getnetbyname_r_proto" in
13324         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13325         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13326         esac
13327         case "$getnetbyname_r_proto" in
13328         ''|0)   d_getnetbyname_r=undef
13329                 getnetbyname_r_proto=0
13330                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13331         * )     case "$getnetbyname_r_proto" in
13332                 REENTRANT_PROTO*) ;;
13333                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13334                 esac
13335                 echo "Prototype: $try" ;;
13336         esac
13337         ;;
13338         *)      case "$usethreads" in
13339                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13340                 esac
13341                 d_getnetbyname_r=undef
13342                 getnetbyname_r_proto=0
13343                 ;;
13344         esac
13345         ;;
13346 *)      getnetbyname_r_proto=0
13347         ;;
13348 esac
13349
13350 : see if getnetent_r exists
13351 set getnetent_r d_getnetent_r
13352 eval $inlibc
13353 case "$d_getnetent_r" in
13354 "$define")
13355         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13356         case "$d_getnetent_r_proto:$usethreads" in
13357         ":define")      d_getnetent_r_proto=define
13358                 set d_getnetent_r_proto getnetent_r $hdrs
13359                 eval $hasproto ;;
13360         *)      ;;
13361         esac
13362         case "$d_getnetent_r_proto" in
13363         define)
13364         case "$getnetent_r_proto" in
13365         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13366         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13367         esac
13368         case "$getnetent_r_proto" in
13369         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13370         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13371         esac
13372         case "$getnetent_r_proto" in
13373         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13374         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13375         esac
13376         case "$getnetent_r_proto" in
13377         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13378         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13379         esac
13380         case "$getnetent_r_proto" in
13381         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13382         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13383         esac
13384         case "$getnetent_r_proto" in
13385         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13386         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13387         esac
13388         case "$getnetent_r_proto" in
13389         ''|0)   d_getnetent_r=undef
13390                 getnetent_r_proto=0
13391                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13392         * )     case "$getnetent_r_proto" in
13393                 REENTRANT_PROTO*) ;;
13394                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13395                 esac
13396                 echo "Prototype: $try" ;;
13397         esac
13398         ;;
13399         *)      case "$usethreads" in
13400                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13401                 esac
13402                 d_getnetent_r=undef
13403                 getnetent_r_proto=0
13404                 ;;
13405         esac
13406         ;;
13407 *)      getnetent_r_proto=0
13408         ;;
13409 esac
13410
13411 : see if prototypes for various getnetxxx netdb.h functions are available
13412 echo " "
13413 set d_getnetprotos getnetent $i_netdb netdb.h
13414 eval $hasproto
13415
13416 : see if getpagesize exists
13417 set getpagesize d_getpagsz
13418 eval $inlibc
13419
13420
13421 : see if getprotobyname exists
13422 set getprotobyname d_getpbyname
13423 eval $inlibc
13424
13425 : see if getprotobynumber exists
13426 set getprotobynumber d_getpbynumber
13427 eval $inlibc
13428
13429 : see if getprotoent exists
13430 set getprotoent d_getpent
13431 eval $inlibc
13432
13433 : see if getpgid exists
13434 set getpgid d_getpgid
13435 eval $inlibc
13436
13437 : see if getpgrp2 exists
13438 set getpgrp2 d_getpgrp2
13439 eval $inlibc
13440
13441 : see if getppid exists
13442 set getppid d_getppid
13443 eval $inlibc
13444
13445 : see if getpriority exists
13446 set getpriority d_getprior
13447 eval $inlibc
13448
13449 : see if getprotobyname_r exists
13450 set getprotobyname_r d_getprotobyname_r
13451 eval $inlibc
13452 case "$d_getprotobyname_r" in
13453 "$define")
13454         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13455         case "$d_getprotobyname_r_proto:$usethreads" in
13456         ":define")      d_getprotobyname_r_proto=define
13457                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13458                 eval $hasproto ;;
13459         *)      ;;
13460         esac
13461         case "$d_getprotobyname_r_proto" in
13462         define)
13463         case "$getprotobyname_r_proto" in
13464         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13465         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13466         esac
13467         case "$getprotobyname_r_proto" in
13468         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13469         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13470         esac
13471         case "$getprotobyname_r_proto" in
13472         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13473         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13474         esac
13475         case "$getprotobyname_r_proto" in
13476         ''|0)   d_getprotobyname_r=undef
13477                 getprotobyname_r_proto=0
13478                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13479         * )     case "$getprotobyname_r_proto" in
13480                 REENTRANT_PROTO*) ;;
13481                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13482                 esac
13483                 echo "Prototype: $try" ;;
13484         esac
13485         ;;
13486         *)      case "$usethreads" in
13487                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13488                 esac
13489                 d_getprotobyname_r=undef
13490                 getprotobyname_r_proto=0
13491                 ;;
13492         esac
13493         ;;
13494 *)      getprotobyname_r_proto=0
13495         ;;
13496 esac
13497
13498 : see if getprotobynumber_r exists
13499 set getprotobynumber_r d_getprotobynumber_r
13500 eval $inlibc
13501 case "$d_getprotobynumber_r" in
13502 "$define")
13503         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13504         case "$d_getprotobynumber_r_proto:$usethreads" in
13505         ":define")      d_getprotobynumber_r_proto=define
13506                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13507                 eval $hasproto ;;
13508         *)      ;;
13509         esac
13510         case "$d_getprotobynumber_r_proto" in
13511         define)
13512         case "$getprotobynumber_r_proto" in
13513         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13514         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13515         esac
13516         case "$getprotobynumber_r_proto" in
13517         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13518         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13519         esac
13520         case "$getprotobynumber_r_proto" in
13521         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13522         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13523         esac
13524         case "$getprotobynumber_r_proto" in
13525         ''|0)   d_getprotobynumber_r=undef
13526                 getprotobynumber_r_proto=0
13527                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13528         * )     case "$getprotobynumber_r_proto" in
13529                 REENTRANT_PROTO*) ;;
13530                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13531                 esac
13532                 echo "Prototype: $try" ;;
13533         esac
13534         ;;
13535         *)      case "$usethreads" in
13536                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13537                 esac
13538                 d_getprotobynumber_r=undef
13539                 getprotobynumber_r_proto=0
13540                 ;;
13541         esac
13542         ;;
13543 *)      getprotobynumber_r_proto=0
13544         ;;
13545 esac
13546
13547 : see if getprotoent_r exists
13548 set getprotoent_r d_getprotoent_r
13549 eval $inlibc
13550 case "$d_getprotoent_r" in
13551 "$define")
13552         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13553         case "$d_getprotoent_r_proto:$usethreads" in
13554         ":define")      d_getprotoent_r_proto=define
13555                 set d_getprotoent_r_proto getprotoent_r $hdrs
13556                 eval $hasproto ;;
13557         *)      ;;
13558         esac
13559         case "$d_getprotoent_r_proto" in
13560         define)
13561         case "$getprotoent_r_proto" in
13562         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13563         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13564         esac
13565         case "$getprotoent_r_proto" in
13566         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13567         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13568         esac
13569         case "$getprotoent_r_proto" in
13570         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13571         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13572         esac
13573         case "$getprotoent_r_proto" in
13574         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13575         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13576         esac
13577         case "$getprotoent_r_proto" in
13578         ''|0)   d_getprotoent_r=undef
13579                 getprotoent_r_proto=0
13580                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13581         * )     case "$getprotoent_r_proto" in
13582                 REENTRANT_PROTO*) ;;
13583                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13584                 esac
13585                 echo "Prototype: $try" ;;
13586         esac
13587         ;;
13588         *)      case "$usethreads" in
13589                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13590                 esac
13591                 d_getprotoent_r=undef
13592                 getprotoent_r_proto=0
13593                 ;;
13594         esac
13595         ;;
13596 *)      getprotoent_r_proto=0
13597         ;;
13598 esac
13599
13600 : see if prototypes for various getprotoxxx netdb.h functions are available
13601 echo " "
13602 set d_getprotoprotos getprotoent $i_netdb netdb.h
13603 eval $hasproto
13604
13605 : see if getprpwnam exists
13606 set getprpwnam d_getprpwnam
13607 eval $inlibc
13608
13609 : see if getpwent exists
13610 set getpwent d_getpwent
13611 eval $inlibc
13612
13613 : see if getpwent_r exists
13614 set getpwent_r d_getpwent_r
13615 eval $inlibc
13616 case "$d_getpwent_r" in
13617 "$define")
13618         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13619         case "$d_getpwent_r_proto:$usethreads" in
13620         ":define")      d_getpwent_r_proto=define
13621                 set d_getpwent_r_proto getpwent_r $hdrs
13622                 eval $hasproto ;;
13623         *)      ;;
13624         esac
13625         case "$d_getpwent_r_proto" in
13626         define)
13627         case "$getpwent_r_proto" in
13628         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13629         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13630         esac
13631         case "$getpwent_r_proto" in
13632         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13633         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13634         esac
13635         case "$getpwent_r_proto" in
13636         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13637         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13638         esac
13639         case "$getpwent_r_proto" in
13640         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13641         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13642         esac
13643         case "$getpwent_r_proto" in
13644         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13645         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13646         esac
13647         case "$getpwent_r_proto" in
13648         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13649         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13650         esac
13651         case "$getpwent_r_proto" in
13652         ''|0)   d_getpwent_r=undef
13653                 getpwent_r_proto=0
13654                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13655         * )     case "$getpwent_r_proto" in
13656                 REENTRANT_PROTO*) ;;
13657                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13658                 esac
13659                 echo "Prototype: $try" ;;
13660         esac
13661         ;;
13662         *)      case "$usethreads" in
13663                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13664                 esac
13665                 d_getpwent_r=undef
13666                 getpwent_r_proto=0
13667                 ;;
13668         esac
13669         ;;
13670 *)      getpwent_r_proto=0
13671         ;;
13672 esac
13673
13674 : see if getpwnam_r exists
13675 set getpwnam_r d_getpwnam_r
13676 eval $inlibc
13677 case "$d_getpwnam_r" in
13678 "$define")
13679         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13680         case "$d_getpwnam_r_proto:$usethreads" in
13681         ":define")      d_getpwnam_r_proto=define
13682                 set d_getpwnam_r_proto getpwnam_r $hdrs
13683                 eval $hasproto ;;
13684         *)      ;;
13685         esac
13686         case "$d_getpwnam_r_proto" in
13687         define)
13688         case "$getpwnam_r_proto" in
13689         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13690         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13691         esac
13692         case "$getpwnam_r_proto" in
13693         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13694         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13695         esac
13696         case "$getpwnam_r_proto" in
13697         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13698         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13699         esac
13700         case "$getpwnam_r_proto" in
13701         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13702         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13703         esac
13704         case "$getpwnam_r_proto" in
13705         ''|0)   d_getpwnam_r=undef
13706                 getpwnam_r_proto=0
13707                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13708         * )     case "$getpwnam_r_proto" in
13709                 REENTRANT_PROTO*) ;;
13710                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13711                 esac
13712                 echo "Prototype: $try" ;;
13713         esac
13714         ;;
13715         *)      case "$usethreads" in
13716                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13717                 esac
13718                 d_getpwnam_r=undef
13719                 getpwnam_r_proto=0
13720                 ;;
13721         esac
13722         ;;
13723 *)      getpwnam_r_proto=0
13724         ;;
13725 esac
13726
13727 : see if getpwuid_r exists
13728 set getpwuid_r d_getpwuid_r
13729 eval $inlibc
13730 case "$d_getpwuid_r" in
13731 "$define")
13732         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13733         case "$d_getpwuid_r_proto:$usethreads" in
13734         ":define")      d_getpwuid_r_proto=define
13735                 set d_getpwuid_r_proto getpwuid_r $hdrs
13736                 eval $hasproto ;;
13737         *)      ;;
13738         esac
13739         case "$d_getpwuid_r_proto" in
13740         define)
13741         case "$getpwuid_r_proto" in
13742         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13743         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13744         esac
13745         case "$getpwuid_r_proto" in
13746         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13747         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13748         esac
13749         case "$getpwuid_r_proto" in
13750         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13751         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13752         esac
13753         case "$getpwuid_r_proto" in
13754         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13755         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13756         esac
13757         case "$getpwuid_r_proto" in
13758         ''|0)   d_getpwuid_r=undef
13759                 getpwuid_r_proto=0
13760                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13761         * )     case "$getpwuid_r_proto" in
13762                 REENTRANT_PROTO*) ;;
13763                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13764                 esac
13765                 echo "Prototype: $try" ;;
13766         esac
13767         ;;
13768         *)      case "$usethreads" in
13769                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13770                 esac
13771                 d_getpwuid_r=undef
13772                 getpwuid_r_proto=0
13773                 ;;
13774         esac
13775         ;;
13776 *)      getpwuid_r_proto=0
13777         ;;
13778 esac
13779
13780
13781 : see if getservbyname exists
13782 set getservbyname d_getsbyname
13783 eval $inlibc
13784
13785 : see if getservbyport exists
13786 set getservbyport d_getsbyport
13787 eval $inlibc
13788
13789 : see if getservent exists
13790 set getservent d_getsent
13791 eval $inlibc
13792
13793 : see if getservbyname_r exists
13794 set getservbyname_r d_getservbyname_r
13795 eval $inlibc
13796 case "$d_getservbyname_r" in
13797 "$define")
13798         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13799         case "$d_getservbyname_r_proto:$usethreads" in
13800         ":define")      d_getservbyname_r_proto=define
13801                 set d_getservbyname_r_proto getservbyname_r $hdrs
13802                 eval $hasproto ;;
13803         *)      ;;
13804         esac
13805         case "$d_getservbyname_r_proto" in
13806         define)
13807         case "$getservbyname_r_proto" in
13808         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13809         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13810         esac
13811         case "$getservbyname_r_proto" in
13812         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13813         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13814         esac
13815         case "$getservbyname_r_proto" in
13816         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13817         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13818         esac
13819         case "$getservbyname_r_proto" in
13820         ''|0)   d_getservbyname_r=undef
13821                 getservbyname_r_proto=0
13822                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13823         * )     case "$getservbyname_r_proto" in
13824                 REENTRANT_PROTO*) ;;
13825                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13826                 esac
13827                 echo "Prototype: $try" ;;
13828         esac
13829         ;;
13830         *)      case "$usethreads" in
13831                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13832                 esac
13833                 d_getservbyname_r=undef
13834                 getservbyname_r_proto=0
13835                 ;;
13836         esac
13837         ;;
13838 *)      getservbyname_r_proto=0
13839         ;;
13840 esac
13841
13842 : see if getservbyport_r exists
13843 set getservbyport_r d_getservbyport_r
13844 eval $inlibc
13845 case "$d_getservbyport_r" in
13846 "$define")
13847         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13848         case "$d_getservbyport_r_proto:$usethreads" in
13849         ":define")      d_getservbyport_r_proto=define
13850                 set d_getservbyport_r_proto getservbyport_r $hdrs
13851                 eval $hasproto ;;
13852         *)      ;;
13853         esac
13854         case "$d_getservbyport_r_proto" in
13855         define)
13856         case "$getservbyport_r_proto" in
13857         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13858         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13859         esac
13860         case "$getservbyport_r_proto" in
13861         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13862         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13863         esac
13864         case "$getservbyport_r_proto" in
13865         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13866         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13867         esac
13868         case "$getservbyport_r_proto" in
13869         ''|0)   d_getservbyport_r=undef
13870                 getservbyport_r_proto=0
13871                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13872         * )     case "$getservbyport_r_proto" in
13873                 REENTRANT_PROTO*) ;;
13874                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13875                 esac
13876                 echo "Prototype: $try" ;;
13877         esac
13878         ;;
13879         *)      case "$usethreads" in
13880                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13881                 esac
13882                 d_getservbyport_r=undef
13883                 getservbyport_r_proto=0
13884                 ;;
13885         esac
13886         ;;
13887 *)      getservbyport_r_proto=0
13888         ;;
13889 esac
13890
13891 : see if getservent_r exists
13892 set getservent_r d_getservent_r
13893 eval $inlibc
13894 case "$d_getservent_r" in
13895 "$define")
13896         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13897         case "$d_getservent_r_proto:$usethreads" in
13898         ":define")      d_getservent_r_proto=define
13899                 set d_getservent_r_proto getservent_r $hdrs
13900                 eval $hasproto ;;
13901         *)      ;;
13902         esac
13903         case "$d_getservent_r_proto" in
13904         define)
13905         case "$getservent_r_proto" in
13906         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13907         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13908         esac
13909         case "$getservent_r_proto" in
13910         ''|0) try='int getservent_r(struct servent*, char*, int);'
13911         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13912         esac
13913         case "$getservent_r_proto" in
13914         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13915         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13916         esac
13917         case "$getservent_r_proto" in
13918         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13919         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13920         esac
13921         case "$getservent_r_proto" in
13922         ''|0)   d_getservent_r=undef
13923                 getservent_r_proto=0
13924                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13925         * )     case "$getservent_r_proto" in
13926                 REENTRANT_PROTO*) ;;
13927                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13928                 esac
13929                 echo "Prototype: $try" ;;
13930         esac
13931         ;;
13932         *)      case "$usethreads" in
13933                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13934                 esac
13935                 d_getservent_r=undef
13936                 getservent_r_proto=0
13937                 ;;
13938         esac
13939         ;;
13940 *)      getservent_r_proto=0
13941         ;;
13942 esac
13943
13944 : see if prototypes for various getservxxx netdb.h functions are available
13945 echo " "
13946 set d_getservprotos getservent $i_netdb netdb.h
13947 eval $hasproto
13948
13949 : see if getspnam exists
13950 set getspnam d_getspnam
13951 eval $inlibc
13952
13953 : see if this is a shadow.h system
13954 set shadow.h i_shadow
13955 eval $inhdr
13956
13957 : see if getspnam_r exists
13958 set getspnam_r d_getspnam_r
13959 eval $inlibc
13960 case "$d_getspnam_r" in
13961 "$define")
13962         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13963         case "$d_getspnam_r_proto:$usethreads" in
13964         ":define")      d_getspnam_r_proto=define
13965                 set d_getspnam_r_proto getspnam_r $hdrs
13966                 eval $hasproto ;;
13967         *)      ;;
13968         esac
13969         case "$d_getspnam_r_proto" in
13970         define)
13971         case "$getspnam_r_proto" in
13972         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13973         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13974         esac
13975         case "$getspnam_r_proto" in
13976         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13977         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13978         esac
13979         case "$getspnam_r_proto" in
13980         ''|0)   d_getspnam_r=undef
13981                 getspnam_r_proto=0
13982                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13983         * )     case "$getspnam_r_proto" in
13984                 REENTRANT_PROTO*) ;;
13985                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13986                 esac
13987                 echo "Prototype: $try" ;;
13988         esac
13989         ;;
13990         *)      case "$usethreads" in
13991                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13992                 esac
13993                 d_getspnam_r=undef
13994                 getspnam_r_proto=0
13995                 ;;
13996         esac
13997         ;;
13998 *)      getspnam_r_proto=0
13999         ;;
14000 esac
14001
14002 : see if gettimeofday or ftime exists
14003 set gettimeofday d_gettimeod
14004 eval $inlibc
14005 case "$d_gettimeod" in
14006 "$undef")
14007         set ftime d_ftime 
14008         eval $inlibc
14009         ;;
14010 *)
14011         val="$undef"; set d_ftime; eval $setvar
14012         ;;
14013 esac
14014 case "$d_gettimeod$d_ftime" in
14015 "$undef$undef")
14016         echo " "
14017         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14018         ;;
14019 esac
14020
14021 : see if gmtime_r exists
14022 set gmtime_r d_gmtime_r
14023 eval $inlibc
14024 case "$d_gmtime_r" in
14025 "$define")
14026         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14027         case "$d_gmtime_r_proto:$usethreads" in
14028         ":define")      d_gmtime_r_proto=define
14029                 set d_gmtime_r_proto gmtime_r $hdrs
14030                 eval $hasproto ;;
14031         *)      ;;
14032         esac
14033         case "$d_gmtime_r_proto" in
14034         define)
14035         case "$gmtime_r_proto" in
14036         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14037         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14038         esac
14039         case "$gmtime_r_proto" in
14040         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14041         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14042         esac
14043         case "$gmtime_r_proto" in
14044         ''|0)   d_gmtime_r=undef
14045                 gmtime_r_proto=0
14046                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14047         * )     case "$gmtime_r_proto" in
14048                 REENTRANT_PROTO*) ;;
14049                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14050                 esac
14051                 echo "Prototype: $try" ;;
14052         esac
14053         ;;
14054         *)      case "$usethreads" in
14055                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14056                 esac
14057                 d_gmtime_r=undef
14058                 gmtime_r_proto=0
14059                 ;;
14060         esac
14061         ;;
14062 *)      gmtime_r_proto=0
14063         ;;
14064 esac
14065
14066 : see if hasmntopt exists
14067 set hasmntopt d_hasmntopt
14068 eval $inlibc
14069
14070 : see if this is a netinet/in.h or sys/in.h system
14071 set netinet/in.h i_niin sys/in.h i_sysin
14072 eval $inhdr
14073
14074 : see if arpa/inet.h has to be included
14075 set arpa/inet.h i_arpainet
14076 eval $inhdr
14077
14078 : see if htonl --and friends-- exists
14079 val=''
14080 set htonl val
14081 eval $inlibc
14082
14083 : Maybe they are macros.
14084 case "$val" in
14085 $undef)
14086         $cat >htonl.c <<EOM
14087 #include <stdio.h>
14088 #include <sys/types.h>
14089 #$i_niin I_NETINET_IN
14090 #$i_sysin I_SYS_IN
14091 #$i_arpainet I_ARPA_INET
14092 #ifdef I_NETINET_IN
14093 #include <netinet/in.h>
14094 #endif
14095 #ifdef I_SYS_IN
14096 #include <sys/in.h>
14097 #endif
14098 #ifdef I_ARPA_INET
14099 #include <arpa/inet.h>
14100 #endif
14101 #ifdef htonl
14102 printf("Defined as a macro.");
14103 #endif
14104 EOM
14105         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14106         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14107                 val="$define"
14108                 echo "But it seems to be defined as a macro." >&4
14109         fi
14110         $rm -f htonl.?
14111         ;;
14112 esac
14113 set d_htonl
14114 eval $setvar
14115
14116 : see if ilogbl exists
14117 set ilogbl d_ilogbl
14118 eval $inlibc
14119
14120 : index or strchr
14121 echo " "
14122 if set index val -f; eval $csym; $val; then
14123         if set strchr val -f d_strchr; eval $csym; $val; then
14124                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14125                         val="$define"
14126                         vali="$undef"
14127                         echo "strchr() found." >&4
14128                 else
14129                         val="$undef"
14130                         vali="$define"
14131                         echo "index() found." >&4
14132                 fi
14133         else
14134                 val="$undef"
14135                 vali="$define"
14136                 echo "index() found." >&4
14137         fi
14138 else
14139         if set strchr val -f d_strchr; eval $csym; $val; then
14140                 val="$define"
14141                 vali="$undef"
14142                 echo "strchr() found." >&4
14143         else
14144                 echo "No index() or strchr() found!" >&4
14145                 val="$undef"
14146                 vali="$undef"
14147         fi
14148 fi
14149 set d_strchr; eval $setvar
14150 val="$vali"
14151 set d_index; eval $setvar
14152
14153 : check whether inet_aton exists
14154 set inet_aton d_inetaton
14155 eval $inlibc
14156
14157 : Look for isascii
14158 echo " "
14159 $cat >isascii.c <<EOCP
14160 #include <stdio.h>
14161 #include <ctype.h>
14162 #$i_stdlib I_STDLIB
14163 #ifdef I_STDLIB
14164 #include <stdlib.h>
14165 #endif
14166 int main() {
14167         int c = 'A';
14168         if (isascii(c))
14169                 exit(0);
14170         else
14171                 exit(1);
14172 }
14173 EOCP
14174 set isascii
14175 if eval $compile; then
14176         echo "isascii() found." >&4
14177         val="$define"
14178 else
14179         echo "isascii() NOT found." >&4
14180         val="$undef"
14181 fi
14182 set d_isascii
14183 eval $setvar
14184 $rm -f isascii*
14185
14186 : see if isfinite exists
14187 set isfinite d_isfinite
14188 eval $inlibc
14189
14190 : see if isinf exists
14191 set isinf d_isinf
14192 eval $inlibc
14193
14194 : see if isnan exists
14195 set isnan d_isnan
14196 eval $inlibc
14197
14198 : see if isnanl exists
14199 set isnanl d_isnanl
14200 eval $inlibc
14201
14202 : see if killpg exists
14203 set killpg d_killpg
14204 eval $inlibc
14205
14206 : see if lchown exists
14207 echo " "
14208 $cat > try.c <<'EOCP'
14209 /* System header to define __stub macros and hopefully few prototypes,
14210     which can conflict with char lchown(); below.  */
14211 #include <assert.h>
14212 /* Override any gcc2 internal prototype to avoid an error.  */
14213 /* We use char because int might match the return type of a gcc2
14214    builtin and then its argument prototype would still apply.  */
14215 char lchown();
14216 int main() {
14217     /*  The GNU C library defines this for functions which it implements
14218         to always fail with ENOSYS.  Some functions are actually named
14219         something starting with __ and the normal name is an alias.  */
14220 #if defined (__stub_lchown) || defined (__stub___lchown)
14221 choke me
14222 #else
14223 lchown();
14224 #endif
14225 ; return 0; }
14226 EOCP
14227 set try
14228 if eval $compile; then
14229     $echo "lchown() found." >&4
14230     val="$define"
14231 else
14232     $echo "lchown() NOT found." >&4
14233     val="$undef"
14234 fi
14235 set d_lchown
14236 eval $setvar
14237
14238 : See if number of significant digits in a double precision number is known
14239 echo " "
14240 $cat >ldbl_dig.c <<EOM
14241 #$i_limits I_LIMITS
14242 #$i_float I_FLOAT
14243 #ifdef I_LIMITS
14244 #include <limits.h>
14245 #endif
14246 #ifdef I_FLOAT
14247 #include <float.h>
14248 #endif
14249 #ifdef LDBL_DIG
14250 printf("Contains LDBL_DIG");
14251 #endif
14252 EOM
14253 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14254 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14255         echo "LDBL_DIG found." >&4
14256         val="$define"
14257 else
14258         echo "LDBL_DIG NOT found." >&4
14259         val="$undef"
14260 fi
14261 $rm -f ldbl_dig.?
14262 set d_ldbl_dig
14263 eval $setvar
14264
14265 : see if this is a math.h system
14266 set math.h i_math
14267 eval $inhdr
14268
14269 d_libm_lib_version="$undef"
14270 case $i_math in
14271     $define)
14272         : check to see if math.h defines _LIB_VERSION
14273         echo " "
14274         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14275         $cat >try.c <<EOCP
14276 #include <unistd.h>
14277 #include <math.h>
14278 int main (int argc, char *argv[])
14279 {
14280     printf ("%d\n", _LIB_VERSION);
14281     return (0);
14282     } /* main */
14283 EOCP
14284         set try
14285         if eval $compile; then
14286             foo=`$run ./try`
14287             echo "Yes, it does ($foo)" >&4
14288             d_libm_lib_version="$define"
14289         else
14290             echo "No, it does not (probably harmless)\n" >&4
14291             fi
14292         $rm -f try.* try core core.try.*
14293         ;;
14294
14295     esac
14296
14297 : see if link exists
14298 set link d_link
14299 eval $inlibc
14300
14301 : see if localtime_r exists
14302 set localtime_r d_localtime_r
14303 eval $inlibc
14304 case "$d_localtime_r" in
14305 "$define")
14306         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14307         case "$d_localtime_r_proto:$usethreads" in
14308         ":define")      d_localtime_r_proto=define
14309                 set d_localtime_r_proto localtime_r $hdrs
14310                 eval $hasproto ;;
14311         *)      ;;
14312         esac
14313         case "$d_localtime_r_proto" in
14314         define)
14315         case "$localtime_r_proto" in
14316         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14317         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14318         esac
14319         case "$localtime_r_proto" in
14320         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14321         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14322         esac
14323         case "$localtime_r_proto" in
14324         ''|0)   d_localtime_r=undef
14325                 localtime_r_proto=0
14326                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14327         * )     case "$localtime_r_proto" in
14328                 REENTRANT_PROTO*) ;;
14329                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14330                 esac
14331                 echo "Prototype: $try" ;;
14332         esac
14333         ;;
14334         *)      case "$usethreads" in
14335                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14336                 esac
14337                 d_localtime_r=undef
14338                 localtime_r_proto=0
14339                 ;;
14340         esac
14341         ;;
14342 *)      localtime_r_proto=0
14343         ;;
14344 esac
14345
14346 : see if localeconv exists
14347 set localeconv d_locconv
14348 eval $inlibc
14349
14350 : see if lockf exists
14351 set lockf d_lockf
14352 eval $inlibc
14353
14354 : see if prototype for lseek is available
14355 echo " "
14356 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14357 eval $hasproto
14358
14359 : see if lstat exists
14360 set lstat d_lstat
14361 eval $inlibc
14362
14363 : see if madvise exists
14364 set madvise d_madvise
14365 eval $inlibc
14366
14367 : see if malloc_size exists
14368 set malloc_size d_malloc_size
14369 eval $inlibc
14370
14371 : see if malloc_size_good exists
14372 set malloc_good_size d_malloc_good_size
14373 eval $inlibc
14374
14375 : see if mblen exists
14376 set mblen d_mblen
14377 eval $inlibc
14378
14379 : see if mbstowcs exists
14380 set mbstowcs d_mbstowcs
14381 eval $inlibc
14382
14383 : see if mbtowc exists
14384 set mbtowc d_mbtowc
14385 eval $inlibc
14386
14387 : see if memchr exists
14388 set memchr d_memchr
14389 eval $inlibc
14390
14391 : see if memcmp exists
14392 set memcmp d_memcmp
14393 eval $inlibc
14394
14395 : see if memcpy exists
14396 set memcpy d_memcpy
14397 eval $inlibc
14398
14399 : see if memmove exists
14400 set memmove d_memmove
14401 eval $inlibc
14402
14403 : see if memset exists
14404 set memset d_memset
14405 eval $inlibc
14406
14407 : see if mkdir exists
14408 set mkdir d_mkdir
14409 eval $inlibc
14410
14411 : see if mkdtemp exists
14412 set mkdtemp d_mkdtemp
14413 eval $inlibc
14414
14415 : see if mkfifo exists
14416 set mkfifo d_mkfifo
14417 eval $inlibc
14418
14419 : see if mkstemp exists
14420 set mkstemp d_mkstemp
14421 eval $inlibc
14422
14423 : see if mkstemps exists
14424 set mkstemps d_mkstemps
14425 eval $inlibc
14426
14427 : see if mktime exists
14428 set mktime d_mktime
14429 eval $inlibc
14430
14431 : see if this is a sys/mman.h system
14432 set sys/mman.h i_sysmman
14433 eval $inhdr
14434
14435 : see if mmap exists
14436 set mmap d_mmap
14437 eval $inlibc
14438 : see what shmat returns
14439 : default to something harmless
14440 mmaptype='void *'
14441 case "$i_sysmman$d_mmap" in
14442 "$define$define")
14443         $cat >mmap.c <<'END'
14444 #include <sys/mman.h>
14445 void *mmap();
14446 END
14447         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14448                 mmaptype='void *'
14449         else
14450                 mmaptype='caddr_t'
14451         fi
14452         echo "and it returns ($mmaptype)." >&4
14453         ;;
14454 esac
14455
14456
14457
14458 : see if sqrtl exists
14459 set sqrtl d_sqrtl
14460 eval $inlibc
14461
14462 : see if scalbnl exists
14463 set scalbnl d_scalbnl
14464 eval $inlibc
14465
14466 : see if modfl exists
14467 set modfl d_modfl
14468 eval $inlibc
14469
14470 : see if prototype for modfl is available
14471 echo " "
14472 set d_modflproto modfl $i_math math.h
14473 eval $hasproto
14474
14475 d_modfl_pow32_bug="$undef"
14476
14477 case "$d_longdbl$d_modfl" in
14478 $define$define)
14479         $cat <<EOM
14480 Checking to see whether your modfl() is okay for large values...
14481 EOM
14482 $cat >try.c <<EOCP
14483 #include <math.h> 
14484 #include <stdio.h>
14485 EOCP
14486 if $test "X$d_modflproto" != "X$define"; then
14487         $cat >>try.c <<EOCP
14488 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14489 long double modfl (long double, long double *);
14490 EOCP
14491 fi
14492 $cat >>try.c <<EOCP
14493 int main() {
14494     long double nv = 4294967303.15;
14495     long double v, w;
14496     v = modfl(nv, &w);         
14497 #ifdef __GLIBC__
14498     printf("glibc");
14499 #endif
14500     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14501     return 0;
14502 }
14503 EOCP
14504         case "$osname:$gccversion" in
14505         aix:)   saveccflags="$ccflags"
14506                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14507         esac
14508         set try
14509         if eval $compile; then
14510                 foo=`$run ./try`
14511                 case "$foo" in
14512                 *" 4294967303.150000 1.150000 4294967302.000000")
14513                         echo >&4 "Your modfl() is broken for large values."
14514                         d_modfl_pow32_bug="$define"
14515                         case "$foo" in
14516                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14517                         ;;
14518                         esac
14519                         ;;
14520                 *" 4294967303.150000 0.150000 4294967303.000000")
14521                         echo >&4 "Your modfl() seems okay for large values."
14522                         ;;
14523                 *)      echo >&4 "I don't understand your modfl() at all."
14524                         d_modfl="$undef"
14525                         ;;
14526                 esac
14527                 $rm -f try.* try core core.try.*
14528         else
14529                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14530                 d_modfl="$undef"
14531         fi
14532         case "$osname:$gccversion" in
14533         aix:)   ccflags="$saveccflags" ;; # restore
14534         esac
14535         ;;
14536 esac
14537
14538 if $test "$uselongdouble" = "$define"; then
14539     message=""
14540     if $test "$d_sqrtl" != "$define"; then
14541         message="$message sqrtl"
14542     fi
14543     if $test "$d_modfl" != "$define"; then
14544         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14545             echo "You have both aintl and copysignl, so I can emulate modfl."
14546         else
14547             message="$message modfl"
14548         fi
14549     fi
14550     if $test "$d_frexpl" != "$define"; then
14551         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14552             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14553         else
14554             message="$message frexpl"
14555         fi
14556     fi
14557
14558     if $test "$message" != ""; then
14559         $cat <<EOM >&4
14560
14561 *** You requested the use of long doubles but you do not seem to have
14562 *** the following mathematical functions needed for long double support:
14563 ***    $message
14564 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14565 *** Cannot continue, aborting.
14566
14567 EOM
14568
14569         exit 1
14570     fi
14571 fi
14572
14573 : see if mprotect exists
14574 set mprotect d_mprotect
14575 eval $inlibc
14576
14577 : see if msgctl exists
14578 set msgctl d_msgctl
14579 eval $inlibc
14580
14581 : see if msgget exists
14582 set msgget d_msgget
14583 eval $inlibc
14584
14585 : see if msgsnd exists
14586 set msgsnd d_msgsnd
14587 eval $inlibc
14588
14589 : see if msgrcv exists
14590 set msgrcv d_msgrcv
14591 eval $inlibc
14592
14593 : see how much of the 'msg*(2)' library is present.
14594 h_msg=true
14595 echo " "
14596 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14597 *"$undef"*) h_msg=false;;
14598 esac
14599 case "$osname" in
14600 freebsd)
14601     case "`ipcs 2>&1`" in
14602     "SVID messages"*"not configured"*)
14603         echo "Your $osname does not have the msg*(2) configured." >&4
14604         h_msg=false
14605         val="$undef"
14606         set msgctl d_msgctl
14607         eval $setvar
14608         set msgget d_msgget
14609         eval $setvar
14610         set msgsnd d_msgsnd
14611         eval $setvar
14612         set msgrcv d_msgrcv
14613         eval $setvar
14614         ;;
14615     esac
14616     ;;
14617 esac
14618 : we could also check for sys/ipc.h ...
14619 if $h_msg && $test `./findhdr sys/msg.h`; then
14620         echo "You have the full msg*(2) library." >&4
14621         val="$define"
14622 else
14623         echo "You don't have the full msg*(2) library." >&4
14624         val="$undef"
14625 fi
14626 set d_msg
14627 eval $setvar
14628
14629
14630 echo " "
14631 echo "Checking to see if your system supports struct msghdr..." >&4
14632 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14633 eval $hasstruct
14634 case "$d_msghdr_s" in
14635 "$define")      echo "Yes, it does."   ;;
14636 *)              echo "No, it doesn't." ;;
14637 esac
14638
14639
14640 : see if msync exists
14641 set msync d_msync
14642 eval $inlibc
14643
14644 : see if munmap exists
14645 set munmap d_munmap
14646 eval $inlibc
14647
14648 : see if nice exists
14649 set nice d_nice
14650 eval $inlibc
14651
14652 : see if this is a langinfo.h system
14653 set langinfo.h i_langinfo
14654 eval $inhdr
14655
14656 : see if nl_langinfo exists
14657 set nl_langinfo d_nl_langinfo
14658 eval $inlibc
14659
14660 : check for length of character
14661 echo " "
14662 case "$charsize" in
14663 '')
14664         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14665         $cat >try.c <<EOCP
14666 #include <stdio.h>
14667 #$i_stdlib I_STDLIB
14668 #ifdef I_STDLIB
14669 #include <stdlib.h>
14670 #endif
14671 int main()
14672 {
14673     printf("%d\n", (int)sizeof(char));
14674     exit(0);
14675 }
14676 EOCP
14677         set try
14678         if eval $compile_ok; then
14679                 dflt=`$run ./try`
14680         else
14681                 dflt='1'
14682                 echo "(I can't seem to compile the test program.  Guessing...)"
14683         fi
14684         ;;
14685 *)
14686         dflt="$charsize"
14687         ;;
14688 esac
14689 rp="What is the size of a character (in bytes)?"
14690 . ./myread
14691 charsize="$ans"
14692 $rm -f try.c try
14693
14694 : check for volatile keyword
14695 echo " "
14696 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14697 $cat >try.c <<'EOCP'
14698 int main()
14699 {
14700         typedef struct _goo_struct goo_struct;
14701         goo_struct * volatile goo = ((goo_struct *)0);
14702         struct _goo_struct {
14703                 long long_int;
14704                 int reg_int;
14705                 char char_var;
14706         };
14707         typedef unsigned short foo_t;
14708         char *volatile foo;
14709         volatile int bar;
14710         volatile foo_t blech;
14711         foo = foo;
14712 }
14713 EOCP
14714 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14715         val="$define"
14716         echo "Yup, it does."
14717 else
14718         val="$undef"
14719         echo "Nope, it doesn't."
14720 fi
14721 set d_volatile
14722 eval $setvar
14723 $rm -f try.*
14724
14725
14726 echo " "
14727 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14728
14729 case "$use64bitint:$d_quad:$quadtype" in
14730 define:define:?*)
14731         ivtype="$quadtype"
14732         uvtype="$uquadtype"
14733         ivsize=8
14734         uvsize=8
14735         ;;
14736 *)      ivtype="long"
14737         uvtype="unsigned long"
14738         ivsize=$longsize
14739         uvsize=$longsize
14740         ;;
14741 esac
14742
14743 case "$uselongdouble:$d_longdbl" in
14744 define:define)
14745         nvtype="long double"
14746         nvsize=$longdblsize
14747         ;;
14748 *)      nvtype=double
14749         nvsize=$doublesize
14750         ;;
14751 esac
14752
14753 $echo "(IV will be "$ivtype", $ivsize bytes)"
14754 $echo "(UV will be "$uvtype", $uvsize bytes)"
14755 $echo "(NV will be "$nvtype", $nvsize bytes)"
14756
14757 $cat >try.c <<EOCP
14758 #$i_inttypes I_INTTYPES
14759 #ifdef I_INTTYPES
14760 #include <inttypes.h>
14761 #endif
14762 #include <stdio.h>
14763 int main() {
14764 #ifdef INT8
14765    int8_t i =  INT8_MAX;
14766   uint8_t u = UINT8_MAX;
14767   printf("int8_t\n");
14768 #endif
14769 #ifdef INT16
14770    int16_t i =  INT16_MAX;
14771   uint16_t i = UINT16_MAX;
14772   printf("int16_t\n");
14773 #endif
14774 #ifdef INT32
14775    int32_t i =  INT32_MAX;
14776   uint32_t u = UINT32_MAX;
14777   printf("int32_t\n");
14778 #endif
14779 }
14780 EOCP
14781
14782 case "$i8type" in
14783 '')     case "$charsize" in
14784         1)      i8type=char
14785                 u8type="unsigned char"
14786                 i8size=$charsize
14787                 u8size=$charsize
14788                 ;;
14789         esac
14790         ;;
14791 esac
14792 case "$i8type" in
14793 '')     set try -DINT8
14794         if eval $compile; then
14795                 case "`$run ./try`" in
14796                 int8_t) i8type=int8_t
14797                         u8type=uint8_t
14798                         i8size=1
14799                         u8size=1
14800                         ;;
14801                 esac
14802         fi
14803         ;;
14804 esac
14805 case "$i8type" in
14806 '')     if $test $charsize -ge 1; then
14807                 i8type=char
14808                 u8type="unsigned char"
14809                 i8size=$charsize
14810                 u8size=$charsize
14811         fi
14812         ;;
14813 esac
14814
14815 case "$i16type" in
14816 '')     case "$shortsize" in
14817         2)      i16type=short
14818                 u16type="unsigned short"
14819                 i16size=$shortsize
14820                 u16size=$shortsize
14821                 ;;
14822         esac
14823         ;;
14824 esac
14825 case "$i16type" in
14826 '')     set try -DINT16
14827         if eval $compile; then
14828                 case "`$run ./try`" in
14829                 int16_t)
14830                         i16type=int16_t
14831                         u16type=uint16_t
14832                         i16size=2
14833                         u16size=2
14834                         ;;
14835                 esac
14836         fi
14837         ;;
14838 esac
14839 case "$i16type" in
14840 '')     if $test $shortsize -ge 2; then
14841                 i16type=short
14842                 u16type="unsigned short"
14843                 i16size=$shortsize
14844                 u16size=$shortsize
14845         fi
14846         ;;
14847 esac
14848
14849 case "$i32type" in
14850 '')     case "$longsize" in
14851         4)      i32type=long
14852                 u32type="unsigned long"
14853                 i32size=$longsize
14854                 u32size=$longsize
14855                 ;;
14856         *)      case "$intsize" in
14857                 4)      i32type=int
14858                         u32type="unsigned int"
14859                         i32size=$intsize
14860                         u32size=$intsize
14861                         ;;
14862                 esac
14863                 ;;
14864         esac
14865         ;;
14866 esac
14867 case "$i32type" in
14868 '')     set try -DINT32
14869         if eval $compile; then
14870                 case "`$run ./try`" in
14871                 int32_t)
14872                         i32type=int32_t
14873                         u32type=uint32_t
14874                         i32size=4
14875                         u32size=4
14876                         ;;
14877                 esac
14878         fi
14879         ;;
14880 esac
14881 case "$i32type" in
14882 '')     if $test $intsize -ge 4; then
14883                 i32type=int
14884                 u32type="unsigned int"
14885                 i32size=$intsize
14886                 u32size=$intsize
14887         fi
14888         ;;
14889 esac
14890
14891 case "$i64type" in
14892 '')     case "$d_quad:$quadtype" in
14893         define:?*)
14894                 i64type="$quadtype"
14895                 u64type="$uquadtype"
14896                 i64size=8
14897                 u64size=8
14898                 ;;
14899         esac
14900         ;;
14901 esac
14902
14903 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14904 : volatile so that the compiler has to store it out to memory.
14905 if test X"$d_volatile" = X"$define"; then
14906         volatile=volatile
14907 fi
14908 $cat <<EOP >try.c
14909 #include <stdio.h>
14910 #$i_stdlib I_STDLIB
14911 #ifdef I_STDLIB
14912 #include <stdlib.h>
14913 #endif
14914 #include <sys/types.h>
14915 #include <signal.h>
14916 #ifdef SIGFPE
14917 $volatile int bletched = 0;
14918 $signal_t blech(s) int s; { bletched = 1; }
14919 #endif
14920 int main() {
14921     $uvtype u = 0;
14922     $nvtype d;
14923     int     n = 8 * $uvsize;
14924     int     i;
14925 #ifdef SIGFPE
14926     signal(SIGFPE, blech);
14927 #endif
14928
14929     for (i = 0; i < n; i++) {
14930       u = u << 1 | ($uvtype)1;
14931       d = ($nvtype)u;
14932       if (($uvtype)d != u)
14933         break;
14934       if (d <= 0)
14935         break;
14936       d = ($nvtype)(u - 1);
14937       if (($uvtype)d != (u - 1))
14938         break;
14939 #ifdef SIGFPE
14940       if (bletched) {
14941         break;
14942 #endif
14943       } 
14944     }
14945     printf("%d\n", ((i == n) ? -n : i));
14946     exit(0);
14947 }
14948 EOP
14949 set try
14950
14951 d_nv_preserves_uv="$undef"
14952 if eval $compile; then
14953         nv_preserves_uv_bits="`$run ./try`"
14954 fi
14955 case "$nv_preserves_uv_bits" in
14956 \-[1-9]*)       
14957         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14958         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14959         d_nv_preserves_uv="$define"
14960         ;;
14961 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14962         d_nv_preserves_uv="$undef" ;;
14963 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14964         nv_preserves_uv_bits="$undef" ;;
14965 esac
14966
14967 $rm -f try.* try
14968
14969 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14970 : volatile so that the compiler has to store it out to memory.
14971 if test X"$d_volatile" = X"$define"; then
14972         volatile=volatile
14973 fi
14974 $cat <<EOP >try.c
14975 #include <stdio.h>
14976 #$i_stdlib I_STDLIB
14977 #ifdef I_STDLIB
14978 #include <stdlib.h>
14979 #endif
14980 #$i_string I_STRING
14981 #ifdef I_STRING
14982 #  include <string.h>
14983 #else
14984 #  include <strings.h>
14985 #endif
14986 #include <sys/types.h>
14987 #include <signal.h>
14988 #ifdef SIGFPE
14989 $volatile int bletched = 0;
14990 $signal_t blech(s) int s; { bletched = 1; }
14991 #endif
14992
14993 int checkit($nvtype d, char *where) {
14994     unsigned char *p = (char *)&d;
14995     unsigned char *end = p + sizeof(d);
14996     int fail = 0;
14997
14998     while (p < end)
14999         fail += *p++;
15000
15001     if (!fail)
15002         return 0;
15003
15004     p = (char *)&d;
15005     printf("No - %s: 0x", where);
15006     while (p < end)
15007         printf ("%02X", *p++);
15008     printf("\n");
15009     return 1;
15010 }
15011
15012 int main(int argc, char **argv) {
15013     $nvtype d = 0.0;
15014     int fail = 0;
15015     fail += checkit(d, "0.0");
15016
15017     /* The compiler shouldn't be assuming that bletched is 0  */
15018     d = bletched;
15019
15020     fail += checkit(d, "bleched");
15021
15022 #ifdef SIGFPE
15023     signal(SIGFPE, blech);
15024 #endif
15025
15026     /* Paranoia - the compiler should have no way of knowing that ANSI says
15027        that argv[argc] will always be NULL.  Actually, if it did assume this it
15028        would be buggy, as this is C and main() can be called from elsewhere in
15029        the program.  */
15030     d = argv[argc] ? 1 : 0;
15031
15032     if (d) {
15033         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15034     }
15035
15036     fail += checkit(d, "ternary");
15037
15038     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15039
15040     if (d != 0.0) {
15041         printf("No - memset doesn't give 0.0\n");
15042         /* This might just blow up:  */
15043         printf("(gives %g)\n", d);
15044         return 1;
15045     }
15046     
15047 #ifdef SIGFPE
15048     if (bletched) {
15049         printf("No - something bleched\n");
15050         return 1;
15051     }
15052 #endif
15053     if (fail) {
15054       printf("No - %d fail(s)\n", fail);
15055       return 1;
15056     }
15057     printf("Yes\n");
15058     return 0;
15059 }
15060 EOP
15061 set try
15062
15063 d_nv_zero_is_allbits_zero="$undef"
15064 if eval $compile; then
15065     xxx="`$run ./try`"
15066     case "$?" in
15067         0)
15068             case "$xxx" in
15069                 Yes)  cat >&4 <<EOM
15070 0.0 is represented as all bits zero in memory
15071 EOM
15072                     d_nv_zero_is_allbits_zero="$define"
15073                     ;;
15074                 *)  cat >&4 <<EOM
15075 0.0 is not represented as all bits zero in memory
15076 EOM
15077                     d_nv_zero_is_allbits_zero="$undef"
15078                     ;;
15079             esac
15080             ;;
15081         *)  cat >&4 <<EOM
15082 0.0 is not represented as all bits zero in memory
15083 EOM
15084             d_nv_zero_is_allbits_zero="$undef"
15085             ;;
15086     esac
15087 fi
15088
15089 $rm -f try.* try
15090
15091
15092 : check for off64_t
15093 echo " "
15094 echo "Checking to see if you have off64_t..." >&4
15095 $cat >try.c <<EOCP
15096 #include <sys/types.h>
15097 #include <unistd.h>
15098 int main() { off64_t x = 7; }
15099 EOCP
15100 set try
15101 if eval $compile; then
15102         val="$define"
15103         echo "You have off64_t."
15104 else
15105         val="$undef"
15106         echo "You do not have off64_t."
15107         case "$lseeksize" in
15108         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15109         esac
15110 fi
15111 $rm -f try.* try
15112 set d_off64_t
15113 eval $setvar
15114
15115 : how to create joinable pthreads
15116 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15117         echo " "
15118         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15119         $cat >try.c <<'EOCP'
15120 #include <pthread.h>
15121 int main() {
15122     int detachstate = JOINABLE;
15123 }
15124 EOCP
15125         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15126         if eval $compile; then
15127                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15128                 val="$undef" # Yes, undef.
15129                 set d_old_pthread_create_joinable
15130                 eval $setvar
15131                 val=""
15132                 set old_pthread_create_joinable
15133                 eval $setvar
15134         else
15135                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15136                 if eval $compile; then
15137                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15138                         val="$define"
15139                         set d_old_pthread_create_joinable
15140                         eval $setvar
15141                         val=PTHREAD_CREATE_UNDETACHED
15142                         set old_pthread_create_joinable
15143                         eval $setvar
15144                 else            
15145                         set try -DJOINABLE=__UNDETACHED
15146                         if eval $compile; then
15147                                 echo "You seem to use __UNDETACHED." >&4
15148                                 val="$define"
15149                                 set d_old_pthread_create_joinable
15150                                 eval $setvar
15151                                 val=__UNDETACHED
15152                                 set old_pthread_create_joinable
15153                                 eval $setvar
15154                         else
15155                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15156                                 val="$define"
15157                                 set d_old_pthread_create_joinable
15158                                 eval $setvar
15159                                 val=0
15160                                 set old_pthread_create_joinable
15161                                 eval $setvar
15162                         fi
15163                 fi
15164         fi
15165         $rm -f try try.*
15166 else
15167     d_old_pthread_create_joinable="$undef"
15168     old_pthread_create_joinable=""
15169 fi
15170
15171 : see if pause exists
15172 set pause d_pause
15173 eval $inlibc
15174
15175 : see if pipe exists
15176 set pipe d_pipe
15177 eval $inlibc
15178
15179 : see if poll exists
15180 set poll d_poll
15181 eval $inlibc
15182
15183 : see if readlink exists
15184 set readlink d_readlink
15185 eval $inlibc
15186
15187 echo " "
15188 procselfexe=''
15189 val="$undef"
15190 case "$d_readlink" in
15191 "$define")
15192         if $issymlink /proc/self/exe ; then
15193                 $ls -l /proc/self/exe > reflect
15194                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15195                         echo "You have Linux-like /proc/self/exe."
15196                         procselfexe='"/proc/self/exe"'
15197                         val="$define"
15198                 fi
15199         fi
15200         if $issymlink /proc/curproc/file ; then
15201                 $ls -l /proc/curproc/file > reflect
15202                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15203                         echo "You have BSD-like /proc/curproc/file."
15204                         procselfexe='"/proc/curproc/file"'
15205                         val="$define"
15206                 fi
15207         fi
15208         ;;
15209 esac
15210 $rm -f reflect
15211 set d_procselfexe
15212 eval $setvar
15213
15214 : see whether the pthread_atfork exists
15215 $cat >try.c <<EOP
15216 #include <pthread.h>
15217 #include <stdio.h>
15218 int main() {
15219 #ifdef  PTHREAD_ATFORK
15220         pthread_atfork(NULL,NULL,NULL);
15221 #endif
15222 }
15223 EOP
15224
15225 : see if pthread_atfork exists
15226 set try -DPTHREAD_ATFORK
15227 if eval $compile; then
15228     val="$define"
15229 else
15230     val="$undef"
15231 fi
15232 case "$usethreads" in
15233 $define)
15234         case "$val" in
15235         $define) echo 'pthread_atfork found.' >&4        ;;
15236         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15237         esac
15238 esac
15239 set d_pthread_atfork
15240 eval $setvar
15241
15242 : see if pthread_attr_setscope exists
15243 set pthread_attr_setscope d_pthread_attr_setscope
15244 eval $inlibc
15245
15246
15247 : see whether the various POSIXish _yields exist
15248 $cat >try.c <<EOP
15249 #include <pthread.h>
15250 #include <stdio.h>
15251 int main() {
15252 #ifdef SCHED_YIELD
15253         sched_yield();
15254 #else
15255 #ifdef PTHREAD_YIELD
15256         pthread_yield();
15257 #else
15258 #ifdef PTHREAD_YIELD_NULL
15259         pthread_yield(NULL);
15260 #endif
15261 #endif
15262 #endif
15263 }
15264 EOP
15265 : see if sched_yield exists
15266 set try -DSCHED_YIELD
15267 if eval $compile; then
15268     val="$define"
15269     sched_yield='sched_yield()'
15270 else
15271     val="$undef"
15272 fi
15273 case "$usethreads" in
15274 $define)
15275         case "$val" in
15276         $define) echo 'sched_yield() found.' >&4        ;;
15277         *)       echo 'sched_yield() NOT found.' >&4    ;;
15278         esac
15279 esac
15280 set d_sched_yield
15281 eval $setvar
15282
15283 : see if pthread_yield exists
15284 set try -DPTHREAD_YIELD
15285 if eval $compile; then
15286     val="$define"
15287     case "$sched_yield" in
15288     '') sched_yield='pthread_yield()' ;;
15289     esac
15290 else
15291     set try -DPTHREAD_YIELD_NULL
15292     if eval $compile; then
15293         val="$define"
15294         case "$sched_yield" in
15295         '') sched_yield='pthread_yield(NULL)' ;;
15296         esac
15297     else
15298         val="$undef"
15299     fi
15300 fi
15301 case "$usethreads" in
15302 $define)
15303         case "$val" in
15304         $define) echo 'pthread_yield() found.' >&4      ;;
15305         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15306         esac
15307         ;;
15308 esac
15309 set d_pthread_yield
15310 eval $setvar
15311
15312 case "$sched_yield" in
15313 '') sched_yield=undef ;;
15314 esac
15315
15316 $rm -f try try.*
15317
15318 : see if random_r exists
15319 set random_r d_random_r
15320 eval $inlibc
15321 case "$d_random_r" in
15322 "$define")
15323         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15324         case "$d_random_r_proto:$usethreads" in
15325         ":define")      d_random_r_proto=define
15326                 set d_random_r_proto random_r $hdrs
15327                 eval $hasproto ;;
15328         *)      ;;
15329         esac
15330         case "$d_random_r_proto" in
15331         define)
15332         case "$random_r_proto" in
15333         ''|0) try='int random_r(int*, struct random_data*);'
15334         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15335         esac
15336         case "$random_r_proto" in
15337         ''|0) try='int random_r(long*, struct random_data*);'
15338         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15339         esac
15340         case "$random_r_proto" in
15341         ''|0) try='int random_r(struct random_data*, int32_t*);'
15342         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15343         esac
15344         case "$random_r_proto" in
15345         ''|0)   d_random_r=undef
15346                 random_r_proto=0
15347                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15348         * )     case "$random_r_proto" in
15349                 REENTRANT_PROTO*) ;;
15350                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15351                 esac
15352                 echo "Prototype: $try" ;;
15353         esac
15354         ;;
15355         *)      case "$usethreads" in
15356                 define) echo "random_r has no prototype, not using it." >&4 ;;
15357                 esac
15358                 d_random_r=undef
15359                 random_r_proto=0
15360                 ;;
15361         esac
15362         ;;
15363 *)      random_r_proto=0
15364         ;;
15365 esac
15366
15367 : see if readdir and friends exist
15368 set readdir d_readdir
15369 eval $inlibc
15370 set seekdir d_seekdir
15371 eval $inlibc
15372 set telldir d_telldir
15373 eval $inlibc
15374 set rewinddir d_rewinddir
15375 eval $inlibc
15376
15377 : see if readdir64_r exists
15378 set readdir64_r d_readdir64_r
15379 eval $inlibc
15380 case "$d_readdir64_r" in
15381 "$define")
15382         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15383         case "$d_readdir64_r_proto:$usethreads" in
15384         ":define")      d_readdir64_r_proto=define
15385                 set d_readdir64_r_proto readdir64_r $hdrs
15386                 eval $hasproto ;;
15387         *)      ;;
15388         esac
15389         case "$d_readdir64_r_proto" in
15390         define)
15391         case "$readdir64_r_proto" in
15392         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15393         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15394         esac
15395         case "$readdir64_r_proto" in
15396         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15397         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15398         esac
15399         case "$readdir64_r_proto" in
15400         ''|0)   d_readdir64_r=undef
15401                 readdir64_r_proto=0
15402                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15403         * )     case "$readdir64_r_proto" in
15404                 REENTRANT_PROTO*) ;;
15405                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15406                 esac
15407                 echo "Prototype: $try" ;;
15408         esac
15409         ;;
15410         *)      case "$usethreads" in
15411                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15412                 esac
15413                 d_readdir64_r=undef
15414                 readdir64_r_proto=0
15415                 ;;
15416         esac
15417         ;;
15418 *)      readdir64_r_proto=0
15419         ;;
15420 esac
15421
15422 : see if readdir_r exists
15423 set readdir_r d_readdir_r
15424 eval $inlibc
15425 case "$d_readdir_r" in
15426 "$define")
15427         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15428         case "$d_readdir_r_proto:$usethreads" in
15429         ":define")      d_readdir_r_proto=define
15430                 set d_readdir_r_proto readdir_r $hdrs
15431                 eval $hasproto ;;
15432         *)      ;;
15433         esac
15434         case "$d_readdir_r_proto" in
15435         define)
15436         case "$readdir_r_proto" in
15437         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15438         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15439         esac
15440         case "$readdir_r_proto" in
15441         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15442         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15443         esac
15444         case "$readdir_r_proto" in
15445         ''|0)   d_readdir_r=undef
15446                 readdir_r_proto=0
15447                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15448         * )     case "$readdir_r_proto" in
15449                 REENTRANT_PROTO*) ;;
15450                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15451                 esac
15452                 echo "Prototype: $try" ;;
15453         esac
15454         ;;
15455         *)      case "$usethreads" in
15456                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15457                 esac
15458                 d_readdir_r=undef
15459                 readdir_r_proto=0
15460                 ;;
15461         esac
15462         ;;
15463 *)      readdir_r_proto=0
15464         ;;
15465 esac
15466
15467 : see if readv exists
15468 set readv d_readv
15469 eval $inlibc
15470
15471 : see if recvmsg exists
15472 set recvmsg d_recvmsg
15473 eval $inlibc
15474
15475 : see if rename exists
15476 set rename d_rename
15477 eval $inlibc
15478
15479 : see if rmdir exists
15480 set rmdir d_rmdir
15481 eval $inlibc
15482
15483 : see if memory.h is available.
15484 val=''
15485 set memory.h val
15486 eval $inhdr
15487
15488 : See if it conflicts with string.h
15489 case "$val" in
15490 $define)
15491         case "$strings" in
15492         '') ;;
15493         *)
15494                 $cppstdin $cppflags $cppminus < $strings > mem.h
15495                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15496                         echo " "
15497                         echo "We won't be including <memory.h>."
15498                         val="$undef"
15499                 fi
15500                 $rm -f mem.h
15501                 ;;
15502         esac
15503 esac
15504 set i_memory
15505 eval $setvar
15506
15507 : can bcopy handle overlapping blocks?
15508 echo " "
15509 val="$undef"
15510 case "$d_memmove" in
15511 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15512 *)      case "$d_bcopy" in
15513         "$define")
15514                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15515                 $cat >try.c <<EOCP
15516 #$i_memory I_MEMORY
15517 #$i_stdlib I_STDLIB
15518 #$i_string I_STRING
15519 #$i_unistd I_UNISTD
15520 EOCP
15521         $cat >>try.c <<'EOCP'
15522 #include <stdio.h>
15523 #ifdef I_MEMORY
15524 #  include <memory.h>
15525 #endif
15526 #ifdef I_STDLIB
15527 #  include <stdlib.h>
15528 #endif
15529 #ifdef I_STRING
15530 #  include <string.h>
15531 #else
15532 #  include <strings.h>
15533 #endif
15534 #ifdef I_UNISTD
15535 #  include <unistd.h>  /* Needed for NetBSD */
15536 #endif
15537 int main()
15538 {
15539 char buf[128], abc[128];
15540 char *b;
15541 int len;
15542 int off;
15543 int align;
15544
15545 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15546    try to store the string in read-only memory. */
15547 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15548
15549 for (align = 7; align >= 0; align--) {
15550         for (len = 36; len; len--) {
15551                 b = buf+align;
15552                 bcopy(abc, b, len);
15553                 for (off = 1; off <= len; off++) {
15554                         bcopy(b, b+off, len);
15555                         bcopy(b+off, b, len);
15556                         if (bcmp(b, abc, len))
15557                                 exit(1);
15558                 }
15559         }
15560 }
15561 exit(0);
15562 }
15563 EOCP
15564                 set try
15565                 if eval $compile_ok; then
15566                         if ./try 2>/dev/null; then
15567                                 echo "Yes, it can."
15568                                 val="$define"
15569                         else
15570                                 echo "It can't, sorry."
15571                         fi
15572                 else
15573                         echo "(I can't compile the test program, so we'll assume not...)"
15574                 fi
15575                 ;;
15576         esac
15577         $rm -f try.* try core
15578         ;;
15579 esac
15580 set d_safebcpy
15581 eval $setvar
15582
15583 : can memcpy handle overlapping blocks?
15584 echo " "
15585 val="$undef"
15586 case "$d_memmove" in
15587 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15588 *)      case "$d_memcpy" in
15589         "$define")
15590                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15591                 $cat >try.c <<EOCP
15592 #$i_memory I_MEMORY
15593 #$i_stdlib I_STDLIB
15594 #$i_string I_STRING
15595 #$i_unistd I_UNISTD
15596 EOCP
15597         $cat >>try.c <<'EOCP'
15598 #include <stdio.h>
15599 #ifdef I_MEMORY
15600 #  include <memory.h>
15601 #endif
15602 #ifdef I_STDLIB
15603 #  include <stdlib.h>
15604 #endif
15605 #ifdef I_STRING
15606 #  include <string.h>
15607 #else
15608 #  include <strings.h>
15609 #endif
15610 #ifdef I_UNISTD
15611 #  include <unistd.h>  /* Needed for NetBSD */
15612 #endif
15613 int main()
15614 {
15615 char buf[128], abc[128];
15616 char *b;
15617 int len;
15618 int off;
15619 int align;
15620
15621 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15622    try to store the string in read-only memory. */
15623 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15624
15625 for (align = 7; align >= 0; align--) {
15626         for (len = 36; len; len--) {
15627                 b = buf+align;
15628                 memcpy(b, abc, len);
15629                 for (off = 1; off <= len; off++) {
15630                         memcpy(b+off, b, len);
15631                         memcpy(b, b+off, len);
15632                         if (memcmp(b, abc, len))
15633                                 exit(1);
15634                 }
15635         }
15636 }
15637 exit(0);
15638 }
15639 EOCP
15640                 set try
15641                 if eval $compile_ok; then
15642                         if ./try 2>/dev/null; then
15643                                 echo "Yes, it can."
15644                                 val="$define"
15645                         else
15646                                 echo "It can't, sorry."
15647                         fi
15648                 else
15649                         echo "(I can't compile the test program, so we'll assume not...)"
15650                 fi
15651                 ;;
15652         esac
15653         $rm -f try.* try core
15654         ;;
15655 esac
15656 set d_safemcpy
15657 eval $setvar
15658
15659 : can memcmp be trusted to compare relative magnitude?
15660 val="$undef"
15661 case "$d_memcmp" in
15662 "$define")
15663         echo " "
15664         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15665         $cat >try.c <<EOCP
15666 #$i_memory I_MEMORY
15667 #$i_stdlib I_STDLIB
15668 #$i_string I_STRING
15669 #$i_unistd I_UNISTD
15670 EOCP
15671         $cat >>try.c <<'EOCP'
15672 #include <stdio.h>
15673 #ifdef I_MEMORY
15674 #  include <memory.h>
15675 #endif
15676 #ifdef I_STDLIB
15677 #  include <stdlib.h>
15678 #endif
15679 #ifdef I_STRING
15680 #  include <string.h>
15681 #else
15682 #  include <strings.h>
15683 #endif
15684 #ifdef I_UNISTD
15685 #  include <unistd.h>  /* Needed for NetBSD */
15686 #endif
15687 int main()
15688 {
15689 char a = -1;
15690 char b = 0;
15691 if ((a < b) && memcmp(&a, &b, 1) < 0)
15692         exit(1);
15693 exit(0);
15694 }
15695 EOCP
15696         set try
15697         if eval $compile_ok; then
15698                 if $run ./try 2>/dev/null; then
15699                         echo "Yes, it can."
15700                         val="$define"
15701                 else
15702                         echo "No, it can't (it uses signed chars)."
15703                 fi
15704         else
15705                 echo "(I can't compile the test program, so we'll assume not...)"
15706         fi
15707         ;;
15708 esac
15709 $rm -f try.* try core
15710 set d_sanemcmp
15711 eval $setvar
15712
15713 : see if prototype for sbrk is available
15714 echo " "
15715 set d_sbrkproto sbrk $i_unistd unistd.h
15716 eval $hasproto
15717
15718 : see if select exists
15719 set select d_select
15720 eval $inlibc
15721
15722 : see if semctl exists
15723 set semctl d_semctl
15724 eval $inlibc
15725
15726 : see if semget exists
15727 set semget d_semget
15728 eval $inlibc
15729
15730 : see if semop exists
15731 set semop d_semop
15732 eval $inlibc
15733
15734 : see how much of the 'sem*(2)' library is present.
15735 h_sem=true
15736 echo " "
15737 case "$d_semctl$d_semget$d_semop" in
15738 *"$undef"*) h_sem=false;;
15739 esac
15740 case "$osname" in
15741 freebsd)
15742     case "`ipcs 2>&1`" in
15743     "SVID messages"*"not configured"*)
15744         echo "Your $osname does not have the sem*(2) configured." >&4
15745         h_sem=false
15746         val="$undef"
15747         set semctl d_semctl
15748         eval $setvar
15749         set semget d_semget
15750         eval $setvar
15751         set semop d_semop
15752         eval $setvar
15753         ;;
15754     esac
15755     ;;
15756 esac
15757 : we could also check for sys/ipc.h ...
15758 if $h_sem && $test `./findhdr sys/sem.h`; then
15759         echo "You have the full sem*(2) library." >&4
15760         val="$define"
15761 else
15762         echo "You don't have the full sem*(2) library." >&4
15763         val="$undef"
15764 fi
15765 set d_sem
15766 eval $setvar
15767
15768 : see whether sys/sem.h defines union semun
15769 echo " "
15770 $cat > try.c <<'END'
15771 #include <sys/types.h>
15772 #include <sys/ipc.h>
15773 #include <sys/sem.h>
15774 int main () { union semun semun; semun.buf = 0; }
15775 END
15776 set try
15777 if eval $compile; then
15778     echo "You have union semun in <sys/sem.h>." >&4
15779     val="$define"
15780 else
15781     echo "You do not have union semun in <sys/sem.h>." >&4
15782     val="$undef"
15783 fi
15784 $rm -f try try.c
15785 set d_union_semun
15786 eval $setvar
15787
15788 : see how to do semctl IPC_STAT
15789 case "$d_sem" in
15790 $define)
15791     echo " "
15792     $cat > try.h <<END
15793 #ifndef S_IRUSR
15794 #   ifdef S_IREAD
15795 #       define S_IRUSR S_IREAD
15796 #       define S_IWUSR S_IWRITE
15797 #       define S_IXUSR S_IEXEC
15798 #   else
15799 #       define S_IRUSR 0400
15800 #       define S_IWUSR 0200
15801 #       define S_IXUSR 0100
15802 #   endif
15803 #   define S_IRGRP (S_IRUSR>>3)
15804 #   define S_IWGRP (S_IWUSR>>3)
15805 #   define S_IXGRP (S_IXUSR>>3)
15806 #   define S_IROTH (S_IRUSR>>6)
15807 #   define S_IWOTH (S_IWUSR>>6)
15808 #   define S_IXOTH (S_IXUSR>>6)
15809 #endif
15810 #ifndef S_IRWXU
15811 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15812 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15813 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15814 #endif
15815 END
15816     : see whether semctl IPC_STAT can use union semun
15817     case "$d_semctl_semun" in
15818     '')
15819       val="$undef"
15820       $cat > try.c <<END
15821 #include <sys/types.h>
15822 #include <sys/ipc.h>
15823 #include <sys/sem.h>
15824 #include <sys/stat.h>
15825 #include <stdio.h>
15826 #include <errno.h>
15827 #include "try.h"
15828 #ifndef errno
15829 extern int errno;
15830 #endif
15831 #$d_union_semun HAS_UNION_SEMUN
15832 int main() {
15833     union semun
15834 #ifndef HAS_UNION_SEMUN
15835     {
15836         int val;
15837         struct semid_ds *buf;
15838         unsigned short *array;
15839     }
15840 #endif
15841     arg;
15842     int sem, st;
15843
15844 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15845     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15846     if (sem > -1) {
15847         struct semid_ds argbuf;
15848         arg.buf = &argbuf;
15849 #       ifdef IPC_STAT
15850         st = semctl(sem, 0, IPC_STAT, arg);
15851         if (st == 0)
15852             printf("semun\n");
15853         else
15854 #       endif /* IPC_STAT */
15855             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15856 #       ifdef IPC_RMID
15857         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15858 #       endif /* IPC_RMID */
15859             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15860     } else
15861 #endif /* IPC_PRIVATE && ... */
15862         printf("semget failed: errno = %d\n", errno);
15863   return 0;
15864 }
15865 END
15866       set try
15867       if eval $compile; then
15868           xxx=`$run ./try`
15869           case "$xxx" in
15870           semun) val="$define" ;;
15871           esac
15872       fi
15873       $rm -f try try.c
15874       set d_semctl_semun
15875       eval $setvar
15876       ;;
15877     esac
15878     case "$d_semctl_semun" in
15879     $define)
15880         echo "You can use union semun for semctl IPC_STAT." >&4
15881         also='also'
15882         ;;
15883     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15884         also=''
15885         ;;
15886     esac
15887
15888     : see whether semctl IPC_STAT can use struct semid_ds pointer
15889     case "$d_semctl_semid_ds" in
15890     '')
15891       val="$undef"
15892       $cat > try.c <<'END'
15893 #include <sys/types.h>
15894 #include <sys/ipc.h>
15895 #include <sys/sem.h>
15896 #include <sys/stat.h>
15897 #include "try.h"
15898 #include <stdio.h>
15899 #include <errno.h>
15900 #ifndef errno
15901 extern int errno;
15902 #endif
15903 int main() {
15904     struct semid_ds arg;
15905     int sem, st;
15906
15907 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15908     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15909     if (sem > -1) {
15910 #       ifdef IPC_STAT
15911         st = semctl(sem, 0, IPC_STAT, &arg);
15912         if (st == 0)
15913             printf("semid_ds\n");
15914         else
15915 #       endif /* IPC_STAT */
15916             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15917 #       ifdef IPC_RMID
15918         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15919 #       endif /* IPC_RMID */
15920             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15921     } else
15922 #endif /* IPC_PRIVATE && ... */
15923         printf("semget failed: errno = %d\n", errno);
15924
15925     return 0;
15926 }
15927 END
15928       set try
15929       if eval $compile; then
15930           xxx=`$run ./try`
15931           case "$xxx" in
15932           semid_ds) val="$define" ;;
15933           esac
15934       fi
15935       $rm -f try try.c
15936       set d_semctl_semid_ds
15937       eval $setvar
15938       ;;
15939     esac
15940     case "$d_semctl_semid_ds" in
15941     $define)
15942         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15943         ;;
15944     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15945         ;;
15946     esac
15947     $rm -f try.h
15948     ;;
15949 *)  val="$undef"
15950
15951     # We do not have the full sem*(2) library, so assume we can not
15952     # use either.
15953
15954     set d_semctl_semun
15955     eval $setvar
15956
15957     set d_semctl_semid_ds
15958     eval $setvar
15959     ;;
15960 esac
15961
15962 : see if sendmsg exists
15963 set sendmsg d_sendmsg
15964 eval $inlibc
15965
15966 : see if setegid exists
15967 set setegid d_setegid
15968 eval $inlibc
15969
15970 : see if seteuid exists
15971 set seteuid d_seteuid
15972 eval $inlibc
15973
15974 : see if setgrent exists
15975 set setgrent d_setgrent
15976 eval $inlibc
15977
15978 : see if setgrent_r exists
15979 set setgrent_r d_setgrent_r
15980 eval $inlibc
15981 case "$d_setgrent_r" in
15982 "$define")
15983         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15984         case "$d_setgrent_r_proto:$usethreads" in
15985         ":define")      d_setgrent_r_proto=define
15986                 set d_setgrent_r_proto setgrent_r $hdrs
15987                 eval $hasproto ;;
15988         *)      ;;
15989         esac
15990         case "$d_setgrent_r_proto" in
15991         define)
15992         case "$setgrent_r_proto" in
15993         ''|0) try='int setgrent_r(FILE**);'
15994         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15995         esac
15996         case "$setgrent_r_proto" in
15997         ''|0) try='void setgrent_r(FILE**);'
15998         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15999         esac
16000         case "$setgrent_r_proto" in
16001         ''|0)   d_setgrent_r=undef
16002                 setgrent_r_proto=0
16003                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16004         * )     case "$setgrent_r_proto" in
16005                 REENTRANT_PROTO*) ;;
16006                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16007                 esac
16008                 echo "Prototype: $try" ;;
16009         esac
16010         ;;
16011         *)      case "$usethreads" in
16012                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16013                 esac
16014                 d_setgrent_r=undef
16015                 setgrent_r_proto=0
16016                 ;;
16017         esac
16018         ;;
16019 *)      setgrent_r_proto=0
16020         ;;
16021 esac
16022
16023 : see if sethostent exists
16024 set sethostent d_sethent
16025 eval $inlibc
16026
16027 : see if sethostent_r exists
16028 set sethostent_r d_sethostent_r
16029 eval $inlibc
16030 case "$d_sethostent_r" in
16031 "$define")
16032         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16033         case "$d_sethostent_r_proto:$usethreads" in
16034         ":define")      d_sethostent_r_proto=define
16035                 set d_sethostent_r_proto sethostent_r $hdrs
16036                 eval $hasproto ;;
16037         *)      ;;
16038         esac
16039         case "$d_sethostent_r_proto" in
16040         define)
16041         case "$sethostent_r_proto" in
16042         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16043         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16044         esac
16045         case "$sethostent_r_proto" in
16046         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16047         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16048         esac
16049         case "$sethostent_r_proto" in
16050         ''|0)   d_sethostent_r=undef
16051                 sethostent_r_proto=0
16052                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16053         * )     case "$sethostent_r_proto" in
16054                 REENTRANT_PROTO*) ;;
16055                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16056                 esac
16057                 echo "Prototype: $try" ;;
16058         esac
16059         ;;
16060         *)      case "$usethreads" in
16061                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16062                 esac
16063                 d_sethostent_r=undef
16064                 sethostent_r_proto=0
16065                 ;;
16066         esac
16067         ;;
16068 *)      sethostent_r_proto=0
16069         ;;
16070 esac
16071
16072 : see if setitimer exists
16073 set setitimer d_setitimer
16074 eval $inlibc
16075
16076 : see if setlinebuf exists
16077 set setlinebuf d_setlinebuf
16078 eval $inlibc
16079
16080 : see if setlocale exists
16081 set setlocale d_setlocale
16082 eval $inlibc
16083
16084 : see if locale.h is available
16085 set locale.h i_locale
16086 eval $inhdr
16087
16088 : see if setlocale_r exists
16089 set setlocale_r d_setlocale_r
16090 eval $inlibc
16091 case "$d_setlocale_r" in
16092 "$define")
16093         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16094         case "$d_setlocale_r_proto:$usethreads" in
16095         ":define")      d_setlocale_r_proto=define
16096                 set d_setlocale_r_proto setlocale_r $hdrs
16097                 eval $hasproto ;;
16098         *)      ;;
16099         esac
16100         case "$d_setlocale_r_proto" in
16101         define)
16102         case "$setlocale_r_proto" in
16103         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16104         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16105         esac
16106         case "$setlocale_r_proto" in
16107         ''|0)   d_setlocale_r=undef
16108                 setlocale_r_proto=0
16109                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16110         * )     case "$setlocale_r_proto" in
16111                 REENTRANT_PROTO*) ;;
16112                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16113                 esac
16114                 echo "Prototype: $try" ;;
16115         esac
16116         ;;
16117         *)      case "$usethreads" in
16118                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16119                 esac
16120                 d_setlocale_r=undef
16121                 setlocale_r_proto=0
16122                 ;;
16123         esac
16124         ;;
16125 *)      setlocale_r_proto=0
16126         ;;
16127 esac
16128
16129 : see if setnetent exists
16130 set setnetent d_setnent
16131 eval $inlibc
16132
16133 : see if setnetent_r exists
16134 set setnetent_r d_setnetent_r
16135 eval $inlibc
16136 case "$d_setnetent_r" in
16137 "$define")
16138         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16139         case "$d_setnetent_r_proto:$usethreads" in
16140         ":define")      d_setnetent_r_proto=define
16141                 set d_setnetent_r_proto setnetent_r $hdrs
16142                 eval $hasproto ;;
16143         *)      ;;
16144         esac
16145         case "$d_setnetent_r_proto" in
16146         define)
16147         case "$setnetent_r_proto" in
16148         ''|0) try='int setnetent_r(int, struct netent_data*);'
16149         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16150         esac
16151         case "$setnetent_r_proto" in
16152         ''|0) try='void setnetent_r(int, struct netent_data*);'
16153         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16154         esac
16155         case "$setnetent_r_proto" in
16156         ''|0)   d_setnetent_r=undef
16157                 setnetent_r_proto=0
16158                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16159         * )     case "$setnetent_r_proto" in
16160                 REENTRANT_PROTO*) ;;
16161                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16162                 esac
16163                 echo "Prototype: $try" ;;
16164         esac
16165         ;;
16166         *)      case "$usethreads" in
16167                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16168                 esac
16169                 d_setnetent_r=undef
16170                 setnetent_r_proto=0
16171                 ;;
16172         esac
16173         ;;
16174 *)      setnetent_r_proto=0
16175         ;;
16176 esac
16177
16178 : see if setprotoent exists
16179 set setprotoent d_setpent
16180 eval $inlibc
16181
16182 : see if setpgid exists
16183 set setpgid d_setpgid
16184 eval $inlibc
16185
16186 : see if setpgrp2 exists
16187 set setpgrp2 d_setpgrp2
16188 eval $inlibc
16189
16190 : see if setpriority exists
16191 set setpriority d_setprior
16192 eval $inlibc
16193
16194 : see if setproctitle exists
16195 set setproctitle d_setproctitle
16196 eval $inlibc
16197
16198 : see if setprotoent_r exists
16199 set setprotoent_r d_setprotoent_r
16200 eval $inlibc
16201 case "$d_setprotoent_r" in
16202 "$define")
16203         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16204         case "$d_setprotoent_r_proto:$usethreads" in
16205         ":define")      d_setprotoent_r_proto=define
16206                 set d_setprotoent_r_proto setprotoent_r $hdrs
16207                 eval $hasproto ;;
16208         *)      ;;
16209         esac
16210         case "$d_setprotoent_r_proto" in
16211         define)
16212         case "$setprotoent_r_proto" in
16213         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16214         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16215         esac
16216         case "$setprotoent_r_proto" in
16217         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16218         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16219         esac
16220         case "$setprotoent_r_proto" in
16221         ''|0)   d_setprotoent_r=undef
16222                 setprotoent_r_proto=0
16223                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16224         * )     case "$setprotoent_r_proto" in
16225                 REENTRANT_PROTO*) ;;
16226                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16227                 esac
16228                 echo "Prototype: $try" ;;
16229         esac
16230         ;;
16231         *)      case "$usethreads" in
16232                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16233                 esac
16234                 d_setprotoent_r=undef
16235                 setprotoent_r_proto=0
16236                 ;;
16237         esac
16238         ;;
16239 *)      setprotoent_r_proto=0
16240         ;;
16241 esac
16242
16243 : see if setpwent exists
16244 set setpwent d_setpwent
16245 eval $inlibc
16246
16247 : see if setpwent_r exists
16248 set setpwent_r d_setpwent_r
16249 eval $inlibc
16250 case "$d_setpwent_r" in
16251 "$define")
16252         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16253         case "$d_setpwent_r_proto:$usethreads" in
16254         ":define")      d_setpwent_r_proto=define
16255                 set d_setpwent_r_proto setpwent_r $hdrs
16256                 eval $hasproto ;;
16257         *)      ;;
16258         esac
16259         case "$d_setpwent_r_proto" in
16260         define)
16261         case "$setpwent_r_proto" in
16262         ''|0) try='int setpwent_r(FILE**);'
16263         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16264         esac
16265         case "$setpwent_r_proto" in
16266         ''|0) try='void setpwent_r(FILE**);'
16267         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16268         esac
16269         case "$setpwent_r_proto" in
16270         ''|0)   d_setpwent_r=undef
16271                 setpwent_r_proto=0
16272                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16273         * )     case "$setpwent_r_proto" in
16274                 REENTRANT_PROTO*) ;;
16275                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16276                 esac
16277                 echo "Prototype: $try" ;;
16278         esac
16279         ;;
16280         *)      case "$usethreads" in
16281                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16282                 esac
16283                 d_setpwent_r=undef
16284                 setpwent_r_proto=0
16285                 ;;
16286         esac
16287         ;;
16288 *)      setpwent_r_proto=0
16289         ;;
16290 esac
16291
16292 : see if setregid exists
16293 set setregid d_setregid
16294 eval $inlibc
16295 set setresgid d_setresgid
16296 eval $inlibc
16297
16298 : see if setreuid exists
16299 set setreuid d_setreuid
16300 eval $inlibc
16301 set setresuid d_setresuid
16302 eval $inlibc
16303
16304 : see if setrgid exists
16305 set setrgid d_setrgid
16306 eval $inlibc
16307
16308 : see if setruid exists
16309 set setruid d_setruid
16310 eval $inlibc
16311
16312 : see if setservent exists
16313 set setservent d_setsent
16314 eval $inlibc
16315
16316 : see if setservent_r exists
16317 set setservent_r d_setservent_r
16318 eval $inlibc
16319 case "$d_setservent_r" in
16320 "$define")
16321         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16322         case "$d_setservent_r_proto:$usethreads" in
16323         ":define")      d_setservent_r_proto=define
16324                 set d_setservent_r_proto setservent_r $hdrs
16325                 eval $hasproto ;;
16326         *)      ;;
16327         esac
16328         case "$d_setservent_r_proto" in
16329         define)
16330         case "$setservent_r_proto" in
16331         ''|0) try='int setservent_r(int, struct servent_data*);'
16332         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16333         esac
16334         case "$setservent_r_proto" in
16335         ''|0) try='void setservent_r(int, struct servent_data*);'
16336         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16337         esac
16338         case "$setservent_r_proto" in
16339         ''|0)   d_setservent_r=undef
16340                 setservent_r_proto=0
16341                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16342         * )     case "$setservent_r_proto" in
16343                 REENTRANT_PROTO*) ;;
16344                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16345                 esac
16346                 echo "Prototype: $try" ;;
16347         esac
16348         ;;
16349         *)      case "$usethreads" in
16350                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16351                 esac
16352                 d_setservent_r=undef
16353                 setservent_r_proto=0
16354                 ;;
16355         esac
16356         ;;
16357 *)      setservent_r_proto=0
16358         ;;
16359 esac
16360
16361 : see if setsid exists
16362 set setsid d_setsid
16363 eval $inlibc
16364
16365 : see if setvbuf exists
16366 set setvbuf d_setvbuf
16367 eval $inlibc
16368
16369 : see if sfio.h is available
16370 set sfio.h i_sfio
16371 eval $inhdr
16372
16373
16374 : see if sfio library is available
16375 case "$i_sfio" in
16376 $define)
16377         val=''
16378         set sfreserve val
16379         eval $inlibc
16380         ;;
16381 *)
16382         val="$undef"
16383         ;;
16384 esac
16385 : Ok, but do we want to use it.
16386 case "$val" in
16387 $define)
16388         case "$usesfio" in
16389         true|$define|[yY]*) dflt='y';;
16390         *) dflt='n';;
16391         esac
16392         echo "$package can use the sfio library, but it is experimental."
16393         case "$useperlio" in
16394         "$undef")
16395             echo "For sfio also the PerlIO abstraction layer is needed."
16396             echo "Earlier you said you wouldn't want that."
16397             ;;
16398         esac
16399         rp="You seem to have sfio available, do you want to try using it?"
16400         . ./myread
16401         case "$ans" in
16402         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16403                 useperlio="$define"
16404                 val="$define"
16405                 ;;
16406         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16407                 val="$undef"
16408                 ;;
16409         esac
16410         ;;
16411 *)      case "$usesfio" in
16412         true|$define|[yY]*)
16413                 echo "Sorry, cannot find sfio on this machine." >&4
16414                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16415                 val="$undef"
16416                 ;;
16417         esac
16418         ;;
16419 esac
16420 set d_sfio
16421 eval $setvar
16422 case "$d_sfio" in
16423 $define) usesfio='true';;
16424 *) usesfio='false';;
16425 esac
16426 case "$d_sfio" in
16427 $define) ;;
16428 *)      : Remove sfio from list of libraries to use
16429         case "$libs" in
16430         *-lsfio*)
16431                 echo "Removing unneeded -lsfio from library list" >&4
16432                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16433                 shift
16434                 libs="$*"
16435                 echo "libs = $libs" >&4
16436                 ;;
16437         esac
16438 ;;
16439 esac
16440
16441
16442 : see if shmctl exists
16443 set shmctl d_shmctl
16444 eval $inlibc
16445
16446 : see if shmget exists
16447 set shmget d_shmget
16448 eval $inlibc
16449
16450 : see if shmat exists
16451 set shmat d_shmat
16452 eval $inlibc
16453 : see what shmat returns
16454 case "$d_shmat" in
16455 "$define")
16456         $cat >shmat.c <<'END'
16457 #include <sys/shm.h>
16458 void *shmat();
16459 END
16460         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16461                 shmattype='void *'
16462         else
16463                 shmattype='char *'
16464         fi
16465         echo "and it returns ($shmattype)." >&4
16466         : see if a prototype for shmat is available
16467         xxx=`./findhdr sys/shm.h`
16468         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16469         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16470                 val="$define"
16471         else
16472                 val="$undef"
16473         fi
16474         $rm -f shmat.[co]
16475         ;;
16476 *)
16477         val="$undef"
16478         ;;
16479 esac
16480 set d_shmatprototype
16481 eval $setvar
16482
16483 : see if shmdt exists
16484 set shmdt d_shmdt
16485 eval $inlibc
16486
16487 : see how much of the 'shm*(2)' library is present.
16488 h_shm=true
16489 echo " "
16490 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16491 *"$undef"*) h_shm=false;;
16492 esac
16493 case "$osname" in
16494 freebsd)
16495     case "`ipcs 2>&1`" in
16496     "SVID shared memory"*"not configured"*)
16497         echo "Your $osname does not have the shm*(2) configured." >&4
16498         h_shm=false
16499         val="$undef"
16500         set shmctl d_shmctl
16501         evat $setvar
16502         set shmget d_shmget
16503         evat $setvar
16504         set shmat d_shmat
16505         evat $setvar
16506         set shmdt d_shmdt
16507         evat $setvar
16508         ;;
16509     esac
16510     ;;
16511 esac
16512 : we could also check for sys/ipc.h ...
16513 if $h_shm && $test `./findhdr sys/shm.h`; then
16514         echo "You have the full shm*(2) library." >&4
16515         val="$define"
16516 else
16517         echo "You don't have the full shm*(2) library." >&4
16518         val="$undef"
16519 fi
16520 set d_shm
16521 eval $setvar
16522
16523 echo " "
16524 : see if we have sigaction
16525 if set sigaction val -f d_sigaction; eval $csym; $val; then
16526         echo 'sigaction() found.' >&4
16527         $cat > try.c <<EOP
16528 #include <stdio.h>
16529 #include <sys/types.h>
16530 #include <signal.h>
16531 #$i_stdlib I_STDLIB
16532 #ifdef I_STDLIB
16533 #include <stdlib.h>
16534 #endif
16535 int main()
16536 {
16537     struct sigaction act, oact;
16538     act.sa_flags = 0;
16539     oact.sa_handler = 0;
16540     /* so that act and oact are used */
16541     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16542 }
16543 EOP
16544         set try
16545         if eval $compile_ok; then
16546                 val="$define"
16547         else
16548                 echo "But you don't seem to have a useable struct sigaction." >&4
16549                 val="$undef"
16550         fi
16551 else
16552         echo 'sigaction NOT found.' >&4
16553         val="$undef"
16554 fi
16555 set d_sigaction; eval $setvar
16556 $rm -f try try$_o try.c
16557
16558 : see if sigprocmask exists
16559 set sigprocmask d_sigprocmask
16560 eval $inlibc
16561
16562 : see if sigsetjmp exists
16563 echo " "
16564 case "$d_sigsetjmp" in
16565 '')
16566         $cat >try.c <<EOP
16567 #include <setjmp.h>
16568 #$i_stdlib I_STDLIB
16569 #ifdef I_STDLIB
16570 #include <stdlib.h>
16571 #endif
16572 sigjmp_buf env;
16573 int set = 1;
16574 int main()
16575 {
16576         if (sigsetjmp(env,1))
16577                 exit(set);
16578         set = 0;
16579         siglongjmp(env, 1);
16580         exit(1);
16581 }
16582 EOP
16583         set try
16584         if eval $compile; then
16585                 if $run ./try >/dev/null 2>&1; then
16586                         echo "POSIX sigsetjmp found." >&4
16587                         val="$define"
16588                 else
16589                         $cat >&4 <<EOM
16590 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16591 I'll ignore them.
16592 EOM
16593                         val="$undef"
16594                 fi
16595         else
16596                 echo "sigsetjmp not found." >&4
16597                 val="$undef"
16598         fi
16599         ;;
16600 *) val="$d_sigsetjmp"
16601         case "$d_sigsetjmp" in
16602         $define) echo "POSIX sigsetjmp found." >&4;;
16603         $undef) echo "sigsetjmp not found." >&4;;
16604         esac
16605         ;;
16606 esac
16607 set d_sigsetjmp
16608 eval $setvar
16609 $rm -f try.c try
16610
16611 : see if snprintf exists
16612 set snprintf d_snprintf
16613 eval $inlibc
16614
16615 : see if vsnprintf exists
16616 set vsnprintf d_vsnprintf
16617 eval $inlibc
16618
16619 case "$d_snprintf-$d_vsnprintf" in
16620 "$define-$define")
16621     $cat <<EOM
16622 Checking whether your snprintf() and vsnprintf() work okay...
16623 EOM
16624     $cat >try.c <<'EOCP'
16625 /* v?snprintf testing logic courtesy of Russ Allbery.
16626  * According to C99:
16627  * - if the buffer is too short it still must be \0-terminated
16628  * - if the buffer is too short the potentially required length
16629  *   must be returned and not -1
16630  * - if the buffer is NULL the potentially required length
16631  *   must be returned and not -1 or core dump
16632  */
16633 #include <stdio.h>
16634 #include <stdarg.h>
16635
16636 char buf[2];
16637
16638 int test (char *format, ...)
16639 {
16640     va_list args;
16641     int count;
16642
16643     va_start (args, format);
16644     count = vsnprintf (buf, sizeof buf, format, args);
16645     va_end (args);
16646     return count;
16647 }
16648
16649 int main ()
16650 {
16651     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16652              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16653 }
16654 EOCP
16655     set try
16656     if eval $compile; then
16657         `$run ./try`
16658         case "$?" in
16659         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16660         *) cat <<EOM >&4
16661 Your snprintf() and snprintf() don't seem to be working okay.
16662 EOM
16663            d_snprintf="$undef"
16664            d_vsnprintf="$undef"
16665            ;;
16666         esac
16667     else
16668         echo "(I can't seem to compile the test program--assuming they don't)"
16669         d_snprintf="$undef"
16670         d_vsnprintf="$undef"
16671     fi
16672     $rm -f try.* try core core.try.*
16673     ;;
16674 esac
16675
16676 : see if sockatmark exists
16677 set sockatmark d_sockatmark
16678 eval $inlibc
16679
16680 : see if prototype for sockatmark is available
16681 echo " "
16682 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16683 eval $hasproto
16684
16685 : see if socks5_init exists
16686 set socks5_init d_socks5_init
16687 eval $inlibc
16688
16689 : see if sprintf returns the length of the string in the buffer as per ANSI
16690 $echo "Checking whether sprintf returns the length of the string..." >&4
16691 $cat <<EOP >try.c
16692 #include <stdio.h>
16693 #$i_stdlib I_STDLIB
16694 #ifdef I_STDLIB
16695 #include <stdlib.h>
16696 #endif
16697 #$i_string I_STRING
16698 #ifdef I_STRING
16699 #  include <string.h>
16700 #else
16701 #  include <strings.h>
16702 #endif
16703 #$i_math I_MATH
16704 #ifdef I_MATH
16705 #include <math.h>
16706 #endif
16707
16708 char buffer[256];
16709
16710 int check (size_t expect, int test) {
16711   size_t got = strlen(buffer);
16712   if (expect == got)
16713     return 0;
16714
16715   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16716        test, buffer);
16717   exit (test);
16718 }
16719
16720 int main(int argc, char **argv) {
16721   int test = 0;
16722
16723   check(sprintf(buffer, ""), ++test);
16724   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16725   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16726
16727   return 0;
16728 }
16729 EOP
16730 set try
16731
16732 d_sprintf_returns_strlen="$undef"
16733 if eval $compile; then
16734     xxx="`$run ./try`"
16735     case "$?" in
16736         0) cat >&4 <<EOM
16737 sprintf returns the length of the string (as ANSI says it should)
16738 EOM
16739         d_sprintf_returns_strlen="$define"
16740         ;;
16741         *) cat >&4 <<EOM
16742 sprintf does not return the length of the string (how old is this system?)
16743 EOM
16744         d_sprintf_returns_strlen="$undef"
16745         ;;
16746     esac
16747 fi
16748
16749 $rm -f try.* try
16750
16751 : see if srand48_r exists
16752 set srand48_r d_srand48_r
16753 eval $inlibc
16754 case "$d_srand48_r" in
16755 "$define")
16756         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16757         case "$d_srand48_r_proto:$usethreads" in
16758         ":define")      d_srand48_r_proto=define
16759                 set d_srand48_r_proto srand48_r $hdrs
16760                 eval $hasproto ;;
16761         *)      ;;
16762         esac
16763         case "$d_srand48_r_proto" in
16764         define)
16765         case "$srand48_r_proto" in
16766         ''|0) try='int srand48_r(long, struct drand48_data*);'
16767         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16768         esac
16769         case "$srand48_r_proto" in
16770         ''|0)   d_srand48_r=undef
16771                 srand48_r_proto=0
16772                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16773         * )     case "$srand48_r_proto" in
16774                 REENTRANT_PROTO*) ;;
16775                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16776                 esac
16777                 echo "Prototype: $try" ;;
16778         esac
16779         ;;
16780         *)      case "$usethreads" in
16781                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16782                 esac
16783                 d_srand48_r=undef
16784                 srand48_r_proto=0
16785                 ;;
16786         esac
16787         ;;
16788 *)      srand48_r_proto=0
16789         ;;
16790 esac
16791
16792 : see if srandom_r exists
16793 set srandom_r d_srandom_r
16794 eval $inlibc
16795 case "$d_srandom_r" in
16796 "$define")
16797         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16798         case "$d_srandom_r_proto:$usethreads" in
16799         ":define")      d_srandom_r_proto=define
16800                 set d_srandom_r_proto srandom_r $hdrs
16801                 eval $hasproto ;;
16802         *)      ;;
16803         esac
16804         case "$d_srandom_r_proto" in
16805         define)
16806         case "$srandom_r_proto" in
16807         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16808         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16809         esac
16810         case "$srandom_r_proto" in
16811         ''|0)   d_srandom_r=undef
16812                 srandom_r_proto=0
16813                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16814         * )     case "$srandom_r_proto" in
16815                 REENTRANT_PROTO*) ;;
16816                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16817                 esac
16818                 echo "Prototype: $try" ;;
16819         esac
16820         ;;
16821         *)      case "$usethreads" in
16822                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16823                 esac
16824                 d_srandom_r=undef
16825                 srandom_r_proto=0
16826                 ;;
16827         esac
16828         ;;
16829 *)      srandom_r_proto=0
16830         ;;
16831 esac
16832
16833 : see if prototype for setresgid is available
16834 echo " "
16835 set d_sresgproto setresgid $i_unistd unistd.h
16836 eval $hasproto
16837
16838 : see if prototype for setresuid is available
16839 echo " "
16840 set d_sresuproto setresuid $i_unistd unistd.h
16841 eval $hasproto
16842
16843 : see if sys/stat.h is available
16844 set sys/stat.h i_sysstat
16845 eval $inhdr
16846
16847
16848 : see if stat knows about block sizes
16849 echo " "
16850 echo "Checking to see if your struct stat has st_blocks field..." >&4
16851 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16852 eval $hasfield
16853
16854
16855 : see if this is a sys/vfs.h system
16856 set sys/vfs.h i_sysvfs
16857 eval $inhdr
16858
16859
16860 : see if this is a sys/statfs.h system
16861 set sys/statfs.h i_sysstatfs
16862 eval $inhdr
16863
16864
16865 echo " "
16866 echo "Checking to see if your system supports struct statfs..." >&4
16867 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
16868 eval $hasstruct
16869 case "$d_statfs_s" in
16870 "$define")      echo "Yes, it does."   ;;
16871 *)              echo "No, it doesn't." ;;
16872 esac
16873
16874
16875
16876 : see if struct statfs knows about f_flags
16877 case "$d_statfs_s" in
16878 define) 
16879         echo " "
16880         echo "Checking to see if your struct statfs has f_flags field..." >&4
16881         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
16882         eval $hasfield
16883         ;;
16884 *)      val="$undef"
16885         set d_statfs_f_flags
16886         eval $setvar
16887         ;;
16888 esac
16889 case "$d_statfs_f_flags" in
16890 "$define")      echo "Yes, it does."   ;;
16891 *)              echo "No, it doesn't." ;;
16892 esac
16893
16894 $cat >&4 <<EOM
16895 Checking how to access stdio streams by file descriptor number...
16896 EOM
16897 case "$stdio_stream_array" in
16898 '')     $cat >try.c <<EOCP
16899 #include <stdio.h>
16900 int main() {
16901   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16902     printf("yes\n");
16903 }
16904 EOCP
16905         for s in _iob __iob __sF
16906         do
16907                 set try -DSTDIO_STREAM_ARRAY=$s
16908                 if eval $compile; then
16909                         case "`$run ./try`" in
16910                         yes)    stdio_stream_array=$s; break ;;
16911                         esac
16912                 fi
16913         done
16914         $rm -f try.* try$exe_ext
16915 esac
16916 case "$stdio_stream_array" in
16917 '')     $cat >&4 <<EOM
16918 I can't figure out how to access stdio streams by file descriptor number.
16919 EOM
16920         d_stdio_stream_array="$undef"
16921         ;;
16922 *)      $cat >&4 <<EOM
16923 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16924 EOM
16925         d_stdio_stream_array="$define"
16926         ;;
16927 esac
16928
16929 : see if strcoll exists
16930 set strcoll d_strcoll
16931 eval $inlibc
16932
16933 : check for structure copying
16934 echo " "
16935 echo "Checking to see if your C compiler can copy structs..." >&4
16936 $cat >try.c <<'EOCP'
16937 int main()
16938 {
16939         struct blurfl {
16940                 int dyick;
16941         } foo, bar;
16942
16943         foo = bar;
16944 }
16945 EOCP
16946 if $cc -c try.c >/dev/null 2>&1 ; then
16947         val="$define"
16948         echo "Yup, it can."
16949 else
16950         val="$undef"
16951         echo "Nope, it can't."
16952 fi
16953 set d_strctcpy
16954 eval $setvar
16955 $rm -f try.*
16956
16957 : see if strerror and/or sys_errlist[] exist
16958 echo " "
16959 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16960     if set strerror val -f d_strerror; eval $csym; $val; then
16961                 echo 'strerror() found.' >&4
16962                 d_strerror="$define"
16963                 d_strerrm='strerror(e)'
16964                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16965                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16966                         d_syserrlst="$define"
16967                 else
16968                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16969                         d_syserrlst="$undef"
16970                 fi
16971     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16972                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16973                 echo 'strerror() found in string header.' >&4
16974                 d_strerror="$define"
16975                 d_strerrm='strerror(e)'
16976                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16977                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16978                                 d_syserrlst="$define"
16979                 else
16980                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16981                         d_syserrlst="$undef"
16982                 fi
16983     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16984                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16985                 d_strerror="$undef"
16986                 d_syserrlst="$define"
16987                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16988     else
16989                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16990                 d_strerror="$undef"
16991                 d_syserrlst="$undef"
16992                 d_strerrm='"unknown"'
16993     fi
16994 fi
16995
16996 : see if strerror_r exists
16997 set strerror_r d_strerror_r
16998 eval $inlibc
16999 case "$d_strerror_r" in
17000 "$define")
17001         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17002         case "$d_strerror_r_proto:$usethreads" in
17003         ":define")      d_strerror_r_proto=define
17004                 set d_strerror_r_proto strerror_r $hdrs
17005                 eval $hasproto ;;
17006         *)      ;;
17007         esac
17008         case "$d_strerror_r_proto" in
17009         define)
17010         case "$strerror_r_proto" in
17011         ''|0) try='int strerror_r(int, char*, size_t);'
17012         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17013         esac
17014         case "$strerror_r_proto" in
17015         ''|0) try='int strerror_r(int, char*, int);'
17016         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17017         esac
17018         case "$strerror_r_proto" in
17019         ''|0) try='char* strerror_r(int, char*, size_t);'
17020         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17021         esac
17022         case "$strerror_r_proto" in
17023         ''|0)   d_strerror_r=undef
17024                 strerror_r_proto=0
17025                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17026         * )     case "$strerror_r_proto" in
17027                 REENTRANT_PROTO*) ;;
17028                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17029                 esac
17030                 echo "Prototype: $try" ;;
17031         esac
17032         ;;
17033         *)      case "$usethreads" in
17034                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17035                 esac
17036                 d_strerror_r=undef
17037                 strerror_r_proto=0
17038                 ;;
17039         esac
17040         ;;
17041 *)      strerror_r_proto=0
17042         ;;
17043 esac
17044
17045 : see if strftime exists
17046 set strftime d_strftime
17047 eval $inlibc
17048
17049 : see if strlcat exists
17050 set strlcat d_strlcat
17051 eval $inlibc
17052
17053 : see if strlcpy exists
17054 set strlcpy d_strlcpy
17055 eval $inlibc
17056
17057 : see if strtod exists
17058 set strtod d_strtod
17059 eval $inlibc
17060
17061 : see if strtol exists
17062 set strtol d_strtol
17063 eval $inlibc
17064
17065 : see if strtold exists
17066 set strtold d_strtold
17067 eval $inlibc
17068
17069 : see if strtoll exists
17070 set strtoll d_strtoll
17071 eval $inlibc
17072
17073 case "$d_longlong-$d_strtoll" in
17074 "$define-$define")
17075         $cat <<EOM
17076 Checking whether your strtoll() works okay...
17077 EOM
17078         $cat >try.c <<'EOCP'
17079 #include <errno.h>
17080 #ifdef __hpux
17081 #define strtoll __strtoll
17082 #endif
17083 #ifdef __EMX__
17084 #define strtoll _strtoll
17085 #endif
17086 #include <stdio.h>
17087 extern long long int strtoll(char *s, char **, int); 
17088 static int bad = 0;
17089 int check(char *s, long long ell, int een) {
17090         long long gll;
17091         errno = 0;
17092         gll = strtoll(s, 0, 10);
17093         if (!((gll == ell) && (errno == een)))
17094                 bad++;
17095 }
17096 int main() {
17097         check(" 1",                                      1LL, 0);
17098         check(" 0",                                      0LL, 0);
17099         check("-1",                                     -1LL, 0);
17100         check("-9223372036854775808", -9223372036854775808LL, 0);
17101         check("-9223372036854775808", -9223372036854775808LL, 0);
17102         check(" 9223372036854775807",  9223372036854775807LL, 0);
17103         check("-9223372036854775808", -9223372036854775808LL, 0);
17104         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17105         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17106         if (!bad)
17107                 printf("ok\n");
17108 }
17109 EOCP
17110         set try
17111         if eval $compile; then
17112                 yyy=`$run ./try`
17113                 case "$yyy" in
17114                 ok) echo "Your strtoll() seems to be working okay." ;;
17115                 *) cat <<EOM >&4
17116 Your strtoll() doesn't seem to be working okay.
17117 EOM
17118                    d_strtoll="$undef"
17119                    ;;
17120                 esac
17121         else
17122                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17123                 d_strtoll="$undef"
17124         fi
17125         ;;
17126 esac
17127
17128 : see if strtoq exists
17129 set strtoq d_strtoq
17130 eval $inlibc
17131
17132 : see if strtoul exists
17133 set strtoul d_strtoul
17134 eval $inlibc
17135
17136 case "$d_strtoul" in
17137 "$define")
17138         $cat <<EOM
17139 Checking whether your strtoul() works okay...
17140 EOM
17141         $cat >try.c <<'EOCP'
17142 #include <errno.h>
17143 #include <stdio.h>
17144 extern unsigned long int strtoul(char *s, char **, int); 
17145 static int bad = 0;
17146 void check(char *s, unsigned long eul, int een) {
17147         unsigned long gul;
17148         errno = 0;
17149         gul = strtoul(s, 0, 10);
17150         if (!((gul == eul) && (errno == een)))
17151                 bad++;
17152 }
17153 int main() {
17154         check(" 1", 1L, 0);
17155         check(" 0", 0L, 0);
17156 EOCP
17157         case "$longsize" in
17158         8)
17159             $cat >>try.c <<'EOCP'
17160         check("18446744073709551615", 18446744073709551615UL, 0);
17161         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17162 #if 0 /* strtoul() for /^-/ strings is undefined. */
17163         check("-1", 18446744073709551615UL, 0);
17164         check("-18446744073709551614", 2, 0);
17165         check("-18446744073709551615", 1, 0);
17166         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17167         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17168 #endif
17169 EOCP
17170                 ;;
17171         4)
17172                     $cat >>try.c <<'EOCP'
17173         check("4294967295", 4294967295UL, 0);
17174         check("4294967296", 4294967295UL, ERANGE);
17175 #if 0 /* strtoul() for /^-/ strings is undefined. */
17176         check("-1", 4294967295UL, 0);
17177         check("-4294967294", 2, 0);
17178         check("-4294967295", 1, 0);
17179         check("-4294967296", 4294967295UL, ERANGE);
17180         check("-4294967297", 4294967295UL, ERANGE);
17181 #endif
17182 EOCP
17183                 ;;
17184         *)
17185 : Should we write these tests to be more portable by sprintf-ing
17186 : ~0 and then manipulating that char string as input for strtol?
17187                 ;;
17188         esac
17189         $cat >>try.c <<'EOCP'
17190         if (!bad)
17191                 printf("ok\n");
17192         return 0;
17193 }
17194 EOCP
17195         set try
17196         if eval $compile; then
17197                 case "`$run ./try`" in
17198                 ok) echo "Your strtoul() seems to be working okay." ;;
17199                 *) cat <<EOM >&4
17200 Your strtoul() doesn't seem to be working okay.
17201 EOM
17202                    d_strtoul="$undef"
17203                    ;;
17204                 esac
17205         fi
17206         ;;
17207 esac
17208
17209 : see if strtoull exists
17210 set strtoull d_strtoull
17211 eval $inlibc
17212
17213 case "$d_longlong-$d_strtoull" in
17214 "$define-$define")
17215         $cat <<EOM
17216 Checking whether your strtoull() works okay...
17217 EOM
17218         $cat >try.c <<'EOCP'
17219 #include <errno.h>
17220 #ifdef __hpux
17221 #define strtoull __strtoull
17222 #endif
17223 #include <stdio.h>
17224 extern unsigned long long int strtoull(char *s, char **, int); 
17225 static int bad = 0;
17226 int check(char *s, long long eull, int een) {
17227         long long gull;
17228         errno = 0;
17229         gull = strtoull(s, 0, 10);
17230         if (!((gull == eull) && (errno == een)))
17231                 bad++;
17232 }
17233 int main() {
17234         check(" 1",                                        1LL, 0);
17235         check(" 0",                                        0LL, 0);
17236         check("18446744073709551615",  18446744073709551615ULL, 0);
17237         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17238 #if 0 /* strtoull() for /^-/ strings is undefined. */
17239         check("-1",                    18446744073709551615ULL, 0);
17240         check("-18446744073709551614",                     2LL, 0);
17241         check("-18446744073709551615",                     1LL, 0);
17242         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17243         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17244 #endif
17245         if (!bad)
17246                 printf("ok\n");
17247 }
17248 EOCP
17249         set try
17250         if eval $compile; then
17251                 case "`$run ./try`" in
17252                 ok) echo "Your strtoull() seems to be working okay." ;;
17253                 *) cat <<EOM >&4
17254 Your strtoull() doesn't seem to be working okay.
17255 EOM
17256                    d_strtoull="$undef"
17257                    ;;
17258                 esac
17259         fi
17260         ;;
17261 esac
17262
17263 : see if strtouq exists
17264 set strtouq d_strtouq
17265 eval $inlibc
17266
17267 case "$d_strtouq" in
17268 "$define")
17269         $cat <<EOM
17270 Checking whether your strtouq() works okay...
17271 EOM
17272         $cat >try.c <<'EOCP'
17273 #include <errno.h>
17274 #include <stdio.h>
17275 extern unsigned long long int strtouq(char *s, char **, int); 
17276 static int bad = 0;
17277 void check(char *s, unsigned long long eull, int een) {
17278         unsigned long long gull;
17279         errno = 0;
17280         gull = strtouq(s, 0, 10);
17281         if (!((gull == eull) && (errno == een)))
17282                 bad++;
17283 }
17284 int main() {
17285         check(" 1",                                        1LL, 0);
17286         check(" 0",                                        0LL, 0);
17287         check("18446744073709551615",  18446744073709551615ULL, 0);
17288         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17289 #if 0 /* strtouq() for /^-/ strings is undefined. */
17290         check("-1",                    18446744073709551615ULL, 0);
17291         check("-18446744073709551614",                     2LL, 0);
17292         check("-18446744073709551615",                     1LL, 0);
17293         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17294         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17295 #endif
17296         if (!bad)
17297                 printf("ok\n");
17298         return 0;
17299 }
17300 EOCP
17301         set try
17302         if eval $compile; then
17303                 case "`$run ./try`" in
17304                 ok) echo "Your strtouq() seems to be working okay." ;;
17305                 *) cat <<EOM >&4
17306 Your strtouq() doesn't seem to be working okay.
17307 EOM
17308                    d_strtouq="$undef"
17309                    ;;
17310                 esac
17311         fi
17312         ;;
17313 esac
17314
17315 : see if strxfrm exists
17316 set strxfrm d_strxfrm
17317 eval $inlibc
17318
17319 : see if symlink exists
17320 set symlink d_symlink
17321 eval $inlibc
17322
17323 : see if syscall exists
17324 set syscall d_syscall
17325 eval $inlibc
17326
17327 : see if prototype for syscall is available
17328 echo " "
17329 set d_syscallproto syscall $i_unistd unistd.h
17330 eval $hasproto
17331
17332 : see if sysconf exists
17333 set sysconf d_sysconf
17334 eval $inlibc
17335
17336 : see if system exists
17337 set system d_system
17338 eval $inlibc
17339
17340 : see if tcgetpgrp exists
17341 set tcgetpgrp d_tcgetpgrp
17342 eval $inlibc
17343
17344 : see if tcsetpgrp exists
17345 set tcsetpgrp d_tcsetpgrp
17346 eval $inlibc
17347
17348 : see if prototype for telldir is available
17349 echo " "
17350 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17351 eval $hasproto
17352
17353 : see if time exists
17354 echo " "
17355 if test "X$d_time" = X -o X"$timetype" = X; then
17356     if set time val -f d_time; eval $csym; $val; then
17357                 echo 'time() found.' >&4
17358                 val="$define"
17359                 rp="What is the type returned by time() on this system?"
17360                 set time_t timetype long stdio.h sys/types.h
17361                 eval $typedef_ask
17362     else
17363                 echo 'time() not found, hope that will do.' >&4
17364                 val="$undef"
17365                 timetype='int';
17366     fi
17367     set d_time
17368     eval $setvar
17369 fi
17370
17371 : see if this is a sys/times.h system
17372 set sys/times.h i_systimes
17373 eval $inhdr
17374
17375 : see if times exists
17376 echo " "
17377 if set times val -f d_times; eval $csym; $val; then
17378         echo 'times() found.' >&4
17379         d_times="$define"
17380         inc=''
17381         case "$i_systimes" in
17382         "$define") inc='sys/times.h';;
17383         esac
17384         rp="What is the type returned by times() on this system?"
17385         set clock_t clocktype long stdio.h sys/types.h $inc
17386         eval $typedef_ask
17387 else
17388         echo 'times() NOT found, hope that will do.' >&4
17389         d_times="$undef"
17390         clocktype='int'
17391 fi
17392
17393 : see if tmpnam_r exists
17394 set tmpnam_r d_tmpnam_r
17395 eval $inlibc
17396 case "$d_tmpnam_r" in
17397 "$define")
17398         hdrs="$i_systypes sys/types.h define stdio.h "
17399         case "$d_tmpnam_r_proto:$usethreads" in
17400         ":define")      d_tmpnam_r_proto=define
17401                 set d_tmpnam_r_proto tmpnam_r $hdrs
17402                 eval $hasproto ;;
17403         *)      ;;
17404         esac
17405         case "$d_tmpnam_r_proto" in
17406         define)
17407         case "$tmpnam_r_proto" in
17408         ''|0) try='char* tmpnam_r(char*);'
17409         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17410         esac
17411         case "$tmpnam_r_proto" in
17412         ''|0)   d_tmpnam_r=undef
17413                 tmpnam_r_proto=0
17414                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17415         * )     case "$tmpnam_r_proto" in
17416                 REENTRANT_PROTO*) ;;
17417                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17418                 esac
17419                 echo "Prototype: $try" ;;
17420         esac
17421         ;;
17422         *)      case "$usethreads" in
17423                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17424                 esac
17425                 d_tmpnam_r=undef
17426                 tmpnam_r_proto=0
17427                 ;;
17428         esac
17429         ;;
17430 *)      tmpnam_r_proto=0
17431         ;;
17432 esac
17433
17434 : see if truncate exists
17435 set truncate d_truncate
17436 eval $inlibc
17437
17438 : see if ttyname_r exists
17439 set ttyname_r d_ttyname_r
17440 eval $inlibc
17441 case "$d_ttyname_r" in
17442 "$define")
17443         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17444         case "$d_ttyname_r_proto:$usethreads" in
17445         ":define")      d_ttyname_r_proto=define
17446                 set d_ttyname_r_proto ttyname_r $hdrs
17447                 eval $hasproto ;;
17448         *)      ;;
17449         esac
17450         case "$d_ttyname_r_proto" in
17451         define)
17452         case "$ttyname_r_proto" in
17453         ''|0) try='int ttyname_r(int, char*, size_t);'
17454         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17455         esac
17456         case "$ttyname_r_proto" in
17457         ''|0) try='int ttyname_r(int, char*, int);'
17458         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17459         esac
17460         case "$ttyname_r_proto" in
17461         ''|0) try='char* ttyname_r(int, char*, int);'
17462         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17463         esac
17464         case "$ttyname_r_proto" in
17465         ''|0)   d_ttyname_r=undef
17466                 ttyname_r_proto=0
17467                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17468         * )     case "$ttyname_r_proto" in
17469                 REENTRANT_PROTO*) ;;
17470                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17471                 esac
17472                 echo "Prototype: $try" ;;
17473         esac
17474         ;;
17475         *)      case "$usethreads" in
17476                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17477                 esac
17478                 d_ttyname_r=undef
17479                 ttyname_r_proto=0
17480                 ;;
17481         esac
17482         ;;
17483 *)      ttyname_r_proto=0
17484         ;;
17485 esac
17486
17487 : see if tzname[] exists
17488 echo " "
17489 if set tzname val -a d_tzname; eval $csym; $val; then
17490         val="$define"
17491         echo 'tzname[] found.' >&4
17492 else
17493         val="$undef"
17494         echo 'tzname[] NOT found.' >&4
17495 fi
17496 set d_tzname
17497 eval $setvar
17498
17499 case "$osname" in
17500 next|rhapsody|darwin) multiarch="$define" ;;
17501 esac
17502 case "$multiarch" in
17503 ''|[nN]*) multiarch="$undef" ;;
17504 esac
17505
17506 : check for ordering of bytes in a UV
17507 echo " "
17508 case "$usecrosscompile$multiarch" in
17509 *$define*)
17510         $cat <<EOM
17511 You seem to be either cross-compiling or doing a multiarchitecture build,
17512 skipping the byteorder check.
17513
17514 EOM
17515         byteorder='ffff'
17516         ;;
17517 *)
17518         case "$byteorder" in
17519         '')
17520                 $cat <<'EOM'
17521 In the following, larger digits indicate more significance.  A big-endian
17522 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17523 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17524 machines may have weird orders like 3412.  A Cray will report 87654321,
17525 an Alpha will report 12345678. If the test program works the default is
17526 probably right.
17527 I'm now running the test program...
17528 EOM
17529                 $cat >try.c <<EOCP
17530 #include <stdio.h>
17531 #$i_stdlib I_STDLIB
17532 #ifdef I_STDLIB
17533 #include <stdlib.h>
17534 #endif
17535 #include <sys/types.h>
17536 typedef $uvtype UV;
17537 int main()
17538 {
17539         int i;
17540         union {
17541                 UV l;
17542                 char c[$uvsize];
17543         } u;
17544
17545         if ($uvsize > 4)
17546                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17547         else
17548                 u.l = (UV)0x04030201;
17549         for (i = 0; i < $uvsize; i++)
17550                 printf("%c", u.c[i]+'0');
17551         printf("\n");
17552         exit(0);
17553 }
17554 EOCP
17555                 xxx_prompt=y
17556                 set try
17557                 if eval $compile && ./try > /dev/null; then
17558                         dflt=`$run ./try`
17559                         case "$dflt" in
17560                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17561                                 echo "(The test program ran ok.)"
17562                                 echo "byteorder=$dflt"
17563                                 xxx_prompt=n
17564                         ;;
17565                         ????|????????) echo "(The test program ran ok.)" ;;
17566                         *) echo "(The test program didn't run right for some reason.)" ;;
17567                         esac
17568                 else
17569                         dflt='4321'
17570                         cat <<'EOM'
17571 (I can't seem to compile the test program.  Guessing big-endian...)
17572 EOM
17573                 fi
17574                 case "$xxx_prompt" in
17575                 y)
17576                         rp="What is the order of bytes in $uvtype?"
17577                         . ./myread
17578                         byteorder="$ans"
17579                         ;;
17580                 *)      byteorder=$dflt
17581                         ;;
17582                 esac
17583                 ;;
17584         esac
17585         $rm -f try.c try
17586         ;;
17587 esac
17588
17589
17590 $cat <<EOM
17591
17592 Checking to see whether you can access character data unalignedly...
17593 EOM
17594 case "$d_u32align" in
17595 '')   $cat >try.c <<EOCP
17596 #include <stdio.h>
17597 #$i_stdlib I_STDLIB
17598 #ifdef I_STDLIB
17599 #include <stdlib.h>
17600 #endif
17601 #define U32 $u32type
17602 #define BYTEORDER 0x$byteorder
17603 #define U8 $u8type
17604 #include <signal.h>
17605 #ifdef SIGBUS
17606 $signal_t bletch(s) int s; { exit(4); }
17607 #endif
17608 int main() {
17609 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17610     U8 buf[8];
17611     U32 *up;
17612     int i;
17613
17614     if (sizeof(U32) != 4) {
17615         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17616         exit(1);
17617     }
17618
17619     fflush(stdout);
17620
17621 #ifdef SIGBUS
17622     signal(SIGBUS, bletch);
17623 #endif
17624
17625     buf[0] = 0;
17626     buf[1] = 0;
17627     buf[2] = 0;
17628     buf[3] = 1;
17629     buf[4] = 0;
17630     buf[5] = 0;
17631     buf[6] = 0;
17632     buf[7] = 1;
17633
17634     for (i = 0; i < 4; i++) {
17635         up = (U32*)(buf + i);
17636         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17637                (*up == 1 << (8*(3-i)))  /* little-endian */
17638               )
17639            )
17640         {
17641             printf("read failed (%x)\n", *up);
17642             exit(2);
17643         }
17644     }
17645
17646     /* write test */
17647     for (i = 0; i < 4; i++) {
17648         up = (U32*)(buf + i);
17649         *up = 0xBeef;
17650         if (*up != 0xBeef) {
17651             printf("write failed (%x)\n", *up);
17652             exit(3);
17653         }
17654     }
17655
17656     exit(0);
17657 #else
17658     printf("1\n");
17659     exit(1);
17660 #endif
17661     return 0;
17662 }
17663 EOCP
17664 set try
17665 if eval $compile_ok; then
17666         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17667         $run ./try 2>&1 >/dev/null
17668         case "$?" in
17669         0)      cat >&4 <<EOM
17670 You can access character data pretty unalignedly.
17671 EOM
17672                 d_u32align="$undef"
17673                 ;;
17674         *)      cat >&4 <<EOM
17675 It seems that you must access character data in an aligned manner.
17676 EOM
17677                 d_u32align="$define"
17678                 ;;
17679         esac
17680 else
17681         rp='Can you access character data at unaligned addresses?'
17682         dflt='n'
17683         . ./myread
17684         case "$ans" in
17685         [yY]*)  d_u32align="$undef"  ;;
17686         *)      d_u32align="$define" ;;
17687         esac
17688 fi
17689 $rm -f core core.try.* try.core
17690 ;;
17691 esac
17692
17693 : see if ualarm exists
17694 set ualarm d_ualarm
17695 eval $inlibc
17696
17697 : see if umask exists
17698 set umask d_umask
17699 eval $inlibc
17700
17701 : see if unordered exists
17702 set unordered d_unordered
17703 eval $inlibc
17704
17705 : see if unsetenv exists
17706 set unsetenv d_unsetenv
17707 eval $inlibc
17708
17709 : see if usleep exists
17710 set usleep d_usleep
17711 eval $inlibc
17712
17713 : see if prototype for usleep is available
17714 echo " "
17715 set d_usleepproto usleep $i_unistd unistd.h
17716 eval $hasproto
17717
17718 : see if ustat exists
17719 set ustat d_ustat
17720 eval $inlibc
17721
17722 : backward compatibility for d_hvfork
17723 if test X$d_hvfork != X; then
17724         d_vfork="$d_hvfork"
17725         d_hvfork=''
17726 fi
17727 : see if there is a vfork
17728 val=''
17729 set vfork val
17730 eval $inlibc
17731
17732 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17733 : perl on Solaris 2.x, and probably elsewhere.
17734 case "$val" in
17735 $define)
17736         echo " "
17737         case "$usevfork" in
17738         false) dflt='n';;
17739         *) dflt='y';;
17740         esac
17741         cat <<'EOM'
17742  
17743 Perl can only use a vfork() that doesn't suffer from strict
17744 restrictions on calling functions or modifying global data in
17745 the child.  For example, glibc-2.1 contains such a vfork()
17746 that is unsuitable.  If your system provides a proper fork()
17747 call, chances are that you do NOT want perl to use vfork().
17748
17749 EOM
17750         rp="Do you still want to use vfork()?"
17751         . ./myread
17752         case "$ans" in
17753         y|Y) ;;
17754         *)
17755                 echo "Ok, we won't use vfork()."
17756                 val="$undef"
17757                 ;;
17758         esac
17759         ;;
17760 esac
17761 set d_vfork
17762 eval $setvar
17763 case "$d_vfork" in
17764 $define) usevfork='true';;
17765 *) usevfork='false';;
17766 esac
17767
17768 : see if closedir exists
17769 set closedir d_closedir
17770 eval $inlibc
17771
17772 case "$d_closedir" in
17773 "$define")
17774         echo " "
17775         echo "Checking whether closedir() returns a status..." >&4
17776         cat > try.c <<EOM
17777 #$i_dirent I_DIRENT             /**/
17778 #$i_sysdir I_SYS_DIR            /**/
17779 #$i_sysndir I_SYS_NDIR          /**/
17780 #$i_systypes I_SYS_TYPES        /**/
17781
17782 #if defined(I_SYS_TYPES)
17783 #include <sys/types.h>
17784 #endif
17785 #if defined(I_DIRENT)
17786 #include <dirent.h>
17787 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17788 #include <sys/dir.h>
17789 #endif
17790 #else
17791 #ifdef I_SYS_NDIR
17792 #include <sys/ndir.h>
17793 #else
17794 #ifdef I_SYS_DIR
17795 #ifdef hp9000s500
17796 #include <ndir.h>       /* may be wrong in the future */
17797 #else
17798 #include <sys/dir.h>
17799 #endif
17800 #endif
17801 #endif
17802 #endif 
17803 int main() { return closedir(opendir(".")); }
17804 EOM
17805         set try
17806         if eval $compile_ok; then
17807                 if $run ./try > /dev/null 2>&1 ; then
17808                         echo "Yes, it does."
17809                         val="$undef"
17810                 else
17811                         echo "No, it doesn't."
17812                         val="$define"
17813                 fi
17814         else
17815                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17816                 val="$define"
17817         fi
17818         ;;
17819 *)
17820         val="$undef";
17821         ;;
17822 esac
17823 set d_void_closedir
17824 eval $setvar
17825 $rm -f try try.*
17826 : see if there is a wait4
17827 set wait4 d_wait4
17828 eval $inlibc
17829
17830 : see if waitpid exists
17831 set waitpid d_waitpid
17832 eval $inlibc
17833
17834 : see if wcstombs exists
17835 set wcstombs d_wcstombs
17836 eval $inlibc
17837
17838 : see if wctomb exists
17839 set wctomb d_wctomb
17840 eval $inlibc
17841
17842 : see if writev exists
17843 set writev d_writev
17844 eval $inlibc
17845
17846 : preserve RCS keywords in files with variable substitution, grrr
17847 Date='$Date'
17848 Id='$Id'
17849 Log='$Log'
17850 RCSfile='$RCSfile'
17851 Revision='$Revision'
17852
17853 : check for alignment requirements
17854 echo " "
17855 case "$usecrosscompile$multiarch" in
17856 *$define*)
17857         $cat <<EOM
17858 You seem to be either cross-compiling or doing a multiarchitecture build,
17859 skipping the memory alignment check.
17860
17861 EOM
17862         case "$alignbytes" in
17863         '') alignbytes=8 ;;
17864         esac
17865         ;;
17866 *)
17867         case "$alignbytes" in
17868         '') echo "Checking alignment constraints..." >&4
17869                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17870                         $cat >try.c <<'EOCP'
17871 typedef long double NV;
17872 EOCP
17873                 else
17874                         $cat >try.c <<'EOCP'
17875 typedef double NV;
17876 EOCP
17877                 fi
17878                 $cat >>try.c <<'EOCP'
17879 #include <stdio.h>
17880 struct foobar {
17881         char foo;
17882         NV bar;
17883 } try_algn;
17884 int main()
17885 {
17886     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17887     return(0);
17888 }
17889 EOCP
17890                 set try
17891                 if eval $compile_ok; then
17892                         dflt=`$run ./try`
17893                 else
17894                         dflt='8'
17895                         echo "(I can't seem to compile the test program...)"
17896                 fi
17897                 ;;
17898         *) dflt="$alignbytes"
17899                 ;;
17900         esac
17901         rp="Doubles must be aligned on a how-many-byte boundary?"
17902         . ./myread
17903         alignbytes="$ans"
17904         $rm -f try.c try
17905         ;;
17906 esac
17907
17908
17909 : set the base revision
17910 baserev=5.0
17911
17912 : how do we concatenate cpp tokens here?
17913 echo " "
17914 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17915 $cat >cpp_stuff.c <<'EOCP'
17916 #define RCAT(a,b)a/**/b
17917 #define ACAT(a,b)a ## b
17918 RCAT(Rei,ser)
17919 ACAT(Cir,cus)
17920 EOCP
17921 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17922 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17923         echo "Oh!  Smells like ANSI's been here." >&4
17924         echo "We can catify or stringify, separately or together!"
17925         cpp_stuff=42
17926 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17927         echo "Ah, yes!  The good old days!" >&4
17928         echo "However, in the good old days we don't know how to stringify and"
17929         echo "catify at the same time."
17930         cpp_stuff=1
17931 else
17932         $cat >&4 <<EOM
17933 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17934 You're going to have to edit the values of CAT[2-5] in config.h...
17935 EOM
17936         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17937 fi
17938 $rm -f cpp_stuff.*
17939
17940 : see if this is a db.h system
17941 set db.h i_db
17942 eval $inhdr
17943
17944 case "$i_db" in
17945 $define)
17946         : Check db version.
17947         echo " "
17948         echo "Checking Berkeley DB version ..." >&4
17949         $cat >try.c <<EOCP
17950 #$d_const HASCONST
17951 #ifndef HASCONST
17952 #define const
17953 #endif
17954 #include <sys/types.h>
17955 #include <stdio.h>
17956 #$i_stdlib I_STDLIB
17957 #ifdef I_STDLIB
17958 #include <stdlib.h>
17959 #endif
17960 #include <db.h>
17961 int main(int argc, char *argv[])
17962 {
17963 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17964     int Major, Minor, Patch ;
17965     unsigned long Version ;
17966     (void)db_version(&Major, &Minor, &Patch) ;
17967     if (argc == 2) {
17968         printf("%d %d %d %d %d %d\n",
17969                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17970                Major, Minor, Patch);
17971         exit(0);
17972     }
17973     printf("You have Berkeley DB Version 2 or greater.\n");
17974
17975     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17976                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17977     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17978                 Major, Minor, Patch) ;
17979
17980     /* check that db.h & libdb are compatible */
17981     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17982         printf("db.h and libdb are incompatible.\n") ;
17983         exit(3);        
17984     }
17985
17986     printf("db.h and libdb are compatible.\n") ;
17987
17988     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17989                 + DB_VERSION_PATCH ;
17990
17991     /* needs to be >= 2.3.4 */
17992     if (Version < 2003004) {
17993     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17994         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17995         exit(2);        
17996     }
17997
17998     exit(0);
17999 #else
18000 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18001     if (argc == 2) {
18002         printf("1 0 0\n");
18003         exit(0);
18004     }
18005     printf("You have Berkeley DB Version 1.\n");
18006     exit(0);    /* DB version < 2: the coast is clear. */
18007 #else
18008     exit(1);    /* <db.h> not Berkeley DB? */
18009 #endif
18010 #endif
18011 }
18012 EOCP
18013         set try
18014         if eval $compile_ok && $run ./try; then
18015                 echo 'Looks OK.' >&4
18016                 set `$run ./try 1`
18017                 db_version_major=$1
18018                 db_version_minor=$2
18019                 db_version_patch=$3
18020         else
18021                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18022                 i_db=$undef
18023                 case " $libs " in
18024                 *"-ldb "*)
18025                         : Remove db from list of libraries to use
18026                         echo "Removing unusable -ldb from library list" >&4
18027                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18028                         shift
18029                         libs="$*"
18030                         echo "libs = $libs" >&4
18031                         ;;
18032                 esac
18033         fi
18034         $rm -f try.*
18035         ;;
18036 esac
18037
18038 case "$i_db" in
18039 define)
18040         : Check the return type needed for hash 
18041         echo " "
18042         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18043         $cat >try.c <<EOCP
18044 #$d_const HASCONST
18045 #ifndef HASCONST
18046 #define const
18047 #endif
18048 #include <sys/types.h>
18049 #include <db.h>
18050
18051 #ifndef DB_VERSION_MAJOR
18052 u_int32_t hash_cb (ptr, size)
18053 const void *ptr;
18054 size_t size;
18055 {
18056 }
18057 HASHINFO info;
18058 int main()
18059 {
18060         info.hash = hash_cb;
18061 }
18062 #endif
18063 EOCP
18064         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18065                 if $contains warning try.out >>/dev/null 2>&1 ; then
18066                         db_hashtype='int'
18067                 else
18068                         db_hashtype='u_int32_t'
18069                 fi
18070         else
18071                 : XXX Maybe we should just give up here.
18072                 db_hashtype=u_int32_t
18073                 $cat try.out >&4
18074                 echo "Help:  I can't seem to compile the db test program." >&4
18075                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18076         fi
18077         $rm -f try.*
18078         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18079         ;;
18080 *)      db_hashtype=u_int32_t
18081         ;;
18082 esac
18083 case "$i_db" in
18084 define)
18085         : Check the return type needed for prefix 
18086         echo " "
18087         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18088         cat >try.c <<EOCP
18089 #$d_const HASCONST
18090 #ifndef HASCONST
18091 #define const
18092 #endif
18093 #include <sys/types.h>
18094 #include <db.h>
18095
18096 #ifndef DB_VERSION_MAJOR
18097 size_t prefix_cb (key1, key2)
18098 const DBT *key1;
18099 const DBT *key2;
18100 {
18101 }
18102 BTREEINFO info;
18103 int main()
18104 {
18105         info.prefix = prefix_cb;
18106 }
18107 #endif
18108 EOCP
18109         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18110                 if $contains warning try.out >>/dev/null 2>&1 ; then
18111                         db_prefixtype='int'
18112                 else
18113                         db_prefixtype='size_t'
18114                 fi
18115         else
18116                 db_prefixtype='size_t'
18117                 : XXX Maybe we should just give up here.
18118                 $cat try.out >&4
18119                 echo "Help:  I can't seem to compile the db test program." >&4
18120                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18121         fi
18122         $rm -f try.*
18123         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18124         ;;
18125 *)      db_prefixtype='size_t'
18126         ;;
18127 esac
18128
18129
18130 : How can we generate normalized random numbers ?
18131 echo " "
18132 echo "Looking for a random number function..." >&4
18133 case "$randfunc" in
18134 '')
18135         if set drand48 val -f; eval $csym; $val; then
18136                 dflt="drand48"
18137                 echo "Good, found drand48()." >&4
18138         elif set random val -f; eval $csym; $val; then
18139                 dflt="random"
18140                 echo "OK, found random()." >&4
18141         else
18142                 dflt="rand"
18143                 echo "Yick, looks like I have to use rand()." >&4
18144         fi
18145         echo " "
18146         ;;
18147 *)
18148         dflt="$randfunc"
18149         ;;
18150 esac
18151 cont=true
18152
18153 case "$ccflags" in
18154 *-Dmy_rand=*|*-Dmy_srand=*)
18155         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18156         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18157         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18158         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18159         ;;
18160 esac
18161
18162 while $test "$cont"; do
18163         rp="Use which function to generate random numbers?"
18164         . ./myread
18165         if $test "$ans" = "$dflt"; then
18166                 : null
18167         else
18168                 randbits=''
18169         fi
18170         randfunc="$ans"
18171         if set $ans val -f; eval $csym; $val; then
18172                 cont=''
18173         else
18174                 dflt=y
18175                 rp="I cannot find function $ans. Use that name anyway?"
18176                 . ./myread
18177                 dflt=rand
18178                 case "$ans" in
18179                         [yY]*) cont='';;
18180                 esac
18181         fi
18182         case "$cont" in
18183         '')
18184                 case "$randfunc" in
18185                 drand48)
18186                         drand01="drand48()"
18187                         seedfunc="srand48"
18188                         randbits=48
18189                         randseedtype=long
18190                         ;;
18191                 rand|random)
18192                         case "$randbits" in
18193                         '')
18194 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18195                                 $cat >try.c <<EOCP
18196 #$i_unistd I_UNISTD
18197 #$i_stdlib I_STDLIB
18198 #include <stdio.h>
18199 #ifdef I_UNISTD
18200 #  include <unistd.h>
18201 #endif
18202 #ifdef I_STDLIB
18203 #  include <stdlib.h>
18204 #endif
18205 int main()
18206 {
18207         register int i;
18208         register unsigned long tmp;
18209         register unsigned long max = 0L;
18210
18211         for (i = 1000; i; i--) {
18212                 tmp = (unsigned long) $randfunc();
18213                 if (tmp > max) max = tmp;
18214         }
18215         for (i = 0; max; i++)
18216                 max /= 2;
18217         printf("%d\n",i);
18218 }
18219 EOCP
18220                                 set try
18221                                 if eval $compile_ok; then
18222                                         dflt=`try`
18223                                 else
18224                                         dflt='?'
18225                                         echo "(I can't seem to compile the test program...)"
18226                                 fi
18227                                 ;;
18228                         *)
18229                                 dflt="$randbits"
18230                                 ;;
18231                         esac
18232                         rp="How many bits does your $randfunc() function produce?"
18233                         . ./myread
18234                         randbits="$ans"
18235                         $rm -f try.c try
18236                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18237                         seedfunc="s$randfunc"
18238                         randseedtype=unsigned
18239                         ;;
18240                 *)
18241                         dflt="31"
18242                         rp="How many bits does your $randfunc() function produce?"
18243                         . ./myread
18244                         randbits="$ans"
18245                         seedfunc="s$randfunc"
18246                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18247                         if set $seedfunc val -f; eval $csym; $val; then
18248                                 echo "(Using $seedfunc() to seed random generator)"
18249                         else
18250                                 echo "(Warning: no $seedfunc() to seed random generator)"
18251                                 seedfunc=rand
18252                         fi
18253                         randseedtype=unsigned
18254                         ;;
18255                 esac
18256                 ;;
18257         esac
18258 done
18259
18260 echo " "
18261 echo "Determining whether or not we are on an EBCDIC system..." >&4
18262 $cat >try.c <<'EOM'
18263 int main()
18264 {
18265   if ('M'==0xd4) return 0;
18266   return 1;
18267 }
18268 EOM
18269
18270 val=$undef
18271 set try
18272 if eval $compile_ok; then
18273         if $run ./try; then
18274                 echo "You seem to speak EBCDIC." >&4
18275                 val="$define"
18276         else
18277                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18278         fi
18279 else
18280         echo "I'm unable to compile the test program." >&4
18281         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18282 fi
18283 $rm -f try try.*
18284 set ebcdic
18285 eval $setvar
18286
18287 echo " "
18288 $cat >&4 <<EOM
18289 Checking how to flush all pending stdio output...
18290 EOM
18291 # I only know how to find the first 32 possibly open files on SunOS.
18292 # See also hints/sunos_4_1.sh and util.c  --AD
18293 case "$osname" in
18294 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18295 esac
18296 $cat >>try.c <<EOCP
18297 #include <stdio.h>
18298 #$i_stdlib I_STDLIB
18299 #ifdef I_STDLIB
18300 #include <stdlib.h>
18301 #endif
18302 #$i_unistd I_UNISTD
18303 #ifdef I_UNISTD
18304 # include <unistd.h>
18305 #endif
18306 #$d_sysconf HAS_SYSCONF
18307 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18308 #ifdef HAS_STDIO_STREAM_ARRAY
18309 # define STDIO_STREAM_ARRAY $stdio_stream_array
18310 #endif
18311 int main() {
18312   FILE* p;
18313   unlink("try.out");
18314   p = fopen("try.out", "w");
18315 #ifdef TRY_FPUTC
18316   fputc('x', p);
18317 #else
18318 # ifdef TRY_FPRINTF
18319   fprintf(p, "x");
18320 # endif
18321 #endif
18322 #ifdef TRY_FFLUSH_NULL
18323   fflush(NULL);
18324 #endif
18325 #ifdef TRY_FFLUSH_ALL
18326   {
18327     long open_max = -1;
18328 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18329     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18330 # else
18331 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18332     open_max = sysconf(_SC_OPEN_MAX);
18333 #  else
18334 #   ifdef FOPEN_MAX
18335     open_max = FOPEN_MAX;
18336 #   else
18337 #    ifdef OPEN_MAX
18338     open_max = OPEN_MAX;
18339 #    else
18340 #     ifdef _NFILE
18341     open_max = _NFILE;
18342 #     endif
18343 #    endif
18344 #   endif
18345 #  endif
18346 # endif 
18347 # ifdef HAS_STDIO_STREAM_ARRAY
18348     if (open_max > 0) {
18349       long i;
18350       for (i = 0; i < open_max; i++)
18351             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18352                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18353                 STDIO_STREAM_ARRAY[i]._flag)
18354                 fflush(&STDIO_STREAM_ARRAY[i]);
18355     }   
18356   }
18357 # endif
18358 #endif
18359   _exit(42);
18360 }
18361 EOCP
18362 : first we have to find out how _not_ to flush
18363 $to try.c
18364 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18365     output=''
18366     set try -DTRY_FPUTC
18367     if eval $compile; then
18368             $run ./try 2>/dev/null
18369             code="$?"
18370             $from try.out
18371             if $test ! -s try.out -a "X$code" = X42; then
18372                 output=-DTRY_FPUTC
18373             fi
18374     fi
18375     case "$output" in
18376     '')
18377             set try -DTRY_FPRINTF
18378             if eval $compile; then
18379                     $run ./try 2>/dev/null
18380                     code="$?"
18381                     $from try.out
18382                     if $test ! -s try.out -a "X$code" = X42; then
18383                         output=-DTRY_FPRINTF
18384                     fi
18385             fi
18386         ;;
18387     esac
18388 fi
18389 : check for fflush NULL behaviour
18390 case "$fflushNULL" in
18391 '')     set try -DTRY_FFLUSH_NULL $output
18392         if eval $compile; then
18393                 $run ./try 2>/dev/null
18394                 code="$?"
18395                 $from try.out
18396                 if $test -s try.out -a "X$code" = X42; then
18397                         fflushNULL="`$cat try.out`"
18398                 else
18399                         if $test "X$code" != X42; then
18400                                 $cat >&4 <<EOM
18401 (If this test failed, don't worry, we'll try another method shortly.)
18402 EOM
18403                         fi
18404                 fi
18405         fi
18406         $rm -f core try.core core.try.*
18407         case "$fflushNULL" in
18408         x)      $cat >&4 <<EOM
18409 Your fflush(NULL) works okay for output streams.
18410 Let's see if it clobbers input pipes...
18411 EOM
18412 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18413 # bug that improperly flushes the input end of pipes.  So we avoid the
18414 # autoflush on fork/system/exec support for now. :-(
18415 $cat >tryp.c <<EOCP
18416 #include <stdio.h>
18417 int
18418 main(int argc, char **argv)
18419 {
18420     char buf[1024];
18421     int i;
18422     char *bp = buf;
18423     while (1) {
18424         while ((i = getc(stdin)) != -1
18425                && (*bp++ = i) != '\n'
18426                && bp < &buf[1024])
18427         /* DO NOTHING */ ;
18428         *bp = '\0';
18429         fprintf(stdout, "%s", buf);
18430         fflush(NULL);
18431         if (i == -1)
18432             return 0;
18433         bp = buf;
18434     }
18435 }
18436 EOCP
18437                 fflushNULL="$define"
18438                 set tryp
18439                 if eval $compile; then
18440                     $rm -f tryp.out
18441                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18442                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18443                        $cat >&4 <<EOM
18444 fflush(NULL) seems to behave okay with input streams.
18445 EOM
18446                         fflushNULL="$define"
18447                     else
18448                         $cat >&4 <<EOM
18449 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18450 EOM
18451                         fflushNULL="$undef"
18452                     fi
18453                 fi
18454                 $rm -f core tryp.c tryp.core core.tryp.*
18455                 ;;
18456         '')     $cat >&4 <<EOM
18457 Your fflush(NULL) isn't working (contrary to ANSI C).
18458 EOM
18459                 fflushNULL="$undef"
18460                 ;;
18461         *)      $cat >&4 <<EOM
18462 Cannot figure out whether your fflush(NULL) works or not.
18463 I'm assuming it doesn't (contrary to ANSI C).
18464 EOM
18465                 fflushNULL="$undef"
18466                 ;;
18467         esac
18468         ;;
18469 $define|true|[yY]*)
18470         fflushNULL="$define"
18471         ;;
18472 *)
18473         fflushNULL="$undef"
18474         ;;
18475 esac
18476 : check explicit looping only if NULL did not work, and if the pipe
18477 : bug does not show up on an explicit flush too
18478 case "$fflushNULL" in
18479 "$undef")
18480         $cat >tryp.c <<EOCP
18481 #include <stdio.h>
18482 int
18483 main(int argc, char **argv)
18484 {
18485     char buf[1024];
18486     int i;
18487     char *bp = buf;
18488     while (1) {
18489         while ((i = getc(stdin)) != -1
18490                && (*bp++ = i) != '\n'
18491                && bp < &buf[1024])
18492         /* DO NOTHING */ ;
18493         *bp = '\0';
18494         fprintf(stdout, "%s", buf);
18495         fflush(stdin);
18496         if (i == -1)
18497             return 0;
18498         bp = buf;
18499     }
18500 }
18501 EOCP
18502         set tryp
18503         if eval $compile; then
18504             $rm -f tryp.out
18505             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18506             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18507                $cat >&4 <<EOM
18508 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18509 EOM
18510                 : now check for fflushall behaviour
18511                 case "$fflushall" in
18512                 '')     set try -DTRY_FFLUSH_ALL $output
18513                         if eval $compile; then
18514                                 $cat >&4 <<EOM
18515 (Now testing the other method--but note that this also may fail.)
18516 EOM
18517                                 $run ./try 2>/dev/null
18518                                 code=$?
18519                                 $from try.out
18520                                 if $test -s try.out -a "X$code" = X42; then
18521                                         fflushall="`$cat try.out`"
18522                                 fi
18523                         fi
18524                         $rm -f core try.core core.try.*
18525                         case "$fflushall" in
18526                         x)      $cat >&4 <<EOM
18527 Whew. Flushing explicitly all the stdio streams works.
18528 EOM
18529                                 fflushall="$define"
18530                                 ;;
18531                         '')     $cat >&4 <<EOM
18532 Sigh. Flushing explicitly all the stdio streams doesn't work.
18533 EOM
18534                                 fflushall="$undef"
18535                                 ;;
18536                         *)      $cat >&4 <<EOM
18537 Cannot figure out whether flushing stdio streams explicitly works or not.
18538 I'm assuming it doesn't.
18539 EOM
18540                                 fflushall="$undef"
18541                                 ;;
18542                         esac
18543                         ;;
18544                 "$define"|true|[yY]*)
18545                         fflushall="$define"
18546                         ;;
18547                 *)
18548                         fflushall="$undef"
18549                         ;;
18550                 esac
18551             else
18552                 $cat >&4 <<EOM
18553 All is futile.  Even fflush(stdin) clobbers input pipes!
18554 EOM
18555                 fflushall="$undef"
18556             fi
18557         else
18558             fflushall="$undef"
18559         fi
18560         $rm -f core tryp.c tryp.core core.tryp.*
18561         ;;
18562 *)      fflushall="$undef"
18563         ;;
18564 esac
18565
18566 case "$fflushNULL$fflushall" in
18567 undefundef)
18568         $cat <<EOM
18569 OK, I give up.  I cannot figure out how to flush pending stdio output.
18570 We won't be flushing handles at all before fork/exec/popen.
18571 EOM
18572         ;;
18573 esac
18574 $rm -f try.* try$exe_ext
18575
18576 : Store the full pathname to the ar program for use in the C program
18577 : Respect a hint or command line value for full_ar.
18578 case "$full_ar" in
18579 '') full_ar=$ar ;;
18580 esac
18581
18582 : Store the full pathname to the sed program for use in the C program
18583 full_sed=$sed
18584
18585 : see what type gids are declared as in the kernel
18586 echo " "
18587 echo "Looking for the type for group ids returned by getgid()."
18588 set gid_t gidtype xxx stdio.h sys/types.h
18589 eval $typedef
18590 case "$gidtype" in
18591 xxx)
18592         xxx=`./findhdr sys/user.h`
18593         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18594         case $1 in
18595         unsigned) dflt="$1 $2" ;;
18596         *) dflt="$1" ;;
18597         esac
18598         ;;
18599 *) dflt="$gidtype";;
18600 esac
18601 case "$gidtype" in
18602 gid_t) echo "gid_t found." ;;
18603 *)      rp="What is the type for group ids returned by getgid()?"
18604         . ./myread
18605         gidtype="$ans"
18606         ;;
18607 esac
18608
18609 echo " "
18610 case "$gidtype" in
18611 *_t) zzz="$gidtype"     ;;
18612 *)   zzz="gid"          ;;
18613 esac
18614 echo "Checking the size of $zzz..." >&4 
18615 cat > try.c <<EOCP
18616 #include <sys/types.h>
18617 #include <stdio.h>
18618 #$i_stdlib I_STDLIB
18619 #ifdef I_STDLIB
18620 #include <stdlib.h>
18621 #endif
18622 int main() {
18623     printf("%d\n", (int)sizeof($gidtype));
18624     exit(0);
18625 }
18626 EOCP
18627 set try
18628 if eval $compile_ok; then
18629         yyy=`$run ./try`
18630         case "$yyy" in
18631         '')     gidsize=4
18632                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18633                 ;;
18634         *)      gidsize=$yyy
18635                 echo "Your $zzz is $gidsize bytes long."
18636                 ;;
18637         esac
18638 else
18639         gidsize=4
18640         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18641 fi
18642
18643
18644 echo " "
18645 case "$gidtype" in
18646 *_t) zzz="$gidtype"     ;;
18647 *)   zzz="gid"          ;;
18648 esac
18649 echo "Checking the sign of $zzz..." >&4 
18650 cat > try.c <<EOCP
18651 #include <sys/types.h>
18652 #include <stdio.h>
18653 int main() {
18654         $gidtype foo = -1;
18655         if (foo < 0)
18656                 printf("-1\n");
18657         else
18658                 printf("1\n");
18659 }
18660 EOCP
18661 set try
18662 if eval $compile; then
18663         yyy=`$run ./try`
18664         case "$yyy" in
18665         '')     gidsign=1
18666                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18667                 ;;
18668         *)      gidsign=$yyy
18669                 case "$gidsign" in
18670                  1) echo "Your $zzz is unsigned." ;;
18671                 -1) echo "Your $zzz is signed."   ;;
18672                 esac
18673                 ;;
18674         esac
18675 else
18676         gidsign=1
18677         echo "(I can't compile the test program--guessing unsigned.)" >&4
18678 fi
18679
18680
18681 echo " "
18682
18683 if $test X"$quadtype" != X; then
18684
18685 echo "Checking how to print 64-bit integers..." >&4
18686
18687 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18688         $cat >try.c <<'EOCP'
18689 #include <sys/types.h>
18690 #include <stdio.h>
18691 int main() {
18692   int q = 12345678901;
18693   printf("%ld\n", q);
18694 }
18695 EOCP
18696         set try
18697         if eval $compile; then
18698                 yyy=`$run ./try`
18699                 case "$yyy" in
18700                 12345678901)
18701                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18702                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18703                         echo "We will use %d."
18704                         ;;
18705                 esac
18706         fi
18707 fi
18708
18709 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18710         $cat >try.c <<'EOCP'
18711 #include <sys/types.h>
18712 #include <stdio.h>
18713 int main() {
18714   long q = 12345678901;
18715   printf("%ld\n", q);
18716 }
18717 EOCP
18718         set try
18719         if eval $compile; then
18720                 yyy=`$run ./try`
18721                 case "$yyy" in
18722                 12345678901)
18723                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18724                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18725                         echo "We will use %ld."
18726                         ;;
18727                 esac
18728         fi
18729 fi
18730
18731 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18732         $cat >try.c <<'EOCP'
18733 #include <sys/types.h>
18734 #include <inttypes.h>
18735 #include <stdio.h>
18736 int main() {
18737   int64_t q = 12345678901;
18738   printf("%" PRId64 "\n", q);
18739 }
18740 EOCP
18741         set try
18742         if eval $compile; then
18743                 yyy=`$run ./try`
18744                 case "$yyy" in
18745                 12345678901)
18746                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18747                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18748                         echo "We will use the C9X style."
18749                         ;;
18750                 esac
18751         fi
18752 fi
18753
18754 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18755         $cat >try.c <<EOCP
18756 #include <sys/types.h>
18757 #include <stdio.h>
18758 int main() {
18759   $quadtype q = 12345678901;
18760   printf("%Ld\n", q);
18761 }
18762 EOCP
18763         set try
18764         if eval $compile; then
18765                 yyy=`$run ./try`
18766                 case "$yyy" in
18767                 12345678901)
18768                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18769                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18770                         echo "We will use %Ld."
18771                         ;;
18772                 esac
18773         fi
18774 fi
18775
18776 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18777         $cat >try.c <<'EOCP'
18778 #include <sys/types.h>
18779 #include <stdio.h>
18780 int main() {
18781   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18782   printf("%lld\n", q);
18783 }
18784 EOCP
18785         set try
18786         if eval $compile; then
18787                 yyy=`$run ./try`
18788                 case "$yyy" in
18789                 12345678901)
18790                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18791                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18792                         echo "We will use the %lld style."
18793                         ;;
18794                 esac
18795         fi
18796 fi
18797
18798 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18799         $cat >try.c <<EOCP
18800 #include <sys/types.h>
18801 #include <stdio.h>
18802 int main() {
18803   $quadtype q = 12345678901;
18804   printf("%qd\n", q);
18805 }
18806 EOCP
18807         set try
18808         if eval $compile; then
18809                 yyy=`$run ./try`
18810                 case "$yyy" in
18811                 12345678901)
18812                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18813                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18814                         echo "We will use %qd."
18815                         ;;
18816                 esac
18817         fi
18818 fi
18819
18820 if $test X"$sPRId64" = X; then
18821         echo "Cannot figure out how to print 64-bit integers." >&4
18822 fi
18823
18824 $rm -f try try.*
18825
18826 fi
18827
18828 case "$sPRId64" in
18829 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18830         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18831         ;;
18832 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18833         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18834         ;;
18835 esac
18836
18837
18838 echo " "
18839 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18840
18841 if $test X"$ivsize" = X8; then
18842         ivdformat="$sPRId64"
18843         uvuformat="$sPRIu64"
18844         uvoformat="$sPRIo64"
18845         uvxformat="$sPRIx64"
18846         uvXUformat="$sPRIXU64"
18847 else
18848         if $test X"$ivsize" = X"$longsize"; then
18849                 ivdformat='"ld"'
18850                 uvuformat='"lu"'
18851                 uvoformat='"lo"'
18852                 uvxformat='"lx"'
18853                 uvXUformat='"lX"'
18854         else
18855                 if $test X"$ivsize" = X"$intsize"; then
18856                         ivdformat='"d"'
18857                         uvuformat='"u"'
18858                         uvoformat='"o"'
18859                         uvxformat='"x"'
18860                         uvXUformat='"X"'
18861                 else
18862                         : far out
18863                         if $test X"$ivsize" = X"$shortsize"; then
18864                                 ivdformat='"hd"'
18865                                 uvuformat='"hu"'
18866                                 uvoformat='"ho"'
18867                                 uvxformat='"hx"'
18868                                 uvXUformat='"hX"'
18869                         fi
18870                 fi
18871         fi
18872 fi
18873
18874 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18875         nveformat="$sPRIeldbl"
18876         nvfformat="$sPRIfldbl"
18877         nvgformat="$sPRIgldbl"
18878         nvEUformat="$sPRIEUldbl"
18879         nvFUformat="$sPRIFUldbl"
18880         nvGUformat="$sPRIGUldbl"
18881 else
18882         nveformat='"e"'
18883         nvfformat='"f"'
18884         nvgformat='"g"'
18885         nvEUformat='"E"'
18886         nvFUformat='"F"'
18887         nvGUformat='"G"'
18888 fi
18889
18890 case "$ivdformat" in
18891 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18892     exit 1
18893     ;;
18894 esac
18895
18896
18897 echo " "
18898 $echo "Checking the format string to be used for gids..." >&4
18899
18900 case "$gidsign" in
18901 -1)     if $test X"$gidsize" = X"$ivsize"; then
18902                 gidformat="$ivdformat"
18903         else
18904                 if $test X"$gidsize" = X"$longsize"; then
18905                         gidformat='"ld"'
18906                 else
18907                         if $test X"$gidsize" = X"$intsize"; then
18908                                 gidformat='"d"'
18909                         else
18910                                 if $test X"$gidsize" = X"$shortsize"; then
18911                                         gidformat='"hd"'
18912                                 fi
18913                         fi
18914                 fi
18915         fi
18916         ;;
18917 *)      if $test X"$gidsize" = X"$uvsize"; then
18918                 gidformat="$uvuformat"
18919         else
18920                 if $test X"$gidsize" = X"$longsize"; then
18921                         gidformat='"lu"'
18922                 else
18923                         if $test X"$gidsize" = X"$intsize"; then
18924                                 gidformat='"u"'
18925                         else
18926                                 if $test X"$gidsize" = X"$shortsize"; then
18927                                         gidformat='"hu"'
18928                                 fi
18929                         fi
18930                 fi
18931         fi
18932         ;;
18933 esac
18934
18935 : see if getgroups exists
18936 set getgroups d_getgrps
18937 eval $inlibc
18938
18939 : see if setgroups exists
18940 set setgroups d_setgrps
18941 eval $inlibc
18942
18943
18944 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18945 echo " "
18946 case "$d_getgrps$d_setgrps" in
18947 *define*)
18948         case "$groupstype" in
18949         '') dflt="$gidtype" ;;
18950         *)  dflt="$groupstype" ;;
18951         esac
18952         $cat <<EOM
18953 What type of pointer is the second argument to getgroups() and setgroups()?
18954 Usually this is the same as group ids, $gidtype, but not always.
18955
18956 EOM
18957         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18958         . ./myread
18959         groupstype="$ans"
18960         ;;
18961 *)  groupstype="$gidtype";;
18962 esac
18963
18964 echo " "
18965 echo "Checking if your $make program sets \$(MAKE)..." >&4
18966 case "$make_set_make" in
18967 '')
18968         $sed 's/^X //' > testmake.mak << 'EOF'
18969 Xall:
18970 X       @echo 'maketemp="$(MAKE)"'
18971 EOF
18972         case "`$make -f testmake.mak 2>/dev/null`" in
18973         *maketemp=*) make_set_make='#' ;;
18974         *)      make_set_make="MAKE=$make" ;;
18975         esac
18976         $rm -f testmake.mak
18977         ;;
18978 esac
18979 case "$make_set_make" in
18980 '#') echo "Yup, it does.";;
18981 *) echo "Nope, it doesn't.";;
18982 esac
18983
18984 : see what type is used for mode_t
18985 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18986 set mode_t modetype int stdio.h sys/types.h
18987 eval $typedef_ask
18988
18989 : see if stdarg is available
18990 echo " "
18991 if $test `./findhdr stdarg.h`; then
18992         echo "<stdarg.h> found." >&4
18993         valstd="$define"
18994 else
18995         echo "<stdarg.h> NOT found." >&4
18996         valstd="$undef"
18997 fi
18998
18999 : see if varags is available
19000 echo " "
19001 if $test `./findhdr varargs.h`; then
19002         echo "<varargs.h> found." >&4
19003 else
19004         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
19005 fi
19006
19007 : set up the varargs testing programs
19008 $cat > varargs.c <<EOP
19009 #ifdef I_STDARG
19010 #include <stdarg.h>
19011 #endif
19012 #ifdef I_VARARGS
19013 #include <varargs.h>
19014 #endif
19015
19016 #ifdef I_STDARG
19017 int f(char *p, ...)
19018 #else
19019 int f(va_alist)
19020 va_dcl
19021 #endif
19022 {
19023         va_list ap;
19024 #ifndef I_STDARG
19025         char *p;
19026 #endif
19027 #ifdef I_STDARG
19028         va_start(ap,p);
19029 #else
19030         va_start(ap);
19031         p = va_arg(ap, char *);
19032 #endif
19033         va_end(ap);
19034 }
19035 EOP
19036 $cat > varargs <<EOP
19037 $startsh
19038 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19039         echo "true"
19040 else
19041         echo "false"
19042 fi
19043 $rm -f varargs$_o
19044 EOP
19045 chmod +x varargs
19046
19047 : now check which varargs header should be included
19048 echo " "
19049 i_varhdr=''
19050 case "$valstd" in
19051 "$define")
19052         if `./varargs I_STDARG`; then
19053                 val='stdarg.h'
19054         elif `./varargs I_VARARGS`; then
19055                 val='varargs.h'
19056         fi
19057         ;;
19058 *)
19059         if `./varargs I_VARARGS`; then
19060                 val='varargs.h'
19061         fi
19062         ;;
19063 esac
19064 case "$val" in
19065 '')
19066 echo "I could not find the definition for va_dcl... You have problems..." >&4
19067         val="$undef"; set i_stdarg; eval $setvar
19068         val="$undef"; set i_varargs; eval $setvar
19069         ;;
19070 *) 
19071         set i_varhdr
19072         eval $setvar
19073         case "$i_varhdr" in
19074         stdarg.h)
19075                 val="$define"; set i_stdarg; eval $setvar
19076                 val="$undef"; set i_varargs; eval $setvar
19077                 ;;
19078         varargs.h)
19079                 val="$undef"; set i_stdarg; eval $setvar
19080                 val="$define"; set i_varargs; eval $setvar
19081                 ;;
19082         esac
19083         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19084 esac
19085 $rm -f varargs*
19086
19087 : see if we need va_copy
19088 echo " "
19089 case "$i_stdarg" in
19090 "$define")
19091         $cat >try.c <<EOCP
19092 #include <stdarg.h>
19093 #include <stdio.h>
19094 #$i_stdlib I_STDLIB
19095 #ifdef I_STDLIB
19096 #include <stdlib.h>
19097 #endif
19098 #include <signal.h>
19099
19100 int
19101 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19102 {
19103   return vfprintf(f, fmt, *valp);
19104 }
19105  
19106 int    
19107 myvfprintf(FILE *f, const  char *fmt, va_list val)
19108 {
19109   return ivfprintf(f, fmt, &val);
19110 }
19111       
19112 int
19113 myprintf(char *fmt, ...) 
19114 {
19115   va_list val;
19116   va_start(val, fmt);
19117   return myvfprintf(stdout, fmt, val); 
19118 }         
19119
19120 int
19121 main(int ac, char **av)
19122 {
19123   signal(SIGSEGV, exit);
19124
19125   myprintf("%s%cs all right, then\n", "that", '\'');                            
19126   exit(0);      
19127 }
19128 EOCP
19129         set try
19130         if eval $compile && $run ./try 2>&1 >/dev/null; then
19131                 case "`$run ./try`" in
19132                 "that's all right, then")
19133                         okay=yes
19134                         ;;
19135                 esac
19136         fi
19137         case "$okay" in
19138         yes)    echo "It seems that you don't need va_copy()." >&4
19139                 need_va_copy="$undef"
19140                 ;;
19141         *)      echo "It seems that va_copy() or similar will be needed." >&4
19142                 need_va_copy="$define"
19143                 ;;
19144         esac
19145         $rm -f try.* core core.* *.core *.core.*
19146         ;;
19147 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19148         ;;
19149 esac
19150
19151 : see what type is used for size_t
19152 rp="What is the type used for the length parameter for string functions?"
19153 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19154 eval $typedef_ask
19155
19156 : check for type of arguments to gethostbyaddr. 
19157 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19158         case "$d_gethbyaddr" in
19159         $define)
19160                 $cat <<EOM
19161
19162 Checking to see what type of arguments are accepted by gethostbyaddr().
19163 EOM
19164                 hdrs="$define sys/types.h
19165                         $d_socket sys/socket.h 
19166                         $i_niin netinet/in.h 
19167                         $i_netdb netdb.h
19168                         $i_unistd unistd.h"
19169                 : The first arg can 'char *' or 'void *'
19170                 : The second arg is some of integral type
19171                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19172                         for yyy in size_t long int; do
19173                                 case "$netdb_host_type" in
19174                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19175                                         if ./protochk "$try" $hdrs; then
19176                                                 echo "Your system accepts $xxx for the first arg."
19177                                                 echo "...and $yyy for the second arg."
19178                                                 netdb_host_type="$xxx"
19179                                                 netdb_hlen_type="$yyy"
19180                                         fi
19181                                         ;;
19182                                 esac
19183                         done
19184                 done
19185                 : In case none of those worked, prompt the user.
19186                 case "$netdb_host_type" in
19187                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19188                         dflt='char *'
19189                         . ./myread
19190                         netdb_host_type=$ans
19191                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19192                         dflt="$sizetype"
19193                         . ./myread
19194                         netdb_hlen_type=$ans
19195                         ;;
19196                 esac
19197                 ;;
19198         *)      : no gethostbyaddr, so pick harmless defaults
19199                 netdb_host_type='char *'
19200                 netdb_hlen_type="$sizetype"
19201                 ;;
19202         esac
19203         # Remove the "const" if needed. -- but then we'll have a 
19204         # prototype clash!
19205         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19206 fi
19207
19208 : check for type of argument to gethostbyname. 
19209 if test "X$netdb_name_type" = X ; then
19210         case "$d_gethbyname" in
19211         $define)
19212                 $cat <<EOM
19213
19214 Checking to see what type of argument is accepted by gethostbyname().
19215 EOM
19216                 hdrs="$define sys/types.h
19217                         $d_socket sys/socket.h 
19218                         $i_niin netinet/in.h 
19219                         $i_netdb netdb.h
19220                         $i_unistd unistd.h"
19221                 for xxx in "const char *" "char *"; do
19222                         case "$netdb_name_type" in
19223                         '')     try="extern struct hostent *gethostbyname($xxx);"
19224                                 if ./protochk "$try" $hdrs; then
19225                                         echo "Your system accepts $xxx."
19226                                         netdb_name_type="$xxx"
19227                                 fi
19228                                 ;;
19229                         esac
19230                 done
19231                 : In case none of those worked, prompt the user.
19232                 case "$netdb_name_type" in
19233                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19234                         dflt='char *'
19235                         . ./myread
19236                         netdb_name_type=$ans
19237                         ;;
19238                 esac
19239                 ;;
19240         *)      : no gethostbyname, so pick harmless default
19241                 netdb_name_type='char *'
19242                 ;;
19243         esac
19244 fi
19245
19246 : check for type of 1st argument to getnetbyaddr. 
19247 if test "X$netdb_net_type" = X ; then
19248         case "$d_getnbyaddr" in
19249         $define)
19250                 $cat <<EOM
19251
19252 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19253 EOM
19254                 hdrs="$define sys/types.h
19255                         $d_socket sys/socket.h 
19256                         $i_niin netinet/in.h 
19257                         $i_netdb netdb.h
19258                         $i_unistd unistd.h"
19259                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19260                         case "$netdb_net_type" in
19261                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19262                                 if ./protochk "$try" $hdrs; then
19263                                         echo "Your system accepts $xxx."
19264                                         netdb_net_type="$xxx"
19265                                 fi
19266                                 ;;
19267                         esac
19268                 done
19269                 : In case none of those worked, prompt the user.
19270                 case "$netdb_net_type" in
19271                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19272                         dflt='long'
19273                         . ./myread
19274                         netdb_net_type=$ans
19275                         ;;
19276                 esac
19277                 ;;
19278         *)      : no getnetbyaddr, so pick harmless default
19279                 netdb_net_type='long'
19280                 ;;
19281         esac
19282 fi
19283 : locate the preferred pager for this system
19284 fn=f/
19285 case "$pager" in
19286 '')
19287         dflt=''
19288         case "$pg" in
19289         /*) dflt=$pg;;
19290         [a-zA-Z]:/*) dflt=$pg;;
19291         esac
19292         case "$more" in
19293         /*) dflt=$more;;
19294         [a-zA-Z]:/*) dflt=$more;;
19295         esac
19296         case "$less" in
19297         /*) dflt=$less;;
19298         [a-zA-Z]:/*) dflt=$less;;
19299         esac
19300         case "$dflt" in
19301         '') dflt=/usr/ucb/more;;
19302         esac
19303         ;;
19304 *)      dflt="$pager"
19305         : Instruct ./getfile to trust the hinted or previous pager value,
19306         : even if it does not begin with a slash.  For example, on os2,
19307         : pager might be cmd /c more.  See comments in UU/getfile.
19308         fn="f/($pager)"
19309         ;;
19310 esac
19311 echo " "
19312 rp='What pager is used on your system?'
19313 . ./getfile
19314 pager="$ans"
19315
19316 : see what type pids are declared as in the kernel
19317 rp="What is the type of process ids on this system?"
19318 set pid_t pidtype int stdio.h sys/types.h
19319 eval $typedef_ask
19320
19321 : see if ar generates random libraries by itself
19322 echo " "
19323 echo "Checking how to generate random libraries on your machine..." >&4
19324 echo 'int bar1() { return bar2(); }' > bar1.c
19325 echo 'int bar2() { return 2; }' > bar2.c
19326 $cat > foo.c <<EOP
19327 #$i_stdlib I_STDLIB
19328 #ifdef I_STDLIB
19329 #include <stdlib.h>
19330 #endif
19331 int main() { printf("%d\n", bar1()); exit(0); }
19332 EOP
19333 $cc $ccflags -c bar1.c >/dev/null 2>&1
19334 $cc $ccflags -c bar2.c >/dev/null 2>&1
19335 $cc $ccflags -c foo.c >/dev/null 2>&1
19336 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19337 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19338         $run ./foobar >/dev/null 2>&1; then
19339         echo "$ar appears to generate random libraries itself."
19340         orderlib=false
19341         if [ "X$ranlib" = "X" ]; then
19342             ranlib=":"
19343         fi
19344 elif $ar s bar$_a >/dev/null 2>&1 &&
19345         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19346         $run ./foobar >/dev/null 2>&1; then
19347                 echo "a table of contents needs to be added with '$ar s'."
19348                 orderlib=false
19349                 ranlib="$ar s"
19350 elif $ar ts bar$_a >/dev/null 2>&1 &&
19351         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19352         $run ./foobar >/dev/null 2>&1; then
19353                 echo "a table of contents needs to be added with '$ar ts'."
19354                 orderlib=false
19355                 ranlib="$ar ts"
19356 else
19357         case "$ranlib" in
19358         :) ranlib='';;
19359         '')
19360                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19361                 $test -f $ranlib || ranlib=''
19362                 ;;
19363         esac
19364         if $test -n "$ranlib"; then
19365                 echo "your system has '$ranlib'; we'll use that."
19366                 orderlib=false
19367         else
19368                 echo "your system doesn't seem to support random libraries"
19369                 echo "so we'll use lorder and tsort to order the libraries."
19370                 orderlib=true
19371                 ranlib=":"
19372         fi
19373 fi
19374 $rm -f foo* bar*
19375
19376 : check for type of arguments to select. 
19377 case "$selecttype" in
19378 '') case "$d_select" in
19379         $define)
19380                 echo " "
19381                 $cat <<EOM
19382 Checking to see what type of arguments are accepted by select().
19383 EOM
19384                 hdrs="$define sys/types.h
19385                         $i_systime sys/time.h 
19386                         $i_sysselct sys/select.h
19387                         $d_socket sys/socket.h"
19388                 : The first arg can be int, unsigned, or size_t
19389                 : The last arg may or may not be 'const'
19390                 val=''
19391                 : void pointer has been seen but using that
19392                 : breaks the selectminbits test
19393                 for xxx in 'fd_set *' 'int *'; do
19394                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19395                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19396                                         case "$val" in
19397                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19398                                                 if ./protochk "$try" $hdrs; then
19399                                                         echo "Your system accepts $xxx."
19400                                                         val="$xxx"
19401                                                 fi
19402                                                 ;;
19403                                         esac
19404                                 done
19405                         done
19406                 done
19407                 case "$val" in
19408                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19409                         case "$d_fd_set" in
19410                                 $define) dflt="fd_set *" ;;
19411                                 *)              dflt="int *" ;;
19412                         esac
19413                         . ./myread
19414                         val=$ans
19415                         ;;
19416                 esac
19417                 selecttype="$val"
19418                 ;;
19419         *)      : no select, so pick a harmless default
19420                 selecttype='int *'
19421                 ;;
19422         esac
19423         ;;
19424 esac
19425
19426 : check for the select 'width'
19427 case "$selectminbits" in
19428 '') safebits=`expr $ptrsize \* 8`
19429     case "$d_select" in
19430         $define)
19431                 $cat <<EOM
19432
19433 Checking to see on how many bits at a time your select() operates...
19434 EOM
19435                 $cat >try.c <<EOCP
19436 #include <sys/types.h>
19437 #$i_time I_TIME
19438 #$i_systime I_SYS_TIME
19439 #$i_systimek I_SYS_TIME_KERNEL
19440 #ifdef I_TIME
19441 #   include <time.h>
19442 #endif
19443 #ifdef I_SYS_TIME
19444 #   ifdef I_SYS_TIME_KERNEL
19445 #       define KERNEL
19446 #   endif
19447 #   include <sys/time.h>
19448 #   ifdef I_SYS_TIME_KERNEL
19449 #       undef KERNEL
19450 #   endif
19451 #endif
19452 #$i_sysselct I_SYS_SELECT
19453 #ifdef I_SYS_SELECT
19454 #include <sys/select.h>
19455 #endif
19456 #$d_socket HAS_SOCKET
19457 #ifdef HAS_SOCKET
19458 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19459 #endif
19460 #include <stdio.h>
19461 #$i_stdlib I_STDLIB
19462 #ifdef I_STDLIB
19463 #include <stdlib.h>
19464 #endif
19465 $selecttype b;
19466 #define S sizeof(*(b))
19467 #define MINBITS 64
19468 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19469 #define NBITS  (NBYTES * 8)
19470 int main() {
19471     char *s = malloc(NBYTES);
19472     struct timeval t;
19473     int i;
19474     FILE* fp;
19475     int fd;
19476
19477     if (!s)
19478         exit(1);
19479     fclose(stdin);
19480     fp = fopen("try.c", "r");
19481     if (fp == 0)
19482       exit(2);
19483     fd = fileno(fp);
19484     if (fd < 0)
19485       exit(3);
19486     b = ($selecttype)s;
19487     for (i = 0; i < NBITS; i++)
19488         FD_SET(i, b);
19489     t.tv_sec  = 0;
19490     t.tv_usec = 0;
19491     select(fd + 1, b, 0, 0, &t);
19492     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19493     free(s);
19494     printf("%d\n", i + 1);
19495     return 0;
19496 }
19497 EOCP
19498                 set try
19499                 if eval $compile_ok; then
19500                         selectminbits=`$run ./try`
19501                         case "$selectminbits" in
19502                         '')     cat >&4 <<EOM
19503 Cannot figure out on how many bits at a time your select() operates.
19504 I'll play safe and guess it is $safebits bits.
19505 EOM
19506                                 selectminbits=$safebits
19507                                 bits="$safebits bits"
19508                                 ;;
19509                         1)      bits="1 bit" ;;
19510                         *)      bits="$selectminbits bits" ;;
19511                         esac
19512                         echo "Your select() operates on $bits at a time." >&4
19513                 else
19514                         rp='What is the minimum number of bits your select() operates on?'
19515                         case "$byteorder" in
19516                         12345678)       dflt=64 ;;
19517                         1234)           dflt=32 ;;
19518                         *)              dflt=1  ;;
19519                         esac
19520                         . ./myread
19521                         val=$ans
19522                         selectminbits="$val"
19523                 fi
19524                 $rm -f try.* try
19525                 ;;
19526         *)      : no select, so pick a harmless default
19527                 selectminbits=$safebits
19528                 ;;
19529         esac
19530         ;;
19531 esac
19532
19533 : Trace out the files included by signal.h, then look for SIGxxx names.
19534 : Remove SIGARRAYSIZE used by HPUX.
19535 : Remove SIGSTKSIZE used by Linux.
19536 : Remove SIGSTKSZ used by Posix.
19537 : Remove SIGTYP void lines used by OS2.
19538 : Some cpps, like os390, dont give the file name anywhere
19539 if [ "X$fieldn" = X ]; then
19540         : Just make some guesses.  We check them later.
19541         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19542 else
19543         xxx=`echo '#include <signal.h>' |
19544         $cppstdin $cppminus $cppflags 2>/dev/null |
19545         $grep '^[       ]*#.*include' | 
19546         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19547 fi
19548 : Check this list of files to be sure we have parsed the cpp output ok.
19549 : This will also avoid potentially non-existent files, such 
19550 : as ../foo/bar.h
19551 xxxfiles=''
19552 for xx in $xxx /dev/null ; do
19553         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19554 done
19555 : If we have found no files, at least try signal.h
19556 case "$xxxfiles" in
19557 '')     xxxfiles=`./findhdr signal.h` ;;
19558 esac
19559 xxx=`awk '
19560 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19561         print substr($2, 4, 20)
19562 }
19563 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19564         print substr($3, 4, 20)
19565 }' $xxxfiles`
19566 : Append some common names just in case the awk scan failed.
19567 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19568 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19569 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19570 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19571 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19572
19573 : generate a few handy files for later
19574 $cat > signal.c <<EOCP
19575 #include <sys/types.h>
19576 #include <signal.h>
19577 #$i_stdlib I_STDLIB
19578 #ifdef I_STDLIB
19579 #include <stdlib.h>
19580 #endif
19581 #include <stdio.h>
19582 int main() {
19583
19584 /* Strange style to avoid deeply-nested #if/#else/#endif */
19585 #ifndef NSIG
19586 #  ifdef _NSIG
19587 #    define NSIG (_NSIG)
19588 #  endif
19589 #endif
19590
19591 #ifndef NSIG
19592 #  ifdef SIGMAX
19593 #    define NSIG (SIGMAX+1)
19594 #  endif
19595 #endif
19596
19597 #ifndef NSIG
19598 #  ifdef SIG_MAX
19599 #    define NSIG (SIG_MAX+1)
19600 #  endif
19601 #endif
19602
19603 #ifndef NSIG
19604 #  ifdef _SIG_MAX
19605 #    define NSIG (_SIG_MAX+1)
19606 #  endif
19607 #endif
19608
19609 #ifndef NSIG
19610 #  ifdef MAXSIG
19611 #    define NSIG (MAXSIG+1)
19612 #  endif
19613 #endif
19614
19615 #ifndef NSIG
19616 #  ifdef MAX_SIG
19617 #    define NSIG (MAX_SIG+1)
19618 #  endif
19619 #endif
19620
19621 #ifndef NSIG
19622 #  ifdef SIGARRAYSIZE
19623 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19624 #  endif
19625 #endif
19626
19627 #ifndef NSIG
19628 #  ifdef _sys_nsig
19629 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19630 #  endif
19631 #endif
19632
19633 /* Default to some arbitrary number that's big enough to get most
19634    of the common signals.
19635 */
19636 #ifndef NSIG
19637 #    define NSIG 50
19638 #endif
19639
19640 printf("NSIG %d\n", NSIG);
19641
19642 #ifndef JUST_NSIG
19643
19644 EOCP
19645
19646 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19647 {
19648         printf "#ifdef SIG"; printf $1; printf "\n"
19649         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19650         printf $1; printf ");\n"
19651         printf "#endif\n"
19652 }
19653 END {
19654         printf "#endif /* JUST_NSIG */\n";
19655         printf "exit(0);\n}\n";
19656 }
19657 ' >>signal.c
19658 $cat >signal.awk <<'EOP'
19659 BEGIN { ndups = 0 }
19660 $1 ~ /^NSIG$/ { nsig = $2 }
19661 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19662     if ($2 > maxsig) { maxsig = $2 }
19663     if (sig_name[$2]) {
19664         dup_name[ndups] = $1
19665         dup_num[ndups] = $2
19666         ndups++ 
19667     }
19668     else {
19669         sig_name[$2] = $1
19670         sig_num[$2] = $2
19671     }
19672 }
19673 END { 
19674     if (nsig == 0) {
19675         nsig = maxsig + 1
19676     }
19677     printf("NSIG %d\n", nsig);
19678     for (n = 1; n < nsig; n++) {
19679         if (sig_name[n]) {
19680             printf("%s %d\n", sig_name[n], sig_num[n])
19681         }
19682         else {
19683             printf("NUM%d %d\n", n, n) 
19684         }
19685     }
19686     for (n = 0; n < ndups; n++) {
19687         printf("%s %d\n", dup_name[n], dup_num[n])
19688     }
19689 }
19690 EOP
19691 $cat >signal_cmd <<EOS
19692 $startsh
19693 if $test -s signal.lst; then
19694     echo "Using your existing signal.lst file"
19695         exit 0
19696 fi
19697 xxx="$xxx"
19698 EOS
19699 $cat >>signal_cmd <<'EOS'
19700
19701 set signal
19702 if eval $compile_ok; then
19703         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19704 else
19705         echo "(I can't seem be able to compile the whole test program)" >&4
19706         echo "(I'll try it in little pieces.)" >&4
19707         set signal -DJUST_NSIG
19708         if eval $compile_ok; then
19709                 $run ./signal$_exe > signal.nsg
19710                 $cat signal.nsg
19711         else
19712                 echo "I can't seem to figure out how many signals you have." >&4
19713                 echo "Guessing 50." >&4
19714                 echo 'NSIG 50' > signal.nsg
19715         fi
19716         : Now look at all the signal names, one at a time.
19717         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19718                 $cat > signal.c <<EOCP
19719 #include <sys/types.h>
19720 #include <signal.h>
19721 #include <stdio.h>
19722 int main() {
19723 printf("$xx %d\n", SIG${xx});
19724 return 0;
19725 }
19726 EOCP
19727                 set signal
19728                 if eval $compile; then
19729                         echo "SIG${xx} found."
19730                         $run ./signal$_exe  >> signal.ls1
19731                 else
19732                         echo "SIG${xx} NOT found."
19733                 fi
19734         done
19735         if $test -s signal.ls1; then
19736                 $cat signal.nsg signal.ls1 |
19737                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19738         fi
19739
19740 fi
19741 if $test -s signal.lst; then
19742         :
19743 else
19744         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19745         echo 'kill -l' >signal
19746         set X `csh -f <signal`
19747         $rm -f signal
19748         shift
19749         case $# in
19750         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19751         esac
19752         echo $@ | $tr ' ' $trnl | \
19753             $awk '{ printf "%s %d\n", $1, ++s; }
19754                   END { printf "NSIG %d\n", ++s }' >signal.lst
19755 fi
19756 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19757 EOS
19758 chmod a+x signal_cmd
19759 $eunicefix signal_cmd
19760
19761 : generate list of signal names
19762 echo " "
19763 case "$sig_name_init" in
19764 '') doinit=yes ;;
19765 *)  case "$sig_num_init" in
19766     ''|*,*) doinit=yes ;;
19767     esac ;;
19768 esac
19769 case "$doinit" in
19770 yes)
19771         echo "Generating a list of signal names and numbers..." >&4
19772         . ./signal_cmd
19773         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19774         sig_name=`$awk 'BEGIN { printf "ZERO " }
19775                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19776         sig_num=`$awk  'BEGIN { printf "0 " }
19777                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19778         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19779                              !/^NSIG/   { printf "\"%s\", ", $1 }
19780                              END        { printf "0\n" }' signal.lst`
19781         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19782                              !/^NSIG/   { printf "%d, ", $2}
19783                              END        { printf "0\n"}' signal.lst`
19784         ;;
19785 esac
19786 echo "The following $sig_count signals are available:"
19787 echo " "
19788 echo $sig_name | $awk \
19789 'BEGIN { linelen = 0 }
19790 {
19791         for (i = 1; i <= NF; i++) {
19792                 name = "SIG" $i " "
19793                 linelen = linelen + length(name)
19794                 if (linelen > 70) {
19795                         printf "\n"
19796                         linelen = length(name)
19797                 }
19798                 printf "%s", name
19799         }
19800         printf "\n"
19801 }'
19802 sig_size=`echo $sig_name | awk '{print NF}'`
19803 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19804
19805 echo " "
19806 case "$sizetype" in
19807 *_t) zzz="$sizetype"    ;;
19808 *)   zzz="filesize"     ;;
19809 esac
19810 echo "Checking the size of $zzz..." >&4 
19811 cat > try.c <<EOCP
19812 #include <sys/types.h>
19813 #include <stdio.h>
19814 #$i_stdlib I_STDLIB
19815 #ifdef I_STDLIB
19816 #include <stdlib.h>
19817 #endif
19818 int main() {
19819     printf("%d\n", (int)sizeof($sizetype));
19820     exit(0);
19821 }
19822 EOCP
19823 set try
19824 if eval $compile_ok; then
19825         yyy=`$run ./try`
19826         case "$yyy" in
19827         '')     sizesize=4
19828                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19829                 ;;
19830         *)      sizesize=$yyy
19831                 echo "Your $zzz size is $sizesize bytes."
19832                 ;;
19833         esac
19834 else
19835         sizesize=4
19836         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19837 fi
19838
19839
19840 : check for socklen_t
19841 echo " "
19842 echo "Checking to see if you have socklen_t..." >&4
19843 $cat >try.c <<EOCP
19844 #include <sys/types.h>
19845 #$d_socket HAS_SOCKET
19846 #ifdef HAS_SOCKET
19847 #include <sys/socket.h>
19848 #endif
19849 int main() { socklen_t x = 16; }
19850 EOCP
19851 set try
19852 if eval $compile; then
19853         val="$define"
19854         echo "You have socklen_t."
19855 else
19856         val="$undef"
19857         echo "You do not have socklen_t."
19858         case "$sizetype" in
19859         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19860         esac
19861 fi
19862 $rm -f try try.*
19863 set d_socklen_t
19864 eval $setvar
19865
19866 : see if this is a socks.h system
19867 set socks.h i_socks
19868 eval $inhdr
19869
19870 : check for type of the size argument to socket calls
19871 case "$d_socket" in
19872 "$define")
19873         $cat <<EOM
19874
19875 Checking to see what type is the last argument of accept().
19876 EOM
19877         yyy=''
19878         case "$d_socklen_t" in
19879         "$define") yyy="$yyy socklen_t"
19880         esac
19881         yyy="$yyy $sizetype int long unsigned"
19882         for xxx in $yyy; do
19883                 case "$socksizetype" in
19884                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19885                         case "$usesocks" in
19886                         "$define")
19887                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19888                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19889                                         socksizetype="$xxx"
19890                                 fi
19891                                 ;;
19892                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19893                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19894                                         socksizetype="$xxx"
19895                                 fi
19896                                 ;;
19897                         esac
19898                         ;;
19899                 esac
19900         done
19901 : In case none of those worked, prompt the user.
19902         case "$socksizetype" in
19903         '')     rp='What is the type for socket address structure sizes?'
19904                 dflt='int'
19905                 . ./myread
19906                 socksizetype=$ans
19907                 ;;
19908         esac
19909         ;;
19910 *)      : no sockets, so pick relatively harmless default
19911         socksizetype='int'
19912         ;;
19913 esac
19914
19915 : see what type is used for signed size_t
19916 set ssize_t ssizetype int stdio.h sys/types.h
19917 eval $typedef
19918 dflt="$ssizetype"
19919 $cat > try.c <<EOM
19920 #include <stdio.h>
19921 #$i_stdlib I_STDLIB
19922 #ifdef I_STDLIB
19923 #include <stdlib.h>
19924 #endif
19925 #include <sys/types.h>
19926 #define Size_t $sizetype
19927 #define SSize_t $dflt
19928 int main()
19929 {
19930         if (sizeof(Size_t) == sizeof(SSize_t))
19931                 printf("$dflt\n");
19932         else if (sizeof(Size_t) == sizeof(int))
19933                 printf("int\n");
19934         else 
19935                 printf("long\n");
19936         exit(0);
19937 }
19938 EOM
19939 echo " "
19940 set try
19941 if eval $compile_ok && $run ./try > /dev/null; then
19942         ssizetype=`$run ./try`
19943         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19944 else
19945         $cat >&4 <<EOM
19946 Help! I can't compile and run the ssize_t test program: please enlighten me!
19947 (This is probably a misconfiguration in your system or libraries, and
19948 you really ought to fix it.  Still, I'll try anyway.)
19949
19950 I need a type that is the same size as $sizetype, but is guaranteed to
19951 be signed.  Common values are ssize_t, int and long.
19952
19953 EOM
19954         rp="What signed type is the same size as $sizetype?"
19955         . ./myread
19956         ssizetype="$ans"
19957 fi
19958 $rm -f try try.*
19959
19960 : see what type of char stdio uses.
19961 echo " "
19962 echo '#include <stdio.h>' > stdio.c
19963 $cppstdin $cppminus < stdio.c > stdioh
19964 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19965         echo "Your stdio uses unsigned chars." >&4
19966         stdchar="unsigned char"
19967 else
19968         echo "Your stdio uses signed chars." >&4
19969         stdchar="char"
19970 fi
19971 $rm -f stdio.* stdioh
19972
19973 : see what type uids are declared as in the kernel
19974 echo " "
19975 echo "Looking for the type for user ids returned by getuid()."
19976 set uid_t uidtype xxx stdio.h sys/types.h
19977 eval $typedef
19978 case "$uidtype" in
19979 xxx)
19980         xxx=`./findhdr sys/user.h`
19981         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19982         case $1 in
19983         unsigned) dflt="$1 $2" ;;
19984         *) dflt="$1" ;;
19985         esac
19986         ;;
19987 *) dflt="$uidtype";;
19988 esac
19989 case "$uidtype" in
19990 uid_t)  echo "uid_t found." ;;
19991 *)      rp="What is the type for user ids returned by getuid()?"
19992         . ./myread
19993         uidtype="$ans"
19994         ;;
19995 esac
19996
19997 echo " "
19998 case "$uidtype" in
19999 *_t) zzz="$uidtype"     ;;
20000 *)   zzz="uid"          ;;
20001 esac
20002 echo "Checking the size of $zzz..." >&4 
20003 cat > try.c <<EOCP
20004 #include <sys/types.h>
20005 #include <stdio.h>
20006 #$i_stdlib I_STDLIB
20007 #ifdef I_STDLIB
20008 #include <stdlib.h>
20009 #endif
20010 int main() {
20011     printf("%d\n", (int)sizeof($uidtype));
20012     exit(0);
20013 }
20014 EOCP
20015 set try
20016 if eval $compile_ok; then
20017         yyy=`$run ./try`
20018         case "$yyy" in
20019         '')     uidsize=4
20020                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20021                 ;;
20022         *)      uidsize=$yyy
20023                 echo "Your $zzz is $uidsize bytes long."
20024                 ;;
20025         esac
20026 else
20027         uidsize=4
20028         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20029 fi
20030
20031 echo " "
20032 case "$uidtype" in
20033 *_t) zzz="$uidtype"     ;;
20034 *)   zzz="uid"          ;;
20035 esac
20036 echo "Checking the sign of $zzz..." >&4
20037 cat > try.c <<EOCP
20038 #include <sys/types.h>
20039 #include <stdio.h>
20040 int main() {
20041         $uidtype foo = -1;
20042         if (foo < 0)
20043                 printf("-1\n");
20044         else
20045                 printf("1\n");
20046 }
20047 EOCP
20048 set try
20049 if eval $compile; then
20050         yyy=`$run ./try`
20051         case "$yyy" in
20052         '')     uidsign=1
20053                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20054                 ;;
20055         *)      uidsign=$yyy
20056                 case "$uidsign" in
20057                  1) echo "Your $zzz is unsigned." ;;
20058                 -1) echo "Your $zzz is signed."   ;;
20059                 esac
20060                 ;;
20061         esac
20062 else
20063         uidsign=1
20064         echo "(I can't compile the test program--guessing unsigned.)" >&4
20065 fi
20066
20067
20068
20069 echo " "
20070 $echo "Checking the format string to be used for uids..." >&4
20071
20072 case "$uidsign" in
20073 -1)     if $test X"$uidsize" = X"$ivsize"; then
20074                 uidformat="$ivdformat"
20075         else
20076                 if $test X"$uidsize" = X"$longsize"; then
20077                         uidformat='"ld"'
20078                 else
20079                         if $test X"$uidsize" = X"$intsize"; then
20080                                 uidformat='"d"'
20081                         else
20082                                 if $test X"$uidsize" = X"$shortsize"; then
20083                                         uidformat='"hd"'
20084                                 fi
20085                         fi
20086                 fi
20087         fi
20088         ;;
20089 *)      if $test X"$uidsize" = X"$uvsize"; then
20090                 uidformat="$uvuformat"
20091         else
20092                 if $test X"$uidsize" = X"$longsize"; then
20093                         uidformat='"lu"'
20094                 else
20095                         if $test X"$uidsize" = X"$intsize"; then
20096                                 uidformat='"u"'
20097                         else
20098                                 if $test X"$uidsize" = X"$shortsize"; then
20099                                         uidformat='"hu"'
20100                                 fi
20101                         fi
20102                 fi
20103         fi
20104         ;;
20105 esac
20106
20107
20108 case "$usesitecustomize" in
20109     $define|true|[Yy]*)
20110         usesitecustomize="$define"
20111         ;;
20112     *)
20113         usesitecustomize="$undef"
20114         ;;
20115     esac
20116
20117 : determine compiler compiler
20118 case "$yacc" in
20119 '')
20120         dflt=yacc;;
20121 *)
20122         dflt="$yacc";;
20123 esac
20124 echo " "
20125 comp='yacc'
20126 if $test -f "$byacc$_exe"; then
20127         dflt="$byacc"
20128         comp="byacc or $comp"
20129 fi
20130 if $test -f "$bison$_exe"; then
20131         comp="$comp or bison -y"
20132 fi
20133 rp="Which compiler compiler ($comp) shall I use?"
20134 . ./myread
20135 yacc="$ans"
20136 case "$yacc" in
20137 *bis*)
20138         case "$yacc" in
20139         *-y*) ;;
20140         *)
20141                 yacc="$yacc -y"
20142                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20143                 ;;
20144         esac
20145         ;;
20146 esac
20147
20148 : see if this is a fp.h system
20149 set fp.h i_fp
20150 eval $inhdr
20151
20152 : see if this is a fp_class.h system
20153 set fp_class.h i_fp_class
20154 eval $inhdr
20155
20156 : see if this is a ieeefp.h system
20157 case "$i_ieeefp" in
20158 '' ) set ieeefp.h i_ieeefp
20159      eval $inhdr
20160      ;;
20161 esac
20162
20163 : see if this is a libutil.h system
20164 set libutil.h i_libutil
20165 eval $inhdr
20166
20167 : see if mach cthreads are available
20168 if test "X$usethreads" = "X$define"; then
20169         set mach/cthreads.h i_machcthr
20170         eval $inhdr
20171 else
20172         i_machcthr="$undef"
20173 fi
20174
20175
20176
20177 : see if this is a mntent.h system
20178 set mntent.h i_mntent
20179 eval $inhdr
20180
20181 : see if ndbm.h is available
20182 set ndbm.h t_ndbm
20183 eval $inhdr
20184
20185 case "$t_ndbm" in
20186 $undef)
20187     # Some Linux distributions such as RedHat 7.1 put the
20188     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20189     if $test -f /usr/include/gdbm/ndbm.h; then
20190         echo '<gdbm/ndbm.h> found.'
20191         ccflags="$ccflags -I/usr/include/gdbm"
20192         cppflags="$cppflags -I/usr/include/gdbm"
20193         t_ndbm=$define
20194     fi
20195     ;;
20196 esac
20197
20198 case "$t_ndbm" in
20199 $define)
20200         : see if dbm_open exists
20201         set dbm_open d_dbm_open
20202         eval $inlibc
20203         case "$d_dbm_open" in
20204         $undef)
20205                 t_ndbm="$undef"
20206                 echo "We won't be including <ndbm.h>"
20207                 ;;
20208         esac
20209         ;;
20210 esac
20211 val="$t_ndbm"
20212 set i_ndbm
20213 eval $setvar
20214
20215 : see if net/errno.h is available
20216 val=''
20217 set net/errno.h val
20218 eval $inhdr
20219
20220 : Unfortunately, it causes problems on some systems.  Arrgh.
20221 case "$val" in
20222 $define)
20223         cat > try.c <<'EOM'
20224 #include <stdio.h>
20225 #include <errno.h>
20226 #include <net/errno.h>
20227 int func()
20228 {
20229         return ENOTSOCK;
20230 }
20231 EOM
20232         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20233                 echo "We'll be including <net/errno.h>." >&4
20234         else
20235                 echo "We won't be including <net/errno.h>." >&4
20236                 val="$undef"
20237         fi
20238         $rm -f try.* try
20239         ;;
20240 esac
20241 set i_neterrno
20242 eval $setvar
20243
20244 : see if netinet/tcp.h is available
20245 set netinet/tcp.h i_netinettcp
20246 eval $inhdr
20247
20248 : see if this is a poll.h system
20249 set poll.h i_poll
20250 eval $inhdr
20251
20252 : see if this is a prot.h system
20253 set prot.h i_prot
20254 eval $inhdr
20255
20256 echo " "
20257 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20258 $cat <<'EOSH' > Cppsym.know
20259 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20260 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20261 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20262 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20263 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20264 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20265 bull c cadmus clipper CMU COFF COMPILER_VERSION
20266 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20267 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20268 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20269 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20270 GLIBC GLIBC_MINOR
20271 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20272 H3050R H3050RX hbullx20 hcx host_mips
20273 hp200 hp300 hp700 HP700 hp800 hp9000
20274 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20275 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20276 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20277 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20278 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20279 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20280 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20281 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20282 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20283 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20284 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20285 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20286 MATH_HAS_NO_SIDE_EFFECTS
20287 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20288 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20289 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20290 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20291 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20292 NetBSD news1500 news1700 news1800 news1900 news3700
20293 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20294 ns32016 ns32332 ns32k nsc32000
20295 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20296 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20297 pc532 pdp11 PGC PIC plexus PORTAR posix
20298 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20299 POSIX_C_SOURCE POSIX_SOURCE POWER
20300 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20301 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20302 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20303 sony sony_news sonyrisc sparc sparclite spectrum
20304 stardent stdc STDC_EXT stratos sun sun3 sun386
20305 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20306 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20307 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20308 sysV68 sysV88 Tek4132 Tek4300 titan
20309 TM3200 TM5400 TM5600
20310 tower tower32 tower32_200 tower32_600 tower32_700
20311 tower32_800 tower32_850 tss
20312 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20313 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20314 unix UNIX95 UNIX99 unixpc unos
20315 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20316 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20317 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20318 USGr4 USGr4_2
20319 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20320 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20321 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20322 z8000
20323 EOSH
20324 # Maybe put other stuff here too.
20325 cat <<EOSH >>Cppsym.know
20326 $osname
20327 EOSH
20328 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20329 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20330 $cat Cppsym.know > Cppsym.c
20331 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20332 $rm -f Cppsym.a Cppsym.b Cppsym.c
20333 cat <<EOSH > Cppsym
20334 $startsh
20335 if $test \$# -gt 0; then
20336     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20337     if $test -s Cppsym.got; then
20338         $rm -f Cppsym.got
20339         exit 0
20340     fi
20341     $rm -f Cppsym.got
20342     exit 1
20343 else
20344     $tr " " "$trnl" | ./Cppsym.try
20345     exit 0
20346 fi
20347 EOSH
20348 chmod +x Cppsym
20349 $eunicefix Cppsym
20350 cat <<EOSH > Cppsym.try
20351 $startsh
20352 cat <<'EOCP' > try.c
20353 #include <stdio.h>
20354 #if cpp_stuff == 1
20355 #define STRINGIFY(a)    "a"
20356 #endif
20357 #if cpp_stuff == 42
20358 #define StGiFy(a)  #a
20359 #define STRINGIFY(a)    StGiFy(a)
20360 #endif
20361 #if $cpp_stuff != 1 && $cpp_stuff != 42
20362 #   include "Bletch: How does this C preprocessor stringify macros?"
20363 #endif
20364 int main() {
20365 EOCP
20366 $awk \\
20367 EOSH
20368 cat <<'EOSH' >> Cppsym.try
20369 'length($1) > 0 {
20370     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20371     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20372     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20373     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20374 }'       >> try.c
20375 echo 'return 0;}' >> try.c
20376 EOSH
20377 cat <<EOSH >> Cppsym.try
20378 ccflags="$ccflags"
20379 case "$osname-$gccversion" in
20380 irix-) ccflags="\$ccflags -woff 1178" ;;
20381 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20382 esac
20383 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20384 EOSH
20385 chmod +x Cppsym.try
20386 $eunicefix Cppsym.try
20387 ./Cppsym < Cppsym.know > Cppsym.true
20388 : Add in any linux cpp "predefined macros":
20389 case "$osname::$gccversion" in
20390   *linux*::*.*)
20391     tHdrH=_tmpHdr
20392     rm -f $tHdrH'.h' $tHdrH
20393     touch $tHdrH'.h'
20394     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20395        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20396        if [ -s $tHdrH'_cppsym.real' ]; then
20397           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20398        fi
20399     fi
20400     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20401   ;;
20402 esac
20403 : now check the C compiler for additional symbols
20404 postprocess_cc_v=''
20405 case "$osname" in
20406 aix) postprocess_cc_v="|$tr , ' '" ;;
20407 esac
20408 $cat >ccsym <<EOS
20409 $startsh
20410 $cat >tmp.c <<EOF
20411 extern int foo;
20412 EOF
20413 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20414 do
20415         case "\$i" in
20416         -D*) echo "\$i" | $sed 's/^-D//';;
20417         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20418         esac
20419 done
20420 $rm -f try.c
20421 EOS
20422 postprocess_cc_v=''
20423 chmod +x ccsym
20424 $eunicefix ccsym
20425 ./ccsym > ccsym1.raw
20426 if $test -s ccsym1.raw; then
20427        $sort ccsym1.raw | $uniq >ccsym.raw
20428 else
20429        mv ccsym1.raw ccsym.raw
20430 fi
20431
20432 $awk '/\=/ { print $0; next }
20433         { print $0"=1" }' ccsym.raw >ccsym.list
20434 $comm -13 Cppsym.true ccsym.list >ccsym.own
20435 $comm -12 Cppsym.true ccsym.list >ccsym.com
20436 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20437 also=''
20438 if $test -z ccsym.raw; then
20439         echo "Your C compiler doesn't seem to define any symbols!" >&4
20440         echo " "
20441         echo "However, your C preprocessor defines the following symbols:"
20442         $cat Cppsym.true
20443         ccsymbols=''
20444         cppsymbols=`$cat Cppsym.true`
20445         cppsymbols=`echo $cppsymbols`
20446         cppccsymbols="$cppsymbols"
20447 else
20448         if $test -s ccsym.com; then
20449                 echo "Your C compiler and pre-processor define these symbols:"
20450                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20451                 also='also '
20452                 symbols='ones'
20453                 cppccsymbols=`$cat ccsym.com`
20454                 cppccsymbols=`echo $cppccsymbols`
20455                 $test "$silent" || sleep 1
20456         fi
20457         if $test -s ccsym.cpp; then
20458                 $test "$also" && echo " "
20459                 echo "Your C pre-processor ${also}defines the following symbols:"
20460                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20461                 also='further '
20462                 cppsymbols=`$cat ccsym.cpp`
20463                 cppsymbols=`echo $cppsymbols`
20464                 $test "$silent" || sleep 1
20465         fi
20466         if $test -s ccsym.own; then
20467                 $test "$also" && echo " "
20468                 echo "Your C compiler ${also}defines the following cpp symbols:"
20469                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20470                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20471                 ccsymbols=`$cat ccsym.own`
20472                 ccsymbols=`echo $ccsymbols`
20473                 $test "$silent" || sleep 1
20474         fi
20475 fi
20476
20477 : see if this is a termio system
20478 val="$undef"
20479 val2="$undef"
20480 val3="$undef"
20481 if $test `./findhdr termios.h`; then
20482         set tcsetattr i_termios
20483         eval $inlibc
20484         val3="$i_termios"
20485 fi
20486 echo " "
20487 case "$val3" in
20488 "$define") echo "You have POSIX termios.h... good!" >&4;;
20489 *) if ./Cppsym pyr; then
20490                 case "`/bin/universe`" in
20491                 ucb) if $test `./findhdr sgtty.h`; then
20492                                 val2="$define"
20493                                 echo "<sgtty.h> found." >&4
20494                         else
20495                                 echo "System is pyramid with BSD universe."
20496                                 echo "<sgtty.h> not found--you could have problems." >&4
20497                         fi;;
20498                 *) if $test `./findhdr termio.h`; then
20499                                 val="$define"
20500                                 echo "<termio.h> found." >&4
20501                         else
20502                                 echo "System is pyramid with USG universe."
20503                                 echo "<termio.h> not found--you could have problems." >&4
20504                         fi;;
20505                 esac
20506         elif ./usg; then
20507                 if $test `./findhdr termio.h`; then
20508                         echo "<termio.h> found." >&4
20509                         val="$define"
20510                 elif $test `./findhdr sgtty.h`; then
20511                         echo "<sgtty.h> found." >&4
20512                         val2="$define"
20513                 else
20514 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20515                 fi
20516         else
20517                 if $test `./findhdr sgtty.h`; then
20518                         echo "<sgtty.h> found." >&4
20519                         val2="$define"
20520                 elif $test `./findhdr termio.h`; then
20521                         echo "<termio.h> found." >&4
20522                         val="$define"
20523                 else
20524 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20525                 fi
20526         fi;;
20527 esac
20528 set i_termio; eval $setvar
20529 val=$val2; set i_sgtty; eval $setvar
20530 val=$val3; set i_termios; eval $setvar
20531
20532 : see if stddef is available
20533 set stddef.h i_stddef
20534 eval $inhdr
20535
20536 : see if this is a sunmath.h system
20537 set sunmath.h i_sunmath
20538 eval $inhdr
20539
20540 : see if sys/access.h is available
20541 set sys/access.h i_sysaccess
20542 eval $inhdr
20543
20544 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20545 set sys/filio.h i_sysfilio
20546 eval $inhdr
20547 echo " "
20548 if $test `./findhdr sys/ioctl.h`; then
20549         val="$define"
20550         echo '<sys/ioctl.h> found.' >&4
20551 else
20552         val="$undef"
20553         if $test $i_sysfilio = "$define"; then
20554             echo '<sys/ioctl.h> NOT found.' >&4
20555         else
20556                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20557                 $test $i_termio = "$define" && xxx="termio.h"
20558                 $test $i_termios = "$define" && xxx="termios.h"
20559 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20560         fi
20561 fi
20562 set i_sysioctl
20563 eval $setvar
20564
20565 : see if socket ioctl defs are in sys/sockio.h
20566 echo " "
20567 xxx=`./findhdr sys/sockio.h`
20568 if $test "$xxx"; then
20569         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20570                 val="$define"
20571                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20572         else
20573                 val="$undef"
20574                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20575         fi
20576 else
20577         val="$undef"
20578         $cat <<EOM
20579 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20580 EOM
20581 fi
20582 set i_syssockio
20583 eval $setvar
20584
20585
20586 : see if this is a syslog.h system
20587 set syslog.h i_syslog
20588 eval $inhdr
20589
20590
20591 : see if this is a sys/mode.h system
20592 set sys/mode.h i_sysmode
20593 eval $inhdr
20594
20595 : see if sys/resource.h has to be included
20596 set sys/resource.h i_sysresrc
20597 eval $inhdr
20598
20599 : see if sys/security.h is available
20600 set sys/security.h i_syssecrt
20601 eval $inhdr
20602
20603 : see if this is a sys/statvfs.h system
20604 set sys/statvfs.h i_sysstatvfs
20605 eval $inhdr
20606
20607 : see if this is a sys/un.h system
20608 set sys/un.h i_sysun
20609 eval $inhdr
20610
20611
20612 : see if this is a sys/utsname.h system
20613 set sys/utsname.h i_sysutsname
20614 eval $inhdr
20615
20616 : see if this is a syswait system
20617 set sys/wait.h i_syswait
20618 eval $inhdr
20619
20620 : see if this is a ustat.h system
20621 set ustat.h i_ustat
20622 eval $inhdr
20623
20624 : see if this is an utime system
20625 set utime.h i_utime
20626 eval $inhdr
20627
20628 : see if this is a values.h system
20629 set values.h i_values
20630 eval $inhdr
20631
20632 : see if this is a vfork system
20633 case "$d_vfork" in
20634 "$define")
20635         set vfork.h i_vfork
20636         eval $inhdr
20637         ;;
20638 *)
20639         i_vfork="$undef"
20640         ;;
20641 esac
20642
20643 : see if gdbm.h is available
20644 set gdbm.h t_gdbm
20645 eval $inhdr
20646 case "$t_gdbm" in
20647 $define)
20648         : see if gdbm_open exists
20649         set gdbm_open d_gdbm_open
20650         eval $inlibc
20651         case "$d_gdbm_open" in
20652         $undef)
20653                 t_gdbm="$undef"
20654                 echo "We won't be including <gdbm.h>"
20655                 ;;
20656         esac
20657         ;;
20658 esac
20659 val="$t_gdbm"
20660 set i_gdbm
20661 eval $setvar
20662
20663 echo " "
20664 echo "Looking for extensions..." >&4
20665 : If we are using the old config.sh, known_extensions may contain
20666 : old or inaccurate or duplicate values.
20667 known_extensions=''
20668 nonxs_extensions=''
20669 : We do not use find because it might not be available.
20670 : We do not just use MANIFEST because the user may have dropped
20671 : some additional extensions into the source tree and expect them
20672 : to be built.
20673
20674 : Function to recursively find available extensions, ignoring DynaLoader
20675 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20676 find_extensions='
20677     for xxx in *; do
20678        case "$xxx" in
20679            DynaLoader|dynaload) ;;
20680            *)
20681            if $test -f $xxx/$xxx.xs; then
20682                known_extensions="$known_extensions $1$xxx";
20683            elif $test -f $xxx/Makefile.PL; then
20684                nonxs_extensions="$nonxs_extensions $1$xxx";
20685            else
20686                if $test -d $xxx -a $# -lt 10; then
20687                    set $1$xxx/ $*;
20688                    cd "$xxx";
20689                    eval $find_extensions;
20690                    cd ..;
20691                    shift;
20692                fi;
20693            fi
20694            ;;
20695        esac;
20696     done'
20697 tdir=`pwd`
20698 cd "$rsrc/ext"
20699 set X
20700 shift
20701 eval $find_extensions
20702 # Special case:  Add in threads/shared since it is not picked up by the
20703 # recursive find above (and adding in general recursive finding breaks
20704 # SDBM_File/sdbm).  A.D.  10/25/2001.
20705 known_extensions="$known_extensions threads/shared"
20706 set X $nonxs_extensions
20707 shift
20708 nonxs_extensions="$*"
20709 set X $known_extensions
20710 shift
20711 known_extensions="$*"
20712 cd "$tdir"
20713
20714 : Now see which are supported on this system.
20715 avail_ext=''
20716 for xxx in $known_extensions ; do
20717         case "$xxx" in
20718         DB_File|db_file)
20719                 case "$i_db" in
20720                 $define) avail_ext="$avail_ext $xxx" ;;
20721                 esac
20722                 ;;
20723         GDBM_File|gdbm_fil)
20724                 case "$i_gdbm" in 
20725                 $define) avail_ext="$avail_ext $xxx" ;;
20726                 esac
20727                 ;;
20728         I18N/Langinfo|i18n_lan)
20729                 case "$i_langinfo$d_nl_langinfo" in 
20730                 $define$define) avail_ext="$avail_ext $xxx" ;;
20731                 esac
20732                 ;;
20733         NDBM_File|ndbm_fil)
20734                 case "$i_ndbm" in
20735                 $define)
20736                     case "$osname-$use64bitint" in
20737                     hpux-define)
20738                         case "$libs" in
20739                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20740                         esac
20741                         ;;
20742                     *) avail_ext="$avail_ext $xxx" ;;
20743                     esac
20744                     ;;
20745                 esac
20746                 ;;
20747         ODBM_File|odbm_fil) 
20748                 case "${i_dbm}${i_rpcsvcdbm}" in
20749                 *"${define}"*)
20750                     case "$osname-$use64bitint" in
20751                     hpux-define)
20752                         case "$libs" in
20753                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20754                         esac
20755                         ;;
20756                     *) avail_ext="$avail_ext $xxx" ;;
20757                     esac
20758                     ;;
20759                 esac
20760                 ;;
20761         POSIX|posix)
20762                 case "$useposix" in
20763                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20764                 esac
20765                 ;;
20766         Opcode|opcode)
20767                 case "$useopcode" in
20768                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20769                 esac
20770                 ;;
20771         Socket|socket)
20772                 case "$d_socket" in 
20773                 true|$define|y)
20774                     case "$osname" in
20775                     beos) ;; # not unless BONE
20776                     *) avail_ext="$avail_ext $xxx" ;;
20777                     esac
20778                     ;;
20779                 esac
20780                 ;;
20781         Sys/Syslog|sys/syslog)
20782                 : XXX syslog requires socket
20783                 case "$d_socket" in 
20784                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20785                 esac
20786                 ;;
20787         Thread|thread)
20788                 case "$usethreads" in
20789                 true|$define|y)
20790                         case "$useithreads" in
20791                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20792                         esac
20793                 esac
20794                 ;;
20795         XS/APItest|xs/apitest)
20796                 # This is just for testing.  Skip it unless we have dynamic loading.
20797
20798                 case "$usedl" in
20799                 $define) avail_ext="$avail_ext $xxx" ;;
20800                 esac
20801                 ;;
20802         XS/Typemap|xs/typemap)
20803                 # This is just for testing.  Skip it unless we have dynamic loading.
20804                 case "$usedl" in
20805                 $define) avail_ext="$avail_ext $xxx" ;;
20806                 esac
20807                 ;;
20808         threads|threads/shared)
20809                 # threads and threads::shared are special cases.
20810                 # To stop people from asking "Perl 5.8.0 was supposed
20811                 # to have this new fancy threads implementation but my
20812                 # perl doesn't have it" and from people trying to
20813                 # (re)install the threads module using CPAN.pm and
20814                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20815                 # the threads.pm and threads/shared.pm will always be
20816                 # there, croaking informatively ("you need to rebuild
20817                 # all of Perl with threads, sorry") when threads haven't
20818                 # been compiled in.
20819                 # --jhi
20820                 avail_ext="$avail_ext $xxx"
20821                 ;;
20822         IPC/SysV|ipc/sysv)
20823                 : XXX Do we need a useipcsysv variable here
20824                 case "${d_msg}${d_sem}${d_shm}" in 
20825                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20826                 esac
20827                 ;;
20828         *)      avail_ext="$avail_ext $xxx"
20829                 ;;
20830         esac
20831 done
20832
20833 set X $avail_ext
20834 shift
20835 avail_ext="$*"
20836
20837 case "$onlyextensions" in
20838 '') ;;
20839 *)  keepextensions=''
20840     echo "You have requested that only certains extensions be included..." >&4
20841     for i in $onlyextensions; do
20842         case " $avail_ext " in
20843         *" $i "*)
20844             echo "Keeping extension $i."
20845             keepextensions="$keepextensions $i"
20846             ;;
20847         *) echo "Ignoring extension $i." ;;
20848         esac
20849     done
20850     avail_ext="$keepextensions"
20851     ;;
20852 esac
20853
20854 case "$noextensions" in
20855 '') ;;
20856 *)  keepextensions=''
20857     echo "You have requested that certain extensions be ignored..." >&4
20858     for i in $avail_ext; do
20859         case " $noextensions " in
20860         *" $i "*) echo "Ignoring extension $i." ;;
20861         *) echo "Keeping extension $i.";
20862            keepextensions="$keepextensions $i"
20863            ;;
20864         esac
20865     done
20866     avail_ext="$keepextensions"
20867     ;;
20868 esac
20869
20870 : Now see which nonxs extensions are supported on this system.
20871 : For now assume all are.
20872 nonxs_ext=''
20873 for xxx in $nonxs_extensions ; do
20874         case "$xxx" in
20875         *)      nonxs_ext="$nonxs_ext $xxx"
20876                 ;;
20877         esac
20878 done
20879
20880 set X $nonxs_ext
20881 shift
20882 nonxs_ext="$*"
20883
20884 case $usedl in
20885 $define)
20886         $cat <<EOM
20887 A number of extensions are supplied with $package.  You may choose to
20888 compile these extensions for dynamic loading (the default), compile
20889 them into the $package executable (static loading), or not include
20890 them at all.  Answer "none" to include no extensions.
20891 Note that DynaLoader is always built and need not be mentioned here.
20892
20893 EOM
20894         case "$dynamic_ext" in
20895         '')
20896                 : Exclude those listed in static_ext
20897                 dflt=''
20898                 for xxx in $avail_ext; do
20899                         case " $static_ext " in
20900                         *" $xxx "*) ;;
20901                         *) dflt="$dflt $xxx" ;;
20902                         esac
20903                 done
20904                 set X $dflt
20905                 shift
20906                 dflt="$*"
20907                 ;;
20908         *)      dflt="$dynamic_ext"
20909                 # Perhaps we are reusing an old out-of-date config.sh.
20910                 case "$hint" in
20911                 previous)
20912                         if test X"$dynamic_ext" != X"$avail_ext"; then
20913                                 $cat <<EOM
20914 NOTICE:  Your previous config.sh list may be incorrect. 
20915 The extensions now available to you are 
20916         ${avail_ext}
20917 but the default list from your previous config.sh is
20918         ${dynamic_ext} 
20919
20920 EOM
20921                         fi
20922                         ;;
20923                 esac
20924                 ;;
20925         esac
20926         case "$dflt" in
20927         '')     dflt=none;;
20928         esac
20929         rp="What extensions do you wish to load dynamically?"
20930         . ./myread
20931         case "$ans" in
20932         none) dynamic_ext=' ' ;;
20933         *) dynamic_ext="$ans" ;;
20934         esac
20935
20936         case "$static_ext" in
20937         '')
20938                 : Exclude those already listed in dynamic linking
20939                 dflt=''
20940                 for xxx in $avail_ext; do
20941                         case " $dynamic_ext " in
20942                         *" $xxx "*) ;;
20943                         *) dflt="$dflt $xxx" ;;
20944                         esac
20945                 done
20946                 set X $dflt
20947                 shift
20948                 dflt="$*"
20949                 ;;
20950         *)  dflt="$static_ext" 
20951                 ;;
20952         esac
20953
20954         case "$dflt" in
20955         '')     dflt=none;;
20956         esac
20957         rp="What extensions do you wish to load statically?"
20958         . ./myread
20959         case "$ans" in
20960         none) static_ext=' ' ;;
20961         *) static_ext="$ans" ;;
20962         esac
20963         ;;
20964 *)
20965         $cat <<EOM
20966 A number of extensions are supplied with $package.  Answer "none" 
20967 to include no extensions. 
20968 Note that DynaLoader is always built and need not be mentioned here.
20969
20970 EOM
20971         case "$static_ext" in
20972         '') dflt="$avail_ext" ;;
20973         *)      dflt="$static_ext"
20974                 # Perhaps we are reusing an old out-of-date config.sh.
20975                 case "$hint" in
20976                 previous)
20977                         if test X"$static_ext" != X"$avail_ext"; then
20978                                 $cat <<EOM
20979 NOTICE:  Your previous config.sh list may be incorrect. 
20980 The extensions now available to you are 
20981         ${avail_ext}
20982 but the default list from your previous config.sh is
20983         ${static_ext} 
20984
20985 EOM
20986                         fi
20987                         ;;
20988                 esac
20989                 ;;
20990         esac
20991         : Exclude those that are not xs extensions
20992         case "$dflt" in
20993         '')     dflt=none;;
20994         esac
20995         rp="What extensions do you wish to include?"
20996         . ./myread
20997         case "$ans" in
20998         none) static_ext=' ' ;;
20999         *) static_ext="$ans" ;;
21000         esac
21001         ;;
21002 esac
21003 #        
21004 # Encode is a special case.  If we are building Encode as a static
21005 # extension, we need to explicitly list its subextensions as well.
21006 # For other nested extensions, this is handled automatically by
21007 # the appropriate Makefile.PL.
21008 case " $static_ext " in
21009         *" Encode "*) # Add the subextensions of Encode
21010         cd "$rsrc/ext"
21011         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21012                 static_ext="$static_ext Encode/$xxx"
21013         done
21014         cd "$tdir"
21015         ;;
21016 esac
21017
21018 set X $dynamic_ext $static_ext $nonxs_ext
21019 shift
21020 extensions="$*"
21021
21022 # Sanity check:  We require an extension suitable for use with
21023 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21024 # should show up as failures in the test suite, but it's helpful to
21025 # catch them now.) The 'extensions' list is normally sorted
21026 # alphabetically, so we need to accept either
21027 #    DB_File ... Fcntl ... IO  ....
21028 # or something like
21029 #    Fcntl ... NDBM_File ... IO  ....
21030 case " $extensions"  in
21031 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21032 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21033 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21034 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21035    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21036    ;;
21037 esac
21038
21039 : Remove libraries needed only for extensions
21040 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21041 : The exception is SunOS 4.x, which needs them.
21042 case "${osname}X${osvers}" in
21043 sunos*X4*)
21044     perllibs="$libs"
21045     ;;
21046 *) case "$usedl" in
21047     $define|true|[yY]*)
21048             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21049             shift
21050             perllibs="$*"
21051             ;;
21052     *)  perllibs="$libs"
21053             ;;
21054     esac
21055     ;;
21056 esac
21057
21058 : Remove build directory name from cppstdin so it can be used from
21059 : either the present location or the final installed location.
21060 echo " "
21061 : Get out of the UU directory to get correct path name.
21062 cd ..
21063 case "$cppstdin" in
21064 `pwd`/cppstdin)
21065         echo "Stripping down cppstdin path name"
21066         cppstdin=cppstdin
21067         ;;
21068 esac
21069 cd UU
21070
21071 : end of configuration questions
21072 echo " "
21073 echo "End of configuration questions."
21074 echo " "
21075
21076 : back to where it started
21077 if test -d ../UU; then
21078         cd ..
21079 fi
21080
21081 : configuration may be patched via a 'config.arch' file
21082 if $test -f config.arch; then
21083         echo "I see a config.arch file, loading it."
21084         . ./config.arch
21085 fi
21086
21087 : configuration may be patched via a 'config.over' file
21088 if $test -f config.over; then
21089         echo " "
21090         dflt=y
21091         rp='I see a config.over file.  Do you wish to load it?'
21092         . UU/myread
21093         case "$ans" in
21094         n*) echo "OK, I'll ignore it.";;
21095         *)      . ./config.over
21096                 echo "Configuration override changes have been loaded."
21097                 ;;
21098         esac
21099 fi
21100
21101 : in case they want portability, strip down executable paths
21102 case "$d_portable" in
21103 "$define")
21104         echo " "
21105         echo "Stripping down executable paths..." >&4
21106         for file in $loclist $trylist; do
21107                 eval temp=\$$file
21108                 eval $file=`basename $temp`
21109         done
21110         ;;
21111 esac
21112
21113 : create config.sh file
21114 echo " "
21115 echo "Creating config.sh..." >&4
21116 $spitshell <<EOT >config.sh
21117 $startsh
21118 #
21119 # This file was produced by running the Configure script. It holds all the
21120 # definitions figured out by Configure. Should you modify one of these values,
21121 # do not forget to propagate your changes by running "Configure -der". You may
21122 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21123 #
21124
21125 # Package name      : $package
21126 # Source directory  : $src
21127 # Configuration time: $cf_time
21128 # Configured by     : $cf_by
21129 # Target system     : $myuname
21130
21131 Author='$Author'
21132 Date='$Date'
21133 Header='$Header'
21134 Id='$Id'
21135 Locker='$Locker'
21136 Log='$Log'
21137 Mcc='$Mcc'
21138 RCSfile='$RCSfile'
21139 Revision='$Revision'
21140 Source='$Source'
21141 State='$State'
21142 _a='$_a'
21143 _exe='$_exe'
21144 _o='$_o'
21145 afs='$afs'
21146 afsroot='$afsroot'
21147 alignbytes='$alignbytes'
21148 ansi2knr='$ansi2knr'
21149 aphostname='$aphostname'
21150 api_revision='$api_revision'
21151 api_subversion='$api_subversion'
21152 api_version='$api_version'
21153 api_versionstring='$api_versionstring'
21154 ar='$ar'
21155 archlib='$archlib'
21156 archlibexp='$archlibexp'
21157 archname64='$archname64'
21158 archname='$archname'
21159 archobjs='$archobjs'
21160 asctime_r_proto='$asctime_r_proto'
21161 awk='$awk'
21162 baserev='$baserev'
21163 bash='$bash'
21164 bin='$bin'
21165 binexp='$binexp'
21166 bison='$bison'
21167 byacc='$byacc'
21168 byteorder='$byteorder'
21169 c='$c'
21170 castflags='$castflags'
21171 cat='$cat'
21172 cc='$cc'
21173 cccdlflags='$cccdlflags'
21174 ccdlflags='$ccdlflags'
21175 ccflags='$ccflags'
21176 ccflags_uselargefiles='$ccflags_uselargefiles'
21177 ccname='$ccname'
21178 ccsymbols='$ccsymbols'
21179 ccversion='$ccversion'
21180 cf_by='$cf_by'
21181 cf_email='$cf_email'
21182 cf_time='$cf_time'
21183 charsize='$charsize'
21184 chgrp='$chgrp'
21185 chmod='$chmod'
21186 chown='$chown'
21187 clocktype='$clocktype'
21188 comm='$comm'
21189 compress='$compress'
21190 contains='$contains'
21191 cp='$cp'
21192 cpio='$cpio'
21193 cpp='$cpp'
21194 cpp_stuff='$cpp_stuff'
21195 cppccsymbols='$cppccsymbols'
21196 cppflags='$cppflags'
21197 cpplast='$cpplast'
21198 cppminus='$cppminus'
21199 cpprun='$cpprun'
21200 cppstdin='$cppstdin'
21201 cppsymbols='$cppsymbols'
21202 crypt_r_proto='$crypt_r_proto'
21203 cryptlib='$cryptlib'
21204 csh='$csh'
21205 ctermid_r_proto='$ctermid_r_proto'
21206 ctime_r_proto='$ctime_r_proto'
21207 d_Gconvert='$d_Gconvert'
21208 d_PRIEUldbl='$d_PRIEUldbl'
21209 d_PRIFUldbl='$d_PRIFUldbl'
21210 d_PRIGUldbl='$d_PRIGUldbl'
21211 d_PRIXU64='$d_PRIXU64'
21212 d_PRId64='$d_PRId64'
21213 d_PRIeldbl='$d_PRIeldbl'
21214 d_PRIfldbl='$d_PRIfldbl'
21215 d_PRIgldbl='$d_PRIgldbl'
21216 d_PRIi64='$d_PRIi64'
21217 d_PRIo64='$d_PRIo64'
21218 d_PRIu64='$d_PRIu64'
21219 d_PRIx64='$d_PRIx64'
21220 d_SCNfldbl='$d_SCNfldbl'
21221 d__fwalk='$d__fwalk'
21222 d_access='$d_access'
21223 d_accessx='$d_accessx'
21224 d_aintl='$d_aintl'
21225 d_alarm='$d_alarm'
21226 d_archlib='$d_archlib'
21227 d_asctime_r='$d_asctime_r'
21228 d_atolf='$d_atolf'
21229 d_atoll='$d_atoll'
21230 d_attribute_format='$d_attribute_format'
21231 d_attribute_malloc='$d_attribute_malloc'
21232 d_attribute_nonnull='$d_attribute_nonnull'
21233 d_attribute_noreturn='$d_attribute_noreturn'
21234 d_attribute_pure='$d_attribute_pure'
21235 d_attribute_unused='$d_attribute_unused'
21236 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21237 d_bcmp='$d_bcmp'
21238 d_bcopy='$d_bcopy'
21239 d_bsd='$d_bsd'
21240 d_bsdgetpgrp='$d_bsdgetpgrp'
21241 d_bsdsetpgrp='$d_bsdsetpgrp'
21242 d_builtin_choose_expr='$d_builtin_choose_expr'
21243 d_builtin_expect='$d_builtin_expect'
21244 d_bzero='$d_bzero'
21245 d_casti32='$d_casti32'
21246 d_castneg='$d_castneg'
21247 d_charvspr='$d_charvspr'
21248 d_chown='$d_chown'
21249 d_chroot='$d_chroot'
21250 d_chsize='$d_chsize'
21251 d_class='$d_class'
21252 d_clearenv='$d_clearenv'
21253 d_closedir='$d_closedir'
21254 d_cmsghdr_s='$d_cmsghdr_s'
21255 d_const='$d_const'
21256 d_copysignl='$d_copysignl'
21257 d_crypt='$d_crypt'
21258 d_crypt_r='$d_crypt_r'
21259 d_csh='$d_csh'
21260 d_ctermid_r='$d_ctermid_r'
21261 d_ctime_r='$d_ctime_r'
21262 d_cuserid='$d_cuserid'
21263 d_dbl_dig='$d_dbl_dig'
21264 d_dbminitproto='$d_dbminitproto'
21265 d_difftime='$d_difftime'
21266 d_dirfd='$d_dirfd'
21267 d_dirnamlen='$d_dirnamlen'
21268 d_dlerror='$d_dlerror'
21269 d_dlopen='$d_dlopen'
21270 d_dlsymun='$d_dlsymun'
21271 d_dosuid='$d_dosuid'
21272 d_drand48_r='$d_drand48_r'
21273 d_drand48proto='$d_drand48proto'
21274 d_dup2='$d_dup2'
21275 d_eaccess='$d_eaccess'
21276 d_endgrent='$d_endgrent'
21277 d_endgrent_r='$d_endgrent_r'
21278 d_endhent='$d_endhent'
21279 d_endhostent_r='$d_endhostent_r'
21280 d_endnent='$d_endnent'
21281 d_endnetent_r='$d_endnetent_r'
21282 d_endpent='$d_endpent'
21283 d_endprotoent_r='$d_endprotoent_r'
21284 d_endpwent='$d_endpwent'
21285 d_endpwent_r='$d_endpwent_r'
21286 d_endsent='$d_endsent'
21287 d_endservent_r='$d_endservent_r'
21288 d_eofnblk='$d_eofnblk'
21289 d_eunice='$d_eunice'
21290 d_faststdio='$d_faststdio'
21291 d_fchdir='$d_fchdir'
21292 d_fchmod='$d_fchmod'
21293 d_fchown='$d_fchown'
21294 d_fcntl='$d_fcntl'
21295 d_fcntl_can_lock='$d_fcntl_can_lock'
21296 d_fd_macros='$d_fd_macros'
21297 d_fd_set='$d_fd_set'
21298 d_fds_bits='$d_fds_bits'
21299 d_fgetpos='$d_fgetpos'
21300 d_finite='$d_finite'
21301 d_finitel='$d_finitel'
21302 d_flexfnam='$d_flexfnam'
21303 d_flock='$d_flock'
21304 d_flockproto='$d_flockproto'
21305 d_fork='$d_fork'
21306 d_fp_class='$d_fp_class'
21307 d_fpathconf='$d_fpathconf'
21308 d_fpclass='$d_fpclass'
21309 d_fpclassify='$d_fpclassify'
21310 d_fpclassl='$d_fpclassl'
21311 d_fpos64_t='$d_fpos64_t'
21312 d_frexpl='$d_frexpl'
21313 d_fs_data_s='$d_fs_data_s'
21314 d_fseeko='$d_fseeko'
21315 d_fsetpos='$d_fsetpos'
21316 d_fstatfs='$d_fstatfs'
21317 d_fstatvfs='$d_fstatvfs'
21318 d_fsync='$d_fsync'
21319 d_ftello='$d_ftello'
21320 d_ftime='$d_ftime'
21321 d_futimes='$d_futimes'
21322 d_getcwd='$d_getcwd'
21323 d_getespwnam='$d_getespwnam'
21324 d_getfsstat='$d_getfsstat'
21325 d_getgrent='$d_getgrent'
21326 d_getgrent_r='$d_getgrent_r'
21327 d_getgrgid_r='$d_getgrgid_r'
21328 d_getgrnam_r='$d_getgrnam_r'
21329 d_getgrps='$d_getgrps'
21330 d_gethbyaddr='$d_gethbyaddr'
21331 d_gethbyname='$d_gethbyname'
21332 d_gethent='$d_gethent'
21333 d_gethname='$d_gethname'
21334 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21335 d_gethostbyname_r='$d_gethostbyname_r'
21336 d_gethostent_r='$d_gethostent_r'
21337 d_gethostprotos='$d_gethostprotos'
21338 d_getitimer='$d_getitimer'
21339 d_getlogin='$d_getlogin'
21340 d_getlogin_r='$d_getlogin_r'
21341 d_getmnt='$d_getmnt'
21342 d_getmntent='$d_getmntent'
21343 d_getnbyaddr='$d_getnbyaddr'
21344 d_getnbyname='$d_getnbyname'
21345 d_getnent='$d_getnent'
21346 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21347 d_getnetbyname_r='$d_getnetbyname_r'
21348 d_getnetent_r='$d_getnetent_r'
21349 d_getnetprotos='$d_getnetprotos'
21350 d_getpagsz='$d_getpagsz'
21351 d_getpbyname='$d_getpbyname'
21352 d_getpbynumber='$d_getpbynumber'
21353 d_getpent='$d_getpent'
21354 d_getpgid='$d_getpgid'
21355 d_getpgrp2='$d_getpgrp2'
21356 d_getpgrp='$d_getpgrp'
21357 d_getppid='$d_getppid'
21358 d_getprior='$d_getprior'
21359 d_getprotobyname_r='$d_getprotobyname_r'
21360 d_getprotobynumber_r='$d_getprotobynumber_r'
21361 d_getprotoent_r='$d_getprotoent_r'
21362 d_getprotoprotos='$d_getprotoprotos'
21363 d_getprpwnam='$d_getprpwnam'
21364 d_getpwent='$d_getpwent'
21365 d_getpwent_r='$d_getpwent_r'
21366 d_getpwnam_r='$d_getpwnam_r'
21367 d_getpwuid_r='$d_getpwuid_r'
21368 d_getsbyname='$d_getsbyname'
21369 d_getsbyport='$d_getsbyport'
21370 d_getsent='$d_getsent'
21371 d_getservbyname_r='$d_getservbyname_r'
21372 d_getservbyport_r='$d_getservbyport_r'
21373 d_getservent_r='$d_getservent_r'
21374 d_getservprotos='$d_getservprotos'
21375 d_getspnam='$d_getspnam'
21376 d_getspnam_r='$d_getspnam_r'
21377 d_gettimeod='$d_gettimeod'
21378 d_gmtime_r='$d_gmtime_r'
21379 d_gnulibc='$d_gnulibc'
21380 d_grpasswd='$d_grpasswd'
21381 d_hasmntopt='$d_hasmntopt'
21382 d_htonl='$d_htonl'
21383 d_ilogbl='$d_ilogbl'
21384 d_index='$d_index'
21385 d_inetaton='$d_inetaton'
21386 d_int64_t='$d_int64_t'
21387 d_isascii='$d_isascii'
21388 d_isfinite='$d_isfinite'
21389 d_isinf='$d_isinf'
21390 d_isnan='$d_isnan'
21391 d_isnanl='$d_isnanl'
21392 d_killpg='$d_killpg'
21393 d_lchown='$d_lchown'
21394 d_ldbl_dig='$d_ldbl_dig'
21395 d_libm_lib_version='$d_libm_lib_version'
21396 d_link='$d_link'
21397 d_localtime_r='$d_localtime_r'
21398 d_locconv='$d_locconv'
21399 d_lockf='$d_lockf'
21400 d_longdbl='$d_longdbl'
21401 d_longlong='$d_longlong'
21402 d_lseekproto='$d_lseekproto'
21403 d_lstat='$d_lstat'
21404 d_madvise='$d_madvise'
21405 d_malloc_good_size='$d_malloc_good_size'
21406 d_malloc_size='$d_malloc_size'
21407 d_mblen='$d_mblen'
21408 d_mbstowcs='$d_mbstowcs'
21409 d_mbtowc='$d_mbtowc'
21410 d_memchr='$d_memchr'
21411 d_memcmp='$d_memcmp'
21412 d_memcpy='$d_memcpy'
21413 d_memmove='$d_memmove'
21414 d_memset='$d_memset'
21415 d_mkdir='$d_mkdir'
21416 d_mkdtemp='$d_mkdtemp'
21417 d_mkfifo='$d_mkfifo'
21418 d_mkstemp='$d_mkstemp'
21419 d_mkstemps='$d_mkstemps'
21420 d_mktime='$d_mktime'
21421 d_mmap='$d_mmap'
21422 d_modfl='$d_modfl'
21423 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21424 d_modflproto='$d_modflproto'
21425 d_mprotect='$d_mprotect'
21426 d_msg='$d_msg'
21427 d_msg_ctrunc='$d_msg_ctrunc'
21428 d_msg_dontroute='$d_msg_dontroute'
21429 d_msg_oob='$d_msg_oob'
21430 d_msg_peek='$d_msg_peek'
21431 d_msg_proxy='$d_msg_proxy'
21432 d_msgctl='$d_msgctl'
21433 d_msgget='$d_msgget'
21434 d_msghdr_s='$d_msghdr_s'
21435 d_msgrcv='$d_msgrcv'
21436 d_msgsnd='$d_msgsnd'
21437 d_msync='$d_msync'
21438 d_munmap='$d_munmap'
21439 d_mymalloc='$d_mymalloc'
21440 d_nice='$d_nice'
21441 d_nl_langinfo='$d_nl_langinfo'
21442 d_nv_preserves_uv='$d_nv_preserves_uv'
21443 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21444 d_off64_t='$d_off64_t'
21445 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21446 d_oldpthreads='$d_oldpthreads'
21447 d_oldsock='$d_oldsock'
21448 d_open3='$d_open3'
21449 d_pathconf='$d_pathconf'
21450 d_pause='$d_pause'
21451 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21452 d_phostname='$d_phostname'
21453 d_pipe='$d_pipe'
21454 d_poll='$d_poll'
21455 d_portable='$d_portable'
21456 d_procselfexe='$d_procselfexe'
21457 d_pthread_atfork='$d_pthread_atfork'
21458 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21459 d_pthread_yield='$d_pthread_yield'
21460 d_pwage='$d_pwage'
21461 d_pwchange='$d_pwchange'
21462 d_pwclass='$d_pwclass'
21463 d_pwcomment='$d_pwcomment'
21464 d_pwexpire='$d_pwexpire'
21465 d_pwgecos='$d_pwgecos'
21466 d_pwpasswd='$d_pwpasswd'
21467 d_pwquota='$d_pwquota'
21468 d_qgcvt='$d_qgcvt'
21469 d_quad='$d_quad'
21470 d_random_r='$d_random_r'
21471 d_readdir64_r='$d_readdir64_r'
21472 d_readdir='$d_readdir'
21473 d_readdir_r='$d_readdir_r'
21474 d_readlink='$d_readlink'
21475 d_readv='$d_readv'
21476 d_recvmsg='$d_recvmsg'
21477 d_rename='$d_rename'
21478 d_rewinddir='$d_rewinddir'
21479 d_rmdir='$d_rmdir'
21480 d_safebcpy='$d_safebcpy'
21481 d_safemcpy='$d_safemcpy'
21482 d_sanemcmp='$d_sanemcmp'
21483 d_sbrkproto='$d_sbrkproto'
21484 d_scalbnl='$d_scalbnl'
21485 d_sched_yield='$d_sched_yield'
21486 d_scm_rights='$d_scm_rights'
21487 d_seekdir='$d_seekdir'
21488 d_select='$d_select'
21489 d_sem='$d_sem'
21490 d_semctl='$d_semctl'
21491 d_semctl_semid_ds='$d_semctl_semid_ds'
21492 d_semctl_semun='$d_semctl_semun'
21493 d_semget='$d_semget'
21494 d_semop='$d_semop'
21495 d_sendmsg='$d_sendmsg'
21496 d_setegid='$d_setegid'
21497 d_seteuid='$d_seteuid'
21498 d_setgrent='$d_setgrent'
21499 d_setgrent_r='$d_setgrent_r'
21500 d_setgrps='$d_setgrps'
21501 d_sethent='$d_sethent'
21502 d_sethostent_r='$d_sethostent_r'
21503 d_setitimer='$d_setitimer'
21504 d_setlinebuf='$d_setlinebuf'
21505 d_setlocale='$d_setlocale'
21506 d_setlocale_r='$d_setlocale_r'
21507 d_setnent='$d_setnent'
21508 d_setnetent_r='$d_setnetent_r'
21509 d_setpent='$d_setpent'
21510 d_setpgid='$d_setpgid'
21511 d_setpgrp2='$d_setpgrp2'
21512 d_setpgrp='$d_setpgrp'
21513 d_setprior='$d_setprior'
21514 d_setproctitle='$d_setproctitle'
21515 d_setprotoent_r='$d_setprotoent_r'
21516 d_setpwent='$d_setpwent'
21517 d_setpwent_r='$d_setpwent_r'
21518 d_setregid='$d_setregid'
21519 d_setresgid='$d_setresgid'
21520 d_setresuid='$d_setresuid'
21521 d_setreuid='$d_setreuid'
21522 d_setrgid='$d_setrgid'
21523 d_setruid='$d_setruid'
21524 d_setsent='$d_setsent'
21525 d_setservent_r='$d_setservent_r'
21526 d_setsid='$d_setsid'
21527 d_setvbuf='$d_setvbuf'
21528 d_sfio='$d_sfio'
21529 d_shm='$d_shm'
21530 d_shmat='$d_shmat'
21531 d_shmatprototype='$d_shmatprototype'
21532 d_shmctl='$d_shmctl'
21533 d_shmdt='$d_shmdt'
21534 d_shmget='$d_shmget'
21535 d_sigaction='$d_sigaction'
21536 d_sigprocmask='$d_sigprocmask'
21537 d_sigsetjmp='$d_sigsetjmp'
21538 d_snprintf='$d_snprintf'
21539 d_sockatmark='$d_sockatmark'
21540 d_sockatmarkproto='$d_sockatmarkproto'
21541 d_socket='$d_socket'
21542 d_socklen_t='$d_socklen_t'
21543 d_sockpair='$d_sockpair'
21544 d_socks5_init='$d_socks5_init'
21545 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21546 d_sqrtl='$d_sqrtl'
21547 d_srand48_r='$d_srand48_r'
21548 d_srandom_r='$d_srandom_r'
21549 d_sresgproto='$d_sresgproto'
21550 d_sresuproto='$d_sresuproto'
21551 d_statblks='$d_statblks'
21552 d_statfs_f_flags='$d_statfs_f_flags'
21553 d_statfs_s='$d_statfs_s'
21554 d_statvfs='$d_statvfs'
21555 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21556 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21557 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21558 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21559 d_stdio_stream_array='$d_stdio_stream_array'
21560 d_stdiobase='$d_stdiobase'
21561 d_stdstdio='$d_stdstdio'
21562 d_strchr='$d_strchr'
21563 d_strcoll='$d_strcoll'
21564 d_strctcpy='$d_strctcpy'
21565 d_strerrm='$d_strerrm'
21566 d_strerror='$d_strerror'
21567 d_strerror_r='$d_strerror_r'
21568 d_strftime='$d_strftime'
21569 d_strlcat='$d_strlcat'
21570 d_strlcpy='$d_strlcpy'
21571 d_strtod='$d_strtod'
21572 d_strtol='$d_strtol'
21573 d_strtold='$d_strtold'
21574 d_strtoll='$d_strtoll'
21575 d_strtoq='$d_strtoq'
21576 d_strtoul='$d_strtoul'
21577 d_strtoull='$d_strtoull'
21578 d_strtouq='$d_strtouq'
21579 d_strxfrm='$d_strxfrm'
21580 d_suidsafe='$d_suidsafe'
21581 d_symlink='$d_symlink'
21582 d_syscall='$d_syscall'
21583 d_syscallproto='$d_syscallproto'
21584 d_sysconf='$d_sysconf'
21585 d_sysernlst='$d_sysernlst'
21586 d_syserrlst='$d_syserrlst'
21587 d_system='$d_system'
21588 d_tcgetpgrp='$d_tcgetpgrp'
21589 d_tcsetpgrp='$d_tcsetpgrp'
21590 d_telldir='$d_telldir'
21591 d_telldirproto='$d_telldirproto'
21592 d_time='$d_time'
21593 d_times='$d_times'
21594 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21595 d_tm_tm_zone='$d_tm_tm_zone'
21596 d_tmpnam_r='$d_tmpnam_r'
21597 d_truncate='$d_truncate'
21598 d_ttyname_r='$d_ttyname_r'
21599 d_tzname='$d_tzname'
21600 d_u32align='$d_u32align'
21601 d_ualarm='$d_ualarm'
21602 d_umask='$d_umask'
21603 d_uname='$d_uname'
21604 d_union_semun='$d_union_semun'
21605 d_unordered='$d_unordered'
21606 d_unsetenv='$d_unsetenv'
21607 d_usleep='$d_usleep'
21608 d_usleepproto='$d_usleepproto'
21609 d_ustat='$d_ustat'
21610 d_vendorarch='$d_vendorarch'
21611 d_vendorbin='$d_vendorbin'
21612 d_vendorlib='$d_vendorlib'
21613 d_vendorscript='$d_vendorscript'
21614 d_vfork='$d_vfork'
21615 d_void_closedir='$d_void_closedir'
21616 d_voidsig='$d_voidsig'
21617 d_voidtty='$d_voidtty'
21618 d_volatile='$d_volatile'
21619 d_vprintf='$d_vprintf'
21620 d_vsnprintf='$d_vsnprintf'
21621 d_wait4='$d_wait4'
21622 d_waitpid='$d_waitpid'
21623 d_wcstombs='$d_wcstombs'
21624 d_wctomb='$d_wctomb'
21625 d_writev='$d_writev'
21626 d_xenix='$d_xenix'
21627 date='$date'
21628 db_hashtype='$db_hashtype'
21629 db_prefixtype='$db_prefixtype'
21630 db_version_major='$db_version_major'
21631 db_version_minor='$db_version_minor'
21632 db_version_patch='$db_version_patch'
21633 defvoidused='$defvoidused'
21634 direntrytype='$direntrytype'
21635 dlext='$dlext'
21636 dlsrc='$dlsrc'
21637 doublesize='$doublesize'
21638 drand01='$drand01'
21639 drand48_r_proto='$drand48_r_proto'
21640 dynamic_ext='$dynamic_ext'
21641 eagain='$eagain'
21642 ebcdic='$ebcdic'
21643 echo='$echo'
21644 egrep='$egrep'
21645 emacs='$emacs'
21646 endgrent_r_proto='$endgrent_r_proto'
21647 endhostent_r_proto='$endhostent_r_proto'
21648 endnetent_r_proto='$endnetent_r_proto'
21649 endprotoent_r_proto='$endprotoent_r_proto'
21650 endpwent_r_proto='$endpwent_r_proto'
21651 endservent_r_proto='$endservent_r_proto'
21652 eunicefix='$eunicefix'
21653 exe_ext='$exe_ext'
21654 expr='$expr'
21655 extensions='$extensions'
21656 extras='$extras'
21657 fflushNULL='$fflushNULL'
21658 fflushall='$fflushall'
21659 find='$find'
21660 firstmakefile='$firstmakefile'
21661 flex='$flex'
21662 fpossize='$fpossize'
21663 fpostype='$fpostype'
21664 freetype='$freetype'
21665 from='$from'
21666 full_ar='$full_ar'
21667 full_csh='$full_csh'
21668 full_sed='$full_sed'
21669 gccansipedantic='$gccansipedantic'
21670 gccosandvers='$gccosandvers'
21671 gccversion='$gccversion'
21672 getgrent_r_proto='$getgrent_r_proto'
21673 getgrgid_r_proto='$getgrgid_r_proto'
21674 getgrnam_r_proto='$getgrnam_r_proto'
21675 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21676 gethostbyname_r_proto='$gethostbyname_r_proto'
21677 gethostent_r_proto='$gethostent_r_proto'
21678 getlogin_r_proto='$getlogin_r_proto'
21679 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21680 getnetbyname_r_proto='$getnetbyname_r_proto'
21681 getnetent_r_proto='$getnetent_r_proto'
21682 getprotobyname_r_proto='$getprotobyname_r_proto'
21683 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21684 getprotoent_r_proto='$getprotoent_r_proto'
21685 getpwent_r_proto='$getpwent_r_proto'
21686 getpwnam_r_proto='$getpwnam_r_proto'
21687 getpwuid_r_proto='$getpwuid_r_proto'
21688 getservbyname_r_proto='$getservbyname_r_proto'
21689 getservbyport_r_proto='$getservbyport_r_proto'
21690 getservent_r_proto='$getservent_r_proto'
21691 getspnam_r_proto='$getspnam_r_proto'
21692 gidformat='$gidformat'
21693 gidsign='$gidsign'
21694 gidsize='$gidsize'
21695 gidtype='$gidtype'
21696 glibpth='$glibpth'
21697 gmake='$gmake'
21698 gmtime_r_proto='$gmtime_r_proto'
21699 gnulibc_version='$gnulibc_version'
21700 grep='$grep'
21701 groupcat='$groupcat'
21702 groupstype='$groupstype'
21703 gzip='$gzip'
21704 h_fcntl='$h_fcntl'
21705 h_sysfile='$h_sysfile'
21706 hint='$hint'
21707 hostcat='$hostcat'
21708 html1dir='$html1dir'
21709 html1direxp='$html1direxp'
21710 html3dir='$html3dir'
21711 html3direxp='$html3direxp'
21712 i16size='$i16size'
21713 i16type='$i16type'
21714 i32size='$i32size'
21715 i32type='$i32type'
21716 i64size='$i64size'
21717 i64type='$i64type'
21718 i8size='$i8size'
21719 i8type='$i8type'
21720 i_arpainet='$i_arpainet'
21721 i_bsdioctl='$i_bsdioctl'
21722 i_crypt='$i_crypt'
21723 i_db='$i_db'
21724 i_dbm='$i_dbm'
21725 i_dirent='$i_dirent'
21726 i_dld='$i_dld'
21727 i_dlfcn='$i_dlfcn'
21728 i_fcntl='$i_fcntl'
21729 i_float='$i_float'
21730 i_fp='$i_fp'
21731 i_fp_class='$i_fp_class'
21732 i_gdbm='$i_gdbm'
21733 i_grp='$i_grp'
21734 i_ieeefp='$i_ieeefp'
21735 i_inttypes='$i_inttypes'
21736 i_langinfo='$i_langinfo'
21737 i_libutil='$i_libutil'
21738 i_limits='$i_limits'
21739 i_locale='$i_locale'
21740 i_machcthr='$i_machcthr'
21741 i_malloc='$i_malloc'
21742 i_math='$i_math'
21743 i_memory='$i_memory'
21744 i_mntent='$i_mntent'
21745 i_ndbm='$i_ndbm'
21746 i_netdb='$i_netdb'
21747 i_neterrno='$i_neterrno'
21748 i_netinettcp='$i_netinettcp'
21749 i_niin='$i_niin'
21750 i_poll='$i_poll'
21751 i_prot='$i_prot'
21752 i_pthread='$i_pthread'
21753 i_pwd='$i_pwd'
21754 i_rpcsvcdbm='$i_rpcsvcdbm'
21755 i_sfio='$i_sfio'
21756 i_sgtty='$i_sgtty'
21757 i_shadow='$i_shadow'
21758 i_socks='$i_socks'
21759 i_stdarg='$i_stdarg'
21760 i_stddef='$i_stddef'
21761 i_stdlib='$i_stdlib'
21762 i_string='$i_string'
21763 i_sunmath='$i_sunmath'
21764 i_sysaccess='$i_sysaccess'
21765 i_sysdir='$i_sysdir'
21766 i_sysfile='$i_sysfile'
21767 i_sysfilio='$i_sysfilio'
21768 i_sysin='$i_sysin'
21769 i_sysioctl='$i_sysioctl'
21770 i_syslog='$i_syslog'
21771 i_sysmman='$i_sysmman'
21772 i_sysmode='$i_sysmode'
21773 i_sysmount='$i_sysmount'
21774 i_sysndir='$i_sysndir'
21775 i_sysparam='$i_sysparam'
21776 i_sysresrc='$i_sysresrc'
21777 i_syssecrt='$i_syssecrt'
21778 i_sysselct='$i_sysselct'
21779 i_syssockio='$i_syssockio'
21780 i_sysstat='$i_sysstat'
21781 i_sysstatfs='$i_sysstatfs'
21782 i_sysstatvfs='$i_sysstatvfs'
21783 i_systime='$i_systime'
21784 i_systimek='$i_systimek'
21785 i_systimes='$i_systimes'
21786 i_systypes='$i_systypes'
21787 i_sysuio='$i_sysuio'
21788 i_sysun='$i_sysun'
21789 i_sysutsname='$i_sysutsname'
21790 i_sysvfs='$i_sysvfs'
21791 i_syswait='$i_syswait'
21792 i_termio='$i_termio'
21793 i_termios='$i_termios'
21794 i_time='$i_time'
21795 i_unistd='$i_unistd'
21796 i_ustat='$i_ustat'
21797 i_utime='$i_utime'
21798 i_values='$i_values'
21799 i_varargs='$i_varargs'
21800 i_varhdr='$i_varhdr'
21801 i_vfork='$i_vfork'
21802 ignore_versioned_solibs='$ignore_versioned_solibs'
21803 inc_version_list='$inc_version_list'
21804 inc_version_list_init='$inc_version_list_init'
21805 incpath='$incpath'
21806 inews='$inews'
21807 installarchlib='$installarchlib'
21808 installbin='$installbin'
21809 installhtml1dir='$installhtml1dir'
21810 installhtml3dir='$installhtml3dir'
21811 installman1dir='$installman1dir'
21812 installman3dir='$installman3dir'
21813 installprefix='$installprefix'
21814 installprefixexp='$installprefixexp'
21815 installprivlib='$installprivlib'
21816 installscript='$installscript'
21817 installsitearch='$installsitearch'
21818 installsitebin='$installsitebin'
21819 installsitehtml1dir='$installsitehtml1dir'
21820 installsitehtml3dir='$installsitehtml3dir'
21821 installsitelib='$installsitelib'
21822 installsiteman1dir='$installsiteman1dir'
21823 installsiteman3dir='$installsiteman3dir'
21824 installsitescript='$installsitescript'
21825 installstyle='$installstyle'
21826 installusrbinperl='$installusrbinperl'
21827 installvendorarch='$installvendorarch'
21828 installvendorbin='$installvendorbin'
21829 installvendorhtml1dir='$installvendorhtml1dir'
21830 installvendorhtml3dir='$installvendorhtml3dir'
21831 installvendorlib='$installvendorlib'
21832 installvendorman1dir='$installvendorman1dir'
21833 installvendorman3dir='$installvendorman3dir'
21834 installvendorscript='$installvendorscript'
21835 intsize='$intsize'
21836 issymlink='$issymlink'
21837 ivdformat='$ivdformat'
21838 ivsize='$ivsize'
21839 ivtype='$ivtype'
21840 known_extensions='$known_extensions'
21841 ksh='$ksh'
21842 ld='$ld'
21843 lddlflags='$lddlflags'
21844 ldflags='$ldflags'
21845 ldflags_uselargefiles='$ldflags_uselargefiles'
21846 ldlibpthname='$ldlibpthname'
21847 less='$less'
21848 lib_ext='$lib_ext'
21849 libc='$libc'
21850 libperl='$libperl'
21851 libpth='$libpth'
21852 libs='$libs'
21853 libsdirs='$libsdirs'
21854 libsfiles='$libsfiles'
21855 libsfound='$libsfound'
21856 libspath='$libspath'
21857 libswanted='$libswanted'
21858 libswanted_uselargefiles='$libswanted_uselargefiles'
21859 line='$line'
21860 lint='$lint'
21861 lkflags='$lkflags'
21862 ln='$ln'
21863 lns='$lns'
21864 localtime_r_proto='$localtime_r_proto'
21865 locincpth='$locincpth'
21866 loclibpth='$loclibpth'
21867 longdblsize='$longdblsize'
21868 longlongsize='$longlongsize'
21869 longsize='$longsize'
21870 lp='$lp'
21871 lpr='$lpr'
21872 ls='$ls'
21873 lseeksize='$lseeksize'
21874 lseektype='$lseektype'
21875 mail='$mail'
21876 mailx='$mailx'
21877 make='$make'
21878 make_set_make='$make_set_make'
21879 mallocobj='$mallocobj'
21880 mallocsrc='$mallocsrc'
21881 malloctype='$malloctype'
21882 man1dir='$man1dir'
21883 man1direxp='$man1direxp'
21884 man1ext='$man1ext'
21885 man3dir='$man3dir'
21886 man3direxp='$man3direxp'
21887 man3ext='$man3ext'
21888 mips_type='$mips_type'
21889 mistrustnm='$mistrustnm'
21890 mkdir='$mkdir'
21891 mmaptype='$mmaptype'
21892 modetype='$modetype'
21893 more='$more'
21894 multiarch='$multiarch'
21895 mv='$mv'
21896 myarchname='$myarchname'
21897 mydomain='$mydomain'
21898 myhostname='$myhostname'
21899 myuname='$myuname'
21900 n='$n'
21901 need_va_copy='$need_va_copy'
21902 netdb_hlen_type='$netdb_hlen_type'
21903 netdb_host_type='$netdb_host_type'
21904 netdb_name_type='$netdb_name_type'
21905 netdb_net_type='$netdb_net_type'
21906 nm='$nm'
21907 nm_opt='$nm_opt'
21908 nm_so_opt='$nm_so_opt'
21909 nonxs_ext='$nonxs_ext'
21910 nroff='$nroff'
21911 nvEUformat='$nvEUformat'
21912 nvFUformat='$nvFUformat'
21913 nvGUformat='$nvGUformat'
21914 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21915 nveformat='$nveformat'
21916 nvfformat='$nvfformat'
21917 nvgformat='$nvgformat'
21918 nvsize='$nvsize'
21919 nvtype='$nvtype'
21920 o_nonblock='$o_nonblock'
21921 obj_ext='$obj_ext'
21922 old_pthread_create_joinable='$old_pthread_create_joinable'
21923 optimize='$optimize'
21924 orderlib='$orderlib'
21925 osname='$osname'
21926 osvers='$osvers'
21927 otherlibdirs='$otherlibdirs'
21928 package='$package'
21929 pager='$pager'
21930 passcat='$passcat'
21931 patchlevel='$patchlevel'
21932 path_sep='$path_sep'
21933 perl5='$perl5'
21934 perl='$perl'
21935 perl_patchlevel='$perl_patchlevel'
21936 perladmin='$perladmin'
21937 perllibs='$perllibs'
21938 perlpath='$perlpath'
21939 pg='$pg'
21940 phostname='$phostname'
21941 pidtype='$pidtype'
21942 plibpth='$plibpth'
21943 pmake='$pmake'
21944 pr='$pr'
21945 prefix='$prefix'
21946 prefixexp='$prefixexp'
21947 privlib='$privlib'
21948 privlibexp='$privlibexp'
21949 procselfexe='$procselfexe'
21950 prototype='$prototype'
21951 ptrsize='$ptrsize'
21952 quadkind='$quadkind'
21953 quadtype='$quadtype'
21954 randbits='$randbits'
21955 randfunc='$randfunc'
21956 random_r_proto='$random_r_proto'
21957 randseedtype='$randseedtype'
21958 ranlib='$ranlib'
21959 rd_nodata='$rd_nodata'
21960 readdir64_r_proto='$readdir64_r_proto'
21961 readdir_r_proto='$readdir_r_proto'
21962 revision='$revision'
21963 rm='$rm'
21964 rmail='$rmail'
21965 run='$run'
21966 runnm='$runnm'
21967 sPRIEUldbl='$sPRIEUldbl'
21968 sPRIFUldbl='$sPRIFUldbl'
21969 sPRIGUldbl='$sPRIGUldbl'
21970 sPRIXU64='$sPRIXU64'
21971 sPRId64='$sPRId64'
21972 sPRIeldbl='$sPRIeldbl'
21973 sPRIfldbl='$sPRIfldbl'
21974 sPRIgldbl='$sPRIgldbl'
21975 sPRIi64='$sPRIi64'
21976 sPRIo64='$sPRIo64'
21977 sPRIu64='$sPRIu64'
21978 sPRIx64='$sPRIx64'
21979 sSCNfldbl='$sSCNfldbl'
21980 sched_yield='$sched_yield'
21981 scriptdir='$scriptdir'
21982 scriptdirexp='$scriptdirexp'
21983 sed='$sed'
21984 seedfunc='$seedfunc'
21985 selectminbits='$selectminbits'
21986 selecttype='$selecttype'
21987 sendmail='$sendmail'
21988 setgrent_r_proto='$setgrent_r_proto'
21989 sethostent_r_proto='$sethostent_r_proto'
21990 setlocale_r_proto='$setlocale_r_proto'
21991 setnetent_r_proto='$setnetent_r_proto'
21992 setprotoent_r_proto='$setprotoent_r_proto'
21993 setpwent_r_proto='$setpwent_r_proto'
21994 setservent_r_proto='$setservent_r_proto'
21995 sh='$sh'
21996 shar='$shar'
21997 sharpbang='$sharpbang'
21998 shmattype='$shmattype'
21999 shortsize='$shortsize'
22000 shrpenv='$shrpenv'
22001 shsharp='$shsharp'
22002 sig_count='$sig_count'
22003 sig_name='$sig_name'
22004 sig_name_init='$sig_name_init'
22005 sig_num='$sig_num'
22006 sig_num_init='$sig_num_init'
22007 sig_size='$sig_size'
22008 signal_t='$signal_t'
22009 sitearch='$sitearch'
22010 sitearchexp='$sitearchexp'
22011 sitebin='$sitebin'
22012 sitebinexp='$sitebinexp'
22013 sitehtml1dir='$sitehtml1dir'
22014 sitehtml1direxp='$sitehtml1direxp'
22015 sitehtml3dir='$sitehtml3dir'
22016 sitehtml3direxp='$sitehtml3direxp'
22017 sitelib='$sitelib'
22018 sitelib_stem='$sitelib_stem'
22019 sitelibexp='$sitelibexp'
22020 siteman1dir='$siteman1dir'
22021 siteman1direxp='$siteman1direxp'
22022 siteman3dir='$siteman3dir'
22023 siteman3direxp='$siteman3direxp'
22024 siteprefix='$siteprefix'
22025 siteprefixexp='$siteprefixexp'
22026 sitescript='$sitescript'
22027 sitescriptexp='$sitescriptexp'
22028 sizesize='$sizesize'
22029 sizetype='$sizetype'
22030 sleep='$sleep'
22031 smail='$smail'
22032 so='$so'
22033 sockethdr='$sockethdr'
22034 socketlib='$socketlib'
22035 socksizetype='$socksizetype'
22036 sort='$sort'
22037 spackage='$spackage'
22038 spitshell='$spitshell'
22039 srand48_r_proto='$srand48_r_proto'
22040 srandom_r_proto='$srandom_r_proto'
22041 src='$src'
22042 ssizetype='$ssizetype'
22043 startperl='$startperl'
22044 startsh='$startsh'
22045 static_ext='$static_ext'
22046 stdchar='$stdchar'
22047 stdio_base='$stdio_base'
22048 stdio_bufsiz='$stdio_bufsiz'
22049 stdio_cnt='$stdio_cnt'
22050 stdio_filbuf='$stdio_filbuf'
22051 stdio_ptr='$stdio_ptr'
22052 stdio_stream_array='$stdio_stream_array'
22053 strerror_r_proto='$strerror_r_proto'
22054 strings='$strings'
22055 submit='$submit'
22056 subversion='$subversion'
22057 sysman='$sysman'
22058 tail='$tail'
22059 tar='$tar'
22060 targetarch='$targetarch'
22061 tbl='$tbl'
22062 tee='$tee'
22063 test='$test'
22064 timeincl='$timeincl'
22065 timetype='$timetype'
22066 tmpnam_r_proto='$tmpnam_r_proto'
22067 to='$to'
22068 touch='$touch'
22069 tr='$tr'
22070 trnl='$trnl'
22071 troff='$troff'
22072 ttyname_r_proto='$ttyname_r_proto'
22073 u16size='$u16size'
22074 u16type='$u16type'
22075 u32size='$u32size'
22076 u32type='$u32type'
22077 u64size='$u64size'
22078 u64type='$u64type'
22079 u8size='$u8size'
22080 u8type='$u8type'
22081 uidformat='$uidformat'
22082 uidsign='$uidsign'
22083 uidsize='$uidsize'
22084 uidtype='$uidtype'
22085 uname='$uname'
22086 uniq='$uniq'
22087 uquadtype='$uquadtype'
22088 use5005threads='$use5005threads'
22089 use64bitall='$use64bitall'
22090 use64bitint='$use64bitint'
22091 usecrosscompile='$usecrosscompile'
22092 usedl='$usedl'
22093 usefaststdio='$usefaststdio'
22094 useithreads='$useithreads'
22095 uselargefiles='$uselargefiles'
22096 uselongdouble='$uselongdouble'
22097 usemallocwrap='$usemallocwrap'
22098 usemorebits='$usemorebits'
22099 usemultiplicity='$usemultiplicity'
22100 usemymalloc='$usemymalloc'
22101 usenm='$usenm'
22102 useopcode='$useopcode'
22103 useperlio='$useperlio'
22104 useposix='$useposix'
22105 usereentrant='$usereentrant'
22106 userelocatableinc='$userelocatableinc'
22107 usesfio='$usesfio'
22108 useshrplib='$useshrplib'
22109 usesitecustomize='$usesitecustomize'
22110 usesocks='$usesocks'
22111 usethreads='$usethreads'
22112 usevendorprefix='$usevendorprefix'
22113 usevfork='$usevfork'
22114 usrinc='$usrinc'
22115 uuname='$uuname'
22116 uvXUformat='$uvXUformat'
22117 uvoformat='$uvoformat'
22118 uvsize='$uvsize'
22119 uvtype='$uvtype'
22120 uvuformat='$uvuformat'
22121 uvxformat='$uvxformat'
22122 vendorarch='$vendorarch'
22123 vendorarchexp='$vendorarchexp'
22124 vendorbin='$vendorbin'
22125 vendorbinexp='$vendorbinexp'
22126 vendorhtml1dir='$vendorhtml1dir'
22127 vendorhtml1direxp='$vendorhtml1direxp'
22128 vendorhtml3dir='$vendorhtml3dir'
22129 vendorhtml3direxp='$vendorhtml3direxp'
22130 vendorlib='$vendorlib'
22131 vendorlib_stem='$vendorlib_stem'
22132 vendorlibexp='$vendorlibexp'
22133 vendorman1dir='$vendorman1dir'
22134 vendorman1direxp='$vendorman1direxp'
22135 vendorman3dir='$vendorman3dir'
22136 vendorman3direxp='$vendorman3direxp'
22137 vendorprefix='$vendorprefix'
22138 vendorprefixexp='$vendorprefixexp'
22139 vendorscript='$vendorscript'
22140 vendorscriptexp='$vendorscriptexp'
22141 version='$version'
22142 version_patchlevel_string='$version_patchlevel_string'
22143 versiononly='$versiononly'
22144 vi='$vi'
22145 voidflags='$voidflags'
22146 xlibpth='$xlibpth'
22147 yacc='$yacc'
22148 yaccflags='$yaccflags'
22149 zcat='$zcat'
22150 zip='$zip'
22151 EOT
22152
22153 : Add in command line options if available
22154 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22155
22156 : add special variables
22157 $test -f $src/patchlevel.h && \
22158 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22159 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22160 echo "PERL_CONFIG_SH=true" >>config.sh
22161
22162 : propagate old symbols
22163 if $test -f UU/config.sh; then
22164         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22165         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22166         $sort | $uniq -u >UU/oldsyms
22167         set X `cat UU/oldsyms`
22168         shift
22169         case $# in
22170         0) ;;
22171         *)
22172                 cat <<EOM
22173 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22174 EOM
22175                 echo "# Variables propagated from previous config.sh file." >>config.sh
22176                 for sym in `cat UU/oldsyms`; do
22177                         echo "    Propagating $hint variable "'$'"$sym..."
22178                         eval 'tmp="$'"${sym}"'"'
22179                         echo "$tmp" | \
22180                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22181                 done
22182                 ;;
22183         esac
22184 fi
22185
22186 : Finish up by extracting the .SH files
22187 case "$alldone" in
22188 exit)
22189         $rm -rf UU
22190         echo "Extraction done."
22191         exit 0
22192         ;;
22193 cont)
22194         ;;
22195 '')
22196         dflt=''
22197         nostick=true
22198         $cat <<EOM
22199
22200 If you'd like to make any changes to the config.sh file before I begin
22201 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22202
22203 EOM
22204         rp="Press return or use a shell escape to edit config.sh:"
22205         . UU/myread
22206         nostick=''
22207         case "$ans" in
22208         '') ;;
22209         *) : in case they cannot read
22210                 sh 1>&4 -c "$ans";;
22211         esac
22212         ;;
22213 esac
22214
22215 : if this fails, just run all the .SH files by hand
22216 . ./config.sh
22217
22218 echo " "
22219 exec 1>&4
22220 pwd=`pwd`
22221 . ./UU/extract
22222 cd "$pwd"
22223
22224 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22225         dflt=y
22226         case "$silent" in
22227         true) ;;
22228         *)
22229                 $cat <<EOM
22230
22231 Now you need to generate make dependencies by running "$make depend".
22232 You might prefer to run it in background: "$make depend > makedepend.out &"
22233 It can take a while, so you might not want to run it right now.
22234
22235 EOM
22236                 ;;
22237         esac
22238         rp="Run $make depend now?"
22239         . UU/myread
22240         case "$ans" in
22241         y*)
22242                 $make depend && echo "Now you must run '$make'."
22243                 ;;
22244         *)
22245                 echo "You must run '$make depend' then '$make'."
22246                 ;;
22247         esac
22248 elif test -f [Mm]akefile; then
22249         echo " "
22250         echo "Now you must run a $make."
22251 else
22252         echo "Configure done."
22253 fi
22254
22255 if $test -f Policy.sh; then
22256     $cat <<EOM
22257
22258 If you compile $package on a different machine or from a different object
22259 directory, copy the Policy.sh file from this object directory to the
22260 new one before you run Configure -- this will help you with most of
22261 the policy defaults.
22262
22263 EOM
22264 fi
22265 if $test -f config.msg; then
22266     echo "Hmm.  I also noted the following information while running:"
22267     echo " "
22268     $cat config.msg >&4
22269     $rm -f config.msg
22270 fi
22271 $rm -f kit*isdone ark*isdone
22272 $rm -rf UU
22273
22274 : End of Configure
22275