This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
Re: -Os for Darwin why?
[perl5.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Mon Feb  3 15:49:19 EET 2003 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
51         cat >&4 <<EOF
52 ***
53 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
55 *** Please read the README.plan9 for further instructions.
56 *** Cannot continue, aborting.
57 ***
58 EOF
59         exit 1
60 fi
61
62 : compute my invocation name
63 me=$0
64 case "$0" in
65 */*)
66         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67         test "$me" || me=$0
68         ;;
69 esac
70
71 : Proper separator for the PATH environment variable
72 p_=:
73 : On OS/2 this directory should exist if this is not floppy only system :-]
74 if test -d c:/. ; then
75     if test -n "$OS2_SHELL"; then
76                 p_=\;
77                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
79         elif test -n "$DJGPP"; then
80                 case "X${MACHTYPE:-nonesuchmach}" in
81                 *cygwin) ;;
82                 *) p_=\; ;;
83                 esac
84         fi
85 fi
86
87 : Proper PATH setting
88 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
89 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
90 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
91 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
92 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
93 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
94 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
95 paths="$paths /sbin /usr/sbin /usr/libexec"
96 paths="$paths /system/gnu_library/bin"
97
98 for p in $paths
99 do
100         case "$p_$PATH$p_" in
101         *$p_$p$p_*) ;;
102         *) test -d $p && PATH=$PATH$p_$p ;;
103         esac
104 done
105
106 PATH=.$p_$PATH
107 export PATH
108
109 : shall we be using ksh?
110 inksh=''
111 needksh=''
112 avoidksh=''
113 newsh=/bin/ksh
114 changesh=''
115 if (PATH=.; alias -x) >/dev/null 2>&1; then
116                 inksh=true
117 fi
118 if test -f /hp-ux -a -f /bin/ksh; then
119         needksh='to avoid sh bug in "here document" expansion'
120 fi
121 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
122         if test X`/usr/bin/uname -v` = X4; then
123                 avoidksh="to avoid AIX 4's /bin/sh"
124                 newsh=/usr/bin/bsh
125         fi
126 fi
127 if test -f /osf_boot -a -f /usr/sbin/setld; then
128         if test X`/usr/bin/uname -s` = XOSF1; then
129                 avoidksh="to avoid Digital UNIX' ksh"
130                 newsh=/bin/sh
131                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
132         fi
133 fi
134 case "$inksh/$needksh" in
135 /[a-z]*)
136                 ENV=''
137                 changesh=true
138                 reason="$needksh"
139         ;;
140 esac
141 case "$inksh/$avoidksh" in
142 true/[a-z]*)
143         changesh=true
144         reason="$avoidksh"
145         ;;
146 esac
147 case "$inksh/$needksh-$avoidksh-" in
148 true/--)
149                 cat <<EOM
150 (I see you are using the Korn shell.  Some ksh's blow up on $me,
151 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
152 EOM
153         ;;
154 esac
155 case "$changesh" in
156 true)
157         export newsh
158         echo "(Feeding myself to $newsh $reason.)"
159         case "$0" in
160         Configure|*/Configure) exec $newsh $0 "$@";;
161         *) exec $newsh Configure "$@";;
162         esac
163         ;;
164 esac
165
166 : if needed set CDPATH to a harmless value that is not chatty
167 : avoid bash 2.02 problems with empty CDPATH.
168 case "$CDPATH" in
169 '')     ;;
170 *)      case "$SHELL" in
171         *bash*) CDPATH='.' ;;
172         *)              CDPATH='' ;;
173         esac
174         ;;
175 esac
176 : Configure runs within the UU subdirectory
177 test -d UU || mkdir UU
178 cd UU && rm -f ./*
179
180 ccname=''
181 ccversion=''
182 ccsymbols=''
183 cppccsymbols=''
184 cppsymbols=''
185 from=''
186 run=''
187 targetarch=''
188 to=''
189 usecrosscompile=''
190 perllibs=''
191 dynamic_ext=''
192 extensions=''
193 known_extensions=''
194 nonxs_ext=''
195 static_ext=''
196 useopcode=''
197 useposix=''
198 extras=''
199 d_bsd=''
200 d_eunice=''
201 d_xenix=''
202 eunicefix=''
203 Mcc=''
204 ar=''
205 awk=''
206 bash=''
207 bison=''
208 byacc=''
209 cat=''
210 chgrp=''
211 chmod=''
212 chown=''
213 comm=''
214 compress=''
215 cp=''
216 cpio=''
217 cpp=''
218 csh=''
219 date=''
220 echo=''
221 egrep=''
222 emacs=''
223 expr=''
224 find=''
225 flex=''
226 gmake=''
227 grep=''
228 gzip=''
229 inews=''
230 ksh=''
231 less=''
232 line=''
233 lint=''
234 ln=''
235 lp=''
236 lpr=''
237 ls=''
238 mail=''
239 mailx=''
240 make=''
241 mkdir=''
242 more=''
243 mv=''
244 nm=''
245 nroff=''
246 perl=''
247 pg=''
248 pmake=''
249 pr=''
250 rm=''
251 rmail=''
252 sed=''
253 sendmail=''
254 shar=''
255 sleep=''
256 smail=''
257 sort=''
258 submit=''
259 tail=''
260 tar=''
261 tbl=''
262 tee=''
263 test=''
264 touch=''
265 tr=''
266 troff=''
267 uname=''
268 uniq=''
269 uuname=''
270 vi=''
271 zcat=''
272 zip=''
273 full_ar=''
274 full_sed=''
275 libswanted=''
276 hint=''
277 myuname=''
278 osname=''
279 osvers=''
280 Author=''
281 Date=''
282 Header=''
283 Id=''
284 Locker=''
285 Log=''
286 RCSfile=''
287 Revision=''
288 Source=''
289 State=''
290 _a=''
291 _exe=''
292 _o=''
293 archobjs=''
294 exe_ext=''
295 firstmakefile=''
296 lib_ext=''
297 obj_ext=''
298 path_sep=''
299 afs=''
300 afsroot=''
301 alignbytes=''
302 ansi2knr=''
303 archlib=''
304 archlibexp=''
305 d_archlib=''
306 installarchlib=''
307 archname=''
308 myarchname=''
309 d_atolf=''
310 d_atoll=''
311 baserev=''
312 bin=''
313 binexp=''
314 installbin=''
315 byteorder=''
316 cc=''
317 ccflags=''
318 cppflags=''
319 ldflags=''
320 lkflags=''
321 locincpth=''
322 optimize=''
323 cf_email=''
324 cf_by=''
325 cf_time=''
326 charsize=''
327 contains=''
328 cpp_stuff=''
329 cpplast=''
330 cppminus=''
331 cpprun=''
332 cppstdin=''
333 d__fwalk=''
334 d_access=''
335 d_accessx=''
336 d_alarm=''
337 asctime_r_proto=''
338 d_asctime_r=''
339 d_attribut=''
340 d_bcmp=''
341 d_bcopy=''
342 d_bzero=''
343 d_casti32=''
344 castflags=''
345 d_castneg=''
346 d_chown=''
347 d_chroot=''
348 d_chsize=''
349 d_class=''
350 d_closedir=''
351 d_void_closedir=''
352 d_cmsghdr_s=''
353 d_const=''
354 cryptlib=''
355 d_crypt=''
356 crypt_r_proto=''
357 d_crypt_r=''
358 d_csh=''
359 full_csh=''
360 ctermid_r_proto=''
361 d_ctermid_r=''
362 ctime_r_proto=''
363 d_ctime_r=''
364 d_cuserid=''
365 d_dbl_dig=''
366 d_dbminitproto=''
367 d_difftime=''
368 d_dirfd=''
369 d_dlerror=''
370 d_dlopen=''
371 d_dlsymun=''
372 d_dosuid=''
373 d_suidsafe=''
374 d_drand48_r=''
375 drand48_r_proto=''
376 d_drand48proto=''
377 d_dup2=''
378 d_eaccess=''
379 d_endgrent=''
380 d_endgrent_r=''
381 endgrent_r_proto=''
382 d_endhent=''
383 d_endhostent_r=''
384 endhostent_r_proto=''
385 d_endnent=''
386 d_endnetent_r=''
387 endnetent_r_proto=''
388 d_endpent=''
389 d_endprotoent_r=''
390 endprotoent_r_proto=''
391 d_endpwent=''
392 d_endpwent_r=''
393 endpwent_r_proto=''
394 d_endsent=''
395 d_endservent_r=''
396 endservent_r_proto=''
397 d_fchdir=''
398 d_fchmod=''
399 d_fchown=''
400 d_fcntl=''
401 d_fcntl_can_lock=''
402 d_fd_macros=''
403 d_fd_set=''
404 d_fds_bits=''
405 d_fgetpos=''
406 d_finite=''
407 d_finitel=''
408 d_flexfnam=''
409 d_flock=''
410 d_flockproto=''
411 d_fork=''
412 d_fp_class=''
413 d_fpclass=''
414 d_fpclassify=''
415 d_fpclassl=''
416 d_fpos64_t=''
417 d_frexpl=''
418 d_fs_data_s=''
419 d_fseeko=''
420 d_fsetpos=''
421 d_fstatfs=''
422 d_fsync=''
423 d_ftello=''
424 d_ftime=''
425 d_gettimeod=''
426 d_Gconvert=''
427 d_getcwd=''
428 d_getespwnam=''
429 d_getfsstat=''
430 d_getgrent=''
431 d_getgrent_r=''
432 getgrent_r_proto=''
433 d_getgrgid_r=''
434 getgrgid_r_proto=''
435 d_getgrnam_r=''
436 getgrnam_r_proto=''
437 d_getgrps=''
438 d_gethbyaddr=''
439 d_gethbyname=''
440 d_gethent=''
441 aphostname=''
442 d_gethname=''
443 d_phostname=''
444 d_uname=''
445 d_gethostbyaddr_r=''
446 gethostbyaddr_r_proto=''
447 d_gethostbyname_r=''
448 gethostbyname_r_proto=''
449 d_gethostent_r=''
450 gethostent_r_proto=''
451 d_gethostprotos=''
452 d_getitimer=''
453 d_getlogin=''
454 d_getlogin_r=''
455 getlogin_r_proto=''
456 d_getmnt=''
457 d_getmntent=''
458 d_getnbyaddr=''
459 d_getnbyname=''
460 d_getnent=''
461 d_getnetbyaddr_r=''
462 getnetbyaddr_r_proto=''
463 d_getnetbyname_r=''
464 getnetbyname_r_proto=''
465 d_getnetent_r=''
466 getnetent_r_proto=''
467 d_getnetprotos=''
468 d_getpagsz=''
469 d_getpent=''
470 d_getpgid=''
471 d_getpgrp2=''
472 d_bsdgetpgrp=''
473 d_getpgrp=''
474 d_getppid=''
475 d_getprior=''
476 d_getpbyname=''
477 d_getpbynumber=''
478 d_getprotobyname_r=''
479 getprotobyname_r_proto=''
480 d_getprotobynumber_r=''
481 getprotobynumber_r_proto=''
482 d_getprotoent_r=''
483 getprotoent_r_proto=''
484 d_getprotoprotos=''
485 d_getprpwnam=''
486 d_getpwent=''
487 d_getpwent_r=''
488 getpwent_r_proto=''
489 d_getpwnam_r=''
490 getpwnam_r_proto=''
491 d_getpwuid_r=''
492 getpwuid_r_proto=''
493 d_getsent=''
494 d_getservbyname_r=''
495 getservbyname_r_proto=''
496 d_getservbyport_r=''
497 getservbyport_r_proto=''
498 d_getservent_r=''
499 getservent_r_proto=''
500 d_getservprotos=''
501 d_getspnam=''
502 d_getspnam_r=''
503 getspnam_r_proto=''
504 d_getsbyname=''
505 d_getsbyport=''
506 d_gmtime_r=''
507 gmtime_r_proto=''
508 d_gnulibc=''
509 gnulibc_version=''
510 d_hasmntopt=''
511 d_htonl=''
512 d_inetaton=''
513 d_int64_t=''
514 d_isascii=''
515 d_isfinite=''
516 d_isinf=''
517 d_isnan=''
518 d_isnanl=''
519 d_killpg=''
520 d_lchown=''
521 d_ldbl_dig=''
522 d_link=''
523 d_localtime_r=''
524 localtime_r_proto=''
525 d_locconv=''
526 d_lockf=''
527 d_longdbl=''
528 longdblsize=''
529 d_longlong=''
530 longlongsize=''
531 d_lseekproto=''
532 d_lstat=''
533 d_madvise=''
534 d_mblen=''
535 d_mbstowcs=''
536 d_mbtowc=''
537 d_memchr=''
538 d_memcmp=''
539 d_memcpy=''
540 d_memmove=''
541 d_memset=''
542 d_mkdir=''
543 d_mkdtemp=''
544 d_mkfifo=''
545 d_mkstemp=''
546 d_mkstemps=''
547 d_mktime=''
548 d_mmap=''
549 mmaptype=''
550 d_modfl=''
551 d_modfl_pow32_bug=''
552 d_modflproto=''
553 d_mprotect=''
554 d_msg=''
555 d_msgctl=''
556 d_msgget=''
557 d_msghdr_s=''
558 d_msgrcv=''
559 d_msgsnd=''
560 d_msync=''
561 d_munmap=''
562 d_nanosleep=''
563 d_nice=''
564 d_nl_langinfo=''
565 d_off64_t=''
566 d_open3=''
567 d_fpathconf=''
568 d_pathconf=''
569 d_pause=''
570 d_pipe=''
571 d_poll=''
572 d_portable=''
573 d_procselfexe=''
574 procselfexe=''
575 d_old_pthread_create_joinable=''
576 old_pthread_create_joinable=''
577 d_pthread_atfork=''
578 d_pthread_yield=''
579 d_sched_yield=''
580 sched_yield=''
581 d_qgcvt=''
582 d_random_r=''
583 random_r_proto=''
584 d_readdir64_r=''
585 readdir64_r_proto=''
586 d_readdir=''
587 d_rewinddir=''
588 d_seekdir=''
589 d_telldir=''
590 d_readdir_r=''
591 readdir_r_proto=''
592 d_readlink=''
593 d_readv=''
594 d_recvmsg=''
595 d_rename=''
596 d_rmdir=''
597 d_safebcpy=''
598 d_safemcpy=''
599 d_sanemcmp=''
600 d_sbrkproto=''
601 d_select=''
602 d_sem=''
603 d_semctl=''
604 d_semget=''
605 d_semop=''
606 d_sendmsg=''
607 d_setegid=''
608 d_seteuid=''
609 d_setgrent=''
610 d_setgrent_r=''
611 setgrent_r_proto=''
612 d_setgrps=''
613 d_sethent=''
614 d_sethostent_r=''
615 sethostent_r_proto=''
616 d_setitimer=''
617 d_setlinebuf=''
618 d_setlocale=''
619 d_setlocale_r=''
620 setlocale_r_proto=''
621 d_setnent=''
622 d_setnetent_r=''
623 setnetent_r_proto=''
624 d_setpent=''
625 d_setpgid=''
626 d_setpgrp2=''
627 d_bsdsetpgrp=''
628 d_setpgrp=''
629 d_setprior=''
630 d_setproctitle=''
631 d_setprotoent_r=''
632 setprotoent_r_proto=''
633 d_setpwent=''
634 d_setpwent_r=''
635 setpwent_r_proto=''
636 d_setregid=''
637 d_setresgid=''
638 d_setresuid=''
639 d_setreuid=''
640 d_setrgid=''
641 d_setruid=''
642 d_setsent=''
643 d_setservent_r=''
644 setservent_r_proto=''
645 d_setsid=''
646 d_setvbuf=''
647 d_sfio=''
648 usesfio=''
649 d_shm=''
650 d_shmat=''
651 d_shmatprototype=''
652 shmattype=''
653 d_shmctl=''
654 d_shmdt=''
655 d_shmget=''
656 d_sigaction=''
657 d_sigprocmask=''
658 d_sigsetjmp=''
659 d_sockatmark=''
660 d_sockatmarkproto=''
661 d_msg_ctrunc=''
662 d_msg_dontroute=''
663 d_msg_oob=''
664 d_msg_peek=''
665 d_msg_proxy=''
666 d_oldsock=''
667 d_scm_rights=''
668 d_socket=''
669 d_sockpair=''
670 sockethdr=''
671 socketlib=''
672 d_socklen_t=''
673 d_socks5_init=''
674 d_sqrtl=''
675 d_srand48_r=''
676 srand48_r_proto=''
677 d_srandom_r=''
678 srandom_r_proto=''
679 d_sresgproto=''
680 d_sresuproto=''
681 d_statblks=''
682 d_statfs_f_flags=''
683 d_statfs_s=''
684 d_fstatvfs=''
685 d_statvfs=''
686 d_stdio_cnt_lval=''
687 d_stdio_ptr_lval=''
688 d_stdio_ptr_lval_nochange_cnt=''
689 d_stdio_ptr_lval_sets_cnt=''
690 d_stdiobase=''
691 d_stdstdio=''
692 stdio_base=''
693 stdio_bufsiz=''
694 stdio_cnt=''
695 stdio_filbuf=''
696 stdio_ptr=''
697 d_index=''
698 d_strchr=''
699 d_strcoll=''
700 d_strctcpy=''
701 d_strerrm=''
702 d_strerror=''
703 d_sysernlst=''
704 d_syserrlst=''
705 d_strerror_r=''
706 strerror_r_proto=''
707 d_strftime=''
708 d_strtod=''
709 d_strtol=''
710 d_strtold=''
711 d_strtoll=''
712 d_strtoq=''
713 d_strtoul=''
714 d_strtoull=''
715 d_strtouq=''
716 d_strxfrm=''
717 d_symlink=''
718 d_syscall=''
719 d_syscallproto=''
720 d_sysconf=''
721 d_system=''
722 d_tcgetpgrp=''
723 d_tcsetpgrp=''
724 d_telldirproto=''
725 d_time=''
726 timetype=''
727 clocktype=''
728 d_times=''
729 d_tmpnam_r=''
730 tmpnam_r_proto=''
731 d_truncate=''
732 d_ttyname_r=''
733 ttyname_r_proto=''
734 d_tzname=''
735 d_u32align=''
736 d_ualarm=''
737 d_umask=''
738 d_semctl_semid_ds=''
739 d_semctl_semun=''
740 d_union_semun=''
741 d_unordered=''
742 d_usleep=''
743 d_usleepproto=''
744 d_ustat=''
745 d_vfork=''
746 usevfork=''
747 d_voidsig=''
748 signal_t=''
749 d_volatile=''
750 d_charvspr=''
751 d_vprintf=''
752 d_wait4=''
753 d_waitpid=''
754 d_wcstombs=''
755 d_wctomb=''
756 d_writev=''
757 dlext=''
758 cccdlflags=''
759 ccdlflags=''
760 dlsrc=''
761 ld=''
762 lddlflags=''
763 usedl=''
764 doublesize=''
765 ebcdic=''
766 fflushNULL=''
767 fflushall=''
768 fpossize=''
769 fpostype=''
770 gccansipedantic=''
771 gccosandvers=''
772 gccversion=''
773 gidformat=''
774 gidsign=''
775 gidsize=''
776 gidtype=''
777 groupstype=''
778 h_fcntl=''
779 h_sysfile=''
780 html1dir=''
781 html1direxp=''
782 installhtml1dir=''
783 html3dir=''
784 html3direxp=''
785 installhtml3dir=''
786 i_arpainet=''
787 i_crypt=''
788 db_hashtype=''
789 db_prefixtype=''
790 db_version_major=''
791 db_version_minor=''
792 db_version_patch=''
793 i_db=''
794 i_dbm=''
795 i_rpcsvcdbm=''
796 d_dirnamlen=''
797 direntrytype=''
798 i_dirent=''
799 i_dld=''
800 i_dlfcn=''
801 i_fcntl=''
802 i_float=''
803 i_fp=''
804 i_fp_class=''
805 i_gdbm=''
806 d_grpasswd=''
807 i_grp=''
808 i_ieeefp=''
809 i_inttypes=''
810 i_langinfo=''
811 i_libutil=''
812 i_limits=''
813 i_locale=''
814 i_machcthr=''
815 i_malloc=''
816 i_math=''
817 i_memory=''
818 i_mntent=''
819 i_ndbm=''
820 i_netdb=''
821 i_neterrno=''
822 i_netinettcp=''
823 i_niin=''
824 i_sysin=''
825 i_poll=''
826 i_prot=''
827 i_pthread=''
828 d_pwage=''
829 d_pwchange=''
830 d_pwclass=''
831 d_pwcomment=''
832 d_pwexpire=''
833 d_pwgecos=''
834 d_pwpasswd=''
835 d_pwquota=''
836 i_pwd=''
837 i_sfio=''
838 i_shadow=''
839 i_socks=''
840 i_stddef=''
841 i_stdlib=''
842 i_string=''
843 strings=''
844 i_sunmath=''
845 i_sysaccess=''
846 i_sysdir=''
847 i_sysfile=''
848 d_voidtty=''
849 i_bsdioctl=''
850 i_sysfilio=''
851 i_sysioctl=''
852 i_syssockio=''
853 i_syslog=''
854 i_sysmman=''
855 i_sysmode=''
856 i_sysmount=''
857 i_sysndir=''
858 i_sysparam=''
859 i_sysresrc=''
860 i_syssecrt=''
861 i_sysselct=''
862 i_sysstat=''
863 i_sysstatfs=''
864 i_sysstatvfs=''
865 i_systimes=''
866 i_systypes=''
867 i_sysuio=''
868 i_sysun=''
869 i_sysutsname=''
870 i_sysvfs=''
871 i_syswait=''
872 i_sgtty=''
873 i_termio=''
874 i_termios=''
875 d_tm_tm_gmtoff=''
876 d_tm_tm_zone=''
877 i_systime=''
878 i_systimek=''
879 i_time=''
880 timeincl=''
881 i_unistd=''
882 i_ustat=''
883 i_utime=''
884 i_values=''
885 i_stdarg=''
886 i_varargs=''
887 i_varhdr=''
888 i_vfork=''
889 inc_version_list=''
890 inc_version_list_init=''
891 installprefix=''
892 installprefixexp=''
893 installstyle=''
894 installusrbinperl=''
895 intsize=''
896 longsize=''
897 shortsize=''
898 issymlink=''
899 libc=''
900 ldlibpthname=''
901 libperl=''
902 shrpenv=''
903 useshrplib=''
904 glibpth=''
905 libpth=''
906 loclibpth=''
907 plibpth=''
908 xlibpth=''
909 ignore_versioned_solibs=''
910 libs=''
911 libsdirs=''
912 libsfiles=''
913 libsfound=''
914 libspath=''
915 lns=''
916 d_PRIEUldbl=''
917 d_PRIFUldbl=''
918 d_PRIGUldbl=''
919 d_PRIeldbl=''
920 d_PRIfldbl=''
921 d_PRIgldbl=''
922 d_SCNfldbl=''
923 sPRIEUldbl=''
924 sPRIFUldbl=''
925 sPRIGUldbl=''
926 sPRIeldbl=''
927 sPRIfldbl=''
928 sPRIgldbl=''
929 sSCNfldbl=''
930 lseeksize=''
931 lseektype=''
932 make_set_make=''
933 d_mymalloc=''
934 freetype=''
935 mallocobj=''
936 mallocsrc=''
937 malloctype=''
938 usemymalloc=''
939 installman1dir=''
940 man1dir=''
941 man1direxp=''
942 man1ext=''
943 installman3dir=''
944 man3dir=''
945 man3direxp=''
946 man3ext=''
947 modetype=''
948 multiarch=''
949 mydomain=''
950 myhostname=''
951 phostname=''
952 c=''
953 n=''
954 d_eofnblk=''
955 eagain=''
956 o_nonblock=''
957 rd_nodata=''
958 need_va_copy=''
959 netdb_hlen_type=''
960 netdb_host_type=''
961 netdb_name_type=''
962 netdb_net_type=''
963 groupcat=''
964 hostcat=''
965 passcat=''
966 orderlib=''
967 ranlib=''
968 d_perl_otherlibdirs=''
969 otherlibdirs=''
970 package=''
971 spackage=''
972 pager=''
973 api_revision=''
974 api_subversion=''
975 api_version=''
976 api_versionstring=''
977 patchlevel=''
978 perl_patchlevel=''
979 revision=''
980 subversion=''
981 version=''
982 version_patchlevel_string=''
983 perl5=''
984 perladmin=''
985 perlpath=''
986 d_nv_preserves_uv=''
987 i16size=''
988 i16type=''
989 i32size=''
990 i32type=''
991 i64size=''
992 i64type=''
993 i8size=''
994 i8type=''
995 ivsize=''
996 ivtype=''
997 nv_preserves_uv_bits=''
998 nvsize=''
999 nvtype=''
1000 u16size=''
1001 u16type=''
1002 u32size=''
1003 u32type=''
1004 u64size=''
1005 u64type=''
1006 u8size=''
1007 u8type=''
1008 uvsize=''
1009 uvtype=''
1010 ivdformat=''
1011 nvEUformat=''
1012 nvFUformat=''
1013 nvGUformat=''
1014 nveformat=''
1015 nvfformat=''
1016 nvgformat=''
1017 uvXUformat=''
1018 uvoformat=''
1019 uvuformat=''
1020 uvxformat=''
1021 pidtype=''
1022 prefix=''
1023 prefixexp=''
1024 installprivlib=''
1025 privlib=''
1026 privlibexp=''
1027 prototype=''
1028 ptrsize=''
1029 d_PRIXU64=''
1030 d_PRId64=''
1031 d_PRIi64=''
1032 d_PRIo64=''
1033 d_PRIu64=''
1034 d_PRIx64=''
1035 sPRIXU64=''
1036 sPRId64=''
1037 sPRIi64=''
1038 sPRIo64=''
1039 sPRIu64=''
1040 sPRIx64=''
1041 d_quad=''
1042 quadkind=''
1043 quadtype=''
1044 uquadtype=''
1045 drand01=''
1046 randbits=''
1047 randfunc=''
1048 randseedtype=''
1049 seedfunc=''
1050 installscript=''
1051 scriptdir=''
1052 scriptdirexp=''
1053 selectminbits=''
1054 selecttype=''
1055 sh=''
1056 sig_count=''
1057 sig_name=''
1058 sig_name_init=''
1059 sig_num=''
1060 sig_num_init=''
1061 sig_size=''
1062 installsitearch=''
1063 sitearch=''
1064 sitearchexp=''
1065 installsitebin=''
1066 sitebin=''
1067 sitebinexp=''
1068 installsitehtml1=''
1069 sitehtml1=''
1070 sitehtml1exp=''
1071 installsitehtml3=''
1072 sitehtml3=''
1073 sitehtml3exp=''
1074 installsitelib=''
1075 sitelib=''
1076 sitelib_stem=''
1077 sitelibexp=''
1078 installsiteman1=''
1079 siteman1=''
1080 siteman1exp=''
1081 installsiteman3=''
1082 siteman3=''
1083 siteman3exp=''
1084 siteprefix=''
1085 siteprefixexp=''
1086 installsitescript=''
1087 sitescript=''
1088 sitescriptexp=''
1089 sizesize=''
1090 sizetype=''
1091 so=''
1092 socksizetype=''
1093 sharpbang=''
1094 shsharp=''
1095 spitshell=''
1096 src=''
1097 ssizetype=''
1098 startperl=''
1099 startsh=''
1100 stdchar=''
1101 d_stdio_stream_array=''
1102 stdio_stream_array=''
1103 sysman=''
1104 trnl=''
1105 uidformat=''
1106 uidsign=''
1107 uidsize=''
1108 uidtype=''
1109 archname64=''
1110 use64bitall=''
1111 use64bitint=''
1112 ccflags_uselargefiles=''
1113 ldflags_uselargefiles=''
1114 libswanted_uselargefiles=''
1115 uselargefiles=''
1116 uselongdouble=''
1117 usemorebits=''
1118 usemultiplicity=''
1119 nm_opt=''
1120 nm_so_opt=''
1121 runnm=''
1122 usenm=''
1123 useperlio=''
1124 usesocks=''
1125 d_oldpthreads=''
1126 use5005threads=''
1127 useithreads=''
1128 usereentrant=''
1129 usethreads=''
1130 incpath=''
1131 mips_type=''
1132 usrinc=''
1133 d_vendorarch=''
1134 installvendorarch=''
1135 vendorarch=''
1136 vendorarchexp=''
1137 d_vendorbin=''
1138 installvendorbin=''
1139 vendorbin=''
1140 vendorbinexp=''
1141 installvendorhtml1=''
1142 vendorhtml1=''
1143 vendorhtml1exp=''
1144 installvendorhtml3=''
1145 vendorhtml3=''
1146 vendorhtml3exp=''
1147 d_vendorlib=''
1148 installvendorlib=''
1149 vendorlib=''
1150 vendorlib_stem=''
1151 vendorlibexp=''
1152 installvendorman1=''
1153 vendorman1=''
1154 vendorman1exp=''
1155 installvendorman3=''
1156 vendorman3=''
1157 vendorman3exp=''
1158 usevendorprefix=''
1159 vendorprefix=''
1160 vendorprefixexp=''
1161 d_vendorscript=''
1162 installvendorscript=''
1163 vendorscript=''
1164 vendorscriptexp=''
1165 versiononly=''
1166 defvoidused=''
1167 voidflags=''
1168 pm_apiversion=''
1169 xs_apiversion=''
1170 yacc=''
1171 yaccflags=''
1172 CONFIG=''
1173
1174 define='define'
1175 undef='undef'
1176 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1177 rmlist=''
1178
1179 : We must find out about Eunice early
1180 eunicefix=':'
1181 if test -f /etc/unixtovms; then
1182         eunicefix=/etc/unixtovms
1183 fi
1184 if test -f /etc/unixtovms.exe; then
1185         eunicefix=/etc/unixtovms.exe
1186 fi
1187
1188 : Set executable suffix now -- needed before hints available
1189 if test -f "/libs/version.library"; then
1190 : Amiga OS
1191     _exe=""
1192 elif test -f "/system/gnu_library/bin/ar.pm"; then
1193 : Stratus VOS
1194     _exe=".pm"
1195 elif test -n "$DJGPP"; then
1196 : DOS DJGPP
1197     _exe=".exe"
1198 elif test -d c:/. ; then
1199 : OS/2 or cygwin
1200     _exe=".exe"
1201 fi
1202
1203 i_whoami=''
1204 : Possible local include directories to search.
1205 : Set locincpth to "" in a hint file to defeat local include searches.
1206 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1207 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1208 :
1209 : no include file wanted by default
1210 inclwanted=''
1211
1212 siteman1=''
1213 siteman3=''
1214 sitescript=''
1215 : Trailing extension.  Override this in a hint file, if needed.
1216 : Extra object files, if any, needed on this platform.
1217 archobjs=''
1218 groupstype=''
1219 libnames=''
1220 : change the next line if compiling for Xenix/286 on Xenix/386
1221 xlibpth='/usr/lib/386 /lib/386'
1222 : Possible local library directories to search.
1223 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1224 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1225
1226 : general looking path for locating libraries
1227 glibpth="/lib /usr/lib $xlibpth"
1228 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1229 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1230 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1231
1232 : Private path used by Configure to find libraries.  Its value
1233 : is prepended to libpth. This variable takes care of special
1234 : machines, like the mips.  Usually, it should be empty.
1235 plibpth=''
1236
1237 : default library list
1238 libswanted=''
1239 : some systems want to use only the non-versioned libso:s
1240 ignore_versioned_solibs=''
1241 : full support for void wanted by default
1242 defvoidused=15
1243
1244 ccname=''
1245 ccversion=''
1246 perllibs=''
1247 : set useposix=false in your hint file to disable the POSIX extension.
1248 useposix=true
1249 : set useopcode=false in your hint file to disable the Opcode extension.
1250 useopcode=true
1251 archname64=''
1252 ccflags_uselargefiles=''
1253 ldflags_uselargefiles=''
1254 libswanted_uselargefiles=''
1255 : set usemultiplicity on the Configure command line to enable multiplicity.
1256 : set usesocks on the Configure command line to enable socks.
1257 archname=''
1258 : set usethreads on the Configure command line to enable threads.
1259 usereentrant='undef'
1260 : List of libraries we want.
1261 : If anyone needs -lnet, put it in a hint file.
1262 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1263 libswanted="$libswanted dld ld sun m c cposix posix"
1264 libswanted="$libswanted ndir dir crypt sec"
1265 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1266 : We probably want to search /usr/shlib before most other libraries.
1267 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1268 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1269 glibpth="/usr/shlib $glibpth"
1270 : Do not use vfork unless overridden by a hint file.
1271 usevfork=false
1272
1273 : Find the basic shell for Bourne shell scripts
1274 case "$sh" in
1275 '')
1276         case "$SYSTYPE" in
1277         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1278         *) xxx='/bin/sh';;
1279         esac
1280         if test -f "$xxx"; then
1281                 sh="$xxx"
1282         else
1283                 : Build up a list and do a single loop so we can 'break' out.
1284                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1285                 for xxx in sh bash ksh pdksh ash; do
1286                         for p in $pth; do
1287                                 try="$try ${p}/${xxx}"
1288                         done
1289                 done
1290                 for xxx in $try; do
1291                         if test -f "$xxx"; then
1292                                 sh="$xxx";
1293                                 break
1294                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1295                                 sh="$xxx";
1296                                 break
1297                         elif test -f "$xxx.exe"; then
1298                                 sh="$xxx";
1299                                 break
1300                         fi
1301                 done
1302         fi
1303         ;;
1304 esac
1305
1306 case "$sh" in
1307 '')     cat >&2 <<EOM
1308 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1309
1310 Usually it's in /bin/sh.  How did you even get this far?
1311 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1312 we'll try to straighten this all out.
1313 EOM
1314         exit 1
1315         ;;
1316 esac
1317
1318 : see if sh knows # comments
1319 if `$sh -c '#' >/dev/null 2>&1`; then
1320         shsharp=true
1321         spitshell=cat
1322         xcat=/bin/cat
1323         test -f $xcat$_exe || xcat=/usr/bin/cat
1324         if test ! -f $xcat$_exe; then
1325                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1326                         if test -f $p/cat$_exe; then
1327                                 xcat=$p/cat
1328                                 break
1329                         fi
1330                 done
1331                 if test ! -f $xcat$_exe; then
1332                         echo "Can't find cat anywhere!"
1333                         exit 1
1334                 fi
1335         fi
1336         echo "#!$xcat" >sharp
1337         $eunicefix sharp
1338         chmod +x sharp
1339         ./sharp > today
1340         if test -s today; then
1341                 sharpbang='#!'
1342         else
1343                 echo "#! $xcat" > sharp
1344                 $eunicefix sharp
1345                 chmod +x sharp
1346                 ./sharp > today
1347                 if test -s today; then
1348                         sharpbang='#! '
1349                 else
1350                         sharpbang=': use '
1351                 fi
1352         fi
1353 else
1354         echo " "
1355         echo "Your $sh doesn't grok # comments--I will strip them later on."
1356         shsharp=false
1357         cd ..
1358         echo "exec grep -v '^[  ]*#'" >spitshell
1359         chmod +x spitshell
1360         $eunicefix spitshell
1361         spitshell=`pwd`/spitshell
1362         cd UU
1363         echo "I presume that if # doesn't work, #! won't work either!"
1364         sharpbang=': use '
1365 fi
1366 rm -f sharp today
1367
1368 : figure out how to guarantee sh startup
1369 case "$startsh" in
1370 '') startsh=${sharpbang}${sh} ;;
1371 *)
1372 esac
1373 cat >sharp <<EOSS
1374 $startsh
1375 set abc
1376 test "$?abc" != 1
1377 EOSS
1378
1379 chmod +x sharp
1380 $eunicefix sharp
1381 if ./sharp; then
1382         : echo "Yup, it does."
1383 else
1384         echo "Hmm... '$startsh' does not guarantee sh startup..."
1385         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1386 fi
1387 rm -f sharp
1388
1389
1390 : Save command line options in file UU/cmdline.opt for later use in
1391 : generating config.sh.
1392 cat > cmdline.opt <<EOSH
1393 # Configure command line arguments.
1394 config_arg0='$0'
1395 config_args='$*'
1396 config_argc=$#
1397 EOSH
1398 argn=1
1399 args_exp=''
1400 args_sep=''
1401 for arg in "$@"; do
1402         cat >>cmdline.opt <<EOSH
1403 config_arg$argn='$arg'
1404 EOSH
1405         # Extreme backslashitis: replace each ' by '"'"'
1406         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1407 $arg
1408 EOC
1409         arg_exp=`cat cmdl.opt`
1410         args_exp="$args_exp$args_sep'$arg_exp'"
1411         argn=`expr $argn + 1`
1412         args_sep=' '
1413 done
1414 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1415 # used by ./hints/os2.sh
1416 rm -f cmdl.opt
1417
1418 : produce awk script to parse command line options
1419 cat >options.awk <<'EOF'
1420 BEGIN {
1421         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1422
1423         len = length(optstr);
1424         for (i = 1; i <= len; i++) {
1425                 c = substr(optstr, i, 1);
1426                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1427                 if (a == ":") {
1428                         arg[c] = 1;
1429                         i++;
1430                 }
1431                 opt[c] = 1;
1432         }
1433 }
1434 {
1435         expect = 0;
1436         str = $0;
1437         if (substr(str, 1, 1) != "-") {
1438                 printf("'%s'\n", str);
1439                 next;
1440         }
1441         len = length($0);
1442         for (i = 2; i <= len; i++) {
1443                 c = substr(str, i, 1);
1444                 if (!opt[c]) {
1445                         printf("-%s\n", substr(str, i));
1446                         next;
1447                 }
1448                 printf("-%s\n", c);
1449                 if (arg[c]) {
1450                         if (i < len)
1451                                 printf("'%s'\n", substr(str, i + 1));
1452                         else
1453                                 expect = 1;
1454                         next;
1455                 }
1456         }
1457 }
1458 END {
1459         if (expect)
1460                 print "?";
1461 }
1462 EOF
1463
1464 : process the command line options
1465 set X `for arg in "$@"; do echo "X$arg"; done |
1466         sed -e s/X// | awk -f options.awk`
1467 eval "set $*"
1468 shift
1469 rm -f options.awk
1470
1471 : set up default values
1472 fastread=''
1473 reuseval=false
1474 config_sh=''
1475 alldone=''
1476 error=''
1477 silent=''
1478 extractsh=''
1479 override=''
1480 knowitall=''
1481 rm -f optdef.sh posthint.sh
1482 cat >optdef.sh <<EOS
1483 $startsh
1484 EOS
1485
1486
1487 : option parsing
1488 while test $# -gt 0; do
1489         case "$1" in
1490         -d) shift; fastread=yes;;
1491         -e) shift; alldone=cont;;
1492         -f)
1493                 shift
1494                 cd ..
1495                 if test -r "$1"; then
1496                         config_sh="$1"
1497                 else
1498                         echo "$me: cannot read config file $1." >&2
1499                         error=true
1500                 fi
1501                 cd UU
1502                 shift;;
1503         -h) shift; error=true;;
1504         -r) shift; reuseval=true;;
1505         -s) shift; silent=true; realsilent=true;;
1506         -E) shift; alldone=exit;;
1507         -K) shift; knowitall=true;;
1508         -O) shift; override=true;;
1509         -S) shift; silent=true; extractsh=true;;
1510         -D)
1511                 shift
1512                 case "$1" in
1513                 *=)
1514                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1515                         echo "$me: ignoring -D $1" >&2
1516                         ;;
1517                 *=*) echo "$1" | \
1518                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1519                 *) echo "$1='define'" >> optdef.sh;;
1520                 esac
1521                 shift
1522                 ;;
1523         -U)
1524                 shift
1525                 case "$1" in
1526                 *=) echo "$1" >> optdef.sh;;
1527                 *=*)
1528                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1529                         echo "$me: ignoring -U $1" >&2
1530                         ;;
1531                 *) echo "$1='undef'" >> optdef.sh;;
1532                 esac
1533                 shift
1534                 ;;
1535         -A)
1536             shift
1537             xxx=''
1538             yyy="$1"
1539             zzz=''
1540             uuu=undef
1541             case "$yyy" in
1542             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1543                  case "$zzz" in
1544                  *:*) zzz='' ;;
1545                  *)   xxx=append
1546                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1547                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1548                  esac
1549                  ;;
1550             esac
1551             case "$xxx" in
1552             '')  case "$yyy" in
1553                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1554                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1555                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1556                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1557                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1558                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1559                  esac
1560                  ;;       
1561             esac
1562             case "$xxx" in
1563             append)
1564                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1565             clear)
1566                 echo "$yyy=''"                  >> posthint.sh ;;
1567             define)
1568                 case "$zzz" in
1569                 '') zzz=define ;;
1570                 esac
1571                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1572             eval)
1573                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1574             prepend)
1575                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1576             undef)
1577                 case "$zzz" in
1578                 '') zzz="$uuu" ;;
1579                 esac
1580                 echo "$yyy=$zzz"                >> posthint.sh ;;
1581             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1582             esac
1583             shift
1584             ;;
1585         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1586             exit 0;;
1587         --) break;;
1588         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1589         *) break;;
1590         esac
1591 done
1592
1593 case "$error" in
1594 true)
1595         cat >&2 <<EOM
1596 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1597                  [-U symbol] [-U symbol=] [-A command:symbol...]
1598   -d : use defaults for all answers.
1599   -e : go on without questioning past the production of config.sh.
1600   -f : specify an alternate default configuration file.
1601   -h : print this help message and exit (with an error status).
1602   -r : reuse C symbols value if possible (skips costly nm extraction).
1603   -s : silent mode, only echoes questions and essential information.
1604   -D : define symbol to have some value:
1605          -D symbol         symbol gets the value 'define'
1606          -D symbol=value   symbol gets the value 'value'
1607   -E : stop at the end of questions, after having produced config.sh.
1608   -K : do not use unless you know what you are doing.
1609   -O : let -D and -U override definitions from loaded configuration file.
1610   -S : perform variable substitutions on all .SH files (can mix with -f)
1611   -U : undefine symbol:
1612          -U symbol    symbol gets the value 'undef'
1613          -U symbol=   symbol gets completely empty
1614   -A : manipulate symbol after the platform specific hints have been applied:
1615          -A symbol=value                append " "value to symbol
1616          -A append:symbol=value         append value to symbol
1617          -A define:symbol=value         define symbol to have value
1618          -A clear:symbol                define symbol to be ''
1619          -A define:symbol               define symbol to be 'define'
1620          -A eval:symbol=value           define symbol to be eval of value
1621          -A prepend:symbol=value        prepend value to symbol
1622          -A undef:symbol                define symbol to be 'undef'
1623          -A undef:symbol=               define symbol to be ''
1624   -V : print version number and exit (with a zero status).
1625 EOM
1626         exit 1
1627         ;;
1628 esac
1629
1630 : Sanity checks
1631 case "$fastread$alldone" in
1632 yescont|yesexit) ;;
1633 *)
1634         case "$extractsh" in
1635         true) ;;
1636         *)
1637                 if test ! -t 0; then
1638                         echo "Say 'sh Configure', not 'sh <Configure'"
1639                         exit 1
1640                 fi
1641                 ;;
1642         esac
1643         ;;
1644 esac
1645
1646 exec 4>&1
1647 case "$silent" in
1648 true) exec 1>/dev/null;;
1649 esac
1650
1651 : run the defines and the undefines, if any, but leave the file out there...
1652 touch optdef.sh
1653 . ./optdef.sh
1654 : create the posthint manipulation script and leave the file out there...
1655 touch posthint.sh
1656
1657 : set package name
1658 package=perl5
1659 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1660 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1661 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1662 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1663 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1664 esac
1665
1666 : Some greps do not return status, grrr.
1667 echo "grimblepritz" >grimble
1668 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1669         contains=contains
1670 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1671         contains=grep
1672 else
1673         contains=contains
1674 fi
1675 rm -f grimble
1676 : the following should work in any shell
1677 case "$contains" in
1678 contains*)
1679         echo " "
1680         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1681         cat >contains <<'EOSS'
1682 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1683 EOSS
1684 chmod +x contains
1685 esac
1686
1687 : Find the path to the source tree
1688 case "$src" in
1689 '') case "$0" in
1690     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1691          case "$src" in
1692          /*)    ;;
1693          .)     ;;
1694          *)     src=`cd ../$src && pwd` ;;
1695          esac
1696          ;;
1697     *)   src='.';;
1698     esac;;
1699 esac
1700 case "$src" in
1701 '')     src=/
1702         rsrc=/
1703         ;;
1704 /*) rsrc="$src";;
1705 *) rsrc="../$src";;
1706 esac
1707 if test -f $rsrc/Configure && \
1708         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1709 then
1710    : found it, so we are ok.
1711 else
1712         rsrc=''
1713         for src in . .. ../.. ../../.. ../../../..; do
1714                 if test -f ../$src/Configure && \
1715                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1716                 then
1717                         rsrc=../$src
1718                         break
1719                 fi
1720         done
1721 fi
1722 case "$rsrc" in
1723 '')
1724         cat <<EOM >&4
1725
1726 Sorry, I can't seem to locate the source dir for $package.  Please start
1727 Configure with an explicit path -- i.e. /some/path/Configure.
1728
1729 EOM
1730         exit 1
1731         ;;
1732 ../.)   rsrc='..';;
1733 *)
1734         echo " "
1735         echo "Sources for $package found in \"$src\"." >&4
1736         ;;
1737 esac
1738
1739 : script used to extract .SH files with variable substitutions
1740 cat >extract <<'EOS'
1741 PERL_CONFIG_SH=true
1742 echo "Doing variable substitutions on .SH files..."
1743 if test -f MANIFEST; then
1744         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1745 else
1746         echo "(Looking for .SH files under the source directory.)"
1747         set x `(cd "$src"; find . -name "*.SH" -print)`
1748 fi
1749 shift
1750 case $# in
1751 0) set x `(cd "$src"; echo *.SH)`; shift;;
1752 esac
1753 if test ! -f "$src/$1"; then
1754         shift
1755 fi
1756 mkdir_p='
1757 name=$1;
1758 create="";
1759 while test $name; do
1760         if test ! -d "$name"; then
1761                 create="$name $create";
1762                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1763                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1764         else
1765                 name="";
1766         fi;
1767 done;
1768 for file in $create; do
1769         mkdir $file;
1770 done
1771 '
1772 for file in $*; do
1773         case "$src" in
1774         ".")
1775                 case "$file" in
1776                 */*)
1777                         dir=`expr X$file : 'X\(.*\)/'`
1778                         file=`expr X$file : 'X.*/\(.*\)'`
1779                         (cd "$dir" && . ./$file)
1780                         ;;
1781                 *)
1782                         . ./$file
1783                         ;;
1784                 esac
1785                 ;;
1786         *)
1787                 case "$file" in
1788                 */*)
1789                         dir=`expr X$file : 'X\(.*\)/'`
1790                         file=`expr X$file : 'X.*/\(.*\)'`
1791                         (set x $dir; shift; eval $mkdir_p)
1792                         sh <"$src/$dir/$file"
1793                         ;;
1794                 *)
1795                         sh <"$src/$file"
1796                         ;;
1797                 esac
1798                 ;;
1799         esac
1800 done
1801 if test -f "$src/config_h.SH"; then
1802         if test ! -f config.h; then
1803         : oops, they left it out of MANIFEST, probably, so do it anyway.
1804         . "$src/config_h.SH"
1805         fi
1806 fi
1807 EOS
1808
1809 : extract files and exit if asked to do so
1810 case "$extractsh" in
1811 true)
1812         case "$realsilent" in
1813         true) ;;
1814         *) exec 1>&4;;
1815         esac
1816         case "$config_sh" in
1817         '') config_sh='config.sh';;
1818         esac
1819         echo " "
1820         echo "Fetching answers from $config_sh..."
1821         cd ..
1822         . $config_sh
1823         test "$override" && . ./optdef.sh
1824         echo " "
1825         . UU/extract
1826         rm -rf UU
1827         echo "Extraction done."
1828         exit 0
1829         ;;
1830 esac
1831
1832 : Eunice requires " " instead of "", can you believe it
1833 echo " "
1834 : Here we go...
1835 echo "Beginning of configuration questions for $package."
1836
1837 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1838
1839 : first determine how to suppress newline on echo command
1840 echo " "
1841 echo "Checking echo to see how to suppress newlines..."
1842 (echo "hi there\c" ; echo " ") >.echotmp
1843 if $contains c .echotmp >/dev/null 2>&1 ; then
1844         echo "...using -n."
1845         n='-n'
1846         c=''
1847 else
1848         cat <<'EOM'
1849 ...using \c
1850 EOM
1851         n=''
1852         c='\c'
1853 fi
1854 echo $n "The star should be here-->$c"
1855 echo '*'
1856 rm -f .echotmp
1857
1858 : Now test for existence of everything in MANIFEST
1859 echo " "
1860 if test -f "$rsrc/MANIFEST"; then
1861         echo "First let's make sure your kit is complete.  Checking..." >&4
1862         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1863         rm -f missing
1864         tmppwd=`pwd`
1865         for filelist in x??; do
1866                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1867         done
1868         if test -s missing; then
1869                 cat missing >&4
1870                 cat >&4 <<'EOM'
1871
1872 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1873
1874 You have the option of continuing the configuration process, despite the
1875 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1876 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1877 and contact the author (perlbug@perl.org).
1878
1879 EOM
1880                 echo $n "Continue? [n] $c" >&4
1881                 read ans
1882                 case "$ans" in
1883                 y*)
1884                         echo "Continuing..." >&4
1885                         rm -f missing
1886                         ;;
1887                 *)
1888                         echo "ABORTING..." >&4
1889                         kill $$
1890                         ;;
1891                 esac
1892         else
1893                 echo "Looks good..."
1894         fi
1895 else
1896         echo "There is no MANIFEST file.  I hope your kit is complete !"
1897 fi
1898 rm -f missing x??
1899
1900 echo " "
1901 : Find the appropriate value for a newline for tr
1902 if test -n "$DJGPP"; then
1903        trnl='\012'
1904 fi
1905 if test X"$trnl" = X; then
1906         case "`echo foo|tr '\n' x 2>/dev/null`" in
1907         foox) trnl='\n' ;;
1908         esac
1909 fi
1910 if test X"$trnl" = X; then
1911         case "`echo foo|tr '\012' x 2>/dev/null`" in
1912         foox) trnl='\012' ;;
1913         esac
1914 fi
1915 if test X"$trnl" = X; then
1916        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1917        fooxy) trnl='\n\r' ;;
1918        esac
1919 fi
1920 if test X"$trnl" = X; then
1921         cat <<EOM >&2
1922
1923 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1924
1925 EOM
1926         exit 1
1927 fi
1928
1929 : compute the number of columns on the terminal for proper question formatting
1930 case "$COLUMNS" in
1931 '') COLUMNS='80';;
1932 esac
1933
1934 : set up the echo used in my read
1935 myecho="case \"\$xxxm\" in
1936 '') echo $n \"\$rp $c\" >&4;;
1937 *) case \"\$rp\" in
1938         '') echo $n \"[\$xxxm] $c\";;
1939         *)
1940                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1941                         echo \"\$rp\" >&4
1942                         echo $n \"[\$xxxm] $c\" >&4
1943                 else
1944                         echo $n \"\$rp [\$xxxm] $c\" >&4
1945                 fi
1946                 ;;
1947         esac;;
1948 esac"
1949
1950 : now set up to do reads with possible shell escape and default assignment
1951 cat <<EOSC >myread
1952 $startsh
1953 xxxm=\$dflt
1954 $myecho
1955 ans='!'
1956 case "\$fastread" in
1957 yes) case "\$dflt" in
1958         '') ;;
1959         *) ans='';
1960                 case "\$silent-\$rp" in
1961                 true-) ;;
1962                 *) echo " " >&4;;
1963                 esac;;
1964         esac;;
1965 *) case "\$silent" in
1966         true) case "\$rp" in
1967                 '') ans='';;
1968                 esac;;
1969         esac;;
1970 esac
1971 while expr "X\$ans" : "X!" >/dev/null; do
1972         read answ
1973         set x \$xxxm
1974         shift
1975         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1976         case  "\$answ" in
1977         "!")
1978                 sh 1>&4
1979                 echo " "
1980                 $myecho
1981                 ;;
1982         !*)
1983                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1984                 shift
1985                 sh 1>&4 -c "\$*"
1986                 echo " "
1987                 $myecho
1988                 ;;
1989         "\$ans")
1990                 case "\$ans" in
1991                 \\&*)
1992                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1993                         shift
1994                         case "\$1" in
1995                         -d)
1996                                 fastread=yes
1997                                 echo "(OK, I'll run with -d after this question.)" >&4
1998                                 ;;
1999                         -*)
2000                                 echo "*** Sorry, \$1 not supported yet." >&4
2001                                 ;;
2002                         esac
2003                         $myecho
2004                         ans=!
2005                         ;;
2006                 esac;;
2007         *)
2008                 case "\$aok" in
2009                 y)
2010                         echo "*** Substitution done -- please confirm."
2011                         xxxm="\$ans"
2012                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2013                         xxxm="\$ans"
2014                         ans=!
2015                         ;;
2016                 *)
2017                         echo "*** Error -- try again."
2018                         ans=!
2019                         ;;
2020                 esac
2021                 $myecho
2022                 ;;
2023         esac
2024         case "\$ans\$xxxm\$nostick" in
2025         '')
2026                 ans=!
2027                 $myecho
2028                 ;;
2029         esac
2030 done
2031 case "\$ans" in
2032 '') ans="\$xxxm";;
2033 esac
2034 EOSC
2035
2036 : create .config dir to save info across Configure sessions
2037 test -d ../.config || mkdir ../.config
2038 cat >../.config/README <<EOF
2039 This directory created by Configure to save information that should
2040 persist across sessions for $package.
2041
2042 You may safely delete it if you wish.
2043 EOF
2044
2045 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2046 case "$usedevel" in
2047 $define|true|[yY]*) ;;
2048 *) case "$xversion" in
2049    *[13579])
2050         cat >&4 <<EOH
2051 *** WHOA THERE!!! ***
2052
2053     This is an UNSTABLE DEVELOPMENT release.
2054     The version of this $package distribution is $xversion, that is, odd,
2055     (as opposed to even) and that signifies a development release.
2056     If you want a maintenance release, you want an even-numbered version.
2057
2058     Do ***NOT*** install this into production use.
2059     Data corruption and crashes are possible.
2060
2061     It is most seriously suggested that you do not continue any further
2062     unless you want to help in developing and debugging Perl.
2063
2064     If you *still* want to build perl, you can answer 'y' now,
2065     or pass -Dusedevel to Configure.
2066
2067 EOH
2068         rp='Do you really want to continue?'
2069         dflt='n'
2070         . ./myread
2071         case "$ans" in
2072         [yY]) echo >&4 "Okay, continuing."
2073               usedevel="$define" ;;
2074         *) echo >&4 "Okay, bye."
2075            exit 1
2076            ;;
2077         esac
2078         ;;
2079     esac
2080     ;;
2081 esac
2082 case "$usedevel" in
2083 $define|true|[yY]*)
2084         case "$versiononly" in
2085         '') versiononly="$define" ;;
2086         esac
2087         case "$installusrbinperl" in
2088         '') installusrbinperl="$undef" ;;
2089         esac
2090         ;;
2091 esac
2092
2093 : general instructions
2094 needman=true
2095 firsttime=true
2096 user=`(logname) 2>/dev/null`
2097 case "$user" in
2098 '') user=`whoami 2>&1`;;
2099 esac
2100 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2101         firsttime=false
2102         echo " "
2103         rp='Would you like to see the instructions?'
2104         dflt=n
2105         . ./myread
2106         case "$ans" in
2107         [yY]*) ;;
2108         *) needman=false;;
2109         esac
2110 fi
2111 if $needman; then
2112         cat <<EOH
2113
2114 This installation shell script will examine your system and ask you questions
2115 to determine how the perl5 package should be installed. If you get
2116 stuck on a question, you may use a ! shell escape to start a subshell or
2117 execute a command.  Many of the questions will have default answers in square
2118 brackets; typing carriage return will give you the default.
2119
2120 On some of the questions which ask for file or directory names you are allowed
2121 to use the ~name construct to specify the login directory belonging to "name",
2122 even if you don't have a shell which knows about that.  Questions where this is
2123 allowed will be marked "(~name ok)".
2124
2125 EOH
2126         rp=''
2127         dflt='Type carriage return to continue'
2128         . ./myread
2129         cat <<'EOH'
2130
2131 The prompter used in this script allows you to use shell variables and
2132 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2133 in the default answer, as if the default line was a set of arguments given to a
2134 script shell.  This means you may also use $* to repeat the whole default line,
2135 so you do not have to re-type everything to add something to the default.
2136
2137 Everytime there is a substitution, you will have to confirm.  If there is an
2138 error (e.g. an unmatched backtick), the default answer will remain unchanged
2139 and you will be prompted again.
2140
2141 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2142 the questions and use the computed defaults (or the previous answers if there
2143 was already a config.sh file). Type 'Configure -h' for a list of options.
2144 You may also start interactively and then answer '& -d' at any prompt to turn
2145 on the non-interactive behaviour for the remainder of the execution.
2146
2147 EOH
2148         . ./myread
2149         cat <<EOH
2150
2151 Much effort has been expended to ensure that this shell script will run on any
2152 Unix system.  If despite that it blows up on yours, your best bet is to edit
2153 Configure and run it again.  If you can't run Configure for some reason,
2154 you'll have to generate a config.sh file by hand.  Whatever problems you
2155 have, let me (perlbug@perl.org) know how I blew it.
2156
2157 This installation script affects things in two ways:
2158
2159 1) it may do direct variable substitutions on some of the files included
2160    in this kit.
2161 2) it builds a config.h file for inclusion in C programs.  You may edit
2162    any of these files as the need arises after running this script.
2163
2164 If you make a mistake on a question, there is no easy way to back up to it
2165 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2166 files.  Configure will offer to let you do this before it runs the SH files.
2167
2168 EOH
2169         dflt='Type carriage return to continue'
2170         . ./myread
2171         case "$firsttime" in
2172         true) echo $user >>../.config/instruct;;
2173         esac
2174 fi
2175
2176 : find out where common programs are
2177 echo " "
2178 echo "Locating common programs..." >&4
2179 cat <<EOSC >loc
2180 $startsh
2181 case \$# in
2182 0) exit 1;;
2183 esac
2184 thing=\$1
2185 shift
2186 dflt=\$1
2187 shift
2188 for dir in \$*; do
2189         case "\$thing" in
2190         .)
2191         if test -d \$dir/\$thing; then
2192                 echo \$dir
2193                 exit 0
2194         fi
2195         ;;
2196         *)
2197         for thisthing in \$dir/\$thing; do
2198                 : just loop through to pick last item
2199         done
2200         if test -f \$thisthing; then
2201                 echo \$thisthing
2202                 exit 0
2203         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2204                 echo \$thisthing
2205                 exit 0
2206         elif test -f \$dir/\$thing.exe; then
2207                 if test -n "$DJGPP"; then
2208                         echo \$dir/\$thing.exe
2209                 elif test "$eunicefix" != ":"; then
2210                         : on Eunice apparently
2211                         echo \$dir/\$thing
2212                         exit 0
2213                 fi
2214                 exit 0
2215         fi
2216         ;;
2217         esac
2218 done
2219 echo \$dflt
2220 exit 1
2221 EOSC
2222 chmod +x loc
2223 $eunicefix loc
2224 loclist="
2225 awk
2226 cat
2227 chmod
2228 comm
2229 cp
2230 echo
2231 expr
2232 grep
2233 ls
2234 mkdir
2235 rm
2236 sed
2237 sort
2238 touch
2239 tr
2240 uniq
2241 "
2242 trylist="
2243 Mcc
2244 ar
2245 bison
2246 byacc
2247 cpp
2248 csh
2249 date
2250 egrep
2251 gmake
2252 gzip
2253 less
2254 ln
2255 make
2256 more
2257 nm
2258 nroff
2259 pg
2260 test
2261 uname
2262 zip
2263 "
2264 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2265 pth="$pth /lib /usr/lib"
2266 for file in $loclist; do
2267         eval xxx=\$$file
2268         case "$xxx" in
2269         /*|?:[\\/]*)
2270                 if test -f "$xxx"; then
2271                         : ok
2272                 else
2273                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2274                         xxx=`./loc $file $file $pth`
2275                 fi
2276                 ;;
2277         '') xxx=`./loc $file $file $pth`;;
2278         *) xxx=`./loc $xxx $xxx $pth`;;
2279         esac
2280         eval $file=$xxx$_exe
2281         eval _$file=$xxx
2282         case "$xxx" in
2283         /*)
2284                 echo $file is in $xxx.
2285                 ;;
2286         ?:[\\/]*)
2287                 echo $file is in $xxx.
2288                 ;;
2289         *)
2290                 echo "I don't know where '$file' is, and my life depends on it." >&4
2291                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2292                 exit 1
2293                 ;;
2294         esac
2295 done
2296 echo " "
2297 echo "Don't worry if any of the following aren't found..."
2298 say=offhand
2299 for file in $trylist; 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 see $file out there, $say."
2324                 say=either
2325                 ;;
2326         esac
2327 done
2328 case "$egrep" in
2329 egrep)
2330         echo "Substituting grep for egrep."
2331         egrep=$grep
2332         _egrep=$grep
2333         ;;
2334 esac
2335 case "$ln" in
2336 ln)
2337         echo "Substituting cp for ln."
2338         ln=$cp
2339         _ln=$cp
2340         ;;
2341 esac
2342 case "$make" in
2343 make)   
2344         case "$gmake" in
2345         gmake)
2346         echo "I can't find make or gmake, and my life depends on it." >&4
2347         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2348         exit 1
2349         ;;
2350         esac
2351         ;;
2352 esac    
2353 case "$gmake" in
2354 gmake)  ;;
2355 *)      # We can't have osname yet.
2356         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2357                 # Assume that gmake, if found, is definitely GNU make
2358                 # and prefer it over the system make.
2359                 echo "Substituting gmake for make."
2360                 make=$gmake
2361                 _make=$gmake
2362         fi
2363         ;;
2364 esac
2365 case "$test" in
2366 test)
2367         echo "Hopefully test is built into your sh."
2368         ;;
2369 *)
2370         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2371                 echo "Using the test built into your sh."
2372                 test=test
2373                 _test=test
2374         fi
2375         ;;
2376 esac
2377 case "$echo" in
2378 echo)
2379         echo "Hopefully echo is built into your sh."
2380         ;;
2381 '') ;;
2382 *)
2383         echo " "
2384 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2385         $echo $n "hi there$c" >foo1
2386         echo $n "hi there$c" >foo2
2387         if cmp foo1 foo2 >/dev/null 2>&1; then
2388                 echo "They are compatible.  In fact, they may be identical."
2389         else
2390                 case "$n" in
2391                 '-n') n='' c='\c';;
2392                 *) n='-n' c='';;
2393                 esac
2394                 cat <<FOO
2395 They are not compatible!  You are probably running ksh on a non-USG system.
2396 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2397 have echo built in and we may have to run some Bourne shell scripts.  That
2398 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2399
2400 FOO
2401                 $echo $n "The star should be here-->$c"
2402                 $echo "*"
2403         fi
2404         $rm -f foo1 foo2
2405         ;;
2406 esac
2407
2408 cat <<EOS >trygcc
2409 $startsh
2410 EOS
2411 cat <<'EOSC' >>trygcc
2412 case "$cc" in
2413 '') ;;
2414 *)  $rm -f try try.*
2415     $cat >try.c <<EOM
2416 int main(int argc, char *argv[]) {
2417   return 0;
2418 }
2419 EOM
2420     if $cc -o try $ccflags $ldflags try.c; then
2421        :
2422     else
2423         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2424         despair=yes
2425         trygcc=yes
2426         case "$cc" in
2427         *gcc*) trygcc=no ;;
2428         esac
2429         case "`$cc -v -c try.c 2>&1`" in
2430         *gcc*) trygcc=no ;;
2431         esac
2432         if $test X"$trygcc" = Xyes; then
2433             if gcc -o try -c try.c; then
2434                 echo " "
2435                 echo "You seem to have a working gcc, though." >&4
2436                 rp="Would you like to use it?"
2437                 dflt=y
2438                 if $test -f myread; then
2439                     . ./myread
2440                 else
2441                     if $test -f UU/myread; then
2442                         . ./UU/myread
2443                     else
2444                         echo "Cannot find myread, sorry.  Aborting." >&2
2445                         exit 1
2446                     fi
2447                 fi  
2448                 case "$ans" in
2449                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2450                        if $test -f usethreads.cbu; then
2451                            $cat >&4 <<EOM 
2452
2453 *** However, any setting of the C compiler flags (e.g. for thread support)
2454 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2455 *** (together with e.g. -Dusethreads).
2456
2457 EOM
2458                        fi;;
2459                 esac
2460             fi
2461         fi
2462     fi
2463     $rm -f try try.*
2464     ;;
2465 esac
2466 EOSC
2467
2468 cat <<EOS >checkcc
2469 $startsh
2470 EOS
2471 cat <<'EOSC' >>checkcc
2472 case "$cc" in        
2473 '') ;;
2474 *)  $rm -f try try.*              
2475     $cat >try.c <<EOM
2476 int main(int argc, char *argv[]) {
2477   return 0;
2478 }
2479 EOM
2480     if $cc -o try $ccflags $ldflags try.c; then
2481        :
2482     else
2483         if $test X"$despair" = Xyes; then
2484            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2485         fi
2486         $cat >&4 <<EOM         
2487 You need to find a working C compiler.
2488 Either (purchase and) install the C compiler supplied by your OS vendor,
2489 or for a free C compiler try http://gcc.gnu.org/
2490 I cannot continue any further, aborting.
2491 EOM
2492         exit 1
2493     fi
2494     $rm -f try try.*
2495     ;;
2496 esac
2497 EOSC
2498
2499 : determine whether symbolic links are supported
2500 echo " "
2501 $touch blurfl
2502 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2503         echo "Symbolic links are supported." >&4
2504         lns="$ln -s"
2505 else
2506         echo "Symbolic links are NOT supported." >&4
2507         lns="$ln"
2508 fi
2509 $rm -f blurfl sym
2510
2511 : determine whether symbolic links are supported
2512 echo " "
2513 case "$lns" in
2514 *"ln"*" -s")
2515         echo "Checking how to test for symbolic links..." >&4
2516         $lns blurfl sym
2517         if $test "X$issymlink" = X; then
2518                 case "$newsh" in
2519                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2520                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2521                 esac
2522                 if test $? = 0; then
2523                         issymlink="test -h"
2524                 else
2525                         echo "Your builtin 'test -h' may be broken." >&4
2526                         case "$test" in
2527                         /*)     ;;
2528                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2529                                 for p in $pth
2530                                 do
2531                                         if test -f "$p/$test"; then
2532                                                 test="$p/$test"
2533                                                 break
2534                                         fi
2535                                 done
2536                                 ;;
2537                         esac
2538                         case "$test" in
2539                         /*)
2540                                 echo "Trying external '$test -h'." >&4
2541                                 issymlink="$test -h"
2542                                 if $test ! -h sym >/dev/null 2>&1; then
2543                                         echo "External '$test -h' is broken, too." >&4
2544                                         issymlink=''
2545                                 fi
2546                                 ;;
2547                         *)      issymlink='' ;;
2548                         esac
2549                 fi              
2550         fi
2551         if $test "X$issymlink" = X; then
2552                 if $test -L sym 2>/dev/null; then
2553                         issymlink="$test -L"
2554                         echo "The builtin '$test -L' worked." >&4
2555                 fi
2556         fi
2557         if $test "X$issymlink" != X; then
2558                 echo "You can test for symbolic links with '$issymlink'." >&4
2559         else
2560                 echo "I do not know how you can test for symbolic links." >&4
2561         fi
2562         $rm -f blurfl sym
2563         ;;
2564 *)      echo "No symbolic links, so not testing for their testing..." >&4
2565         ;;
2566 esac
2567 echo " "
2568
2569
2570 case "$mksymlinks" in
2571 $define|true|[yY]*)
2572         case "$src" in
2573         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2574                 exit 1
2575                 ;;
2576         *)      case "$lns:$issymlink" in
2577                 *"ln"*" -s:"*"test -"?)
2578                         echo "Creating the symbolic links..." >&4
2579                         echo "(First creating the subdirectories...)" >&4
2580                         cd ..
2581                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2582                                 read directory
2583                                 test -z "$directory" && break
2584                                 mkdir -p $directory
2585                         done
2586                         # Sanity check 1.
2587                         if test ! -d t/base; then
2588                                 echo "Failed to create the subdirectories.  Aborting." >&4
2589                                 exit 1
2590                         fi
2591                         echo "(Then creating the symlinks...)" >&4
2592                         awk '{print $1}' $src/MANIFEST | while true; do
2593                                 read filename
2594                                 test -z "$filename" && break
2595                                 if test -f $filename; then
2596                                         if $issymlink $filename; then
2597                                                 rm -f $filename
2598                                         fi
2599                                 fi
2600                                 if test -f $filename; then
2601                                         echo "$filename already exists, not symlinking."
2602                                 else
2603                                         ln -s $src/$filename $filename
2604                                 fi
2605                         done
2606                         # Sanity check 2.
2607                         if test ! -f t/base/lex.t; then
2608                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2609                                 exit 1
2610                         fi
2611                         cd UU
2612                         ;;
2613                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2614                         ;;
2615                 esac
2616                 ;;
2617         esac
2618         ;;
2619 esac
2620
2621
2622 case "$usecrosscompile" in
2623 $define|true|[yY]*)
2624         $echo "Cross-compiling..."
2625         croak=''
2626         case "$cc" in
2627         *-*-gcc) # A cross-compiling gcc, probably.
2628             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2629             ar=$targetarch-ar
2630             # leave out ld, choosing it is more complex
2631             nm=$targetarch-nm
2632             ranlib=$targetarch-ranlib
2633             $echo 'extern int foo;' > try.c
2634             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2635             shift
2636             if $test $# -gt 0; then
2637                 incpth="$incpth $*"
2638                 incpth="`$echo $incpth|$sed 's/^ //'`"
2639                 echo "Guessing incpth '$incpth'." >&4
2640                 for i in $*; do
2641                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2642                     if $test -d $j; then
2643                         libpth="$libpth $j"
2644                     fi
2645                 done   
2646                 libpth="`$echo $libpth|$sed 's/^ //'`"
2647                 echo "Guessing libpth '$libpth'." >&4
2648             fi
2649             $rm -f try.c
2650             ;;
2651         esac
2652         case "$targetarch" in
2653         '') echo "Targetarch not defined." >&4; croak=y ;;
2654         *)  echo "Using targetarch $targetarch." >&4 ;;
2655         esac
2656         case "$incpth" in
2657         '') echo "Incpth not defined." >&4; croak=y ;;
2658         *)  echo "Using incpth '$incpth'." >&4 ;;
2659         esac
2660         case "$libpth" in
2661         '') echo "Libpth not defined." >&4; croak=y ;;
2662         *)  echo "Using libpth '$libpth'." >&4 ;;
2663         esac
2664         case "$usrinc" in
2665         '') for i in $incpth; do
2666                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2667                     usrinc=$i
2668                     echo "Guessing usrinc $usrinc." >&4
2669                     break
2670                 fi
2671             done
2672             case "$usrinc" in
2673             '') echo "Usrinc not defined." >&4; croak=y ;;
2674             esac
2675             ;;
2676         *)  echo "Using usrinc $usrinc." >&4 ;;
2677         esac
2678         case "$targethost" in
2679         '') echo "Targethost not defined." >&4; croak=y ;;
2680         *)  echo "Using targethost $targethost." >&4
2681         esac
2682         locincpth=' '
2683         loclibpth=' '
2684         case "$croak" in
2685         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2686         esac
2687         case "$src" in
2688         /*) run=$src/Cross/run
2689             targetmkdir=$src/Cross/mkdir
2690             to=$src/Cross/to
2691             from=$src/Cross/from
2692             ;;
2693         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2694             run=$pwd/Cross/run
2695             targetmkdir=$pwd/Cross/mkdir
2696             to=$pwd/Cross/to
2697             from=$pwd/Cross/from
2698             ;;
2699         esac
2700         case "$targetrun" in
2701         '') targetrun=ssh ;;
2702         esac
2703         case "$targetto" in
2704         '') targetto=scp ;;
2705         esac
2706         case "$targetfrom" in
2707         '') targetfrom=scp ;;
2708         esac
2709         run=$run-$targetrun
2710         to=$to-$targetto
2711         from=$from-$targetfrom
2712         case "$targetdir" in
2713         '')  targetdir=/tmp
2714              echo "Guessing targetdir $targetdir." >&4
2715              ;;
2716         esac
2717         case "$targetuser" in
2718         '')  targetuser=root
2719              echo "Guessing targetuser $targetuser." >&4
2720              ;;
2721         esac
2722         case "$targetfrom" in
2723         scp)    q=-q ;;
2724         *)      q='' ;;
2725         esac
2726         case "$targetrun" in
2727         ssh|rsh)
2728             cat >$run <<EOF
2729 #!/bin/sh
2730 case "\$1" in
2731 -cwd)
2732   shift
2733   cwd=\$1
2734   shift
2735   ;;
2736 esac
2737 case "\$cwd" in
2738 '') cwd=$targetdir ;;
2739 esac
2740 exe=\$1
2741 shift
2742 if $test ! -f \$exe.xok; then
2743   $to \$exe
2744   $touch \$exe.xok
2745 fi
2746 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2747 EOF
2748             ;;
2749         *)  echo "Unknown targetrun '$targetrun'" >&4
2750             exit 1
2751             ;;
2752         esac
2753         case "$targetmkdir" in
2754         */Cross/mkdir)
2755             cat >$targetmkdir <<EOF
2756 #!/bin/sh
2757 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2758 EOF
2759             $chmod a+rx $targetmkdir
2760             ;;
2761         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2762             exit 1
2763             ;;
2764         esac
2765         case "$targetto" in
2766         scp|rcp)
2767             cat >$to <<EOF
2768 #!/bin/sh
2769 for f in \$@
2770 do
2771   case "\$f" in
2772   /*)
2773     $targetmkdir \`dirname \$f\`
2774     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2775     ;;
2776   *)
2777     $targetmkdir $targetdir/\`dirname \$f\`
2778     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2779     ;;
2780   esac
2781 done
2782 exit 0
2783 EOF
2784             ;;
2785         cp) cat >$to <<EOF
2786 #!/bin/sh
2787 for f in \$@
2788 do
2789   case "\$f" in
2790   /*)
2791     $mkdir -p $targetdir/\`dirname \$f\`
2792     $cp \$f $targetdir/\$f || exit 1
2793     ;;
2794   *)
2795     $targetmkdir $targetdir/\`dirname \$f\`
2796     $cp \$f $targetdir/\$f || exit 1
2797     ;;
2798   esac
2799 done
2800 exit 0
2801 EOF
2802             ;;
2803         *)  echo "Unknown targetto '$targetto'" >&4
2804             exit 1
2805             ;;
2806         esac
2807         case "$targetfrom" in
2808         scp|rcp)
2809           cat >$from <<EOF
2810 #!/bin/sh
2811 for f in \$@
2812 do
2813   $rm -f \$f
2814   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2815 done
2816 exit 0
2817 EOF
2818             ;;
2819         cp) cat >$from <<EOF
2820 #!/bin/sh
2821 for f in \$@
2822 do
2823   $rm -f \$f
2824   cp $targetdir/\$f . || exit 1
2825 done
2826 exit 0
2827 EOF
2828             ;;
2829         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2830             exit 1
2831             ;;
2832         esac
2833         if $test ! -f $run; then
2834             echo "Target 'run' script '$run' not found." >&4
2835         else
2836             $chmod a+rx $run
2837         fi
2838         if $test ! -f $to; then
2839             echo "Target 'to' script '$to' not found." >&4
2840         else
2841             $chmod a+rx $to
2842         fi
2843         if $test ! -f $from; then
2844             echo "Target 'from' script '$from' not found." >&4
2845         else
2846             $chmod a+rx $from
2847         fi
2848         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2849             exit 1
2850         fi
2851         cat >&4 <<EOF
2852 Using '$run' for remote execution,
2853 and '$from' and '$to'
2854 for remote file transfer.
2855 EOF
2856         ;;
2857 *)      run=''
2858         to=:
2859         from=:
2860         usecrosscompile='undef'
2861         targetarch=''
2862         ;;
2863 esac
2864
2865 : see whether [:lower:] and [:upper:] are supported character classes
2866 echo " "
2867 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2868 ABYZ)
2869         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2870         up='[:upper:]'
2871         low='[:lower:]'
2872         ;;
2873 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2874         # (0xc9 and 0xd1), therefore that is a nice testing point.
2875         if test "X$up" = X -o "X$low" = X; then
2876             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2877             ij) up='[A-Z]'
2878                 low='[a-z]'
2879                 ;;
2880             esac
2881         fi
2882         if test "X$up" = X -o "X$low" = X; then
2883             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2884             ij) up='A-Z'
2885                 low='a-z'
2886                 ;;
2887             esac
2888         fi
2889         if test "X$up" = X -o "X$low" = X; then
2890             case "`echo IJ | od -x 2>/dev/null`" in
2891             *C9D1*|*c9d1*)
2892                 echo "Hey, this might be EBCDIC." >&4
2893                 if test "X$up" = X -o "X$low" = X; then
2894                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2895                     ij) up='[A-IJ-RS-Z]'
2896                         low='[a-ij-rs-z]'
2897                         ;;
2898                     esac
2899                 fi
2900                 if test "X$up" = X -o "X$low" = X; then
2901                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2902                     ij) up='A-IJ-RS-Z'
2903                         low='a-ij-rs-z'
2904                         ;;
2905                     esac
2906                 fi
2907                 ;;
2908             esac
2909         fi
2910 esac
2911 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2912 ij)
2913     echo "Using $up and $low to convert case." >&4
2914     ;;
2915 *)
2916     echo "I don't know how to translate letters from upper to lower case." >&4
2917     echo "Your tr is not acting any way I know of." >&4
2918     exit 1
2919     ;;
2920 esac
2921 : set up the translation script tr, must be called with ./tr of course
2922 cat >tr <<EOSC
2923 $startsh
2924 case "\$1\$2" in
2925 '[A-Z][a-z]') exec $tr '$up' '$low';;
2926 '[a-z][A-Z]') exec $tr '$low' '$up';;
2927 esac
2928 exec $tr "\$@"
2929 EOSC
2930 chmod +x tr
2931 $eunicefix tr
2932
2933 : Try to determine whether config.sh was made on this system
2934 case "$config_sh" in
2935 '')
2936 myuname=`$uname -a 2>/dev/null`
2937 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2938 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2939 # because the A-Z/a-z are not consecutive.
2940 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2941         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2942 newmyuname="$myuname"
2943 dflt=n
2944 case "$knowitall" in
2945 '')
2946         if test -f ../config.sh; then
2947                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2948                         eval "`grep myuname= ../config.sh`"
2949                 fi
2950                 if test "X$myuname" = "X$newmyuname"; then
2951                         dflt=y
2952                 fi
2953         fi
2954         ;;
2955 *) dflt=y;;
2956 esac
2957
2958 : Get old answers from old config file if Configure was run on the
2959 : same system, otherwise use the hints.
2960 hint=default
2961 cd ..
2962 if test -f config.sh; then
2963         echo " "
2964         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2965         . UU/myread
2966         case "$ans" in
2967         n*|N*) echo "OK, I'll ignore it."
2968                 mv config.sh config.sh.old
2969                 myuname="$newmyuname"
2970                 ;;
2971         *)  echo "Fetching default answers from your old config.sh file..." >&4
2972                 tmp_n="$n"
2973                 tmp_c="$c"
2974                 tmp_sh="$sh"
2975                 . ./config.sh
2976                 cp config.sh UU
2977                 n="$tmp_n"
2978                 c="$tmp_c"
2979                 : Older versions did not always set $sh.  Catch re-use of such
2980                 : an old config.sh.
2981                 case "$sh" in
2982                 '') sh="$tmp_sh" ;;
2983                 esac
2984                 hint=previous
2985                 ;;
2986         esac
2987 fi
2988 . ./UU/checkcc
2989 if test ! -f config.sh; then
2990         $cat <<EOM
2991
2992 First time through, eh?  I have some defaults handy for some systems
2993 that need some extra help getting the Configure answers right:
2994
2995 EOM
2996         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2997         dflt=''
2998         : Half the following guesses are probably wrong... If you have better
2999         : tests or hints, please send them to perlbug@perl.org
3000         : The metaconfig authors would also appreciate a copy...
3001         $test -f /irix && osname=irix
3002         $test -f /xenix && osname=sco_xenix
3003         $test -f /dynix && osname=dynix
3004         $test -f /dnix && osname=dnix
3005         $test -f /lynx.os && osname=lynxos
3006         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3007         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3008         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3009         $test -f /bin/mips && /bin/mips && osname=mips
3010         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3011                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3012         $test -d /usr/apollo/bin && osname=apollo
3013         $test -f /etc/saf/_sactab && osname=svr4
3014         $test -d /usr/include/minix && osname=minix
3015         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3016         if $test -d /MachTen -o -d /MachTen_Folder; then
3017                 osname=machten
3018                 if $test -x /sbin/version; then
3019                         osvers=`/sbin/version | $awk '{print $2}' |
3020                         $sed -e 's/[A-Za-z]$//'`
3021                 elif $test -x /usr/etc/version; then
3022                         osvers=`/usr/etc/version | $awk '{print $2}' |
3023                         $sed -e 's/[A-Za-z]$//'`
3024                 else
3025                         osvers="$2.$3"
3026                 fi
3027         fi
3028
3029         $test -f /sys/posix.dll &&
3030                 $test -f /usr/bin/what &&
3031                 set X `/usr/bin/what /sys/posix.dll` &&
3032                 $test "$3" = UWIN &&
3033                 osname=uwin &&
3034                 osvers="$5"
3035
3036         if $test -f $uname; then
3037                 set X $myuname
3038                 shift
3039
3040                 case "$5" in
3041                 fps*) osname=fps ;;
3042                 mips*)
3043                         case "$4" in
3044                         umips) osname=umips ;;
3045                         *) osname=mips ;;
3046                         esac;;
3047                 [23]100) osname=mips ;;
3048                 next*) osname=next ;;
3049                 i386*)
3050                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3051                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3052                                 osname='sco'
3053                                 osvers=$tmp
3054                         elif $test -f /etc/kconfig; then
3055                                 osname=isc
3056                                 if test "$lns" = "$ln -s"; then
3057                                         osvers=4
3058                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3059                                         osvers=3
3060                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3061                                         osvers=2
3062                                 fi
3063                         fi
3064                         tmp=''
3065                         ;;
3066                 pc*)
3067                         if test -n "$DJGPP"; then
3068                                 osname=dos
3069                                 osvers=djgpp
3070                         fi
3071                         ;;
3072                 esac
3073
3074                 case "$1" in
3075                 aix) osname=aix
3076                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3077                         case "$tmp" in
3078                         'not found') osvers="$4"."$3" ;;
3079                         '<3240'|'<>3240') osvers=3.2.0 ;;
3080                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3081                         '=3250'|'>3250') osvers=3.2.5 ;;
3082                         *) osvers=$tmp;;
3083                         esac
3084                         ;;
3085                 bsd386) osname=bsd386
3086                         osvers=`$uname -r`
3087                         ;;
3088                 cygwin*) osname=cygwin
3089                         osvers="$3"
3090                         ;;
3091                 *dc.osx) osname=dcosx
3092                         osvers="$3"
3093                         ;;
3094                 dnix) osname=dnix
3095                         osvers="$3"
3096                         ;;
3097                 domainos) osname=apollo
3098                         osvers="$3"
3099                         ;;
3100                 dgux) osname=dgux 
3101                         osvers="$3"
3102                         ;;
3103                 dynixptx*) osname=dynixptx
3104                         osvers=`echo "$4"|sed 's/^v//'`
3105                         ;;
3106                 freebsd) osname=freebsd 
3107                         osvers="$3" ;;
3108                 genix) osname=genix ;;
3109                 hp*) osname=hpux 
3110                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3111                         ;;
3112                 irix*) osname=irix
3113                         case "$3" in
3114                         4*) osvers=4 ;;
3115                         5*) osvers=5 ;;
3116                         *)      osvers="$3" ;;
3117                         esac
3118                         ;;
3119                 linux) osname=linux
3120                         case "$3" in
3121                         *)      osvers="$3" ;;
3122                         esac
3123                         ;;
3124                 MiNT) osname=mint
3125                         ;;
3126                 netbsd*) osname=netbsd
3127                         osvers="$3"
3128                         ;;
3129                 news-os) osvers="$3"
3130                         case "$3" in
3131                         4*) osname=newsos4 ;;
3132                         *) osname=newsos ;;
3133                         esac
3134                         ;;
3135                 next*) osname=next ;;
3136                 nonstop-ux) osname=nonstopux ;;
3137                 openbsd) osname=openbsd
3138                         osvers="$3"
3139                         ;;
3140                 POSIX-BC | posix-bc ) osname=posix-bc
3141                         osvers="$3"
3142                         ;;
3143                 powerux | power_ux | powermax_os | powermaxos | \
3144                 powerunix | power_unix) osname=powerux
3145                         osvers="$3"
3146                         ;;
3147                 qnx) osname=qnx
3148                         osvers="$4"
3149                         ;;
3150                 solaris) osname=solaris
3151                         case "$3" in
3152                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3153                         *)      osvers="$3" ;;
3154                         esac
3155                         ;;
3156                 sunos) osname=sunos
3157                         case "$3" in
3158                         5*) osname=solaris
3159                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3160                         *)      osvers="$3" ;;
3161                         esac
3162                         ;;
3163                 titanos) osname=titanos
3164                         case "$3" in
3165                         1*) osvers=1 ;;
3166                         2*) osvers=2 ;;
3167                         3*) osvers=3 ;;
3168                         4*) osvers=4 ;;
3169                         *)      osvers="$3" ;;
3170                         esac
3171                         ;;
3172                 ultrix) osname=ultrix
3173                         osvers="$3"
3174                         ;;
3175                 osf1|mls+)      case "$5" in
3176                                 alpha)
3177                                         osname=dec_osf
3178                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3179                                         case "$osvers" in
3180                                         [1-9].[0-9]*) ;;
3181                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3182                                         esac
3183                                         ;;
3184                         hp*)    osname=hp_osf1  ;;
3185                         mips)   osname=mips_osf1 ;;
3186                         esac
3187                         ;;
3188                 unixware) osname=svr5
3189                         osvers="$4"
3190                         ;;
3191                 uts)    osname=uts
3192                         osvers="$3"
3193                         ;;
3194                 vos) osvers="$3"
3195                         ;;
3196                 $2) case "$osname" in
3197                         *isc*) ;;
3198                         *freebsd*) ;;
3199                         svr*)
3200                                 : svr4.x or possibly later
3201                                 case "svr$3" in 
3202                                 ${osname}*)
3203                                         osname=svr$3
3204                                         osvers=$4
3205                                         ;;
3206                                 esac
3207                                 case "$osname" in
3208                                 svr4.0)
3209                                         : Check for ESIX
3210                                         if test -f /stand/boot ; then
3211                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3212                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3213                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3214                                                         if test -n "$isesix"; then
3215                                                                 osname=esix4
3216                                                         fi
3217                                                 fi
3218                                         fi
3219                                         ;;
3220                                 esac
3221                                 ;;
3222                         *)      if test -f /etc/systemid; then
3223                                         osname=sco
3224                                         set `echo $3 | $sed 's/\./ /g'` $4
3225                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3226                                                 osvers=$1.$2.$3
3227                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3228                                                 osvers=$1.$2
3229                                         elif $test -f $src/hints/sco_$1.sh; then
3230                                                 osvers=$1
3231                                         fi
3232                                 else
3233                                         case "$osname" in
3234                                         '') : Still unknown.  Probably a generic Sys V.
3235                                                 osname="sysv"
3236                                                 osvers="$3"
3237                                                 ;;
3238                                         esac
3239                                 fi
3240                                 ;;
3241                         esac
3242                         ;;
3243                 *)      case "$osname" in
3244                         '') : Still unknown.  Probably a generic BSD.
3245                                 osname="$1"
3246                                 osvers="$3"
3247                                 ;;
3248                         esac
3249                         ;;
3250                 esac
3251         else
3252                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3253                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3254                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3255                                 osname=news_os
3256                         fi
3257                         $rm -f UU/kernel.what
3258                 elif test -d c:/.; then
3259                         set X $myuname
3260                         osname=os2
3261                         osvers="$5"
3262                 fi
3263         fi
3264         
3265         case "$targetarch" in
3266         '') ;;
3267         *)  hostarch=$osname
3268             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3269             osvers=''
3270             ;;
3271         esac
3272
3273         : Now look for a hint file osname_osvers, unless one has been
3274         : specified already.
3275         case "$hintfile" in
3276         ''|' ')
3277                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3278                 : Also try without trailing minor version numbers.
3279                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3280                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3281                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3282                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3283                 case "$file" in
3284                 '') dflt=none ;;
3285                 *)  case "$osvers" in
3286                         '') dflt=$file
3287                                 ;;
3288                         *)  if $test -f $src/hints/$file.sh ; then
3289                                         dflt=$file
3290                                 elif $test -f $src/hints/$xfile.sh ; then
3291                                         dflt=$xfile
3292                                 elif $test -f $src/hints/$xxfile.sh ; then
3293                                         dflt=$xxfile
3294                                 elif $test -f $src/hints/$xxxfile.sh ; then
3295                                         dflt=$xxxfile
3296                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3297                                         dflt=$xxxxfile
3298                                 elif $test -f "$src/hints/${osname}.sh" ; then
3299                                         dflt="${osname}"
3300                                 else
3301                                         dflt=none
3302                                 fi
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307                 if $test -f Policy.sh ; then
3308                         case "$dflt" in
3309                         *Policy*) ;;
3310                         none) dflt="Policy" ;;
3311                         *) dflt="Policy $dflt" ;;
3312                         esac
3313                 fi
3314                 ;;
3315         *)
3316                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3317                 ;;
3318         esac
3319
3320         if $test -f Policy.sh ; then
3321                 $cat <<EOM
3322
3323 There's also a Policy hint file available, which should make the
3324 site-specific (policy) questions easier to answer.
3325 EOM
3326
3327         fi
3328
3329         $cat <<EOM
3330
3331 You may give one or more space-separated answers, or "none" if appropriate.
3332 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3333 is a good thing.  DO NOT give a wrong version or a wrong OS.
3334
3335 EOM
3336
3337         rp="Which of these apply, if any?"
3338         . UU/myread
3339         tans=$ans
3340         for file in $tans; do
3341                 if $test X$file = XPolicy -a -f Policy.sh; then
3342                         . Policy.sh
3343                         $cat Policy.sh >> UU/config.sh
3344                 elif $test -f $src/hints/$file.sh; then
3345                         . $src/hints/$file.sh
3346                         $cat $src/hints/$file.sh >> UU/config.sh
3347                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3348                         : nothing
3349                 else
3350                         : Give one chance to correct a possible typo.
3351                         echo "$file.sh does not exist"
3352                         dflt=$file
3353                         rp="hint to use instead?"
3354                         . UU/myread
3355                         for file in $ans; do
3356                                 if $test -f "$src/hints/$file.sh"; then
3357                                         . $src/hints/$file.sh
3358                                         $cat $src/hints/$file.sh >> UU/config.sh
3359                                 elif $test X$ans = X -o X$ans = Xnone ; then
3360                                         : nothing
3361                                 else
3362                                         echo "$file.sh does not exist -- ignored."
3363                                 fi
3364                         done
3365                 fi
3366         done
3367
3368         hint=recommended
3369         : Remember our hint file for later.
3370         if $test -f "$src/hints/$file.sh" ; then
3371                 hintfile="$file"
3372         else
3373                 hintfile=''
3374         fi
3375 fi
3376 cd UU
3377 ;;
3378 *)
3379         echo " "
3380         echo "Fetching default answers from $config_sh..." >&4
3381         tmp_n="$n"
3382         tmp_c="$c"
3383         cd ..
3384         cp $config_sh config.sh 2>/dev/null
3385         chmod +w config.sh
3386         . ./config.sh
3387         cd UU
3388         cp ../config.sh .
3389         n="$tmp_n"
3390         c="$tmp_c"
3391         hint=previous
3392         ;;
3393 esac
3394 test "$override" && . ./optdef.sh
3395
3396 : Restore computed paths
3397 for file in $loclist $trylist; do
3398         eval $file="\$_$file"
3399 done
3400
3401 cat << EOM
3402
3403 Configure uses the operating system name and version to set some defaults.
3404 The default value is probably right if the name rings a bell. Otherwise,
3405 since spelling matters for me, either accept the default or answer "none"
3406 to leave it blank.
3407
3408 EOM
3409 case "$osname" in
3410         ''|' ')
3411                 case "$hintfile" in
3412                 ''|' '|none) dflt=none ;;
3413                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3414                 esac
3415                 ;;
3416         *) dflt="$osname" ;;
3417 esac
3418 rp="Operating system name?"
3419 . ./myread
3420 case "$ans" in
3421 none)  osname='' ;;
3422 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3423 esac
3424 echo " "
3425 case "$osvers" in
3426         ''|' ')
3427                 case "$hintfile" in
3428                 ''|' '|none) dflt=none ;;
3429                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3430                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3431                         case "$dflt" in
3432                         ''|' ') dflt=none ;;
3433                         esac
3434                         ;;
3435                 esac
3436                 ;;
3437         *) dflt="$osvers" ;;
3438 esac
3439 rp="Operating system version?"
3440 . ./myread
3441 case "$ans" in
3442 none)  osvers='' ;;
3443 *) osvers="$ans" ;;
3444 esac
3445
3446
3447 . ./posthint.sh
3448
3449 : who configured the system
3450 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3451 cf_by=`(logname) 2>/dev/null`
3452 case "$cf_by" in
3453 "")
3454         cf_by=`(whoami) 2>/dev/null`
3455         case "$cf_by" in
3456         "") cf_by=unknown ;;
3457         esac ;;
3458 esac
3459
3460 : set up the script used to warn in case of inconsistency
3461 cat <<EOS >whoa
3462 $startsh
3463 EOS
3464 cat <<'EOSC' >>whoa
3465 dflt=y
3466 echo " "
3467 echo "*** WHOA THERE!!! ***" >&4
3468 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3469 rp="    Keep the $hint value?"
3470 . ./myread
3471 case "$ans" in
3472 y) td=$was; tu=$was;;
3473 esac
3474 EOSC
3475
3476 : function used to set $1 to $val
3477 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3478 case "$val$was" in
3479 $define$undef) . ./whoa; eval "$var=\$td";;
3480 $undef$define) . ./whoa; eval "$var=\$tu";;
3481 *) eval "$var=$val";;
3482 esac'
3483
3484 case "$usesocks" in
3485 $define|true|[yY]*)     dflt='y';;
3486 *) dflt='n';;
3487 esac
3488 cat <<EOM
3489
3490 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3491 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3492 to use the PerlIO abstraction layer, this will be implicitly selected.
3493
3494 If this doesn't make any sense to you, just accept the default '$dflt'.
3495 EOM
3496 rp='Build Perl for SOCKS?'
3497 . ./myread
3498 case "$ans" in
3499 y|Y)    val="$define" ;;     
3500 *)      val="$undef" ;;
3501 esac
3502 set usesocks
3503 eval $setvar
3504
3505 case "$usesocks" in
3506 $define|true|[yY]*) useperlio="$define";;
3507 esac
3508
3509 case "$useperlio" in
3510 $define|true|[yY]*|'')  dflt='y';;
3511 *) dflt='n';;
3512 esac
3513 cat <<EOM
3514
3515 Previous version of $package used the standard IO mechanisms as
3516 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3517 alternate IO mechanisms via the PerlIO abstraction layer, but the
3518 stdio mechanism is still available if needed.  The abstraction layer
3519 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3520 Using PerlIO with sfio may cause problems with some extension modules.
3521
3522 If this doesn't make any sense to you, just accept the default '$dflt'.
3523 EOM
3524 rp='Use the PerlIO abstraction layer?'
3525 . ./myread
3526 case "$ans" in
3527 y|Y) 
3528         val="$define"
3529         ;;
3530 *)      
3531         echo "Ok, doing things the stdio way."
3532         val="$undef"
3533         ;;
3534 esac
3535 set useperlio
3536 eval $setvar 
3537
3538 case "$usesocks" in
3539 $define|true|[yY]*)
3540         case "$useperlio" in
3541         $define|true|[yY]*) ;;
3542         *)      cat >&4 <<EOM
3543
3544 You are using the SOCKS proxy protocol library which means that you
3545 should also use the PerlIO layer.  You may be headed for trouble.
3546
3547 EOM
3548                 ;;
3549         esac
3550         ;;
3551 esac
3552
3553         
3554 case "$usethreads" in
3555 $define|true|[yY]*)     dflt='y';;
3556 *)     # Catch case where user specified ithreads or 5005threads but
3557        # forgot -Dusethreads (A.D. 4/2002)
3558        case "$useithreads$use5005threads" in
3559        *$define*)      
3560                 case "$useperlio" in
3561                 "$define")      dflt='y' ;;
3562                 *)              dflt='n' ;;
3563                 esac
3564                 ;;
3565        *)       dflt='n';;
3566        esac
3567        ;;
3568 esac
3569 cat <<EOM
3570
3571 Perl can be built to take advantage of threads on some systems.
3572 To do so, Configure can be run with -Dusethreads.
3573
3574 Note that Perl built with threading support runs slightly slower
3575 and uses more memory than plain Perl. The current implementation
3576 is believed to be stable, but it is fairly new, and so should be
3577 treated with caution.
3578
3579 If this doesn't make any sense to you, just accept the default '$dflt'.
3580 EOM
3581 rp='Build a threading Perl?'
3582 . ./myread
3583 case "$ans" in
3584 y|Y)    val="$define" ;;
3585 *)      val="$undef" ;;
3586 esac
3587 set usethreads
3588 eval $setvar
3589
3590 case "$usethreads" in
3591 $define)
3592         $cat <<EOM
3593
3594 Since release 5.6, Perl has had two different threading implementations,
3595 the newer interpreter-based version (ithreads) with one interpreter per
3596 thread, and the older 5.005 version (5005threads).
3597 The 5005threads version is effectively unmaintained and will probably be
3598 removed in Perl 5.10, so there should be no need to build a Perl using it
3599 unless needed for backwards compatibility with some existing 5.005threads
3600 code.
3601
3602 EOM
3603         : Default to ithreads unless overridden on command line or with
3604         : old config.sh
3605         dflt='y'
3606         case "$use5005threads" in
3607                 $define|true|[yY]*) dflt='n';;
3608         esac
3609         case "$useithreads" in
3610                 $undef|false|[nN]*) dflt='n';;
3611         esac
3612         rp='Use the newer interpreter-based ithreads?'
3613         . ./myread
3614         case "$ans" in
3615         y|Y)    val="$define" ;;
3616         *)      val="$undef" ;;
3617         esac
3618         set useithreads
3619         eval $setvar
3620         : Now set use5005threads to the opposite value.
3621         case "$useithreads" in
3622         $define) val="$undef" ;;
3623         *) val="$define" ;;
3624         esac
3625         set use5005threads
3626         eval $setvar
3627         ;;
3628 *)
3629         useithreads="$undef"
3630         use5005threads="$undef"
3631         ;;
3632 esac
3633
3634 case "$useithreads$use5005threads" in
3635 "$define$define")
3636         $cat >&4 <<EOM
3637
3638 You cannot have both the ithreads and the 5.005 threads enabled
3639 at the same time.  Disabling the 5.005 threads since they are
3640 much less stable than the ithreads.
3641
3642 EOM
3643         use5005threads="$undef"
3644         ;;
3645 esac
3646
3647 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3648         cat >&4 <<EOF
3649 ***
3650 *** To build with ithreads you must also use the PerlIO layer.
3651 *** Cannot continue, aborting.
3652 ***
3653 EOF
3654         exit 1
3655 fi
3656
3657 case "$d_oldpthreads" in
3658 '')     : Configure tests would be welcome here.  For now, assume undef.
3659         val="$undef" ;;
3660 *)      val="$d_oldpthreads" ;;
3661 esac
3662 set d_oldpthreads
3663 eval $setvar
3664
3665
3666 case "$usethreads" in
3667 "$define"|true|[yY]*)
3668 : Look for a hint-file generated 'call-back-unit'.  If the
3669 : user has specified that a threading perl is to be built,
3670 : we may need to set or change some other defaults.
3671         if $test -f usethreads.cbu; then
3672                 echo "Your platform has some specific hints for threaded builds, using them..."
3673                 . ./usethreads.cbu
3674         else
3675                 $cat <<EOM
3676 (Your platform doesn't have any specific hints for threaded builds.
3677  Assuming POSIX threads, then.)
3678 EOM
3679         fi
3680         ;;
3681 esac
3682
3683 cat <<EOM
3684
3685 Perl can be built so that multiple Perl interpreters can coexist
3686 within the same Perl executable.
3687 EOM
3688
3689 case "$useithreads" in
3690 $define)
3691         cat <<EOM
3692 This multiple interpreter support is required for interpreter-based threads.
3693 EOM
3694         val="$define"
3695         ;;
3696 *)      case "$usemultiplicity" in
3697         $define|true|[yY]*)     dflt='y';;
3698         *) dflt='n';;
3699         esac
3700         echo " "
3701         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3702         rp='Build Perl for multiplicity?'
3703         . ./myread
3704         case "$ans" in
3705         y|Y)    val="$define" ;;
3706         *)      val="$undef" ;;
3707         esac
3708         ;;
3709 esac
3710 set usemultiplicity
3711 eval $setvar
3712
3713
3714 case "$usemorebits" in
3715 "$define"|true|[yY]*)
3716         use64bitint="$define"
3717         uselongdouble="$define"
3718         usemorebits="$define"
3719         ;;
3720 *)      usemorebits="$undef"
3721         ;;
3722 esac
3723
3724 : make some quick guesses about what we are up against
3725 echo " "
3726 $echo $n "Hmm...  $c"
3727 echo exit 1 >bsd
3728 echo exit 1 >usg
3729 echo exit 1 >v7
3730 echo exit 1 >osf1
3731 echo exit 1 >eunice
3732 echo exit 1 >xenix
3733 echo exit 1 >venix
3734 echo exit 1 >os2
3735 d_bsd="$undef"
3736 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3737 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3738 then
3739         echo "Looks kind of like an OSF/1 system, but we'll see..."
3740         echo exit 0 >osf1
3741 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3742         xxx=`./loc addbib blurfl $pth`
3743         if $test -f $xxx; then
3744         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3745                 echo exit 0 >bsd
3746                 echo exit 0 >usg
3747         else
3748                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3749                         echo "Looks kind of like an extended USG system, but we'll see..."
3750                 else
3751                         echo "Looks kind of like a USG system, but we'll see..."
3752                 fi
3753                 echo exit 0 >usg
3754         fi
3755 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3756         echo "Looks kind of like a BSD system, but we'll see..."
3757         d_bsd="$define"
3758         echo exit 0 >bsd
3759 else
3760         echo "Looks kind of like a Version 7 system, but we'll see..."
3761         echo exit 0 >v7
3762 fi
3763 case "$eunicefix" in
3764 *unixtovms*)
3765         $cat <<'EOI'
3766 There is, however, a strange, musty smell in the air that reminds me of
3767 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3768 EOI
3769         echo exit 0 >eunice
3770         d_eunice="$define"
3771 : it so happens the Eunice I know will not run shell scripts in Unix format
3772         ;;
3773 *)
3774         echo " "
3775         echo "Congratulations.  You aren't running Eunice."
3776         d_eunice="$undef"
3777         ;;
3778 esac
3779 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3780 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3781 : semicolon as a patch separator
3782 case "$p_" in
3783 :) ;;
3784 *)
3785         $cat <<'EOI'
3786 I have the feeling something is not exactly right, however...don't tell me...
3787 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3788 (Or you may be running DOS with DJGPP.)
3789 EOI
3790         echo exit 0 >os2
3791         ;;
3792 esac
3793 if test -f /xenix; then
3794         echo "Actually, this looks more like a XENIX system..."
3795         echo exit 0 >xenix
3796         d_xenix="$define"
3797 else
3798         echo " "
3799         echo "It's not Xenix..."
3800         d_xenix="$undef"
3801 fi
3802 chmod +x xenix
3803 $eunicefix xenix
3804 if test -f /venix; then
3805         echo "Actually, this looks more like a VENIX system..."
3806         echo exit 0 >venix
3807 else
3808         echo " "
3809         if ./xenix; then
3810                 : null
3811         else
3812                 echo "Nor is it Venix..."
3813         fi
3814 fi
3815 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3816 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3817 $rm -f foo
3818
3819 case "$cc" in
3820 '') dflt=cc;;
3821 *) dflt="$cc";;
3822 esac
3823 rp="Use which C compiler?"
3824 . ./myread
3825 cc="$ans"
3826
3827 : See if they have not cc but they do have gcc
3828 . ./trygcc
3829 : Look for a hint-file generated 'call-back-unit'.  Now that the
3830 : user has specified the compiler, we may need to set or change some
3831 : other defaults.
3832 if $test -f cc.cbu; then
3833     . ./cc.cbu
3834 fi
3835 . ./checkcc
3836
3837 echo " "
3838 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3839 $cat >try.c <<EOM
3840 #include <stdio.h>
3841 int main() {
3842 #ifdef __GNUC__
3843 #ifdef __VERSION__
3844         printf("%s\n", __VERSION__);
3845 #else
3846         printf("%s\n", "1");
3847 #endif
3848 #endif
3849         exit(0);
3850 }
3851 EOM
3852 if $cc -o try $ccflags $ldflags try.c; then
3853         gccversion=`$run ./try`
3854         case "$gccversion" in
3855         '') echo "You are not using GNU cc." ;;
3856         *)  echo "You are using GNU cc $gccversion."
3857             ccname=gcc
3858             ;;
3859         esac
3860 else
3861         echo " "
3862         echo "*** WHOA THERE!!! ***" >&4
3863         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3864         case "$knowitall" in
3865         '')
3866         echo "    You'd better start hunting for one and let me know about it." >&4
3867                 exit 1
3868                 ;;
3869         esac
3870 fi
3871 $rm -f try try.*
3872 case "$gccversion" in
3873 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3874 esac
3875 case "$gccversion" in
3876 '') gccosandvers='' ;;
3877 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3878    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3879    gccshortvers=''
3880    case "$gccosandvers" in
3881    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3882    $osname$osvers) ;; # looking good
3883    $osname*) cat <<EOM >&4
3884
3885 *** WHOA THERE!!! ***
3886
3887     Your gcc has not been compiled for the exact release of
3888     your operating system ($gccosandvers versus $osname$osvers).
3889
3890     In general it is a good idea to keep gcc synchronized with
3891     the operating system because otherwise serious problems
3892     may ensue when trying to compile software, like Perl.
3893
3894     I'm trying to be optimistic here, though, and will continue.
3895     If later during the configuration and build icky compilation
3896     problems appear (headerfile conflicts being the most common
3897     manifestation), I suggest reinstalling the gcc to match
3898     your operating system release.
3899
3900 EOM
3901       ;;
3902    *) gccosandvers='' ;; # failed to parse, better be silent
3903    esac
3904    ;;
3905 esac
3906 case "$ccname" in
3907 '') ccname="$cc" ;;
3908 esac
3909
3910 # gcc 3.* complain about adding -Idirectories that they already know about,
3911 # so we will take those off from locincpth.
3912 case "$gccversion" in
3913 3*)
3914     echo "main(){}">try.c
3915     for incdir in $locincpth; do
3916        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3917              grep '^c[cp]p*[01]: warning: changing search order '`
3918        if test "X$warn" != X; then
3919            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3920        fi
3921     done
3922     $rm -f try try.*
3923 esac
3924
3925 : decide how portable to be.  Allow command line overrides.
3926 case "$d_portable" in
3927 "$undef") ;;
3928 *)      d_portable="$define" ;;
3929 esac
3930
3931 : set up shell script to do ~ expansion
3932 cat >filexp <<EOSS
3933 $startsh
3934 : expand filename
3935 case "\$1" in
3936  ~/*|~)
3937         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3938         ;;
3939  ~*)
3940         if $test -f /bin/csh; then
3941                 /bin/csh -f -c "glob \$1"
3942                 failed=\$?
3943                 echo ""
3944                 exit \$failed
3945         else
3946                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3947                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3948                 if $test ! -d "\$dir"; then
3949                         me=\`basename \$0\`
3950                         echo "\$me: can't locate home directory for: \$name" >&2
3951                         exit 1
3952                 fi
3953                 case "\$1" in
3954                 */*)
3955                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3956                         ;;
3957                 *)
3958                         echo \$dir
3959                         ;;
3960                 esac
3961         fi
3962         ;;
3963 *)
3964         echo \$1
3965         ;;
3966 esac
3967 EOSS
3968 chmod +x filexp
3969 $eunicefix filexp
3970
3971 : now set up to get a file name
3972 cat <<EOS >getfile
3973 $startsh
3974 EOS
3975 cat <<'EOSC' >>getfile
3976 tilde=''
3977 fullpath=''
3978 already=''
3979 skip=''
3980 none_ok=''
3981 exp_file=''
3982 nopath_ok=''
3983 orig_rp="$rp"
3984 orig_dflt="$dflt"
3985 case "$gfpth" in
3986 '') gfpth='.' ;;
3987 esac
3988
3989 case "$fn" in
3990 *\(*)
3991         : getfile will accept an answer from the comma-separated list
3992         : enclosed in parentheses even if it does not meet other criteria.
3993         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3994         fn=`echo $fn | sed 's/(.*)//'`
3995         ;;
3996 esac
3997
3998 case "$fn" in
3999 *:*)
4000         loc_file=`expr $fn : '.*:\(.*\)'`
4001         fn=`expr $fn : '\(.*\):.*'`
4002         ;;
4003 esac
4004
4005 case "$fn" in
4006 *~*) tilde=true;;
4007 esac
4008 case "$fn" in
4009 */*) fullpath=true;;
4010 esac
4011 case "$fn" in
4012 *+*) skip=true;;
4013 esac
4014 case "$fn" in
4015 *n*) none_ok=true;;
4016 esac
4017 case "$fn" in
4018 *e*) exp_file=true;;
4019 esac
4020 case "$fn" in
4021 *p*) nopath_ok=true;;
4022 esac
4023
4024 case "$fn" in
4025 *f*) type='File';;
4026 *d*) type='Directory';;
4027 *l*) type='Locate';;
4028 esac
4029
4030 what="$type"
4031 case "$what" in
4032 Locate) what='File';;
4033 esac
4034
4035 case "$exp_file" in
4036 '')
4037         case "$d_portable" in
4038         "$define") ;;
4039         *) exp_file=true;;
4040         esac
4041         ;;
4042 esac
4043
4044 cd ..
4045 while test "$type"; do
4046         redo=''
4047         rp="$orig_rp"
4048         dflt="$orig_dflt"
4049         case "$tilde" in
4050         true) rp="$rp (~name ok)";;
4051         esac
4052         . UU/myread
4053         if test -f UU/getfile.ok && \
4054                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4055         then
4056                 value="$ans"
4057                 ansexp="$ans"
4058                 break
4059         fi
4060         case "$ans" in
4061         none)
4062                 value=''
4063                 ansexp=''
4064                 case "$none_ok" in
4065                 true) type='';;
4066                 esac
4067                 ;;
4068         *)
4069                 case "$tilde" in
4070                 '') value="$ans"
4071                         ansexp="$ans";;
4072                 *)
4073                         value=`UU/filexp $ans`
4074                         case $? in
4075                         0)
4076                                 if test "$ans" != "$value"; then
4077                                         echo "(That expands to $value on this system.)"
4078                                 fi
4079                                 ;;
4080                         *) value="$ans";;
4081                         esac
4082                         ansexp="$value"
4083                         case "$exp_file" in
4084                         '') value="$ans";;
4085                         esac
4086                         ;;
4087                 esac
4088                 case "$fullpath" in
4089                 true)
4090                         case "$ansexp" in
4091                         /*) value="$ansexp" ;;
4092                         [a-zA-Z]:/*) value="$ansexp" ;;
4093                         *)
4094                                 redo=true
4095                                 case "$already" in
4096                                 true)
4097                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4098                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4099                                         ;;
4100                                 *)
4101                                 echo "Please give a full path name, starting with slash." >&4
4102                                         case "$tilde" in
4103                                         true)
4104                                 echo "Note that using ~name is ok provided it expands well." >&4
4105                                                 already=true
4106                                                 ;;
4107                                         esac
4108                                 esac
4109                                 ;;
4110                         esac
4111                         ;;
4112                 esac
4113                 case "$redo" in
4114                 '')
4115                         case "$type" in
4116                         File)
4117                                 for fp in $gfpth; do
4118                                         if test "X$fp" = X.; then
4119                                             pf="$ansexp"
4120                                         else    
4121                                             pf="$fp/$ansexp"
4122                                         fi
4123                                         if test -f "$pf"; then
4124                                                 type=''
4125                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4126                                         then
4127                                                 echo "($value is not a plain file, but that's ok.)"
4128                                                 type=''
4129                                         fi
4130                                         if test X"$type" = X; then
4131                                             value="$pf"
4132                                             break
4133                                         fi
4134                                 done
4135                                 ;;
4136                         Directory)
4137                                 for fp in $gfpth; do
4138                                         if test "X$fp" = X.; then
4139                                             dir="$ans"
4140                                             direxp="$ansexp"
4141                                         else    
4142                                             dir="$fp/$ansexp"
4143                                             direxp="$fp/$ansexp"
4144                                         fi
4145                                         if test -d "$direxp"; then
4146                                                 type=''
4147                                                 value="$dir"
4148                                                 break
4149                                         fi
4150                                 done
4151                                 ;;
4152                         Locate)
4153                                 if test -d "$ansexp"; then
4154                                         echo "(Looking for $loc_file in directory $value.)"
4155                                         value="$value/$loc_file"
4156                                         ansexp="$ansexp/$loc_file"
4157                                 fi
4158                                 if test -f "$ansexp"; then
4159                                         type=''
4160                                 fi
4161                                 case "$nopath_ok" in
4162                                 true)   case "$value" in
4163                                         */*) ;;
4164                                         *)      echo "Assuming $value will be in people's path."
4165                                                 type=''
4166                                                 ;;
4167                                         esac
4168                                         ;;
4169                                 esac
4170                                 ;;
4171                         esac
4172
4173                         case "$skip" in
4174                         true) type='';
4175                         esac
4176
4177                         case "$type" in
4178                         '') ;;
4179                         *)
4180                                 if test "$fastread" = yes; then
4181                                         dflt=y
4182                                 else
4183                                         dflt=n
4184                                 fi
4185                                 rp="$what $value doesn't exist.  Use that name anyway?"
4186                                 . UU/myread
4187                                 dflt=''
4188                                 case "$ans" in
4189                                 y*) type='';;
4190                                 *) echo " ";;
4191                                 esac
4192                                 ;;
4193                         esac
4194                         ;;
4195                 esac
4196                 ;;
4197         esac
4198 done
4199 cd UU
4200 ans="$value"
4201 rp="$orig_rp"
4202 dflt="$orig_dflt"
4203 rm -f getfile.ok
4204 test "X$gfpthkeep" != Xy && gfpth=""
4205 EOSC
4206
4207 : What should the include directory be ?
4208 echo " "
4209 $echo $n "Hmm...  $c"
4210 dflt='/usr/include'
4211 incpath=''
4212 mips_type=''
4213 if $test -f /bin/mips && /bin/mips; then
4214         echo "Looks like a MIPS system..."
4215         $cat >usr.c <<'EOCP'
4216 #ifdef SYSTYPE_BSD43
4217 /bsd43
4218 #endif
4219 EOCP
4220         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4221                 dflt='/bsd43/usr/include'
4222                 incpath='/bsd43'
4223                 mips_type='BSD 4.3'
4224         else
4225                 mips_type='System V'
4226         fi
4227         $rm -f usr.c usr.out
4228         echo "and you're compiling with the $mips_type compiler and libraries."
4229         xxx_prompt=y
4230         echo "exit 0" >mips
4231 else
4232         echo "Doesn't look like a MIPS system."
4233         xxx_prompt=n
4234         echo "exit 1" >mips
4235 fi
4236 chmod +x mips
4237 $eunicefix mips
4238 case "$usrinc" in
4239 '') ;;
4240 *) dflt="$usrinc";;
4241 esac
4242 case "$xxx_prompt" in
4243 y)      fn=d/
4244         echo " "
4245         rp='Where are the include files you want to use?'
4246         . ./getfile
4247         usrinc="$ans"
4248         ;;
4249 *)      usrinc="$dflt"
4250         ;;
4251 esac
4252
4253 : see how we invoke the C preprocessor
4254 echo " "
4255 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4256 cat <<'EOT' >testcpp.c
4257 #define ABC abc
4258 #define XYZ xyz
4259 ABC.XYZ
4260 EOT
4261 cd ..
4262 if test ! -f cppstdin; then
4263         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4264                 # AIX cc -E doesn't show the absolute headerfile
4265                 # locations but we'll cheat by using the -M flag.
4266                 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
4267         else
4268                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4269         fi
4270 else
4271         echo "Keeping your $hint cppstdin wrapper."
4272 fi
4273 chmod 755 cppstdin
4274 wrapper=`pwd`/cppstdin
4275 ok='false'
4276 cd UU
4277
4278 if $test "X$cppstdin" != "X" && \
4279         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4280         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4281 then
4282         echo "You used to use $cppstdin $cppminus so we'll use that again."
4283         case "$cpprun" in
4284         '') echo "But let's see if we can live without a wrapper..." ;;
4285         *)
4286                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4287                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4288                 then
4289                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4290                         ok='true'
4291                 else
4292                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4293                 fi
4294                 ;;
4295         esac
4296 else
4297         case "$cppstdin" in
4298         '') ;;
4299         *)
4300                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4301                 ;;
4302         esac
4303 fi
4304
4305 if $ok; then
4306         : nothing
4307 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4308         $cc -E <testcpp.c >testcpp.out 2>&1; \
4309         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4310         echo "Yup, it does."
4311         x_cpp="$cc -E"
4312         x_minus='';
4313 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4314         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4315         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4316         echo "Yup, it does."
4317         x_cpp="$cc -E"
4318         x_minus='-';
4319 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4320         $cc -P <testcpp.c >testcpp.out 2>&1; \
4321         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4322         echo "Yipee, that works!"
4323         x_cpp="$cc -P"
4324         x_minus='';
4325 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4326         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4327         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4328         echo "At long last!"
4329         x_cpp="$cc -P"
4330         x_minus='-';
4331 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4332         $cpp <testcpp.c >testcpp.out 2>&1; \
4333         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4334         echo "It works!"
4335         x_cpp="$cpp"
4336         x_minus='';
4337 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4338         $cpp - <testcpp.c >testcpp.out 2>&1; \
4339         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4340         echo "Hooray, it works!  I was beginning to wonder."
4341         x_cpp="$cpp"
4342         x_minus='-';
4343 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4344         $wrapper <testcpp.c >testcpp.out 2>&1; \
4345         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346         x_cpp="$wrapper"
4347         x_minus=''
4348         echo "Eureka!"
4349 else
4350         dflt=''
4351         rp="No dice.  I can't find a C preprocessor.  Name one:"
4352         . ./myread
4353         x_cpp="$ans"
4354         x_minus=''
4355         $x_cpp <testcpp.c >testcpp.out 2>&1
4356         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4357                 echo "OK, that will do." >&4
4358         else
4359 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4360                 exit 1
4361         fi
4362 fi
4363
4364 case "$ok" in
4365 false)
4366         cppstdin="$x_cpp"
4367         cppminus="$x_minus"
4368         cpprun="$x_cpp"
4369         cpplast="$x_minus"
4370         set X $x_cpp
4371         shift
4372         case "$1" in
4373         "$cpp")
4374                 echo "Perhaps can we force $cc -E using a wrapper..."
4375                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4376                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4377                 then
4378                         echo "Yup, we can."
4379                         cppstdin="$wrapper"
4380                         cppminus='';
4381                 else
4382                         echo "Nope, we'll have to live without it..."
4383                 fi
4384                 ;;
4385         esac
4386         case "$cpprun" in
4387         "$wrapper")
4388                 cpprun=''
4389                 cpplast=''
4390                 ;;
4391         esac
4392         ;;
4393 esac
4394
4395 case "$cppstdin" in
4396 "$wrapper"|'cppstdin') ;;
4397 *) $rm -f $wrapper;;
4398 esac
4399 $rm -f testcpp.c testcpp.out
4400
4401 : Set private lib path
4402 case "$plibpth" in
4403 '') if ./mips; then
4404                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4405         fi;;
4406 esac
4407 case "$libpth" in
4408 ' ') dlist='';;
4409 '') dlist="$loclibpth $plibpth $glibpth";;
4410 *) dlist="$libpth";;
4411 esac
4412
4413 : Now check and see which directories actually exist, avoiding duplicates
4414 libpth=''
4415 for xxx in $dlist
4416 do
4417     if $test -d $xxx; then
4418                 case " $libpth " in
4419                 *" $xxx "*) ;;
4420                 *) libpth="$libpth $xxx";;
4421                 esac
4422     fi
4423 done
4424 $cat <<'EOM'
4425
4426 Some systems have incompatible or broken versions of libraries.  Among
4427 the directories listed in the question below, please remove any you
4428 know not to be holding relevant libraries, and add any that are needed.
4429 Say "none" for none.
4430
4431 EOM
4432 case "$libpth" in
4433 '') dflt='none';;
4434 *)
4435         set X $libpth
4436         shift
4437         dflt=${1+"$@"}
4438         ;;
4439 esac
4440 rp="Directories to use for library searches?"
4441 . ./myread
4442 case "$ans" in
4443 none) libpth=' ';;
4444 *) libpth="$ans";;
4445 esac
4446
4447 : compute shared library extension
4448 case "$so" in
4449 '')
4450         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4451                 dflt='sl'
4452         else
4453                 dflt='so'
4454         fi
4455         ;;
4456 *) dflt="$so";;
4457 esac
4458 $cat <<EOM
4459
4460 On some systems, shared libraries may be available.  Answer 'none' if
4461 you want to suppress searching of shared libraries for the remainder
4462 of this configuration.
4463
4464 EOM
4465 rp='What is the file extension used for shared libraries?'
4466 . ./myread
4467 so="$ans"
4468
4469 : Define several unixisms.
4470 : Hints files or command line option can be used to override them.
4471 : The convoluted testing is in case hints files set either the old
4472 : or the new name.
4473 case "$_exe" in
4474 '')     case "$exe_ext" in
4475         '')     ;;
4476         *)      _exe="$exe_ext" ;;
4477         esac
4478         ;;
4479 esac
4480 case "$_a" in
4481 '')     case "$lib_ext" in
4482     '') _a='.a';;
4483         *)      _a="$lib_ext" ;;
4484         esac
4485         ;;
4486 esac
4487 case "$_o" in
4488 '') case "$obj_ext" in
4489         '')     _o='.o';;
4490         *)      _o="$obj_ext";;
4491         esac
4492         ;;
4493 esac
4494 case "$p_" in
4495 '') case "$path_sep" in
4496         '')     p_=':';;
4497         *)      p_="$path_sep";;
4498         esac
4499         ;;
4500 esac
4501 exe_ext=$_exe
4502 lib_ext=$_a
4503 obj_ext=$_o
4504 path_sep=$p_
4505
4506 : Which makefile gets called first.  This is used by make depend.
4507 case "$firstmakefile" in
4508 '') firstmakefile='makefile';;
4509 esac
4510
4511 : Looking for optional libraries
4512 echo " "
4513 echo "Checking for optional libraries..." >&4
4514 case "$libs" in
4515 ' '|'') dflt='';;
4516 *) dflt="$libs";;
4517 esac
4518 case "$libswanted" in
4519 '') libswanted='c_s';;
4520 esac
4521 case "$usesocks" in
4522 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4523 esac
4524 libsfound=''
4525 libsfiles=''
4526 libsdirs=''
4527 libspath=''
4528 for thisdir in $libpth $xlibpth; do
4529   test -d $thisdir && libspath="$libspath $thisdir"
4530 done
4531 for thislib in $libswanted; do
4532         for thisdir in $libspath; do
4533             xxx=''
4534             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4535                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4536                 $test -f "$xxx" && eval $libscheck
4537                 $test -f "$xxx" && libstyle=shared
4538             fi
4539             if test ! -f "$xxx"; then
4540                 xxx=$thisdir/lib$thislib.$so
4541                 $test -f "$xxx" && eval $libscheck
4542                 $test -f "$xxx" && libstyle=shared
4543             fi  
4544             if test ! -f "$xxx"; then
4545                 xxx=$thisdir/lib$thislib$_a
4546                 $test -f "$xxx" && eval $libscheck
4547                 $test -f "$xxx" && libstyle=static
4548             fi
4549             if test ! -f "$xxx"; then
4550                 xxx=$thisdir/$thislib$_a
4551                 $test -f "$xxx" && eval $libscheck
4552                 $test -f "$xxx" && libstyle=static
4553             fi
4554             if test ! -f "$xxx"; then
4555                 xxx=$thisdir/lib${thislib}_s$_a
4556                 $test -f "$xxx" && eval $libscheck
4557                 $test -f "$xxx" && libstyle=static
4558                 $test -f "$xxx" && thislib=${thislib}_s
4559             fi
4560             if test ! -f "$xxx"; then
4561                 xxx=$thisdir/Slib$thislib$_a
4562                 $test -f "$xxx" && eval $libscheck
4563                 $test -f "$xxx" && libstyle=static
4564             fi
4565             if $test -f "$xxx"; then
4566                 case "$libstyle" in
4567                 shared) echo "Found -l$thislib (shared)." ;;
4568                 static) echo "Found -l$thislib." ;;
4569                 *)      echo "Found -l$thislib ($libstyle)." ;;
4570                 esac
4571                 case " $dflt " in
4572                 *"-l$thislib "*);;
4573                 *) dflt="$dflt -l$thislib"
4574                    libsfound="$libsfound $xxx"
4575                    yyy=`basename $xxx`
4576                    libsfiles="$libsfiles $yyy"
4577                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4578                    case " $libsdirs " in
4579                    *" $yyy "*) ;;
4580                    *) libsdirs="$libsdirs $yyy" ;;
4581                    esac
4582                    ;;
4583                 esac
4584                 break
4585             fi  
4586         done
4587         if $test ! -f "$xxx"; then
4588             echo "No -l$thislib."
4589         fi
4590 done
4591 set X $dflt
4592 shift
4593 dflt="$*"
4594 case "$libs" in
4595 '') dflt="$dflt";;
4596 *) dflt="$libs";;
4597 esac
4598 case "$dflt" in
4599 ' '|'') dflt='none';;
4600 esac
4601
4602 $cat <<EOM
4603
4604 In order to compile $package on your machine, a number of libraries
4605 are usually needed.  Include any other special libraries here as well.
4606 Say "none" for none.  The default list is almost always right.
4607 EOM
4608
4609 echo " "
4610 rp="What libraries to use?"
4611 . ./myread
4612 case "$ans" in
4613 none) libs=' ';;
4614 *) libs="$ans";;
4615 esac
4616
4617 : determine optimization, if desired, or use for debug flag also
4618 case "$optimize" in
4619 ' '|$undef) dflt='none';;
4620 '') dflt='-O';;
4621 *) dflt="$optimize";;
4622 esac
4623 $cat <<EOH
4624
4625 By default, $package compiles with the -O flag to use the optimizer.
4626 Alternately, you might want to use the symbolic debugger, which uses
4627 the -g flag (on traditional Unix systems).  Either flag can be
4628 specified here.  To use neither flag, specify the word "none".
4629
4630 EOH
4631 rp="What optimizer/debugger flag should be used?"
4632 . ./myread
4633 optimize="$ans"
4634 case "$optimize" in
4635 'none') optimize=" ";;
4636 esac
4637
4638 dflt=''
4639 : We will not override a previous value, but we might want to
4640 : augment a hint file
4641 case "$hint" in
4642 default|recommended)
4643         case "$gccversion" in
4644         1*) dflt='-fpcc-struct-return' ;;
4645         esac
4646         case "$optimize" in
4647         *-g*) dflt="$dflt -DDEBUGGING";;
4648         esac
4649         case "$gccversion" in
4650         2*) if test -d /etc/conf/kconfig.d &&
4651                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4652                 then
4653                         dflt="$dflt -posix"
4654                 fi
4655                 ;;
4656         esac
4657         case "$gccversion" in
4658         1*) ;;
4659         2.[0-8]*) ;;
4660         ?*)     echo " "
4661                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4662                 echo 'int main(void) { return 0; }' > gcctest.c
4663                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4664                         echo "Yes, it does." 2>&1
4665                         case "$ccflags" in
4666                         *strict-aliasing*) 
4667                                 echo "Leaving current flags $ccflags alone." 2>&1
4668                                 ;;
4669                         *) dflt="$dflt -fno-strict-aliasing" ;;
4670                         esac
4671                 else
4672                         echo "Nope, it doesn't, but that's ok." 2>&1
4673                 fi
4674                 ;;
4675         esac
4676         ;;
4677 esac
4678
4679 case "$mips_type" in
4680 *BSD*|'') inclwanted="$locincpth $usrinc";;
4681 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4682 esac
4683 for thisincl in $inclwanted; do
4684         if $test -d $thisincl; then
4685                 if $test x$thisincl != x$usrinc; then
4686                         case "$dflt" in
4687                         *" -I$thisincl "*);;
4688                         *) dflt="$dflt -I$thisincl ";;
4689                         esac
4690                 fi
4691         fi
4692 done
4693
4694 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4695         xxx=true;
4696 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4697         xxx=true;
4698 else
4699         xxx=false;
4700 fi;
4701 if $xxx; then
4702         case "$dflt" in
4703         *$2*);;
4704         *) dflt="$dflt -D$2";;
4705         esac;
4706 fi'
4707
4708 set signal.h LANGUAGE_C; eval $inctest
4709
4710 case "$usesocks" in
4711 $define)
4712         ccflags="$ccflags -DSOCKS"
4713         ;;
4714 esac
4715
4716 case "$hint" in
4717 default|recommended) dflt="$ccflags $dflt" ;;
4718 *) dflt="$ccflags";;
4719 esac
4720
4721 case "$dflt" in
4722 ''|' ') dflt=none;;
4723 esac
4724
4725 $cat <<EOH
4726
4727 Your C compiler may want other flags.  For this question you should include
4728 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4729 but you should NOT include libraries or ld flags like -lwhatever.  If you
4730 want $package to honor its debug switch, you should include -DDEBUGGING here.
4731 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4732
4733 To use no flags, specify the word "none".
4734
4735 EOH
4736 set X $dflt
4737 shift
4738 dflt=${1+"$@"}
4739 rp="Any additional cc flags?"
4740 . ./myread
4741 case "$ans" in
4742 none) ccflags='';;
4743 *) ccflags="$ans";;
4744 esac
4745
4746 : the following weeds options from ccflags that are of no interest to cpp
4747 case "$cppflags" in
4748 '') cppflags="$ccflags" ;;
4749 *)  cppflags="$cppflags $ccflags" ;;
4750 esac
4751 case "$gccversion" in
4752 1*) cppflags="$cppflags -D__GNUC__"
4753 esac
4754 case "$mips_type" in
4755 '');;
4756 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4757 esac
4758 case "$cppflags" in
4759 '');;
4760 *)
4761         echo " "
4762         echo "Let me guess what the preprocessor flags are..." >&4
4763         set X $cppflags
4764         shift
4765         cppflags=''
4766         $cat >cpp.c <<'EOM'
4767 #define BLURFL foo
4768
4769 BLURFL xx LFRULB
4770 EOM
4771         previous=''
4772         for flag in $*
4773         do
4774                 case "$flag" in
4775                 -*) ftry="$flag";;
4776                 *) ftry="$previous $flag";;
4777                 esac
4778                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4779                         >cpp1.out 2>/dev/null && \
4780                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4781                         >cpp2.out 2>/dev/null && \
4782                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4783                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4784                 then
4785                         cppflags="$cppflags $ftry"
4786                         previous=''
4787                 else
4788                         previous="$flag"
4789                 fi
4790         done
4791         set X $cppflags
4792         shift
4793         cppflags=${1+"$@"}
4794         case "$cppflags" in
4795         *-*)  echo "They appear to be: $cppflags";;
4796         esac
4797         $rm -f cpp.c cpp?.out
4798         ;;
4799 esac
4800
4801 : flags used in final linking phase
4802 case "$ldflags" in
4803 '') if ./venix; then
4804                 dflt='-i -z'
4805         else
4806                 dflt=''
4807         fi
4808         case "$ccflags" in
4809         *-posix*) dflt="$dflt -posix" ;;
4810         esac
4811         ;;
4812 *) dflt="$ldflags";;
4813 esac
4814
4815 : Try to guess additional flags to pick up local libraries.
4816 for thislibdir in $libpth; do
4817         case " $loclibpth " in
4818         *" $thislibdir "*)
4819                 case "$dflt " in 
4820                 *"-L$thislibdir "*) ;;
4821                 *)  dflt="$dflt -L$thislibdir" ;;
4822                 esac
4823                 ;;
4824         esac
4825 done
4826
4827 case "$dflt" in
4828 '') dflt='none' ;;
4829 esac
4830
4831 $cat <<EOH
4832
4833 Your C linker may need flags.  For this question you should
4834 include -L/whatever and any other flags used by the C linker, but you
4835 should NOT include libraries like -lwhatever.
4836
4837 Make sure you include the appropriate -L/path flags if your C linker
4838 does not normally search all of the directories you specified above,
4839 namely
4840         $libpth
4841 To use no flags, specify the word "none".
4842
4843 EOH
4844
4845 rp="Any additional ld flags (NOT including libraries)?"
4846 . ./myread
4847 case "$ans" in
4848 none) ldflags='';;
4849 *) ldflags="$ans";;
4850 esac
4851 rmlist="$rmlist pdp11"
4852
4853 : coherency check
4854 echo " "
4855 echo "Checking your choice of C compiler and flags for coherency..." >&4
4856 $cat > try.c <<'EOF'
4857 #include <stdio.h>
4858 int main() { printf("Ok\n"); exit(0); }
4859 EOF
4860 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4861 shift
4862 $cat >try.msg <<'EOM'
4863 I've tried to compile and run the following simple program:
4864
4865 EOM
4866 $cat try.c >> try.msg
4867
4868 $cat >> try.msg <<EOM
4869
4870 I used the command:
4871
4872         $*
4873         $run ./try
4874
4875 and I got the following output:
4876
4877 EOM
4878 dflt=y
4879 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4880         if $sh -c "$run ./try" >>try.msg 2>&1; then
4881                 xxx=`$run ./try`
4882                 case "$xxx" in
4883                 "Ok") dflt=n ;;
4884                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4885                         case " $libs " in
4886                         *" -lsfio "*)
4887                                 cat >> try.msg <<'EOQS'
4888 If $libs contains -lsfio, and sfio is mis-configured, then it
4889 sometimes (apparently) runs and exits with a 0 status, but with no
4890 output!  It may have to do with sfio's use of _exit vs. exit.
4891
4892 EOQS
4893                                 rp="You have a big problem.  Shall I abort Configure"
4894                                 dflt=y
4895                                 ;;
4896                         esac
4897                         ;;
4898                 esac
4899         else
4900                 echo "The program compiled OK, but exited with status $?." >>try.msg
4901                 rp="You have a problem.  Shall I abort Configure"
4902                 dflt=y
4903         fi
4904 else
4905         echo "I can't compile the test program." >>try.msg
4906         rp="You have a BIG problem.  Shall I abort Configure"
4907         dflt=y
4908 fi
4909 case "$dflt" in
4910 y)
4911         $cat try.msg >&4
4912         case "$knowitall" in
4913         '')
4914                 echo "(The supplied flags or libraries might be incorrect.)"
4915                 ;;
4916         *) dflt=n;;
4917         esac
4918         echo " "
4919         . ./myread
4920         case "$ans" in
4921         n*|N*) ;;
4922         *)      echo "Ok.  Stopping Configure." >&4
4923                 exit 1
4924                 ;;
4925         esac
4926         ;;
4927 n) echo "OK, that should do.";;
4928 esac
4929 $rm -f try try.* core
4930
4931 : define a shorthand compile call
4932 compile='
4933 mc_file=$1;
4934 shift;
4935 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4936 : define a shorthand compile call for compilations that should be ok.
4937 compile_ok='
4938 mc_file=$1;
4939 shift;
4940 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4941
4942 : check for lengths of integral types
4943 echo " "
4944 case "$intsize" in
4945 '')
4946         echo "Checking to see how big your integers are..." >&4
4947         $cat >try.c <<'EOCP'
4948 #include <stdio.h>
4949 int main()
4950 {
4951         printf("intsize=%d;\n", (int)sizeof(int));
4952         printf("longsize=%d;\n", (int)sizeof(long));
4953         printf("shortsize=%d;\n", (int)sizeof(short));
4954         exit(0);
4955 }
4956 EOCP
4957         set try
4958         if eval $compile_ok && $run ./try > /dev/null; then
4959                 eval `$run ./try`
4960                 echo "Your integers are $intsize bytes long."
4961                 echo "Your long integers are $longsize bytes long."
4962                 echo "Your short integers are $shortsize bytes long."
4963         else
4964                 $cat >&4 <<EOM
4965 !
4966 Help! I can't compile and run the intsize test program: please enlighten me!
4967 (This is probably a misconfiguration in your system or libraries, and
4968 you really ought to fix it.  Still, I'll try anyway.)
4969 !
4970 EOM
4971                 dflt=4
4972                 rp="What is the size of an integer (in bytes)?"
4973                 . ./myread
4974                 intsize="$ans"
4975                 dflt=$intsize
4976                 rp="What is the size of a long integer (in bytes)?"
4977                 . ./myread
4978                 longsize="$ans"
4979                 dflt=2
4980                 rp="What is the size of a short integer (in bytes)?"
4981                 . ./myread
4982                 shortsize="$ans"
4983         fi
4984         ;;
4985 esac
4986 $rm -f try try.*
4987
4988 : check for long long
4989 echo " "
4990 echo "Checking to see if you have long long..." >&4
4991 echo 'int main() { long long x = 7; return 0; }' > try.c
4992 set try
4993 if eval $compile; then
4994         val="$define"
4995         echo "You have long long."
4996 else
4997         val="$undef"
4998         echo "You do not have long long."
4999 fi
5000 $rm try.*
5001 set d_longlong
5002 eval $setvar
5003
5004 : check for length of long long
5005 case "${d_longlong}${longlongsize}" in
5006 $define)
5007         echo " "
5008         echo "Checking to see how big your long longs are..." >&4
5009         $cat >try.c <<'EOCP'
5010 #include <stdio.h>
5011 int main()
5012 {
5013     printf("%d\n", (int)sizeof(long long));
5014     return(0);
5015 }
5016 EOCP
5017         set try
5018         if eval $compile_ok; then
5019                 longlongsize=`$run ./try`
5020                 echo "Your long longs are $longlongsize bytes long."
5021         else
5022                 dflt='8'
5023                 echo " "
5024                 echo "(I can't seem to compile the test program.  Guessing...)"
5025                 rp="What is the size of a long long (in bytes)?"
5026                 . ./myread
5027                 longlongsize="$ans"
5028         fi
5029         if $test "X$longsize" = "X$longlongsize"; then
5030                 echo "(That isn't any different from an ordinary long.)"
5031         fi      
5032         ;;
5033 esac
5034 $rm -f try.* try
5035
5036 : determine filename position in cpp output
5037 echo " "
5038 echo "Computing filename position in cpp output for #include directives..." >&4
5039 case "$osname" in
5040 vos) testaccess=-e ;;
5041 *)   testaccess=-r ;;
5042 esac
5043 echo '#include <stdio.h>' > foo.c
5044 $cat >fieldn <<EOF
5045 $startsh
5046 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5047 $grep '^[       ]*#.*stdio\.h' | \
5048 while read cline; do
5049         pos=1
5050         set \$cline
5051         while $test \$# -gt 0; do
5052                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5053                         echo "\$pos"
5054                         exit 0
5055                 fi
5056                 shift
5057                 pos=\`expr \$pos + 1\`
5058         done
5059 done
5060 EOF
5061 chmod +x fieldn
5062 fieldn=`./fieldn`
5063 $rm -f foo.c fieldn
5064 case $fieldn in
5065 '') pos='???';;
5066 1) pos=first;;
5067 2) pos=second;;
5068 3) pos=third;;
5069 *) pos="${fieldn}th";;
5070 esac
5071 echo "Your cpp writes the filename in the $pos field of the line."
5072
5073 case "$osname" in
5074 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5075 *)   cppfilter='' ;;
5076 esac
5077 : locate header file
5078 $cat >findhdr <<EOF
5079 $startsh
5080 wanted=\$1
5081 name=''
5082 for usrincdir in $usrinc
5083 do
5084         if test -f \$usrincdir/\$wanted; then
5085                 echo "\$usrincdir/\$wanted"
5086                 exit 0
5087         fi
5088 done
5089 awkprg='{ print \$$fieldn }'
5090 echo "#include <\$wanted>" > foo\$\$.c
5091 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5092 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5093 while read cline; do
5094         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5095         case "\$name" in
5096         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5097         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5098         *) exit 2;;
5099         esac;
5100 done;
5101 #
5102 # status = 0: grep returned 0 lines, case statement not executed
5103 # status = 1: headerfile found
5104 # status = 2: while loop executed, no headerfile found
5105 #
5106 status=\$?
5107 $rm -f foo\$\$.c;
5108 if test \$status -eq 1; then
5109         exit 0;
5110 fi
5111 exit 1
5112 EOF
5113 chmod +x findhdr
5114
5115 : define an alternate in-header-list? function
5116 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5117 cont=true; xxf="echo \"<\$1> found.\" >&4";
5118 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5119 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5120 esac;
5121 case $# in 4) instead=instead;; *) instead="at last";; esac;
5122 while $test "$cont"; do
5123         xxx=`./findhdr $1`
5124         var=$2; eval "was=\$$2";
5125         if $test "$xxx" && $test -r "$xxx";
5126         then eval $xxf;
5127         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5128                 cont="";
5129         else eval $xxnf;
5130         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5131         set $yyy; shift; shift; yyy=$@;
5132         case $# in 0) cont="";;
5133         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5134                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5135         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5136                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5137         esac;
5138 done;
5139 while $test "$yyy";
5140 do set $yyy; var=$2; eval "was=\$$2";
5141         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5142         set $yyy; shift; shift; yyy=$@;
5143 done'
5144
5145 : see if inttypes.h is available
5146 : we want a real compile instead of Inhdr because some systems
5147 : have an inttypes.h which includes non-existent headers
5148 echo " "
5149 $cat >try.c <<EOCP
5150 #include <inttypes.h>
5151 int main() {
5152         static int32_t foo32 = 0x12345678;
5153 }
5154 EOCP
5155 set try
5156 if eval $compile; then
5157         echo "<inttypes.h> found." >&4
5158         val="$define"
5159 else
5160         echo "<inttypes.h> NOT found." >&4
5161         val="$undef"
5162 fi
5163 $rm -f try.c try
5164 set i_inttypes
5165 eval $setvar
5166
5167 : check for int64_t
5168 echo " "
5169 echo "Checking to see if you have int64_t..." >&4
5170 $cat >try.c <<EOCP
5171 #include <sys/types.h>
5172 #$i_inttypes I_INTTYPES
5173 #ifdef I_INTTYPES
5174 #include <inttypes.h>
5175 #endif
5176 int main() { int64_t x = 7; }
5177 EOCP
5178 set try
5179 if eval $compile; then
5180         val="$define"
5181         echo "You have int64_t."
5182 else
5183         val="$undef"
5184         echo "You do not have int64_t."
5185 fi
5186 $rm -f try try.*
5187 set d_int64_t
5188 eval $setvar
5189
5190
5191 echo " "
5192 echo "Checking which 64-bit integer type we could use..." >&4
5193
5194 case "$intsize" in
5195 8) val=int
5196    set quadtype
5197    eval $setvar
5198    val='"unsigned int"'
5199    set uquadtype
5200    eval $setvar
5201    quadkind=1
5202    ;;
5203 *) case "$longsize" in
5204    8) val=long
5205       set quadtype
5206       eval $setvar
5207       val='"unsigned long"'
5208       set uquadtype
5209       eval $setvar
5210       quadkind=2
5211       ;;
5212    *) case "$d_longlong:$longlongsize" in
5213       define:8)
5214         val='"long long"'
5215         set quadtype
5216         eval $setvar
5217         val='"unsigned long long"'
5218         set uquadtype
5219         eval $setvar
5220         quadkind=3
5221         ;;
5222       *) case "$d_int64_t" in
5223          define)
5224            val=int64_t
5225            set quadtype
5226            eval $setvar
5227            val=uint64_t
5228            set uquadtype
5229            eval $setvar
5230            quadkind=4
5231            ;;
5232          esac
5233          ;;
5234       esac
5235       ;;
5236    esac
5237    ;;
5238 esac
5239
5240 case "$quadtype" in
5241 '')     echo "Alas, no 64-bit integer types in sight." >&4
5242         d_quad="$undef"
5243         ;;
5244 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5245         d_quad="$define"
5246         ;;
5247 esac
5248
5249
5250 case "$uselonglong" in
5251 "$define"|true|[yY]*)
5252         cat <<EOM >&4
5253
5254 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5255 EOM
5256         use64bitint="$define"
5257         ;;
5258 esac                          
5259 case "$use64bits" in
5260 "$define"|true|[yY]*)
5261         cat <<EOM >&4
5262
5263 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5264 EOM
5265         use64bitint="$define"
5266         ;;
5267 esac                          
5268 case "$use64bitints" in
5269 "$define"|true|[yY]*)
5270         cat <<EOM >&4
5271
5272 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5273 EOM
5274         use64bitint="$define"
5275         ;;
5276 esac                          
5277 case "$use64bitsint" in
5278 "$define"|true|[yY]*)
5279         cat <<EOM >&4
5280
5281 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5282 EOM
5283         use64bitint="$define"
5284         ;;
5285 esac                          
5286 case "$uselonglongs" in
5287 "$define"|true|[yY]*)
5288         cat <<EOM >&4
5289
5290 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5291 EOM
5292         use64bitint="$define"
5293         ;;
5294 esac                          
5295 case "$use64bitsall" in
5296 "$define"|true|[yY]*)
5297         cat <<EOM >&4
5298
5299 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5300 EOM
5301         use64bitall="$define"
5302         ;;
5303 esac                          
5304
5305 case "$ccflags" in
5306 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5307 esac
5308 case "$use64bitall" in
5309 "$define"|true|[yY]*) use64bitint="$define" ;;
5310 esac
5311
5312 case "$longsize" in
5313 8) cat <<EOM
5314
5315 You have natively 64-bit long integers.
5316 EOM
5317    val="$define"
5318    ;;
5319 *) case "$use64bitint" in
5320    "$define"|true|[yY]*) dflt='y';;
5321    *) dflt='n';;
5322    esac
5323    case "$d_quad" in
5324    "$define") ;;
5325    *) dflt='n' ;;
5326    esac
5327    cat <<EOM
5328
5329 Perl can be built to take advantage of 64-bit integer types
5330 on some systems.  To do so, Configure can be run with -Duse64bitint.
5331 Choosing this option will most probably introduce binary incompatibilities.
5332
5333 If this doesn't make any sense to you, just accept the default '$dflt'.
5334 (The default has been chosen based on your configuration.)
5335 EOM
5336    rp='Try to use 64-bit integers, if available?'
5337    . ./myread
5338    case "$ans" in
5339    [yY]*) val="$define" ;;
5340    *)     val="$undef"  ;;
5341    esac
5342    ;;
5343 esac
5344 set use64bitint
5345 eval $setvar
5346
5347 case "$use64bitall" in
5348 "$define"|true|[yY]*) dflt='y' ;;
5349 *) case "$longsize" in
5350    8) dflt='y' ;;
5351    *) dflt='n' ;;
5352    esac
5353    ;;
5354 esac    
5355 cat <<EOM
5356
5357 You may also choose to try maximal 64-bitness.  It means using as much
5358 64-bitness as possible on the platform.  This in turn means even more
5359 binary incompatibilities.  On the other hand, your platform may not
5360 have any more 64-bitness available than what you already have chosen.
5361
5362 If this doesn't make any sense to you, just accept the default '$dflt'.
5363 (The default has been chosen based on your configuration.)
5364 EOM
5365 rp='Try to use maximal 64-bit support, if available?'
5366 . ./myread
5367 case "$ans" in
5368 [yY]*) val="$define" ;;
5369 *)     val="$undef"  ;;
5370 esac
5371 set use64bitall
5372 eval $setvar
5373 case "$use64bitall" in
5374 "$define")
5375         case "$use64bitint" in
5376         "$undef")
5377                 cat <<EOM
5378
5379 Since you have chosen a maximally 64-bit build, I'm also turning on
5380 the use of 64-bit integers.
5381 EOM
5382                 use64bitint="$define" ;;
5383         esac
5384         ;;
5385 esac
5386
5387 case "$use64bitint" in
5388 "$define"|true|[yY]*)
5389 : Look for a hint-file generated 'call-back-unit'.  If the
5390 : user has specified that a 64-bit perl is to be built,
5391 : we may need to set or change some other defaults.
5392         if $test -f use64bitint.cbu; then
5393                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5394                 . ./use64bitint.cbu
5395         fi
5396         case "$longsize" in
5397         4) case "$archname64" in
5398            '') archname64=64int ;;
5399            esac
5400            ;;
5401         esac
5402         ;;
5403 esac
5404
5405 case "$use64bitall" in
5406 "$define"|true|[yY]*)
5407 : Look for a hint-file generated 'call-back-unit'.  If the
5408 : user has specified that a maximally 64-bit perl is to be built,
5409 : we may need to set or change some other defaults.
5410         if $test -f use64bitall.cbu; then
5411                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5412                 . ./use64bitall.cbu
5413         fi
5414         case "$longsize" in
5415         4) case "$archname64" in
5416            ''|64int) archname64=64all ;;
5417            esac
5418            ;;
5419         esac
5420         ;;
5421 esac
5422
5423 echo " "
5424 echo "Checking for GNU C Library..." >&4
5425 cat >try.c <<'EOCP'
5426 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5427    alone are insufficient to distinguish different versions, such as
5428    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5429    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5430 */
5431 #include <stdio.h>
5432 int main(void)
5433 {
5434 #ifdef __GLIBC__
5435 #   ifdef __GLIBC_MINOR__
5436 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5437 #           include <gnu/libc-version.h>
5438             printf("%s\n",  gnu_get_libc_version());
5439 #       else
5440             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5441 #       endif
5442 #   else
5443         printf("%d\n",  __GLIBC__);
5444 #   endif
5445     return 0;
5446 #else
5447     return 1;
5448 #endif
5449 }
5450 EOCP
5451 set try
5452 if eval $compile_ok && $run ./try > glibc.ver; then
5453         val="$define"
5454         gnulibc_version=`$cat glibc.ver`
5455         echo "You are using the GNU C Library version $gnulibc_version"
5456 else
5457         val="$undef"
5458         gnulibc_version=''
5459         echo "You are not using the GNU C Library"
5460 fi
5461 $rm -f try try.* glibc.ver
5462 set d_gnulibc
5463 eval $setvar
5464
5465 : see if nm is to be used to determine whether a symbol is defined or not
5466 case "$usenm" in
5467 '')
5468         dflt=''
5469         case "$d_gnulibc" in
5470         "$define")
5471                 echo " "
5472                 echo "nm probably won't work on the GNU C Library." >&4
5473                 dflt=n
5474                 ;;
5475         esac
5476         case "$dflt" in
5477         '') 
5478                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5479                         echo " "
5480                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5481                         echo "'nm' won't be sufficient on this sytem." >&4
5482                         dflt=n
5483                 fi
5484                 ;;
5485         esac
5486         case "$dflt" in
5487         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5488                 if $test $dflt -gt 20; then
5489                         dflt=y
5490                 else
5491                         dflt=n
5492                 fi
5493                 ;;
5494         esac
5495         ;;
5496 *)
5497         case "$usenm" in
5498         true|$define) dflt=y;;
5499         *) dflt=n;;
5500         esac
5501         ;;
5502 esac
5503 $cat <<EOM
5504
5505 I can use $nm to extract the symbols from your C libraries. This
5506 is a time consuming task which may generate huge output on the disk (up
5507 to 3 megabytes) but that should make the symbols extraction faster. The
5508 alternative is to skip the 'nm' extraction part and to compile a small
5509 test program instead to determine whether each symbol is present. If
5510 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5511 this may be the best solution.
5512
5513 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5514
5515 EOM
5516 rp="Shall I use $nm to extract C symbols from the libraries?"
5517 . ./myread
5518 case "$ans" in
5519 [Nn]*) usenm=false;;
5520 *) usenm=true;;
5521 esac
5522
5523 runnm=$usenm
5524 case "$reuseval" in
5525 true) runnm=false;;
5526 esac
5527
5528 : nm options which may be necessary
5529 case "$nm_opt" in
5530 '') if $test -f /mach_boot; then
5531                 nm_opt=''       # Mach
5532         elif $test -d /usr/ccs/lib; then
5533                 nm_opt='-p'     # Solaris (and SunOS?)
5534         elif $test -f /dgux; then
5535                 nm_opt='-p'     # DG-UX
5536         elif $test -f /lib64/rld; then
5537                 nm_opt='-p'     # 64-bit Irix
5538         else
5539                 nm_opt=''
5540         fi;;
5541 esac
5542
5543 : nm options which may be necessary for shared libraries but illegal
5544 : for archive libraries.  Thank you, Linux.
5545 case "$nm_so_opt" in
5546 '')     case "$myuname" in
5547         *linux*)
5548                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5549                         nm_so_opt='--dynamic'
5550                 fi
5551                 ;;
5552         esac
5553         ;;
5554 esac
5555
5556 case "$runnm" in
5557 true)
5558 : get list of predefined functions in a handy place
5559 echo " "
5560 case "$libc" in
5561 '') libc=unknown
5562         case "$libs" in
5563         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5564         esac
5565         ;;
5566 esac
5567 case "$libs" in
5568 '') ;;
5569 *)  for thislib in $libs; do
5570         case "$thislib" in
5571         -lc|-lc_s)
5572                 : Handle C library specially below.
5573                 ;;
5574         -l*)
5575                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5576                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5577                         :
5578                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5579                         :
5580                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5581                         :
5582                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5583                         :
5584                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5585                         :
5586                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5587                         :
5588                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5589                         :
5590                 else
5591                         try=''
5592                 fi
5593                 libnames="$libnames $try"
5594                 ;;
5595         *) libnames="$libnames $thislib" ;;
5596         esac
5597         done
5598         ;;
5599 esac
5600 xxx=normal
5601 case "$libc" in
5602 unknown)
5603         set /lib/libc.$so
5604         for xxx in $libpth; do
5605                 $test -r $1 || set $xxx/libc.$so
5606                 : The messy sed command sorts on library version numbers.
5607                 $test -r $1 || \
5608                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5609                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5610                                 h
5611                                 s/[0-9][0-9]*/0000&/g
5612                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5613                                 G
5614                                 s/\n/ /' | \
5615                          $sort | $sed -e 's/^.* //'`
5616                 eval set \$$#
5617         done
5618         $test -r $1 || set /usr/ccs/lib/libc.$so
5619         $test -r $1 || set /lib/libsys_s$_a
5620         ;;
5621 *)
5622         set blurfl
5623         ;;
5624 esac
5625 if $test -r "$1"; then
5626         echo "Your (shared) C library seems to be in $1."
5627         libc="$1"
5628 elif $test -r /lib/libc && $test -r /lib/clib; then
5629         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5630         xxx=apollo
5631         libc='/lib/clib /lib/libc'
5632         if $test -r /lib/syslib; then
5633                 echo "(Your math library is in /lib/syslib.)"
5634                 libc="$libc /lib/syslib"
5635         fi
5636 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5637         echo "Your C library seems to be in $libc, as you said before."
5638 elif $test -r $incpath/usr/lib/libc$_a; then
5639         libc=$incpath/usr/lib/libc$_a;
5640         echo "Your C library seems to be in $libc.  That's fine."
5641 elif $test -r /lib/libc$_a; then
5642         libc=/lib/libc$_a;
5643         echo "Your C library seems to be in $libc.  You're normal."
5644 else
5645         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5646                 :
5647         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5648                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5649         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5650                 :
5651         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5652                 :
5653         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5654                 :
5655         else
5656                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5657         fi
5658         if $test -r "$tans"; then
5659                 echo "Your C library seems to be in $tans, of all places."
5660                 libc=$tans
5661         else
5662                 libc='blurfl'
5663         fi
5664 fi
5665 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5666         dflt="$libc"
5667         cat <<EOM
5668
5669 If the guess above is wrong (which it might be if you're using a strange
5670 compiler, or your machine supports multiple models), you can override it here.
5671
5672 EOM
5673 else
5674         dflt=''
5675         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5676         cat >&4 <<EOM
5677 I can't seem to find your C library.  I've looked in the following places:
5678
5679 EOM
5680         $sed 's/^/      /' libpath
5681         cat <<EOM
5682
5683 None of these seems to contain your C library. I need to get its name...
5684
5685 EOM
5686 fi
5687 fn=f
5688 rp='Where is your C library?'
5689 . ./getfile
5690 libc="$ans"
5691
5692 echo " "
5693 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5694 set X `cat libnames`
5695 shift
5696 xxx=files
5697 case $# in 1) xxx=file; esac
5698 echo "Extracting names from the following $xxx for later perusal:" >&4
5699 echo " "
5700 $sed 's/^/      /' libnames >&4
5701 echo " "
5702 $echo $n "This may take a while...$c" >&4
5703
5704 for file in $*; do
5705         case $file in
5706         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5707         *) $nm $nm_opt $file 2>/dev/null;;
5708         esac
5709 done >libc.tmp
5710
5711 $echo $n ".$c"
5712 $grep fprintf libc.tmp > libc.ptf
5713 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5714 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5715 xxx='[ADTSIW]'
5716 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5717         eval $xscan;\
5718         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5719                 eval $xrun
5720 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5721         eval $xscan;\
5722         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5723                 eval $xrun
5724 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5741                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5742         eval $xscan;\
5743         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5744                 eval $xrun
5745 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5746         eval $xscan;\
5747         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5748                 eval $xrun
5749 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5754         eval $xscan;\
5755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756                 eval $xrun
5757 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5762         eval $xscan;\
5763         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764                 eval $xrun
5765 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5766         eval $xscan;\
5767         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768                 eval $xrun
5769 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5770         eval $xscan;\
5771         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772                 eval $xrun
5773 else
5774         $nm -p $* 2>/dev/null >libc.tmp
5775         $grep fprintf libc.tmp > libc.ptf
5776         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5777                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5778         then
5779                 nm_opt='-p'
5780                 eval $xrun
5781         else
5782                 echo " "
5783                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5784                 com=''
5785                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5786                         for thisname in $libnames $libc; do
5787                                 $ar t $thisname >>libc.tmp
5788                         done
5789                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5790                         echo "Ok." >&4
5791                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5792                         # Repeat libc to extract forwarders to DLL entries too
5793                         for thisname in $libnames $libc; do
5794                                 $ar tv $thisname >>libc.tmp
5795                                 # Revision 50 of EMX has bug in $ar.
5796                                 # it will not extract forwarders to DLL entries
5797                                 # Use emximp which will extract exactly them.
5798                                 emximp -o tmp.imp $thisname \
5799                                     2>/dev/null && \
5800                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5801                                     < tmp.imp >>libc.tmp
5802                                 $rm tmp.imp
5803                         done
5804                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5805                         echo "Ok." >&4
5806                 else
5807                         echo "$ar didn't seem to work right." >&4
5808                         echo "Maybe this is a Cray...trying bld instead..." >&4
5809                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5810                         then
5811                                 for thisname in $libnames; do
5812                                         bld t $libnames | \
5813                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5814                                         $ar t $thisname >>libc.tmp
5815                                 done
5816                                 echo "Ok." >&4
5817                         else
5818                                 echo "That didn't work either.  Giving up." >&4
5819                                 exit 1
5820                         fi
5821                 fi
5822         fi
5823 fi
5824 nm_extract="$com"
5825 case "$PASE" in
5826 define)
5827     echo " "
5828     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5829     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5830     ;;
5831 *)  if $test -f /lib/syscalls.exp; then
5832         echo " "
5833         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5834         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5835     fi
5836     ;;
5837 esac
5838 ;;
5839 esac
5840 $rm -f libnames libpath
5841
5842 : is a C symbol defined?
5843 csym='tlook=$1;
5844 case "$3" in
5845 -v) tf=libc.tmp; tc=""; tdc="";;
5846 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5847 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5848 esac;
5849 tx=yes;
5850 case "$reuseval-$4" in
5851 true-) ;;
5852 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5853 esac;
5854 case "$tx" in
5855 yes)
5856         case "$runnm" in
5857         true)
5858                 if $contains $tlook $tf >/dev/null 2>&1;
5859                 then tval=true;
5860                 else tval=false;
5861                 fi;;
5862         *)
5863                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5864                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5865                 then tval=true;
5866                 else tval=false;
5867                 fi;
5868                 $rm -f t t.c;;
5869         esac;;
5870 *)
5871         case "$tval" in
5872         $define) tval=true;;
5873         *) tval=false;;
5874         esac;;
5875 esac;
5876 eval "$2=$tval"'
5877
5878 : define an is-in-libc? function
5879 inlibc='echo " "; td=$define; tu=$undef;
5880 sym=$1; var=$2; eval "was=\$$2";
5881 tx=yes;
5882 case "$reuseval$was" in
5883 true) ;;
5884 true*) tx=no;;
5885 esac;
5886 case "$tx" in
5887 yes)
5888         set $sym tres -f;
5889         eval $csym;
5890         case "$tres" in
5891         true)
5892                 echo "$sym() found." >&4;
5893                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5894         *)
5895                 echo "$sym() NOT found." >&4;
5896                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5897         esac;;
5898 *)
5899         case "$was" in
5900         $define) echo "$sym() found." >&4;;
5901         *) echo "$sym() NOT found." >&4;;
5902         esac;;
5903 esac'
5904
5905 : see if sqrtl exists
5906 set sqrtl d_sqrtl
5907 eval $inlibc
5908
5909 hasproto='varname=$1; func=$2; shift; shift;
5910 while $test $# -ge 2; do
5911         case "$1" in
5912         $define) echo "#include <$2>";;
5913         esac ;
5914     shift 2;
5915 done > try.c;
5916 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5917 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5918         echo "$func() prototype found.";
5919         val="$define";
5920 else
5921         echo "$func() prototype NOT found.";
5922         val="$undef";
5923 fi;
5924 set $varname;
5925 eval $setvar;
5926 $rm -f try.c tryout.c'
5927
5928 : check for length of double
5929 echo " "
5930 case "$doublesize" in
5931 '')
5932         echo "Checking to see how big your double precision numbers are..." >&4
5933         $cat >try.c <<'EOCP'
5934 #include <stdio.h>
5935 int main()
5936 {
5937     printf("%d\n", (int)sizeof(double));
5938     exit(0);
5939 }
5940 EOCP
5941         set try
5942         if eval $compile_ok; then
5943                 doublesize=`$run ./try`
5944                 echo "Your double is $doublesize bytes long."
5945         else
5946                 dflt='8'
5947                 echo "(I can't seem to compile the test program.  Guessing...)"
5948                 rp="What is the size of a double precision number (in bytes)?"
5949                 . ./myread
5950                 doublesize="$ans"
5951         fi
5952         ;;
5953 esac
5954 $rm -f try.c try
5955
5956 : check for long doubles
5957 echo " "
5958 echo "Checking to see if you have long double..." >&4
5959 echo 'int main() { long double x = 7.0; }' > try.c
5960 set try
5961 if eval $compile; then
5962         val="$define"
5963         echo "You have long double."
5964 else
5965         val="$undef"
5966         echo "You do not have long double."
5967 fi
5968 $rm try.*
5969 set d_longdbl
5970 eval $setvar
5971
5972 : check for length of long double
5973 case "${d_longdbl}${longdblsize}" in
5974 $define)
5975         echo " "
5976         echo "Checking to see how big your long doubles are..." >&4
5977         $cat >try.c <<'EOCP'
5978 #include <stdio.h>
5979 int main()
5980 {
5981         printf("%d\n", sizeof(long double));
5982 }
5983 EOCP
5984         set try
5985         set try
5986         if eval $compile; then
5987                 longdblsize=`$run ./try`
5988                 echo "Your long doubles are $longdblsize bytes long."
5989         else
5990                 dflt='8'
5991                 echo " "
5992                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5993                 rp="What is the size of a long double (in bytes)?"
5994                 . ./myread
5995                 longdblsize="$ans"
5996         fi
5997         if $test "X$doublesize" = "X$longdblsize"; then
5998                 echo "(That isn't any different from an ordinary double.)"
5999         fi      
6000         ;;
6001 esac
6002 $rm -f try.* try
6003
6004 echo " "
6005
6006 if $test X"$d_longdbl" = X"$define"; then
6007
6008 echo "Checking how to print long doubles..." >&4
6009
6010 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6011         $cat >try.c <<'EOCP'
6012 #include <sys/types.h>
6013 #include <stdio.h>
6014 int main() {
6015   double d = 123.456;
6016   printf("%.3f\n", d);
6017 }
6018 EOCP
6019         set try
6020         if eval $compile; then
6021                 yyy=`$run ./try`
6022                 case "$yyy" in
6023                 123.456)
6024                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6025                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6026                         echo "We will use %f."
6027                         ;;
6028                 esac
6029         fi
6030 fi
6031
6032 if $test X"$sPRIfldbl" = X; then
6033         $cat >try.c <<'EOCP'
6034 #include <sys/types.h>
6035 #include <stdio.h>
6036 int main() {
6037   long double d = 123.456;
6038   printf("%.3Lf\n", d);
6039 }
6040 EOCP
6041         set try
6042         if eval $compile; then
6043                 yyy=`$run ./try`
6044                 case "$yyy" in
6045                 123.456)
6046                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6047                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6048                         echo "We will use %Lf."
6049                         ;;
6050                 esac
6051         fi
6052 fi
6053
6054 if $test X"$sPRIfldbl" = X; then
6055         $cat >try.c <<'EOCP'
6056 #include <sys/types.h>
6057 #include <stdio.h>
6058 int main() {
6059   long double d = 123.456;
6060   printf("%.3llf\n", d);
6061 }
6062 EOCP
6063         set try
6064         if eval $compile; then
6065                 yyy=`$run ./try`
6066                 case "$yyy" in
6067                 123.456)
6068                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6069                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6070                         echo "We will use %llf."
6071                         ;;
6072                 esac
6073         fi
6074 fi
6075
6076 if $test X"$sPRIfldbl" = X; then
6077         $cat >try.c <<'EOCP'
6078 #include <sys/types.h>
6079 #include <stdio.h>
6080 int main() {
6081   long double d = 123.456;
6082   printf("%.3lf\n", d);
6083 }
6084 EOCP
6085         set try
6086         if eval $compile; then
6087                 yyy=`$run ./try`
6088                 case "$yyy" in
6089                 123.456)
6090                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6091                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6092                         echo "We will use %lf."
6093                         ;;
6094                 esac
6095         fi
6096 fi
6097
6098 if $test X"$sPRIfldbl" = X; then
6099         echo "Cannot figure out how to print long doubles." >&4
6100 else
6101         sSCNfldbl=$sPRIfldbl    # expect consistency
6102 fi
6103
6104 $rm -f try try.*
6105
6106 fi # d_longdbl
6107
6108 case "$sPRIfldbl" in
6109 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6110         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6111         d_SCNfldbl="$undef";
6112         ;;
6113 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6114         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6115         d_SCNfldbl="$define";
6116         ;;
6117 esac
6118
6119 : see if modfl exists
6120 set modfl d_modfl
6121 eval $inlibc
6122
6123 : see if prototype for modfl is available
6124 echo " "
6125 set d_modflproto modfl math.h
6126 eval $hasproto
6127
6128 d_modfl_pow32_bug="$undef"
6129
6130 case "$d_longdbl$d_modfl" in
6131 $define$define)
6132         $cat <<EOM
6133 Checking to see whether your modfl() is okay for large values...
6134 EOM
6135 $cat >try.c <<EOCP
6136 #include <math.h> 
6137 #include <stdio.h>
6138 EOCP
6139 if $test "X$d_modflproto" != "X$define"; then
6140         $cat >>try.c <<EOCP
6141 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6142 long double modfl (long double, long double *);
6143 EOCP
6144 fi
6145 $cat >>try.c <<EOCP
6146 int main() {
6147     long double nv = 4294967303.15;
6148     long double v, w;
6149     v = modfl(nv, &w);         
6150 #ifdef __GLIBC__
6151     printf("glibc");
6152 #endif
6153     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6154     return 0;
6155 }
6156 EOCP
6157         case "$osname:$gccversion" in
6158         aix:)   saveccflags="$ccflags"
6159                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6160         esac
6161         set try
6162         if eval $compile; then
6163                 foo=`$run ./try`
6164                 case "$foo" in
6165                 *" 4294967303.150000 1.150000 4294967302.000000")
6166                         echo >&4 "Your modfl() is broken for large values."
6167                         d_modfl_pow32_bug="$define"
6168                         case "$foo" in
6169                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6170                         ;;
6171                         esac
6172                         ;;
6173                 *" 4294967303.150000 0.150000 4294967303.000000")
6174                         echo >&4 "Your modfl() seems okay for large values."
6175                         ;;
6176                 *)      echo >&4 "I don't understand your modfl() at all."
6177                         d_modfl="$undef"
6178                         ;;
6179                 esac
6180                 $rm -f try.* try core core.try.*
6181         else
6182                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6183                 d_modfl="$undef"
6184         fi
6185         case "$osname:$gccversion" in
6186         aix:)   ccflags="$saveccflags" ;; # restore
6187         esac
6188         ;;
6189 esac
6190
6191 case "$ccflags" in
6192 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6193 esac
6194
6195 case "$uselongdouble" in
6196 $define|true|[yY]*)     dflt='y';;
6197 *) dflt='n';;
6198 esac
6199 cat <<EOM
6200
6201 Perl can be built to take advantage of long doubles which
6202 (if available) may give more accuracy and range for floating point numbers.
6203
6204 If this doesn't make any sense to you, just accept the default '$dflt'.
6205 EOM
6206 rp='Try to use long doubles if available?'
6207 . ./myread
6208 case "$ans" in
6209 y|Y)    val="$define"   ;;
6210 *)      val="$undef"    ;;
6211 esac
6212 set uselongdouble
6213 eval $setvar
6214
6215 case "$uselongdouble" in
6216 true|[yY]*) uselongdouble="$define" ;;
6217 esac
6218
6219 case "$uselongdouble" in
6220 $define)
6221 : Look for a hint-file generated 'call-back-unit'.  If the
6222 : user has specified that long doubles should be used,
6223 : we may need to set or change some other defaults.
6224         if $test -f uselongdouble.cbu; then
6225                 echo "Your platform has some specific hints for long doubles, using them..."
6226                 . ./uselongdouble.cbu
6227         else
6228                 $cat <<EOM
6229 (Your platform doesn't have any specific hints for long doubles.)
6230 EOM
6231         fi
6232         ;;
6233 esac
6234
6235 message=X
6236 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6237 $define:$define:$define)
6238         : You have both
6239         ;;
6240 $define:$define:$undef)
6241         message="I could not find modfl"
6242         ;;
6243 $define:$undef:$define)
6244         message="I could not find sqrtl"
6245         ;;
6246 $define:$undef:$undef)
6247         message="I found neither sqrtl nor modfl"
6248         ;;
6249 esac
6250
6251 if $test "$message" != X; then
6252         $cat <<EOM >&4
6253
6254 *** You requested the use of long doubles but you do not seem to have
6255 *** the mathematic functions for long doubles.
6256 *** ($message)
6257 *** I'm disabling the use of long doubles.
6258
6259 EOM
6260
6261         uselongdouble=$undef
6262 fi
6263
6264 : determine the architecture name
6265 echo " "
6266 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6267         tarch=`arch`"-$osname"
6268 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6269         if uname -m > tmparch 2>&1 ; then
6270                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6271                         -e 's/$/'"-$osname/" tmparch`
6272         else
6273                 tarch="$osname"
6274         fi
6275         $rm -f tmparch
6276 else
6277         tarch="$osname"
6278 fi
6279 case "$myarchname" in
6280 ''|"$tarch") ;;
6281 *)
6282         echo "(Your architecture name used to be $myarchname.)"
6283         archname=''
6284         ;;
6285 esac
6286 case "$targetarch" in
6287 '') ;;
6288 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6289 esac
6290 myarchname="$tarch"
6291 case "$archname" in
6292 '') dflt="$tarch";;
6293 *) dflt="$archname";;
6294 esac
6295 rp='What is your architecture name'
6296 . ./myread
6297 archname="$ans"
6298 case "$usethreads" in
6299 $define)
6300         echo "Threads selected." >&4
6301         case "$archname" in
6302         *-thread*) echo "...and architecture name already has -thread." >&4
6303                 ;;
6304         *)      archname="$archname-thread"
6305                 echo "...setting architecture name to $archname." >&4
6306                 ;;
6307         esac
6308         ;;
6309 esac
6310 case "$usemultiplicity" in
6311 $define)
6312         echo "Multiplicity selected." >&4
6313         case "$archname" in
6314         *-multi*) echo "...and architecture name already has -multi." >&4
6315                 ;;
6316         *)      archname="$archname-multi"
6317                 echo "...setting architecture name to $archname." >&4
6318                 ;;
6319         esac
6320         ;;
6321 esac
6322 case "$use64bitint$use64bitall" in
6323 *"$define"*)
6324         case "$archname64" in
6325         '')
6326                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6327                 ;;
6328         *)
6329                 case "$use64bitint" in
6330                 "$define") echo "64 bit integers selected." >&4 ;;
6331                 esac
6332                 case "$use64bitall" in
6333                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6334                 esac
6335                 case "$archname" in
6336                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6337                         ;;
6338                 *)      archname="$archname-$archname64"
6339                         echo "...setting architecture name to $archname." >&4
6340                         ;;
6341                 esac
6342                 ;;
6343         esac
6344 esac
6345 case "$uselongdouble" in
6346 $define)
6347         echo "Long doubles selected." >&4
6348         case "$longdblsize" in
6349         $doublesize)
6350                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6351                 ;;
6352         *)
6353                 case "$archname" in
6354                 *-ld*) echo "...and architecture name already has -ld." >&4
6355                         ;;
6356                 *)      archname="$archname-ld"
6357                         echo "...setting architecture name to $archname." >&4
6358                         ;;
6359                 esac
6360                 ;;
6361         esac
6362         ;;
6363 esac
6364 case "$useperlio" in
6365 $define)
6366         echo "Perlio selected." >&4
6367         ;;
6368 *)
6369         echo "Perlio not selected, using stdio." >&4
6370         case "$archname" in
6371         *-stdio*) echo "...and architecture name already has -stdio." >&4
6372                 ;;
6373         *)      archname="$archname-stdio"
6374                 echo "...setting architecture name to $archname." >&4
6375                 ;;
6376         esac
6377         ;;
6378 esac
6379
6380 : determine root of directory hierarchy where package will be installed.
6381 case "$prefix" in
6382 '')
6383         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6384         ;;
6385 *?/)
6386         dflt=`echo "$prefix" | sed 's/.$//'`
6387         ;;
6388 *)
6389         dflt="$prefix"
6390         ;;
6391 esac
6392 $cat <<EOM
6393
6394 By default, $package will be installed in $dflt/bin, manual pages
6395 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6396 installation directories. Typically this is something like /usr/local.
6397 If you wish to have binaries under /usr/bin but other parts of the
6398 installation under /usr/local, that's ok: you will be prompted
6399 separately for each of the installation directories, the prefix being
6400 only used to set the defaults.
6401
6402 EOM
6403 fn=d~
6404 rp='Installation prefix to use?'
6405 . ./getfile
6406 oldprefix=''
6407 case "$prefix" in
6408 '') ;;
6409 *)
6410         case "$ans" in
6411         "$prefix") ;;
6412         *) oldprefix="$prefix";;
6413         esac
6414         ;;
6415 esac
6416 prefix="$ans"
6417 prefixexp="$ansexp"
6418
6419 case "$afsroot" in
6420 '')     afsroot=/afs ;;
6421 *)      afsroot=$afsroot ;;
6422 esac
6423
6424 : is AFS running?
6425 echo " "
6426 case "$afs" in
6427 $define|true)   afs=true ;;
6428 $undef|false)   afs=false ;;
6429 *)      if test -d $afsroot; then
6430                 afs=true
6431         else
6432                 afs=false
6433         fi
6434         ;;
6435 esac
6436 if $afs; then
6437         echo "AFS may be running... I'll be extra cautious then..." >&4
6438 else
6439         echo "AFS does not seem to be running..." >&4
6440 fi
6441
6442 : determine installation prefix for where package is to be installed.
6443 if $afs; then 
6444 $cat <<EOM
6445
6446 Since you are running AFS, I need to distinguish the directory in which
6447 files will reside from the directory in which they are installed (and from
6448 which they are presumably copied to the former directory by occult means).
6449
6450 EOM
6451         case "$installprefix" in
6452         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6453         *) dflt="$installprefix";;
6454         esac
6455 else
6456 $cat <<EOM
6457
6458 In some special cases, particularly when building $package for distribution,
6459 it is convenient to distinguish the directory in which files should be
6460 installed from the directory ($prefix) in which they will
6461 eventually reside.  For most users, these two directories are the same.
6462
6463 EOM
6464         case "$installprefix" in
6465         '') dflt=$prefix ;;
6466         *) dflt=$installprefix;;
6467         esac
6468 fi
6469 fn=d~
6470 rp='What installation prefix should I use for installing files?'
6471 . ./getfile
6472 installprefix="$ans"
6473 installprefixexp="$ansexp"
6474
6475 : set the prefixit variable, to compute a suitable default value
6476 prefixit='case "$3" in
6477 ""|none)
6478         case "$oldprefix" in
6479         "") eval "$1=\"\$$2\"";;
6480         *)
6481                 case "$3" in
6482                 "") eval "$1=";;
6483                 none)
6484                         eval "tp=\"\$$2\"";
6485                         case "$tp" in
6486                         ""|" ") eval "$1=\"\$$2\"";;
6487                         *) eval "$1=";;
6488                         esac;;
6489                 esac;;
6490         esac;;
6491 *)
6492         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6493         case "$tp" in
6494         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6495         /*-$oldprefix/*|\~*-$oldprefix/*)
6496                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6497         *) eval "$1=\"\$$2\"";;
6498         esac;;
6499 esac'
6500
6501 : get the patchlevel
6502 echo " "
6503 echo "Getting the current patchlevel..." >&4
6504 if $test -r $rsrc/patchlevel.h;then
6505         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6506         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6507         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6508         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6509         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6510         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6511        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6512 else
6513         revision=0
6514         patchlevel=0
6515         subversion=0
6516         api_revision=0
6517         api_version=0
6518         api_subversion=0
6519         perl_patchlevel=0
6520         $echo "(You do not have patchlevel.h.  Eek.)"
6521 fi
6522 if $test -r $rsrc/.patch ; then  
6523         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6524                 perl_patchlevel=`cat $rsrc/.patch`
6525         fi
6526 fi
6527 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6528 version_patchlevel_string="version $patchlevel subversion $subversion"
6529 case "$perl_patchlevel" in
6530 0|'') ;;
6531 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6532 esac
6533
6534 $echo "(You have $package $version_patchlevel_string.)"
6535
6536 case "$osname" in
6537 dos|vms)
6538         : XXX Should be a Configure test for double-dots in filenames.
6539         version=`echo $revision $patchlevel $subversion | \
6540                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6541         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6542                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6543         ;;
6544 *)
6545         version=`echo $revision $patchlevel $subversion | \
6546                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6547         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6548                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6549         ;;
6550 esac
6551 : Special case the 5.005_xx maintenance series, which used 5.005
6552 : without any subversion label as a subdirectory in $sitelib
6553 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6554         api_versionstring='5.005'
6555 fi
6556
6557 : determine installation style
6558 : For now, try to deduce it from prefix unless it is already set.
6559 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6560 case "$installstyle" in
6561 '')     case "$prefix" in
6562                 *perl*) dflt='lib';;
6563                 *) dflt='lib/perl5' ;;
6564         esac
6565         ;;
6566 *)      dflt="$installstyle" ;;
6567 esac
6568 : Probably not worth prompting for this since we prompt for all
6569 : the directories individually, and the prompt would be too long and
6570 : confusing anyway.
6571 installstyle=$dflt
6572
6573 : determine where private library files go
6574 : Usual default is /usr/local/lib/perl5/$version.
6575 : Also allow things like /opt/perl/lib/$version, since 
6576 : /opt/perl/lib/perl5... would be redundant.
6577 : The default "style" setting is made in installstyle.U
6578 case "$installstyle" in
6579 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6580 *)       set dflt privlib lib/$version ;;
6581 esac
6582 eval $prefixit
6583 $cat <<EOM
6584
6585 There are some auxiliary files for $package that need to be put into a
6586 private library directory that is accessible by everyone.
6587
6588 EOM
6589 fn=d~+
6590 rp='Pathname where the private library files will reside?'
6591 . ./getfile
6592 privlib="$ans"
6593 privlibexp="$ansexp"
6594 : Change installation prefix, if necessary.
6595 if $test X"$prefix" != X"$installprefix"; then
6596         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6597 else
6598         installprivlib="$privlibexp"
6599 fi
6600
6601 : set the prefixup variable, to restore leading tilda escape
6602 prefixup='case "$prefixexp" in
6603 "$prefix") ;;
6604 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6605 esac'
6606
6607 : determine where public architecture dependent libraries go
6608 set archlib archlib
6609 eval $prefixit
6610 : privlib default is /usr/local/lib/$package/$version
6611 : archlib default is /usr/local/lib/$package/$version/$archname
6612 : privlib may have an optional trailing /share.
6613 tdflt=`echo $privlib | $sed 's,/share$,,'`
6614 tdflt=$tdflt/$archname
6615 case "$archlib" in
6616 '')     dflt=$tdflt
6617         ;;
6618 *)      dflt="$archlib"
6619     ;;
6620 esac
6621 $cat <<EOM
6622
6623 $spackage contains architecture-dependent library files.  If you are
6624 sharing libraries in a heterogeneous environment, you might store
6625 these files in a separate location.  Otherwise, you can just include
6626 them with the rest of the public library files.
6627
6628 EOM
6629 fn=d+~
6630 rp='Where do you want to put the public architecture-dependent libraries?'
6631 . ./getfile
6632 archlib="$ans"
6633 archlibexp="$ansexp"
6634 if $test X"$archlib" = X"$privlib"; then
6635         d_archlib="$undef"
6636 else
6637         d_archlib="$define"
6638 fi
6639 : Change installation prefix, if necessary.
6640 if $test X"$prefix" != X"$installprefix"; then
6641         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6642 else
6643         installarchlib="$archlibexp"
6644 fi
6645
6646 : see if setuid scripts can be secure
6647 $cat <<EOM
6648
6649 Some kernels have a bug that prevents setuid #! scripts from being
6650 secure.  Some sites have disabled setuid #! scripts because of this.
6651
6652 First let's decide if your kernel supports secure setuid #! scripts.
6653 (If setuid #! scripts would be secure but have been disabled anyway,
6654 don't say that they are secure if asked.)
6655
6656 EOM
6657
6658 val="$undef"
6659 if $test -d /dev/fd; then
6660         echo "#!$ls" >reflect
6661         chmod +x,u+s reflect
6662         ./reflect >flect 2>&1
6663         if $contains "/dev/fd" flect >/dev/null; then
6664                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6665                 val="$define"
6666         else
6667                 $cat <<EOM
6668 If you are not sure if they are secure, I can check but I'll need a
6669 username and password different from the one you are using right now.
6670 If you don't have such a username or don't want me to test, simply
6671 enter 'none'.
6672
6673 EOM
6674                 rp='Other username to test security of setuid scripts with?'
6675                 dflt='none'
6676                 . ./myread
6677                 case "$ans" in
6678                 n|none)
6679                         case "$d_suidsafe" in
6680                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6681                                 dflt=n;;
6682                         "$undef")
6683                                 echo "Well, the $hint value is *not* secure." >&4
6684                                 dflt=n;;
6685                         *)      echo "Well, the $hint value *is* secure." >&4
6686                                 dflt=y;;
6687                         esac
6688                         ;;
6689                 *)
6690                         $rm -f reflect flect
6691                         echo "#!$ls" >reflect
6692                         chmod +x,u+s reflect
6693                         echo >flect
6694                         chmod a+w flect
6695                         echo '"su" will (probably) prompt you for '"$ans's password."
6696                         su $ans -c './reflect >flect'
6697                         if $contains "/dev/fd" flect >/dev/null; then
6698                                 echo "Okay, it looks like setuid scripts are secure." >&4
6699                                 dflt=y
6700                         else
6701                                 echo "I don't think setuid scripts are secure." >&4
6702                                 dflt=n
6703                         fi
6704                         ;;
6705                 esac
6706                 rp='Does your kernel have *secure* setuid scripts?'
6707                 . ./myread
6708                 case "$ans" in
6709                 [yY]*)  val="$define";;
6710                 *)      val="$undef";;
6711                 esac
6712         fi
6713 else
6714         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6715         echo "(That's for file descriptors, not floppy disks.)"
6716         val="$undef"
6717 fi
6718 set d_suidsafe
6719 eval $setvar
6720
6721 $rm -f reflect flect
6722
6723 : now see if they want to do setuid emulation
6724 echo " "
6725 val="$undef"
6726 case "$d_suidsafe" in
6727 "$define")
6728         val="$undef"
6729         echo "No need to emulate SUID scripts since they are secure here." >&4
6730         ;;
6731 *)
6732         $cat <<EOM
6733 Some systems have disabled setuid scripts, especially systems where
6734 setuid scripts cannot be secure.  On systems where setuid scripts have
6735 been disabled, the setuid/setgid bits on scripts are currently
6736 useless.  It is possible for $package to detect those bits and emulate
6737 setuid/setgid in a secure fashion.  This emulation will only work if
6738 setuid scripts have been disabled in your kernel.
6739
6740 EOM
6741         case "$d_dosuid" in
6742         "$define") dflt=y ;;
6743         *) dflt=n ;;
6744         esac
6745         rp="Do you want to do setuid/setgid emulation?"
6746         . ./myread
6747         case "$ans" in
6748         [yY]*)  val="$define";;
6749         *)      val="$undef";;
6750         esac
6751         ;;
6752 esac
6753 set d_dosuid
6754 eval $setvar
6755
6756 : see if this is a malloc.h system
6757 : we want a real compile instead of Inhdr because some systems have a
6758 : malloc.h that just gives a compile error saying to use stdlib.h instead
6759 echo " "
6760 $cat >try.c <<EOCP
6761 #include <stdlib.h>
6762 #include <malloc.h>
6763 int main () { return 0; }
6764 EOCP
6765 set try
6766 if eval $compile; then
6767     echo "<malloc.h> found." >&4
6768     val="$define"
6769 else
6770     echo "<malloc.h> NOT found." >&4
6771     val="$undef"
6772 fi
6773 $rm -f try.c try
6774 set i_malloc
6775 eval $setvar
6776
6777 : see if stdlib is available
6778 set stdlib.h i_stdlib
6779 eval $inhdr
6780
6781 : check for void type
6782 echo " "
6783 echo "Checking to see how well your C compiler groks the void type..." >&4
6784 case "$voidflags" in
6785 '')
6786         $cat >try.c <<'EOCP'
6787 #if TRY & 1
6788 void sub() {
6789 #else
6790 sub() {
6791 #endif
6792         extern void moo();      /* function returning void */
6793         void (*goo)();          /* ptr to func returning void */
6794 #if TRY & 8
6795         void *hue;              /* generic ptr */
6796 #endif
6797 #if TRY & 2
6798         void (*foo[10])();
6799 #endif
6800
6801 #if TRY & 4
6802         if(goo == moo) {
6803                 exit(0);
6804         }
6805 #endif
6806         exit(0);
6807 }
6808 int main() { sub(); }
6809 EOCP
6810         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6811                 voidflags=$defvoidused
6812         echo "Good.  It appears to support void to the level $package wants.">&4
6813                 if $contains warning .out >/dev/null 2>&1; then
6814                         echo "However, you might get some warnings that look like this:"
6815                         $cat .out
6816                 fi
6817         else
6818 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6819                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6820                         echo "It supports 1..."
6821                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6822                                 echo "It also supports 2..."
6823                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6824                                         voidflags=7
6825                                         echo "And it supports 4 but not 8 definitely."
6826                                 else
6827                                         echo "It doesn't support 4..."
6828                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6829                                                 voidflags=11
6830                                                 echo "But it supports 8."
6831                                         else
6832                                                 voidflags=3
6833                                                 echo "Neither does it support 8."
6834                                         fi
6835                                 fi
6836                         else
6837                                 echo "It does not support 2..."
6838                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6839                                         voidflags=13
6840                                         echo "But it supports 4 and 8."
6841                                 else
6842                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6843                                                 voidflags=5
6844                                                 echo "And it supports 4 but has not heard about 8."
6845                                         else
6846                                                 echo "However it supports 8 but not 4."
6847                                         fi
6848                                 fi
6849                         fi
6850                 else
6851                         echo "There is no support at all for void."
6852                         voidflags=0
6853                 fi
6854         fi
6855 esac
6856 case "$voidflags" in
6857 "$defvoidused") ;;
6858 *)      $cat >&4 <<'EOM'
6859   Support flag bits are:
6860     1: basic void declarations.
6861     2: arrays of pointers to functions returning void.
6862     4: operations between pointers to and addresses of void functions.
6863     8: generic void pointers.
6864 EOM
6865         dflt="$voidflags";
6866         rp="Your void support flags add up to what?"
6867         . ./myread
6868         voidflags="$ans"
6869         ;;
6870 esac
6871 $rm -f try.* .out
6872
6873 : check for length of pointer
6874 echo " "
6875 case "$ptrsize" in
6876 '')
6877         echo "Checking to see how big your pointers are..." >&4
6878         if test "$voidflags" -gt 7; then
6879                 echo '#define VOID_PTR char *' > try.c
6880         else
6881                 echo '#define VOID_PTR void *' > try.c
6882         fi
6883         $cat >>try.c <<'EOCP'
6884 #include <stdio.h>
6885 int main()
6886 {
6887     printf("%d\n", (int)sizeof(VOID_PTR));
6888     exit(0);
6889 }
6890 EOCP
6891         set try
6892         if eval $compile_ok; then
6893                 ptrsize=`$run ./try`
6894                 echo "Your pointers are $ptrsize bytes long."
6895         else
6896                 dflt='4'
6897                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6898                 rp="What is the size of a pointer (in bytes)?"
6899                 . ./myread
6900                 ptrsize="$ans"
6901         fi
6902         ;;
6903 esac
6904 $rm -f try.c try
6905 case "$use64bitall" in
6906 "$define"|true|[yY]*)
6907         case "$ptrsize" in
6908         4)      cat <<EOM >&4
6909
6910 *** You have chosen a maximally 64-bit build, but your pointers
6911 *** are only 4 bytes wide, disabling maximal 64-bitness.
6912
6913 EOM
6914                 use64bitall="$undef"
6915                 case "$use64bitint" in
6916                 "$define"|true|[yY]*) ;;
6917                 *)      cat <<EOM >&4
6918
6919 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6920
6921 EOM
6922                         use64bitint="$define"
6923                         ;;
6924                 esac
6925                 ;;
6926         esac
6927         ;;
6928 esac
6929
6930
6931 : determine which malloc to compile in
6932 echo " "
6933 case "$usemymalloc" in
6934 [yY]*|true|$define)     dflt='y' ;;
6935 [nN]*|false|$undef)     dflt='n' ;;
6936 *)      case "$ptrsize" in
6937         4) dflt='y' ;;
6938         *) dflt='n' ;;
6939         esac
6940         ;;
6941 esac
6942 rp="Do you wish to attempt to use the malloc that comes with $package?"
6943 . ./myread
6944 usemymalloc="$ans"
6945 case "$ans" in
6946 y*|true)
6947         usemymalloc='y'
6948         mallocsrc='malloc.c'
6949         mallocobj="malloc$_o"
6950         d_mymalloc="$define"
6951         case "$libs" in
6952         *-lmalloc*)
6953                 : Remove malloc from list of libraries to use
6954                 echo "Removing unneeded -lmalloc from library list" >&4
6955                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6956                 shift
6957                 libs="$*"
6958                 echo "libs = $libs" >&4
6959                 ;;
6960         esac
6961         ;;
6962 *)
6963         usemymalloc='n'
6964         mallocsrc=''
6965         mallocobj=''
6966         d_mymalloc="$undef"
6967         ;;
6968 esac
6969
6970 : compute the return types of malloc and free
6971 echo " "
6972 $cat >malloc.c <<END
6973 #$i_malloc I_MALLOC
6974 #$i_stdlib I_STDLIB
6975 #include <stdio.h>
6976 #include <sys/types.h>
6977 #ifdef I_MALLOC
6978 #include <malloc.h>
6979 #endif
6980 #ifdef I_STDLIB
6981 #include <stdlib.h>
6982 #endif
6983 #ifdef TRY_MALLOC
6984 void *malloc();
6985 #endif
6986 #ifdef TRY_FREE
6987 void free();
6988 #endif
6989 END
6990 case "$malloctype" in
6991 '')
6992         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6993                 malloctype='void *'
6994         else
6995                 malloctype='char *'
6996         fi
6997         ;;
6998 esac
6999 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7000
7001 case "$freetype" in
7002 '')
7003         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7004                 freetype='void'
7005         else
7006                 freetype='int'
7007         fi
7008         ;;
7009 esac
7010 echo "Your system uses $freetype free(), it would seem." >&4
7011 $rm -f malloc.[co]
7012 $cat <<EOM
7013
7014 After $package is installed, you may wish to install various
7015 add-on modules and utilities.  Typically, these add-ons will
7016 be installed under $prefix with the rest
7017 of this package.  However, you may wish to install such add-ons
7018 elsewhere under a different prefix.
7019
7020 If you do not wish to put everything under a single prefix, that's
7021 ok.  You will be prompted for the individual locations; this siteprefix
7022 is only used to suggest the defaults.
7023
7024 The default should be fine for most people.
7025
7026 EOM
7027 fn=d~+
7028 rp='Installation prefix to use for add-on modules and utilities?'
7029 : XXX Here might be another good place for an installstyle setting.
7030 case "$siteprefix" in
7031 '') dflt=$prefix ;;
7032 *)  dflt=$siteprefix ;;
7033 esac
7034 . ./getfile
7035 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7036 oldsiteprefix=''
7037 case "$siteprefix" in
7038 '') ;;
7039 *)      case "$ans" in
7040         "$prefix") ;;
7041         *) oldsiteprefix="$prefix";;
7042         esac
7043         ;;
7044 esac
7045 siteprefix="$ans"
7046 siteprefixexp="$ansexp"
7047
7048 : determine where site specific libraries go.
7049 : Usual default is /usr/local/lib/perl5/site_perl/$version
7050 : The default "style" setting is made in installstyle.U
7051 : XXX No longer works with Prefixit stuff.
7052 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7053 case "$sitelib" in
7054 '') case "$installstyle" in
7055         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7056         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7057         esac
7058         ;;
7059 *)      dflt="$sitelib"
7060         ;;
7061 esac
7062 $cat <<EOM
7063
7064 The installation process will create a directory for
7065 site-specific extensions and modules.  Most users find it convenient
7066 to place all site-specific files in this directory rather than in the
7067 main distribution directory.
7068
7069 EOM
7070 fn=d~+
7071 rp='Pathname for the site-specific library files?'
7072 . ./getfile
7073 sitelib="$ans"
7074 sitelibexp="$ansexp"
7075 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7076 : Change installation prefix, if necessary.
7077 if $test X"$prefix" != X"$installprefix"; then
7078         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7079 else
7080         installsitelib="$sitelibexp"
7081 fi
7082
7083 : determine where site specific architecture-dependent libraries go.
7084 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7085 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7086 : sitelib may have an optional trailing /share.
7087 case "$sitearch" in
7088 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7089         dflt="$dflt/$archname"
7090         ;;
7091 *)      dflt="$sitearch"
7092         ;;
7093 esac
7094 set sitearch sitearch none
7095 eval $prefixit
7096 $cat <<EOM
7097
7098 The installation process will also create a directory for
7099 architecture-dependent site-specific extensions and modules.
7100
7101 EOM
7102 fn=d~+
7103 rp='Pathname for the site-specific architecture-dependent library files?'
7104 . ./getfile
7105 sitearch="$ans"
7106 sitearchexp="$ansexp"
7107 : Change installation prefix, if necessary.
7108 if $test X"$prefix" != X"$installprefix"; then
7109         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7110 else
7111         installsitearch="$sitearchexp"
7112 fi
7113
7114 $cat <<EOM
7115
7116 The installation process will also create a directory for
7117 vendor-supplied add-ons.  Vendors who supply perl with their system
7118 may find it convenient to place all vendor-supplied files in this
7119 directory rather than in the main distribution directory.  This will
7120 ease upgrades between binary-compatible maintenance versions of perl.
7121
7122 Of course you may also use these directories in whatever way you see
7123 fit.  For example, you might use them to access modules shared over a
7124 company-wide network.
7125
7126 The default answer should be fine for most people.
7127 This causes further questions about vendor add-ons to be skipped
7128 and no vendor-specific directories will be configured for perl.
7129
7130 EOM
7131 rp='Do you want to configure vendor-specific add-on directories?'
7132 case "$usevendorprefix" in
7133 define|true|[yY]*) dflt=y ;;
7134 *)      : User may have set vendorprefix directly on Configure command line.
7135         case "$vendorprefix" in
7136         ''|' ') dflt=n ;;
7137         *)      dflt=y ;;
7138         esac
7139         ;;
7140 esac
7141 . ./myread
7142 case "$ans" in
7143 [yY]*)  fn=d~+
7144         rp='Installation prefix to use for vendor-supplied add-ons?'
7145         case "$vendorprefix" in
7146         '') dflt='' ;;
7147         *)  dflt=$vendorprefix ;;
7148         esac
7149         . ./getfile
7150         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7151         oldvendorprefix=''
7152         case "$vendorprefix" in
7153         '') ;;
7154         *)      case "$ans" in
7155                 "$prefix") ;;
7156                 *) oldvendorprefix="$prefix";;
7157                 esac
7158                 ;;
7159         esac
7160         usevendorprefix="$define"
7161         vendorprefix="$ans"
7162         vendorprefixexp="$ansexp"
7163         ;;
7164 *)      usevendorprefix="$undef"
7165         vendorprefix=''
7166         vendorprefixexp=''
7167         ;;
7168 esac
7169
7170 case "$vendorprefix" in
7171 '')     d_vendorlib="$undef"
7172         vendorlib=''
7173         vendorlibexp=''
7174         ;;
7175 *)      d_vendorlib="$define"
7176         : determine where vendor-supplied modules go.
7177         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7178         case "$vendorlib" in
7179         '')
7180                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7181                 case "$installstyle" in
7182                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7183                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7184                 esac
7185                 ;;
7186         *)      dflt="$vendorlib"
7187                 ;;
7188         esac
7189         fn=d~+
7190         rp='Pathname for the vendor-supplied library files?'
7191         . ./getfile
7192         vendorlib="$ans"
7193         vendorlibexp="$ansexp"
7194         ;;
7195 esac
7196 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7197 : Change installation prefix, if necessary.
7198 if $test X"$prefix" != X"$installprefix"; then
7199         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7200 else
7201         installvendorlib="$vendorlibexp"
7202 fi
7203
7204 case "$vendorprefix" in
7205 '')     d_vendorarch="$undef"
7206         vendorarch=''
7207         vendorarchexp=''
7208         ;;
7209 *)      d_vendorarch="$define"
7210         : determine where vendor-supplied architecture-dependent libraries go.
7211         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7212         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7213         : vendorlib may have an optional trailing /share.
7214         case "$vendorarch" in
7215         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7216                 dflt="$dflt/$archname"
7217                 ;;
7218         *)      dflt="$vendorarch" ;;
7219         esac
7220         fn=d~+
7221         rp='Pathname for vendor-supplied architecture-dependent files?'
7222         . ./getfile
7223         vendorarch="$ans"
7224         vendorarchexp="$ansexp"
7225         ;;
7226 esac
7227 : Change installation prefix, if necessary.
7228 if $test X"$prefix" != X"$installprefix"; then
7229         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7230 else
7231         installvendorarch="$vendorarchexp"
7232 fi
7233
7234 : Final catch-all directories to search
7235 $cat <<EOM
7236
7237 Lastly, you can have perl look in other directories for extensions and
7238 modules in addition to those already specified.
7239 These directories will be searched after 
7240         $sitearch 
7241         $sitelib 
7242 EOM
7243 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7244 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7245 echo ' '
7246 case "$otherlibdirs" in
7247 ''|' ') dflt='none' ;;
7248 *)      dflt="$otherlibdirs" ;;
7249 esac
7250 $cat <<EOM
7251 Enter a colon-separated set of extra paths to include in perl's @INC
7252 search path, or enter 'none' for no extra paths.
7253
7254 EOM
7255
7256 rp='Colon-separated list of additional directories for perl to search?'
7257 . ./myread
7258 case "$ans" in
7259 ' '|''|none)    otherlibdirs=' ' ;;     
7260 *)      otherlibdirs="$ans" ;;
7261 esac
7262 case "$otherlibdirs" in
7263 ' ') val=$undef ;;
7264 *)      val=$define ;;
7265 esac
7266 set d_perl_otherlibdirs
7267 eval $setvar
7268
7269 : Cruising for prototypes
7270 echo " "
7271 echo "Checking out function prototypes..." >&4
7272 $cat >prototype.c <<'EOCP'
7273 int main(int argc, char *argv[]) {
7274         exit(0);}
7275 EOCP
7276 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7277         echo "Your C compiler appears to support function prototypes."
7278         val="$define"
7279 else
7280         echo "Your C compiler doesn't seem to understand function prototypes."
7281         val="$undef"
7282 fi
7283 set prototype
7284 eval $setvar
7285 $rm -f prototype*
7286
7287 case "$prototype" in
7288 "$define") ;;
7289 *)      ansi2knr='ansi2knr'
7290         echo " "
7291         cat <<EOM >&4
7292
7293 $me:  FATAL ERROR:
7294 This version of $package can only be compiled by a compiler that 
7295 understands function prototypes.  Unfortunately, your C compiler 
7296         $cc $ccflags
7297 doesn't seem to understand them.  Sorry about that.
7298
7299 If GNU cc is available for your system, perhaps you could try that instead.  
7300
7301 Eventually, we hope to support building Perl with pre-ANSI compilers.
7302 If you would like to help in that effort, please contact <perlbug@perl.org>.
7303
7304 Aborting Configure now.
7305 EOM
7306         exit 2
7307         ;;
7308 esac
7309
7310 : determine where public executables go
7311 echo " "
7312 set dflt bin bin
7313 eval $prefixit
7314 fn=d~
7315 rp='Pathname where the public executables will reside?'
7316 . ./getfile
7317 if $test "X$ansexp" != "X$binexp"; then
7318         installbin=''
7319 fi
7320 bin="$ans"
7321 binexp="$ansexp"
7322 : Change installation prefix, if necessary.
7323 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7324 if $test X"$prefix" != X"$installprefix"; then
7325         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7326 else
7327         installbin="$binexp"
7328 fi
7329
7330 echo " "
7331 case "$extras" in
7332 '') dflt='n';;
7333 *) dflt='y';;
7334 esac
7335 cat <<EOM
7336 Perl can be built with extra modules or bundles of modules which
7337 will be fetched from the CPAN and installed alongside Perl.
7338
7339 Notice that you will need access to the CPAN; either via the Internet,
7340 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7341 be asked later to configure the CPAN.pm module which will in turn do
7342 the installation of the rest of the extra modules or bundles.)
7343
7344 Notice also that if the modules require any external software such as
7345 libraries and headers (the libz library and the zlib.h header for the
7346 Compress::Zlib module, for example) you MUST have any such software
7347 already installed, this configuration process will NOT install such
7348 things for you.
7349
7350 If this doesn't make any sense to you, just accept the default '$dflt'.
7351 EOM
7352 rp='Install any extra modules (y or n)?'
7353 . ./myread
7354 case "$ans" in
7355 y|Y)
7356         cat <<EOM
7357
7358 Please list any extra modules or bundles to be installed from CPAN,
7359 with spaces between the names.  The names can be in any format the
7360 'install' command of CPAN.pm will understand.  (Answer 'none',
7361 without the quotes, to install no extra modules or bundles.)
7362 EOM
7363         rp='Extras?'
7364         dflt="$extras"
7365         . ./myread
7366         extras="$ans"
7367 esac
7368 case "$extras" in
7369 ''|'none')
7370         val=''
7371         $rm -f ../extras.lst
7372         ;;
7373 *)      echo "(Saving the list of extras for later...)"
7374         echo "$extras" > ../extras.lst
7375         val="'$extras'"
7376         ;;
7377 esac
7378 set extras
7379 eval $setvar
7380 echo " "
7381
7382 : determine where html pages for programs go
7383 set html1dir html1dir none
7384 eval $prefixit
7385 $cat <<EOM
7386
7387 If you wish to install html files for programs in $spackage, indicate 
7388 the appropriate directory here.  To skip installing html files,
7389 answer "none".
7390 EOM
7391 case "$html1dir" in
7392 ''|none|$undef|' ') dflt=none ;;
7393 *) dflt=$html1dir ;;
7394 esac
7395 fn=dn+~
7396 rp="Directory for the main $spackage html pages?"
7397 . ./getfile
7398 html1dir="$ans"
7399 html1direxp="$ansexp"
7400 : Use ' ' for none so value is preserved next time through Configure
7401 $test X"$html1dir" = "X" && html1dir=' '
7402 : Change installation prefix, if necessary.
7403 if $test X"$prefix" != X"$installprefix"; then
7404         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7405 else
7406         installhtml1dir="$html1direxp"
7407 fi
7408
7409 : determine where html pages for libraries and modules go
7410 set html3dir html3dir none
7411 eval $prefixit
7412 $cat <<EOM
7413
7414 If you wish to install html files for modules associated with $spackage,
7415 indicate the appropriate directory here.  To skip installing html files,
7416 answer "none".
7417 EOM
7418 : There is no obvious default.  If they have specified html1dir, then
7419 : try to key off that, possibly changing .../html1 into .../html3.
7420 case "$html3dir" in
7421 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7422 *) dflt=$html3dir ;;
7423 esac
7424 fn=dn+~
7425 rp="Directory for the $spackage module html pages?"
7426 . ./getfile
7427 html3dir="$ans"
7428 html3direxp="$ansexp"
7429 : Use ' ' for none so value is preserved next time through Configure
7430 $test X"$html3dir" = "X" && html3dir=' '
7431 : Change installation prefix, if necessary.
7432 if $test X"$prefix" != X"$installprefix"; then
7433         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7434 else
7435         installhtml3dir="$html3direxp"
7436 fi
7437
7438 : Find perl5.005 or later.
7439 echo "Looking for a previously installed perl5.005 or later... "
7440 case "$perl5" in
7441 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7442                 : Check if this perl is recent and can load a simple module
7443                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7444                         perl5=$tdir/perl
7445                         break;
7446                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7447                         perl5=$tdir/perl5
7448                         break;
7449                 fi
7450         done
7451         ;;
7452 *)      perl5="$perl5"
7453         ;;
7454 esac
7455 case "$perl5" in
7456 '')     echo "None found.  That's ok.";;
7457 *)      echo "Using $perl5." ;;
7458 esac
7459
7460 : Determine list of previous versions to include in @INC
7461 $cat > getverlist <<EOPL
7462 #!$perl5 -w
7463 use File::Basename;
7464 \$api_versionstring = "$api_versionstring";
7465 \$version = "$version";
7466 \$stem = "$sitelib_stem";
7467 \$archname = "$archname";
7468 EOPL
7469         $cat >> getverlist <<'EOPL'
7470 # Can't have leading @ because metaconfig interprets it as a command!
7471 ;@inc_version_list=();
7472 # XXX Redo to do opendir/readdir? 
7473 if (-d $stem) {
7474     chdir($stem);
7475     ;@candidates = glob("5.*");
7476 }
7477 else {
7478     ;@candidates = ();
7479 }
7480
7481 # XXX ToDo:  These comparisons must be reworked when two-digit
7482 # subversions come along, so that 5.7.10 compares as greater than
7483 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7484 # widespread that we can use the built-in version vectors rather
7485 # than reinventing them here.  For 5.6.0, however, we must
7486 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7487 foreach $d (@candidates) {
7488     if ($d lt $version) {
7489         if ($d ge $api_versionstring) {
7490             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7491         }
7492         elsif ($d ge "5.005") {
7493             unshift(@inc_version_list, grep { -d } $d);
7494         }
7495     }
7496     else {
7497         # Skip newer version.  I.e. don't look in
7498         # 5.7.0 if we're installing 5.6.1.
7499     }
7500 }
7501
7502 if (@inc_version_list) {
7503     print join(' ', @inc_version_list);
7504 }
7505 else {
7506     # Blank space to preserve value for next Configure run.
7507     print " ";
7508 }
7509 EOPL
7510 chmod +x getverlist
7511 case "$inc_version_list" in
7512 '')     if test -x "$perl5$exe_ext"; then
7513                 dflt=`$perl5 getverlist`
7514         else
7515                 dflt='none'
7516         fi
7517         ;;
7518 $undef) dflt='none' ;;
7519 *)  eval dflt=\"$inc_version_list\" ;;
7520 esac
7521 case "$dflt" in
7522 ''|' ') dflt=none ;;
7523 esac
7524 case "$dflt" in
7525 5.005) dflt=none ;;
7526 esac
7527 $cat <<EOM
7528
7529 In order to ease the process of upgrading, this version of perl 
7530 can be configured to use modules built and installed with earlier 
7531 versions of perl that were installed under $prefix.  Specify here
7532 the list of earlier versions that this version of perl should check.
7533 If Configure detected no earlier versions of perl installed under
7534 $prefix, then the list will be empty.  Answer 'none' to tell perl
7535 to not search earlier versions.
7536
7537 The default should almost always be sensible, so if you're not sure,
7538 just accept the default.
7539 EOM
7540
7541 rp='List of earlier versions to include in @INC?'
7542 . ./myread
7543 case "$ans" in
7544 [Nn]one|''|' ') inc_version_list=' ' ;;
7545 *) inc_version_list="$ans" ;;
7546 esac
7547 case "$inc_version_list" in
7548 ''|' ') 
7549         inc_version_list_init='0';;
7550 *)      inc_version_list_init=`echo $inc_version_list |
7551                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7552         ;;
7553 esac
7554 $rm -f getverlist
7555
7556 : determine whether to install perl also as /usr/bin/perl
7557
7558 echo " "
7559 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7560         $cat <<EOM
7561 Many scripts expect perl to be installed as /usr/bin/perl.
7562
7563 If you want to, I can install the perl you are about to compile
7564 as /usr/bin/perl (in addition to $bin/perl).
7565 EOM
7566         if test -f /usr/bin/perl; then
7567             $cat <<EOM
7568
7569 However, please note that because you already have a /usr/bin/perl,
7570 overwriting that with a new Perl would very probably cause problems.
7571 Therefore I'm assuming you don't want to do that (unless you insist).
7572
7573 EOM
7574             case "$installusrbinperl" in
7575             "$define"|[yY]*)    dflt='y';;
7576             *)                  dflt='n';;
7577             esac
7578         else
7579             $cat <<EOM
7580
7581 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7582
7583 EOM
7584             case "$installusrbinperl" in
7585             "$undef"|[nN]*)     dflt='n';;
7586             *)                  dflt='y';;
7587             esac
7588         fi
7589         rp="Do you want to install perl as /usr/bin/perl?"
7590         . ./myread
7591         case "$ans" in
7592         [yY]*)  val="$define";;
7593         *)      val="$undef" ;;
7594         esac
7595 else
7596         val="$undef"
7597 fi
7598 set installusrbinperl
7599 eval $setvar
7600
7601 : see if dld is available
7602 set dld.h i_dld
7603 eval $inhdr
7604
7605 : see if dlopen exists
7606 xxx_runnm="$runnm"
7607 runnm=false
7608 set dlopen d_dlopen
7609 eval $inlibc
7610 runnm="$xxx_runnm"
7611
7612 : determine which dynamic loading, if any, to compile in
7613 echo " "
7614 dldir="ext/DynaLoader"
7615 case "$usedl" in
7616 $define|y|true)
7617         dflt='y'
7618         usedl="$define"
7619         ;;
7620 $undef|n|false)
7621         dflt='n'
7622         usedl="$undef"
7623         ;;
7624 *) 
7625         dflt='n'
7626         case "$d_dlopen" in
7627             $define) dflt='y' ;;
7628         esac
7629         case "$i_dld" in
7630             $define) dflt='y' ;;
7631         esac
7632         : Does a dl_xxx.xs file exist for this operating system
7633         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7634         ;;
7635 esac
7636 rp="Do you wish to use dynamic loading?"
7637 . ./myread
7638 usedl="$ans"
7639 case "$ans" in
7640 y*) usedl="$define"
7641         case "$dlsrc" in
7642         '')
7643                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7644                         dflt="$dldir/dl_${osname}.xs"
7645                 elif $test "$d_dlopen" = "$define" ; then
7646                         dflt="$dldir/dl_dlopen.xs"
7647                 elif $test "$i_dld" = "$define" ; then
7648                         dflt="$dldir/dl_dld.xs"
7649                 else
7650                         dflt=''
7651                 fi
7652                 ;;
7653         *)      dflt="$dldir/$dlsrc"
7654                 ;;
7655         esac
7656     echo "The following dynamic loading files are available:"
7657         : Can not go over to $dldir because getfile has path hard-coded in.
7658         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7659         rp="Source file to use for dynamic loading"
7660         fn="fne"
7661         gfpth="$src"
7662         . ./getfile
7663         usedl="$define"
7664         : emulate basename
7665         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7666
7667         $cat << EOM
7668
7669 Some systems may require passing special flags to $cc -c to
7670 compile modules that will be used to create a shared library.
7671 To use no flags, say "none".
7672
7673 EOM
7674     case "$cccdlflags" in
7675     '') case "$gccversion" in
7676                 '') case "$osname" in
7677                         hpux)   dflt='+z' ;;
7678                         next)   dflt='none' ;;
7679                         irix*)  dflt='-KPIC' ;;
7680                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7681                         sunos)  dflt='-pic' ;;
7682                         *)      dflt='none' ;;
7683                     esac
7684                         ;;
7685                 *)  case "$osname" in
7686                         darwin) dflt='none' ;;
7687                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7688                         *)      dflt='-fpic' ;;
7689                     esac ;;
7690             esac ;;
7691         ' ') dflt='none' ;;
7692     *)  dflt="$cccdlflags" ;;
7693     esac
7694     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7695     . ./myread
7696     case "$ans" in
7697     none) cccdlflags=' ' ;;
7698     *) cccdlflags="$ans" ;;
7699     esac
7700
7701     cat << EOM
7702
7703 Some systems use ld to create libraries that can be dynamically loaded,
7704 while other systems (such as those using ELF) use $cc.
7705
7706 EOM
7707         case "$ld" in
7708         '')     $cat >try.c <<'EOM'
7709 /* Test for whether ELF binaries are produced */
7710 #include <fcntl.h>
7711 #include <stdlib.h>
7712 int main() {
7713         char b[4];
7714         int i = open("a.out",O_RDONLY);
7715         if(i == -1) 
7716                 exit(1); /* fail */
7717         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7718                 exit(0); /* succeed (yes, it's ELF) */
7719         else
7720                 exit(1); /* fail */
7721 }
7722 EOM
7723                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7724                         cat <<EOM
7725 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7726 EOM
7727                         dflt="$cc"
7728                 else
7729                         echo "I'll use ld to build dynamic libraries."
7730                         dflt='ld'
7731                 fi
7732                 rm -f try.c a.out
7733                 ;;
7734         *)      dflt="$ld"
7735                 ;;
7736         esac
7737
7738     rp="What command should be used to create dynamic libraries?"
7739     . ./myread
7740         ld="$ans"
7741
7742     cat << EOM
7743
7744 Some systems may require passing special flags to $ld to create a
7745 library that can be dynamically loaded.  If your ld flags include
7746 -L/other/path options to locate libraries outside your loader's normal
7747 search path, you may need to specify those -L options here as well.  To
7748 use no flags, say "none".
7749
7750 EOM
7751     case "$lddlflags" in
7752     '') case "$osname" in
7753                         beos) dflt='-nostart' ;;
7754                         hpux) dflt='-b';
7755                               case "$gccversion" in
7756                               '') dflt="$dflt +vnocompatwarnings" ;;
7757                               esac
7758                               ;;        
7759                         linux|irix*)    dflt='-shared' ;;
7760                         next)  dflt='none' ;;
7761                         solaris) dflt='-G' ;;
7762                         sunos) dflt='-assert nodefinitions' ;;
7763                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7764                 *)     dflt='none' ;;
7765                         esac
7766                         ;;
7767     *) dflt="$lddlflags" ;;
7768     esac
7769
7770         : Try to guess additional flags to pick up local libraries.
7771         : Be careful not to append to a plain 'none'
7772         case "$dflt" in
7773         none) dflt='' ;;
7774         esac
7775         for thisflag in $ldflags; do
7776                 case "$thisflag" in
7777                 -L*|-R*|-Wl,-R*)
7778                         case " $dflt " in
7779                         *" $thisflag "*) ;;
7780                         *) dflt="$dflt $thisflag" ;;
7781                         esac
7782                         ;;
7783                 esac
7784         done
7785
7786         case "$dflt" in
7787         ''|' ') dflt='none' ;;
7788         esac
7789
7790     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7791     . ./myread
7792     case "$ans" in
7793     none) lddlflags=' ' ;;
7794     *) lddlflags="$ans" ;;
7795     esac
7796
7797         cat <<EOM
7798
7799 Some systems may require passing special flags to $cc to indicate that
7800 the resulting executable will use dynamic linking.  To use no flags,
7801 say "none".
7802
7803 EOM
7804     case "$ccdlflags" in
7805     '') case "$osname" in
7806                 hpux)   dflt='-Wl,-E' ;;
7807                 linux)  dflt='-rdynamic' ;;
7808                 next)   dflt='none' ;;
7809                 sunos)  dflt='none' ;;
7810                 *)      dflt='none' ;;
7811             esac ;;
7812     ' ')  dflt='none' ;;
7813     *)  dflt="$ccdlflags" ;;
7814     esac
7815     rp="Any special flags to pass to $cc to use dynamic linking?"
7816     . ./myread
7817     case "$ans" in
7818     none) ccdlflags=' ' ;;
7819     *) ccdlflags="$ans" ;;
7820     esac
7821     ;;
7822 *)  usedl="$undef"
7823         ld='ld'
7824     dlsrc='dl_none.xs'
7825     lddlflags=''
7826     ccdlflags=''
7827     ;;
7828 esac
7829
7830 also=''
7831 case "$usedl" in
7832 $undef)
7833         # No dynamic loading being used, so don't bother even to prompt.
7834         useshrplib='false'
7835         ;;
7836 *)      case "$useshrplib" in
7837         '')     case "$osname" in
7838                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7839                         dflt=y
7840                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7841                         ;;
7842                 next*)
7843                         case "$osvers" in
7844                         4*)     dflt=y
7845                                 also='Building a shared libperl is needed for MAB support.'
7846                                 ;;
7847                         *)      dflt=n
7848                                 ;;
7849                         esac
7850                         ;;
7851                 *)      dflt=n
7852                         ;;
7853                 esac
7854                 ;;
7855         $define|true|[Yy]*)
7856                 dflt=y
7857                 ;;
7858         *)      dflt=n
7859                 ;;
7860         esac
7861         $cat << EOM
7862
7863 The perl executable is normally obtained by linking perlmain.c with
7864 libperl${_a}, any static extensions (usually just DynaLoader), and
7865 any other libraries needed on this system (such as -lm, etc.).  Since
7866 your system supports dynamic loading, it is probably possible to build
7867 a shared libperl.$so.  If you will have more than one executable linked
7868 to libperl.$so, this will significantly reduce the size of each
7869 executable, but it may have a noticeable affect on performance.  The
7870 default is probably sensible for your system.
7871 $also
7872
7873 EOM
7874         rp="Build a shared libperl.$so (y/n)"
7875         . ./myread
7876         case "$ans" in
7877         true|$define|[Yy]*)
7878                 useshrplib='true'  ;;
7879         *)      useshrplib='false' ;;
7880         esac
7881         ;;
7882 esac
7883
7884 case "$useshrplib" in
7885 true)
7886         case "$libperl" in
7887         '')
7888                 # Figure out a good name for libperl.so.  Since it gets stored in
7889                 # a version-specific architecture-dependent library, the version
7890                 # number isn't really that important, except for making cc/ld happy.
7891                 #
7892                 # A name such as libperl.so.3.1
7893                 majmin="libperl.$so.$patchlevel.$subversion"
7894                 # A name such as libperl.so.301
7895                 majonly=`echo $patchlevel $subversion |
7896                         $awk '{printf "%d%02d", $1, $2}'`
7897                 majonly=libperl.$so.$majonly
7898                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7899                 # rely on figuring it out from the naming of libc.
7900                 case "${osname}${osvers}" in
7901                 next4*)
7902                         dflt=libperl.5.$so
7903                         # XXX How handle the --version stuff for MAB?
7904                         ;;
7905                 linux*)  # ld won't link with a bare -lperl otherwise.
7906                         dflt=libperl.$so
7907                         ;;
7908                 cygwin*) # ld links against an importlib
7909                         dflt=libperl$lib_ext
7910                         ;;
7911                 *)      # Try to guess based on whether libc has major.minor.
7912                         case "$libc" in
7913                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7914                         *libc.$so.[0-9]*) dflt=$majonly ;;
7915                         *)      dflt=libperl.$so ;;
7916                         esac
7917                         ;;
7918                 esac
7919                 ;;
7920         *)      dflt=$libperl
7921                 ;;
7922         esac
7923         cat << EOM
7924
7925 I need to select a good name for the shared libperl.  If your system uses
7926 library names with major and minor numbers, then you might want something
7927 like $majmin.  Alternatively, if your system uses a single version
7928 number for shared libraries, then you might want to use $majonly.
7929 Or, your system might be quite happy with a simple libperl.$so.
7930
7931 Since the shared libperl will get installed into a version-specific
7932 architecture-dependent directory, the version number of the shared perl
7933 library probably isn't important, so the default should be o.k.
7934
7935 EOM
7936         rp='What name do you want to give to the shared libperl?'
7937         . ./myread
7938         libperl=$ans
7939         echo "Ok, I'll use $libperl"
7940         ;;
7941 *)
7942         libperl="libperl${_a}"
7943         ;;
7944 esac
7945
7946 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7947 case "$shrpdir" in
7948 '') ;;
7949 *)      $cat >&4 <<EOM
7950 WARNING:  Use of the shrpdir variable for the installation location of
7951 the shared $libperl is not supported.  It was never documented and
7952 will not work in this version.  Let me (perlbug@perl.org)
7953 know of any problems this may cause.
7954
7955 EOM
7956         case "$shrpdir" in
7957         "$archlibexp/CORE")
7958                 $cat >&4 <<EOM
7959 But your current setting of $shrpdir is
7960 the default anyway, so it's harmless.
7961 EOM
7962                 ;;
7963         *)
7964                 $cat >&4 <<EOM
7965 Further, your current attempted setting of $shrpdir
7966 conflicts with the value of $archlibexp/CORE
7967 that installperl will use.
7968 EOM
7969                 ;;
7970         esac
7971         ;;
7972 esac
7973
7974 # How will the perl executable find the installed shared $libperl?
7975 # Add $xxx to ccdlflags.
7976 # If we can't figure out a command-line option, use $shrpenv to
7977 # set env LD_RUN_PATH.  The main perl makefile uses this.
7978 shrpdir=$archlibexp/CORE
7979 xxx=''
7980 tmp_shrpenv=''
7981 if "$useshrplib"; then
7982     case "$osname" in 
7983         aix)
7984                 # We'll set it in Makefile.SH...
7985                 ;;
7986         solaris)
7987                 xxx="-R $shrpdir"
7988                 ;;
7989         freebsd|netbsd|openbsd)
7990                 xxx="-Wl,-R$shrpdir"
7991                 ;;
7992         bsdos|linux|irix*|dec_osf)
7993                 xxx="-Wl,-rpath,$shrpdir"
7994                 ;;
7995         next)
7996                 # next doesn't like the default...
7997                 ;;
7998         beos)
7999                 # beos doesn't like the default, either.
8000                 ;;
8001         hpux*)
8002                 # hpux doesn't like the default, either.
8003                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8004                 ;;
8005         *)
8006                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8007                 ;;
8008         esac
8009         case "$xxx" in
8010         '') ;;
8011         *)      
8012                 # Only add $xxx if it isn't already in ccdlflags.
8013                 case " $ccdlflags " in
8014                 *" $xxx "*)     ;;
8015                 *)      ccdlflags="$ccdlflags $xxx"
8016                         cat <<EOM >&4
8017
8018 Adding $xxx to the flags
8019 passed to $ld so that the perl executable will find the 
8020 installed shared $libperl.
8021
8022 EOM
8023                         ;;
8024                 esac
8025                 ;;
8026         esac
8027 fi
8028 # Fix ccdlflags in AIX for building external extensions.
8029 # (For building Perl itself bare -bE:perl.exp is needed,
8030 #  Makefile.SH takes care of this.)
8031 case "$osname" in
8032 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8033 esac
8034 # Respect a hint or command-line value.
8035 case "$shrpenv" in
8036 '') shrpenv="$tmp_shrpenv" ;;
8037 esac
8038 case "$ldlibpthname" in
8039 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8040 none)   ldlibpthname='' ;;
8041 esac
8042
8043 : determine where manual pages are on this system
8044 echo " "
8045 case "$sysman" in
8046 '') 
8047         syspath='/usr/share/man/man1 /usr/man/man1'
8048         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8049         syspath="$syspath /usr/man/u_man/man1"
8050         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8051         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8052         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8053         sysman=`./loc . /usr/man/man1 $syspath`
8054         ;;
8055 esac
8056 if $test -d "$sysman"; then
8057         echo "System manual is in $sysman." >&4
8058 else
8059         echo "Could not find manual pages in source form." >&4
8060 fi
8061
8062 : determine where manual pages go
8063 set man1dir man1dir none
8064 eval $prefixit
8065 $cat <<EOM
8066
8067 $spackage has manual pages available in source form.
8068 EOM
8069 case "$nroff" in
8070 nroff)
8071         echo "However, you don't have nroff, so they're probably useless to you."
8072         case "$man1dir" in
8073         '') man1dir="none";;
8074         esac;;
8075 esac
8076 echo "If you don't want the manual sources installed, answer 'none'."
8077 case "$man1dir" in
8078 ' ') dflt=none
8079         ;;
8080 '')
8081         lookpath="$prefixexp/share/man/man1"
8082         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8083         lookpath="$lookpath $prefixexp/man/p_man/man1"
8084         lookpath="$lookpath $prefixexp/man/u_man/man1"
8085         lookpath="$lookpath $prefixexp/man/man.1"
8086         case "$sysman" in
8087         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8088         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8089         esac
8090         set dflt
8091         eval $prefixup
8092         ;;
8093 *)  dflt="$man1dir"
8094         ;;
8095 esac
8096 echo " "
8097 fn=dn+~
8098 rp="Where do the main $spackage manual pages (source) go?"
8099 . ./getfile
8100 if $test "X$man1direxp" != "X$ansexp"; then
8101         installman1dir=''
8102 fi
8103 man1dir="$ans"
8104 man1direxp="$ansexp"
8105 case "$man1dir" in
8106 '')     man1dir=' '
8107         installman1dir='';;
8108 esac
8109
8110 : Change installation prefix, if necessary.
8111 if $test X"$prefix" != X"$installprefix"; then
8112         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8113 else
8114         installman1dir="$man1direxp"
8115 fi
8116
8117 : What suffix to use on installed man pages
8118
8119 case "$man1dir" in
8120 ' ')
8121         man1ext='0'
8122         ;;
8123 *)
8124         rp="What suffix should be used for the main $spackage man pages?"
8125         case "$man1ext" in
8126         '')     case "$man1dir" in
8127                 *1)  dflt=1 ;;
8128                 *1p) dflt=1p ;;
8129                 *1pm) dflt=1pm ;;
8130                 *l) dflt=l;;
8131                 *n) dflt=n;;
8132                 *o) dflt=o;;
8133                 *p) dflt=p;;
8134                 *C) dflt=C;;
8135                 *L) dflt=L;;
8136                 *L1) dflt=L1;;
8137                 *) dflt=1;;
8138                 esac
8139                 ;;
8140         *)      dflt="$man1ext";;
8141         esac
8142         . ./myread
8143         man1ext="$ans"
8144         ;;
8145 esac
8146
8147 : see if we can have long filenames
8148 echo " "
8149 first=123456789abcdef
8150 $rm -f $first
8151 if (echo hi >$first) 2>/dev/null; then
8152         if $test -f 123456789abcde; then
8153                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8154                 val="$undef"
8155         else
8156                 echo 'You can have filenames longer than 14 characters.'>&4
8157                 val="$define"
8158         fi
8159 else
8160         $cat <<'EOM'
8161 You can't have filenames longer than 14 chars.
8162 You can't even think about them!
8163 EOM
8164         val="$undef"
8165 fi 
8166 set d_flexfnam
8167 eval $setvar
8168 $rm -rf 123456789abcde*
8169
8170 : determine where library module manual pages go
8171 set man3dir man3dir none
8172 eval $prefixit
8173 $cat <<EOM
8174
8175 $spackage has manual pages for many of the library modules.
8176 EOM
8177
8178 case "$nroff" in
8179 nroff)
8180         $cat <<'EOM'
8181 However, you don't have nroff, so they're probably useless to you.
8182 EOM
8183         case "$man3dir" in
8184         '') man3dir="none";;
8185         esac;;
8186 esac
8187
8188 case "$d_flexfnam" in
8189 undef)
8190         $cat <<'EOM'
8191 However, your system can't handle the long file names like File::Basename.3. 
8192 EOM
8193         case "$man3dir" in
8194         '') man3dir="none";;
8195         esac;;
8196 esac
8197
8198 echo "If you don't want the manual sources installed, answer 'none'."
8199 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8200 case "$man3dir" in
8201 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8202         if $test -d "$privlib/man/man3"; then
8203                 cat <<EOM >&4
8204
8205 WARNING:  Previous versions of perl installed man3 pages into
8206 $privlib/man/man3.  This version will suggest a 
8207 new default of $dflt.  
8208 EOM
8209                 tdflt=$dflt
8210                 dflt='n'
8211                 rp='Do you wish to preserve the old behavior?(y/n)'
8212                 . ./myread
8213                 case "$ans" in
8214                 y*) dflt="$privlib/man/man3" ;;
8215                 *)  dflt=$tdflt ;;
8216                 esac
8217     fi
8218         ;;
8219 *)      dflt="$man3dir" ;;
8220 esac
8221 case "$dflt" in
8222 ' ') dflt=none ;;
8223 esac
8224 echo " "
8225 fn=dn+~
8226 rp="Where do the $package library man pages (source) go?"
8227 . ./getfile
8228 man3dir="$ans"
8229 man3direxp="$ansexp"
8230 case "$man3dir" in
8231 '')     man3dir=' '
8232         installman3dir='';;
8233 esac
8234
8235 : Change installation prefix, if necessary.
8236 if $test X"$prefix" != X"$installprefix"; then
8237         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8238 else
8239         installman3dir="$man3direxp"
8240 fi
8241
8242 : What suffix to use on installed man pages
8243 case "$man3dir" in
8244 ' ')
8245         man3ext='0'
8246         ;;
8247 *)
8248         rp="What suffix should be used for the $package library man pages?"
8249         case "$man3ext" in
8250         '')     case "$man3dir" in
8251                 *3)  dflt=3 ;;
8252                 *3p) dflt=3p ;;
8253                 *3pm) dflt=3pm ;;
8254                 *l) dflt=l;;
8255                 *n) dflt=n;;
8256                 *o) dflt=o;;
8257                 *p) dflt=p;;
8258                 *C) dflt=C;;
8259                 *L) dflt=L;;
8260                 *L3) dflt=L3;;
8261                 *) dflt=3;;
8262                 esac
8263                 ;;
8264         *)      dflt="$man3ext";;
8265         esac
8266         . ./myread
8267         man3ext="$ans"
8268         ;;
8269 esac
8270
8271 : see if we have to deal with yellow pages, now NIS.
8272 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8273         if $test -f /usr/etc/nibindd; then
8274                 echo " "
8275                 echo "I'm fairly confident you're on a NeXT."
8276                 echo " "
8277                 rp='Do you get the hosts file via NetInfo?'
8278                 dflt=y
8279                 case "$hostcat" in
8280                 nidump*) ;;
8281                 '') ;;
8282                 *) dflt=n;;
8283                 esac
8284                 . ./myread
8285                 case "$ans" in
8286                 y*) hostcat='nidump hosts .';;
8287                 *)      case "$hostcat" in
8288                         nidump*) hostcat='';;
8289                         esac
8290                         ;;
8291                 esac
8292         fi
8293         case "$hostcat" in
8294         nidump*) ;;
8295         *)
8296                 case "$hostcat" in
8297                 *ypcat*) dflt=y;;
8298                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8299                                 dflt=y
8300                         else
8301                                 dflt=n
8302                         fi;;
8303                 *) dflt=n;;
8304                 esac
8305                 echo " "
8306                 rp='Are you getting the hosts file via yellow pages?'
8307                 . ./myread
8308                 case "$ans" in
8309                 y*) hostcat='ypcat hosts';;
8310                 *) hostcat='cat /etc/hosts';;
8311                 esac
8312                 ;;
8313         esac
8314 fi
8315 case "$hostcat" in
8316 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8317 esac
8318 case "$groupcat" in
8319 '') test -f /etc/group && groupcat='cat /etc/group';;
8320 esac
8321 case "$passcat" in
8322 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8323 esac
8324
8325 : now get the host name
8326 echo " "
8327 echo "Figuring out host name..." >&4
8328 case "$myhostname" in
8329 '') cont=true
8330         echo 'Maybe "hostname" will work...'
8331         if tans=`sh -c hostname 2>&1` ; then
8332                 myhostname=$tans
8333                 phostname=hostname
8334                 cont=''
8335         fi
8336         ;;
8337 *) cont='';;
8338 esac
8339 if $test "$cont"; then
8340         if ./xenix; then
8341                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8342                 if tans=`cat /etc/systemid 2>&1` ; then
8343                         myhostname=$tans
8344                         phostname='cat /etc/systemid'
8345                         echo "Whadyaknow.  Xenix always was a bit strange..."
8346                         cont=''
8347                 fi
8348         elif $test -r /etc/systemid; then
8349                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8350         fi
8351 fi
8352 if $test "$cont"; then
8353         echo 'No, maybe "uuname -l" will work...'
8354         if tans=`sh -c 'uuname -l' 2>&1` ; then
8355                 myhostname=$tans
8356                 phostname='uuname -l'
8357         else
8358                 echo 'Strange.  Maybe "uname -n" will work...'
8359                 if tans=`sh -c 'uname -n' 2>&1` ; then
8360                         myhostname=$tans
8361                         phostname='uname -n'
8362                 else
8363                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8364                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8365                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8366                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8367                         else
8368                                 case "$myhostname" in
8369                                 '') echo "Does this machine have an identity crisis or something?"
8370                                         phostname='';;
8371                                 *)
8372                                         echo "Well, you said $myhostname before..."
8373                                         phostname='echo $myhostname';;
8374                                 esac
8375                         fi
8376                 fi
8377         fi
8378 fi
8379 case "$myhostname" in
8380 '') myhostname=noname ;;
8381 esac
8382 : you do not want to know about this
8383 set $myhostname
8384 myhostname=$1
8385
8386 : verify guess
8387 if $test "$myhostname" ; then
8388         dflt=y
8389         rp='Your host name appears to be "'$myhostname'".'" Right?"
8390         . ./myread
8391         case "$ans" in
8392         y*) ;;
8393         *) myhostname='';;
8394         esac
8395 fi
8396
8397 : bad guess or no guess
8398 while $test "X$myhostname" = X ; do
8399         dflt=''
8400         rp="Please type the (one word) name of your host:"
8401         . ./myread
8402         myhostname="$ans"
8403 done
8404
8405 : translate upper to lower if necessary
8406 case "$myhostname" in
8407 *[A-Z]*)
8408         echo "(Normalizing case in your host name)"
8409         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8410         ;;
8411 esac
8412
8413 case "$myhostname" in
8414 *.*)
8415         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8416         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8417         echo "(Trimming domain name from host name--host name is now $myhostname)"
8418         ;;
8419 *) case "$mydomain" in
8420         '')
8421                 {
8422                         test "X$hostcat" = "Xypcat hosts" &&
8423                         ypmatch "$myhostname" hosts 2>/dev/null |\
8424                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8425                         $test -s hosts
8426                 } || {
8427                         test "X$hostcat" != "X" &&
8428                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8429                                         /[       ]$myhostname[  . ]/p" > hosts
8430                 }
8431                 tmp_re="[       . ]"
8432                 if $test -f hosts; then
8433                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8434                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8435                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8436                                 hosts | $sort | $uniq | \
8437                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8438                         case `$echo X$dflt` in
8439                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8440                                 dflt=.
8441                                 ;;
8442                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8443                                 ;;
8444                         esac
8445                 else
8446                         echo "(I cannot locate a hosts database anywhere)"
8447                         dflt=.
8448                 fi
8449                 case "$dflt" in
8450                 .)
8451                         tans=`./loc resolv.conf X /etc /usr/etc`
8452                         if $test -f "$tans"; then
8453                                 echo "(Attempting domain name extraction from $tans)"
8454                                 dflt=.`$sed -n -e 's/   / /g' \
8455                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8456                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8457                                 case "$dflt" in
8458                                 .) dflt=.`$sed -n -e 's/        / /g' \
8459                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8460                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8461                                         ;;
8462                                 esac
8463                         fi
8464                         ;;
8465                 esac
8466                 case "$dflt" in
8467                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8468                         dflt=.`sh -c domainname 2>/dev/null`
8469                         case "$dflt" in
8470                         '') dflt='.';;
8471                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8472                         esac
8473                         ;;
8474                 esac
8475                 case "$dflt$osname" in
8476                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8477                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8478                         ;;
8479                 esac
8480                 case "$dflt" in
8481                 .) echo "(Lost all hope -- silly guess then)"
8482                         dflt='.nonet'
8483                         ;;
8484                 esac
8485                 $rm -f hosts
8486                 ;;
8487         *) dflt="$mydomain";;
8488         esac;;
8489 esac
8490 echo " "
8491 rp="What is your domain name?"
8492 . ./myread
8493 tans="$ans"
8494 case "$ans" in
8495 '') ;;
8496 .*) ;;
8497 *) tans=".$tans";;
8498 esac
8499 mydomain="$tans"
8500
8501 : translate upper to lower if necessary
8502 case "$mydomain" in
8503 *[A-Z]*)
8504         echo "(Normalizing case in your domain name)"
8505         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8506         ;;
8507 esac
8508
8509 : a little sanity check here
8510 case "$phostname" in
8511 '') ;;
8512 *)
8513         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8514         $myhostname$mydomain|$myhostname) ;;
8515         *)
8516                 case "$phostname" in
8517                 sed*)
8518                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8519                         ;;
8520                 *)
8521                         echo "(That doesn't agree with your $phostname command, by the way.)"
8522                         ;;
8523                 esac
8524         ;;
8525         esac
8526         ;;
8527 esac
8528
8529 $cat <<EOM
8530
8531 I need to get your e-mail address in Internet format if possible, i.e.
8532 something like user@host.domain. Please answer accurately since I have
8533 no easy means to double check it. The default value provided below
8534 is most probably close to reality but may not be valid from outside
8535 your organization...
8536
8537 EOM
8538 cont=x
8539 while test "$cont"; do
8540         case "$cf_email" in
8541         '') dflt="$cf_by@$myhostname$mydomain";;
8542         *) dflt="$cf_email";;
8543         esac
8544         rp='What is your e-mail address?'
8545         . ./myread
8546         cf_email="$ans"
8547         case "$cf_email" in
8548         *@*.*) cont='' ;;
8549         *)
8550                 rp='Address does not look like an Internet one.  Use it anyway?'
8551                 case "$fastread" in
8552                 yes) dflt=y ;;
8553                 *) dflt=n ;;
8554                 esac
8555                 . ./myread
8556                 case "$ans" in
8557                 y*) cont='' ;;
8558                 *) echo " " ;;
8559                 esac
8560                 ;;
8561         esac
8562 done
8563
8564 $cat <<EOM
8565
8566 If you or somebody else will be maintaining perl at your site, please
8567 fill in the correct e-mail address here so that they may be contacted
8568 if necessary. Currently, the "perlbug" program included with perl
8569 will send mail to this address in addition to perlbug@perl.org. You may
8570 enter "none" for no administrator.
8571
8572 EOM
8573 case "$perladmin" in
8574 '') dflt="$cf_email";;
8575 *) dflt="$perladmin";;
8576 esac
8577 rp='Perl administrator e-mail address'
8578 . ./myread
8579 perladmin="$ans"
8580
8581 : determine whether to only install version-specific parts.
8582 echo " "
8583 $cat <<EOM
8584 Do you want to install only the version-specific parts of the perl
8585 distribution?  Usually you do *not* want to do this.
8586 EOM
8587 case "$versiononly" in
8588 "$define"|[Yy]*|true) dflt='y' ;;
8589 *) dflt='n';
8590 esac
8591 rp="Do you want to install only the version-specific parts of perl?"
8592 . ./myread
8593 case "$ans" in
8594 [yY]*)  val="$define";;
8595 *)      val="$undef" ;;
8596 esac
8597 set versiononly
8598 eval $setvar
8599
8600 case "$versiononly" in
8601 "$define") inc_version_list=''
8602            inc_version_list_init=0
8603            ;;
8604 esac
8605
8606 : figure out how to guarantee perl startup
8607 case "$startperl" in
8608 '')
8609         case "$sharpbang" in
8610         *!)
8611                 $cat <<EOH
8612
8613 I can use the #! construct to start perl on your system. This will
8614 make startup of perl scripts faster, but may cause problems if you
8615 want to share those scripts and perl is not in a standard place
8616 ($binexp/perl) on all your platforms. The alternative is to force
8617 a shell by starting the script with a single ':' character.
8618
8619 EOH
8620                 case "$versiononly" in
8621                 "$define")      dflt="$binexp/perl$version";;  
8622                 *)              dflt="$binexp/perl";;
8623                 esac
8624                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8625                 . ./myread
8626                 case "$ans" in
8627                 none)   startperl=": # use perl";;
8628                 *)      startperl="#!$ans"
8629                         if $test 30 -lt `echo "$ans" | wc -c`; then
8630                                 $cat >&4 <<EOM
8631
8632 WARNING:  Some systems limit the #! command to 32 characters.
8633 If you experience difficulty running Perl scripts with #!, try
8634 installing Perl in a directory with a shorter pathname.
8635
8636 EOM
8637                         fi ;;
8638                 esac
8639                 ;;
8640         *) startperl=": # use perl"
8641                 ;;
8642         esac
8643         ;;
8644 esac
8645 echo "I'll use $startperl to start perl scripts."
8646
8647 : figure best path for perl in scripts
8648 case "$perlpath" in
8649 '')
8650         case "$versiononly" in
8651         "$define")      perlpath="$binexp/perl$version";;
8652         *)              perlpath="$binexp/perl";;
8653         esac
8654         case "$startperl" in
8655         *!*) ;;
8656         *)
8657                 $cat <<EOH
8658
8659 I will use the "eval 'exec'" idiom to start Perl on your system.
8660 I can use the full path of your Perl binary for this purpose, but
8661 doing so may cause problems if you want to share those scripts and
8662 Perl is not always in a standard place ($binexp/perl).
8663
8664 EOH
8665                 dflt="$binexp/perl"
8666                 rp="What path shall I use in \"eval 'exec'\"?"
8667                 . ./myread
8668                 perlpath="$ans"
8669                 ;;
8670         esac
8671         ;;
8672 esac
8673 case "$startperl" in
8674 *!*)    ;;
8675 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8676 esac
8677
8678 : determine where public executable scripts go
8679 set scriptdir scriptdir
8680 eval $prefixit
8681 case "$scriptdir" in
8682 '')
8683         dflt="$bin"
8684         : guess some guesses
8685         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8686         $test -d /usr/share/bin     && dflt=/usr/share/bin
8687         $test -d /usr/local/script  && dflt=/usr/local/script
8688         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8689         $test -d $prefixexp/script  && dflt=$prefixexp/script
8690         set dflt
8691         eval $prefixup
8692         ;;
8693 *)  dflt="$scriptdir"
8694         ;;
8695 esac
8696 $cat <<EOM
8697  
8698 Some installations have a separate directory just for executable scripts so
8699 that they can mount it across multiple architectures but keep the scripts in
8700 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8701 Or you might just lump your scripts in with all your other executables.
8702  
8703 EOM
8704 fn=d~
8705 rp='Where do you keep publicly executable scripts?'
8706 . ./getfile
8707 if $test "X$ansexp" != "X$scriptdirexp"; then
8708         installscript=''
8709 fi
8710 scriptdir="$ans"
8711 scriptdirexp="$ansexp"
8712 : Change installation prefix, if necessary.
8713 if $test X"$prefix" != X"$installprefix"; then
8714         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8715 else
8716         installscript="$scriptdirexp"
8717 fi
8718
8719 : determine where add-on public executables go
8720 case "$sitebin" in
8721 '')     dflt=$siteprefix/bin ;;
8722 *)      dflt=$sitebin ;;
8723 esac
8724 fn=d~
8725 rp='Pathname where the add-on public executables should be installed?'
8726 . ./getfile
8727 sitebin="$ans"
8728 sitebinexp="$ansexp"
8729 : Change installation prefix, if necessary.
8730 if $test X"$prefix" != X"$installprefix"; then
8731         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8732 else
8733         installsitebin="$sitebinexp"
8734 fi
8735
8736 : determine where add-on html pages go
8737 : There is no standard location, so try to copy the previously-selected 
8738 : directory structure for the core html pages.
8739 case "$sitehtml1" in
8740 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8741 *)      dflt=$sitehtml1 ;;
8742 esac
8743 case "$dflt" in
8744 ''|' ') dflt=none ;;
8745 esac
8746 fn=dn+~
8747 rp='Pathname where the site-specific html pages should be installed?'
8748 . ./getfile
8749 sitehtml1="$ans"
8750 sitehtml1exp="$ansexp"
8751 : Use ' ' for none so value is preserved next time through Configure
8752 $test X"$sitehtml1" = "X" && sitehtml1=' '
8753 : Change installation prefix, if necessary.
8754 if $test X"$prefix" != X"$installprefix"; then
8755         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8756 else
8757         installsitehtml1="$sitehtml1exp"
8758 fi
8759
8760 : determine where add-on library html pages go
8761 : There is no standard location, so try to copy the previously-selected
8762 : directory structure for the core html pages.
8763 case "$sitehtml3" in
8764 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8765 *)      dflt=$sitehtml3 ;;
8766 esac
8767 case "$dflt" in
8768 ''|' ') dflt=none ;;
8769 esac
8770 fn=dn+~
8771 rp='Pathname where the site-specific library html pages should be installed?'
8772 . ./getfile
8773 sitehtml3="$ans"
8774 sitehtml3exp="$ansexp"
8775 : Use ' ' for none so value is preserved next time through Configure
8776 $test X"$sitehtml3" = "X" && sitehtml3=' '
8777 : Change installation prefix, if necessary.
8778 if $test X"$prefix" != X"$installprefix"; then
8779         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8780 else
8781         installsitehtml3="$sitehtml3exp"
8782 fi
8783
8784 : determine where add-on manual pages go
8785 case "$siteman1" in
8786 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8787 *)      dflt=$siteman1 ;;
8788 esac
8789 case "$dflt" in
8790 ''|' ') dflt=none ;;
8791 esac
8792 fn=dn+~
8793 rp='Pathname where the site-specific manual pages should be installed?'
8794 . ./getfile
8795 siteman1="$ans"
8796 siteman1exp="$ansexp"
8797 : Use ' ' for none so value is preserved next time through Configure
8798 $test X"$siteman1" = "X" && siteman1=' '
8799 : Change installation prefix, if necessary.
8800 if $test X"$prefix" != X"$installprefix"; then
8801         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8802 else
8803         installsiteman1="$siteman1exp"
8804 fi
8805
8806 : determine where add-on library man pages go
8807 case "$siteman3" in
8808 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8809 *)      dflt=$siteman3 ;;
8810 esac
8811 case "$dflt" in
8812 ''|' ') dflt=none ;;
8813 esac
8814 fn=dn+~
8815 rp='Pathname where the site-specific library manual pages should be installed?'
8816 . ./getfile
8817 siteman3="$ans"
8818 siteman3exp="$ansexp"
8819 : Use ' ' for none so value is preserved next time through Configure
8820 $test X"$siteman3" = "X" && siteman3=' '
8821 : Change installation prefix, if necessary.
8822 if $test X"$prefix" != X"$installprefix"; then
8823         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8824 else
8825         installsiteman3="$siteman3exp"
8826 fi
8827
8828 : determine where add-on public executable scripts go
8829 case "$sitescript" in
8830 '')     dflt=$siteprefix/script
8831         $test -d $dflt || dflt=$sitebin ;;
8832 *)  dflt="$sitescript" ;;
8833 esac
8834 fn=d~+
8835 rp='Pathname where add-on public executable scripts should be installed?'
8836 . ./getfile
8837 sitescript="$ans"
8838 sitescriptexp="$ansexp"
8839 : Change installation prefix, if necessary.
8840 if $test X"$prefix" != X"$installprefix"; then
8841         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8842 else
8843         installsitescript="$sitescriptexp"
8844 fi
8845
8846 : define an is-a-typedef? function
8847 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8848 case "$inclist" in
8849 "") inclist="sys/types.h";;
8850 esac;
8851 eval "varval=\$$var";
8852 case "$varval" in
8853 "")
8854         $rm -f temp.c;
8855         for inc in $inclist; do
8856                 echo "#include <$inc>" >>temp.c;
8857         done;
8858         echo "#ifdef $type" >> temp.c;
8859         echo "printf(\"We have $type\");" >> temp.c;
8860         echo "#endif" >> temp.c;
8861         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8862         if $contains $type temp.E >/dev/null 2>&1; then
8863                 eval "$var=\$type";
8864         else
8865                 eval "$var=\$def";
8866         fi;
8867         $rm -f temp.?;;
8868 *) eval "$var=\$varval";;
8869 esac'
8870
8871 : define an is-a-typedef? function that prompts if the type is not available.
8872 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8873 case "$inclist" in
8874 "") inclist="sys/types.h";;
8875 esac;
8876 eval "varval=\$$var";
8877 case "$varval" in
8878 "")
8879         $rm -f temp.c;
8880         for inc in $inclist; do
8881                 echo "#include <$inc>" >>temp.c;
8882         done;
8883         echo "#ifdef $type" >> temp.c;
8884         echo "printf(\"We have $type\");" >> temp.c;
8885         echo "#endif" >> temp.c;
8886         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8887         echo " " ;
8888         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8889         if $contains $type temp.E >/dev/null 2>&1; then
8890                 echo "$type found." >&4;
8891                 eval "$var=\$type";
8892         else
8893                 echo "$type NOT found." >&4;
8894                 dflt="$def";
8895                 . ./myread ;
8896                 eval "$var=\$ans";
8897         fi;
8898         $rm -f temp.?;;
8899 *) eval "$var=\$varval";;
8900 esac'
8901
8902 : see what type lseek is declared as in the kernel
8903 rp="What is the type used for lseek's offset on this system?"
8904 set off_t lseektype long stdio.h sys/types.h
8905 eval $typedef_ask
8906
8907 echo " "
8908 echo "Checking to see how big your file offsets are..." >&4
8909 $cat >try.c <<EOCP
8910 #include <sys/types.h>
8911 #include <stdio.h>
8912 int main()
8913 {
8914     printf("%d\n", (int)sizeof($lseektype));
8915     return(0); 
8916 }
8917 EOCP
8918 set try
8919 if eval $compile_ok; then
8920         lseeksize=`$run ./try`
8921         echo "Your file offsets are $lseeksize bytes long."
8922 else
8923         dflt=$longsize
8924         echo " "
8925         echo "(I can't seem to compile the test program.  Guessing...)"
8926         rp="What is the size of your file offsets (in bytes)?"
8927         . ./myread
8928         lseeksize="$ans"
8929 fi
8930 $rm -f try.c try
8931
8932 : see what type file positions are declared as in the library
8933 rp="What is the type for file position used by fsetpos()?"
8934 set fpos_t fpostype long stdio.h sys/types.h
8935 eval $typedef_ask
8936
8937 echo " "
8938 case "$fpostype" in
8939 *_t) zzz="$fpostype"    ;;
8940 *)   zzz="fpos_t"       ;;
8941 esac
8942 echo "Checking the size of $zzz..." >&4 
8943 cat > try.c <<EOCP
8944 #include <sys/types.h>
8945 #include <stdio.h>
8946 int main() {
8947     printf("%d\n", (int)sizeof($fpostype));
8948     exit(0);
8949 }
8950 EOCP
8951 set try
8952 if eval $compile_ok; then
8953         yyy=`$run ./try`
8954         case "$yyy" in
8955         '')     fpossize=4
8956                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8957                 ;;
8958         *)      fpossize=$yyy
8959                 echo "Your $zzz is $fpossize bytes long."
8960                 ;;
8961         esac
8962 else
8963         dflt="$longsize"
8964         echo " " >&4
8965         echo "(I can't compile the test program.  Guessing...)" >&4
8966         rp="What is the size of your file positions (in bytes)?"
8967         . ./myread
8968         fpossize="$ans"
8969 fi
8970
8971
8972
8973 # Backward compatibility (uselfs is deprecated).
8974 case "$uselfs" in
8975 "$define"|true|[yY]*)
8976         cat <<EOM >&4
8977
8978 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8979 EOM
8980         uselargefiles="$define"
8981         ;;
8982 esac                          
8983
8984 case "$lseeksize:$fpossize" in
8985 8:8) cat <<EOM
8986
8987 You can have files larger than 2 gigabytes.
8988 EOM
8989    val="$define" ;;
8990 *)    case "$uselargefiles" in
8991    "$undef"|false|[nN]*) dflt='n' ;;
8992    *)   dflt='y' ;;
8993    esac
8994    cat <<EOM
8995
8996 Perl can be built to understand large files (files larger than 2 gigabytes)
8997 on some systems.  To do so, Configure can be run with -Duselargefiles.
8998
8999 If this doesn't make any sense to you, just accept the default '$dflt'.
9000 EOM
9001    rp='Try to understand large files, if available?'
9002    . ./myread
9003    case "$ans" in
9004    y|Y)         val="$define" ;;
9005    *)           val="$undef"  ;;
9006    esac
9007    ;;
9008 esac
9009 set uselargefiles
9010 eval $setvar
9011 case "$uselargefiles" in
9012 "$define")
9013 : Look for a hint-file generated 'call-back-unit'.  If the
9014 : user has specified that a large files perl is to be built,
9015 : we may need to set or change some other defaults.
9016         if $test -f uselargefiles.cbu; then
9017                 echo "Your platform has some specific hints for large file builds, using them..."
9018                 . ./uselargefiles.cbu
9019                 echo " "
9020                 echo "Rechecking to see how big your file offsets are..." >&4
9021                 $cat >try.c <<EOCP
9022 #include <sys/types.h>
9023 #include <stdio.h>
9024 int main()
9025 {
9026     printf("%d\n", (int)sizeof($lseektype));
9027     return(0); 
9028 }
9029 EOCP
9030                 set try
9031                 if eval $compile_ok; then
9032                         lseeksize=`$run ./try`
9033                         $echo "Your file offsets are now $lseeksize bytes long."
9034                 else
9035                         dflt="$lseeksize"
9036                         echo " "
9037                         echo "(I can't seem to compile the test program.  Guessing...)"
9038                         rp="What is the size of your file offsets (in bytes)?"
9039                         . ./myread
9040                         lseeksize="$ans"
9041                 fi
9042                 case "$fpostype" in
9043                 *_t) zzz="$fpostype"    ;;
9044                 *)   zzz="fpos_t"       ;;
9045                 esac
9046                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9047                 $cat > try.c <<EOCP
9048 #include <sys/types.h>
9049 #include <stdio.h>
9050 int main() {
9051     printf("%d\n", (int)sizeof($fpostype));
9052     exit(0);
9053 }
9054 EOCP
9055                 set try
9056                 if eval $compile_ok; then
9057                         yyy=`$run ./try`
9058                         dflt="$lseeksize"
9059                         case "$yyy" in
9060                         '')     echo " "
9061                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9062                                 ;;
9063                         *)      fpossize=$yyy
9064                                 echo " $fpossize bytes." >&4
9065                                 ;;
9066                         esac
9067                 else
9068                         dflt="$fpossize"
9069                         echo " "
9070                         echo "(I can't compile the test program.  Guessing...)" >&4
9071                         rp="What is the size of your file positions (in bytes)?"
9072                         . ./myread
9073                         fpossize="$ans"
9074                 fi
9075                 $rm -f try.c try
9076         fi
9077         ;;
9078 esac
9079
9080 case "$vendorprefix" in
9081 '')     d_vendorbin="$undef"
9082         vendorbin=''
9083         vendorbinexp=''
9084         ;;
9085 *)      d_vendorbin="$define"
9086         : determine where vendor-supplied executables go.
9087         case "$vendorbin" in
9088         '') dflt=$vendorprefix/bin ;;
9089         *)      dflt="$vendorbin" ;;
9090         esac
9091         fn=d~+
9092         rp='Pathname for the vendor-supplied executables directory?'
9093         . ./getfile
9094         vendorbin="$ans"
9095         vendorbinexp="$ansexp"
9096         ;;
9097 esac
9098 : Change installation prefix, if necessary.
9099 if $test X"$prefix" != X"$installprefix"; then
9100         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9101 else
9102         installvendorbin="$vendorbinexp"
9103 fi
9104
9105 case "$vendorprefix" in
9106 '')     vendorhtml1=''
9107         vendorhtml1exp=''
9108         ;;
9109 *)      : determine where vendor-supplied html pages go.
9110         : There is no standard location, so try to copy the previously-selected
9111         : directory structure for the core html pages.
9112         : XXX Better default suggestions would be welcome.
9113         case "$vendorhtml1" in
9114         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9115         *)      dflt=$vendorhtml1 ;;
9116         esac
9117         case "$dflt" in
9118         ''|' ') dflt=none ;;
9119         esac
9120         fn=dn+~
9121         rp='Pathname for the vendor-supplied html pages?'
9122         . ./getfile
9123         vendorhtml1="$ans"
9124         vendorhtml1exp="$ansexp"
9125         ;;
9126 esac
9127 : Use ' ' for none so value is preserved next time through Configure
9128 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
9129 : Change installation prefix, if necessary.
9130 if $test X"$prefix" != X"$installprefix"; then
9131         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9132 else
9133         installvendorhtml1="$vendorhtml1exp"
9134 fi
9135
9136 case "$vendorprefix" in
9137 '')     vendorhtml3=''
9138         vendorhtml3exp=''
9139         ;;
9140 *)      : determine where vendor-supplied module html pages go.
9141         : There is no standard location, so try to copy the previously-selected
9142         : directory structure for the core html pages.
9143         : XXX Better default suggestions would be welcome.
9144         case "$vendorhtml3" in
9145         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9146         *)      dflt=$vendorhtml3 ;;
9147         esac
9148         case "$dflt" in
9149         ''|' ') dflt=none ;;
9150         esac
9151         fn=dn+~
9152         rp='Pathname for the vendor-supplied html pages?'
9153         . ./getfile
9154         vendorhtml3="$ans"
9155         vendorhtml3exp="$ansexp"
9156         ;;
9157 esac
9158 : Use ' ' for none so value is preserved next time through Configure
9159 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9160 : Change installation prefix, if necessary.
9161 if $test X"$prefix" != X"$installprefix"; then
9162         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9163 else
9164         installvendorhtml3="$vendorhtml3exp"
9165 fi
9166
9167 case "$vendorprefix" in
9168 '')     vendorman1=''
9169         vendorman1exp=''
9170         ;;
9171 *)      : determine where vendor-supplied manual pages go.
9172         case "$vendorman1" in
9173         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9174         *)      dflt=$vendorman1 ;;
9175         esac
9176         case "$dflt" in
9177         ''|' ') dflt=none ;;
9178         esac
9179         fn=nd~+
9180         rp='Pathname for the vendor-supplied manual section 1 pages?'
9181         . ./getfile
9182         vendorman1="$ans"
9183         vendorman1exp="$ansexp"
9184         ;;
9185 esac
9186 : Use ' ' for none so value is preserved next time through Configure
9187 $test X"$vendorman1" = "X" && vendorman1=' '
9188 : Change installation prefix, if necessary.
9189 if $test X"$prefix" != X"$installprefix"; then
9190         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9191 else
9192         installvendorman1="$vendorman1exp"
9193 fi
9194
9195 case "$vendorprefix" in
9196 '')     vendorman3=''
9197         vendorman3exp=''
9198         ;;
9199 *)      : determine where vendor-supplied module manual pages go.
9200         case "$vendorman3" in
9201         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9202         *)      dflt=$vendorman3 ;;
9203         esac
9204         case "$dflt" in
9205         ''|' ') dflt=none ;;
9206         esac
9207         fn=nd~+
9208         rp='Pathname for the vendor-supplied manual section 3 pages?'
9209         . ./getfile
9210         vendorman3="$ans"
9211         vendorman3exp="$ansexp"
9212         ;;
9213 esac
9214 : Use ' ' for none so value is preserved next time through Configure
9215 $test X"$vendorman3" = "X" && vendorman3=' '
9216 : Change installation prefix, if necessary.
9217 if $test X"$prefix" != X"$installprefix"; then
9218         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9219 else
9220         installvendorman3="$vendorman3exp"
9221 fi
9222
9223 case "$vendorprefix" in
9224 '')     d_vendorscript="$undef"
9225         vendorscript=''
9226         vendorscriptexp=''
9227         ;;
9228 *)      d_vendorscript="$define"
9229         : determine where vendor-supplied scripts go.
9230         case "$vendorscript" in
9231         '')     dflt=$vendorprefix/script
9232                 $test -d $dflt || dflt=$vendorbin ;;
9233         *)  dflt="$vendorscript" ;;
9234         esac
9235         $cat <<EOM
9236
9237 The installation process will create a directory for 
9238 vendor-supplied scripts.
9239
9240 EOM
9241         fn=d~+
9242         rp='Pathname for the vendor-supplied scripts directory?'
9243         . ./getfile
9244         vendorscript="$ans"
9245         vendorscriptexp="$ansexp"
9246         ;;
9247 esac
9248 : Change installation prefix, if necessary.
9249 if $test X"$prefix" != X"$installprefix"; then
9250         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9251 else
9252         installvendorscript="$vendorscriptexp"
9253 fi
9254
9255 : see if qgcvt exists
9256 set qgcvt d_qgcvt
9257 eval $inlibc
9258
9259 : Check how to convert floats to strings.
9260
9261 if test "X$d_Gconvert" = X; then
9262
9263 echo " "
9264 echo "Checking for an efficient way to convert floats to strings."
9265 echo " " > try.c
9266 case "$uselongdouble" in
9267 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9268 esac
9269 case "$d_longdbl" in
9270 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9271 esac
9272 case "$d_PRIgldbl" in
9273 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9274 esac
9275 $cat >>try.c <<EOP
9276 #ifdef TRY_gconvert
9277 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9278 char *myname = "gconvert";
9279 #endif
9280 #ifdef TRY_gcvt
9281 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9282 char *myname = "gcvt";
9283 #endif
9284 #ifdef TRY_qgcvt
9285 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9286 char *myname = "qgcvt";
9287 #define DOUBLETYPE long double
9288 #endif
9289 #ifdef TRY_sprintf
9290 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9291 #ifdef HAS_PRIgldbl
9292 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9293 #else
9294 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9295 #endif
9296 #else
9297 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9298 #endif
9299 char *myname = "sprintf";
9300 #endif
9301
9302 #ifndef DOUBLETYPE
9303 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9304 #define DOUBLETYPE long double
9305 #else
9306 #define DOUBLETYPE double
9307 #endif
9308 #endif
9309
9310 #include <stdio.h>
9311
9312 #define I_STDLIB $i_stdlib
9313 #ifdef I_STDLIB
9314 #include <stdlib.h>
9315 #endif
9316
9317 int
9318 checkit(expect, got)
9319 char *expect;
9320 char *got;
9321 {
9322     if (strcmp(expect, got)) {
9323                 printf("%s oddity:  Expected %s, got %s\n",
9324                         myname, expect, got);
9325                 exit(1);
9326         }
9327 }
9328
9329 int main()
9330
9331         char buf[64]; 
9332         buf[63] = '\0';
9333
9334         /* This must be 1st test on (which?) platform */
9335         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9336         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9337         checkit("0.1", buf);
9338
9339         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9340         checkit("0.01", buf);
9341
9342         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9343         checkit("0.001", buf);
9344
9345         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9346         checkit("0.0001", buf);
9347
9348         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9349         if (strlen(buf) > 5)
9350             checkit("9e-005", buf); /* for Microsoft ?? */
9351         else
9352             checkit("9e-05", buf);
9353
9354         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9355         checkit("1", buf);
9356
9357         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9358         checkit("1.1", buf);
9359
9360         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9361         checkit("1.01", buf);
9362
9363         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9364         checkit("1.001", buf);
9365
9366         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9367         checkit("1.0001", buf);
9368
9369         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9370         checkit("1.00001", buf);
9371
9372         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9373         checkit("1.000001", buf);
9374
9375         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9376         checkit("0", buf);
9377
9378         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9379         checkit("-1", buf);
9380
9381         /* Some Linux gcvt's give 1.e+5 here. */
9382         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9383         checkit("100000", buf);
9384         
9385         /* Some Linux gcvt's give -1.e+5 here. */
9386         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9387         checkit("-100000", buf);
9388
9389         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9390         checkit("123.456", buf);
9391
9392         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9393         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9394         /* 34 should be enough to scare even long double
9395          * places into using the e notation. */
9396         if (strlen(buf) > 5)
9397             checkit("1e+034", buf); /* for Microsoft */
9398         else
9399             checkit("1e+34", buf);
9400
9401         /* For Perl, if you add additional tests here, also add them to
9402          * t/base/num.t for benefit of platforms not using Configure or
9403          * overriding d_Gconvert */
9404
9405         exit(0);
9406 }
9407 EOP
9408 : first add preferred functions to our list
9409 xxx_list=""
9410 for xxx_convert in $gconvert_preference; do
9411     case $xxx_convert in
9412     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9413     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9414     esac 
9415 done
9416 : then add any others
9417 for xxx_convert in gconvert gcvt sprintf; do
9418     case "$xxx_list" in
9419     *$xxx_convert*) ;;
9420     *) xxx_list="$xxx_list $xxx_convert" ;;
9421     esac 
9422 done
9423
9424 case "$d_longdbl$uselongdouble" in
9425 "$define$define")
9426     : again, add prefered functions to our list first
9427     xxx_ld_list=""
9428     for xxx_convert in $gconvert_ld_preference; do
9429         case $xxx_convert in
9430         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9431         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9432         esac
9433     done
9434     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9435     for xxx_convert in qgcvt sprintf $xxx_list; do
9436         case "$xxx_ld_list" in
9437         $xxx_convert*|*" $xxx_convert"*) ;;
9438         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9439         esac
9440     done
9441     : if sprintf cannot do long doubles, move it to the end
9442     if test "$d_PRIgldbl" != "$define"; then
9443         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9444     fi
9445     : if no qgcvt, remove it
9446     if test "$d_qgcvt" != "$define"; then
9447         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9448     fi
9449     : use the ld_list
9450     xxx_list="$xxx_ld_list"
9451     ;;
9452 esac
9453
9454 for xxx_convert in $xxx_list; do
9455         echo "Trying $xxx_convert..."
9456         $rm -f try try$_o
9457         set try -DTRY_$xxx_convert
9458         if eval $compile; then
9459                 echo "$xxx_convert() found." >&4
9460                 if $run ./try; then
9461                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9462                         break;
9463                 else
9464                         echo "...But $xxx_convert didn't work as I expected."
9465                         xxx_convert=''
9466                 fi
9467         else
9468                 echo "$xxx_convert NOT found." >&4
9469         fi
9470 done
9471
9472 if test X$xxx_convert = X; then
9473     echo "*** WHOA THERE!!! ***" >&4
9474     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9475     xxx_convert=sprintf
9476 fi
9477
9478 case "$xxx_convert" in
9479 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9480 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9481 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9482 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9483    "$define$define$define")
9484       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9485    "$define$define$undef")
9486       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9487    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9488    esac
9489    ;;  
9490 esac
9491
9492 fi
9493
9494 : see if _fwalk exists
9495 set fwalk d__fwalk
9496 eval $inlibc
9497
9498 : Initialize h_fcntl
9499 h_fcntl=false
9500
9501 : Initialize h_sysfile
9502 h_sysfile=false
9503
9504 : access call always available on UNIX
9505 set access d_access
9506 eval $inlibc
9507
9508 : locate the flags for 'access()'
9509 case "$d_access" in
9510 "$define")
9511         echo " "
9512         $cat >access.c <<'EOCP'
9513 #include <sys/types.h>
9514 #ifdef I_FCNTL
9515 #include <fcntl.h>
9516 #endif
9517 #ifdef I_SYS_FILE
9518 #include <sys/file.h>
9519 #endif
9520 #ifdef I_UNISTD
9521 #include <unistd.h>
9522 #endif
9523 int main() {
9524         exit(R_OK);
9525 }
9526 EOCP
9527         : check sys/file.h first, no particular reason here
9528         if $test `./findhdr sys/file.h` && \
9529                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9530                 h_sysfile=true;
9531                 echo "<sys/file.h> defines the *_OK access constants." >&4
9532         elif $test `./findhdr fcntl.h` && \
9533                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9534                 h_fcntl=true;
9535                 echo "<fcntl.h> defines the *_OK access constants." >&4
9536         elif $test `./findhdr unistd.h` && \
9537                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9538                 echo "<unistd.h> defines the *_OK access constants." >&4
9539         else
9540                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9541         fi
9542         ;;
9543 esac
9544 $rm -f access*
9545
9546 : see if accessx exists
9547 set accessx d_accessx
9548 eval $inlibc
9549
9550 : see if alarm exists
9551 set alarm d_alarm
9552 eval $inlibc
9553
9554 : see if POSIX threads are available
9555 set pthread.h i_pthread
9556 eval $inhdr
9557
9558 : define a fucntion to check prototypes
9559 $cat > protochk <<EOSH
9560 $startsh
9561 cc="$cc"
9562 optimize="$optimize"
9563 ccflags="$ccflags"
9564 prototype="$prototype"
9565 define="$define"
9566 rm=$rm
9567 usethreads=$usethreads
9568 i_pthread=$i_pthread
9569 pthread_h_first=$pthread_h_first
9570 EOSH
9571
9572 $cat >> protochk <<'EOSH'
9573
9574 $rm -f try.c
9575 foo="$1"
9576 shift
9577 while test $# -ge 2; do
9578         case "$1" in
9579                 $define) echo "#include <$2>" >> try.c ;;
9580                 literal) echo "$2" >> try.c ;;
9581         esac
9582     # Extra magic for the benefit of systems that need pthread.h
9583     # to be included early to correctly detect threadsafe functions.
9584     # Such functions must guarantee themselves, though, that the usethreads
9585     # and i_pthread have been defined, before calling protochk.
9586     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9587         echo "#include <pthread.h>" >> try.c
9588         pthread_h_done=yes
9589     fi
9590     shift 2
9591 done
9592 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9593 cat >> try.c <<'EOCP'
9594 #ifdef CAN_PROTOTYPE
9595 #define _(args) args
9596 #else
9597 #define _(args) ()
9598 #endif
9599 EOCP
9600 echo "$foo" >> try.c
9601 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9602 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9603 status=$?
9604 $rm -f try.[co]
9605 exit $status
9606 EOSH
9607 chmod +x protochk
9608 $eunicefix protochk
9609
9610 : see if sys/types.h has to be included
9611 set sys/types.h i_systypes
9612 eval $inhdr
9613
9614 : see if sys/select.h has to be included
9615 set sys/select.h i_sysselct
9616 eval $inhdr
9617
9618 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9619 while $test $# -ge 2; do
9620         case "$1" in
9621         $define) echo "#include <$2>";;
9622         esac ;
9623     shift 2;
9624 done > try.c;
9625 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9626 set try;
9627 if eval $compile; then
9628         val="$define";
9629 else
9630         val="$undef";
9631 fi;
9632 set $varname;
9633 eval $setvar;
9634 $rm -f try.c try.o'
9635
9636 : see if we should include time.h, sys/time.h, or both
9637 echo " "
9638 if test "X$timeincl" = X; then
9639         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9640         $echo $n "I'm now running the test program...$c"
9641         $cat >try.c <<'EOCP'
9642 #include <sys/types.h>
9643 #ifdef I_TIME
9644 #include <time.h>
9645 #endif
9646 #ifdef I_SYSTIME
9647 #ifdef SYSTIMEKERNEL
9648 #define KERNEL
9649 #endif
9650 #include <sys/time.h>
9651 #endif
9652 #ifdef I_SYSSELECT
9653 #include <sys/select.h>
9654 #endif
9655 int main()
9656 {
9657         struct tm foo;
9658 #ifdef S_TIMEVAL
9659         struct timeval bar;
9660 #endif
9661 #ifdef S_TIMEZONE
9662         struct timezone tzp;
9663 #endif
9664         if (foo.tm_sec == foo.tm_sec)
9665                 exit(0);
9666 #ifdef S_TIMEVAL
9667         if (bar.tv_sec == bar.tv_sec)
9668                 exit(0);
9669 #endif
9670         exit(1);
9671 }
9672 EOCP
9673         flags=''
9674         for s_timezone in '-DS_TIMEZONE' ''; do
9675         sysselect=''
9676         for s_timeval in '-DS_TIMEVAL' ''; do
9677         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9678         for i_time in '' '-DI_TIME'; do
9679         for i_systime in '-DI_SYSTIME' ''; do
9680                 case "$flags" in
9681                 '') $echo $n ".$c"
9682                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9683                         if eval $compile; then
9684                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9685                                 shift
9686                                 flags="$*"
9687                                 echo " "
9688                                 $echo $n "Succeeded with $flags$c"
9689                         fi
9690                         ;;
9691                 esac
9692         done
9693         done
9694         done
9695         done
9696         done
9697         timeincl=''
9698         echo " "
9699         case "$flags" in
9700         *SYSTIMEKERNEL*) i_systimek="$define"
9701                 timeincl=`./findhdr sys/time.h`
9702                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9703         *) i_systimek="$undef";;
9704         esac
9705         case "$flags" in
9706         *I_TIME*) i_time="$define"
9707                 timeincl=`./findhdr time.h`" $timeincl"
9708                 echo "We'll include <time.h>." >&4;;
9709         *) i_time="$undef";;
9710         esac
9711         case "$flags" in
9712         *I_SYSTIME*) i_systime="$define"
9713                 timeincl=`./findhdr sys/time.h`" $timeincl"
9714                 echo "We'll include <sys/time.h>." >&4;;
9715         *) i_systime="$undef";;
9716         esac
9717         $rm -f try.c try
9718 fi
9719 : see if struct tm knows about tm_zone
9720 case "$i_systime$i_time" in
9721 *$define*) 
9722         echo " "
9723         echo "Checking to see if your struct tm has tm_zone field..." >&4
9724         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9725         eval $hasfield
9726         ;;
9727 *)      val="$undef"
9728         set d_tm_tm_zone
9729         eval $setvar
9730         ;;
9731 esac
9732 case "$d_tm_tm_zone" in
9733 "$define")      echo "Yes, it does."   ;;
9734 *)              echo "No, it doesn't." ;;
9735 esac
9736 : see if struct tm knows about tm_gmtoff
9737 case "$i_systime$i_time" in
9738 *$define*) 
9739         echo " "
9740         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9741         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9742         eval $hasfield
9743         ;;
9744 *)      val="$undef"
9745         set d_tm_tm_gmtoff
9746         eval $setvar
9747         ;;
9748 esac
9749 case "$d_tm_tm_gmtoff" in
9750 "$define")      echo "Yes, it does."   ;;
9751 *)              echo "No, it doesn't." ;;
9752 esac
9753
9754 : see if asctime_r exists
9755 set asctime_r d_asctime_r
9756 eval $inlibc
9757 case "$d_asctime_r" in
9758 "$define")
9759         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9760         case "$d_asctime_r_proto:$usethreads" in
9761         ":define")      d_asctime_r_proto=define
9762                 set d_asctime_r_proto asctime_r $hdrs
9763                 eval $hasproto ;;
9764         *)      ;;
9765         esac
9766         case "$d_asctime_r_proto" in
9767         define)
9768         case "$asctime_r_proto" in
9769         ''|0) try='char* asctime_r(const struct tm*, char*);'
9770         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9771         esac
9772         case "$asctime_r_proto" in
9773         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9774         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9775         esac
9776         case "$asctime_r_proto" in
9777         ''|0) try='int asctime_r(const struct tm*, char*);'
9778         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9779         esac
9780         case "$asctime_r_proto" in
9781         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9782         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9783         esac
9784         case "$asctime_r_proto" in
9785         ''|0)   d_asctime_r=undef
9786                 asctime_r_proto=0
9787                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9788         * )     case "$asctime_r_proto" in
9789                 REENTRANT_PROTO*) ;;
9790                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9791                 esac
9792                 echo "Prototype: $try" ;;
9793         esac
9794         ;;
9795         *)      case "$usethreads" in
9796                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9797                 esac
9798                 d_asctime_r=undef
9799                 asctime_r_proto=0
9800                 ;;
9801         esac
9802         ;;
9803 *)      asctime_r_proto=0
9804         ;;
9805 esac
9806
9807 : see if atolf exists
9808 set atolf d_atolf
9809 eval $inlibc
9810
9811 : see if atoll exists
9812 set atoll d_atoll
9813 eval $inlibc
9814
9815 : Look for GNU-cc style attribute checking
9816 echo " "
9817 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9818 $cat >attrib.c <<'EOCP'
9819 #include <stdio.h>
9820 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9821 EOCP
9822 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9823         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9824                 echo "Your C compiler doesn't fully support __attribute__."
9825                 val="$undef"
9826         else
9827                 echo "Your C compiler supports __attribute__."
9828                 val="$define"
9829         fi
9830 else
9831         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9832         val="$undef"
9833 fi
9834 set d_attribut
9835 eval $setvar
9836 $rm -f attrib*
9837
9838 : see if bcmp exists
9839 set bcmp d_bcmp
9840 eval $inlibc
9841
9842 : see if bcopy exists
9843 set bcopy d_bcopy
9844 eval $inlibc
9845
9846 : see if this is a unistd.h system
9847 set unistd.h i_unistd
9848 eval $inhdr
9849
9850 : see if getpgrp exists
9851 set getpgrp d_getpgrp
9852 eval $inlibc
9853
9854 case "$d_getpgrp" in
9855 "$define")
9856         echo " "
9857         echo "Checking to see which flavor of getpgrp is in use..."
9858         $cat >try.c <<EOP
9859 #$i_unistd I_UNISTD
9860 #include <sys/types.h>
9861 #ifdef I_UNISTD
9862 #  include <unistd.h>
9863 #endif
9864 int main()
9865 {
9866         if (getuid() == 0) {
9867                 printf("(I see you are running Configure as super-user...)\n");
9868                 setuid(1);
9869         }
9870 #ifdef TRY_BSD_PGRP
9871         if (getpgrp(1) == 0)
9872                 exit(0);
9873 #else
9874         if (getpgrp() > 0)
9875                 exit(0);
9876 #endif
9877         exit(1);
9878 }
9879 EOP
9880         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9881                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9882                 val="$define"
9883         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9884                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9885                 val="$undef"
9886         else
9887                 echo "I can't seem to compile and run the test program."
9888                 if ./usg; then
9889                         xxx="a USG one, i.e. you use getpgrp()."
9890                 else
9891                         # SVR4 systems can appear rather BSD-ish.
9892                         case "$i_unistd" in
9893                         $undef)
9894                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9895                                 val="$define"
9896                                 ;;
9897                         $define)
9898                                 xxx="probably a USG one, i.e. you use getpgrp()."
9899                                 val="$undef"
9900                                 ;;
9901                         esac
9902                 fi
9903                 echo "Assuming your getpgrp is $xxx" >&4
9904         fi
9905         ;;
9906 *) val="$undef";;
9907 esac
9908 set d_bsdgetpgrp
9909 eval $setvar
9910 $rm -f try try.*
9911
9912 : see if setpgrp exists
9913 set setpgrp d_setpgrp
9914 eval $inlibc
9915
9916 case "$d_setpgrp" in
9917 "$define")
9918         echo " "
9919         echo "Checking to see which flavor of setpgrp is in use..."
9920         $cat >try.c <<EOP
9921 #$i_unistd I_UNISTD
9922 #include <sys/types.h>
9923 #ifdef I_UNISTD
9924 #  include <unistd.h>
9925 #endif
9926 int main()
9927 {
9928         if (getuid() == 0) {
9929                 printf("(I see you are running Configure as super-user...)\n");
9930                 setuid(1);
9931         }
9932 #ifdef TRY_BSD_PGRP
9933         if (-1 == setpgrp(1, 1))
9934                 exit(0);
9935 #else
9936         if (setpgrp() != -1)
9937                 exit(0);
9938 #endif
9939         exit(1);
9940 }
9941 EOP
9942         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9943                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9944                 val="$define"
9945         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9946                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9947                 val="$undef"
9948         else
9949                 echo "(I can't seem to compile and run the test program.)"
9950                 if ./usg; then
9951                         xxx="a USG one, i.e. you use setpgrp()."
9952                 else
9953                         # SVR4 systems can appear rather BSD-ish.
9954                         case "$i_unistd" in
9955                         $undef)
9956                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9957                                 val="$define"
9958                                 ;;
9959                         $define)
9960                                 xxx="probably a USG one, i.e. you use setpgrp()."
9961                                 val="$undef"
9962                                 ;;
9963                         esac
9964                 fi
9965                 echo "Assuming your setpgrp is $xxx" >&4
9966         fi
9967         ;;
9968 *) val="$undef";;
9969 esac
9970 set d_bsdsetpgrp
9971 eval $setvar
9972 $rm -f try try.*
9973 : see if bzero exists
9974 set bzero d_bzero
9975 eval $inlibc
9976
9977 : see if signal is declared as pointer to function returning int or void
9978 echo " "
9979 xxx=`./findhdr signal.h`
9980 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9981 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9982         echo "You have int (*signal())() instead of void." >&4
9983         val="$undef"
9984 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9985         echo "You have void (*signal())()." >&4
9986         val="$define"
9987 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
9988         echo "You have int (*signal())() instead of void." >&4
9989         val="$undef"
9990 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
9991         echo "You have void (*signal())()." >&4
9992         val="$define"
9993 else
9994         case "$d_voidsig" in
9995         '')
9996         echo "I can't determine whether signal handler returns void or int..." >&4
9997                 dflt=void
9998                 rp="What type does your signal handler return?"
9999                 . ./myread
10000                 case "$ans" in
10001                 v*) val="$define";;
10002                 *) val="$undef";;
10003                 esac;;
10004         "$define")
10005                 echo "As you already told me, signal handler returns void." >&4
10006                 val="$define"
10007                 ;;
10008         *)      echo "As you already told me, signal handler returns int." >&4
10009                 val="$undef"
10010                 ;;
10011         esac
10012 fi
10013 set d_voidsig
10014 eval $setvar
10015 case "$d_voidsig" in
10016 "$define") signal_t="void";;
10017 *) signal_t="int";;
10018 esac
10019 $rm -f $$.tmp
10020
10021 : check for ability to cast large floats to 32-bit ints.
10022 echo " "
10023 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10024 if $test "$intsize" -ge 4; then
10025         xxx=int
10026 else
10027         xxx=long
10028 fi
10029 $cat >try.c <<EOCP
10030 #include <stdio.h>
10031 #include <sys/types.h>
10032 #include <signal.h>
10033 $signal_t blech(s) int s; { exit(3); }
10034 int main()
10035 {
10036         $xxx i32;
10037         double f, g;
10038         int result = 0;
10039         char str[16];
10040         signal(SIGFPE, blech);
10041
10042         /* Don't let compiler optimize the test away.  Store the number 
10043            in a writable string for gcc to pass to sscanf under HP/UX.
10044         */
10045         sprintf(str, "2147483647");
10046         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10047         g = 10 * f;
10048         i32  = ($xxx) g;
10049
10050         /* x86 processors will probably give 0x8000 0000, which is a
10051        sign change.  We don't want that.  We want to mimic SPARC
10052            behavior here, which is to preserve the sign and give
10053            back 0x7fff ffff.
10054         */
10055         if (i32 != ($xxx) f)
10056                 result |= 1;
10057         exit(result);
10058 }
10059 EOCP
10060 set try
10061 if eval $compile_ok; then
10062         $run ./try
10063         yyy=$?
10064 else
10065         echo "(I can't seem to compile the test program--assuming it can't)"
10066         yyy=1
10067 fi
10068 case "$yyy" in
10069 0)      val="$define"
10070         echo "Yup, it can."
10071         ;;
10072 *)      val="$undef"
10073         echo "Nope, it can't."
10074         ;;
10075 esac
10076 set d_casti32
10077 eval $setvar
10078 $rm -f try try.*
10079
10080 : check for ability to cast negative floats to unsigned
10081 echo " "
10082 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10083 $cat >try.c <<EOCP
10084 #include <stdio.h>
10085 #include <sys/types.h>
10086 #include <signal.h>
10087 $signal_t blech(s) int s; { exit(7); }
10088 $signal_t blech_in_list(s) int s; { exit(4); }
10089 unsigned long dummy_long(p) unsigned long p; { return p; }
10090 unsigned int dummy_int(p) unsigned int p; { return p; }
10091 unsigned short dummy_short(p) unsigned short p; { return p; }
10092 int main()
10093 {
10094         double f;
10095         unsigned long along;
10096         unsigned int aint;
10097         unsigned short ashort;
10098         int result = 0;
10099         char str[16];
10100         
10101         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10102            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10103            optimized the whole file away
10104         */
10105         /* Store the number in a writable string for gcc to pass to 
10106            sscanf under HP/UX.
10107         */
10108         sprintf(str, "-123");
10109         sscanf(str, "%lf", &f);  /* f = -123.; */
10110
10111         signal(SIGFPE, blech);
10112         along = (unsigned long)f;
10113         aint = (unsigned int)f;
10114         ashort = (unsigned short)f;
10115         if (along != (unsigned long)-123)
10116                 result |= 1;
10117         if (aint != (unsigned int)-123)
10118                 result |= 1;
10119         if (ashort != (unsigned short)-123)
10120                 result |= 1;
10121         sprintf(str, "1073741824.");
10122         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10123         f = f + f;
10124         along = 0;
10125         along = (unsigned long)f;
10126         if (along != 0x80000000)
10127                 result |= 2;
10128         f -= 1.;
10129         along = 0;
10130         along = (unsigned long)f;
10131         if (along != 0x7fffffff)
10132                 result |= 1;
10133         f += 2.;
10134         along = 0;
10135         along = (unsigned long)f;
10136         if (along != 0x80000001)
10137                 result |= 2;
10138         if (result)
10139                 exit(result);
10140         signal(SIGFPE, blech_in_list);
10141         sprintf(str, "123.");
10142         sscanf(str, "%lf", &f);  /* f = 123.; */
10143         along = dummy_long((unsigned long)f);
10144         aint = dummy_int((unsigned int)f);
10145         ashort = dummy_short((unsigned short)f);
10146         if (along != (unsigned long)123)
10147                 result |= 4;
10148         if (aint != (unsigned int)123)
10149                 result |= 4;
10150         if (ashort != (unsigned short)123)
10151                 result |= 4;
10152         exit(result);
10153
10154 }
10155 EOCP
10156 set try
10157 if eval $compile_ok; then
10158         $run ./try
10159         castflags=$?
10160 else
10161         echo "(I can't seem to compile the test program--assuming it can't)"
10162         castflags=7
10163 fi
10164 case "$castflags" in
10165 0)      val="$define"
10166         echo "Yup, it can."
10167         ;;
10168 *)      val="$undef"
10169         echo "Nope, it can't."
10170         ;;
10171 esac
10172 set d_castneg
10173 eval $setvar
10174 $rm -f try.*
10175
10176 : see if vprintf exists
10177 echo " "
10178 if set vprintf val -f d_vprintf; eval $csym; $val; then
10179         echo 'vprintf() found.' >&4
10180         val="$define"
10181         $cat >try.c <<'EOF'
10182 #include <varargs.h>
10183
10184 int main() { xxx("foo"); }
10185
10186 xxx(va_alist)
10187 va_dcl
10188 {
10189         va_list args;
10190         char buf[10];
10191
10192         va_start(args);
10193         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10194 }
10195 EOF
10196         set try
10197         if eval $compile && $run ./try; then
10198                 echo "Your vsprintf() returns (int)." >&4
10199                 val2="$undef"
10200         else
10201                 echo "Your vsprintf() returns (char*)." >&4
10202                 val2="$define"
10203         fi
10204 else
10205         echo 'vprintf() NOT found.' >&4
10206                 val="$undef"
10207                 val2="$undef"
10208 fi
10209 $rm -f try try.*
10210 set d_vprintf
10211 eval $setvar
10212 val=$val2
10213 set d_charvspr
10214 eval $setvar
10215
10216 : see if chown exists
10217 set chown d_chown
10218 eval $inlibc
10219
10220 : see if chroot exists
10221 set chroot d_chroot
10222 eval $inlibc
10223
10224 : see if chsize exists
10225 set chsize d_chsize
10226 eval $inlibc
10227
10228 : see if class exists
10229 set class d_class
10230 eval $inlibc
10231
10232 hasstruct='varname=$1; struct=$2; shift; shift;
10233 while $test $# -ge 2; do
10234         case "$1" in
10235         $define) echo "#include <$2>";;
10236         esac ;
10237     shift 2;
10238 done > try.c;
10239 echo "int main () { struct $struct foo; }" >> try.c;
10240 set try;
10241 if eval $compile; then
10242         val="$define";
10243 else
10244         val="$undef";
10245 fi;
10246 set $varname;
10247 eval $setvar;
10248 $rm -f try.c try.o'
10249
10250 socketlib=''
10251 sockethdr=''
10252 : see whether socket exists
10253 echo " "
10254 $echo $n "Hmm... $c" >&4
10255 if set socket val -f d_socket; eval $csym; $val; then
10256         echo "Looks like you have Berkeley networking support." >&4
10257         d_socket="$define"
10258         if set setsockopt val -f; eval $csym; $val; then
10259                 d_oldsock="$undef"
10260         else
10261                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10262                 d_oldsock="$define"
10263         fi
10264 else
10265         if $contains socklib libc.list >/dev/null 2>&1; then
10266                 echo "Looks like you have Berkeley networking support." >&4
10267                 d_socket="$define"
10268                 : we will have to assume that it supports the 4.2 BSD interface
10269                 d_oldsock="$undef"
10270         else
10271                 echo "You don't have Berkeley networking in libc$_a..." >&4
10272                 if test "X$d_socket" = "X$define"; then
10273                    echo "...but you seem to believe that you have sockets." >&4
10274                 else
10275                         for net in net socket
10276                         do
10277                                 if test -f /usr/lib/lib$net$_a; then
10278                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10279                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10280                                         if $contains socket libc.list >/dev/null 2>&1; then
10281                                                 d_socket="$define"
10282                                                 socketlib="-l$net"
10283                                                 case "$net" in
10284                                                 net)
10285                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10286                                                         sockethdr="-I/usr/netinclude"
10287                                                         ;;
10288                                                 esac
10289                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10290                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10291                                                         d_oldsock="$undef"
10292                                                 else
10293                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10294                                                         d_oldsock="$define"
10295                                                 fi
10296                                                 break
10297                                         fi
10298                                 fi
10299                         done
10300                         if test "X$d_socket" != "X$define"; then
10301                            echo "or anywhere else I see." >&4
10302                            d_socket="$undef"
10303                            d_oldsock="$undef"
10304                         fi
10305                 fi
10306         fi
10307 fi
10308
10309 : see if socketpair exists
10310 set socketpair d_sockpair
10311 eval $inlibc
10312
10313
10314 echo " "
10315 echo "Checking the availability of certain socket constants..." >&4
10316 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10317         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10318         $cat >try.c <<EOF
10319 #include <sys/types.h>
10320 #include <sys/socket.h>
10321 int main() {
10322     int i = $ENUM;
10323 }
10324 EOF
10325         val="$undef"
10326         set try; if eval $compile; then
10327                 val="$define"
10328         fi
10329         set d_${enum}; eval $setvar
10330         $rm -f try.c try
10331 done
10332
10333 : see if this is a sys/uio.h system
10334 set sys/uio.h i_sysuio
10335 eval $inhdr
10336
10337
10338 echo " "
10339 echo "Checking to see if your system supports struct cmsghdr..." >&4
10340 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10341 eval $hasstruct
10342 case "$d_cmsghdr_s" in
10343 "$define")      echo "Yes, it does."   ;;
10344 *)              echo "No, it doesn't." ;;
10345 esac
10346
10347
10348 : check for const keyword
10349 echo " "
10350 echo 'Checking to see if your C compiler knows about "const"...' >&4
10351 $cat >const.c <<'EOCP'
10352 typedef struct spug { int drokk; } spug;
10353 int main()
10354 {
10355         const char *foo;
10356         const spug y;
10357 }
10358 EOCP
10359 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10360         val="$define"
10361         echo "Yup, it does."
10362 else
10363         val="$undef"
10364         echo "Nope, it doesn't."
10365 fi
10366 set d_const
10367 eval $setvar
10368
10369 : see if crypt exists
10370 echo " "
10371 set crypt d_crypt
10372 eval $inlibc
10373 case "$d_crypt" in
10374 $define) cryptlib='' ;;
10375 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10376                 echo 'crypt() found.' >&4
10377                 val="$define"
10378                 cryptlib=''
10379         else
10380                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10381                 if $test -z "$cryptlib"; then
10382                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10383                 else
10384                         cryptlib=-lcrypt
10385                 fi
10386                 if $test -z "$cryptlib"; then
10387                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10388                 else
10389                         cryptlib=-lcrypt
10390                 fi
10391                 if $test -z "$cryptlib"; then
10392                         cryptlib=`./loc libcrypt$_a "" $libpth`
10393                 else
10394                         cryptlib=-lcrypt
10395                 fi
10396                 if $test -z "$cryptlib"; then
10397                         echo 'crypt() NOT found.' >&4
10398                         val="$undef"
10399                 else
10400                         val="$define"
10401                 fi
10402         fi
10403         set d_crypt
10404         eval $setvar
10405         ;;
10406 esac
10407
10408 : see if this is a crypt.h system
10409 set crypt.h i_crypt
10410 eval $inhdr
10411
10412 : see if crypt_r exists
10413 set crypt_r d_crypt_r
10414 eval $inlibc
10415 case "$d_crypt_r" in
10416 "$define")
10417         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10418         case "$d_crypt_r_proto:$usethreads" in
10419         ":define")      d_crypt_r_proto=define
10420                 set d_crypt_r_proto crypt_r $hdrs
10421                 eval $hasproto ;;
10422         *)      ;;
10423         esac
10424         case "$d_crypt_r_proto" in
10425         define)
10426         case "$crypt_r_proto" in
10427         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10428         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10429         esac
10430         case "$crypt_r_proto" in
10431         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10432         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10433         esac
10434         case "$crypt_r_proto" in
10435         ''|0)   d_crypt_r=undef
10436                 crypt_r_proto=0
10437                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10438         * )     case "$crypt_r_proto" in
10439                 REENTRANT_PROTO*) ;;
10440                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10441                 esac
10442                 echo "Prototype: $try" ;;
10443         esac
10444         ;;
10445         *)      case "$usethreads" in
10446                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10447                 esac
10448                 d_crypt_r=undef
10449                 crypt_r_proto=0
10450                 ;;
10451         esac
10452         ;;
10453 *)      crypt_r_proto=0
10454         ;;
10455 esac
10456
10457 : get csh whereabouts
10458 case "$csh" in
10459 'csh') val="$undef" ;;
10460 *) val="$define" ;;
10461 esac
10462 set d_csh
10463 eval $setvar
10464 : Respect a hint or command line value for full_csh.
10465 case "$full_csh" in
10466 '') full_csh=$csh ;;
10467 esac
10468
10469 : see if ctermid_r exists
10470 set ctermid_r d_ctermid_r
10471 eval $inlibc
10472 case "$d_ctermid_r" in
10473 "$define")
10474         hdrs="$i_systypes sys/types.h define stdio.h "
10475         case "$d_ctermid_r_proto:$usethreads" in
10476         ":define")      d_ctermid_r_proto=define
10477                 set d_ctermid_r_proto ctermid_r $hdrs
10478                 eval $hasproto ;;
10479         *)      ;;
10480         esac
10481         case "$d_ctermid_r_proto" in
10482         define)
10483         case "$ctermid_r_proto" in
10484         ''|0) try='char* ctermid_r(char*);'
10485         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10486         esac
10487         case "$ctermid_r_proto" in
10488         ''|0)   d_ctermid_r=undef
10489                 ctermid_r_proto=0
10490                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10491         * )     case "$ctermid_r_proto" in
10492                 REENTRANT_PROTO*) ;;
10493                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10494                 esac
10495                 echo "Prototype: $try" ;;
10496         esac
10497         ;;
10498         *)      case "$usethreads" in
10499                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10500                 esac
10501                 d_ctermid_r=undef
10502                 ctermid_r_proto=0
10503                 ;;
10504         esac
10505         ;;
10506 *)      ctermid_r_proto=0
10507         ;;
10508 esac
10509
10510 : see if ctime_r exists
10511 set ctime_r d_ctime_r
10512 eval $inlibc
10513 case "$d_ctime_r" in
10514 "$define")
10515         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10516         case "$d_ctime_r_proto:$usethreads" in
10517         ":define")      d_ctime_r_proto=define
10518                 set d_ctime_r_proto ctime_r $hdrs
10519                 eval $hasproto ;;
10520         *)      ;;
10521         esac
10522         case "$d_ctime_r_proto" in
10523         define)
10524         case "$ctime_r_proto" in
10525         ''|0) try='char* ctime_r(const time_t*, char*);'
10526         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10527         esac
10528         case "$ctime_r_proto" in
10529         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10530         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10531         esac
10532         case "$ctime_r_proto" in
10533         ''|0) try='int ctime_r(const time_t*, char*);'
10534         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10535         esac
10536         case "$ctime_r_proto" in
10537         ''|0) try='int ctime_r(const time_t*, char*, int);'
10538         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10539         esac
10540         case "$ctime_r_proto" in
10541         ''|0)   d_ctime_r=undef
10542                 ctime_r_proto=0
10543                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10544         * )     case "$ctime_r_proto" in
10545                 REENTRANT_PROTO*) ;;
10546                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10547                 esac
10548                 echo "Prototype: $try" ;;
10549         esac
10550         ;;
10551         *)      case "$usethreads" in
10552                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10553                 esac
10554                 d_ctime_r=undef
10555                 ctime_r_proto=0
10556                 ;;
10557         esac
10558         ;;
10559 *)      ctime_r_proto=0
10560         ;;
10561 esac
10562
10563 : see if cuserid exists
10564 set cuserid d_cuserid
10565 eval $inlibc
10566
10567 : see if this is a limits.h system
10568 set limits.h i_limits
10569 eval $inhdr
10570
10571 : see if this is a float.h system
10572 set float.h i_float
10573 eval $inhdr
10574
10575 : See if number of significant digits in a double precision number is known
10576 echo " "
10577 $cat >dbl_dig.c <<EOM
10578 #$i_limits I_LIMITS
10579 #$i_float I_FLOAT
10580 #ifdef I_LIMITS
10581 #include <limits.h>
10582 #endif
10583 #ifdef I_FLOAT
10584 #include <float.h>
10585 #endif
10586 #ifdef DBL_DIG
10587 printf("Contains DBL_DIG");
10588 #endif
10589 EOM
10590 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10591 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10592         echo "DBL_DIG found." >&4
10593         val="$define"
10594 else
10595         echo "DBL_DIG NOT found." >&4
10596         val="$undef"
10597 fi
10598 $rm -f dbl_dig.?
10599 set d_dbl_dig
10600 eval $setvar
10601
10602 : see if dbm.h is available
10603 : see if dbmclose exists
10604 set dbmclose d_dbmclose
10605 eval $inlibc
10606
10607 case "$d_dbmclose" in
10608 $define)
10609         set dbm.h i_dbm
10610         eval $inhdr
10611         case "$i_dbm" in
10612         $define)
10613                 val="$undef"
10614                 set i_rpcsvcdbm
10615                 eval $setvar
10616                 ;;
10617         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10618                 eval $inhdr
10619                 ;;
10620         esac
10621         ;;
10622 *)      echo "We won't be including <dbm.h>"
10623         val="$undef"
10624         set i_dbm
10625         eval $setvar
10626         val="$undef"
10627         set i_rpcsvcdbm
10628         eval $setvar
10629         ;;
10630 esac
10631
10632 : see if prototype for dbminit is available
10633 echo " "
10634 set d_dbminitproto dbminit $i_dbm dbm.h
10635 eval $hasproto
10636
10637 : see if difftime exists
10638 set difftime d_difftime
10639 eval $inlibc
10640
10641 : see if this is a dirent system
10642 echo " "
10643 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10644         val="$define"
10645         echo "<dirent.h> found." >&4
10646 else
10647         val="$undef"
10648         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10649                 echo "<sys/dir.h> found." >&4
10650                 echo " "
10651         else
10652                 xinc=`./findhdr sys/ndir.h`
10653         fi
10654         echo "<dirent.h> NOT found." >&4
10655 fi
10656 set i_dirent
10657 eval $setvar
10658
10659 : Look for type of directory structure.
10660 echo " "
10661 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10662
10663 case "$direntrytype" in
10664 ''|' ')
10665         case "$i_dirent" in
10666         $define) guess1='struct dirent' ;;
10667         *) guess1='struct direct'  ;;
10668         esac
10669         ;;
10670 *)      guess1="$direntrytype"
10671         ;;
10672 esac
10673
10674 case "$guess1" in
10675 'struct dirent') guess2='struct direct' ;;
10676 *) guess2='struct dirent' ;;
10677 esac
10678                 
10679 if $contains "$guess1" try.c >/dev/null 2>&1; then
10680         direntrytype="$guess1"
10681         echo "Your directory entries are $direntrytype." >&4
10682 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10683         direntrytype="$guess2"
10684         echo "Your directory entries seem to be $direntrytype." >&4
10685 else
10686         echo "I don't recognize your system's directory entries." >&4
10687         rp="What type is used for directory entries on this system?"
10688         dflt="$guess1"
10689         . ./myread
10690         direntrytype="$ans"
10691 fi
10692 $rm -f try.c
10693
10694
10695 : see if the directory entry stores field length
10696 echo " "
10697 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10698 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10699         echo "Good, your directory entry keeps length information in d_namlen." >&4
10700         val="$define"
10701 else
10702         echo "Your directory entry does not know about the d_namlen field." >&4
10703         val="$undef"
10704 fi
10705 set d_dirnamlen
10706 eval $setvar
10707 $rm -f try.c
10708
10709 : see if this is an sysdir system
10710 set sys/dir.h i_sysdir
10711 eval $inhdr
10712
10713 : see if this is an sysndir system
10714 set sys/ndir.h i_sysndir
10715 eval $inhdr
10716
10717 : Look for dirfd
10718 echo " "
10719 $cat >dirfd.c <<EOM
10720 #include <stdio.h>
10721 #$i_dirent I_DIRENT             /**/
10722 #$i_sysdir I_SYS_DIR            /**/
10723 #$i_sysndir I_SYS_NDIR          /**/
10724 #$i_systypes I_SYS_TYPES        /**/
10725 #if defined(I_SYS_TYPES)
10726 #include <sys/types.h>
10727 #endif
10728 #if defined(I_DIRENT)
10729 #include <dirent.h>
10730 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10731 #include <sys/dir.h>
10732 #endif
10733 #else
10734 #ifdef I_SYS_NDIR
10735 #include <sys/ndir.h>
10736 #else
10737 #ifdef I_SYS_DIR
10738 #ifdef hp9000s500
10739 #include <ndir.h>       /* may be wrong in the future */
10740 #else
10741 #include <sys/dir.h>
10742 #endif
10743 #endif
10744 #endif
10745 #endif 
10746 int main() {
10747         DIR *dirp = opendir(".");
10748         if (dirfd(dirp) >= 0)
10749                 exit(0);
10750         else
10751                 exit(1);
10752 }
10753 EOM
10754 set dirfd
10755 if eval $compile; then
10756         val="$define"
10757 fi
10758 case "$val" in
10759 $define)        echo "dirfd() found." >&4       ;;
10760 *)              echo "dirfd() NOT found." >&4   ;;
10761 esac
10762 set d_dirfd
10763 eval $setvar
10764 $rm -f dirfd*
10765
10766 : see if dlerror exists
10767 xxx_runnm="$runnm"
10768 runnm=false
10769 set dlerror d_dlerror
10770 eval $inlibc
10771 runnm="$xxx_runnm"
10772
10773 : see if dlfcn is available
10774 set dlfcn.h i_dlfcn
10775 eval $inhdr
10776
10777 case "$usedl" in
10778 $define|y|true)
10779         $cat << EOM
10780
10781 On a few systems, the dynamically loaded modules that perl generates and uses
10782 will need a different extension than shared libs. The default will probably
10783 be appropriate.
10784
10785 EOM
10786         case "$dlext" in
10787         '')     dflt="$so" ;;
10788         *)      dflt="$dlext" ;;
10789         esac
10790         rp='What is the extension of dynamically loaded modules'
10791         . ./myread
10792         dlext="$ans"
10793         ;;
10794 *)
10795         dlext="none"
10796         ;;
10797 esac
10798
10799 : Check if dlsym need a leading underscore
10800 echo " "
10801 val="$undef"
10802
10803 case "$dlsrc" in
10804 dl_dlopen.xs)
10805         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10806         $cat >dyna.c <<'EOM'
10807 fred () { }
10808 EOM
10809
10810 $cat >fred.c<<EOM
10811
10812 #include <stdio.h>
10813 #$i_dlfcn I_DLFCN
10814 #ifdef I_DLFCN
10815 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10816 #else
10817 #include <sys/types.h>
10818 #include <nlist.h>
10819 #include <link.h>
10820 #endif
10821
10822 extern int fred() ;
10823
10824 int main()
10825 {
10826     void * handle ;
10827     void * symbol ;
10828 #ifndef RTLD_LAZY
10829     int mode = 1 ;
10830 #else
10831     int mode = RTLD_LAZY ;
10832 #endif
10833     handle = dlopen("./dyna.$dlext", mode) ;
10834     if (handle == NULL) {
10835         printf ("1\n") ;
10836         fflush (stdout) ;
10837         exit(0);
10838     }
10839     symbol = dlsym(handle, "fred") ;
10840     if (symbol == NULL) {
10841         /* try putting a leading underscore */
10842         symbol = dlsym(handle, "_fred") ;
10843         if (symbol == NULL) {
10844             printf ("2\n") ;
10845             fflush (stdout) ;
10846             exit(0);
10847         }
10848         printf ("3\n") ;
10849     }
10850     else
10851         printf ("4\n") ;
10852     fflush (stdout) ;
10853     exit(0);
10854 }
10855 EOM
10856         : Call the object file tmp-dyna.o in case dlext=o.
10857         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10858                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10859                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10860                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10861                 xxx=`$run ./fred`
10862                 case $xxx in
10863                 1)      echo "Test program failed using dlopen." >&4
10864                         echo "Perhaps you should not use dynamic loading." >&4;;
10865                 2)      echo "Test program failed using dlsym." >&4
10866                         echo "Perhaps you should not use dynamic loading." >&4;;
10867                 3)      echo "dlsym needs a leading underscore" >&4
10868                         val="$define" ;;
10869                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10870                 esac
10871         else
10872                 echo "I can't compile and run the test program." >&4
10873                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10874         fi
10875         ;;
10876 esac
10877                 
10878 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10879
10880 set d_dlsymun
10881 eval $setvar
10882
10883 : see if drand48_r exists
10884 set drand48_r d_drand48_r
10885 eval $inlibc
10886 case "$d_drand48_r" in
10887 "$define")
10888         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10889         case "$d_drand48_r_proto:$usethreads" in
10890         ":define")      d_drand48_r_proto=define
10891                 set d_drand48_r_proto drand48_r $hdrs
10892                 eval $hasproto ;;
10893         *)      ;;
10894         esac
10895         case "$d_drand48_r_proto" in
10896         define)
10897         case "$drand48_r_proto" in
10898         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10899         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10900         esac
10901         case "$drand48_r_proto" in
10902         ''|0)   d_drand48_r=undef
10903                 drand48_r_proto=0
10904                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10905         * )     case "$drand48_r_proto" in
10906                 REENTRANT_PROTO*) ;;
10907                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10908                 esac
10909                 echo "Prototype: $try" ;;
10910         esac
10911         ;;
10912         *)      case "$usethreads" in
10913                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10914                 esac
10915                 d_drand48_r=undef
10916                 drand48_r_proto=0
10917                 ;;
10918         esac
10919         ;;
10920 *)      drand48_r_proto=0
10921         ;;
10922 esac
10923
10924 : see if prototype for drand48 is available
10925 echo " "
10926 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10927 eval $hasproto
10928
10929 : see if dup2 exists
10930 set dup2 d_dup2
10931 eval $inlibc
10932
10933 : see if eaccess exists
10934 set eaccess d_eaccess
10935 eval $inlibc
10936
10937 : see if endgrent exists
10938 set endgrent d_endgrent
10939 eval $inlibc
10940
10941 : see if this is an grp system
10942 set grp.h i_grp
10943 eval $inhdr
10944
10945 case "$i_grp" in
10946 $define)
10947         xxx=`./findhdr grp.h`
10948         $cppstdin $cppflags $cppminus < $xxx >$$.h
10949
10950         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10951                 val="$define"
10952         else
10953                 val="$undef"
10954         fi
10955         set d_grpasswd
10956         eval $setvar
10957
10958         $rm -f $$.h
10959         ;;
10960 *)
10961         val="$undef";
10962         set d_grpasswd; eval $setvar
10963         ;;
10964 esac
10965
10966 : see if endgrent_r exists
10967 set endgrent_r d_endgrent_r
10968 eval $inlibc
10969 case "$d_endgrent_r" in
10970 "$define")
10971         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
10972         case "$d_endgrent_r_proto:$usethreads" in
10973         ":define")      d_endgrent_r_proto=define
10974                 set d_endgrent_r_proto endgrent_r $hdrs
10975                 eval $hasproto ;;
10976         *)      ;;
10977         esac
10978         case "$d_endgrent_r_proto" in
10979         define)
10980         case "$endgrent_r_proto" in
10981         ''|0) try='int endgrent_r(FILE**);'
10982         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
10983         esac
10984         case "$endgrent_r_proto" in
10985         ''|0) try='void endgrent_r(FILE**);'
10986         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
10987         esac
10988         case "$endgrent_r_proto" in
10989         ''|0)   d_endgrent_r=undef
10990                 endgrent_r_proto=0
10991                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
10992         * )     case "$endgrent_r_proto" in
10993                 REENTRANT_PROTO*) ;;
10994                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
10995                 esac
10996                 echo "Prototype: $try" ;;
10997         esac
10998         ;;
10999         *)      case "$usethreads" in
11000                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11001                 esac
11002                 d_endgrent_r=undef
11003                 endgrent_r_proto=0
11004                 ;;
11005         esac
11006         ;;
11007 *)      endgrent_r_proto=0
11008         ;;
11009 esac
11010
11011 : see if endhostent exists
11012 set endhostent d_endhent
11013 eval $inlibc
11014
11015 : see if this is a netdb.h system
11016 set netdb.h i_netdb
11017 eval $inhdr
11018
11019 : see if endhostent_r exists
11020 set endhostent_r d_endhostent_r
11021 eval $inlibc
11022 case "$d_endhostent_r" in
11023 "$define")
11024         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11025         case "$d_endhostent_r_proto:$usethreads" in
11026         ":define")      d_endhostent_r_proto=define
11027                 set d_endhostent_r_proto endhostent_r $hdrs
11028                 eval $hasproto ;;
11029         *)      ;;
11030         esac
11031         case "$d_endhostent_r_proto" in
11032         define)
11033         case "$endhostent_r_proto" in
11034         ''|0) try='int endhostent_r(struct hostent_data*);'
11035         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11036         esac
11037         case "$endhostent_r_proto" in
11038         ''|0) try='void endhostent_r(struct hostent_data*);'
11039         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11040         esac
11041         case "$endhostent_r_proto" in
11042         ''|0)   d_endhostent_r=undef
11043                 endhostent_r_proto=0
11044                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11045         * )     case "$endhostent_r_proto" in
11046                 REENTRANT_PROTO*) ;;
11047                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11048                 esac
11049                 echo "Prototype: $try" ;;
11050         esac
11051         ;;
11052         *)      case "$usethreads" in
11053                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11054                 esac
11055                 d_endhostent_r=undef
11056                 endhostent_r_proto=0
11057                 ;;
11058         esac
11059         ;;
11060 *)      endhostent_r_proto=0
11061         ;;
11062 esac
11063
11064 : see if endnetent exists
11065 set endnetent d_endnent
11066 eval $inlibc
11067
11068 : see if endnetent_r exists
11069 set endnetent_r d_endnetent_r
11070 eval $inlibc
11071 case "$d_endnetent_r" in
11072 "$define")
11073         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11074         case "$d_endnetent_r_proto:$usethreads" in
11075         ":define")      d_endnetent_r_proto=define
11076                 set d_endnetent_r_proto endnetent_r $hdrs
11077                 eval $hasproto ;;
11078         *)      ;;
11079         esac
11080         case "$d_endnetent_r_proto" in
11081         define)
11082         case "$endnetent_r_proto" in
11083         ''|0) try='int endnetent_r(struct netent_data*);'
11084         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11085         esac
11086         case "$endnetent_r_proto" in
11087         ''|0) try='void endnetent_r(struct netent_data*);'
11088         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11089         esac
11090         case "$endnetent_r_proto" in
11091         ''|0)   d_endnetent_r=undef
11092                 endnetent_r_proto=0
11093                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11094         * )     case "$endnetent_r_proto" in
11095                 REENTRANT_PROTO*) ;;
11096                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11097                 esac
11098                 echo "Prototype: $try" ;;
11099         esac
11100         ;;
11101         *)      case "$usethreads" in
11102                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11103                 esac
11104                 d_endnetent_r=undef
11105                 endnetent_r_proto=0
11106                 ;;
11107         esac
11108         ;;
11109 *)      endnetent_r_proto=0
11110         ;;
11111 esac
11112
11113 : see if endprotoent exists
11114 set endprotoent d_endpent
11115 eval $inlibc
11116
11117 : see if endprotoent_r exists
11118 set endprotoent_r d_endprotoent_r
11119 eval $inlibc
11120 case "$d_endprotoent_r" in
11121 "$define")
11122         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11123         case "$d_endprotoent_r_proto:$usethreads" in
11124         ":define")      d_endprotoent_r_proto=define
11125                 set d_endprotoent_r_proto endprotoent_r $hdrs
11126                 eval $hasproto ;;
11127         *)      ;;
11128         esac
11129         case "$d_endprotoent_r_proto" in
11130         define)
11131         case "$endprotoent_r_proto" in
11132         ''|0) try='int endprotoent_r(struct protoent_data*);'
11133         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11134         esac
11135         case "$endprotoent_r_proto" in
11136         ''|0) try='void endprotoent_r(struct protoent_data*);'
11137         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11138         esac
11139         case "$endprotoent_r_proto" in
11140         ''|0)   d_endprotoent_r=undef
11141                 endprotoent_r_proto=0
11142                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11143         * )     case "$endprotoent_r_proto" in
11144                 REENTRANT_PROTO*) ;;
11145                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11146                 esac
11147                 echo "Prototype: $try" ;;
11148         esac
11149         ;;
11150         *)      case "$usethreads" in
11151                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11152                 esac
11153                 d_endprotoent_r=undef
11154                 endprotoent_r_proto=0
11155                 ;;
11156         esac
11157         ;;
11158 *)      endprotoent_r_proto=0
11159         ;;
11160 esac
11161
11162 : see if endpwent exists
11163 set endpwent d_endpwent
11164 eval $inlibc
11165
11166 : see if this is a pwd.h system
11167 set pwd.h i_pwd
11168 eval $inhdr
11169
11170 case "$i_pwd" in
11171 $define)
11172         xxx=`./findhdr pwd.h`
11173         $cppstdin $cppflags $cppminus < $xxx >$$.h
11174
11175         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11176                 val="$define"
11177         else
11178                 val="$undef"
11179         fi
11180         set d_pwquota
11181         eval $setvar
11182
11183         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11184                 val="$define"
11185         else
11186                 val="$undef"
11187         fi
11188         set d_pwage
11189         eval $setvar
11190
11191         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11192                 val="$define"
11193         else
11194                 val="$undef"
11195         fi
11196         set d_pwchange
11197         eval $setvar
11198
11199         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11200                 val="$define"
11201         else
11202                 val="$undef"
11203         fi
11204         set d_pwclass
11205         eval $setvar
11206
11207         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11208                 val="$define"
11209         else
11210                 val="$undef"
11211         fi
11212         set d_pwexpire
11213         eval $setvar
11214
11215         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11216                 val="$define"
11217         else
11218                 val="$undef"
11219         fi
11220         set d_pwcomment
11221         eval $setvar
11222
11223         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11224                 val="$define"
11225         else
11226                 val="$undef"
11227         fi
11228         set d_pwgecos
11229         eval $setvar
11230
11231         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11232                 val="$define"
11233         else
11234                 val="$undef"
11235         fi
11236         set d_pwpasswd
11237         eval $setvar
11238
11239         $rm -f $$.h
11240         ;;
11241 *)
11242         val="$undef"; 
11243         set d_pwquota; eval $setvar
11244         set d_pwage; eval $setvar
11245         set d_pwchange; eval $setvar
11246         set d_pwclass; eval $setvar
11247         set d_pwexpire; eval $setvar
11248         set d_pwcomment; eval $setvar
11249         set d_pwgecos; eval $setvar
11250         set d_pwpasswd; eval $setvar
11251         ;;
11252 esac
11253
11254 : see if endpwent_r exists
11255 set endpwent_r d_endpwent_r
11256 eval $inlibc
11257 case "$d_endpwent_r" in
11258 "$define")
11259         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11260         case "$d_endpwent_r_proto:$usethreads" in
11261         ":define")      d_endpwent_r_proto=define
11262                 set d_endpwent_r_proto endpwent_r $hdrs
11263                 eval $hasproto ;;
11264         *)      ;;
11265         esac
11266         case "$d_endpwent_r_proto" in
11267         define)
11268         case "$endpwent_r_proto" in
11269         ''|0) try='int endpwent_r(FILE**);'
11270         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11271         esac
11272         case "$endpwent_r_proto" in
11273         ''|0) try='void endpwent_r(FILE**);'
11274         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11275         esac
11276         case "$endpwent_r_proto" in
11277         ''|0)   d_endpwent_r=undef
11278                 endpwent_r_proto=0
11279                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11280         * )     case "$endpwent_r_proto" in
11281                 REENTRANT_PROTO*) ;;
11282                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11283                 esac
11284                 echo "Prototype: $try" ;;
11285         esac
11286         ;;
11287         *)      case "$usethreads" in
11288                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11289                 esac
11290                 d_endpwent_r=undef
11291                 endpwent_r_proto=0
11292                 ;;
11293         esac
11294         ;;
11295 *)      endpwent_r_proto=0
11296         ;;
11297 esac
11298
11299 : see if endservent exists
11300 set endservent d_endsent
11301 eval $inlibc
11302
11303 : see if endservent_r exists
11304 set endservent_r d_endservent_r
11305 eval $inlibc
11306 case "$d_endservent_r" in
11307 "$define")
11308         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11309         case "$d_endservent_r_proto:$usethreads" in
11310         ":define")      d_endservent_r_proto=define
11311                 set d_endservent_r_proto endservent_r $hdrs
11312                 eval $hasproto ;;
11313         *)      ;;
11314         esac
11315         case "$d_endservent_r_proto" in
11316         define)
11317         case "$endservent_r_proto" in
11318         ''|0) try='int endservent_r(struct servent_data*);'
11319         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11320         esac
11321         case "$endservent_r_proto" in
11322         ''|0) try='void endservent_r(struct servent_data*);'
11323         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11324         esac
11325         case "$endservent_r_proto" in
11326         ''|0)   d_endservent_r=undef
11327                 endservent_r_proto=0
11328                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11329         * )     case "$endservent_r_proto" in
11330                 REENTRANT_PROTO*) ;;
11331                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11332                 esac
11333                 echo "Prototype: $try" ;;
11334         esac
11335         ;;
11336         *)      case "$usethreads" in
11337                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11338                 esac
11339                 d_endservent_r=undef
11340                 endservent_r_proto=0
11341                 ;;
11342         esac
11343         ;;
11344 *)      endservent_r_proto=0
11345         ;;
11346 esac
11347
11348 : Locate the flags for 'open()'
11349 echo " "
11350 $cat >try.c <<'EOCP'
11351 #include <sys/types.h>
11352 #ifdef I_FCNTL
11353 #include <fcntl.h>
11354 #endif
11355 #ifdef I_SYS_FILE
11356 #include <sys/file.h>
11357 #endif
11358 int main() {
11359         if(O_RDONLY);
11360 #ifdef O_TRUNC
11361         exit(0);
11362 #else
11363         exit(1);
11364 #endif
11365 }
11366 EOCP
11367 : check sys/file.h first to get FREAD on Sun
11368 if $test `./findhdr sys/file.h` && \
11369                 set try -DI_SYS_FILE && eval $compile; then
11370         h_sysfile=true;
11371         echo "<sys/file.h> defines the O_* constants..." >&4
11372         if $run ./try; then
11373                 echo "and you have the 3 argument form of open()." >&4
11374                 val="$define"
11375         else
11376                 echo "but not the 3 argument form of open().  Oh, well." >&4
11377                 val="$undef"
11378         fi
11379 elif $test `./findhdr fcntl.h` && \
11380                 set try -DI_FCNTL && eval $compile; then
11381         h_fcntl=true;
11382         echo "<fcntl.h> defines the O_* constants..." >&4
11383         if $run ./try; then
11384                 echo "and you have the 3 argument form of open()." >&4
11385                 val="$define"
11386         else
11387                 echo "but not the 3 argument form of open().  Oh, well." >&4
11388                 val="$undef"
11389         fi
11390 else
11391         val="$undef"
11392         echo "I can't find the O_* constant definitions!  You got problems." >&4
11393 fi
11394 set d_open3
11395 eval $setvar
11396 $rm -f try try.*
11397
11398 : see which of string.h or strings.h is needed
11399 echo " "
11400 strings=`./findhdr string.h`
11401 if $test "$strings" && $test -r "$strings"; then
11402         echo "Using <string.h> instead of <strings.h>." >&4
11403         val="$define"
11404 else
11405         val="$undef"
11406         strings=`./findhdr strings.h`
11407         if $test "$strings" && $test -r "$strings"; then
11408                 echo "Using <strings.h> instead of <string.h>." >&4
11409         else
11410                 echo "No string header found -- You'll surely have problems." >&4
11411         fi
11412 fi
11413 set i_string
11414 eval $setvar
11415 case "$i_string" in
11416 "$undef") strings=`./findhdr strings.h`;;
11417 *)        strings=`./findhdr string.h`;;
11418 esac
11419
11420 : see if this is a sys/file.h system
11421 val=''
11422 set sys/file.h val
11423 eval $inhdr
11424
11425 : do we need to include sys/file.h ?
11426 case "$val" in
11427 "$define")
11428         echo " "
11429         if $h_sysfile; then
11430                 val="$define"
11431                 echo "We'll be including <sys/file.h>." >&4
11432         else
11433                 val="$undef"
11434                 echo "We won't be including <sys/file.h>." >&4
11435         fi
11436         ;;
11437 *)
11438         h_sysfile=false
11439         ;;
11440 esac
11441 set i_sysfile
11442 eval $setvar
11443
11444 : see if fcntl.h is there
11445 val=''
11446 set fcntl.h val
11447 eval $inhdr
11448
11449 : see if we can include fcntl.h
11450 case "$val" in
11451 "$define")
11452         echo " "
11453         if $h_fcntl; then
11454                 val="$define"
11455                 echo "We'll be including <fcntl.h>." >&4
11456         else
11457                 val="$undef"
11458                 if $h_sysfile; then
11459         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11460                 else
11461                         echo "We won't be including <fcntl.h>." >&4
11462                 fi
11463         fi
11464         ;;
11465 *)
11466         h_fcntl=false
11467         val="$undef"
11468         ;;
11469 esac
11470 set i_fcntl
11471 eval $setvar
11472
11473 : check for non-blocking I/O stuff
11474 case "$h_sysfile" in
11475 true) echo "#include <sys/file.h>" > head.c;;
11476 *)
11477        case "$h_fcntl" in
11478        true) echo "#include <fcntl.h>" > head.c;;
11479        *) echo "#include <sys/fcntl.h>" > head.c;;
11480        esac
11481        ;;
11482 esac
11483 echo " "
11484 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11485 case "$o_nonblock" in
11486 '')
11487         $cat head.c > try.c
11488         $cat >>try.c <<EOCP
11489 #include <stdio.h>
11490 #include <stdlib.h>
11491 #$i_fcntl I_FCNTL
11492 #ifdef I_FCNTL
11493 #include <fcntl.h>
11494 #endif
11495 int main() {
11496 #ifdef O_NONBLOCK
11497         printf("O_NONBLOCK\n");
11498         exit(0);
11499 #endif
11500 #ifdef O_NDELAY
11501         printf("O_NDELAY\n");
11502         exit(0);
11503 #endif
11504 #ifdef FNDELAY
11505         printf("FNDELAY\n");
11506         exit(0);
11507 #endif
11508         exit(0);
11509 }
11510 EOCP
11511         set try
11512         if eval $compile_ok; then
11513                 o_nonblock=`$run ./try`
11514                 case "$o_nonblock" in
11515                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11516                 *) echo "Seems like we can use $o_nonblock.";;
11517                 esac
11518         else
11519                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11520         fi
11521         ;;
11522 *) echo "Using $hint value $o_nonblock.";;
11523 esac
11524 $rm -f try try.* .out core
11525
11526 echo " "
11527 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11528 case "$eagain" in
11529 '')
11530         $cat head.c > try.c
11531         $cat >>try.c <<EOCP
11532 #include <errno.h>
11533 #include <sys/types.h>
11534 #include <signal.h>
11535 #include <stdio.h> 
11536 #include <stdlib.h> 
11537 #$i_fcntl I_FCNTL
11538 #ifdef I_FCNTL
11539 #include <fcntl.h>
11540 #endif
11541 #define MY_O_NONBLOCK $o_nonblock
11542 #ifndef errno  /* XXX need better Configure test */
11543 extern int errno;
11544 #endif
11545 #$i_unistd I_UNISTD
11546 #ifdef I_UNISTD
11547 #include <unistd.h>
11548 #endif
11549 #$i_string I_STRING
11550 #ifdef I_STRING
11551 #include <string.h>
11552 #else
11553 #include <strings.h>
11554 #endif
11555 $signal_t blech(x) int x; { exit(3); }
11556 EOCP
11557         $cat >> try.c <<'EOCP'
11558 int main()
11559 {
11560         int pd[2];
11561         int pu[2];
11562         char buf[1];
11563         char string[100];
11564
11565         pipe(pd);       /* Down: child -> parent */
11566         pipe(pu);       /* Up: parent -> child */
11567         if (0 != fork()) {
11568                 int ret;
11569                 close(pd[1]);   /* Parent reads from pd[0] */
11570                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11571 #ifdef F_SETFL
11572                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11573                         exit(1);
11574 #else
11575                 exit(4);
11576 #endif
11577                 signal(SIGALRM, blech);
11578                 alarm(5);
11579                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11580                         exit(2);
11581                 sprintf(string, "%d\n", ret);
11582                 write(2, string, strlen(string));
11583                 alarm(0);
11584 #ifdef EAGAIN
11585                 if (errno == EAGAIN) {
11586                         printf("EAGAIN\n");
11587                         goto ok;
11588                 }
11589 #endif
11590 #ifdef EWOULDBLOCK
11591                 if (errno == EWOULDBLOCK)
11592                         printf("EWOULDBLOCK\n");
11593 #endif
11594         ok:
11595                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11596                 sleep(2);                               /* Give it time to close our pipe */
11597                 alarm(5);
11598                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11599                 alarm(0);
11600                 sprintf(string, "%d\n", ret);
11601                 write(4, string, strlen(string));
11602                 exit(0);
11603         }
11604
11605         close(pd[0]);                   /* We write to pd[1] */
11606         close(pu[1]);                   /* We read from pu[0] */
11607         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11608         close(pd[1]);                   /* Pipe pd is now fully closed! */
11609         exit(0);                                /* Bye bye, thank you for playing! */
11610 }
11611 EOCP
11612         set try
11613         if eval $compile_ok; then
11614                 echo "$startsh" >mtry
11615                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11616                 chmod +x mtry
11617                 ./mtry >/dev/null 2>&1
11618                 case $? in
11619                 0) eagain=`$cat try.out`;;
11620                 1) echo "Could not perform non-blocking setting!";;
11621                 2) echo "I did a successful read() for something that was not there!";;
11622                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11623                 4) echo "Could not find F_SETFL!";;
11624                 *) echo "Something terribly wrong happened during testing.";;
11625                 esac
11626                 rd_nodata=`$cat try.ret`
11627                 echo "A read() system call with no data present returns $rd_nodata."
11628                 case "$rd_nodata" in
11629                 0|-1) ;;
11630                 *)
11631                         echo "(That's peculiar, fixing that to be -1.)"
11632                         rd_nodata=-1
11633                         ;;
11634                 esac
11635                 case "$eagain" in
11636                 '')
11637                         echo "Forcing errno EAGAIN on read() with no data available."
11638                         eagain=EAGAIN
11639                         ;;
11640                 *)
11641                         echo "Your read() sets errno to $eagain when no data is available."
11642                         ;;
11643                 esac
11644                 status=`$cat try.err`
11645                 case "$status" in
11646                 0) echo "And it correctly returns 0 to signal EOF.";;
11647                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11648                 *) echo "However, your read() returns '$status' on EOF??";;
11649                 esac
11650                 val="$define"
11651                 if test "$status" = "$rd_nodata"; then
11652                         echo "WARNING: you can't distinguish between EOF and no data!"
11653                         val="$undef"
11654                 fi
11655         else
11656                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11657                 eagain=EAGAIN
11658         fi
11659         set d_eofnblk
11660         eval $setvar
11661         ;;
11662 *)
11663         echo "Using $hint value $eagain."
11664         echo "Your read() returns $rd_nodata when no data is present."
11665         case "$d_eofnblk" in
11666         "$define") echo "And you can see EOF because read() returns 0.";;
11667         "$undef") echo "But you can't see EOF status from read() returned value.";;
11668         *)
11669                 echo "(Assuming you can't see EOF status from read anyway.)"
11670                 d_eofnblk=$undef
11671                 ;;
11672         esac
11673         ;;
11674 esac
11675 $rm -f try try.* .out core head.c mtry
11676
11677 : see if fchdir exists
11678 set fchdir d_fchdir
11679 eval $inlibc
11680
11681 : see if fchmod exists
11682 set fchmod d_fchmod
11683 eval $inlibc
11684
11685 : see if fchown exists
11686 set fchown d_fchown
11687 eval $inlibc
11688
11689 : see if this is an fcntl system
11690 set fcntl d_fcntl
11691 eval $inlibc
11692
11693 echo " "
11694 : See if fcntl-based locking works.
11695 $cat >try.c <<EOCP
11696 #include <stdlib.h>
11697 #include <unistd.h>
11698 #include <fcntl.h>
11699 #include <signal.h>
11700 $signal_t blech(x) int x; { exit(3); }
11701 int main() {
11702 #if defined(F_SETLK) && defined(F_SETLKW)
11703      struct flock flock;
11704      int retval, fd;
11705      fd = open("try.c", O_RDONLY);
11706      flock.l_type = F_RDLCK;
11707      flock.l_whence = SEEK_SET;
11708      flock.l_start = flock.l_len = 0;
11709      signal(SIGALRM, blech);
11710      alarm(10);
11711      retval = fcntl(fd, F_SETLK, &flock);
11712      close(fd);
11713      (retval < 0 ? exit(2) : exit(0));
11714 #else
11715      exit(2);
11716 #endif
11717 }
11718 EOCP
11719 echo "Checking if fcntl-based file locking works... "
11720 case "$d_fcntl" in
11721 "$define")
11722         set try
11723         if eval $compile_ok; then
11724                 if $run ./try; then
11725                         echo "Yes, it seems to work."
11726                         val="$define"
11727                 else
11728                         echo "Nope, it didn't work."
11729                         val="$undef"
11730                         case "$?" in
11731                         3) $cat >&4 <<EOM
11732 ***
11733 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11734 *** This is (almost) impossible.
11735 *** If your NFS lock daemons are not feeling well, something like
11736 *** this may happen, please investigate.  Cannot continue, aborting.
11737 ***
11738 EOM
11739                                 exit 1
11740                                 ;;
11741                         esac
11742                 fi
11743         else
11744                 echo "I'm unable to compile the test program, so I'll assume not."
11745                 val="$undef"
11746         fi
11747         ;;
11748 *) val="$undef";
11749         echo "Nope, since you don't even have fcntl()."
11750         ;;
11751 esac
11752 set d_fcntl_can_lock
11753 eval $setvar
11754 $rm -f try*
11755
11756
11757 : check for fd_set items
11758 $cat <<EOM
11759
11760 Checking to see how well your C compiler handles fd_set and friends ...
11761 EOM
11762 $cat >try.c <<EOCP
11763 #$i_systime I_SYS_TIME
11764 #$i_sysselct I_SYS_SELECT
11765 #$d_socket HAS_SOCKET
11766 #include <sys/types.h>
11767 #ifdef HAS_SOCKET
11768 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11769 #endif
11770 #ifdef I_SYS_TIME
11771 #include <sys/time.h>
11772 #endif
11773 #ifdef I_SYS_SELECT
11774 #include <sys/select.h>
11775 #endif
11776 int main() {
11777         fd_set fds;
11778
11779 #ifdef TRYBITS
11780         if(fds.fds_bits);
11781 #endif
11782
11783 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11784         exit(0);
11785 #else
11786         exit(1);
11787 #endif
11788 }
11789 EOCP
11790 set try -DTRYBITS
11791 if eval $compile; then
11792         d_fds_bits="$define"
11793         d_fd_set="$define"
11794         echo "Well, your system knows about the normal fd_set typedef..." >&4
11795         if $run ./try; then
11796                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11797                 d_fd_macros="$define"
11798         else
11799                 $cat >&4 <<'EOM'
11800 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11801 EOM
11802                 d_fd_macros="$undef"
11803         fi
11804 else
11805         $cat <<'EOM'
11806 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11807 EOM
11808         set try
11809         if eval $compile; then
11810                 d_fds_bits="$undef"
11811                 d_fd_set="$define"
11812                 echo "Well, your system has some sort of fd_set available..." >&4
11813                 if $run ./try; then
11814                         echo "and you have the normal fd_set macros." >&4
11815                         d_fd_macros="$define"
11816                 else
11817                         $cat <<'EOM'
11818 but not the normal fd_set macros!  Gross!  More work for me...
11819 EOM
11820                         d_fd_macros="$undef"
11821                 fi
11822         else
11823         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11824                 d_fd_set="$undef"
11825                 d_fds_bits="$undef"
11826                 d_fd_macros="$undef"
11827         fi
11828 fi
11829 $rm -f try try.*
11830
11831 : see if fgetpos exists
11832 set fgetpos d_fgetpos
11833 eval $inlibc
11834
11835 : see if finite exists
11836 set finite d_finite
11837 eval $inlibc
11838
11839 : see if finitel exists
11840 set finitel d_finitel
11841 eval $inlibc
11842
11843 : see if flock exists
11844 set flock d_flock
11845 eval $inlibc
11846
11847 : see if prototype for flock is available
11848 echo " "
11849 set d_flockproto flock $i_sysfile sys/file.h
11850 eval $hasproto
11851
11852 : see if fork exists
11853 set fork d_fork
11854 eval $inlibc
11855
11856 : see if fp_class exists
11857 set fp_class d_fp_class
11858 eval $inlibc
11859
11860 : see if pathconf exists
11861 set pathconf d_pathconf
11862 eval $inlibc
11863
11864 : see if fpathconf exists
11865 set fpathconf d_fpathconf
11866 eval $inlibc
11867
11868 : see if fpclass exists
11869 set fpclass d_fpclass
11870 eval $inlibc
11871
11872 : see if fpclassify exists
11873 set fpclassify d_fpclassify
11874 eval $inlibc
11875
11876 : see if fpclassl exists
11877 set fpclassl d_fpclassl
11878 eval $inlibc
11879
11880
11881 : check for fpos64_t
11882 echo " "
11883 echo "Checking to see if you have fpos64_t..." >&4
11884 $cat >try.c <<EOCP
11885 #include <stdio.h>
11886 int main() { fpos64_t x = 7; }
11887 EOCP
11888 set try
11889 if eval $compile; then
11890         val="$define"
11891         echo "You have fpos64_t."
11892 else
11893         val="$undef"
11894         echo "You do not have fpos64_t."
11895         case "$fpossize" in
11896         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11897         esac
11898 fi
11899 $rm -f try.* try
11900 set d_fpos64_t
11901 eval $setvar
11902
11903 : see if frexpl exists
11904 set frexpl d_frexpl
11905 eval $inlibc
11906
11907 : see if this is a sys/param system
11908 set sys/param.h i_sysparam
11909 eval $inhdr
11910
11911 : see if this is a sys/mount.h system
11912 set sys/mount.h i_sysmount
11913 eval $inhdr
11914
11915
11916 echo " "
11917 echo "Checking to see if your system supports struct fs_data..." >&4
11918 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11919 eval $hasstruct
11920 case "$d_fs_data_s" in
11921 "$define")      echo "Yes, it does."   ;;
11922 *)              echo "No, it doesn't." ;;
11923 esac
11924
11925 : see if fseeko exists
11926 set fseeko d_fseeko
11927 eval $inlibc
11928 case "$longsize" in
11929 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11930 esac
11931
11932 : see if fsetpos exists
11933 set fsetpos d_fsetpos
11934 eval $inlibc
11935
11936
11937 : see if fstatfs exists
11938 set fstatfs d_fstatfs
11939 eval $inlibc
11940
11941
11942 : see if statvfs exists
11943 set statvfs d_statvfs
11944 eval $inlibc
11945
11946 : see if fstatvfs exists
11947 set fstatvfs d_fstatvfs
11948 eval $inlibc
11949
11950
11951 : see if fsync exists
11952 set fsync d_fsync
11953 eval $inlibc
11954
11955 : see if ftello exists
11956 set ftello d_ftello
11957 eval $inlibc
11958 case "$longsize" in
11959 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11960 esac
11961
11962 : see if getcwd exists
11963 set getcwd d_getcwd
11964 eval $inlibc
11965
11966 : see if getespwnam exists
11967 set getespwnam d_getespwnam
11968 eval $inlibc
11969
11970
11971 : see if getfsstat exists
11972 set getfsstat d_getfsstat
11973 eval $inlibc
11974
11975 : see if getgrent exists
11976 set getgrent d_getgrent
11977 eval $inlibc
11978
11979 : see if getgrent_r exists
11980 set getgrent_r d_getgrent_r
11981 eval $inlibc
11982 case "$d_getgrent_r" in
11983 "$define")
11984         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11985         case "$d_getgrent_r_proto:$usethreads" in
11986         ":define")      d_getgrent_r_proto=define
11987                 set d_getgrent_r_proto getgrent_r $hdrs
11988                 eval $hasproto ;;
11989         *)      ;;
11990         esac
11991         case "$d_getgrent_r_proto" in
11992         define)
11993         case "$getgrent_r_proto" in
11994         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
11995         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
11996         esac
11997         case "$getgrent_r_proto" in
11998         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
11999         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12000         esac
12001         case "$getgrent_r_proto" in
12002         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12003         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12004         esac
12005         case "$getgrent_r_proto" in
12006         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12007         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12008         esac
12009         case "$getgrent_r_proto" in
12010         ''|0) try='int getgrent_r(struct group*, char*, int);'
12011         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12012         esac
12013         case "$getgrent_r_proto" in
12014         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12015         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12016         esac
12017         case "$getgrent_r_proto" in
12018         ''|0)   d_getgrent_r=undef
12019                 getgrent_r_proto=0
12020                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12021         * )     case "$getgrent_r_proto" in
12022                 REENTRANT_PROTO*) ;;
12023                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12024                 esac
12025                 echo "Prototype: $try" ;;
12026         esac
12027         ;;
12028         *)      case "$usethreads" in
12029                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12030                 esac
12031                 d_getgrent_r=undef
12032                 getgrent_r_proto=0
12033                 ;;
12034         esac
12035         ;;
12036 *)      getgrent_r_proto=0
12037         ;;
12038 esac
12039
12040 : see if getgrgid_r exists
12041 set getgrgid_r d_getgrgid_r
12042 eval $inlibc
12043 case "$d_getgrgid_r" in
12044 "$define")
12045         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12046         case "$d_getgrgid_r_proto:$usethreads" in
12047         ":define")      d_getgrgid_r_proto=define
12048                 set d_getgrgid_r_proto getgrgid_r $hdrs
12049                 eval $hasproto ;;
12050         *)      ;;
12051         esac
12052         case "$d_getgrgid_r_proto" in
12053         define)
12054         case "$getgrgid_r_proto" in
12055         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12056         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12057         esac
12058         case "$getgrgid_r_proto" in
12059         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12060         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12061         esac
12062         case "$getgrgid_r_proto" in
12063         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12064         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12065         esac
12066         case "$getgrgid_r_proto" in
12067         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12068         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12069         esac
12070         case "$getgrgid_r_proto" in
12071         ''|0)   d_getgrgid_r=undef
12072                 getgrgid_r_proto=0
12073                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12074         * )     case "$getgrgid_r_proto" in
12075                 REENTRANT_PROTO*) ;;
12076                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12077                 esac
12078                 echo "Prototype: $try" ;;
12079         esac
12080         ;;
12081         *)      case "$usethreads" in
12082                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12083                 esac
12084                 d_getgrgid_r=undef
12085                 getgrgid_r_proto=0
12086                 ;;
12087         esac
12088         ;;
12089 *)      getgrgid_r_proto=0
12090         ;;
12091 esac
12092
12093 : see if getgrnam_r exists
12094 set getgrnam_r d_getgrnam_r
12095 eval $inlibc
12096 case "$d_getgrnam_r" in
12097 "$define")
12098         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12099         case "$d_getgrnam_r_proto:$usethreads" in
12100         ":define")      d_getgrnam_r_proto=define
12101                 set d_getgrnam_r_proto getgrnam_r $hdrs
12102                 eval $hasproto ;;
12103         *)      ;;
12104         esac
12105         case "$d_getgrnam_r_proto" in
12106         define)
12107         case "$getgrnam_r_proto" in
12108         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12109         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12110         esac
12111         case "$getgrnam_r_proto" in
12112         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12113         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12114         esac
12115         case "$getgrnam_r_proto" in
12116         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12117         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12118         esac
12119         case "$getgrnam_r_proto" in
12120         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12121         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12122         esac
12123         case "$getgrnam_r_proto" in
12124         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12125         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12126         esac
12127         case "$getgrnam_r_proto" in
12128         ''|0)   d_getgrnam_r=undef
12129                 getgrnam_r_proto=0
12130                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12131         * )     case "$getgrnam_r_proto" in
12132                 REENTRANT_PROTO*) ;;
12133                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12134                 esac
12135                 echo "Prototype: $try" ;;
12136         esac
12137         ;;
12138         *)      case "$usethreads" in
12139                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12140                 esac
12141                 d_getgrnam_r=undef
12142                 getgrnam_r_proto=0
12143                 ;;
12144         esac
12145         ;;
12146 *)      getgrnam_r_proto=0
12147         ;;
12148 esac
12149
12150 : see if gethostbyaddr exists
12151 set gethostbyaddr d_gethbyaddr
12152 eval $inlibc
12153
12154 : see if gethostbyname exists
12155 set gethostbyname d_gethbyname
12156 eval $inlibc
12157
12158 : see if gethostent exists
12159 set gethostent d_gethent
12160 eval $inlibc
12161
12162 : see how we will look up host name
12163 echo " "
12164 call=''
12165 if set gethostname val -f d_gethname; eval $csym; $val; then
12166         echo 'gethostname() found.' >&4
12167         d_gethname="$define"
12168         call=gethostname
12169 fi
12170 if set uname val -f d_uname; eval $csym; $val; then
12171         if ./xenix; then
12172                 $cat <<'EOM'
12173 uname() was found, but you're running xenix, and older versions of xenix
12174 have a broken uname(). If you don't really know whether your xenix is old
12175 enough to have a broken system call, use the default answer.
12176
12177 EOM
12178                 dflt=y
12179                 case "$d_uname" in
12180                 "$define") dflt=n;;
12181                 esac
12182                 rp='Is your uname() broken?'
12183                 . ./myread
12184                 case "$ans" in
12185                 n*) d_uname="$define"; call=uname;;
12186                 esac
12187         else
12188                 echo 'uname() found.' >&4
12189                 d_uname="$define"
12190                 case "$call" in
12191                 '') call=uname ;;
12192                 esac
12193         fi
12194 fi
12195 case "$d_gethname" in
12196 '') d_gethname="$undef";;
12197 esac
12198 case "$d_uname" in
12199 '') d_uname="$undef";;
12200 esac
12201 case "$d_uname$d_gethname" in
12202 *define*)
12203         dflt=n
12204         cat <<EOM
12205  
12206 Every now and then someone has a $call() that lies about the hostname
12207 but can't be fixed for political or economic reasons.  If you wish, I can
12208 pretend $call() isn't there and maybe compute hostname at run-time
12209 thanks to the '$phostname' command.
12210
12211 EOM
12212         rp="Shall I ignore $call() from now on?"
12213         . ./myread
12214         case "$ans" in
12215         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12216         esac;;
12217 esac
12218 case "$phostname" in
12219 '') aphostname='';;
12220 *) case "$aphostname" in
12221         /*) ;;
12222         *) set X $phostname
12223                 shift
12224                 file=$1
12225                 shift
12226                 file=`./loc $file $file $pth`
12227                 aphostname=`echo $file $*`
12228                 ;;
12229         esac
12230         ;;
12231 esac
12232 case "$d_uname$d_gethname" in
12233 *define*) ;;
12234 *)
12235         case "$phostname" in
12236         '')
12237                 echo "There will be no way for $package to get your hostname." >&4;;
12238         *)
12239         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12240                 ;;
12241         esac;;
12242 esac
12243 case "$d_phostname" in
12244 '') d_phostname="$undef";;
12245 esac
12246
12247 : see if gethostbyaddr_r exists
12248 set gethostbyaddr_r d_gethostbyaddr_r
12249 eval $inlibc
12250 case "$d_gethostbyaddr_r" in
12251 "$define")
12252         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12253         case "$d_gethostbyaddr_r_proto:$usethreads" in
12254         ":define")      d_gethostbyaddr_r_proto=define
12255                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12256                 eval $hasproto ;;
12257         *)      ;;
12258         esac
12259         case "$d_gethostbyaddr_r_proto" in
12260         define)
12261         case "$gethostbyaddr_r_proto" in
12262         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12263         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12264         esac
12265         case "$gethostbyaddr_r_proto" in
12266         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12267         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12268         esac
12269         case "$gethostbyaddr_r_proto" in
12270         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12271         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12272         esac
12273         case "$gethostbyaddr_r_proto" in
12274         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12275         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12276         esac
12277         case "$gethostbyaddr_r_proto" in
12278         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12279         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12280         esac
12281         case "$gethostbyaddr_r_proto" in
12282         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12283         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12284         esac
12285         case "$gethostbyaddr_r_proto" in
12286         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12287         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12288         esac
12289         case "$gethostbyaddr_r_proto" in
12290         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12291         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12292         esac
12293         case "$gethostbyaddr_r_proto" in
12294         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12295         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12296         esac
12297         case "$gethostbyaddr_r_proto" in
12298         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12299         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12300         esac
12301         case "$gethostbyaddr_r_proto" in
12302         ''|0)   d_gethostbyaddr_r=undef
12303                 gethostbyaddr_r_proto=0
12304                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12305         * )     case "$gethostbyaddr_r_proto" in
12306                 REENTRANT_PROTO*) ;;
12307                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12308                 esac
12309                 echo "Prototype: $try" ;;
12310         esac
12311         ;;
12312         *)      case "$usethreads" in
12313                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12314                 esac
12315                 d_gethostbyaddr_r=undef
12316                 gethostbyaddr_r_proto=0
12317                 ;;
12318         esac
12319         ;;
12320 *)      gethostbyaddr_r_proto=0
12321         ;;
12322 esac
12323
12324 : see if gethostbyname_r exists
12325 set gethostbyname_r d_gethostbyname_r
12326 eval $inlibc
12327 case "$d_gethostbyname_r" in
12328 "$define")
12329         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12330         case "$d_gethostbyname_r_proto:$usethreads" in
12331         ":define")      d_gethostbyname_r_proto=define
12332                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12333                 eval $hasproto ;;
12334         *)      ;;
12335         esac
12336         case "$d_gethostbyname_r_proto" in
12337         define)
12338         case "$gethostbyname_r_proto" in
12339         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12340         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12341         esac
12342         case "$gethostbyname_r_proto" in
12343         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12344         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12345         esac
12346         case "$gethostbyname_r_proto" in
12347         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12348         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12349         esac
12350         case "$gethostbyname_r_proto" in
12351         ''|0)   d_gethostbyname_r=undef
12352                 gethostbyname_r_proto=0
12353                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12354         * )     case "$gethostbyname_r_proto" in
12355                 REENTRANT_PROTO*) ;;
12356                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12357                 esac
12358                 echo "Prototype: $try" ;;
12359         esac
12360         ;;
12361         *)      case "$usethreads" in
12362                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12363                 esac
12364                 d_gethostbyname_r=undef
12365                 gethostbyname_r_proto=0
12366                 ;;
12367         esac
12368         ;;
12369 *)      gethostbyname_r_proto=0
12370         ;;
12371 esac
12372
12373 : see if gethostent_r exists
12374 set gethostent_r d_gethostent_r
12375 eval $inlibc
12376 case "$d_gethostent_r" in
12377 "$define")
12378         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12379         case "$d_gethostent_r_proto:$usethreads" in
12380         ":define")      d_gethostent_r_proto=define
12381                 set d_gethostent_r_proto gethostent_r $hdrs
12382                 eval $hasproto ;;
12383         *)      ;;
12384         esac
12385         case "$d_gethostent_r_proto" in
12386         define)
12387         case "$gethostent_r_proto" in
12388         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12389         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12390         esac
12391         case "$gethostent_r_proto" in
12392         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12393         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12394         esac
12395         case "$gethostent_r_proto" in
12396         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12397         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12398         esac
12399         case "$gethostent_r_proto" in
12400         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12401         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12402         esac
12403         case "$gethostent_r_proto" in
12404         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12405         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12406         esac
12407         case "$gethostent_r_proto" in
12408         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12409         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12410         esac
12411         case "$gethostent_r_proto" in
12412         ''|0)   d_gethostent_r=undef
12413                 gethostent_r_proto=0
12414                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12415         * )     case "$gethostent_r_proto" in
12416                 REENTRANT_PROTO*) ;;
12417                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12418                 esac
12419                 echo "Prototype: $try" ;;
12420         esac
12421         ;;
12422         *)      case "$usethreads" in
12423                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12424                 esac
12425                 d_gethostent_r=undef
12426                 gethostent_r_proto=0
12427                 ;;
12428         esac
12429         ;;
12430 *)      gethostent_r_proto=0
12431         ;;
12432 esac
12433
12434 : see if prototypes for various gethostxxx netdb.h functions are available
12435 echo " "
12436 set d_gethostprotos gethostent $i_netdb netdb.h
12437 eval $hasproto
12438
12439 : see if getitimer exists
12440 set getitimer d_getitimer
12441 eval $inlibc
12442
12443 : see if getlogin exists
12444 set getlogin d_getlogin
12445 eval $inlibc
12446
12447 : see if getlogin_r exists
12448 set getlogin_r d_getlogin_r
12449 eval $inlibc
12450 case "$d_getlogin_r" in
12451 "$define")
12452         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12453         case "$d_getlogin_r_proto:$usethreads" in
12454         ":define")      d_getlogin_r_proto=define
12455                 set d_getlogin_r_proto getlogin_r $hdrs
12456                 eval $hasproto ;;
12457         *)      ;;
12458         esac
12459         case "$d_getlogin_r_proto" in
12460         define)
12461         case "$getlogin_r_proto" in
12462         ''|0) try='int getlogin_r(char*, size_t);'
12463         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12464         esac
12465         case "$getlogin_r_proto" in
12466         ''|0) try='int getlogin_r(char*, int);'
12467         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12468         esac
12469         case "$getlogin_r_proto" in
12470         ''|0) try='char* getlogin_r(char*, size_t);'
12471         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12472         esac
12473         case "$getlogin_r_proto" in
12474         ''|0) try='char* getlogin_r(char*, int);'
12475         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12476         esac
12477         case "$getlogin_r_proto" in
12478         ''|0)   d_getlogin_r=undef
12479                 getlogin_r_proto=0
12480                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12481         * )     case "$getlogin_r_proto" in
12482                 REENTRANT_PROTO*) ;;
12483                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12484                 esac
12485                 echo "Prototype: $try" ;;
12486         esac
12487         ;;
12488         *)      case "$usethreads" in
12489                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12490                 esac
12491                 d_getlogin_r=undef
12492                 getlogin_r_proto=0
12493                 ;;
12494         esac
12495         ;;
12496 *)      getlogin_r_proto=0
12497         ;;
12498 esac
12499
12500 : see if getmnt exists
12501 set getmnt d_getmnt
12502 eval $inlibc
12503
12504 : see if getmntent exists
12505 set getmntent d_getmntent
12506 eval $inlibc
12507
12508 : see if getnetbyaddr exists
12509 set getnetbyaddr d_getnbyaddr
12510 eval $inlibc
12511
12512 : see if getnetbyname exists
12513 set getnetbyname d_getnbyname
12514 eval $inlibc
12515
12516 : see if getnetent exists
12517 set getnetent d_getnent
12518 eval $inlibc
12519
12520 : see if getnetbyaddr_r exists
12521 set getnetbyaddr_r d_getnetbyaddr_r
12522 eval $inlibc
12523 case "$d_getnetbyaddr_r" in
12524 "$define")
12525         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12526         case "$d_getnetbyaddr_r_proto:$usethreads" in
12527         ":define")      d_getnetbyaddr_r_proto=define
12528                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12529                 eval $hasproto ;;
12530         *)      ;;
12531         esac
12532         case "$d_getnetbyaddr_r_proto" in
12533         define)
12534         case "$getnetbyaddr_r_proto" in
12535         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12536         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12537         esac
12538         case "$getnetbyaddr_r_proto" in
12539         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12540         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12541         esac
12542         case "$getnetbyaddr_r_proto" in
12543         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12544         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12545         esac
12546         case "$getnetbyaddr_r_proto" in
12547         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12548         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12549         esac
12550         case "$getnetbyaddr_r_proto" in
12551         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12552         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12553         esac
12554         case "$getnetbyaddr_r_proto" in
12555         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12556         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12557         esac
12558         case "$getnetbyaddr_r_proto" in
12559         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12560         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12561         esac
12562         case "$getnetbyaddr_r_proto" in
12563         ''|0)   d_getnetbyaddr_r=undef
12564                 getnetbyaddr_r_proto=0
12565                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12566         * )     case "$getnetbyaddr_r_proto" in
12567                 REENTRANT_PROTO*) ;;
12568                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12569                 esac
12570                 echo "Prototype: $try" ;;
12571         esac
12572         ;;
12573         *)      case "$usethreads" in
12574                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12575                 esac
12576                 d_getnetbyaddr_r=undef
12577                 getnetbyaddr_r_proto=0
12578                 ;;
12579         esac
12580         ;;
12581 *)      getnetbyaddr_r_proto=0
12582         ;;
12583 esac
12584
12585 : see if getnetbyname_r exists
12586 set getnetbyname_r d_getnetbyname_r
12587 eval $inlibc
12588 case "$d_getnetbyname_r" in
12589 "$define")
12590         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12591         case "$d_getnetbyname_r_proto:$usethreads" in
12592         ":define")      d_getnetbyname_r_proto=define
12593                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12594                 eval $hasproto ;;
12595         *)      ;;
12596         esac
12597         case "$d_getnetbyname_r_proto" in
12598         define)
12599         case "$getnetbyname_r_proto" in
12600         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12601         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12602         esac
12603         case "$getnetbyname_r_proto" in
12604         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12605         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12606         esac
12607         case "$getnetbyname_r_proto" in
12608         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12609         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12610         esac
12611         case "$getnetbyname_r_proto" in
12612         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12613         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12614         esac
12615         case "$getnetbyname_r_proto" in
12616         ''|0)   d_getnetbyname_r=undef
12617                 getnetbyname_r_proto=0
12618                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12619         * )     case "$getnetbyname_r_proto" in
12620                 REENTRANT_PROTO*) ;;
12621                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12622                 esac
12623                 echo "Prototype: $try" ;;
12624         esac
12625         ;;
12626         *)      case "$usethreads" in
12627                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12628                 esac
12629                 d_getnetbyname_r=undef
12630                 getnetbyname_r_proto=0
12631                 ;;
12632         esac
12633         ;;
12634 *)      getnetbyname_r_proto=0
12635         ;;
12636 esac
12637
12638 : see if getnetent_r exists
12639 set getnetent_r d_getnetent_r
12640 eval $inlibc
12641 case "$d_getnetent_r" in
12642 "$define")
12643         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12644         case "$d_getnetent_r_proto:$usethreads" in
12645         ":define")      d_getnetent_r_proto=define
12646                 set d_getnetent_r_proto getnetent_r $hdrs
12647                 eval $hasproto ;;
12648         *)      ;;
12649         esac
12650         case "$d_getnetent_r_proto" in
12651         define)
12652         case "$getnetent_r_proto" in
12653         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12654         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12655         esac
12656         case "$getnetent_r_proto" in
12657         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12658         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12659         esac
12660         case "$getnetent_r_proto" in
12661         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12662         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12663         esac
12664         case "$getnetent_r_proto" in
12665         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12666         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12667         esac
12668         case "$getnetent_r_proto" in
12669         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12670         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12671         esac
12672         case "$getnetent_r_proto" in
12673         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12674         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12675         esac
12676         case "$getnetent_r_proto" in
12677         ''|0)   d_getnetent_r=undef
12678                 getnetent_r_proto=0
12679                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12680         * )     case "$getnetent_r_proto" in
12681                 REENTRANT_PROTO*) ;;
12682                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12683                 esac
12684                 echo "Prototype: $try" ;;
12685         esac
12686         ;;
12687         *)      case "$usethreads" in
12688                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12689                 esac
12690                 d_getnetent_r=undef
12691                 getnetent_r_proto=0
12692                 ;;
12693         esac
12694         ;;
12695 *)      getnetent_r_proto=0
12696         ;;
12697 esac
12698
12699 : see if prototypes for various getnetxxx netdb.h functions are available
12700 echo " "
12701 set d_getnetprotos getnetent $i_netdb netdb.h
12702 eval $hasproto
12703
12704 : see if getpagesize exists
12705 set getpagesize d_getpagsz
12706 eval $inlibc
12707
12708
12709 : see if getprotobyname exists
12710 set getprotobyname d_getpbyname
12711 eval $inlibc
12712
12713 : see if getprotobynumber exists
12714 set getprotobynumber d_getpbynumber
12715 eval $inlibc
12716
12717 : see if getprotoent exists
12718 set getprotoent d_getpent
12719 eval $inlibc
12720
12721 : see if getpgid exists
12722 set getpgid d_getpgid
12723 eval $inlibc
12724
12725 : see if getpgrp2 exists
12726 set getpgrp2 d_getpgrp2
12727 eval $inlibc
12728
12729 : see if getppid exists
12730 set getppid d_getppid
12731 eval $inlibc
12732
12733 : see if getpriority exists
12734 set getpriority d_getprior
12735 eval $inlibc
12736
12737 : see if getprotobyname_r exists
12738 set getprotobyname_r d_getprotobyname_r
12739 eval $inlibc
12740 case "$d_getprotobyname_r" in
12741 "$define")
12742         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12743         case "$d_getprotobyname_r_proto:$usethreads" in
12744         ":define")      d_getprotobyname_r_proto=define
12745                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12746                 eval $hasproto ;;
12747         *)      ;;
12748         esac
12749         case "$d_getprotobyname_r_proto" in
12750         define)
12751         case "$getprotobyname_r_proto" in
12752         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12753         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12754         esac
12755         case "$getprotobyname_r_proto" in
12756         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12757         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12758         esac
12759         case "$getprotobyname_r_proto" in
12760         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12761         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12762         esac
12763         case "$getprotobyname_r_proto" in
12764         ''|0)   d_getprotobyname_r=undef
12765                 getprotobyname_r_proto=0
12766                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12767         * )     case "$getprotobyname_r_proto" in
12768                 REENTRANT_PROTO*) ;;
12769                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12770                 esac
12771                 echo "Prototype: $try" ;;
12772         esac
12773         ;;
12774         *)      case "$usethreads" in
12775                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12776                 esac
12777                 d_getprotobyname_r=undef
12778                 getprotobyname_r_proto=0
12779                 ;;
12780         esac
12781         ;;
12782 *)      getprotobyname_r_proto=0
12783         ;;
12784 esac
12785
12786 : see if getprotobynumber_r exists
12787 set getprotobynumber_r d_getprotobynumber_r
12788 eval $inlibc
12789 case "$d_getprotobynumber_r" in
12790 "$define")
12791         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12792         case "$d_getprotobynumber_r_proto:$usethreads" in
12793         ":define")      d_getprotobynumber_r_proto=define
12794                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12795                 eval $hasproto ;;
12796         *)      ;;
12797         esac
12798         case "$d_getprotobynumber_r_proto" in
12799         define)
12800         case "$getprotobynumber_r_proto" in
12801         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12802         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12803         esac
12804         case "$getprotobynumber_r_proto" in
12805         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12806         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12807         esac
12808         case "$getprotobynumber_r_proto" in
12809         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12810         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12811         esac
12812         case "$getprotobynumber_r_proto" in
12813         ''|0)   d_getprotobynumber_r=undef
12814                 getprotobynumber_r_proto=0
12815                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12816         * )     case "$getprotobynumber_r_proto" in
12817                 REENTRANT_PROTO*) ;;
12818                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12819                 esac
12820                 echo "Prototype: $try" ;;
12821         esac
12822         ;;
12823         *)      case "$usethreads" in
12824                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12825                 esac
12826                 d_getprotobynumber_r=undef
12827                 getprotobynumber_r_proto=0
12828                 ;;
12829         esac
12830         ;;
12831 *)      getprotobynumber_r_proto=0
12832         ;;
12833 esac
12834
12835 : see if getprotoent_r exists
12836 set getprotoent_r d_getprotoent_r
12837 eval $inlibc
12838 case "$d_getprotoent_r" in
12839 "$define")
12840         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12841         case "$d_getprotoent_r_proto:$usethreads" in
12842         ":define")      d_getprotoent_r_proto=define
12843                 set d_getprotoent_r_proto getprotoent_r $hdrs
12844                 eval $hasproto ;;
12845         *)      ;;
12846         esac
12847         case "$d_getprotoent_r_proto" in
12848         define)
12849         case "$getprotoent_r_proto" in
12850         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12851         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12852         esac
12853         case "$getprotoent_r_proto" in
12854         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12855         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12856         esac
12857         case "$getprotoent_r_proto" in
12858         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12859         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12860         esac
12861         case "$getprotoent_r_proto" in
12862         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12863         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12864         esac
12865         case "$getprotoent_r_proto" in
12866         ''|0)   d_getprotoent_r=undef
12867                 getprotoent_r_proto=0
12868                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12869         * )     case "$getprotoent_r_proto" in
12870                 REENTRANT_PROTO*) ;;
12871                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12872                 esac
12873                 echo "Prototype: $try" ;;
12874         esac
12875         ;;
12876         *)      case "$usethreads" in
12877                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12878                 esac
12879                 d_getprotoent_r=undef
12880                 getprotoent_r_proto=0
12881                 ;;
12882         esac
12883         ;;
12884 *)      getprotoent_r_proto=0
12885         ;;
12886 esac
12887
12888 : see if prototypes for various getprotoxxx netdb.h functions are available
12889 echo " "
12890 set d_getprotoprotos getprotoent $i_netdb netdb.h
12891 eval $hasproto
12892
12893 : see if getprpwnam exists
12894 set getprpwnam d_getprpwnam
12895 eval $inlibc
12896
12897 : see if getpwent exists
12898 set getpwent d_getpwent
12899 eval $inlibc
12900
12901 : see if getpwent_r exists
12902 set getpwent_r d_getpwent_r
12903 eval $inlibc
12904 case "$d_getpwent_r" in
12905 "$define")
12906         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12907         case "$d_getpwent_r_proto:$usethreads" in
12908         ":define")      d_getpwent_r_proto=define
12909                 set d_getpwent_r_proto getpwent_r $hdrs
12910                 eval $hasproto ;;
12911         *)      ;;
12912         esac
12913         case "$d_getpwent_r_proto" in
12914         define)
12915         case "$getpwent_r_proto" in
12916         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12917         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12918         esac
12919         case "$getpwent_r_proto" in
12920         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12921         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12922         esac
12923         case "$getpwent_r_proto" in
12924         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12925         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12926         esac
12927         case "$getpwent_r_proto" in
12928         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12929         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12930         esac
12931         case "$getpwent_r_proto" in
12932         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12933         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12934         esac
12935         case "$getpwent_r_proto" in
12936         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12937         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12938         esac
12939         case "$getpwent_r_proto" in
12940         ''|0)   d_getpwent_r=undef
12941                 getpwent_r_proto=0
12942                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12943         * )     case "$getpwent_r_proto" in
12944                 REENTRANT_PROTO*) ;;
12945                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12946                 esac
12947                 echo "Prototype: $try" ;;
12948         esac
12949         ;;
12950         *)      case "$usethreads" in
12951                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12952                 esac
12953                 d_getpwent_r=undef
12954                 getpwent_r_proto=0
12955                 ;;
12956         esac
12957         ;;
12958 *)      getpwent_r_proto=0
12959         ;;
12960 esac
12961
12962 : see if getpwnam_r exists
12963 set getpwnam_r d_getpwnam_r
12964 eval $inlibc
12965 case "$d_getpwnam_r" in
12966 "$define")
12967         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12968         case "$d_getpwnam_r_proto:$usethreads" in
12969         ":define")      d_getpwnam_r_proto=define
12970                 set d_getpwnam_r_proto getpwnam_r $hdrs
12971                 eval $hasproto ;;
12972         *)      ;;
12973         esac
12974         case "$d_getpwnam_r_proto" in
12975         define)
12976         case "$getpwnam_r_proto" in
12977         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
12978         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
12979         esac
12980         case "$getpwnam_r_proto" in
12981         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
12982         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
12983         esac
12984         case "$getpwnam_r_proto" in
12985         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
12986         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
12987         esac
12988         case "$getpwnam_r_proto" in
12989         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
12990         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
12991         esac
12992         case "$getpwnam_r_proto" in
12993         ''|0)   d_getpwnam_r=undef
12994                 getpwnam_r_proto=0
12995                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
12996         * )     case "$getpwnam_r_proto" in
12997                 REENTRANT_PROTO*) ;;
12998                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
12999                 esac
13000                 echo "Prototype: $try" ;;
13001         esac
13002         ;;
13003         *)      case "$usethreads" in
13004                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13005                 esac
13006                 d_getpwnam_r=undef
13007                 getpwnam_r_proto=0
13008                 ;;
13009         esac
13010         ;;
13011 *)      getpwnam_r_proto=0
13012         ;;
13013 esac
13014
13015 : see if getpwuid_r exists
13016 set getpwuid_r d_getpwuid_r
13017 eval $inlibc
13018 case "$d_getpwuid_r" in
13019 "$define")
13020         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13021         case "$d_getpwuid_r_proto:$usethreads" in
13022         ":define")      d_getpwuid_r_proto=define
13023                 set d_getpwuid_r_proto getpwuid_r $hdrs
13024                 eval $hasproto ;;
13025         *)      ;;
13026         esac
13027         case "$d_getpwuid_r_proto" in
13028         define)
13029         case "$getpwuid_r_proto" in
13030         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13031         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13032         esac
13033         case "$getpwuid_r_proto" in
13034         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13035         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13036         esac
13037         case "$getpwuid_r_proto" in
13038         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13039         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13040         esac
13041         case "$getpwuid_r_proto" in
13042         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13043         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13044         esac
13045         case "$getpwuid_r_proto" in
13046         ''|0)   d_getpwuid_r=undef
13047                 getpwuid_r_proto=0
13048                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13049         * )     case "$getpwuid_r_proto" in
13050                 REENTRANT_PROTO*) ;;
13051                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13052                 esac
13053                 echo "Prototype: $try" ;;
13054         esac
13055         ;;
13056         *)      case "$usethreads" in
13057                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13058                 esac
13059                 d_getpwuid_r=undef
13060                 getpwuid_r_proto=0
13061                 ;;
13062         esac
13063         ;;
13064 *)      getpwuid_r_proto=0
13065         ;;
13066 esac
13067
13068
13069 : see if getservbyname exists
13070 set getservbyname d_getsbyname
13071 eval $inlibc
13072
13073 : see if getservbyport exists
13074 set getservbyport d_getsbyport
13075 eval $inlibc
13076
13077 : see if getservent exists
13078 set getservent d_getsent
13079 eval $inlibc
13080
13081 : see if getservbyname_r exists
13082 set getservbyname_r d_getservbyname_r
13083 eval $inlibc
13084 case "$d_getservbyname_r" in
13085 "$define")
13086         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13087         case "$d_getservbyname_r_proto:$usethreads" in
13088         ":define")      d_getservbyname_r_proto=define
13089                 set d_getservbyname_r_proto getservbyname_r $hdrs
13090                 eval $hasproto ;;
13091         *)      ;;
13092         esac
13093         case "$d_getservbyname_r_proto" in
13094         define)
13095         case "$getservbyname_r_proto" in
13096         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13097         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13098         esac
13099         case "$getservbyname_r_proto" in
13100         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13101         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13102         esac
13103         case "$getservbyname_r_proto" in
13104         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13105         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13106         esac
13107         case "$getservbyname_r_proto" in
13108         ''|0)   d_getservbyname_r=undef
13109                 getservbyname_r_proto=0
13110                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13111         * )     case "$getservbyname_r_proto" in
13112                 REENTRANT_PROTO*) ;;
13113                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13114                 esac
13115                 echo "Prototype: $try" ;;
13116         esac
13117         ;;
13118         *)      case "$usethreads" in
13119                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13120                 esac
13121                 d_getservbyname_r=undef
13122                 getservbyname_r_proto=0
13123                 ;;
13124         esac
13125         ;;
13126 *)      getservbyname_r_proto=0
13127         ;;
13128 esac
13129
13130 : see if getservbyport_r exists
13131 set getservbyport_r d_getservbyport_r
13132 eval $inlibc
13133 case "$d_getservbyport_r" in
13134 "$define")
13135         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13136         case "$d_getservbyport_r_proto:$usethreads" in
13137         ":define")      d_getservbyport_r_proto=define
13138                 set d_getservbyport_r_proto getservbyport_r $hdrs
13139                 eval $hasproto ;;
13140         *)      ;;
13141         esac
13142         case "$d_getservbyport_r_proto" in
13143         define)
13144         case "$getservbyport_r_proto" in
13145         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13146         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13147         esac
13148         case "$getservbyport_r_proto" in
13149         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13150         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13151         esac
13152         case "$getservbyport_r_proto" in
13153         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13154         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13155         esac
13156         case "$getservbyport_r_proto" in
13157         ''|0)   d_getservbyport_r=undef
13158                 getservbyport_r_proto=0
13159                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13160         * )     case "$getservbyport_r_proto" in
13161                 REENTRANT_PROTO*) ;;
13162                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13163                 esac
13164                 echo "Prototype: $try" ;;
13165         esac
13166         ;;
13167         *)      case "$usethreads" in
13168                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13169                 esac
13170                 d_getservbyport_r=undef
13171                 getservbyport_r_proto=0
13172                 ;;
13173         esac
13174         ;;
13175 *)      getservbyport_r_proto=0
13176         ;;
13177 esac
13178
13179 : see if getservent_r exists
13180 set getservent_r d_getservent_r
13181 eval $inlibc
13182 case "$d_getservent_r" in
13183 "$define")
13184         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13185         case "$d_getservent_r_proto:$usethreads" in
13186         ":define")      d_getservent_r_proto=define
13187                 set d_getservent_r_proto getservent_r $hdrs
13188                 eval $hasproto ;;
13189         *)      ;;
13190         esac
13191         case "$d_getservent_r_proto" in
13192         define)
13193         case "$getservent_r_proto" in
13194         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13195         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13196         esac
13197         case "$getservent_r_proto" in
13198         ''|0) try='int getservent_r(struct servent*, char*, int);'
13199         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13200         esac
13201         case "$getservent_r_proto" in
13202         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13203         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13204         esac
13205         case "$getservent_r_proto" in
13206         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13207         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13208         esac
13209         case "$getservent_r_proto" in
13210         ''|0)   d_getservent_r=undef
13211                 getservent_r_proto=0
13212                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13213         * )     case "$getservent_r_proto" in
13214                 REENTRANT_PROTO*) ;;
13215                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13216                 esac
13217                 echo "Prototype: $try" ;;
13218         esac
13219         ;;
13220         *)      case "$usethreads" in
13221                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13222                 esac
13223                 d_getservent_r=undef
13224                 getservent_r_proto=0
13225                 ;;
13226         esac
13227         ;;
13228 *)      getservent_r_proto=0
13229         ;;
13230 esac
13231
13232 : see if prototypes for various getservxxx netdb.h functions are available
13233 echo " "
13234 set d_getservprotos getservent $i_netdb netdb.h
13235 eval $hasproto
13236
13237 : see if getspnam exists
13238 set getspnam d_getspnam
13239 eval $inlibc
13240
13241 : see if this is a shadow.h system
13242 set shadow.h i_shadow
13243 eval $inhdr
13244
13245 : see if getspnam_r exists
13246 set getspnam_r d_getspnam_r
13247 eval $inlibc
13248 case "$d_getspnam_r" in
13249 "$define")
13250         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13251         case "$d_getspnam_r_proto:$usethreads" in
13252         ":define")      d_getspnam_r_proto=define
13253                 set d_getspnam_r_proto getspnam_r $hdrs
13254                 eval $hasproto ;;
13255         *)      ;;
13256         esac
13257         case "$d_getspnam_r_proto" in
13258         define)
13259         case "$getspnam_r_proto" in
13260         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13261         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13262         esac
13263         case "$getspnam_r_proto" in
13264         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13265         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13266         esac
13267         case "$getspnam_r_proto" in
13268         ''|0)   d_getspnam_r=undef
13269                 getspnam_r_proto=0
13270                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13271         * )     case "$getspnam_r_proto" in
13272                 REENTRANT_PROTO*) ;;
13273                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13274                 esac
13275                 echo "Prototype: $try" ;;
13276         esac
13277         ;;
13278         *)      case "$usethreads" in
13279                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13280                 esac
13281                 d_getspnam_r=undef
13282                 getspnam_r_proto=0
13283                 ;;
13284         esac
13285         ;;
13286 *)      getspnam_r_proto=0
13287         ;;
13288 esac
13289
13290 : see if gettimeofday or ftime exists
13291 set gettimeofday d_gettimeod
13292 eval $inlibc
13293 case "$d_gettimeod" in
13294 "$undef")
13295         set ftime d_ftime 
13296         eval $inlibc
13297         ;;
13298 *)
13299         val="$undef"; set d_ftime; eval $setvar
13300         ;;
13301 esac
13302 case "$d_gettimeod$d_ftime" in
13303 "$undef$undef")
13304         echo " "
13305         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13306         ;;
13307 esac
13308
13309 : see if gmtime_r exists
13310 set gmtime_r d_gmtime_r
13311 eval $inlibc
13312 case "$d_gmtime_r" in
13313 "$define")
13314         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13315         case "$d_gmtime_r_proto:$usethreads" in
13316         ":define")      d_gmtime_r_proto=define
13317                 set d_gmtime_r_proto gmtime_r $hdrs
13318                 eval $hasproto ;;
13319         *)      ;;
13320         esac
13321         case "$d_gmtime_r_proto" in
13322         define)
13323         case "$gmtime_r_proto" in
13324         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13325         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13326         esac
13327         case "$gmtime_r_proto" in
13328         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13329         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13330         esac
13331         case "$gmtime_r_proto" in
13332         ''|0)   d_gmtime_r=undef
13333                 gmtime_r_proto=0
13334                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13335         * )     case "$gmtime_r_proto" in
13336                 REENTRANT_PROTO*) ;;
13337                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13338                 esac
13339                 echo "Prototype: $try" ;;
13340         esac
13341         ;;
13342         *)      case "$usethreads" in
13343                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13344                 esac
13345                 d_gmtime_r=undef
13346                 gmtime_r_proto=0
13347                 ;;
13348         esac
13349         ;;
13350 *)      gmtime_r_proto=0
13351         ;;
13352 esac
13353
13354 : see if hasmntopt exists
13355 set hasmntopt d_hasmntopt
13356 eval $inlibc
13357
13358 : see if this is a netinet/in.h or sys/in.h system
13359 set netinet/in.h i_niin sys/in.h i_sysin
13360 eval $inhdr
13361
13362 : see if arpa/inet.h has to be included
13363 set arpa/inet.h i_arpainet
13364 eval $inhdr
13365
13366 : see if htonl --and friends-- exists
13367 val=''
13368 set htonl val
13369 eval $inlibc
13370
13371 : Maybe they are macros.
13372 case "$val" in
13373 $undef)
13374         $cat >htonl.c <<EOM
13375 #include <stdio.h>
13376 #include <sys/types.h>
13377 #$i_niin I_NETINET_IN
13378 #$i_sysin I_SYS_IN
13379 #$i_arpainet I_ARPA_INET
13380 #ifdef I_NETINET_IN
13381 #include <netinet/in.h>
13382 #endif
13383 #ifdef I_SYS_IN
13384 #include <sys/in.h>
13385 #endif
13386 #ifdef I_ARPA_INET
13387 #include <arpa/inet.h>
13388 #endif
13389 #ifdef htonl
13390 printf("Defined as a macro.");
13391 #endif
13392 EOM
13393         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13394         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13395                 val="$define"
13396                 echo "But it seems to be defined as a macro." >&4
13397         fi
13398         $rm -f htonl.?
13399         ;;
13400 esac
13401 set d_htonl
13402 eval $setvar
13403
13404 : index or strchr
13405 echo " "
13406 if set index val -f; eval $csym; $val; then
13407         if set strchr val -f d_strchr; eval $csym; $val; then
13408                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13409                         val="$define"
13410                         vali="$undef"
13411                         echo "strchr() found." >&4
13412                 else
13413                         val="$undef"
13414                         vali="$define"
13415                         echo "index() found." >&4
13416                 fi
13417         else
13418                 val="$undef"
13419                 vali="$define"
13420                 echo "index() found." >&4
13421         fi
13422 else
13423         if set strchr val -f d_strchr; eval $csym; $val; then
13424                 val="$define"
13425                 vali="$undef"
13426                 echo "strchr() found." >&4
13427         else
13428                 echo "No index() or strchr() found!" >&4
13429                 val="$undef"
13430                 vali="$undef"
13431         fi
13432 fi
13433 set d_strchr; eval $setvar
13434 val="$vali"
13435 set d_index; eval $setvar
13436
13437 : check whether inet_aton exists
13438 set inet_aton d_inetaton
13439 eval $inlibc
13440
13441 : Look for isascii
13442 echo " "
13443 $cat >isascii.c <<'EOCP'
13444 #include <stdio.h>
13445 #include <ctype.h>
13446 int main() {
13447         int c = 'A';
13448         if (isascii(c))
13449                 exit(0);
13450         else
13451                 exit(1);
13452 }
13453 EOCP
13454 set isascii
13455 if eval $compile; then
13456         echo "isascii() found." >&4
13457         val="$define"
13458 else
13459         echo "isascii() NOT found." >&4
13460         val="$undef"
13461 fi
13462 set d_isascii
13463 eval $setvar
13464 $rm -f isascii*
13465
13466 : see if isfinite exists
13467 set isfinite d_isfinite
13468 eval $inlibc
13469
13470 : see if isinf exists
13471 set isinf d_isinf
13472 eval $inlibc
13473
13474 : see if isnan exists
13475 set isnan d_isnan
13476 eval $inlibc
13477
13478 : see if isnanl exists
13479 set isnanl d_isnanl
13480 eval $inlibc
13481
13482 : see if killpg exists
13483 set killpg d_killpg
13484 eval $inlibc
13485
13486 : see if lchown exists
13487 echo " "
13488 $cat > try.c <<'EOCP'
13489 /* System header to define __stub macros and hopefully few prototypes,
13490     which can conflict with char lchown(); below.  */
13491 #include <assert.h>
13492 /* Override any gcc2 internal prototype to avoid an error.  */
13493 /* We use char because int might match the return type of a gcc2
13494    builtin and then its argument prototype would still apply.  */
13495 char lchown();
13496 int main() {
13497     /*  The GNU C library defines this for functions which it implements
13498         to always fail with ENOSYS.  Some functions are actually named
13499         something starting with __ and the normal name is an alias.  */
13500 #if defined (__stub_lchown) || defined (__stub___lchown)
13501 choke me
13502 #else
13503 lchown();
13504 #endif
13505 ; return 0; }
13506 EOCP
13507 set try
13508 if eval $compile; then
13509     $echo "lchown() found." >&4
13510     val="$define"
13511 else
13512     $echo "lchown() NOT found." >&4
13513     val="$undef"
13514 fi
13515 set d_lchown
13516 eval $setvar
13517
13518 : See if number of significant digits in a double precision number is known
13519 echo " "
13520 $cat >ldbl_dig.c <<EOM
13521 #$i_limits I_LIMITS
13522 #$i_float I_FLOAT
13523 #ifdef I_LIMITS
13524 #include <limits.h>
13525 #endif
13526 #ifdef I_FLOAT
13527 #include <float.h>
13528 #endif
13529 #ifdef LDBL_DIG
13530 printf("Contains LDBL_DIG");
13531 #endif
13532 EOM
13533 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13534 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13535         echo "LDBL_DIG found." >&4
13536         val="$define"
13537 else
13538         echo "LDBL_DIG NOT found." >&4
13539         val="$undef"
13540 fi
13541 $rm -f ldbl_dig.?
13542 set d_ldbl_dig
13543 eval $setvar
13544
13545 : see if link exists
13546 set link d_link
13547 eval $inlibc
13548
13549 : see if localtime_r exists
13550 set localtime_r d_localtime_r
13551 eval $inlibc
13552 case "$d_localtime_r" in
13553 "$define")
13554         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13555         case "$d_localtime_r_proto:$usethreads" in
13556         ":define")      d_localtime_r_proto=define
13557                 set d_localtime_r_proto localtime_r $hdrs
13558                 eval $hasproto ;;
13559         *)      ;;
13560         esac
13561         case "$d_localtime_r_proto" in
13562         define)
13563         case "$localtime_r_proto" in
13564         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13565         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13566         esac
13567         case "$localtime_r_proto" in
13568         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13569         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13570         esac
13571         case "$localtime_r_proto" in
13572         ''|0)   d_localtime_r=undef
13573                 localtime_r_proto=0
13574                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13575         * )     case "$localtime_r_proto" in
13576                 REENTRANT_PROTO*) ;;
13577                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13578                 esac
13579                 echo "Prototype: $try" ;;
13580         esac
13581         ;;
13582         *)      case "$usethreads" in
13583                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13584                 esac
13585                 d_localtime_r=undef
13586                 localtime_r_proto=0
13587                 ;;
13588         esac
13589         ;;
13590 *)      localtime_r_proto=0
13591         ;;
13592 esac
13593
13594 : see if localeconv exists
13595 set localeconv d_locconv
13596 eval $inlibc
13597
13598 : see if lockf exists
13599 set lockf d_lockf
13600 eval $inlibc
13601
13602 : see if prototype for lseek is available
13603 echo " "
13604 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13605 eval $hasproto
13606
13607 : see if lstat exists
13608 set lstat d_lstat
13609 eval $inlibc
13610
13611 : see if madvise exists
13612 set madvise d_madvise
13613 eval $inlibc
13614
13615 : see if mblen exists
13616 set mblen d_mblen
13617 eval $inlibc
13618
13619 : see if mbstowcs exists
13620 set mbstowcs d_mbstowcs
13621 eval $inlibc
13622
13623 : see if mbtowc exists
13624 set mbtowc d_mbtowc
13625 eval $inlibc
13626
13627 : see if memchr exists
13628 set memchr d_memchr
13629 eval $inlibc
13630
13631 : see if memcmp exists
13632 set memcmp d_memcmp
13633 eval $inlibc
13634
13635 : see if memcpy exists
13636 set memcpy d_memcpy
13637 eval $inlibc
13638
13639 : see if memmove exists
13640 set memmove d_memmove
13641 eval $inlibc
13642
13643 : see if memset exists
13644 set memset d_memset
13645 eval $inlibc
13646
13647 : see if mkdir exists
13648 set mkdir d_mkdir
13649 eval $inlibc
13650
13651 : see if mkdtemp exists
13652 set mkdtemp d_mkdtemp
13653 eval $inlibc
13654
13655 : see if mkfifo exists
13656 set mkfifo d_mkfifo
13657 eval $inlibc
13658
13659 : see if mkstemp exists
13660 set mkstemp d_mkstemp
13661 eval $inlibc
13662
13663 : see if mkstemps exists
13664 set mkstemps d_mkstemps
13665 eval $inlibc
13666
13667 : see if mktime exists
13668 set mktime d_mktime
13669 eval $inlibc
13670
13671 : see if this is a sys/mman.h system
13672 set sys/mman.h i_sysmman
13673 eval $inhdr
13674
13675 : see if mmap exists
13676 set mmap d_mmap
13677 eval $inlibc
13678 : see what shmat returns
13679 : default to something harmless
13680 mmaptype='void *'
13681 case "$i_sysmman$d_mmap" in
13682 "$define$define")
13683         $cat >mmap.c <<'END'
13684 #include <sys/mman.h>
13685 void *mmap();
13686 END
13687         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13688                 mmaptype='void *'
13689         else
13690                 mmaptype='caddr_t'
13691         fi
13692         echo "and it returns ($mmaptype)." >&4
13693         ;;
13694 esac
13695
13696
13697
13698 : see if mprotect exists
13699 set mprotect d_mprotect
13700 eval $inlibc
13701
13702 : see if msgctl exists
13703 set msgctl d_msgctl
13704 eval $inlibc
13705
13706 : see if msgget exists
13707 set msgget d_msgget
13708 eval $inlibc
13709
13710 : see if msgsnd exists
13711 set msgsnd d_msgsnd
13712 eval $inlibc
13713
13714 : see if msgrcv exists
13715 set msgrcv d_msgrcv
13716 eval $inlibc
13717
13718 : see how much of the 'msg*(2)' library is present.
13719 h_msg=true
13720 echo " "
13721 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13722 *"$undef"*) h_msg=false;;
13723 esac
13724 case "$osname" in
13725 freebsd)
13726     case "`ipcs 2>&1`" in
13727     "SVID messages"*"not configured"*)
13728         echo "Your $osname does not have the msg*(2) configured." >&4
13729         h_msg=false
13730         val="$undef"
13731         set msgctl d_msgctl
13732         eval $setvar
13733         set msgget d_msgget
13734         eval $setvar
13735         set msgsnd d_msgsnd
13736         eval $setvar
13737         set msgrcv d_msgrcv
13738         eval $setvar
13739         ;;
13740     esac
13741     ;;
13742 esac
13743 : we could also check for sys/ipc.h ...
13744 if $h_msg && $test `./findhdr sys/msg.h`; then
13745         echo "You have the full msg*(2) library." >&4
13746         val="$define"
13747 else
13748         echo "You don't have the full msg*(2) library." >&4
13749         val="$undef"
13750 fi
13751 set d_msg
13752 eval $setvar
13753
13754
13755 echo " "
13756 echo "Checking to see if your system supports struct msghdr..." >&4
13757 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13758 eval $hasstruct
13759 case "$d_msghdr_s" in
13760 "$define")      echo "Yes, it does."   ;;
13761 *)              echo "No, it doesn't." ;;
13762 esac
13763
13764
13765 : see if msync exists
13766 set msync d_msync
13767 eval $inlibc
13768
13769 : see if munmap exists
13770 set munmap d_munmap
13771 eval $inlibc
13772
13773 : see if nanosleep exists
13774 set nanosleep d_nanosleep
13775 eval $inlibc
13776
13777 : see if nice exists
13778 set nice d_nice
13779 eval $inlibc
13780
13781 : see if this is a langinfo.h system
13782 set langinfo.h i_langinfo
13783 eval $inhdr
13784
13785 : see if nl_langinfo exists
13786 set nl_langinfo d_nl_langinfo
13787 eval $inlibc
13788
13789 : check for length of character
13790 echo " "
13791 case "$charsize" in
13792 '')
13793         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13794         $cat >try.c <<'EOCP'
13795 #include <stdio.h>
13796 int main()
13797 {
13798     printf("%d\n", (int)sizeof(char));
13799     exit(0);
13800 }
13801 EOCP
13802         set try
13803         if eval $compile_ok; then
13804                 dflt=`$run ./try`
13805         else
13806                 dflt='1'
13807                 echo "(I can't seem to compile the test program.  Guessing...)"
13808         fi
13809         ;;
13810 *)
13811         dflt="$charsize"
13812         ;;
13813 esac
13814 rp="What is the size of a character (in bytes)?"
13815 . ./myread
13816 charsize="$ans"
13817 $rm -f try.c try
13818
13819 : check for volatile keyword
13820 echo " "
13821 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13822 $cat >try.c <<'EOCP'
13823 int main()
13824 {
13825         typedef struct _goo_struct goo_struct;
13826         goo_struct * volatile goo = ((goo_struct *)0);
13827         struct _goo_struct {
13828                 long long_int;
13829                 int reg_int;
13830                 char char_var;
13831         };
13832         typedef unsigned short foo_t;
13833         char *volatile foo;
13834         volatile int bar;
13835         volatile foo_t blech;
13836         foo = foo;
13837 }
13838 EOCP
13839 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13840         val="$define"
13841         echo "Yup, it does."
13842 else
13843         val="$undef"
13844         echo "Nope, it doesn't."
13845 fi
13846 set d_volatile
13847 eval $setvar
13848 $rm -f try.*
13849
13850
13851 echo " "
13852 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13853
13854 case "$use64bitint:$d_quad:$quadtype" in
13855 define:define:?*)
13856         ivtype="$quadtype"
13857         uvtype="$uquadtype"
13858         ivsize=8
13859         uvsize=8
13860         ;;
13861 *)      ivtype="long"
13862         uvtype="unsigned long"
13863         ivsize=$longsize
13864         uvsize=$longsize
13865         ;;
13866 esac
13867
13868 case "$uselongdouble:$d_longdbl" in
13869 define:define)
13870         nvtype="long double"
13871         nvsize=$longdblsize
13872         ;;
13873 *)      nvtype=double
13874         nvsize=$doublesize
13875         ;;
13876 esac
13877
13878 $echo "(IV will be "$ivtype", $ivsize bytes)"
13879 $echo "(UV will be "$uvtype", $uvsize bytes)"
13880 $echo "(NV will be "$nvtype", $nvsize bytes)"
13881
13882 $cat >try.c <<EOCP
13883 #$i_inttypes I_INTTYPES
13884 #ifdef I_INTTYPES
13885 #include <inttypes.h>
13886 #endif
13887 #include <stdio.h>
13888 int main() {
13889 #ifdef INT8
13890    int8_t i =  INT8_MAX;
13891   uint8_t u = UINT8_MAX;
13892   printf("int8_t\n");
13893 #endif
13894 #ifdef INT16
13895    int16_t i =  INT16_MAX;
13896   uint16_t i = UINT16_MAX;
13897   printf("int16_t\n");
13898 #endif
13899 #ifdef INT32
13900    int32_t i =  INT32_MAX;
13901   uint32_t u = UINT32_MAX;
13902   printf("int32_t\n");
13903 #endif
13904 }
13905 EOCP
13906
13907 case "$i8type" in
13908 '')     case "$charsize" in
13909         1)      i8type=char
13910                 u8type="unsigned char"
13911                 i8size=$charsize
13912                 u8size=$charsize
13913                 ;;
13914         esac
13915         ;;
13916 esac
13917 case "$i8type" in
13918 '')     set try -DINT8
13919         if eval $compile; then
13920                 case "`$run ./try`" in
13921                 int8_t) i8type=int8_t
13922                         u8type=uint8_t
13923                         i8size=1
13924                         u8size=1
13925                         ;;
13926                 esac
13927         fi
13928         ;;
13929 esac
13930 case "$i8type" in
13931 '')     if $test $charsize -ge 1; then
13932                 i8type=char
13933                 u8type="unsigned char"
13934                 i8size=$charsize
13935                 u8size=$charsize
13936         fi
13937         ;;
13938 esac
13939
13940 case "$i16type" in
13941 '')     case "$shortsize" in
13942         2)      i16type=short
13943                 u16type="unsigned short"
13944                 i16size=$shortsize
13945                 u16size=$shortsize
13946                 ;;
13947         esac
13948         ;;
13949 esac
13950 case "$i16type" in
13951 '')     set try -DINT16
13952         if eval $compile; then
13953                 case "`$run ./try`" in
13954                 int16_t)
13955                         i16type=int16_t
13956                         u16type=uint16_t
13957                         i16size=2
13958                         u16size=2
13959                         ;;
13960                 esac
13961         fi
13962         ;;
13963 esac
13964 case "$i16type" in
13965 '')     if $test $shortsize -ge 2; then
13966                 i16type=short
13967                 u16type="unsigned short"
13968                 i16size=$shortsize
13969                 u16size=$shortsize
13970         fi
13971         ;;
13972 esac
13973
13974 case "$i32type" in
13975 '')     case "$longsize" in
13976         4)      i32type=long
13977                 u32type="unsigned long"
13978                 i32size=$longsize
13979                 u32size=$longsize
13980                 ;;
13981         *)      case "$intsize" in
13982                 4)      i32type=int
13983                         u32type="unsigned int"
13984                         i32size=$intsize
13985                         u32size=$intsize
13986                         ;;
13987                 esac
13988                 ;;
13989         esac
13990         ;;
13991 esac
13992 case "$i32type" in
13993 '')     set try -DINT32
13994         if eval $compile; then
13995                 case "`$run ./try`" in
13996                 int32_t)
13997                         i32type=int32_t
13998                         u32type=uint32_t
13999                         i32size=4
14000                         u32size=4
14001                         ;;
14002                 esac
14003         fi
14004         ;;
14005 esac
14006 case "$i32type" in
14007 '')     if $test $intsize -ge 4; then
14008                 i32type=int
14009                 u32type="unsigned int"
14010                 i32size=$intsize
14011                 u32size=$intsize
14012         fi
14013         ;;
14014 esac
14015
14016 case "$i64type" in
14017 '')     case "$d_quad:$quadtype" in
14018         define:?*)
14019                 i64type="$quadtype"
14020                 u64type="$uquadtype"
14021                 i64size=8
14022                 u64size=8
14023                 ;;
14024         esac
14025         ;;
14026 esac
14027
14028 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14029 : volatile so that the compiler has to store it out to memory.
14030 if test X"$d_volatile" = X"$define"; then
14031         volatile=volatile
14032 fi
14033 $cat <<EOP >try.c
14034 #include <stdio.h>
14035 #include <sys/types.h>
14036 #include <signal.h>
14037 #ifdef SIGFPE
14038 $volatile int bletched = 0;
14039 $signal_t blech(s) int s; { bletched = 1; }
14040 #endif
14041 int main() {
14042     $uvtype u = 0;
14043     $nvtype d;
14044     int     n = 8 * $uvsize;
14045     int     i;
14046 #ifdef SIGFPE
14047     signal(SIGFPE, blech);
14048 #endif
14049
14050     for (i = 0; i < n; i++) {
14051       u = u << 1 | ($uvtype)1;
14052       d = ($nvtype)u;
14053       if (($uvtype)d != u)
14054         break;
14055       if (d <= 0)
14056         break;
14057       d = ($nvtype)(u - 1);
14058       if (($uvtype)d != (u - 1))
14059         break;
14060 #ifdef SIGFPE
14061       if (bletched) {
14062         break;
14063 #endif
14064       } 
14065     }
14066     printf("%d\n", ((i == n) ? -n : i));
14067     exit(0);
14068 }
14069 EOP
14070 set try
14071
14072 d_nv_preserves_uv="$undef"
14073 if eval $compile; then
14074         nv_preserves_uv_bits="`$run ./try`"
14075 fi
14076 case "$nv_preserves_uv_bits" in
14077 \-[1-9]*)       
14078         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14079         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14080         d_nv_preserves_uv="$define"
14081         ;;
14082 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14083         d_nv_preserves_uv="$undef" ;;
14084 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14085         nv_preserves_uv_bits="$undef" ;;
14086 esac
14087
14088 $rm -f try.* try
14089
14090
14091 : check for off64_t
14092 echo " "
14093 echo "Checking to see if you have off64_t..." >&4
14094 $cat >try.c <<EOCP
14095 #include <sys/types.h>
14096 #include <unistd.h>
14097 int main() { off64_t x = 7; }
14098 EOCP
14099 set try
14100 if eval $compile; then
14101         val="$define"
14102         echo "You have off64_t."
14103 else
14104         val="$undef"
14105         echo "You do not have off64_t."
14106         case "$lseeksize" in
14107         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14108         esac
14109 fi
14110 $rm -f try.* try
14111 set d_off64_t
14112 eval $setvar
14113
14114 : how to create joinable pthreads
14115 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14116         echo " "
14117         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14118         $cat >try.c <<'EOCP'
14119 #include <pthread.h>
14120 int main() {
14121     int detachstate = JOINABLE;
14122 }
14123 EOCP
14124         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14125         if eval $compile; then
14126                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14127                 val="$undef" # Yes, undef.
14128                 set d_old_pthread_create_joinable
14129                 eval $setvar
14130                 val=""
14131                 set old_pthread_create_joinable
14132                 eval $setvar
14133         else
14134                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14135                 if eval $compile; then
14136                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14137                         val="$define"
14138                         set d_old_pthread_create_joinable
14139                         eval $setvar
14140                         val=PTHREAD_CREATE_UNDETACHED
14141                         set old_pthread_create_joinable
14142                         eval $setvar
14143                 else            
14144                         set try -DJOINABLE=__UNDETACHED
14145                         if eval $compile; then
14146                                 echo "You seem to use __UNDETACHED." >&4
14147                                 val="$define"
14148                                 set d_old_pthread_create_joinable
14149                                 eval $setvar
14150                                 val=__UNDETACHED
14151                                 set old_pthread_create_joinable
14152                                 eval $setvar
14153                         else
14154                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14155                                 val="$define"
14156                                 set d_old_pthread_create_joinable
14157                                 eval $setvar
14158                                 val=0
14159                                 set old_pthread_create_joinable
14160                                 eval $setvar
14161                         fi
14162                 fi
14163         fi
14164         $rm -f try try.*
14165 else
14166     d_old_pthread_create_joinable="$undef"
14167     old_pthread_create_joinable=""
14168 fi
14169
14170 : see if pause exists
14171 set pause d_pause
14172 eval $inlibc
14173
14174 : see if pipe exists
14175 set pipe d_pipe
14176 eval $inlibc
14177
14178 : see if poll exists
14179 set poll d_poll
14180 eval $inlibc
14181
14182 : see if readlink exists
14183 set readlink d_readlink
14184 eval $inlibc
14185
14186 echo " "
14187 procselfexe=''
14188 val="$undef"
14189 case "$d_readlink" in
14190 "$define")
14191         if $issymlink /proc/self/exe ; then
14192                 $ls -l /proc/self/exe > reflect
14193                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14194                         echo "You have Linux-like /proc/self/exe."
14195                         procselfexe='"/proc/self/exe"'
14196                         val="$define"
14197                 fi
14198         fi
14199         if $issymlink /proc/curproc/file ; then
14200                 $ls -l /proc/curproc/file > reflect
14201                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14202                         echo "You have BSD-like /proc/curproc/file."
14203                         procselfexe='"/proc/curproc/file"'
14204                         val="$define"
14205                 fi
14206         fi
14207         ;;
14208 esac
14209 $rm -f reflect
14210 set d_procselfexe
14211 eval $setvar
14212
14213 : see whether the pthread_atfork exists
14214 $cat >try.c <<EOP
14215 #include <pthread.h>
14216 #include <stdio.h>
14217 int main() {
14218 #ifdef  PTHREAD_ATFORK
14219         pthread_atfork(NULL,NULL,NULL);
14220 #endif
14221 }
14222 EOP
14223
14224 : see if pthread_atfork exists
14225 set try -DPTHREAD_ATFORK
14226 if eval $compile; then
14227     val="$define"
14228 else
14229     val="$undef"
14230 fi
14231 case "$usethreads" in
14232 $define)
14233         case "$val" in
14234         $define) echo 'pthread_atfork found.' >&4        ;;
14235         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14236         esac
14237 esac
14238 set d_pthread_atfork
14239 eval $setvar
14240
14241
14242 : see whether the various POSIXish _yields exist
14243 $cat >try.c <<EOP
14244 #include <pthread.h>
14245 #include <stdio.h>
14246 int main() {
14247 #ifdef SCHED_YIELD
14248         sched_yield();
14249 #else
14250 #ifdef PTHREAD_YIELD
14251         pthread_yield();
14252 #else
14253 #ifdef PTHREAD_YIELD_NULL
14254         pthread_yield(NULL);
14255 #endif
14256 #endif
14257 #endif
14258 }
14259 EOP
14260 : see if sched_yield exists
14261 set try -DSCHED_YIELD
14262 if eval $compile; then
14263     val="$define"
14264     sched_yield='sched_yield()'
14265 else
14266     val="$undef"
14267 fi
14268 case "$usethreads" in
14269 $define)
14270         case "$val" in
14271         $define) echo 'sched_yield() found.' >&4        ;;
14272         *)       echo 'sched_yield() NOT found.' >&4    ;;
14273         esac
14274 esac
14275 set d_sched_yield
14276 eval $setvar
14277
14278 : see if pthread_yield exists
14279 set try -DPTHREAD_YIELD
14280 if eval $compile; then
14281     val="$define"
14282     case "$sched_yield" in
14283     '') sched_yield='pthread_yield()' ;;
14284     esac
14285 else
14286     set try -DPTHREAD_YIELD_NULL
14287     if eval $compile; then
14288         val="$define"
14289         case "$sched_yield" in
14290         '') sched_yield='pthread_yield(NULL)' ;;
14291         esac
14292     else
14293         val="$undef"
14294     fi
14295 fi
14296 case "$usethreads" in
14297 $define)
14298         case "$val" in
14299         $define) echo 'pthread_yield() found.' >&4      ;;
14300         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14301         esac
14302         ;;
14303 esac
14304 set d_pthread_yield
14305 eval $setvar
14306
14307 case "$sched_yield" in
14308 '') sched_yield=undef ;;
14309 esac
14310
14311 $rm -f try try.*
14312
14313 : see if random_r exists
14314 set random_r d_random_r
14315 eval $inlibc
14316 case "$d_random_r" in
14317 "$define")
14318         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14319         case "$d_random_r_proto:$usethreads" in
14320         ":define")      d_random_r_proto=define
14321                 set d_random_r_proto random_r $hdrs
14322                 eval $hasproto ;;
14323         *)      ;;
14324         esac
14325         case "$d_random_r_proto" in
14326         define)
14327         case "$random_r_proto" in
14328         ''|0) try='int random_r(int*, struct random_data*);'
14329         ./protochk "extern $try" $hdrs && random_r_proto=I_TS ;;
14330         esac
14331         case "$random_r_proto" in
14332         ''|0)   d_random_r=undef
14333                 random_r_proto=0
14334                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14335         * )     case "$random_r_proto" in
14336                 REENTRANT_PROTO*) ;;
14337                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14338                 esac
14339                 echo "Prototype: $try" ;;
14340         esac
14341         ;;
14342         *)      case "$usethreads" in
14343                 define) echo "random_r has no prototype, not using it." >&4 ;;
14344                 esac
14345                 d_random_r=undef
14346                 random_r_proto=0
14347                 ;;
14348         esac
14349         ;;
14350 *)      random_r_proto=0
14351         ;;
14352 esac
14353
14354 : see if readdir and friends exist
14355 set readdir d_readdir
14356 eval $inlibc
14357 set seekdir d_seekdir
14358 eval $inlibc
14359 set telldir d_telldir
14360 eval $inlibc
14361 set rewinddir d_rewinddir
14362 eval $inlibc
14363
14364 : see if readdir64_r exists
14365 set readdir64_r d_readdir64_r
14366 eval $inlibc
14367 case "$d_readdir64_r" in
14368 "$define")
14369         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14370         case "$d_readdir64_r_proto:$usethreads" in
14371         ":define")      d_readdir64_r_proto=define
14372                 set d_readdir64_r_proto readdir64_r $hdrs
14373                 eval $hasproto ;;
14374         *)      ;;
14375         esac
14376         case "$d_readdir64_r_proto" in
14377         define)
14378         case "$readdir64_r_proto" in
14379         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14380         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14381         esac
14382         case "$readdir64_r_proto" in
14383         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14384         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14385         esac
14386         case "$readdir64_r_proto" in
14387         ''|0)   d_readdir64_r=undef
14388                 readdir64_r_proto=0
14389                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14390         * )     case "$readdir64_r_proto" in
14391                 REENTRANT_PROTO*) ;;
14392                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14393                 esac
14394                 echo "Prototype: $try" ;;
14395         esac
14396         ;;
14397         *)      case "$usethreads" in
14398                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14399                 esac
14400                 d_readdir64_r=undef
14401                 readdir64_r_proto=0
14402                 ;;
14403         esac
14404         ;;
14405 *)      readdir64_r_proto=0
14406         ;;
14407 esac
14408
14409 : see if readdir_r exists
14410 set readdir_r d_readdir_r
14411 eval $inlibc
14412 case "$d_readdir_r" in
14413 "$define")
14414         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14415         case "$d_readdir_r_proto:$usethreads" in
14416         ":define")      d_readdir_r_proto=define
14417                 set d_readdir_r_proto readdir_r $hdrs
14418                 eval $hasproto ;;
14419         *)      ;;
14420         esac
14421         case "$d_readdir_r_proto" in
14422         define)
14423         case "$readdir_r_proto" in
14424         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14425         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14426         esac
14427         case "$readdir_r_proto" in
14428         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14429         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14430         esac
14431         case "$readdir_r_proto" in
14432         ''|0)   d_readdir_r=undef
14433                 readdir_r_proto=0
14434                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14435         * )     case "$readdir_r_proto" in
14436                 REENTRANT_PROTO*) ;;
14437                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14438                 esac
14439                 echo "Prototype: $try" ;;
14440         esac
14441         ;;
14442         *)      case "$usethreads" in
14443                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14444                 esac
14445                 d_readdir_r=undef
14446                 readdir_r_proto=0
14447                 ;;
14448         esac
14449         ;;
14450 *)      readdir_r_proto=0
14451         ;;
14452 esac
14453
14454 : see if readv exists
14455 set readv d_readv
14456 eval $inlibc
14457
14458 : see if recvmsg exists
14459 set recvmsg d_recvmsg
14460 eval $inlibc
14461
14462 : see if rename exists
14463 set rename d_rename
14464 eval $inlibc
14465
14466 : see if rmdir exists
14467 set rmdir d_rmdir
14468 eval $inlibc
14469
14470 : see if memory.h is available.
14471 val=''
14472 set memory.h val
14473 eval $inhdr
14474
14475 : See if it conflicts with string.h
14476 case "$val" in
14477 $define)
14478         case "$strings" in
14479         '') ;;
14480         *)
14481                 $cppstdin $cppflags $cppminus < $strings > mem.h
14482                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14483                         echo " "
14484                         echo "We won't be including <memory.h>."
14485                         val="$undef"
14486                 fi
14487                 $rm -f mem.h
14488                 ;;
14489         esac
14490 esac
14491 set i_memory
14492 eval $setvar
14493
14494 : can bcopy handle overlapping blocks?
14495 echo " "
14496 val="$undef"
14497 case "$d_memmove" in
14498 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14499 *)      case "$d_bcopy" in
14500         "$define")
14501                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14502                 $cat >try.c <<EOCP
14503 #$i_memory I_MEMORY
14504 #$i_stdlib I_STDLIB
14505 #$i_string I_STRING
14506 #$i_unistd I_UNISTD
14507 EOCP
14508         $cat >>try.c <<'EOCP'
14509 #include <stdio.h>
14510 #ifdef I_MEMORY
14511 #  include <memory.h>
14512 #endif
14513 #ifdef I_STDLIB
14514 #  include <stdlib.h>
14515 #endif
14516 #ifdef I_STRING
14517 #  include <string.h>
14518 #else
14519 #  include <strings.h>
14520 #endif
14521 #ifdef I_UNISTD
14522 #  include <unistd.h>  /* Needed for NetBSD */
14523 #endif
14524 int main()
14525 {
14526 char buf[128], abc[128];
14527 char *b;
14528 int len;
14529 int off;
14530 int align;
14531
14532 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14533    try to store the string in read-only memory. */
14534 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14535
14536 for (align = 7; align >= 0; align--) {
14537         for (len = 36; len; len--) {
14538                 b = buf+align;
14539                 bcopy(abc, b, len);
14540                 for (off = 1; off <= len; off++) {
14541                         bcopy(b, b+off, len);
14542                         bcopy(b+off, b, len);
14543                         if (bcmp(b, abc, len))
14544                                 exit(1);
14545                 }
14546         }
14547 }
14548 exit(0);
14549 }
14550 EOCP
14551                 set try
14552                 if eval $compile_ok; then
14553                         if ./try 2>/dev/null; then
14554                                 echo "Yes, it can."
14555                                 val="$define"
14556                         else
14557                                 echo "It can't, sorry."
14558                         fi
14559                 else
14560                         echo "(I can't compile the test program, so we'll assume not...)"
14561                 fi
14562                 ;;
14563         esac
14564         $rm -f try.* try core
14565         ;;
14566 esac
14567 set d_safebcpy
14568 eval $setvar
14569
14570 : can memcpy handle overlapping blocks?
14571 echo " "
14572 val="$undef"
14573 case "$d_memmove" in
14574 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14575 *)      case "$d_memcpy" in
14576         "$define")
14577                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14578                 $cat >try.c <<EOCP
14579 #$i_memory I_MEMORY
14580 #$i_stdlib I_STDLIB
14581 #$i_string I_STRING
14582 #$i_unistd I_UNISTD
14583 EOCP
14584         $cat >>try.c <<'EOCP'
14585 #include <stdio.h>
14586 #ifdef I_MEMORY
14587 #  include <memory.h>
14588 #endif
14589 #ifdef I_STDLIB
14590 #  include <stdlib.h>
14591 #endif
14592 #ifdef I_STRING
14593 #  include <string.h>
14594 #else
14595 #  include <strings.h>
14596 #endif
14597 #ifdef I_UNISTD
14598 #  include <unistd.h>  /* Needed for NetBSD */
14599 #endif
14600 int main()
14601 {
14602 char buf[128], abc[128];
14603 char *b;
14604 int len;
14605 int off;
14606 int align;
14607
14608 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14609    try to store the string in read-only memory. */
14610 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14611
14612 for (align = 7; align >= 0; align--) {
14613         for (len = 36; len; len--) {
14614                 b = buf+align;
14615                 memcpy(b, abc, len);
14616                 for (off = 1; off <= len; off++) {
14617                         memcpy(b+off, b, len);
14618                         memcpy(b, b+off, len);
14619                         if (memcmp(b, abc, len))
14620                                 exit(1);
14621                 }
14622         }
14623 }
14624 exit(0);
14625 }
14626 EOCP
14627                 set try
14628                 if eval $compile_ok; then
14629                         if ./try 2>/dev/null; then
14630                                 echo "Yes, it can."
14631                                 val="$define"
14632                         else
14633                                 echo "It can't, sorry."
14634                         fi
14635                 else
14636                         echo "(I can't compile the test program, so we'll assume not...)"
14637                 fi
14638                 ;;
14639         esac
14640         $rm -f try.* try core
14641         ;;
14642 esac
14643 set d_safemcpy
14644 eval $setvar
14645
14646 : can memcmp be trusted to compare relative magnitude?
14647 val="$undef"
14648 case "$d_memcmp" in
14649 "$define")
14650         echo " "
14651         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14652         $cat >try.c <<EOCP
14653 #$i_memory I_MEMORY
14654 #$i_stdlib I_STDLIB
14655 #$i_string I_STRING
14656 #$i_unistd I_UNISTD
14657 EOCP
14658         $cat >>try.c <<'EOCP'
14659 #include <stdio.h>
14660 #ifdef I_MEMORY
14661 #  include <memory.h>
14662 #endif
14663 #ifdef I_STDLIB
14664 #  include <stdlib.h>
14665 #endif
14666 #ifdef I_STRING
14667 #  include <string.h>
14668 #else
14669 #  include <strings.h>
14670 #endif
14671 #ifdef I_UNISTD
14672 #  include <unistd.h>  /* Needed for NetBSD */
14673 #endif
14674 int main()
14675 {
14676 char a = -1;
14677 char b = 0;
14678 if ((a < b) && memcmp(&a, &b, 1) < 0)
14679         exit(1);
14680 exit(0);
14681 }
14682 EOCP
14683         set try
14684         if eval $compile_ok; then
14685                 if $run ./try 2>/dev/null; then
14686                         echo "Yes, it can."
14687                         val="$define"
14688                 else
14689                         echo "No, it can't (it uses signed chars)."
14690                 fi
14691         else
14692                 echo "(I can't compile the test program, so we'll assume not...)"
14693         fi
14694         ;;
14695 esac
14696 $rm -f try.* try core
14697 set d_sanemcmp
14698 eval $setvar
14699
14700 : see if prototype for sbrk is available
14701 echo " "
14702 set d_sbrkproto sbrk $i_unistd unistd.h
14703 eval $hasproto
14704
14705 : see if select exists
14706 set select d_select
14707 eval $inlibc
14708
14709 : see if semctl exists
14710 set semctl d_semctl
14711 eval $inlibc
14712
14713 : see if semget exists
14714 set semget d_semget
14715 eval $inlibc
14716
14717 : see if semop exists
14718 set semop d_semop
14719 eval $inlibc
14720
14721 : see how much of the 'sem*(2)' library is present.
14722 h_sem=true
14723 echo " "
14724 case "$d_semctl$d_semget$d_semop" in
14725 *"$undef"*) h_sem=false;;
14726 esac
14727 case "$osname" in
14728 freebsd)
14729     case "`ipcs 2>&1`" in
14730     "SVID messages"*"not configured"*)
14731         echo "Your $osname does not have the sem*(2) configured." >&4
14732         h_sem=false
14733         val="$undef"
14734         set semctl d_semctl
14735         eval $setvar
14736         set semget d_semget
14737         eval $setvar
14738         set semop d_semop
14739         eval $setvar
14740         ;;
14741     esac
14742     ;;
14743 esac
14744 : we could also check for sys/ipc.h ...
14745 if $h_sem && $test `./findhdr sys/sem.h`; then
14746         echo "You have the full sem*(2) library." >&4
14747         val="$define"
14748 else
14749         echo "You don't have the full sem*(2) library." >&4
14750         val="$undef"
14751 fi
14752 set d_sem
14753 eval $setvar
14754
14755 : see whether sys/sem.h defines union semun
14756 echo " "
14757 $cat > try.c <<'END'
14758 #include <sys/types.h>
14759 #include <sys/ipc.h>
14760 #include <sys/sem.h>
14761 int main () { union semun semun; semun.buf = 0; }
14762 END
14763 set try
14764 if eval $compile; then
14765     echo "You have union semun in <sys/sem.h>." >&4
14766     val="$define"
14767 else
14768     echo "You do not have union semun in <sys/sem.h>." >&4
14769     val="$undef"
14770 fi
14771 $rm -f try try.c try.h
14772 set d_union_semun
14773 eval $setvar
14774
14775 : see how to do semctl IPC_STAT
14776 case "$d_sem" in
14777 $define)
14778     : see whether semctl IPC_STAT can use union semun
14779     echo " "
14780     $cat > try.h <<END
14781 #ifndef S_IRUSR
14782 #   ifdef S_IREAD
14783 #       define S_IRUSR S_IREAD
14784 #       define S_IWUSR S_IWRITE
14785 #       define S_IXUSR S_IEXEC
14786 #   else
14787 #       define S_IRUSR 0400
14788 #       define S_IWUSR 0200
14789 #       define S_IXUSR 0100
14790 #   endif
14791 #   define S_IRGRP (S_IRUSR>>3)
14792 #   define S_IWGRP (S_IWUSR>>3)
14793 #   define S_IXGRP (S_IXUSR>>3)
14794 #   define S_IROTH (S_IRUSR>>6)
14795 #   define S_IWOTH (S_IWUSR>>6)
14796 #   define S_IXOTH (S_IXUSR>>6)
14797 #endif
14798 #ifndef S_IRWXU
14799 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14800 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14801 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14802 #endif
14803 END
14804
14805     $cat > try.c <<END
14806 #include <sys/types.h>
14807 #include <sys/ipc.h>
14808 #include <sys/sem.h>
14809 #include <sys/stat.h>
14810 #include <stdio.h>
14811 #include <errno.h>
14812 #include "try.h"
14813 #ifndef errno
14814 extern int errno;
14815 #endif
14816 #$d_union_semun HAS_UNION_SEMUN
14817 int main() {
14818     union semun
14819 #ifndef HAS_UNION_SEMUN
14820     {
14821         int val;
14822         struct semid_ds *buf;
14823         unsigned short *array;
14824     }
14825 #endif
14826     arg;
14827     int sem, st;
14828
14829 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14830     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14831     if (sem > -1) {
14832         struct semid_ds argbuf;
14833         arg.buf = &argbuf;
14834 #       ifdef IPC_STAT
14835         st = semctl(sem, 0, IPC_STAT, arg);
14836         if (st == 0)
14837             printf("semun\n");
14838         else
14839 #       endif /* IPC_STAT */
14840             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14841 #       ifdef IPC_RMID
14842         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14843 #       endif /* IPC_RMID */
14844             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14845     } else
14846 #endif /* IPC_PRIVATE && ... */
14847         printf("semget failed: errno = %d\n", errno);
14848   return 0;
14849 }
14850 END
14851     val="$undef"
14852     set try
14853     if eval $compile; then
14854         xxx=`$run ./try`
14855         case "$xxx" in
14856         semun) val="$define" ;;
14857         esac
14858     fi
14859     $rm -f try try.c
14860     set d_semctl_semun
14861     eval $setvar
14862     case "$d_semctl_semun" in
14863     $define)
14864         echo "You can use union semun for semctl IPC_STAT." >&4
14865         also='also'
14866         ;;
14867     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14868         also=''
14869         ;;
14870     esac
14871
14872     : see whether semctl IPC_STAT can use struct semid_ds pointer
14873     $cat > try.c <<'END'
14874 #include <sys/types.h>
14875 #include <sys/ipc.h>
14876 #include <sys/sem.h>
14877 #include <sys/stat.h>
14878 #include "try.h"
14879 #include <stdio.h>
14880 #include <errno.h>
14881 #ifndef errno
14882 extern int errno;
14883 #endif
14884 int main() {
14885     struct semid_ds arg;
14886     int sem, st;
14887
14888 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14889     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14890     if (sem > -1) {
14891 #       ifdef IPC_STAT
14892         st = semctl(sem, 0, IPC_STAT, &arg);
14893         if (st == 0)
14894             printf("semid_ds\n");
14895         else
14896 #       endif /* IPC_STAT */
14897             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14898 #       ifdef IPC_RMID
14899         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14900 #       endif /* IPC_RMID */
14901             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14902     } else
14903 #endif /* IPC_PRIVATE && ... */
14904         printf("semget failed: errno = %d\n", errno);
14905
14906     return 0;
14907 }
14908 END
14909     val="$undef"
14910     set try
14911     if eval $compile; then
14912         xxx=`$run ./try`
14913         case "$xxx" in
14914         semid_ds) val="$define" ;;
14915         esac
14916     fi
14917     $rm -f try try.c
14918     set d_semctl_semid_ds
14919     eval $setvar
14920     case "$d_semctl_semid_ds" in
14921     $define)
14922         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14923         ;;
14924     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14925         ;;
14926     esac
14927     $rm -f try.h
14928     ;;
14929 *)  val="$undef"
14930
14931     # We do not have the full sem*(2) library, so assume we can not
14932     # use either.
14933
14934     set d_semctl_semun
14935     eval $setvar
14936
14937     set d_semctl_semid_ds
14938     eval $setvar
14939     ;;
14940 esac
14941
14942 : see if sendmsg exists
14943 set sendmsg d_sendmsg
14944 eval $inlibc
14945
14946 : see if setegid exists
14947 set setegid d_setegid
14948 eval $inlibc
14949
14950 : see if seteuid exists
14951 set seteuid d_seteuid
14952 eval $inlibc
14953
14954 : see if setgrent exists
14955 set setgrent d_setgrent
14956 eval $inlibc
14957
14958 : see if setgrent_r exists
14959 set setgrent_r d_setgrent_r
14960 eval $inlibc
14961 case "$d_setgrent_r" in
14962 "$define")
14963         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
14964         case "$d_setgrent_r_proto:$usethreads" in
14965         ":define")      d_setgrent_r_proto=define
14966                 set d_setgrent_r_proto setgrent_r $hdrs
14967                 eval $hasproto ;;
14968         *)      ;;
14969         esac
14970         case "$d_setgrent_r_proto" in
14971         define)
14972         case "$setgrent_r_proto" in
14973         ''|0) try='int setgrent_r(FILE**);'
14974         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
14975         esac
14976         case "$setgrent_r_proto" in
14977         ''|0) try='void setgrent_r(FILE**);'
14978         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
14979         esac
14980         case "$setgrent_r_proto" in
14981         ''|0)   d_setgrent_r=undef
14982                 setgrent_r_proto=0
14983                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
14984         * )     case "$setgrent_r_proto" in
14985                 REENTRANT_PROTO*) ;;
14986                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
14987                 esac
14988                 echo "Prototype: $try" ;;
14989         esac
14990         ;;
14991         *)      case "$usethreads" in
14992                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
14993                 esac
14994                 d_setgrent_r=undef
14995                 setgrent_r_proto=0
14996                 ;;
14997         esac
14998         ;;
14999 *)      setgrent_r_proto=0
15000         ;;
15001 esac
15002
15003 : see if sethostent exists
15004 set sethostent d_sethent
15005 eval $inlibc
15006
15007 : see if sethostent_r exists
15008 set sethostent_r d_sethostent_r
15009 eval $inlibc
15010 case "$d_sethostent_r" in
15011 "$define")
15012         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15013         case "$d_sethostent_r_proto:$usethreads" in
15014         ":define")      d_sethostent_r_proto=define
15015                 set d_sethostent_r_proto sethostent_r $hdrs
15016                 eval $hasproto ;;
15017         *)      ;;
15018         esac
15019         case "$d_sethostent_r_proto" in
15020         define)
15021         case "$sethostent_r_proto" in
15022         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15023         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15024         esac
15025         case "$sethostent_r_proto" in
15026         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15027         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15028         esac
15029         case "$sethostent_r_proto" in
15030         ''|0)   d_sethostent_r=undef
15031                 sethostent_r_proto=0
15032                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15033         * )     case "$sethostent_r_proto" in
15034                 REENTRANT_PROTO*) ;;
15035                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15036                 esac
15037                 echo "Prototype: $try" ;;
15038         esac
15039         ;;
15040         *)      case "$usethreads" in
15041                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15042                 esac
15043                 d_sethostent_r=undef
15044                 sethostent_r_proto=0
15045                 ;;
15046         esac
15047         ;;
15048 *)      sethostent_r_proto=0
15049         ;;
15050 esac
15051
15052 : see if setitimer exists
15053 set setitimer d_setitimer
15054 eval $inlibc
15055
15056 : see if setlinebuf exists
15057 set setlinebuf d_setlinebuf
15058 eval $inlibc
15059
15060 : see if setlocale exists
15061 set setlocale d_setlocale
15062 eval $inlibc
15063
15064 : see if locale.h is available
15065 set locale.h i_locale
15066 eval $inhdr
15067
15068 : see if setlocale_r exists
15069 set setlocale_r d_setlocale_r
15070 eval $inlibc
15071 case "$d_setlocale_r" in
15072 "$define")
15073         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15074         case "$d_setlocale_r_proto:$usethreads" in
15075         ":define")      d_setlocale_r_proto=define
15076                 set d_setlocale_r_proto setlocale_r $hdrs
15077                 eval $hasproto ;;
15078         *)      ;;
15079         esac
15080         case "$d_setlocale_r_proto" in
15081         define)
15082         case "$setlocale_r_proto" in
15083         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15084         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15085         esac
15086         case "$setlocale_r_proto" in
15087         ''|0)   d_setlocale_r=undef
15088                 setlocale_r_proto=0
15089                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15090         * )     case "$setlocale_r_proto" in
15091                 REENTRANT_PROTO*) ;;
15092                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15093                 esac
15094                 echo "Prototype: $try" ;;
15095         esac
15096         ;;
15097         *)      case "$usethreads" in
15098                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15099                 esac
15100                 d_setlocale_r=undef
15101                 setlocale_r_proto=0
15102                 ;;
15103         esac
15104         ;;
15105 *)      setlocale_r_proto=0
15106         ;;
15107 esac
15108
15109 : see if setnetent exists
15110 set setnetent d_setnent
15111 eval $inlibc
15112
15113 : see if setnetent_r exists
15114 set setnetent_r d_setnetent_r
15115 eval $inlibc
15116 case "$d_setnetent_r" in
15117 "$define")
15118         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15119         case "$d_setnetent_r_proto:$usethreads" in
15120         ":define")      d_setnetent_r_proto=define
15121                 set d_setnetent_r_proto setnetent_r $hdrs
15122                 eval $hasproto ;;
15123         *)      ;;
15124         esac
15125         case "$d_setnetent_r_proto" in
15126         define)
15127         case "$setnetent_r_proto" in
15128         ''|0) try='int setnetent_r(int, struct netent_data*);'
15129         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15130         esac
15131         case "$setnetent_r_proto" in
15132         ''|0) try='void setnetent_r(int, struct netent_data*);'
15133         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15134         esac
15135         case "$setnetent_r_proto" in
15136         ''|0)   d_setnetent_r=undef
15137                 setnetent_r_proto=0
15138                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15139         * )     case "$setnetent_r_proto" in
15140                 REENTRANT_PROTO*) ;;
15141                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15142                 esac
15143                 echo "Prototype: $try" ;;
15144         esac
15145         ;;
15146         *)      case "$usethreads" in
15147                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15148                 esac
15149                 d_setnetent_r=undef
15150                 setnetent_r_proto=0
15151                 ;;
15152         esac
15153         ;;
15154 *)      setnetent_r_proto=0
15155         ;;
15156 esac
15157
15158 : see if setprotoent exists
15159 set setprotoent d_setpent
15160 eval $inlibc
15161
15162 : see if setpgid exists
15163 set setpgid d_setpgid
15164 eval $inlibc
15165
15166 : see if setpgrp2 exists
15167 set setpgrp2 d_setpgrp2
15168 eval $inlibc
15169
15170 : see if setpriority exists
15171 set setpriority d_setprior
15172 eval $inlibc
15173
15174 : see if setproctitle exists
15175 set setproctitle d_setproctitle
15176 eval $inlibc
15177
15178 : see if setprotoent_r exists
15179 set setprotoent_r d_setprotoent_r
15180 eval $inlibc
15181 case "$d_setprotoent_r" in
15182 "$define")
15183         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15184         case "$d_setprotoent_r_proto:$usethreads" in
15185         ":define")      d_setprotoent_r_proto=define
15186                 set d_setprotoent_r_proto setprotoent_r $hdrs
15187                 eval $hasproto ;;
15188         *)      ;;
15189         esac
15190         case "$d_setprotoent_r_proto" in
15191         define)
15192         case "$setprotoent_r_proto" in
15193         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15194         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15195         esac
15196         case "$setprotoent_r_proto" in
15197         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15198         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15199         esac
15200         case "$setprotoent_r_proto" in
15201         ''|0)   d_setprotoent_r=undef
15202                 setprotoent_r_proto=0
15203                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15204         * )     case "$setprotoent_r_proto" in
15205                 REENTRANT_PROTO*) ;;
15206                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15207                 esac
15208                 echo "Prototype: $try" ;;
15209         esac
15210         ;;
15211         *)      case "$usethreads" in
15212                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15213                 esac
15214                 d_setprotoent_r=undef
15215                 setprotoent_r_proto=0
15216                 ;;
15217         esac
15218         ;;
15219 *)      setprotoent_r_proto=0
15220         ;;
15221 esac
15222
15223 : see if setpwent exists
15224 set setpwent d_setpwent
15225 eval $inlibc
15226
15227 : see if setpwent_r exists
15228 set setpwent_r d_setpwent_r
15229 eval $inlibc
15230 case "$d_setpwent_r" in
15231 "$define")
15232         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15233         case "$d_setpwent_r_proto:$usethreads" in
15234         ":define")      d_setpwent_r_proto=define
15235                 set d_setpwent_r_proto setpwent_r $hdrs
15236                 eval $hasproto ;;
15237         *)      ;;
15238         esac
15239         case "$d_setpwent_r_proto" in
15240         define)
15241         case "$setpwent_r_proto" in
15242         ''|0) try='int setpwent_r(FILE**);'
15243         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15244         esac
15245         case "$setpwent_r_proto" in
15246         ''|0) try='void setpwent_r(FILE**);'
15247         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15248         esac
15249         case "$setpwent_r_proto" in
15250         ''|0)   d_setpwent_r=undef
15251                 setpwent_r_proto=0
15252                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15253         * )     case "$setpwent_r_proto" in
15254                 REENTRANT_PROTO*) ;;
15255                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15256                 esac
15257                 echo "Prototype: $try" ;;
15258         esac
15259         ;;
15260         *)      case "$usethreads" in
15261                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15262                 esac
15263                 d_setpwent_r=undef
15264                 setpwent_r_proto=0
15265                 ;;
15266         esac
15267         ;;
15268 *)      setpwent_r_proto=0
15269         ;;
15270 esac
15271
15272 : see if setregid exists
15273 set setregid d_setregid
15274 eval $inlibc
15275 set setresgid d_setresgid
15276 eval $inlibc
15277
15278 : see if setreuid exists
15279 set setreuid d_setreuid
15280 eval $inlibc
15281 set setresuid d_setresuid
15282 eval $inlibc
15283
15284 : see if setrgid exists
15285 set setrgid d_setrgid
15286 eval $inlibc
15287
15288 : see if setruid exists
15289 set setruid d_setruid
15290 eval $inlibc
15291
15292 : see if setservent exists
15293 set setservent d_setsent
15294 eval $inlibc
15295
15296 : see if setservent_r exists
15297 set setservent_r d_setservent_r
15298 eval $inlibc
15299 case "$d_setservent_r" in
15300 "$define")
15301         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15302         case "$d_setservent_r_proto:$usethreads" in
15303         ":define")      d_setservent_r_proto=define
15304                 set d_setservent_r_proto setservent_r $hdrs
15305                 eval $hasproto ;;
15306         *)      ;;
15307         esac
15308         case "$d_setservent_r_proto" in
15309         define)
15310         case "$setservent_r_proto" in
15311         ''|0) try='int setservent_r(int, struct servent_data*);'
15312         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15313         esac
15314         case "$setservent_r_proto" in
15315         ''|0) try='void setservent_r(int, struct servent_data*);'
15316         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15317         esac
15318         case "$setservent_r_proto" in
15319         ''|0)   d_setservent_r=undef
15320                 setservent_r_proto=0
15321                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15322         * )     case "$setservent_r_proto" in
15323                 REENTRANT_PROTO*) ;;
15324                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15325                 esac
15326                 echo "Prototype: $try" ;;
15327         esac
15328         ;;
15329         *)      case "$usethreads" in
15330                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15331                 esac
15332                 d_setservent_r=undef
15333                 setservent_r_proto=0
15334                 ;;
15335         esac
15336         ;;
15337 *)      setservent_r_proto=0
15338         ;;
15339 esac
15340
15341 : see if setsid exists
15342 set setsid d_setsid
15343 eval $inlibc
15344
15345 : see if setvbuf exists
15346 set setvbuf d_setvbuf
15347 eval $inlibc
15348
15349 : see if sfio.h is available
15350 set sfio.h i_sfio
15351 eval $inhdr
15352
15353
15354 : see if sfio library is available
15355 case "$i_sfio" in
15356 $define)
15357         val=''
15358         set sfreserve val
15359         eval $inlibc
15360         ;;
15361 *)
15362         val="$undef"
15363         ;;
15364 esac
15365 : Ok, but do we want to use it.
15366 case "$val" in
15367 $define)
15368         case "$usesfio" in
15369         true|$define|[yY]*) dflt='y';;
15370         *) dflt='n';;
15371         esac
15372         echo "$package can use the sfio library, but it is experimental."
15373         case "$useperlio" in
15374         "$undef")
15375             echo "For sfio also the PerlIO abstraction layer is needed."
15376             echo "Earlier you said you wouldn't want that."
15377             ;;
15378         esac
15379         rp="You seem to have sfio available, do you want to try using it?"
15380         . ./myread
15381         case "$ans" in
15382         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15383                 useperlio="$define"
15384                 val="$define"
15385                 ;;
15386         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15387                 val="$undef"
15388                 ;;
15389         esac
15390         ;;
15391 *)      case "$usesfio" in
15392         true|$define|[yY]*)
15393                 echo "Sorry, cannot find sfio on this machine." >&4
15394                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15395                 val="$undef"
15396                 ;;
15397         esac
15398         ;;
15399 esac
15400 set d_sfio
15401 eval $setvar
15402 case "$d_sfio" in
15403 $define) usesfio='true';;
15404 *) usesfio='false';;
15405 esac
15406 case "$d_sfio" in
15407 $define) ;;
15408 *)      : Remove sfio from list of libraries to use
15409         case "$libs" in
15410         *-lsfio*)
15411                 echo "Removing unneeded -lsfio from library list" >&4
15412                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15413                 shift
15414                 libs="$*"
15415                 echo "libs = $libs" >&4
15416                 ;;
15417         esac
15418 ;;
15419 esac
15420
15421
15422 : see if shmctl exists
15423 set shmctl d_shmctl
15424 eval $inlibc
15425
15426 : see if shmget exists
15427 set shmget d_shmget
15428 eval $inlibc
15429
15430 : see if shmat exists
15431 set shmat d_shmat
15432 eval $inlibc
15433 : see what shmat returns
15434 case "$d_shmat" in
15435 "$define")
15436         $cat >shmat.c <<'END'
15437 #include <sys/shm.h>
15438 void *shmat();
15439 END
15440         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15441                 shmattype='void *'
15442         else
15443                 shmattype='char *'
15444         fi
15445         echo "and it returns ($shmattype)." >&4
15446         : see if a prototype for shmat is available
15447         xxx=`./findhdr sys/shm.h`
15448         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15449         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15450                 val="$define"
15451         else
15452                 val="$undef"
15453         fi
15454         $rm -f shmat.[co]
15455         ;;
15456 *)
15457         val="$undef"
15458         ;;
15459 esac
15460 set d_shmatprototype
15461 eval $setvar
15462
15463 : see if shmdt exists
15464 set shmdt d_shmdt
15465 eval $inlibc
15466
15467 : see how much of the 'shm*(2)' library is present.
15468 h_shm=true
15469 echo " "
15470 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15471 *"$undef"*) h_shm=false;;
15472 esac
15473 case "$osname" in
15474 freebsd)
15475     case "`ipcs 2>&1`" in
15476     "SVID shared memory"*"not configured"*)
15477         echo "Your $osname does not have the shm*(2) configured." >&4
15478         h_shm=false
15479         val="$undef"
15480         set shmctl d_shmctl
15481         evat $setvar
15482         set shmget d_shmget
15483         evat $setvar
15484         set shmat d_shmat
15485         evat $setvar
15486         set shmdt d_shmdt
15487         evat $setvar
15488         ;;
15489     esac
15490     ;;
15491 esac
15492 : we could also check for sys/ipc.h ...
15493 if $h_shm && $test `./findhdr sys/shm.h`; then
15494         echo "You have the full shm*(2) library." >&4
15495         val="$define"
15496 else
15497         echo "You don't have the full shm*(2) library." >&4
15498         val="$undef"
15499 fi
15500 set d_shm
15501 eval $setvar
15502
15503 echo " "
15504 : see if we have sigaction
15505 if set sigaction val -f d_sigaction; eval $csym; $val; then
15506         echo 'sigaction() found.' >&4
15507         $cat > try.c <<'EOP'
15508 #include <stdio.h>
15509 #include <sys/types.h>
15510 #include <signal.h>
15511 int main()
15512 {
15513     struct sigaction act, oact;
15514     act.sa_flags = 0;
15515     oact.sa_handler = 0;
15516     /* so that act and oact are used */
15517     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15518 }
15519 EOP
15520         set try
15521         if eval $compile_ok; then
15522                 val="$define"
15523         else
15524                 echo "But you don't seem to have a useable struct sigaction." >&4
15525                 val="$undef"
15526         fi
15527 else
15528         echo 'sigaction NOT found.' >&4
15529         val="$undef"
15530 fi
15531 set d_sigaction; eval $setvar
15532 $rm -f try try$_o try.c
15533
15534 : see if sigprocmask exists
15535 set sigprocmask d_sigprocmask
15536 eval $inlibc
15537
15538 : see if sigsetjmp exists
15539 echo " "
15540 case "$d_sigsetjmp" in
15541 '')
15542         $cat >try.c <<'EOP'
15543 #include <setjmp.h>
15544 sigjmp_buf env;
15545 int set = 1;
15546 int main()
15547 {
15548         if (sigsetjmp(env,1))
15549                 exit(set);
15550         set = 0;
15551         siglongjmp(env, 1);
15552         exit(1);
15553 }
15554 EOP
15555         set try
15556         if eval $compile; then
15557                 if $run ./try >/dev/null 2>&1; then
15558                         echo "POSIX sigsetjmp found." >&4
15559                         val="$define"
15560                 else
15561                         $cat >&4 <<EOM
15562 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15563 I'll ignore them.
15564 EOM
15565                         val="$undef"
15566                 fi
15567         else
15568                 echo "sigsetjmp not found." >&4
15569                 val="$undef"
15570         fi
15571         ;;
15572 *) val="$d_sigsetjmp"
15573         case "$d_sigsetjmp" in
15574         $define) echo "POSIX sigsetjmp found." >&4;;
15575         $undef) echo "sigsetjmp not found." >&4;;
15576         esac
15577         ;;
15578 esac
15579 set d_sigsetjmp
15580 eval $setvar
15581 $rm -f try.c try
15582
15583 : see if sockatmark exists
15584 set sockatmark d_sockatmark
15585 eval $inlibc
15586
15587 : see if prototype for sockatmark is available
15588 echo " "
15589 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15590 eval $hasproto
15591
15592 : see if socks5_init exists
15593 set socks5_init d_socks5_init
15594 eval $inlibc
15595
15596 : see if srand48_r exists
15597 set srand48_r d_srand48_r
15598 eval $inlibc
15599 case "$d_srand48_r" in
15600 "$define")
15601         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15602         case "$d_srand48_r_proto:$usethreads" in
15603         ":define")      d_srand48_r_proto=define
15604                 set d_srand48_r_proto srand48_r $hdrs
15605                 eval $hasproto ;;
15606         *)      ;;
15607         esac
15608         case "$d_srand48_r_proto" in
15609         define)
15610         case "$srand48_r_proto" in
15611         ''|0) try='int srand48_r(long, struct drand48_data*);'
15612         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15613         esac
15614         case "$srand48_r_proto" in
15615         ''|0)   d_srand48_r=undef
15616                 srand48_r_proto=0
15617                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15618         * )     case "$srand48_r_proto" in
15619                 REENTRANT_PROTO*) ;;
15620                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15621                 esac
15622                 echo "Prototype: $try" ;;
15623         esac
15624         ;;
15625         *)      case "$usethreads" in
15626                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15627                 esac
15628                 d_srand48_r=undef
15629                 srand48_r_proto=0
15630                 ;;
15631         esac
15632         ;;
15633 *)      srand48_r_proto=0
15634         ;;
15635 esac
15636
15637 : see if srandom_r exists
15638 set srandom_r d_srandom_r
15639 eval $inlibc
15640 case "$d_srandom_r" in
15641 "$define")
15642         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15643         case "$d_srandom_r_proto:$usethreads" in
15644         ":define")      d_srandom_r_proto=define
15645                 set d_srandom_r_proto srandom_r $hdrs
15646                 eval $hasproto ;;
15647         *)      ;;
15648         esac
15649         case "$d_srandom_r_proto" in
15650         define)
15651         case "$srandom_r_proto" in
15652         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15653         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15654         esac
15655         case "$srandom_r_proto" in
15656         ''|0)   d_srandom_r=undef
15657                 srandom_r_proto=0
15658                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15659         * )     case "$srandom_r_proto" in
15660                 REENTRANT_PROTO*) ;;
15661                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15662                 esac
15663                 echo "Prototype: $try" ;;
15664         esac
15665         ;;
15666         *)      case "$usethreads" in
15667                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15668                 esac
15669                 d_srandom_r=undef
15670                 srandom_r_proto=0
15671                 ;;
15672         esac
15673         ;;
15674 *)      srandom_r_proto=0
15675         ;;
15676 esac
15677
15678 : see if prototype for setresgid is available
15679 echo " "
15680 set d_sresgproto setresgid $i_unistd unistd.h
15681 eval $hasproto
15682
15683 : see if prototype for setresuid is available
15684 echo " "
15685 set d_sresuproto setresuid $i_unistd unistd.h
15686 eval $hasproto
15687
15688 : see if sys/stat.h is available
15689 set sys/stat.h i_sysstat
15690 eval $inhdr
15691
15692
15693 : see if stat knows about block sizes
15694 echo " "
15695 echo "Checking to see if your struct stat has st_blocks field..." >&4
15696 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15697 eval $hasfield
15698
15699
15700 : see if this is a sys/vfs.h system
15701 set sys/vfs.h i_sysvfs
15702 eval $inhdr
15703
15704
15705 : see if this is a sys/statfs.h system
15706 set sys/statfs.h i_sysstatfs
15707 eval $inhdr
15708
15709
15710 echo " "
15711 echo "Checking to see if your system supports struct statfs..." >&4
15712 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
15713 eval $hasstruct
15714 case "$d_statfs_s" in
15715 "$define")      echo "Yes, it does."   ;;
15716 *)              echo "No, it doesn't." ;;
15717 esac
15718
15719
15720
15721 : see if struct statfs knows about f_flags
15722 case "$d_statfs_s" in
15723 define) 
15724         echo " "
15725         echo "Checking to see if your struct statfs has f_flags field..." >&4
15726         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
15727         eval $hasfield
15728         ;;
15729 *)      val="$undef"
15730         set d_statfs_f_flags
15731         eval $setvar
15732         ;;
15733 esac
15734 case "$d_statfs_f_flags" in
15735 "$define")      echo "Yes, it does."   ;;
15736 *)              echo "No, it doesn't." ;;
15737 esac
15738
15739 : see if _ptr and _cnt from stdio act std
15740 echo " "
15741
15742 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15743         echo "(Looks like you have stdio.h from BSD.)"
15744         case "$stdio_ptr" in
15745         '') stdio_ptr='((fp)->_p)'
15746                 ptr_lval=$define
15747                 ;;
15748         *)      ptr_lval=$d_stdio_ptr_lval;;
15749         esac
15750         case "$stdio_cnt" in
15751         '') stdio_cnt='((fp)->_r)'
15752                 cnt_lval=$define
15753                 ;;
15754         *)      cnt_lval=$d_stdio_cnt_lval;;
15755         esac
15756         case "$stdio_base" in
15757         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15758         esac
15759         case "$stdio_bufsiz" in
15760         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15761         esac
15762 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15763         echo "(Looks like you have stdio.h from Linux.)"
15764         case "$stdio_ptr" in
15765         '') stdio_ptr='((fp)->_IO_read_ptr)'
15766                 ptr_lval=$define
15767                 ;;
15768         *)      ptr_lval=$d_stdio_ptr_lval;;
15769         esac
15770         case "$stdio_cnt" in
15771         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15772                 cnt_lval=$undef
15773                 ;;
15774         *)      cnt_lval=$d_stdio_cnt_lval;;
15775         esac
15776         case "$stdio_base" in
15777         '') stdio_base='((fp)->_IO_read_base)';;
15778         esac
15779         case "$stdio_bufsiz" in
15780         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15781         esac
15782 else
15783         case "$stdio_ptr" in
15784         '') stdio_ptr='((fp)->_ptr)'
15785                 ptr_lval=$define
15786                 ;;
15787         *)      ptr_lval=$d_stdio_ptr_lval;;
15788         esac
15789         case "$stdio_cnt" in
15790         '') stdio_cnt='((fp)->_cnt)'
15791                 cnt_lval=$define
15792                 ;;
15793         *)      cnt_lval=$d_stdio_cnt_lval;;
15794         esac
15795         case "$stdio_base" in
15796         '') stdio_base='((fp)->_base)';;
15797         esac
15798         case "$stdio_bufsiz" in
15799         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15800         esac
15801 fi
15802
15803 : test whether _ptr and _cnt really work
15804 echo "Checking how std your stdio is..." >&4
15805 $cat >try.c <<EOP
15806 #include <stdio.h>
15807 #define FILE_ptr(fp)    $stdio_ptr
15808 #define FILE_cnt(fp)    $stdio_cnt
15809 int main() {
15810         FILE *fp = fopen("try.c", "r");
15811         char c = getc(fp);
15812         if (
15813                 18 <= FILE_cnt(fp) &&
15814                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15815         )
15816                 exit(0);
15817         exit(1);
15818 }
15819 EOP
15820 val="$undef"
15821 set try
15822 if eval $compile && $to try.c; then
15823         if $run ./try; then
15824                 echo "Your stdio acts pretty std."
15825                 val="$define"
15826         else
15827                 echo "Your stdio isn't very std."
15828         fi
15829 else
15830         echo "Your stdio doesn't appear very std."
15831 fi
15832 $rm -f try.c try
15833
15834 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15835 # direct buffer manipulation no longer works.  The Configure tests
15836 # should be changed to correctly detect this, but until then,
15837 # the following check should at least let perl compile and run.
15838 # (This quick fix should be updated before 5.8.1.)
15839 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15840 # A. Dougherty, June 3, 2002.
15841 case "$d_gnulibc" in
15842 $define)
15843         case "$gnulibc_version" in
15844         2.[01]*)  ;;
15845         2.2) ;;
15846         2.2.[0-9]) ;;
15847         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15848                 val="$undef"
15849                 ;;
15850         esac
15851         ;;
15852 esac
15853 set d_stdstdio
15854 eval $setvar
15855
15856 : Can _ptr be used as an lvalue?
15857 case "$d_stdstdio$ptr_lval" in
15858 $define$define) val=$define ;;
15859 *) val=$undef ;;
15860 esac
15861 set d_stdio_ptr_lval
15862 eval $setvar
15863
15864 : Can _cnt be used as an lvalue?
15865 case "$d_stdstdio$cnt_lval" in
15866 $define$define) val=$define ;;
15867 *) val=$undef ;;
15868 esac
15869 set d_stdio_cnt_lval
15870 eval $setvar
15871
15872
15873 : test whether setting _ptr sets _cnt as a side effect
15874 d_stdio_ptr_lval_sets_cnt="$undef"
15875 d_stdio_ptr_lval_nochange_cnt="$undef"
15876 case "$d_stdio_ptr_lval$d_stdstdio" in
15877 $define$define)
15878         echo "Checking to see what happens if we set the stdio ptr..." >&4
15879 $cat >try.c <<EOP
15880 #include <stdio.h>
15881 /* Can we scream? */
15882 /* Eat dust sed :-) */
15883 /* In the buffer space, no one can hear you scream. */
15884 #define FILE_ptr(fp)    $stdio_ptr
15885 #define FILE_cnt(fp)    $stdio_cnt
15886 #include <sys/types.h>
15887 int main() {
15888         FILE *fp = fopen("try.c", "r");
15889         int c;
15890         char *ptr;
15891         size_t cnt;
15892         if (!fp) {
15893             puts("Fail even to read");
15894             exit(1);
15895         }
15896         c = getc(fp); /* Read away the first # */
15897         if (c == EOF) {
15898             puts("Fail even to read");
15899             exit(1);
15900         }
15901         if (!(
15902                 18 <= FILE_cnt(fp) &&
15903                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15904         )) {
15905                 puts("Fail even to read");
15906                 exit (1);
15907         }
15908         ptr = (char*) FILE_ptr(fp);
15909         cnt = (size_t)FILE_cnt(fp);
15910
15911         FILE_ptr(fp) += 42;
15912
15913         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15914                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15915                 exit (1);
15916         }
15917         if (FILE_cnt(fp) <= 20) {
15918                 printf ("Fail (<20 chars to test)");
15919                 exit (1);
15920         }
15921         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15922                 puts("Fail compare");
15923                 exit (1);
15924         }
15925         if (cnt == FILE_cnt(fp)) {
15926                 puts("Pass_unchanged");
15927                 exit (0);
15928         }       
15929         if (FILE_cnt(fp) == (cnt - 42)) {
15930                 puts("Pass_changed");
15931                 exit (0);
15932         }
15933         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15934         return 1;
15935
15936 }
15937 EOP
15938         set try
15939         if eval $compile && $to try.c; then
15940                 case `$run ./try` in
15941                 Pass_changed)
15942                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15943                         d_stdio_ptr_lval_sets_cnt="$define" ;;
15944                 Pass_unchanged)
15945                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
15946                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
15947                 Fail*)
15948                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
15949                 *)
15950                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
15951         esac
15952         else
15953                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
15954         fi
15955         $rm -f try.c try
15956         ;;
15957 esac
15958
15959 : see if _base is also standard
15960 val="$undef"
15961 case "$d_stdstdio" in
15962 $define)
15963         $cat >try.c <<EOP
15964 #include <stdio.h>
15965 #define FILE_base(fp)   $stdio_base
15966 #define FILE_bufsiz(fp) $stdio_bufsiz
15967 int main() {
15968         FILE *fp = fopen("try.c", "r");
15969         char c = getc(fp);
15970         if (
15971                 19 <= FILE_bufsiz(fp) &&
15972                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
15973         )
15974                 exit(0);
15975         exit(1);
15976 }
15977 EOP
15978         set try
15979         if eval $compile && $to try.c; then
15980                 if $run ./try; then
15981                         echo "And its _base field acts std."
15982                         val="$define"
15983                 else
15984                         echo "But its _base field isn't std."
15985                 fi
15986         else
15987                 echo "However, it seems to be lacking the _base field."
15988         fi
15989         $rm -f try.c try
15990         ;;
15991 esac
15992 set d_stdiobase
15993 eval $setvar
15994
15995 $cat >&4 <<EOM
15996 Checking how to access stdio streams by file descriptor number...
15997 EOM
15998 case "$stdio_stream_array" in
15999 '')     $cat >try.c <<EOCP
16000 #include <stdio.h>
16001 int main() {
16002   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16003     printf("yes\n");
16004 }
16005 EOCP
16006         for s in _iob __iob __sF
16007         do
16008                 set try -DSTDIO_STREAM_ARRAY=$s
16009                 if eval $compile; then
16010                         case "`$run ./try`" in
16011                         yes)    stdio_stream_array=$s; break ;;
16012                         esac
16013                 fi
16014         done
16015         $rm -f try.* try$exe_ext
16016 esac
16017 case "$stdio_stream_array" in
16018 '')     $cat >&4 <<EOM
16019 I can't figure out how to access stdio streams by file descriptor number.
16020 EOM
16021         d_stdio_stream_array="$undef"
16022         ;;
16023 *)      $cat >&4 <<EOM
16024 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16025 EOM
16026         d_stdio_stream_array="$define"
16027         ;;
16028 esac
16029
16030 : see if strcoll exists
16031 set strcoll d_strcoll
16032 eval $inlibc
16033
16034 : check for structure copying
16035 echo " "
16036 echo "Checking to see if your C compiler can copy structs..." >&4
16037 $cat >try.c <<'EOCP'
16038 int main()
16039 {
16040         struct blurfl {
16041                 int dyick;
16042         } foo, bar;
16043
16044         foo = bar;
16045 }
16046 EOCP
16047 if $cc -c try.c >/dev/null 2>&1 ; then
16048         val="$define"
16049         echo "Yup, it can."
16050 else
16051         val="$undef"
16052         echo "Nope, it can't."
16053 fi
16054 set d_strctcpy
16055 eval $setvar
16056 $rm -f try.*
16057
16058 : see if strerror and/or sys_errlist[] exist
16059 echo " "
16060 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16061     if set strerror val -f d_strerror; eval $csym; $val; then
16062                 echo 'strerror() found.' >&4
16063                 d_strerror="$define"
16064                 d_strerrm='strerror(e)'
16065                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16066                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16067                         d_syserrlst="$define"
16068                 else
16069                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16070                         d_syserrlst="$undef"
16071                 fi
16072     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16073                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16074                 echo 'strerror() found in string header.' >&4
16075                 d_strerror="$define"
16076                 d_strerrm='strerror(e)'
16077                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16078                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16079                                 d_syserrlst="$define"
16080                 else
16081                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16082                         d_syserrlst="$undef"
16083                 fi
16084     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16085                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16086                 d_strerror="$undef"
16087                 d_syserrlst="$define"
16088                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16089     else
16090                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16091                 d_strerror="$undef"
16092                 d_syserrlst="$undef"
16093                 d_strerrm='"unknown"'
16094     fi
16095 fi
16096
16097 : see if strerror_r exists
16098 set strerror_r d_strerror_r
16099 eval $inlibc
16100 case "$d_strerror_r" in
16101 "$define")
16102         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16103         case "$d_strerror_r_proto:$usethreads" in
16104         ":define")      d_strerror_r_proto=define
16105                 set d_strerror_r_proto strerror_r $hdrs
16106                 eval $hasproto ;;
16107         *)      ;;
16108         esac
16109         case "$d_strerror_r_proto" in
16110         define)
16111         case "$strerror_r_proto" in
16112         ''|0) try='int strerror_r(int, char*, size_t);'
16113         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16114         esac
16115         case "$strerror_r_proto" in
16116         ''|0) try='int strerror_r(int, char*, int);'
16117         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16118         esac
16119         case "$strerror_r_proto" in
16120         ''|0) try='char* strerror_r(int, char*, size_t);'
16121         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16122         esac
16123         case "$strerror_r_proto" in
16124         ''|0)   d_strerror_r=undef
16125                 strerror_r_proto=0
16126                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16127         * )     case "$strerror_r_proto" in
16128                 REENTRANT_PROTO*) ;;
16129                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16130                 esac
16131                 echo "Prototype: $try" ;;
16132         esac
16133         ;;
16134         *)      case "$usethreads" in
16135                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16136                 esac
16137                 d_strerror_r=undef
16138                 strerror_r_proto=0
16139                 ;;
16140         esac
16141         ;;
16142 *)      strerror_r_proto=0
16143         ;;
16144 esac
16145
16146 : see if strftime exists
16147 set strftime d_strftime
16148 eval $inlibc
16149
16150 : see if strtod exists
16151 set strtod d_strtod
16152 eval $inlibc
16153
16154 : see if strtol exists
16155 set strtol d_strtol
16156 eval $inlibc
16157
16158 : see if strtold exists
16159 set strtold d_strtold
16160 eval $inlibc
16161
16162 : see if strtoll exists
16163 set strtoll d_strtoll
16164 eval $inlibc
16165
16166 case "$d_longlong-$d_strtoll" in
16167 "$define-$define")
16168         $cat <<EOM
16169 Checking whether your strtoll() works okay...
16170 EOM
16171         $cat >try.c <<'EOCP'
16172 #include <errno.h>
16173 #ifdef __hpux
16174 #define strtoll __strtoll
16175 #endif
16176 #ifdef __EMX__
16177 #define strtoll _strtoll
16178 #endif
16179 #include <stdio.h>
16180 extern long long int strtoll(char *s, char **, int); 
16181 static int bad = 0;
16182 int check(char *s, long long ell, int een) {
16183         long long gll;
16184         errno = 0;
16185         gll = strtoll(s, 0, 10);
16186         if (!((gll == ell) && (errno == een)))
16187                 bad++;
16188 }
16189 int main() {
16190         check(" 1",                                      1LL, 0);
16191         check(" 0",                                      0LL, 0);
16192         check("-1",                                     -1LL, 0);
16193         check("-9223372036854775808", -9223372036854775808LL, 0);
16194         check("-9223372036854775808", -9223372036854775808LL, 0);
16195         check(" 9223372036854775807",  9223372036854775807LL, 0);
16196         check("-9223372036854775808", -9223372036854775808LL, 0);
16197         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16198         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16199         if (!bad)
16200                 printf("ok\n");
16201 }
16202 EOCP
16203         set try
16204         if eval $compile; then
16205                 yyy=`$run ./try`
16206                 case "$yyy" in
16207                 ok) echo "Your strtoll() seems to be working okay." ;;
16208                 *) cat <<EOM >&4
16209 Your strtoll() doesn't seem to be working okay.
16210 EOM
16211                    d_strtoll="$undef"
16212                    ;;
16213                 esac
16214         else
16215                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16216                 d_strtoll="$undef"
16217         fi
16218         ;;
16219 esac
16220
16221 : see if strtoq exists
16222 set strtoq d_strtoq
16223 eval $inlibc
16224
16225 : see if strtoul exists
16226 set strtoul d_strtoul
16227 eval $inlibc
16228
16229 case "$d_strtoul" in
16230 "$define")
16231         $cat <<EOM
16232 Checking whether your strtoul() works okay...
16233 EOM
16234         $cat >try.c <<'EOCP'
16235 #include <errno.h>
16236 #include <stdio.h>
16237 extern unsigned long int strtoul(char *s, char **, int); 
16238 static int bad = 0;
16239 void check(char *s, unsigned long eul, int een) {
16240         unsigned long gul;
16241         errno = 0;
16242         gul = strtoul(s, 0, 10);
16243         if (!((gul == eul) && (errno == een)))
16244                 bad++;
16245 }
16246 int main() {
16247         check(" 1", 1L, 0);
16248         check(" 0", 0L, 0);
16249 EOCP
16250         case "$longsize" in
16251         8)
16252             $cat >>try.c <<'EOCP'
16253         check("18446744073709551615", 18446744073709551615UL, 0);
16254         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16255 #if 0 /* strtoul() for /^-/ strings is undefined. */
16256         check("-1", 18446744073709551615UL, 0);
16257         check("-18446744073709551614", 2, 0);
16258         check("-18446744073709551615", 1, 0);
16259         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16260         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16261 #endif
16262 EOCP
16263                 ;;
16264         4)
16265                     $cat >>try.c <<'EOCP'
16266         check("4294967295", 4294967295UL, 0);
16267         check("4294967296", 4294967295UL, ERANGE);
16268 #if 0 /* strtoul() for /^-/ strings is undefined. */
16269         check("-1", 4294967295UL, 0);
16270         check("-4294967294", 2, 0);
16271         check("-4294967295", 1, 0);
16272         check("-4294967296", 4294967295UL, ERANGE);
16273         check("-4294967297", 4294967295UL, ERANGE);
16274 #endif
16275 EOCP
16276                 ;;
16277         *)
16278 : Should we write these tests to be more portable by sprintf-ing
16279 : ~0 and then manipulating that char string as input for strtol?
16280                 ;;
16281         esac
16282         $cat >>try.c <<'EOCP'
16283         if (!bad)
16284                 printf("ok\n");
16285         return 0;
16286 }
16287 EOCP
16288         set try
16289         if eval $compile; then
16290                 case "`$run ./try`" in
16291                 ok) echo "Your strtoul() seems to be working okay." ;;
16292                 *) cat <<EOM >&4
16293 Your strtoul() doesn't seem to be working okay.
16294 EOM
16295                    d_strtoul="$undef"
16296                    ;;
16297                 esac
16298         fi
16299         ;;
16300 esac
16301
16302 : see if strtoull exists
16303 set strtoull d_strtoull
16304 eval $inlibc
16305
16306 case "$d_longlong-$d_strtoull" in
16307 "$define-$define")
16308         $cat <<EOM
16309 Checking whether your strtoull() works okay...
16310 EOM
16311         $cat >try.c <<'EOCP'
16312 #include <errno.h>
16313 #ifdef __hpux
16314 #define strtoull __strtoull
16315 #endif
16316 #include <stdio.h>
16317 extern unsigned long long int strtoull(char *s, char **, int); 
16318 static int bad = 0;
16319 int check(char *s, long long eull, int een) {
16320         long long gull;
16321         errno = 0;
16322         gull = strtoull(s, 0, 10);
16323         if (!((gull == eull) && (errno == een)))
16324                 bad++;
16325 }
16326 int main() {
16327         check(" 1",                                        1LL, 0);
16328         check(" 0",                                        0LL, 0);
16329         check("18446744073709551615",  18446744073709551615ULL, 0);
16330         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16331 #if 0 /* strtoull() for /^-/ strings is undefined. */
16332         check("-1",                    18446744073709551615ULL, 0);
16333         check("-18446744073709551614",                     2LL, 0);
16334         check("-18446744073709551615",                     1LL, 0);
16335         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16336         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16337 #endif
16338         if (!bad)
16339                 printf("ok\n");
16340 }
16341 EOCP
16342         set try
16343         if eval $compile; then
16344                 case "`$run ./try`" in
16345                 ok) echo "Your strtoull() seems to be working okay." ;;
16346                 *) cat <<EOM >&4
16347 Your strtoull() doesn't seem to be working okay.
16348 EOM
16349                    d_strtoull="$undef"
16350                    ;;
16351                 esac
16352         fi
16353         ;;
16354 esac
16355
16356 : see if strtouq exists
16357 set strtouq d_strtouq
16358 eval $inlibc
16359
16360 case "$d_strtouq" in
16361 "$define")
16362         $cat <<EOM
16363 Checking whether your strtouq() works okay...
16364 EOM
16365         $cat >try.c <<'EOCP'
16366 #include <errno.h>
16367 #include <stdio.h>
16368 extern unsigned long long int strtouq(char *s, char **, int); 
16369 static int bad = 0;
16370 void check(char *s, unsigned long long eull, int een) {
16371         unsigned long long gull;
16372         errno = 0;
16373         gull = strtouq(s, 0, 10);
16374         if (!((gull == eull) && (errno == een)))
16375                 bad++;
16376 }
16377 int main() {
16378         check(" 1",                                        1LL, 0);
16379         check(" 0",                                        0LL, 0);
16380         check("18446744073709551615",  18446744073709551615ULL, 0);
16381         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16382 #if 0 /* strtouq() for /^-/ strings is undefined. */
16383         check("-1",                    18446744073709551615ULL, 0);
16384         check("-18446744073709551614",                     2LL, 0);
16385         check("-18446744073709551615",                     1LL, 0);
16386         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16387         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16388 #endif
16389         if (!bad)
16390                 printf("ok\n");
16391         return 0;
16392 }
16393 EOCP
16394         set try
16395         if eval $compile; then
16396                 case "`$run ./try`" in
16397                 ok) echo "Your strtouq() seems to be working okay." ;;
16398                 *) cat <<EOM >&4
16399 Your strtouq() doesn't seem to be working okay.
16400 EOM
16401                    d_strtouq="$undef"
16402                    ;;
16403                 esac
16404         fi
16405         ;;
16406 esac
16407
16408 : see if strxfrm exists
16409 set strxfrm d_strxfrm
16410 eval $inlibc
16411
16412 : see if symlink exists
16413 set symlink d_symlink
16414 eval $inlibc
16415
16416 : see if syscall exists
16417 set syscall d_syscall
16418 eval $inlibc
16419
16420 : see if prototype for syscall is available
16421 echo " "
16422 set d_syscallproto syscall $i_unistd unistd.h
16423 eval $hasproto
16424
16425 : see if sysconf exists
16426 set sysconf d_sysconf
16427 eval $inlibc
16428
16429 : see if system exists
16430 set system d_system
16431 eval $inlibc
16432
16433 : see if tcgetpgrp exists
16434 set tcgetpgrp d_tcgetpgrp
16435 eval $inlibc
16436
16437 : see if tcsetpgrp exists
16438 set tcsetpgrp d_tcsetpgrp
16439 eval $inlibc
16440
16441 : see if prototype for telldir is available
16442 echo " "
16443 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16444 eval $hasproto
16445
16446 : see if time exists
16447 echo " "
16448 if test "X$d_time" = X -o X"$timetype" = X; then
16449     if set time val -f d_time; eval $csym; $val; then
16450                 echo 'time() found.' >&4
16451                 val="$define"
16452                 rp="What is the type returned by time() on this system?"
16453                 set time_t timetype long stdio.h sys/types.h
16454                 eval $typedef_ask
16455     else
16456                 echo 'time() not found, hope that will do.' >&4
16457                 val="$undef"
16458                 timetype='int';
16459     fi
16460     set d_time
16461     eval $setvar
16462 fi
16463
16464 : see if this is a sys/times.h system
16465 set sys/times.h i_systimes
16466 eval $inhdr
16467
16468 : see if times exists
16469 echo " "
16470 if set times val -f d_times; eval $csym; $val; then
16471         echo 'times() found.' >&4
16472         d_times="$define"
16473         inc=''
16474         case "$i_systimes" in
16475         "$define") inc='sys/times.h';;
16476         esac
16477         rp="What is the type returned by times() on this system?"
16478         set clock_t clocktype long stdio.h sys/types.h $inc
16479         eval $typedef_ask
16480 else
16481         echo 'times() NOT found, hope that will do.' >&4
16482         d_times="$undef"
16483         clocktype='int'
16484 fi
16485
16486 : see if tmpnam_r exists
16487 set tmpnam_r d_tmpnam_r
16488 eval $inlibc
16489 case "$d_tmpnam_r" in
16490 "$define")
16491         hdrs="$i_systypes sys/types.h define stdio.h "
16492         case "$d_tmpnam_r_proto:$usethreads" in
16493         ":define")      d_tmpnam_r_proto=define
16494                 set d_tmpnam_r_proto tmpnam_r $hdrs
16495                 eval $hasproto ;;
16496         *)      ;;
16497         esac
16498         case "$d_tmpnam_r_proto" in
16499         define)
16500         case "$tmpnam_r_proto" in
16501         ''|0) try='char* tmpnam_r(char*);'
16502         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16503         esac
16504         case "$tmpnam_r_proto" in
16505         ''|0)   d_tmpnam_r=undef
16506                 tmpnam_r_proto=0
16507                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16508         * )     case "$tmpnam_r_proto" in
16509                 REENTRANT_PROTO*) ;;
16510                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16511                 esac
16512                 echo "Prototype: $try" ;;
16513         esac
16514         ;;
16515         *)      case "$usethreads" in
16516                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16517                 esac
16518                 d_tmpnam_r=undef
16519                 tmpnam_r_proto=0
16520                 ;;
16521         esac
16522         ;;
16523 *)      tmpnam_r_proto=0
16524         ;;
16525 esac
16526
16527 : see if truncate exists
16528 set truncate d_truncate
16529 eval $inlibc
16530
16531 : see if ttyname_r exists
16532 set ttyname_r d_ttyname_r
16533 eval $inlibc
16534 case "$d_ttyname_r" in
16535 "$define")
16536         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16537         case "$d_ttyname_r_proto:$usethreads" in
16538         ":define")      d_ttyname_r_proto=define
16539                 set d_ttyname_r_proto ttyname_r $hdrs
16540                 eval $hasproto ;;
16541         *)      ;;
16542         esac
16543         case "$d_ttyname_r_proto" in
16544         define)
16545         case "$ttyname_r_proto" in
16546         ''|0) try='int ttyname_r(int, char*, size_t);'
16547         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16548         esac
16549         case "$ttyname_r_proto" in
16550         ''|0) try='int ttyname_r(int, char*, int);'
16551         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16552         esac
16553         case "$ttyname_r_proto" in
16554         ''|0) try='char* ttyname_r(int, char*, int);'
16555         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16556         esac
16557         case "$ttyname_r_proto" in
16558         ''|0)   d_ttyname_r=undef
16559                 ttyname_r_proto=0
16560                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16561         * )     case "$ttyname_r_proto" in
16562                 REENTRANT_PROTO*) ;;
16563                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16564                 esac
16565                 echo "Prototype: $try" ;;
16566         esac
16567         ;;
16568         *)      case "$usethreads" in
16569                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16570                 esac
16571                 d_ttyname_r=undef
16572                 ttyname_r_proto=0
16573                 ;;
16574         esac
16575         ;;
16576 *)      ttyname_r_proto=0
16577         ;;
16578 esac
16579
16580 : see if tzname[] exists
16581 echo " "
16582 if set tzname val -a d_tzname; eval $csym; $val; then
16583         val="$define"
16584         echo 'tzname[] found.' >&4
16585 else
16586         val="$undef"
16587         echo 'tzname[] NOT found.' >&4
16588 fi
16589 set d_tzname
16590 eval $setvar
16591
16592 case "$osname" in
16593 next|rhapsody|darwin) multiarch="$define" ;;
16594 esac
16595 case "$multiarch" in
16596 ''|[nN]*) multiarch="$undef" ;;
16597 esac
16598
16599 : check for ordering of bytes in a UV
16600 echo " "
16601 case "$usecrosscompile$multiarch" in
16602 *$define*)
16603         $cat <<EOM
16604 You seem to be either cross-compiling or doing a multiarchitecture build,
16605 skipping the byteorder check.
16606
16607 EOM
16608         byteorder='ffff'
16609         ;;
16610 *)
16611         case "$byteorder" in
16612         '')
16613                 $cat <<'EOM'
16614 In the following, larger digits indicate more significance.  A big-endian
16615 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16616 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16617 machines may have weird orders like 3412.  A Cray will report 87654321,
16618 an Alpha will report 12345678. If the test program works the default is
16619 probably right.
16620 I'm now running the test program...
16621 EOM
16622                 $cat >try.c <<EOCP
16623 #include <stdio.h>
16624 #include <sys/types.h>
16625 typedef $uvtype UV;
16626 int main()
16627 {
16628         int i;
16629         union {
16630                 UV l;
16631                 char c[$uvsize];
16632         } u;
16633
16634         if ($uvsize > 4)
16635                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16636         else
16637                 u.l = (UV)0x04030201;
16638         for (i = 0; i < $uvsize; i++)
16639                 printf("%c", u.c[i]+'0');
16640         printf("\n");
16641         exit(0);
16642 }
16643 EOCP
16644                 xxx_prompt=y
16645                 set try
16646                 if eval $compile && ./try > /dev/null; then
16647                         dflt=`$run ./try`
16648                         case "$dflt" in
16649                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16650                                 echo "(The test program ran ok.)"
16651                                 echo "byteorder=$dflt"
16652                                 xxx_prompt=n
16653                         ;;
16654                         ????|????????) echo "(The test program ran ok.)" ;;
16655                         *) echo "(The test program didn't run right for some reason.)" ;;
16656                         esac
16657                 else
16658                         dflt='4321'
16659                         cat <<'EOM'
16660 (I can't seem to compile the test program.  Guessing big-endian...)
16661 EOM
16662                 fi
16663                 case "$xxx_prompt" in
16664                 y)
16665                         rp="What is the order of bytes in $uvtype?"
16666                         . ./myread
16667                         byteorder="$ans"
16668                         ;;
16669                 *)      byteorder=$dflt
16670                         ;;
16671                 esac
16672                 ;;
16673         esac
16674         $rm -f try.c try
16675         ;;
16676 esac
16677
16678
16679 $cat <<EOM
16680
16681 Checking to see whether you can access character data unalignedly...
16682 EOM
16683 case "$d_u32align" in
16684 '')   $cat >try.c <<EOCP
16685 #include <stdio.h>
16686 #define U32 $u32type
16687 #define BYTEORDER 0x$byteorder
16688 #define U8 $u8type
16689 #include <signal.h>
16690 #ifdef SIGBUS
16691 $signal_t bletch(s) int s; { exit(4); }
16692 #endif
16693 int main() {
16694 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16695     U8 buf[8];
16696     U32 *up;
16697     int i;
16698
16699     if (sizeof(U32) != 4) {
16700         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16701         exit(1);
16702     }
16703
16704     fflush(stdout);
16705
16706 #ifdef SIGBUS
16707     signal(SIGBUS, bletch);
16708 #endif
16709
16710     buf[0] = 0;
16711     buf[1] = 0;
16712     buf[2] = 0;
16713     buf[3] = 1;
16714     buf[5] = 0;
16715     buf[6] = 0;
16716     buf[7] = 0;
16717     buf[8] = 1;
16718
16719     for (i = 0; i < 4; i++) {
16720         up = (U32*)(buf + i);
16721         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16722                (*up == 1 << (8*(3-i)))  /* little-endian */
16723               )
16724            )
16725         {
16726             printf("read failed (%x)\n", *up);
16727             exit(2);
16728         }
16729     }
16730
16731     /* write test */
16732     for (i = 0; i < 4; i++) {
16733         up = (U32*)(buf + i);
16734         *up = 0xBeef;
16735         if (*up != 0xBeef) {
16736             printf("write failed (%x)\n", *up);
16737             exit(3);
16738         }
16739     }
16740
16741     exit(0);
16742 #else
16743     printf("1\n");
16744     exit(1);
16745 #endif
16746     return 0;
16747 }
16748 EOCP
16749 set try
16750 if eval $compile_ok; then
16751         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16752         $run ./try 2>&1 >/dev/null
16753         case "$?" in
16754         0)      cat >&4 <<EOM
16755 You can access character data pretty unalignedly.
16756 EOM
16757                 d_u32align="$undef"
16758                 ;;
16759         *)      cat >&4 <<EOM
16760 It seems that you must access character data in an aligned manner.
16761 EOM
16762                 d_u32align="$define"
16763                 ;;
16764         esac
16765 else
16766         rp='Can you access character data at unaligned addresses?'
16767         dflt='n'
16768         . ./myread
16769         case "$ans" in
16770         [yY]*)  d_u32align="$undef"  ;;
16771         *)      d_u32align="$define" ;;
16772         esac
16773 fi
16774 $rm -f core core.try.* try.core
16775 ;;
16776 esac
16777
16778 : see if ualarm exists
16779 set ualarm d_ualarm
16780 eval $inlibc
16781
16782 : see if umask exists
16783 set umask d_umask
16784 eval $inlibc
16785
16786 : see if unordered exists
16787 set unordered d_unordered
16788 eval $inlibc
16789
16790 : see if usleep exists
16791 set usleep d_usleep
16792 eval $inlibc
16793
16794 : see if prototype for usleep is available
16795 echo " "
16796 set d_usleepproto usleep $i_unistd unistd.h
16797 eval $hasproto
16798
16799 : see if ustat exists
16800 set ustat d_ustat
16801 eval $inlibc
16802
16803 : backward compatibility for d_hvfork
16804 if test X$d_hvfork != X; then
16805         d_vfork="$d_hvfork"
16806         d_hvfork=''
16807 fi
16808 : see if there is a vfork
16809 val=''
16810 set vfork val
16811 eval $inlibc
16812
16813 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16814 : perl on Solaris 2.x, and probably elsewhere.
16815 case "$val" in
16816 $define)
16817         echo " "
16818         case "$usevfork" in
16819         false) dflt='n';;
16820         *) dflt='y';;
16821         esac
16822         cat <<'EOM'
16823  
16824 Perl can only use a vfork() that doesn't suffer from strict
16825 restrictions on calling functions or modifying global data in
16826 the child.  For example, glibc-2.1 contains such a vfork()
16827 that is unsuitable.  If your system provides a proper fork()
16828 call, chances are that you do NOT want perl to use vfork().
16829
16830 EOM
16831         rp="Do you still want to use vfork()?"
16832         . ./myread
16833         case "$ans" in
16834         y|Y) ;;
16835         *)
16836                 echo "Ok, we won't use vfork()."
16837                 val="$undef"
16838                 ;;
16839         esac
16840         ;;
16841 esac
16842 set d_vfork
16843 eval $setvar
16844 case "$d_vfork" in
16845 $define) usevfork='true';;
16846 *) usevfork='false';;
16847 esac
16848
16849 : see if closedir exists
16850 set closedir d_closedir
16851 eval $inlibc
16852
16853 case "$d_closedir" in
16854 "$define")
16855         echo " "
16856         echo "Checking whether closedir() returns a status..." >&4
16857         cat > try.c <<EOM
16858 #$i_dirent I_DIRENT             /**/
16859 #$i_sysdir I_SYS_DIR            /**/
16860 #$i_sysndir I_SYS_NDIR          /**/
16861 #$i_systypes I_SYS_TYPES        /**/
16862
16863 #if defined(I_SYS_TYPES)
16864 #include <sys/types.h>
16865 #endif
16866 #if defined(I_DIRENT)
16867 #include <dirent.h>
16868 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16869 #include <sys/dir.h>
16870 #endif
16871 #else
16872 #ifdef I_SYS_NDIR
16873 #include <sys/ndir.h>
16874 #else
16875 #ifdef I_SYS_DIR
16876 #ifdef hp9000s500
16877 #include <ndir.h>       /* may be wrong in the future */
16878 #else
16879 #include <sys/dir.h>
16880 #endif
16881 #endif
16882 #endif
16883 #endif 
16884 int main() { return closedir(opendir(".")); }
16885 EOM
16886         set try
16887         if eval $compile_ok; then
16888                 if $run ./try > /dev/null 2>&1 ; then
16889                         echo "Yes, it does."
16890                         val="$undef"
16891                 else
16892                         echo "No, it doesn't."
16893                         val="$define"
16894                 fi
16895         else
16896                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16897                 val="$define"
16898         fi
16899         ;;
16900 *)
16901         val="$undef";
16902         ;;
16903 esac
16904 set d_void_closedir
16905 eval $setvar
16906 $rm -f try try.*
16907 : see if there is a wait4
16908 set wait4 d_wait4
16909 eval $inlibc
16910
16911 : see if waitpid exists
16912 set waitpid d_waitpid
16913 eval $inlibc
16914
16915 : see if wcstombs exists
16916 set wcstombs d_wcstombs
16917 eval $inlibc
16918
16919 : see if wctomb exists
16920 set wctomb d_wctomb
16921 eval $inlibc
16922
16923 : see if writev exists
16924 set writev d_writev
16925 eval $inlibc
16926
16927 : preserve RCS keywords in files with variable substitution, grrr
16928 Date='$Date'
16929 Id='$Id'
16930 Log='$Log'
16931 RCSfile='$RCSfile'
16932 Revision='$Revision'
16933
16934 : check for alignment requirements
16935 echo " "
16936 case "$usecrosscompile$multiarch" in
16937 *$define*)
16938         $cat <<EOM
16939 You seem to be either cross-compiling or doing a multiarchitecture build,
16940 skipping the memory alignment check.
16941
16942 EOM
16943         case "$alignbytes" in
16944         '') alignbytes=8 ;;
16945         esac
16946         ;;
16947 *)
16948         case "$alignbytes" in
16949         '') echo "Checking alignment constraints..." >&4
16950                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
16951                         $cat >try.c <<'EOCP'
16952 typedef long double NV;
16953 EOCP
16954                 else
16955                         $cat >try.c <<'EOCP'
16956 typedef double NV;
16957 EOCP
16958                 fi
16959                 $cat >>try.c <<'EOCP'
16960 #include <stdio.h>
16961 struct foobar {
16962         char foo;
16963         NV bar;
16964 } try_algn;
16965 int main()
16966 {
16967     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
16968     return(0);
16969 }
16970 EOCP
16971                 set try
16972                 if eval $compile_ok; then
16973                         dflt=`$run ./try`
16974                 else
16975                         dflt='8'
16976                         echo "(I can't seem to compile the test program...)"
16977                 fi
16978                 ;;
16979         *) dflt="$alignbytes"
16980                 ;;
16981         esac
16982         rp="Doubles must be aligned on a how-many-byte boundary?"
16983         . ./myread
16984         alignbytes="$ans"
16985         $rm -f try.c try
16986         ;;
16987 esac
16988
16989
16990 : set the base revision
16991 baserev=5.0
16992
16993 : how do we catenate cpp tokens here?
16994 echo " "
16995 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
16996 $cat >cpp_stuff.c <<'EOCP'
16997 #define RCAT(a,b)a/**/b
16998 #define ACAT(a,b)a ## b
16999 RCAT(Rei,ser)
17000 ACAT(Cir,cus)
17001 EOCP
17002 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17003 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17004         echo "Oh!  Smells like ANSI's been here." >&4
17005         echo "We can catify or stringify, separately or together!"
17006         cpp_stuff=42
17007 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17008         echo "Ah, yes!  The good old days!" >&4
17009         echo "However, in the good old days we don't know how to stringify and"
17010         echo "catify at the same time."
17011         cpp_stuff=1
17012 else
17013         $cat >&4 <<EOM
17014 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
17015 to have to edit the values of CAT[2-5] in config.h...
17016 EOM
17017         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17018 fi
17019 $rm -f cpp_stuff.*
17020
17021 : see if this is a db.h system
17022 set db.h i_db
17023 eval $inhdr
17024
17025 case "$i_db" in
17026 $define)
17027         : Check db version.
17028         echo " "
17029         echo "Checking Berkeley DB version ..." >&4
17030         $cat >try.c <<EOCP
17031 #$d_const HASCONST
17032 #ifndef HASCONST
17033 #define const
17034 #endif
17035 #include <sys/types.h>
17036 #include <stdio.h>
17037 #include <db.h>
17038 int main(int argc, char *argv[])
17039 {
17040 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17041     int Major, Minor, Patch ;
17042     unsigned long Version ;
17043     (void)db_version(&Major, &Minor, &Patch) ;
17044     if (argc == 2) {
17045         printf("%d %d %d %d %d %d\n",
17046                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17047                Major, Minor, Patch);
17048         exit(0);
17049     }
17050     printf("You have Berkeley DB Version 2 or greater.\n");
17051
17052     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17053                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17054     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17055                 Major, Minor, Patch) ;
17056
17057     /* check that db.h & libdb are compatible */
17058     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17059         printf("db.h and libdb are incompatible.\n") ;
17060         exit(3);        
17061     }
17062
17063     printf("db.h and libdb are compatible.\n") ;
17064
17065     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17066                 + DB_VERSION_PATCH ;
17067
17068     /* needs to be >= 2.3.4 */
17069     if (Version < 2003004) {
17070     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17071         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17072         exit(2);        
17073     }
17074
17075     exit(0);
17076 #else
17077 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17078     if (argc == 2) {
17079         printf("1 0 0\n");
17080         exit(0);
17081     }
17082     printf("You have Berkeley DB Version 1.\n");
17083     exit(0);    /* DB version < 2: the coast is clear. */
17084 #else
17085     exit(1);    /* <db.h> not Berkeley DB? */
17086 #endif
17087 #endif
17088 }
17089 EOCP
17090         set try
17091         if eval $compile_ok && $run ./try; then
17092                 echo 'Looks OK.' >&4
17093                 set `$run ./try 1`
17094                 db_version_major=$1
17095                 db_version_minor=$2
17096                 db_version_patch=$3
17097         else
17098                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17099                 i_db=$undef
17100                 case " $libs " in
17101                 *"-ldb "*)
17102                         : Remove db from list of libraries to use
17103                         echo "Removing unusable -ldb from library list" >&4
17104                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17105                         shift
17106                         libs="$*"
17107                         echo "libs = $libs" >&4
17108                         ;;
17109                 esac
17110         fi
17111         $rm -f try.*
17112         ;;
17113 esac
17114
17115 case "$i_db" in
17116 define)
17117         : Check the return type needed for hash 
17118         echo " "
17119         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17120         $cat >try.c <<EOCP
17121 #$d_const HASCONST
17122 #ifndef HASCONST
17123 #define const
17124 #endif
17125 #include <sys/types.h>
17126 #include <db.h>
17127
17128 #ifndef DB_VERSION_MAJOR
17129 u_int32_t hash_cb (ptr, size)
17130 const void *ptr;
17131 size_t size;
17132 {
17133 }
17134 HASHINFO info;
17135 int main()
17136 {
17137         info.hash = hash_cb;
17138 }
17139 #endif
17140 EOCP
17141         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17142                 if $contains warning try.out >>/dev/null 2>&1 ; then
17143                         db_hashtype='int'
17144                 else
17145                         db_hashtype='u_int32_t'
17146                 fi
17147         else
17148                 : XXX Maybe we should just give up here.
17149                 db_hashtype=u_int32_t
17150                 $cat try.out >&4
17151                 echo "Help:  I can't seem to compile the db test program." >&4
17152                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17153         fi
17154         $rm -f try.*
17155         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17156         ;;
17157 *)      db_hashtype=u_int32_t
17158         ;;
17159 esac
17160 case "$i_db" in
17161 define)
17162         : Check the return type needed for prefix 
17163         echo " "
17164         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17165         cat >try.c <<EOCP
17166 #$d_const HASCONST
17167 #ifndef HASCONST
17168 #define const
17169 #endif
17170 #include <sys/types.h>
17171 #include <db.h>
17172
17173 #ifndef DB_VERSION_MAJOR
17174 size_t prefix_cb (key1, key2)
17175 const DBT *key1;
17176 const DBT *key2;
17177 {
17178 }
17179 BTREEINFO info;
17180 int main()
17181 {
17182         info.prefix = prefix_cb;
17183 }
17184 #endif
17185 EOCP
17186         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17187                 if $contains warning try.out >>/dev/null 2>&1 ; then
17188                         db_prefixtype='int'
17189                 else
17190                         db_prefixtype='size_t'
17191                 fi
17192         else
17193                 db_prefixtype='size_t'
17194                 : XXX Maybe we should just give up here.
17195                 $cat try.out >&4
17196                 echo "Help:  I can't seem to compile the db test program." >&4
17197                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17198         fi
17199         $rm -f try.*
17200         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17201         ;;
17202 *)      db_prefixtype='size_t'
17203         ;;
17204 esac
17205
17206
17207 : How can we generate normalized random numbers ?
17208 echo " "
17209 echo "Looking for a random number function..." >&4
17210 case "$randfunc" in
17211 '')
17212         if set drand48 val -f; eval $csym; $val; then
17213                 dflt="drand48"
17214                 echo "Good, found drand48()." >&4
17215         elif set random val -f; eval $csym; $val; then
17216                 dflt="random"
17217                 echo "OK, found random()." >&4
17218         else
17219                 dflt="rand"
17220                 echo "Yick, looks like I have to use rand()." >&4
17221         fi
17222         echo " "
17223         ;;
17224 *)
17225         dflt="$randfunc"
17226         ;;
17227 esac
17228 cont=true
17229
17230 case "$ccflags" in
17231 *-Dmy_rand=*|*-Dmy_srand=*)
17232         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17233         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17234         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17235         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17236         ;;
17237 esac
17238
17239 while $test "$cont"; do
17240         rp="Use which function to generate random numbers?"
17241         . ./myread
17242         if $test "$ans" = "$dflt"; then
17243                 : null
17244         else
17245                 randbits=''
17246         fi
17247         randfunc="$ans"
17248         if set $ans val -f; eval $csym; $val; then
17249                 cont=''
17250         else
17251                 dflt=y
17252                 rp="I cannot find function $ans. Use that name anyway?"
17253                 . ./myread
17254                 dflt=rand
17255                 case "$ans" in
17256                         [yY]*) cont='';;
17257                 esac
17258         fi
17259         case "$cont" in
17260         '')
17261                 case "$randfunc" in
17262                 drand48)
17263                         drand01="drand48()"
17264                         seedfunc="srand48"
17265                         randbits=48
17266                         randseedtype=long
17267                         ;;
17268                 rand|random)
17269                         case "$randbits" in
17270                         '')
17271 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17272                                 $cat >try.c <<EOCP
17273 #$i_unistd I_UNISTD
17274 #$i_stdlib I_STDLIB
17275 #include <stdio.h>
17276 #ifdef I_UNISTD
17277 #  include <unistd.h>
17278 #endif
17279 #ifdef I_STDLIB
17280 #  include <stdlib.h>
17281 #endif
17282 int main()
17283 {
17284         register int i;
17285         register unsigned long tmp;
17286         register unsigned long max = 0L;
17287
17288         for (i = 1000; i; i--) {
17289                 tmp = (unsigned long) $randfunc();
17290                 if (tmp > max) max = tmp;
17291         }
17292         for (i = 0; max; i++)
17293                 max /= 2;
17294         printf("%d\n",i);
17295 }
17296 EOCP
17297                                 set try
17298                                 if eval $compile_ok; then
17299                                         dflt=`try`
17300                                 else
17301                                         dflt='?'
17302                                         echo "(I can't seem to compile the test program...)"
17303                                 fi
17304                                 ;;
17305                         *)
17306                                 dflt="$randbits"
17307                                 ;;
17308                         esac
17309                         rp="How many bits does your $randfunc() function produce?"
17310                         . ./myread
17311                         randbits="$ans"
17312                         $rm -f try.c try
17313                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17314                         seedfunc="s$randfunc"
17315                         randseedtype=unsigned
17316                         ;;
17317                 *)
17318                         dflt="31"
17319                         rp="How many bits does your $randfunc() function produce?"
17320                         . ./myread
17321                         randbits="$ans"
17322                         seedfunc="s$randfunc"
17323                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17324                         if set $seedfunc val -f; eval $csym; $val; then
17325                                 echo "(Using $seedfunc() to seed random generator)"
17326                         else
17327                                 echo "(Warning: no $seedfunc() to seed random generator)"
17328                                 seedfunc=rand
17329                         fi
17330                         randseedtype=unsigned
17331                         ;;
17332                 esac
17333                 ;;
17334         esac
17335 done
17336
17337 echo " "
17338 echo "Determining whether or not we are on an EBCDIC system..." >&4
17339 $cat >try.c <<'EOM'
17340 int main()
17341 {
17342   if ('M'==0xd4) return 0;
17343   return 1;
17344 }
17345 EOM
17346
17347 val=$undef
17348 set try
17349 if eval $compile_ok; then
17350         if $run ./try; then
17351                 echo "You seem to speak EBCDIC." >&4
17352                 val="$define"
17353         else
17354                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17355         fi
17356 else
17357         echo "I'm unable to compile the test program." >&4
17358         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17359 fi
17360 $rm -f try try.*
17361 set ebcdic
17362 eval $setvar
17363
17364 echo " "
17365 $cat >&4 <<EOM
17366 Checking how to flush all pending stdio output...
17367 EOM
17368 # I only know how to find the first 32 possibly open files on SunOS.
17369 # See also hints/sunos_4_1.sh and util.c  --AD
17370 case "$osname" in
17371 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17372 esac
17373 $cat >>try.c <<EOCP
17374 #include <stdio.h>
17375 #$i_unistd I_UNISTD
17376 #ifdef I_UNISTD
17377 # include <unistd.h>
17378 #endif
17379 #$d_sysconf HAS_SYSCONF
17380 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17381 #ifdef HAS_STDIO_STREAM_ARRAY
17382 # define STDIO_STREAM_ARRAY $stdio_stream_array
17383 #endif
17384 int main() {
17385   FILE* p;
17386   unlink("try.out");
17387   p = fopen("try.out", "w");
17388 #ifdef TRY_FPUTC
17389   fputc('x', p);
17390 #else
17391 # ifdef TRY_FPRINTF
17392   fprintf(p, "x");
17393 # endif
17394 #endif
17395 #ifdef TRY_FFLUSH_NULL
17396   fflush(NULL);
17397 #endif
17398 #ifdef TRY_FFLUSH_ALL
17399   {
17400     long open_max = -1;
17401 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17402     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17403 # else
17404 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17405     open_max = sysconf(_SC_OPEN_MAX);
17406 #  else
17407 #   ifdef FOPEN_MAX
17408     open_max = FOPEN_MAX;
17409 #   else
17410 #    ifdef OPEN_MAX
17411     open_max = OPEN_MAX;
17412 #    else
17413 #     ifdef _NFILE
17414     open_max = _NFILE;
17415 #     endif
17416 #    endif
17417 #   endif
17418 #  endif
17419 # endif 
17420 # ifdef HAS_STDIO_STREAM_ARRAY
17421     if (open_max > 0) {
17422       long i;
17423       for (i = 0; i < open_max; i++)
17424             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17425                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17426                 STDIO_STREAM_ARRAY[i]._flag)
17427                 fflush(&STDIO_STREAM_ARRAY[i]);
17428     }   
17429   }
17430 # endif
17431 #endif
17432   _exit(42);
17433 }
17434 EOCP
17435 : first we have to find out how _not_ to flush
17436 $to try.c
17437 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17438     output=''
17439     set try -DTRY_FPUTC
17440     if eval $compile; then
17441             $run ./try 2>/dev/null
17442             code="$?"
17443             $from try.out
17444             if $test ! -s try.out -a "X$code" = X42; then
17445                 output=-DTRY_FPUTC
17446             fi
17447     fi
17448     case "$output" in
17449     '')
17450             set try -DTRY_FPRINTF
17451             if eval $compile; then
17452                     $run ./try 2>/dev/null
17453                     code="$?"
17454                     $from try.out
17455                     if $test ! -s try.out -a "X$code" = X42; then
17456                         output=-DTRY_FPRINTF
17457                     fi
17458             fi
17459         ;;
17460     esac
17461 fi
17462 : check for fflush NULL behaviour
17463 case "$fflushNULL" in
17464 '')     set try -DTRY_FFLUSH_NULL $output
17465         if eval $compile; then
17466                 $run ./try 2>/dev/null
17467                 code="$?"
17468                 $from try.out
17469                 if $test -s try.out -a "X$code" = X42; then
17470                         fflushNULL="`$cat try.out`"
17471                 else
17472                         if $test "X$code" != X42; then
17473                                 $cat >&4 <<EOM
17474 (If this test failed, don't worry, we'll try another method shortly.)
17475 EOM
17476                         fi
17477                 fi
17478         fi
17479         $rm -f core try.core core.try.*
17480         case "$fflushNULL" in
17481         x)      $cat >&4 <<EOM
17482 Your fflush(NULL) works okay for output streams.
17483 Let's see if it clobbers input pipes...
17484 EOM
17485 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17486 # bug that improperly flushes the input end of pipes.  So we avoid the
17487 # autoflush on fork/system/exec support for now. :-(
17488 $cat >tryp.c <<EOCP
17489 #include <stdio.h>
17490 int
17491 main(int argc, char **argv)
17492 {
17493     char buf[1024];
17494     int i;
17495     char *bp = buf;
17496     while (1) {
17497         while ((i = getc(stdin)) != -1
17498                && (*bp++ = i) != '\n'
17499                && bp < &buf[1024])
17500         /* DO NOTHING */ ;
17501         *bp = '\0';
17502         fprintf(stdout, "%s", buf);
17503         fflush(NULL);
17504         if (i == -1)
17505             return 0;
17506         bp = buf;
17507     }
17508 }
17509 EOCP
17510                 fflushNULL="$define"
17511                 set tryp
17512                 if eval $compile; then
17513                     $rm -f tryp.out
17514                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17515                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17516                        $cat >&4 <<EOM
17517 fflush(NULL) seems to behave okay with input streams.
17518 EOM
17519                         fflushNULL="$define"
17520                     else
17521                         $cat >&4 <<EOM
17522 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17523 EOM
17524                         fflushNULL="$undef"
17525                     fi
17526                 fi
17527                 $rm -f core tryp.c tryp.core core.tryp.*
17528                 ;;
17529         '')     $cat >&4 <<EOM
17530 Your fflush(NULL) isn't working (contrary to ANSI C).
17531 EOM
17532                 fflushNULL="$undef"
17533                 ;;
17534         *)      $cat >&4 <<EOM
17535 Cannot figure out whether your fflush(NULL) works or not.
17536 I'm assuming it doesn't (contrary to ANSI C).
17537 EOM
17538                 fflushNULL="$undef"
17539                 ;;
17540         esac
17541         ;;
17542 $define|true|[yY]*)
17543         fflushNULL="$define"
17544         ;;
17545 *)
17546         fflushNULL="$undef"
17547         ;;
17548 esac
17549 : check explicit looping only if NULL did not work, and if the pipe
17550 : bug does not show up on an explicit flush too
17551 case "$fflushNULL" in
17552 "$undef")
17553         $cat >tryp.c <<EOCP
17554 #include <stdio.h>
17555 int
17556 main(int argc, char **argv)
17557 {
17558     char buf[1024];
17559     int i;
17560     char *bp = buf;
17561     while (1) {
17562         while ((i = getc(stdin)) != -1
17563                && (*bp++ = i) != '\n'
17564                && bp < &buf[1024])
17565         /* DO NOTHING */ ;
17566         *bp = '\0';
17567         fprintf(stdout, "%s", buf);
17568         fflush(stdin);
17569         if (i == -1)
17570             return 0;
17571         bp = buf;
17572     }
17573 }
17574 EOCP
17575         set tryp
17576         if eval $compile; then
17577             $rm -f tryp.out
17578             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17579             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17580                $cat >&4 <<EOM
17581 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17582 EOM
17583                 : now check for fflushall behaviour
17584                 case "$fflushall" in
17585                 '')     set try -DTRY_FFLUSH_ALL $output
17586                         if eval $compile; then
17587                                 $cat >&4 <<EOM
17588 (Now testing the other method--but note that this also may fail.)
17589 EOM
17590                                 $run ./try 2>/dev/null
17591                                 code=$?
17592                                 $from try.out
17593                                 if $test -s try.out -a "X$code" = X42; then
17594                                         fflushall="`$cat try.out`"
17595                                 fi
17596                         fi
17597                         $rm -f core try.core core.try.*
17598                         case "$fflushall" in
17599                         x)      $cat >&4 <<EOM
17600 Whew. Flushing explicitly all the stdio streams works.
17601 EOM
17602                                 fflushall="$define"
17603                                 ;;
17604                         '')     $cat >&4 <<EOM
17605 Sigh. Flushing explicitly all the stdio streams doesn't work.
17606 EOM
17607                                 fflushall="$undef"
17608                                 ;;
17609                         *)      $cat >&4 <<EOM
17610 Cannot figure out whether flushing stdio streams explicitly works or not.
17611 I'm assuming it doesn't.
17612 EOM
17613                                 fflushall="$undef"
17614                                 ;;
17615                         esac
17616                         ;;
17617                 "$define"|true|[yY]*)
17618                         fflushall="$define"
17619                         ;;
17620                 *)
17621                         fflushall="$undef"
17622                         ;;
17623                 esac
17624             else
17625                 $cat >&4 <<EOM
17626 All is futile.  Even fflush(stdin) clobbers input pipes!
17627 EOM
17628                 fflushall="$undef"
17629             fi
17630         else
17631             fflushall="$undef"
17632         fi
17633         $rm -f core tryp.c tryp.core core.tryp.*
17634         ;;
17635 *)      fflushall="$undef"
17636         ;;
17637 esac
17638
17639 case "$fflushNULL$fflushall" in
17640 undefundef)
17641         $cat <<EOM
17642 OK, I give up.  I cannot figure out how to flush pending stdio output.
17643 We won't be flushing handles at all before fork/exec/popen.
17644 EOM
17645         ;;
17646 esac
17647 $rm -f try.* try$exe_ext
17648
17649 : Store the full pathname to the ar program for use in the C program
17650 : Respect a hint or command line value for full_ar.
17651 case "$full_ar" in
17652 '') full_ar=$ar ;;
17653 esac
17654
17655 : Store the full pathname to the sed program for use in the C program
17656 full_sed=$sed
17657
17658 : see what type gids are declared as in the kernel
17659 echo " "
17660 echo "Looking for the type for group ids returned by getgid()."
17661 set gid_t gidtype xxx stdio.h sys/types.h
17662 eval $typedef
17663 case "$gidtype" in
17664 xxx)
17665         xxx=`./findhdr sys/user.h`
17666         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17667         case $1 in
17668         unsigned) dflt="$1 $2" ;;
17669         *) dflt="$1" ;;
17670         esac
17671         ;;
17672 *) dflt="$gidtype";;
17673 esac
17674 case "$gidtype" in
17675 gid_t) echo "gid_t found." ;;
17676 *)      rp="What is the type for group ids returned by getgid()?"
17677         . ./myread
17678         gidtype="$ans"
17679         ;;
17680 esac
17681
17682 echo " "
17683 case "$gidtype" in
17684 *_t) zzz="$gidtype"     ;;
17685 *)   zzz="gid"          ;;
17686 esac
17687 echo "Checking the size of $zzz..." >&4 
17688 cat > try.c <<EOCP
17689 #include <sys/types.h>
17690 #include <stdio.h>
17691 int main() {
17692     printf("%d\n", (int)sizeof($gidtype));
17693     exit(0);
17694 }
17695 EOCP
17696 set try
17697 if eval $compile_ok; then
17698         yyy=`$run ./try`
17699         case "$yyy" in
17700         '')     gidsize=4
17701                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17702                 ;;
17703         *)      gidsize=$yyy
17704                 echo "Your $zzz is $gidsize bytes long."
17705                 ;;
17706         esac
17707 else
17708         gidsize=4
17709         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17710 fi
17711
17712
17713 echo " "
17714 case "$gidtype" in
17715 *_t) zzz="$gidtype"     ;;
17716 *)   zzz="gid"          ;;
17717 esac
17718 echo "Checking the sign of $zzz..." >&4 
17719 cat > try.c <<EOCP
17720 #include <sys/types.h>
17721 #include <stdio.h>
17722 int main() {
17723         $gidtype foo = -1;
17724         if (foo < 0)
17725                 printf("-1\n");
17726         else
17727                 printf("1\n");
17728 }
17729 EOCP
17730 set try
17731 if eval $compile; then
17732         yyy=`$run ./try`
17733         case "$yyy" in
17734         '')     gidsign=1
17735                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17736                 ;;
17737         *)      gidsign=$yyy
17738                 case "$gidsign" in
17739                  1) echo "Your $zzz is unsigned." ;;
17740                 -1) echo "Your $zzz is signed."   ;;
17741                 esac
17742                 ;;
17743         esac
17744 else
17745         gidsign=1
17746         echo "(I can't compile the test program--guessing unsigned.)" >&4
17747 fi
17748
17749
17750 echo " "
17751
17752 if $test X"$quadtype" != X; then
17753
17754 echo "Checking how to print 64-bit integers..." >&4
17755
17756 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17757         $cat >try.c <<'EOCP'
17758 #include <sys/types.h>
17759 #include <stdio.h>
17760 int main() {
17761   int q = 12345678901;
17762   printf("%ld\n", q);
17763 }
17764 EOCP
17765         set try
17766         if eval $compile; then
17767                 yyy=`$run ./try`
17768                 case "$yyy" in
17769                 12345678901)
17770                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17771                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17772                         echo "We will use %d."
17773                         ;;
17774                 esac
17775         fi
17776 fi
17777
17778 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17779         $cat >try.c <<'EOCP'
17780 #include <sys/types.h>
17781 #include <stdio.h>
17782 int main() {
17783   long q = 12345678901;
17784   printf("%ld\n", q);
17785 }
17786 EOCP
17787         set try
17788         if eval $compile; then
17789                 yyy=`$run ./try`
17790                 case "$yyy" in
17791                 12345678901)
17792                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17793                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17794                         echo "We will use %ld."
17795                         ;;
17796                 esac
17797         fi
17798 fi
17799
17800 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17801         $cat >try.c <<'EOCP'
17802 #include <sys/types.h>
17803 #include <inttypes.h>
17804 #include <stdio.h>
17805 int main() {
17806   int64_t q = 12345678901;
17807   printf("%" PRId64 "\n", q);
17808 }
17809 EOCP
17810         set try
17811         if eval $compile; then
17812                 yyy=`$run ./try`
17813                 case "$yyy" in
17814                 12345678901)
17815                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17816                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17817                         echo "We will use the C9X style."
17818                         ;;
17819                 esac
17820         fi
17821 fi
17822
17823 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17824         $cat >try.c <<EOCP
17825 #include <sys/types.h>
17826 #include <stdio.h>
17827 int main() {
17828   $quadtype q = 12345678901;
17829   printf("%Ld\n", q);
17830 }
17831 EOCP
17832         set try
17833         if eval $compile; then
17834                 yyy=`$run ./try`
17835                 case "$yyy" in
17836                 12345678901)
17837                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17838                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17839                         echo "We will use %Ld."
17840                         ;;
17841                 esac
17842         fi
17843 fi
17844
17845 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17846         $cat >try.c <<'EOCP'
17847 #include <sys/types.h>
17848 #include <stdio.h>
17849 int main() {
17850   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17851   printf("%lld\n", q);
17852 }
17853 EOCP
17854         set try
17855         if eval $compile; then
17856                 yyy=`$run ./try`
17857                 case "$yyy" in
17858                 12345678901)
17859                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17860                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17861                         echo "We will use the %lld style."
17862                         ;;
17863                 esac
17864         fi
17865 fi
17866
17867 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17868         $cat >try.c <<EOCP
17869 #include <sys/types.h>
17870 #include <stdio.h>
17871 int main() {
17872   $quadtype q = 12345678901;
17873   printf("%qd\n", q);
17874 }
17875 EOCP
17876         set try
17877         if eval $compile; then
17878                 yyy=`$run ./try`
17879                 case "$yyy" in
17880                 12345678901)
17881                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17882                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17883                         echo "We will use %qd."
17884                         ;;
17885                 esac
17886         fi
17887 fi
17888
17889 if $test X"$sPRId64" = X; then
17890         echo "Cannot figure out how to print 64-bit integers." >&4
17891 fi
17892
17893 $rm -f try try.*
17894
17895 fi
17896
17897 case "$sPRId64" in
17898 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17899         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17900         ;;
17901 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17902         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17903         ;;
17904 esac
17905
17906
17907 echo " "
17908 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17909
17910 if $test X"$ivsize" = X8; then
17911         ivdformat="$sPRId64"
17912         uvuformat="$sPRIu64"
17913         uvoformat="$sPRIo64"
17914         uvxformat="$sPRIx64"
17915         uvXUformat="$sPRIXU64"
17916 else
17917         if $test X"$ivsize" = X"$longsize"; then
17918                 ivdformat='"ld"'
17919                 uvuformat='"lu"'
17920                 uvoformat='"lo"'
17921                 uvxformat='"lx"'
17922                 uvXUformat='"lX"'
17923         else
17924                 if $test X"$ivsize" = X"$intsize"; then
17925                         ivdformat='"d"'
17926                         uvuformat='"u"'
17927                         uvoformat='"o"'
17928                         uvxformat='"x"'
17929                         uvXUformat='"X"'
17930                 else
17931                         : far out
17932                         if $test X"$ivsize" = X"$shortsize"; then
17933                                 ivdformat='"hd"'
17934                                 uvuformat='"hu"'
17935                                 uvoformat='"ho"'
17936                                 uvxformat='"hx"'
17937                                 uvXUformat='"hX"'
17938                         fi
17939                 fi
17940         fi
17941 fi
17942
17943 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
17944         nveformat="$sPRIeldbl"
17945         nvfformat="$sPRIfldbl"
17946         nvgformat="$sPRIgldbl"
17947         nvEUformat="$sPRIEUldbl"
17948         nvFUformat="$sPRIFUldbl"
17949         nvGUformat="$sPRIGUldbl"
17950 else
17951         nveformat='"e"'
17952         nvfformat='"f"'
17953         nvgformat='"g"'
17954         nvEUformat='"E"'
17955         nvFUformat='"F"'
17956         nvGUformat='"G"'
17957 fi
17958
17959 case "$ivdformat" in
17960 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
17961     exit 1
17962     ;;
17963 esac
17964
17965
17966 echo " "
17967 $echo "Checking the format string to be used for gids..." >&4
17968
17969 case "$gidsign" in
17970 -1)     if $test X"$gidsize" = X"$ivsize"; then
17971                 gidformat="$ivdformat"
17972         else
17973                 if $test X"$gidsize" = X"$longsize"; then
17974                         gidformat='"ld"'
17975                 else
17976                         if $test X"$gidsize" = X"$intsize"; then
17977                                 gidformat='"d"'
17978                         else
17979                                 if $test X"$gidsize" = X"$shortsize"; then
17980                                         gidformat='"hd"'
17981                                 fi
17982                         fi
17983                 fi
17984         fi
17985         ;;
17986 *)      if $test X"$gidsize" = X"$uvsize"; then
17987                 gidformat="$uvuformat"
17988         else
17989                 if $test X"$gidsize" = X"$longsize"; then
17990                         gidformat='"lu"'
17991                 else
17992                         if $test X"$gidsize" = X"$intsize"; then
17993                                 gidformat='"u"'
17994                         else
17995                                 if $test X"$gidsize" = X"$shortsize"; then
17996                                         gidformat='"hu"'
17997                                 fi
17998                         fi
17999                 fi
18000         fi
18001         ;;
18002 esac
18003
18004 : see if getgroups exists
18005 set getgroups d_getgrps
18006 eval $inlibc
18007
18008 : see if setgroups exists
18009 set setgroups d_setgrps
18010 eval $inlibc
18011
18012
18013 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18014 echo " "
18015 case "$d_getgrps$d_setgrps" in
18016 *define*)
18017         case "$groupstype" in
18018         '') dflt="$gidtype" ;;
18019         *)  dflt="$groupstype" ;;
18020         esac
18021         $cat <<EOM
18022 What type of pointer is the second argument to getgroups() and setgroups()?
18023 Usually this is the same as group ids, $gidtype, but not always.
18024
18025 EOM
18026         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18027         . ./myread
18028         groupstype="$ans"
18029         ;;
18030 *)  groupstype="$gidtype";;
18031 esac
18032
18033 echo " "
18034 echo "Checking if your $make program sets \$(MAKE)..." >&4
18035 case "$make_set_make" in
18036 '')
18037         $sed 's/^X //' > testmake.mak << 'EOF'
18038 Xall:
18039 X       @echo 'maketemp="$(MAKE)"'
18040 EOF
18041         case "`$make -f testmake.mak 2>/dev/null`" in
18042         *maketemp=*) make_set_make='#' ;;
18043         *)      make_set_make="MAKE=$make" ;;
18044         esac
18045         $rm -f testmake.mak
18046         ;;
18047 esac
18048 case "$make_set_make" in
18049 '#') echo "Yup, it does.";;
18050 *) echo "Nope, it doesn't.";;
18051 esac
18052
18053 : see what type is used for mode_t
18054 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18055 set mode_t modetype int stdio.h sys/types.h
18056 eval $typedef_ask
18057
18058 : see if stdarg is available
18059 echo " "
18060 if $test `./findhdr stdarg.h`; then
18061         echo "<stdarg.h> found." >&4
18062         valstd="$define"
18063 else
18064         echo "<stdarg.h> NOT found." >&4
18065         valstd="$undef"
18066 fi
18067
18068 : see if varags is available
18069 echo " "
18070 if $test `./findhdr varargs.h`; then
18071         echo "<varargs.h> found." >&4
18072 else
18073         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18074 fi
18075
18076 : set up the varargs testing programs
18077 $cat > varargs.c <<EOP
18078 #ifdef I_STDARG
18079 #include <stdarg.h>
18080 #endif
18081 #ifdef I_VARARGS
18082 #include <varargs.h>
18083 #endif
18084
18085 #ifdef I_STDARG
18086 int f(char *p, ...)
18087 #else
18088 int f(va_alist)
18089 va_dcl
18090 #endif
18091 {
18092         va_list ap;
18093 #ifndef I_STDARG
18094         char *p;
18095 #endif
18096 #ifdef I_STDARG
18097         va_start(ap,p);
18098 #else
18099         va_start(ap);
18100         p = va_arg(ap, char *);
18101 #endif
18102         va_end(ap);
18103 }
18104 EOP
18105 $cat > varargs <<EOP
18106 $startsh
18107 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18108         echo "true"
18109 else
18110         echo "false"
18111 fi
18112 $rm -f varargs$_o
18113 EOP
18114 chmod +x varargs
18115
18116 : now check which varargs header should be included
18117 echo " "
18118 i_varhdr=''
18119 case "$valstd" in
18120 "$define")
18121         if `./varargs I_STDARG`; then
18122                 val='stdarg.h'
18123         elif `./varargs I_VARARGS`; then
18124                 val='varargs.h'
18125         fi
18126         ;;
18127 *)
18128         if `./varargs I_VARARGS`; then
18129                 val='varargs.h'
18130         fi
18131         ;;
18132 esac
18133 case "$val" in
18134 '')
18135 echo "I could not find the definition for va_dcl... You have problems..." >&4
18136         val="$undef"; set i_stdarg; eval $setvar
18137         val="$undef"; set i_varargs; eval $setvar
18138         ;;
18139 *) 
18140         set i_varhdr
18141         eval $setvar
18142         case "$i_varhdr" in
18143         stdarg.h)
18144                 val="$define"; set i_stdarg; eval $setvar
18145                 val="$undef"; set i_varargs; eval $setvar
18146                 ;;
18147         varargs.h)
18148                 val="$undef"; set i_stdarg; eval $setvar
18149                 val="$define"; set i_varargs; eval $setvar
18150                 ;;
18151         esac
18152         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18153 esac
18154 $rm -f varargs*
18155
18156 : see if we need va_copy
18157 echo " "
18158 case "$i_stdarg" in
18159 "$define")
18160         $cat >try.c <<EOCP
18161 #include <stdarg.h>
18162 #include <stdio.h>
18163 #$i_stdlib I_STDLIB
18164 #ifdef I_STDLIB
18165 #include <stdlib.h>
18166 #endif
18167 #include <signal.h>
18168
18169 int
18170 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18171 {
18172   return vfprintf(f, fmt, *valp);
18173 }
18174  
18175 int    
18176 myvfprintf(FILE *f, const  char *fmt, va_list val)
18177 {
18178   return ivfprintf(f, fmt, &val);
18179 }
18180       
18181 int
18182 myprintf(char *fmt, ...) 
18183 {
18184   va_list val;
18185   va_start(val, fmt);
18186   return myvfprintf(stdout, fmt, val); 
18187 }         
18188
18189 int
18190 main(int ac, char **av)
18191 {
18192   signal(SIGSEGV, exit);
18193
18194   myprintf("%s%cs all right, then\n", "that", '\'');                            
18195   exit(0);      
18196 }
18197 EOCP
18198         set try
18199         if eval $compile && $run ./try 2>&1 >/dev/null; then
18200                 case "`$run ./try`" in
18201                 "that's all right, then")
18202                         okay=yes
18203                         ;;
18204                 esac
18205         fi
18206         case "$okay" in
18207         yes)    echo "It seems that you don't need va_copy()." >&4
18208                 need_va_copy="$undef"
18209                 ;;
18210         *)      echo "It seems that va_copy() or similar will be needed." >&4
18211                 need_va_copy="$define"
18212                 ;;
18213         esac
18214         $rm -f try.* core core.* *.core *.core.*
18215         ;;
18216 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18217         ;;
18218 esac
18219
18220 : see what type is used for size_t
18221 rp="What is the type used for the length parameter for string functions?"
18222 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18223 eval $typedef_ask
18224
18225 : check for type of arguments to gethostbyaddr. 
18226 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18227         case "$d_gethbyaddr" in
18228         $define)
18229                 $cat <<EOM
18230
18231 Checking to see what type of arguments are accepted by gethostbyaddr().
18232 EOM
18233                 hdrs="$define sys/types.h
18234                         $d_socket sys/socket.h 
18235                         $i_niin netinet/in.h 
18236                         $i_netdb netdb.h
18237                         $i_unistd unistd.h"
18238                 : The first arg can 'char *' or 'void *'
18239                 : The second arg is some of integral type
18240                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18241                         for yyy in size_t long int; do
18242                                 case "$netdb_host_type" in
18243                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18244                                         if ./protochk "$try" $hdrs; then
18245                                                 echo "Your system accepts $xxx for the first arg."
18246                                                 echo "...and $yyy for the second arg."
18247                                                 netdb_host_type="$xxx"
18248                                                 netdb_hlen_type="$yyy"
18249                                         fi
18250                                         ;;
18251                                 esac
18252                         done
18253                 done
18254                 : In case none of those worked, prompt the user.
18255                 case "$netdb_host_type" in
18256                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18257                         dflt='char *'
18258                         . ./myread
18259                         netdb_host_type=$ans
18260                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18261                         dflt="$sizetype"
18262                         . ./myread
18263                         netdb_hlen_type=$ans
18264                         ;;
18265                 esac
18266                 ;;
18267         *)      : no gethostbyaddr, so pick harmless defaults
18268                 netdb_host_type='char *'
18269                 netdb_hlen_type="$sizetype"
18270                 ;;
18271         esac
18272         # Remove the "const" if needed. -- but then we'll have a 
18273         # prototype clash!
18274         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18275 fi
18276
18277 : check for type of argument to gethostbyname. 
18278 if test "X$netdb_name_type" = X ; then
18279         case "$d_gethbyname" in
18280         $define)
18281                 $cat <<EOM
18282
18283 Checking to see what type of argument is accepted by gethostbyname().
18284 EOM
18285                 hdrs="$define sys/types.h
18286                         $d_socket sys/socket.h 
18287                         $i_niin netinet/in.h 
18288                         $i_netdb netdb.h
18289                         $i_unistd unistd.h"
18290                 for xxx in "const char *" "char *"; do
18291                         case "$netdb_name_type" in
18292                         '')     try="extern struct hostent *gethostbyname($xxx);"
18293                                 if ./protochk "$try" $hdrs; then
18294                                         echo "Your system accepts $xxx."
18295                                         netdb_name_type="$xxx"
18296                                 fi
18297                                 ;;
18298                         esac
18299                 done
18300                 : In case none of those worked, prompt the user.
18301                 case "$netdb_name_type" in
18302                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18303                         dflt='char *'
18304                         . ./myread
18305                         netdb_name_type=$ans
18306                         ;;
18307                 esac
18308                 ;;
18309         *)      : no gethostbyname, so pick harmless default
18310                 netdb_name_type='char *'
18311                 ;;
18312         esac
18313 fi
18314
18315 : check for type of 1st argument to getnetbyaddr. 
18316 if test "X$netdb_net_type" = X ; then
18317         case "$d_getnbyaddr" in
18318         $define)
18319                 $cat <<EOM
18320
18321 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18322 EOM
18323                 hdrs="$define sys/types.h
18324                         $d_socket sys/socket.h 
18325                         $i_niin netinet/in.h 
18326                         $i_netdb netdb.h
18327                         $i_unistd unistd.h"
18328                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18329                         case "$netdb_net_type" in
18330                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18331                                 if ./protochk "$try" $hdrs; then
18332                                         echo "Your system accepts $xxx."
18333                                         netdb_net_type="$xxx"
18334                                 fi
18335                                 ;;
18336                         esac
18337                 done
18338                 : In case none of those worked, prompt the user.
18339                 case "$netdb_net_type" in
18340                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18341                         dflt='long'
18342                         . ./myread
18343                         netdb_net_type=$ans
18344                         ;;
18345                 esac
18346                 ;;
18347         *)      : no getnetbyaddr, so pick harmless default
18348                 netdb_net_type='long'
18349                 ;;
18350         esac
18351 fi
18352 : locate the preferred pager for this system
18353 fn=f/
18354 case "$pager" in
18355 '')
18356         dflt=''
18357         case "$pg" in
18358         /*) dflt=$pg;;
18359         [a-zA-Z]:/*) dflt=$pg;;
18360         esac
18361         case "$more" in
18362         /*) dflt=$more;;
18363         [a-zA-Z]:/*) dflt=$more;;
18364         esac
18365         case "$less" in
18366         /*) dflt=$less;;
18367         [a-zA-Z]:/*) dflt=$less;;
18368         esac
18369         case "$dflt" in
18370         '') dflt=/usr/ucb/more;;
18371         esac
18372         ;;
18373 *)      dflt="$pager"
18374         : Instruct ./getfile to trust the hinted or previous pager value,
18375         : even if it does not begin with a slash.  For example, on os2,
18376         : pager might be cmd /c more.  See comments in UU/getfile.
18377         fn="f/($pager)"
18378         ;;
18379 esac
18380 echo " "
18381 rp='What pager is used on your system?'
18382 . ./getfile
18383 pager="$ans"
18384
18385 : see what type pids are declared as in the kernel
18386 rp="What is the type of process ids on this system?"
18387 set pid_t pidtype int stdio.h sys/types.h
18388 eval $typedef_ask
18389
18390 : Find earliest binary compatible site_perl subdirectory perl can use.
18391 xs_apiversion=$version # The current site_perl version.
18392 : Find earliest pure perl site_perl subdirectory perl can use.
18393 : The versioned directories started at 5.005.
18394 pm_apiversion='5.005'
18395
18396 : see if ar generates random libraries by itself
18397 echo " "
18398 echo "Checking how to generate random libraries on your machine..." >&4
18399 echo 'int bar1() { return bar2(); }' > bar1.c
18400 echo 'int bar2() { return 2; }' > bar2.c
18401 $cat > foo.c <<'EOP'
18402 int main() { printf("%d\n", bar1()); exit(0); }
18403 EOP
18404 $cc $ccflags -c bar1.c >/dev/null 2>&1
18405 $cc $ccflags -c bar2.c >/dev/null 2>&1
18406 $cc $ccflags -c foo.c >/dev/null 2>&1
18407 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18408 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18409         $run ./foobar >/dev/null 2>&1; then
18410         echo "$ar appears to generate random libraries itself."
18411         orderlib=false
18412         ranlib=":"
18413 elif $ar ts bar$_a >/dev/null 2>&1 &&
18414         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18415         $run ./foobar >/dev/null 2>&1; then
18416                 echo "a table of contents needs to be added with '$ar ts'."
18417                 orderlib=false
18418                 ranlib="$ar ts"
18419 else
18420         case "$ranlib" in
18421         :) ranlib='';;
18422         '')
18423                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18424                 $test -f $ranlib || ranlib=''
18425                 ;;
18426         esac
18427         if $test -n "$ranlib"; then
18428                 echo "your system has '$ranlib'; we'll use that."
18429                 orderlib=false
18430         else
18431                 echo "your system doesn't seem to support random libraries"
18432                 echo "so we'll use lorder and tsort to order the libraries."
18433                 orderlib=true
18434                 ranlib=":"
18435         fi
18436 fi
18437 $rm -f foo* bar* 
18438
18439 : check for type of arguments to select. 
18440 case "$selecttype" in
18441 '') case "$d_select" in
18442         $define)
18443                 echo " "
18444                 $cat <<EOM
18445 Checking to see what type of arguments are accepted by select().
18446 EOM
18447                 hdrs="$define sys/types.h
18448                         $i_systime sys/time.h 
18449                         $i_sysselct sys/select.h
18450                         $d_socket sys/socket.h"
18451                 : The first arg can be int, unsigned, or size_t
18452                 : The last arg may or may not be 'const'
18453                 val=''
18454                 : void pointer has been seen but using that
18455                 : breaks the selectminbits test
18456                 for xxx in 'fd_set *' 'int *'; do
18457                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18458                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18459                                         case "$val" in
18460                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18461                                                 if ./protochk "$try" $hdrs; then
18462                                                         echo "Your system accepts $xxx."
18463                                                         val="$xxx"
18464                                                 fi
18465                                                 ;;
18466                                         esac
18467                                 done
18468                         done
18469                 done
18470                 case "$val" in
18471                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18472                         case "$d_fd_set" in
18473                                 $define) dflt="fd_set *" ;;
18474                                 *)              dflt="int *" ;;
18475                         esac
18476                         . ./myread
18477                         val=$ans
18478                         ;;
18479                 esac
18480                 selecttype="$val"
18481                 ;;
18482         *)      : no select, so pick a harmless default
18483                 selecttype='int *'
18484                 ;;
18485         esac
18486         ;;
18487 esac
18488
18489 : check for the select 'width'
18490 case "$selectminbits" in
18491 '') case "$d_select" in
18492         $define)
18493                 $cat <<EOM
18494
18495 Checking to see on how many bits at a time your select() operates...
18496 EOM
18497                 $cat >try.c <<EOCP
18498 #include <sys/types.h>
18499 #$i_time I_TIME
18500 #$i_systime I_SYS_TIME
18501 #$i_systimek I_SYS_TIME_KERNEL
18502 #ifdef I_TIME
18503 #   include <time.h>
18504 #endif
18505 #ifdef I_SYS_TIME
18506 #   ifdef I_SYS_TIME_KERNEL
18507 #       define KERNEL
18508 #   endif
18509 #   include <sys/time.h>
18510 #   ifdef I_SYS_TIME_KERNEL
18511 #       undef KERNEL
18512 #   endif
18513 #endif
18514 #$i_sysselct I_SYS_SELECT
18515 #ifdef I_SYS_SELECT
18516 #include <sys/select.h>
18517 #endif
18518 #$d_socket HAS_SOCKET
18519 #ifdef HAS_SOCKET
18520 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18521 #endif
18522 #include <stdio.h>
18523 $selecttype b;
18524 #define S sizeof(*(b))
18525 #define MINBITS 64
18526 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18527 #define NBITS  (NBYTES * 8)
18528 int main() {
18529     char s[NBYTES];
18530     struct timeval t;
18531     int i;
18532     FILE* fp;
18533     int fd;
18534
18535     fclose(stdin);
18536     fp = fopen("try.c", "r");
18537     if (fp == 0)
18538       exit(1);
18539     fd = fileno(fp);
18540     if (fd < 0)
18541       exit(2);
18542     b = ($selecttype)s;
18543     for (i = 0; i < NBITS; i++)
18544         FD_SET(i, b);
18545     t.tv_sec  = 0;
18546     t.tv_usec = 0;
18547     select(fd + 1, b, 0, 0, &t);
18548     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18549     printf("%d\n", i + 1);
18550     return 0;
18551 }
18552 EOCP
18553                 set try
18554                 if eval $compile_ok; then
18555                         selectminbits=`$run ./try`
18556                         case "$selectminbits" in
18557                         '')     cat >&4 <<EOM
18558 Cannot figure out on how many bits at a time your select() operates.
18559 I'll play safe and guess it is 32 bits.
18560 EOM
18561                                 selectminbits=32
18562                                 bits="32 bits"
18563                                 ;;
18564                         1)      bits="1 bit" ;;
18565                         *)      bits="$selectminbits bits" ;;
18566                         esac
18567                         echo "Your select() operates on $bits at a time." >&4
18568                 else
18569                         rp='What is the minimum number of bits your select() operates on?'
18570                         case "$byteorder" in
18571                         1234|12345678)  dflt=32 ;;
18572                         *)              dflt=1  ;;
18573                         esac
18574                         . ./myread
18575                         val=$ans
18576                         selectminbits="$val"
18577                 fi
18578                 $rm -f try.* try
18579                 ;;
18580         *)      : no select, so pick a harmless default
18581                 selectminbits='32'
18582                 ;;
18583         esac
18584         ;;
18585 esac
18586
18587 : Trace out the files included by signal.h, then look for SIGxxx names.
18588 : Remove SIGARRAYSIZE used by HPUX.
18589 : Remove SIGSTKSIZE used by Linux.
18590 : Remove SIGSTKSZ used by Posix.
18591 : Remove SIGTYP void lines used by OS2.
18592 : Some cpps, like os390, dont give the file name anywhere
18593 if [ "X$fieldn" = X ]; then
18594         : Just make some guesses.  We check them later.
18595         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18596 else
18597         xxx=`echo '#include <signal.h>' |
18598         $cppstdin $cppminus $cppflags 2>/dev/null |
18599         $grep '^[       ]*#.*include' | 
18600         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18601 fi
18602 : Check this list of files to be sure we have parsed the cpp output ok.
18603 : This will also avoid potentially non-existent files, such 
18604 : as ../foo/bar.h
18605 xxxfiles=''
18606 for xx in $xxx /dev/null ; do
18607         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18608 done
18609 : If we have found no files, at least try signal.h
18610 case "$xxxfiles" in
18611 '')     xxxfiles=`./findhdr signal.h` ;;
18612 esac
18613 xxx=`awk '
18614 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18615         print substr($2, 4, 20)
18616 }
18617 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18618         print substr($3, 4, 20)
18619 }' $xxxfiles`
18620 : Append some common names just in case the awk scan failed.
18621 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18622 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18623 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18624 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18625 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18626
18627 : generate a few handy files for later
18628 $cat > signal.c <<'EOCP'
18629 #include <sys/types.h>
18630 #include <signal.h>
18631 #include <stdio.h>
18632 int main() {
18633
18634 /* Strange style to avoid deeply-nested #if/#else/#endif */
18635 #ifndef NSIG
18636 #  ifdef _NSIG
18637 #    define NSIG (_NSIG)
18638 #  endif
18639 #endif
18640
18641 #ifndef NSIG
18642 #  ifdef SIGMAX
18643 #    define NSIG (SIGMAX+1)
18644 #  endif
18645 #endif
18646
18647 #ifndef NSIG
18648 #  ifdef SIG_MAX
18649 #    define NSIG (SIG_MAX+1)
18650 #  endif
18651 #endif
18652
18653 #ifndef NSIG
18654 #  ifdef MAXSIG
18655 #    define NSIG (MAXSIG+1)
18656 #  endif
18657 #endif
18658
18659 #ifndef NSIG
18660 #  ifdef MAX_SIG
18661 #    define NSIG (MAX_SIG+1)
18662 #  endif
18663 #endif
18664
18665 #ifndef NSIG
18666 #  ifdef SIGARRAYSIZE
18667 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18668 #  endif
18669 #endif
18670
18671 #ifndef NSIG
18672 #  ifdef _sys_nsig
18673 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18674 #  endif
18675 #endif
18676
18677 /* Default to some arbitrary number that's big enough to get most
18678    of the common signals.
18679 */
18680 #ifndef NSIG
18681 #    define NSIG 50
18682 #endif
18683
18684 printf("NSIG %d\n", NSIG);
18685
18686 #ifndef JUST_NSIG
18687
18688 EOCP
18689
18690 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18691 {
18692         printf "#ifdef SIG"; printf $1; printf "\n"
18693         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18694         printf $1; printf ");\n"
18695         printf "#endif\n"
18696 }
18697 END {
18698         printf "#endif /* JUST_NSIG */\n";
18699         printf "exit(0);\n}\n";
18700 }
18701 ' >>signal.c
18702 $cat >signal.awk <<'EOP'
18703 BEGIN { ndups = 0 }
18704 $1 ~ /^NSIG$/ { nsig = $2 }
18705 ($1 !~ /^NSIG$/) && (NF == 2) {
18706     if ($2 > maxsig) { maxsig = $2 }
18707     if (sig_name[$2]) {
18708         dup_name[ndups] = $1
18709         dup_num[ndups] = $2
18710         ndups++ 
18711     }
18712     else {
18713         sig_name[$2] = $1
18714         sig_num[$2] = $2
18715     }
18716 }
18717 END { 
18718     if (nsig == 0) {
18719         nsig = maxsig + 1
18720     }
18721     printf("NSIG %d\n", nsig);
18722     for (n = 1; n < nsig; n++) {
18723         if (sig_name[n]) {
18724             printf("%s %d\n", sig_name[n], sig_num[n])
18725         }
18726         else {
18727             printf("NUM%d %d\n", n, n) 
18728         }
18729     }
18730     for (n = 0; n < ndups; n++) {
18731         printf("%s %d\n", dup_name[n], dup_num[n])
18732     }
18733 }
18734 EOP
18735 $cat >signal_cmd <<EOS
18736 $startsh
18737 if $test -s signal.lst; then
18738     echo "Using your existing signal.lst file"
18739         exit 0
18740 fi
18741 xxx="$xxx"
18742 EOS
18743 $cat >>signal_cmd <<'EOS'
18744
18745 set signal
18746 if eval $compile_ok; then
18747         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18748 else
18749         echo "(I can't seem be able to compile the whole test program)" >&4
18750         echo "(I'll try it in little pieces.)" >&4
18751         set signal -DJUST_NSIG
18752         if eval $compile_ok; then
18753                 $run ./signal$_exe > signal.nsg
18754                 $cat signal.nsg
18755         else
18756                 echo "I can't seem to figure out how many signals you have." >&4
18757                 echo "Guessing 50." >&4
18758                 echo 'NSIG 50' > signal.nsg
18759         fi
18760         : Now look at all the signal names, one at a time.
18761         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18762                 $cat > signal.c <<EOCP
18763 #include <sys/types.h>
18764 #include <signal.h>
18765 #include <stdio.h>
18766 int main() {
18767 printf("$xx %d\n", SIG${xx});
18768 return 0;
18769 }
18770 EOCP
18771                 set signal
18772                 if eval $compile; then
18773                         echo "SIG${xx} found."
18774                         $run ./signal$_exe  >> signal.ls1
18775                 else
18776                         echo "SIG${xx} NOT found."
18777                 fi
18778         done
18779         if $test -s signal.ls1; then
18780                 $cat signal.nsg signal.ls1 |
18781                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18782         fi
18783
18784 fi
18785 if $test -s signal.lst; then
18786         :
18787 else
18788         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18789         echo 'kill -l' >signal
18790         set X `csh -f <signal`
18791         $rm -f signal
18792         shift
18793         case $# in
18794         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18795         esac
18796         echo $@ | $tr ' ' $trnl | \
18797             $awk '{ printf "%s %d\n", $1, ++s; }
18798                   END { printf "NSIG %d\n", ++s }' >signal.lst
18799 fi
18800 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18801 EOS
18802 chmod a+x signal_cmd
18803 $eunicefix signal_cmd
18804
18805 : generate list of signal names
18806 echo " "
18807 case "$sig_name_init" in
18808 '') doinit=yes ;;
18809 *)  case "$sig_num_init" in
18810     ''|*,*) doinit=yes ;;
18811     esac ;;
18812 esac
18813 case "$doinit" in
18814 yes)
18815         echo "Generating a list of signal names and numbers..." >&4
18816         . ./signal_cmd
18817         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18818         sig_name=`$awk 'BEGIN { printf "ZERO " }
18819                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18820         sig_num=`$awk  'BEGIN { printf "0 " }
18821                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18822         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18823                              !/^NSIG/   { printf "\"%s\", ", $1 }
18824                              END        { printf "0\n" }' signal.lst`
18825         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18826                              !/^NSIG/   { printf "%d, ", $2}
18827                              END        { printf "0\n"}' signal.lst`
18828         ;;
18829 esac
18830 echo "The following $sig_count signals are available:"
18831 echo " "
18832 echo $sig_name | $awk \
18833 'BEGIN { linelen = 0 }
18834 {
18835         for (i = 1; i <= NF; i++) {
18836                 name = "SIG" $i " "
18837                 linelen = linelen + length(name)
18838                 if (linelen > 70) {
18839                         printf "\n"
18840                         linelen = length(name)
18841                 }
18842                 printf "%s", name
18843         }
18844         printf "\n"
18845 }'
18846 sig_size=`echo $sig_name | awk '{print NF}'`
18847 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18848
18849 echo " "
18850 case "$sizetype" in
18851 *_t) zzz="$sizetype"    ;;
18852 *)   zzz="filesize"     ;;
18853 esac
18854 echo "Checking the size of $zzz..." >&4 
18855 cat > try.c <<EOCP
18856 #include <sys/types.h>
18857 #include <stdio.h>
18858 int main() {
18859     printf("%d\n", (int)sizeof($sizetype));
18860     exit(0);
18861 }
18862 EOCP
18863 set try
18864 if eval $compile_ok; then
18865         yyy=`$run ./try`
18866         case "$yyy" in
18867         '')     sizesize=4
18868                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18869                 ;;
18870         *)      sizesize=$yyy
18871                 echo "Your $zzz size is $sizesize bytes."
18872                 ;;
18873         esac
18874 else
18875         sizesize=4
18876         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18877 fi
18878
18879
18880 : check for socklen_t
18881 echo " "
18882 echo "Checking to see if you have socklen_t..." >&4
18883 $cat >try.c <<EOCP
18884 #include <sys/types.h>
18885 #$d_socket HAS_SOCKET
18886 #ifdef HAS_SOCKET
18887 #include <sys/socket.h>
18888 #endif
18889 int main() { socklen_t x = 16; }
18890 EOCP
18891 set try
18892 if eval $compile; then
18893         val="$define"
18894         echo "You have socklen_t."
18895 else
18896         val="$undef"
18897         echo "You do not have socklen_t."
18898         case "$sizetype" in
18899         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18900         esac
18901 fi
18902 $rm -f try try.*
18903 set d_socklen_t
18904 eval $setvar
18905
18906 : see if this is a socks.h system
18907 set socks.h i_socks
18908 eval $inhdr
18909
18910 : check for type of the size argument to socket calls
18911 case "$d_socket" in
18912 "$define")
18913         $cat <<EOM
18914
18915 Checking to see what type is the last argument of accept().
18916 EOM
18917         yyy=''
18918         case "$d_socklen_t" in
18919         "$define") yyy="$yyy socklen_t"
18920         esac
18921         yyy="$yyy $sizetype int long unsigned"
18922         for xxx in $yyy; do
18923                 case "$socksizetype" in
18924                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18925                         case "$usesocks" in
18926                         "$define")
18927                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
18928                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18929                                         socksizetype="$xxx"
18930                                 fi
18931                                 ;;
18932                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
18933                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
18934                                         socksizetype="$xxx"
18935                                 fi
18936                                 ;;
18937                         esac
18938                         ;;
18939                 esac
18940         done
18941 : In case none of those worked, prompt the user.
18942         case "$socksizetype" in
18943         '')     rp='What is the type for socket address structure sizes?'
18944                 dflt='int'
18945                 . ./myread
18946                 socksizetype=$ans
18947                 ;;
18948         esac
18949         ;;
18950 *)      : no sockets, so pick relatively harmless default
18951         socksizetype='int'
18952         ;;
18953 esac
18954
18955 : see what type is used for signed size_t
18956 set ssize_t ssizetype int stdio.h sys/types.h
18957 eval $typedef
18958 dflt="$ssizetype"
18959 $cat > try.c <<EOM
18960 #include <stdio.h>
18961 #include <sys/types.h>
18962 #define Size_t $sizetype
18963 #define SSize_t $dflt
18964 int main()
18965 {
18966         if (sizeof(Size_t) == sizeof(SSize_t))
18967                 printf("$dflt\n");
18968         else if (sizeof(Size_t) == sizeof(int))
18969                 printf("int\n");
18970         else 
18971                 printf("long\n");
18972         exit(0);
18973 }
18974 EOM
18975 echo " "
18976 set try
18977 if eval $compile_ok && $run ./try > /dev/null; then
18978         ssizetype=`$run ./try`
18979         echo "I'll be using $ssizetype for functions returning a byte count." >&4
18980 else
18981         $cat >&4 <<EOM
18982 Help! I can't compile and run the ssize_t test program: please enlighten me!
18983 (This is probably a misconfiguration in your system or libraries, and
18984 you really ought to fix it.  Still, I'll try anyway.)
18985
18986 I need a type that is the same size as $sizetype, but is guaranteed to
18987 be signed.  Common values are ssize_t, int and long.
18988
18989 EOM
18990         rp="What signed type is the same size as $sizetype?"
18991         . ./myread
18992         ssizetype="$ans"
18993 fi
18994 $rm -f try try.*
18995
18996 : see what type of char stdio uses.
18997 echo " "
18998 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
18999 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19000         echo "Your stdio uses unsigned chars." >&4
19001         stdchar="unsigned char"
19002 else
19003         echo "Your stdio uses signed chars." >&4
19004         stdchar="char"
19005 fi
19006 $rm -f stdioh
19007
19008
19009
19010 : see what type uids are declared as in the kernel
19011 echo " "
19012 echo "Looking for the type for user ids returned by getuid()."
19013 set uid_t uidtype xxx stdio.h sys/types.h
19014 eval $typedef
19015 case "$uidtype" in
19016 xxx)
19017         xxx=`./findhdr sys/user.h`
19018         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19019         case $1 in
19020         unsigned) dflt="$1 $2" ;;
19021         *) dflt="$1" ;;
19022         esac
19023         ;;
19024 *) dflt="$uidtype";;
19025 esac
19026 case "$uidtype" in
19027 uid_t)  echo "uid_t found." ;;
19028 *)      rp="What is the type for user ids returned by getuid()?"
19029         . ./myread
19030         uidtype="$ans"
19031         ;;
19032 esac
19033
19034 echo " "
19035 case "$uidtype" in
19036 *_t) zzz="$uidtype"     ;;
19037 *)   zzz="uid"          ;;
19038 esac
19039 echo "Checking the size of $zzz..." >&4 
19040 cat > try.c <<EOCP
19041 #include <sys/types.h>
19042 #include <stdio.h>
19043 int main() {
19044     printf("%d\n", (int)sizeof($uidtype));
19045     exit(0);
19046 }
19047 EOCP
19048 set try
19049 if eval $compile_ok; then
19050         yyy=`$run ./try`
19051         case "$yyy" in
19052         '')     uidsize=4
19053                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19054                 ;;
19055         *)      uidsize=$yyy
19056                 echo "Your $zzz is $uidsize bytes long."
19057                 ;;
19058         esac
19059 else
19060         uidsize=4
19061         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19062 fi
19063
19064 echo " "
19065 case "$uidtype" in
19066 *_t) zzz="$uidtype"     ;;
19067 *)   zzz="uid"          ;;
19068 esac
19069 echo "Checking the sign of $zzz..." >&4
19070 cat > try.c <<EOCP
19071 #include <sys/types.h>
19072 #include <stdio.h>
19073 int main() {
19074         $uidtype foo = -1;
19075         if (foo < 0)
19076                 printf("-1\n");
19077         else
19078                 printf("1\n");
19079 }
19080 EOCP
19081 set try
19082 if eval $compile; then
19083         yyy=`$run ./try`
19084         case "$yyy" in
19085         '')     uidsign=1
19086                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19087                 ;;
19088         *)      uidsign=$yyy
19089                 case "$uidsign" in
19090                  1) echo "Your $zzz is unsigned." ;;
19091                 -1) echo "Your $zzz is signed."   ;;
19092                 esac
19093                 ;;
19094         esac
19095 else
19096         uidsign=1
19097         echo "(I can't compile the test program--guessing unsigned.)" >&4
19098 fi
19099
19100
19101
19102 echo " "
19103 $echo "Checking the format string to be used for uids..." >&4
19104
19105 case "$uidsign" in
19106 -1)     if $test X"$uidsize" = X"$ivsize"; then
19107                 uidformat="$ivdformat"
19108         else
19109                 if $test X"$uidsize" = X"$longsize"; then
19110                         uidformat='"ld"'
19111                 else
19112                         if $test X"$uidsize" = X"$intsize"; then
19113                                 uidformat='"d"'
19114                         else
19115                                 if $test X"$uidsize" = X"$shortsize"; then
19116                                         uidformat='"hd"'
19117                                 fi
19118                         fi
19119                 fi
19120         fi
19121         ;;
19122 *)      if $test X"$uidsize" = X"$uvsize"; then
19123                 uidformat="$uvuformat"
19124         else
19125                 if $test X"$uidsize" = X"$longsize"; then
19126                         uidformat='"lu"'
19127                 else
19128                         if $test X"$uidsize" = X"$intsize"; then
19129                                 uidformat='"u"'
19130                         else
19131                                 if $test X"$uidsize" = X"$shortsize"; then
19132                                         uidformat='"hu"'
19133                                 fi
19134                         fi
19135                 fi
19136         fi
19137         ;;
19138 esac
19139
19140 : determine compiler compiler
19141 case "$yacc" in
19142 '')
19143         dflt=yacc;;
19144 *)
19145         dflt="$yacc";;
19146 esac
19147 echo " "
19148 comp='yacc'
19149 if $test -f "$byacc$_exe"; then
19150         dflt="$byacc"
19151         comp="byacc or $comp"
19152 fi
19153 if $test -f "$bison$_exe"; then
19154         comp="$comp or bison -y"
19155 fi
19156 rp="Which compiler compiler ($comp) shall I use?"
19157 . ./myread
19158 yacc="$ans"
19159 case "$yacc" in
19160 *bis*)
19161         case "$yacc" in
19162         *-y*) ;;
19163         *)
19164                 yacc="$yacc -y"
19165                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19166                 ;;
19167         esac
19168         ;;
19169 esac
19170
19171 : see if this is a fp.h system
19172 set fp.h i_fp
19173 eval $inhdr
19174
19175 : see if this is a fp_class.h system
19176 set fp_class.h i_fp_class
19177 eval $inhdr
19178
19179 : see if this is a ieeefp.h system
19180 case "$i_ieeefp" in
19181 '' ) set ieeefp.h i_ieeefp
19182      eval $inhdr
19183      ;;
19184 esac
19185
19186 : see if this is a libutil.h system
19187 set libutil.h i_libutil
19188 eval $inhdr
19189
19190 : see if mach cthreads are available
19191 if test "X$usethreads" = "X$define"; then
19192         set mach/cthreads.h i_machcthr
19193         eval $inhdr
19194 else
19195         i_machcthr="$undef"
19196 fi
19197
19198
19199
19200 : see if this is a math.h system
19201 set math.h i_math
19202 eval $inhdr
19203
19204 : see if this is a mntent.h system
19205 set mntent.h i_mntent
19206 eval $inhdr
19207
19208 : see if ndbm.h is available
19209 set ndbm.h t_ndbm
19210 eval $inhdr
19211
19212 case "$t_ndbm" in
19213 $undef)
19214     # Some Linux distributions such as RedHat 7.1 put the
19215     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19216     if $test -f /usr/include/gdbm/ndbm.h; then
19217         echo '<gdbm/ndbm.h> found.'
19218         ccflags="$ccflags -I/usr/include/gdbm"
19219         cppflags="$cppflags -I/usr/include/gdbm"
19220         t_ndbm=$define
19221     fi
19222     ;;
19223 esac
19224
19225 case "$t_ndbm" in
19226 $define)
19227         : see if dbm_open exists
19228         set dbm_open d_dbm_open
19229         eval $inlibc
19230         case "$d_dbm_open" in
19231         $undef)
19232                 t_ndbm="$undef"
19233                 echo "We won't be including <ndbm.h>"
19234                 ;;
19235         esac
19236         ;;
19237 esac
19238 val="$t_ndbm"
19239 set i_ndbm
19240 eval $setvar
19241
19242 : see if net/errno.h is available
19243 val=''
19244 set net/errno.h val
19245 eval $inhdr
19246
19247 : Unfortunately, it causes problems on some systems.  Arrgh.
19248 case "$val" in
19249 $define)
19250         cat > try.c <<'EOM'
19251 #include <stdio.h>
19252 #include <errno.h>
19253 #include <net/errno.h>
19254 int func()
19255 {
19256         return ENOTSOCK;
19257 }
19258 EOM
19259         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19260                 echo "We'll be including <net/errno.h>." >&4
19261         else
19262                 echo "We won't be including <net/errno.h>." >&4
19263                 val="$undef"
19264         fi
19265         $rm -f try.* try
19266         ;;
19267 esac
19268 set i_neterrno
19269 eval $setvar
19270
19271 : see if netinet/tcp.h is available
19272 set netinet/tcp.h i_netinettcp
19273 eval $inhdr
19274
19275 : see if this is a poll.h system
19276 set poll.h i_poll
19277 eval $inhdr
19278
19279 : see if this is a prot.h system
19280 set prot.h i_prot
19281 eval $inhdr
19282
19283 echo " "
19284 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19285 $cat <<'EOSH' > Cppsym.know
19286 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19287 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19288 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19289 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19290 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19291 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19292 bull c cadmus clipper CMU COFF COMPILER_VERSION
19293 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19294 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19295 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19296 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19297 GLIBC GLIBC_MINOR
19298 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19299 H3050R H3050RX hbullx20 hcx host_mips
19300 hp200 hp300 hp700 HP700 hp800 hp9000
19301 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19302 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19303 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19304 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19305 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19306 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19307 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19308 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19309 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19310 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19311 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19312 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19313 MATH_HAS_NO_SIDE_EFFECTS
19314 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19315 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19316 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19317 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19318 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19319 NetBSD news1500 news1700 news1800 news1900 news3700
19320 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19321 ns32016 ns32332 ns32k nsc32000
19322 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19323 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19324 pc532 pdp11 PGC PIC plexus PORTAR posix
19325 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19326 POSIX_C_SOURCE POSIX_SOURCE POWER
19327 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19328 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19329 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19330 sony sony_news sonyrisc sparc sparclite spectrum
19331 stardent stdc STDC_EXT stratos sun sun3 sun386
19332 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19333 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19334 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19335 sysV68 sysV88 Tek4132 Tek4300 titan
19336 TM3200 TM5400 TM5600
19337 tower tower32 tower32_200 tower32_600 tower32_700
19338 tower32_800 tower32_850 tss
19339 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19340 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19341 unix UNIX95 UNIX99 unixpc unos
19342 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19343 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19344 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19345 USGr4 USGr4_2
19346 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19347 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19348 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19349 z8000
19350 EOSH
19351 # Maybe put other stuff here too.
19352 cat <<EOSH >>Cppsym.know
19353 $osname
19354 EOSH
19355 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19356 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19357 $cat Cppsym.know > Cppsym.c
19358 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19359 $rm -f Cppsym.a Cppsym.b Cppsym.c
19360 cat <<EOSH > Cppsym
19361 $startsh
19362 if $test \$# -gt 0; then
19363     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19364     if $test -s Cppsym.got; then
19365         $rm -f Cppsym.got
19366         exit 0
19367     fi
19368     $rm -f Cppsym.got
19369     exit 1
19370 else
19371     $tr " " "$trnl" | ./Cppsym.try
19372     exit 0
19373 fi
19374 EOSH
19375 chmod +x Cppsym
19376 $eunicefix Cppsym
19377 cat <<EOSH > Cppsym.try
19378 $startsh
19379 cat <<'EOCP' > try.c
19380 #include <stdio.h>
19381 int main() {
19382 EOCP
19383 $awk \\
19384 EOSH
19385 cat <<'EOSH' >> Cppsym.try
19386 'length($1) > 0 {
19387     printf "#ifdef %s\n#if %s+0\nprintf(\"%s=%%ld\\n\", (long)%s);\n#else\nprintf(\"%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19388     printf "#ifdef _%s\n#if _%s+0\nprintf(\"_%s=%%ld\\n\", (long)_%s);\n#else\nprintf(\"_%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19389     printf "#ifdef __%s\n#if __%s+0\nprintf(\"__%s=%%ld\\n\", (long)__%s);\n#else\nprintf(\"__%s\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19390     printf "#ifdef __%s__\n#if __%s__+0\nprintf(\"__%s__=%%ld\\n\", (long)__%s__);\n#else\nprintf(\"__%s__\\n\");\n#endif\n#endif\n", $1, $1, $1, $1, $1
19391 }'       >> try.c
19392 echo 'return 0;}' >> try.c
19393 EOSH
19394 cat <<EOSH >> Cppsym.try
19395 ccflags="$ccflags"
19396 case "$osname-$gccversion" in
19397 irix-) ccflags="\$ccflags -woff 1178" ;;
19398 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19399 esac
19400 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19401 EOSH
19402 chmod +x Cppsym.try
19403 $eunicefix Cppsym.try
19404 ./Cppsym < Cppsym.know > Cppsym.true
19405 : now check the C compiler for additional symbols
19406 postprocess_cc_v=''
19407 case "$osname" in
19408 aix) postprocess_cc_v="|$tr , ' '" ;;
19409 esac
19410 $cat >ccsym <<EOS
19411 $startsh
19412 $cat >tmp.c <<EOF
19413 extern int foo;
19414 EOF
19415 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19416 do
19417         case "\$i" in
19418         -D*) echo "\$i" | $sed 's/^-D//';;
19419         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19420         esac
19421 done
19422 $rm -f try.c
19423 EOS
19424 postprocess_cc_v=''
19425 chmod +x ccsym
19426 $eunicefix ccsym
19427 ./ccsym > ccsym1.raw
19428 if $test -s ccsym1.raw; then
19429        $sort ccsym1.raw | $uniq >ccsym.raw
19430 else
19431        mv ccsym1.raw ccsym.raw
19432 fi
19433
19434 $awk '/\=/ { print $0; next }
19435         { print $0"=1" }' ccsym.raw >ccsym.list
19436 $awk '/\=/ { print $0; next }
19437         { print $0"=1" }' Cppsym.true >ccsym.true
19438 $comm -13 ccsym.true ccsym.list >ccsym.own
19439 $comm -12 ccsym.true ccsym.list >ccsym.com
19440 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19441 also=''
19442 if $test -z ccsym.raw; then
19443         echo "Your C compiler doesn't seem to define any symbols!" >&4
19444         echo " "
19445         echo "However, your C preprocessor defines the following symbols:"
19446         $cat Cppsym.true
19447         ccsymbols=''
19448         cppsymbols=`$cat Cppsym.true`
19449         cppsymbols=`echo $cppsymbols`
19450         cppccsymbols="$cppsymbols"
19451 else
19452         if $test -s ccsym.com; then
19453                 echo "Your C compiler and pre-processor define these symbols:"
19454                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19455                 also='also '
19456                 symbols='ones'
19457                 cppccsymbols=`$cat ccsym.com`
19458                 cppccsymbols=`echo $cppccsymbols`
19459                 $test "$silent" || sleep 1
19460         fi
19461         if $test -s ccsym.cpp; then
19462                 $test "$also" && echo " "
19463                 echo "Your C pre-processor ${also}defines the following symbols:"
19464                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19465                 also='further '
19466                 cppsymbols=`$cat ccsym.cpp`
19467                 cppsymbols=`echo $cppsymbols`
19468                 $test "$silent" || sleep 1
19469         fi
19470         if $test -s ccsym.own; then
19471                 $test "$also" && echo " "
19472                 echo "Your C compiler ${also}defines the following cpp symbols:"
19473                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19474                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19475                 ccsymbols=`$cat ccsym.own`
19476                 ccsymbols=`echo $ccsymbols`
19477                 $test "$silent" || sleep 1
19478         fi
19479 fi
19480
19481 : see if this is a termio system
19482 val="$undef"
19483 val2="$undef"
19484 val3="$undef"
19485 if $test `./findhdr termios.h`; then
19486         set tcsetattr i_termios
19487         eval $inlibc
19488         val3="$i_termios"
19489 fi
19490 echo " "
19491 case "$val3" in
19492 "$define") echo "You have POSIX termios.h... good!" >&4;;
19493 *) if ./Cppsym pyr; then
19494                 case "`/bin/universe`" in
19495                 ucb) if $test `./findhdr sgtty.h`; then
19496                                 val2="$define"
19497                                 echo "<sgtty.h> found." >&4
19498                         else
19499                                 echo "System is pyramid with BSD universe."
19500                                 echo "<sgtty.h> not found--you could have problems." >&4
19501                         fi;;
19502                 *) if $test `./findhdr termio.h`; then
19503                                 val="$define"
19504                                 echo "<termio.h> found." >&4
19505                         else
19506                                 echo "System is pyramid with USG universe."
19507                                 echo "<termio.h> not found--you could have problems." >&4
19508                         fi;;
19509                 esac
19510         elif ./usg; then
19511                 if $test `./findhdr termio.h`; then
19512                         echo "<termio.h> found." >&4
19513                         val="$define"
19514                 elif $test `./findhdr sgtty.h`; then
19515                         echo "<sgtty.h> found." >&4
19516                         val2="$define"
19517                 else
19518 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19519                 fi
19520         else
19521                 if $test `./findhdr sgtty.h`; then
19522                         echo "<sgtty.h> found." >&4
19523                         val2="$define"
19524                 elif $test `./findhdr termio.h`; then
19525                         echo "<termio.h> found." >&4
19526                         val="$define"
19527                 else
19528 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19529                 fi
19530         fi;;
19531 esac
19532 set i_termio; eval $setvar
19533 val=$val2; set i_sgtty; eval $setvar
19534 val=$val3; set i_termios; eval $setvar
19535
19536 : see if stddef is available
19537 set stddef.h i_stddef
19538 eval $inhdr
19539
19540 : see if this is a sunmath.h system
19541 set sunmath.h i_sunmath
19542 eval $inhdr
19543
19544 : see if sys/access.h is available
19545 set sys/access.h i_sysaccess
19546 eval $inhdr
19547
19548 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19549 set sys/filio.h i_sysfilio
19550 eval $inhdr
19551 echo " "
19552 if $test `./findhdr sys/ioctl.h`; then
19553         val="$define"
19554         echo '<sys/ioctl.h> found.' >&4
19555 else
19556         val="$undef"
19557         if $test $i_sysfilio = "$define"; then
19558             echo '<sys/ioctl.h> NOT found.' >&4
19559         else
19560                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19561                 $test $i_termio = "$define" && xxx="termio.h"
19562                 $test $i_termios = "$define" && xxx="termios.h"
19563 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19564         fi
19565 fi
19566 set i_sysioctl
19567 eval $setvar
19568
19569 : see if socket ioctl defs are in sys/sockio.h
19570 echo " "
19571 xxx=`./findhdr sys/sockio.h`
19572 if $test "$xxx"; then
19573         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19574                 val="$define"
19575                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19576         else
19577                 val="$undef"
19578                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19579         fi
19580 else
19581         val="$undef"
19582         $cat <<EOM
19583 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19584 EOM
19585 fi
19586 set i_syssockio
19587 eval $setvar
19588
19589
19590 : see if this is a syslog.h system
19591 set syslog.h i_syslog
19592 eval $inhdr
19593
19594
19595 : see if this is a sys/mode.h system
19596 set sys/mode.h i_sysmode
19597 eval $inhdr
19598
19599 : see if sys/resource.h has to be included
19600 set sys/resource.h i_sysresrc
19601 eval $inhdr
19602
19603 : see if sys/security.h is available
19604 set sys/security.h i_syssecrt
19605 eval $inhdr
19606
19607 : see if this is a sys/statvfs.h system
19608 set sys/statvfs.h i_sysstatvfs
19609 eval $inhdr
19610
19611 : see if this is a sys/un.h system
19612 set sys/un.h i_sysun
19613 eval $inhdr
19614
19615
19616 : see if this is a sys/utsname.h system
19617 set sys/utsname.h i_sysutsname
19618 eval $inhdr
19619
19620 : see if this is a syswait system
19621 set sys/wait.h i_syswait
19622 eval $inhdr
19623
19624 : see if this is a ustat.h system
19625 set ustat.h i_ustat
19626 eval $inhdr
19627
19628 : see if this is an utime system
19629 set utime.h i_utime
19630 eval $inhdr
19631
19632 : see if this is a values.h system
19633 set values.h i_values
19634 eval $inhdr
19635
19636 : see if this is a vfork system
19637 case "$d_vfork" in
19638 "$define")
19639         set vfork.h i_vfork
19640         eval $inhdr
19641         ;;
19642 *)
19643         i_vfork="$undef"
19644         ;;
19645 esac
19646
19647 : see if gdbm.h is available
19648 set gdbm.h t_gdbm
19649 eval $inhdr
19650 case "$t_gdbm" in
19651 $define)
19652         : see if gdbm_open exists
19653         set gdbm_open d_gdbm_open
19654         eval $inlibc
19655         case "$d_gdbm_open" in
19656         $undef)
19657                 t_gdbm="$undef"
19658                 echo "We won't be including <gdbm.h>"
19659                 ;;
19660         esac
19661         ;;
19662 esac
19663 val="$t_gdbm"
19664 set i_gdbm
19665 eval $setvar
19666
19667 echo " "
19668 echo "Looking for extensions..." >&4
19669 : If we are using the old config.sh, known_extensions may contain
19670 : old or inaccurate or duplicate values.
19671 known_extensions=''
19672 nonxs_extensions=''
19673 : We do not use find because it might not be available.
19674 : We do not just use MANIFEST because the user may have dropped
19675 : some additional extensions into the source tree and expect them
19676 : to be built.
19677
19678 : Function to recursively find available extensions, ignoring DynaLoader
19679 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19680 find_extensions='
19681     for xxx in *; do
19682        case "$xxx" in
19683            DynaLoader|dynaload) ;;
19684            *)
19685            if $test -f $xxx/$xxx.xs; then
19686                known_extensions="$known_extensions $1$xxx";
19687            elif $test -f $xxx/Makefile.PL; then
19688                nonxs_extensions="$nonxs_extensions $1$xxx";
19689            else
19690                if $test -d $xxx -a $# -lt 10; then
19691                    set $1$xxx/ $*;
19692                    cd "$xxx";
19693                    eval $find_extensions;
19694                    cd ..;
19695                    shift;
19696                fi;
19697            fi
19698            ;;
19699        esac;
19700     done'
19701 tdir=`pwd`
19702 cd "$rsrc/ext"
19703 set X
19704 shift
19705 eval $find_extensions
19706 # Special case:  Add in threads/shared since it is not picked up by the
19707 # recursive find above (and adding in general recursive finding breaks
19708 # SDBM_File/sdbm).  A.D.  10/25/2001.
19709 known_extensions="$known_extensions threads/shared"
19710 set X $nonxs_extensions
19711 shift
19712 nonxs_extensions="$*"
19713 set X $known_extensions
19714 shift
19715 known_extensions="$*"
19716 cd "$tdir"
19717
19718 : Now see which are supported on this system.
19719 avail_ext=''
19720 for xxx in $known_extensions ; do
19721         case "$xxx" in
19722         DB_File|db_file)
19723                 case "$i_db" in
19724                 $define) avail_ext="$avail_ext $xxx" ;;
19725                 esac
19726                 ;;
19727         GDBM_File|gdbm_fil)
19728                 case "$i_gdbm" in 
19729                 $define) avail_ext="$avail_ext $xxx" ;;
19730                 esac
19731                 ;;
19732         I18N/Langinfo|i18n_lan)
19733                 case "$i_langinfo$d_nl_langinfo" in 
19734                 $define$define) avail_ext="$avail_ext $xxx" ;;
19735                 esac
19736                 ;;
19737         NDBM_File|ndbm_fil)
19738                 case "$i_ndbm" in
19739                 $define)
19740                     case "$osname-$use64bitint" in
19741                     hpux-define)
19742                         case "$libs" in
19743                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19744                         esac
19745                         ;;
19746                     *) avail_ext="$avail_ext $xxx" ;;
19747                     esac
19748                     ;;
19749                 esac
19750                 ;;
19751         ODBM_File|odbm_fil) 
19752                 case "${i_dbm}${i_rpcsvcdbm}" in
19753                 *"${define}"*)
19754                     case "$osname-$use64bitint" in
19755                     hpux-define)
19756                         case "$libs" in
19757                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19758                         esac
19759                         ;;
19760                     *) avail_ext="$avail_ext $xxx" ;;
19761                     esac
19762                     ;;
19763                 esac
19764                 ;;
19765         POSIX|posix)
19766                 case "$useposix" in
19767                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19768                 esac
19769                 ;;
19770         Opcode|opcode)
19771                 case "$useopcode" in
19772                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19773                 esac
19774                 ;;
19775         Socket|socket)
19776                 case "$d_socket" in 
19777                 true|$define|y)
19778                     case "$osname" in
19779                     beos) ;; # not unless BONE
19780                     *) avail_ext="$avail_ext $xxx" ;;
19781                     esac
19782                     ;;
19783                 esac
19784                 ;;
19785         Sys/Syslog|sys/syslog)
19786                 : XXX syslog requires socket
19787                 case "$d_socket" in 
19788                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19789                 esac
19790                 ;;
19791         Thread|thread)
19792                 case "$usethreads" in
19793                 true|$define|y)
19794                         case "$useithreads" in
19795                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19796                         esac
19797                 esac
19798                 ;;
19799         XS/APItest|xs/apitest)
19800                 # This is just for testing.  Skip it unless we have dynamic loading.
19801
19802                 case "$usedl" in
19803                 $define) avail_ext="$avail_ext $xxx" ;;
19804                 esac
19805                 ;;
19806         XS/Typemap|xs/typemap)
19807                 # This is just for testing.  Skip it unless we have dynamic loading.
19808                 case "$usedl" in
19809                 $define) avail_ext="$avail_ext $xxx" ;;
19810                 esac
19811                 ;;
19812         threads|threads/shared)
19813                 # threads and threads::shared are special cases.
19814                 # To stop people from asking "Perl 5.8.0 was supposed
19815                 # to have this new fancy threads implementation but my
19816                 # perl doesn't have it" and from people trying to
19817                 # (re)install the threads module using CPAN.pm and
19818                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19819                 # the threads.pm and threads/shared.pm will always be
19820                 # there, croaking informatively ("you need to rebuild
19821                 # all of Perl with threads, sorry") when threads haven't
19822                 # been compiled in.
19823                 # --jhi
19824                 avail_ext="$avail_ext $xxx"
19825                 ;;
19826         IPC/SysV|ipc/sysv)
19827                 : XXX Do we need a useipcsysv variable here
19828                 case "${d_msg}${d_sem}${d_shm}" in 
19829                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19830                 esac
19831                 ;;
19832         *)      avail_ext="$avail_ext $xxx"
19833                 ;;
19834         esac
19835 done
19836
19837 set X $avail_ext
19838 shift
19839 avail_ext="$*"
19840
19841 : Now see which nonxs extensions are supported on this system.
19842 : For now assume all are.
19843 nonxs_ext=''
19844 for xxx in $nonxs_extensions ; do
19845         case "$xxx" in
19846         *)      nonxs_ext="$nonxs_ext $xxx"
19847                 ;;
19848         esac
19849 done
19850
19851 set X $nonxs_ext
19852 shift
19853 nonxs_ext="$*"
19854
19855 case $usedl in
19856 $define)
19857         $cat <<EOM
19858 A number of extensions are supplied with $package.  You may choose to
19859 compile these extensions for dynamic loading (the default), compile
19860 them into the $package executable (static loading), or not include
19861 them at all.  Answer "none" to include no extensions.
19862 Note that DynaLoader is always built and need not be mentioned here.
19863
19864 EOM
19865         case "$dynamic_ext" in
19866         '')
19867                 : Exclude those listed in static_ext
19868                 dflt=''
19869                 for xxx in $avail_ext; do
19870                         case " $static_ext " in
19871                         *" $xxx "*) ;;
19872                         *) dflt="$dflt $xxx" ;;
19873                         esac
19874                 done
19875                 set X $dflt
19876                 shift
19877                 dflt="$*"
19878                 ;;
19879         *)      dflt="$dynamic_ext"
19880                 # Perhaps we are reusing an old out-of-date config.sh.
19881                 case "$hint" in
19882                 previous)
19883                         if test X"$dynamic_ext" != X"$avail_ext"; then
19884                                 $cat <<EOM
19885 NOTICE:  Your previous config.sh list may be incorrect. 
19886 The extensions now available to you are 
19887         ${avail_ext}
19888 but the default list from your previous config.sh is
19889         ${dynamic_ext} 
19890
19891 EOM
19892                         fi
19893                         ;;
19894                 esac
19895                 ;;
19896         esac
19897         case "$dflt" in
19898         '')     dflt=none;;
19899         esac
19900         rp="What extensions do you wish to load dynamically?"
19901         . ./myread
19902         case "$ans" in
19903         none) dynamic_ext=' ' ;;
19904         *) dynamic_ext="$ans" ;;
19905         esac
19906
19907         case "$static_ext" in
19908         '')
19909                 : Exclude those already listed in dynamic linking
19910                 dflt=''
19911                 for xxx in $avail_ext; do
19912                         case " $dynamic_ext " in
19913                         *" $xxx "*) ;;
19914                         *) dflt="$dflt $xxx" ;;
19915                         esac
19916                 done
19917                 set X $dflt
19918                 shift
19919                 dflt="$*"
19920                 ;;
19921         *)  dflt="$static_ext" 
19922                 ;;
19923         esac
19924
19925         case "$dflt" in
19926         '')     dflt=none;;
19927         esac
19928         rp="What extensions do you wish to load statically?"
19929         . ./myread
19930         case "$ans" in
19931         none) static_ext=' ' ;;
19932         *) static_ext="$ans" ;;
19933         esac
19934         ;;
19935 *)
19936         $cat <<EOM
19937 A number of extensions are supplied with $package.  Answer "none" 
19938 to include no extensions. 
19939 Note that DynaLoader is always built and need not be mentioned here.
19940
19941 EOM
19942         case "$static_ext" in
19943         '') dflt="$avail_ext" ;;
19944         *)      dflt="$static_ext"
19945                 # Perhaps we are reusing an old out-of-date config.sh.
19946                 case "$hint" in
19947                 previous)
19948                         if test X"$static_ext" != X"$avail_ext"; then
19949                                 $cat <<EOM
19950 NOTICE:  Your previous config.sh list may be incorrect. 
19951 The extensions now available to you are 
19952         ${avail_ext}
19953 but the default list from your previous config.sh is
19954         ${static_ext} 
19955
19956 EOM
19957                         fi
19958                         ;;
19959                 esac
19960                 ;;
19961         esac
19962         : Exclude those that are not xs extensions
19963         case "$dflt" in
19964         '')     dflt=none;;
19965         esac
19966         rp="What extensions do you wish to include?"
19967         . ./myread
19968         case "$ans" in
19969         none) static_ext=' ' ;;
19970         *) static_ext="$ans" ;;
19971         esac
19972         ;;
19973 esac
19974 #        
19975 # Encode is a special case.  If we are building Encode as a static
19976 # extension, we need to explicitly list its subextensions as well.
19977 # For other nested extensions, this is handled automatically by
19978 # the appropriate Makefile.PL.
19979 case " $static_ext " in
19980         *" Encode "*) # Add the subextensions of Encode
19981         cd "$rsrc/ext"
19982         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
19983                 static_ext="$static_ext Encode/$xxx"
19984         done
19985         cd "$tdir"
19986         ;;
19987 esac
19988
19989 set X $dynamic_ext $static_ext $nonxs_ext
19990 shift
19991 extensions="$*"
19992
19993 : Remove libraries needed only for extensions
19994 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
19995 : The exception is SunOS 4.x, which needs them.
19996 case "${osname}X${osvers}" in
19997 sunos*X4*)
19998     perllibs="$libs"
19999     ;;
20000 *) case "$usedl" in
20001     $define|true|[yY]*)
20002             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20003             shift
20004             perllibs="$*"
20005             ;;
20006     *)  perllibs="$libs"
20007             ;;
20008     esac
20009     ;;
20010 esac
20011
20012 : Remove build directory name from cppstdin so it can be used from
20013 : either the present location or the final installed location.
20014 echo " "
20015 : Get out of the UU directory to get correct path name.
20016 cd ..
20017 case "$cppstdin" in
20018 `pwd`/cppstdin)
20019         echo "Stripping down cppstdin path name"
20020         cppstdin=cppstdin
20021         ;;
20022 esac
20023 cd UU
20024
20025 : end of configuration questions
20026 echo " "
20027 echo "End of configuration questions."
20028 echo " "
20029
20030 : back to where it started
20031 if test -d ../UU; then
20032         cd ..
20033 fi
20034
20035 : configuration may be patched via a 'config.arch' file
20036 if $test -f config.arch; then
20037         echo "I see a config.arch file, loading it."
20038         . ./config.arch
20039 fi
20040
20041 : configuration may be patched via a 'config.over' file
20042 if $test -f config.over; then
20043         echo " "
20044         dflt=y
20045         rp='I see a config.over file.  Do you wish to load it?'
20046         . UU/myread
20047         case "$ans" in
20048         n*) echo "OK, I'll ignore it.";;
20049         *)      . ./config.over
20050                 echo "Configuration override changes have been loaded."
20051                 ;;
20052         esac
20053 fi
20054
20055 : in case they want portability, strip down executable paths
20056 case "$d_portable" in
20057 "$define")
20058         echo " "
20059         echo "Stripping down executable paths..." >&4
20060         for file in $loclist $trylist; do
20061                 eval temp=\$$file
20062                 eval $file=`basename $temp`
20063         done
20064         ;;
20065 esac
20066
20067 : create config.sh file
20068 echo " "
20069 echo "Creating config.sh..." >&4
20070 $spitshell <<EOT >config.sh
20071 $startsh
20072 #
20073 # This file was produced by running the Configure script. It holds all the
20074 # definitions figured out by Configure. Should you modify one of these values,
20075 # do not forget to propagate your changes by running "Configure -der". You may
20076 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20077 #
20078
20079 # Package name      : $package
20080 # Source directory  : $src
20081 # Configuration time: $cf_time
20082 # Configured by     : $cf_by
20083 # Target system     : $myuname
20084
20085 Author='$Author'
20086 Date='$Date'
20087 Header='$Header'
20088 Id='$Id'
20089 Locker='$Locker'
20090 Log='$Log'
20091 Mcc='$Mcc'
20092 RCSfile='$RCSfile'
20093 Revision='$Revision'
20094 Source='$Source'
20095 State='$State'
20096 _a='$_a'
20097 _exe='$_exe'
20098 _o='$_o'
20099 afs='$afs'
20100 afsroot='$afsroot'
20101 alignbytes='$alignbytes'
20102 ansi2knr='$ansi2knr'
20103 aphostname='$aphostname'
20104 api_revision='$api_revision'
20105 api_subversion='$api_subversion'
20106 api_version='$api_version'
20107 api_versionstring='$api_versionstring'
20108 ar='$ar'
20109 archlib='$archlib'
20110 archlibexp='$archlibexp'
20111 archname64='$archname64'
20112 archname='$archname'
20113 archobjs='$archobjs'
20114 asctime_r_proto='$asctime_r_proto'
20115 awk='$awk'
20116 baserev='$baserev'
20117 bash='$bash'
20118 bin='$bin'
20119 binexp='$binexp'
20120 bison='$bison'
20121 byacc='$byacc'
20122 byteorder='$byteorder'
20123 c='$c'
20124 castflags='$castflags'
20125 cat='$cat'
20126 cc='$cc'
20127 cccdlflags='$cccdlflags'
20128 ccdlflags='$ccdlflags'
20129 ccflags='$ccflags'
20130 ccflags_uselargefiles='$ccflags_uselargefiles'
20131 ccname='$ccname'
20132 ccsymbols='$ccsymbols'
20133 ccversion='$ccversion'
20134 cf_by='$cf_by'
20135 cf_email='$cf_email'
20136 cf_time='$cf_time'
20137 charsize='$charsize'
20138 chgrp='$chgrp'
20139 chmod='$chmod'
20140 chown='$chown'
20141 clocktype='$clocktype'
20142 comm='$comm'
20143 compress='$compress'
20144 contains='$contains'
20145 cp='$cp'
20146 cpio='$cpio'
20147 cpp='$cpp'
20148 cpp_stuff='$cpp_stuff'
20149 cppccsymbols='$cppccsymbols'
20150 cppflags='$cppflags'
20151 cpplast='$cpplast'
20152 cppminus='$cppminus'
20153 cpprun='$cpprun'
20154 cppstdin='$cppstdin'
20155 cppsymbols='$cppsymbols'
20156 crypt_r_proto='$crypt_r_proto'
20157 cryptlib='$cryptlib'
20158 csh='$csh'
20159 ctermid_r_proto='$ctermid_r_proto'
20160 ctime_r_proto='$ctime_r_proto'
20161 d_Gconvert='$d_Gconvert'
20162 d_PRIEUldbl='$d_PRIEUldbl'
20163 d_PRIFUldbl='$d_PRIFUldbl'
20164 d_PRIGUldbl='$d_PRIGUldbl'
20165 d_PRIXU64='$d_PRIXU64'
20166 d_PRId64='$d_PRId64'
20167 d_PRIeldbl='$d_PRIeldbl'
20168 d_PRIfldbl='$d_PRIfldbl'
20169 d_PRIgldbl='$d_PRIgldbl'
20170 d_PRIi64='$d_PRIi64'
20171 d_PRIo64='$d_PRIo64'
20172 d_PRIu64='$d_PRIu64'
20173 d_PRIx64='$d_PRIx64'
20174 d_SCNfldbl='$d_SCNfldbl'
20175 d__fwalk='$d__fwalk'
20176 d_access='$d_access'
20177 d_accessx='$d_accessx'
20178 d_alarm='$d_alarm'
20179 d_archlib='$d_archlib'
20180 d_asctime_r='$d_asctime_r'
20181 d_atolf='$d_atolf'
20182 d_atoll='$d_atoll'
20183 d_attribut='$d_attribut'
20184 d_bcmp='$d_bcmp'
20185 d_bcopy='$d_bcopy'
20186 d_bsd='$d_bsd'
20187 d_bsdgetpgrp='$d_bsdgetpgrp'
20188 d_bsdsetpgrp='$d_bsdsetpgrp'
20189 d_bzero='$d_bzero'
20190 d_casti32='$d_casti32'
20191 d_castneg='$d_castneg'
20192 d_charvspr='$d_charvspr'
20193 d_chown='$d_chown'
20194 d_chroot='$d_chroot'
20195 d_chsize='$d_chsize'
20196 d_class='$d_class'
20197 d_closedir='$d_closedir'
20198 d_cmsghdr_s='$d_cmsghdr_s'
20199 d_const='$d_const'
20200 d_crypt='$d_crypt'
20201 d_crypt_r='$d_crypt_r'
20202 d_csh='$d_csh'
20203 d_ctermid_r='$d_ctermid_r'
20204 d_ctime_r='$d_ctime_r'
20205 d_cuserid='$d_cuserid'
20206 d_dbl_dig='$d_dbl_dig'
20207 d_dbminitproto='$d_dbminitproto'
20208 d_difftime='$d_difftime'
20209 d_dirfd='$d_dirfd'
20210 d_dirnamlen='$d_dirnamlen'
20211 d_dlerror='$d_dlerror'
20212 d_dlopen='$d_dlopen'
20213 d_dlsymun='$d_dlsymun'
20214 d_dosuid='$d_dosuid'
20215 d_drand48_r='$d_drand48_r'
20216 d_drand48proto='$d_drand48proto'
20217 d_dup2='$d_dup2'
20218 d_eaccess='$d_eaccess'
20219 d_endgrent='$d_endgrent'
20220 d_endgrent_r='$d_endgrent_r'
20221 d_endhent='$d_endhent'
20222 d_endhostent_r='$d_endhostent_r'
20223 d_endnent='$d_endnent'
20224 d_endnetent_r='$d_endnetent_r'
20225 d_endpent='$d_endpent'
20226 d_endprotoent_r='$d_endprotoent_r'
20227 d_endpwent='$d_endpwent'
20228 d_endpwent_r='$d_endpwent_r'
20229 d_endsent='$d_endsent'
20230 d_endservent_r='$d_endservent_r'
20231 d_eofnblk='$d_eofnblk'
20232 d_eunice='$d_eunice'
20233 d_fchdir='$d_fchdir'
20234 d_fchmod='$d_fchmod'
20235 d_fchown='$d_fchown'
20236 d_fcntl='$d_fcntl'
20237 d_fcntl_can_lock='$d_fcntl_can_lock'
20238 d_fd_macros='$d_fd_macros'
20239 d_fd_set='$d_fd_set'
20240 d_fds_bits='$d_fds_bits'
20241 d_fgetpos='$d_fgetpos'
20242 d_finite='$d_finite'
20243 d_finitel='$d_finitel'
20244 d_flexfnam='$d_flexfnam'
20245 d_flock='$d_flock'
20246 d_flockproto='$d_flockproto'
20247 d_fork='$d_fork'
20248 d_fp_class='$d_fp_class'
20249 d_fpathconf='$d_fpathconf'
20250 d_fpclass='$d_fpclass'
20251 d_fpclassify='$d_fpclassify'
20252 d_fpclassl='$d_fpclassl'
20253 d_fpos64_t='$d_fpos64_t'
20254 d_frexpl='$d_frexpl'
20255 d_fs_data_s='$d_fs_data_s'
20256 d_fseeko='$d_fseeko'
20257 d_fsetpos='$d_fsetpos'
20258 d_fstatfs='$d_fstatfs'
20259 d_fstatvfs='$d_fstatvfs'
20260 d_fsync='$d_fsync'
20261 d_ftello='$d_ftello'
20262 d_ftime='$d_ftime'
20263 d_getcwd='$d_getcwd'
20264 d_getespwnam='$d_getespwnam'
20265 d_getfsstat='$d_getfsstat'
20266 d_getgrent='$d_getgrent'
20267 d_getgrent_r='$d_getgrent_r'
20268 d_getgrgid_r='$d_getgrgid_r'
20269 d_getgrnam_r='$d_getgrnam_r'
20270 d_getgrps='$d_getgrps'
20271 d_gethbyaddr='$d_gethbyaddr'
20272 d_gethbyname='$d_gethbyname'
20273 d_gethent='$d_gethent'
20274 d_gethname='$d_gethname'
20275 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20276 d_gethostbyname_r='$d_gethostbyname_r'
20277 d_gethostent_r='$d_gethostent_r'
20278 d_gethostprotos='$d_gethostprotos'
20279 d_getitimer='$d_getitimer'
20280 d_getlogin='$d_getlogin'
20281 d_getlogin_r='$d_getlogin_r'
20282 d_getmnt='$d_getmnt'
20283 d_getmntent='$d_getmntent'
20284 d_getnbyaddr='$d_getnbyaddr'
20285 d_getnbyname='$d_getnbyname'
20286 d_getnent='$d_getnent'
20287 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20288 d_getnetbyname_r='$d_getnetbyname_r'
20289 d_getnetent_r='$d_getnetent_r'
20290 d_getnetprotos='$d_getnetprotos'
20291 d_getpagsz='$d_getpagsz'
20292 d_getpbyname='$d_getpbyname'
20293 d_getpbynumber='$d_getpbynumber'
20294 d_getpent='$d_getpent'
20295 d_getpgid='$d_getpgid'
20296 d_getpgrp2='$d_getpgrp2'
20297 d_getpgrp='$d_getpgrp'
20298 d_getppid='$d_getppid'
20299 d_getprior='$d_getprior'
20300 d_getprotobyname_r='$d_getprotobyname_r'
20301 d_getprotobynumber_r='$d_getprotobynumber_r'
20302 d_getprotoent_r='$d_getprotoent_r'
20303 d_getprotoprotos='$d_getprotoprotos'
20304 d_getprpwnam='$d_getprpwnam'
20305 d_getpwent='$d_getpwent'
20306 d_getpwent_r='$d_getpwent_r'
20307 d_getpwnam_r='$d_getpwnam_r'
20308 d_getpwuid_r='$d_getpwuid_r'
20309 d_getsbyname='$d_getsbyname'
20310 d_getsbyport='$d_getsbyport'
20311 d_getsent='$d_getsent'
20312 d_getservbyname_r='$d_getservbyname_r'
20313 d_getservbyport_r='$d_getservbyport_r'
20314 d_getservent_r='$d_getservent_r'
20315 d_getservprotos='$d_getservprotos'
20316 d_getspnam='$d_getspnam'
20317 d_getspnam_r='$d_getspnam_r'
20318 d_gettimeod='$d_gettimeod'
20319 d_gmtime_r='$d_gmtime_r'
20320 d_gnulibc='$d_gnulibc'
20321 d_grpasswd='$d_grpasswd'
20322 d_hasmntopt='$d_hasmntopt'
20323 d_htonl='$d_htonl'
20324 d_index='$d_index'
20325 d_inetaton='$d_inetaton'
20326 d_int64_t='$d_int64_t'
20327 d_isascii='$d_isascii'
20328 d_isfinite='$d_isfinite'
20329 d_isinf='$d_isinf'
20330 d_isnan='$d_isnan'
20331 d_isnanl='$d_isnanl'
20332 d_killpg='$d_killpg'
20333 d_lchown='$d_lchown'
20334 d_ldbl_dig='$d_ldbl_dig'
20335 d_link='$d_link'
20336 d_localtime_r='$d_localtime_r'
20337 d_locconv='$d_locconv'
20338 d_lockf='$d_lockf'
20339 d_longdbl='$d_longdbl'
20340 d_longlong='$d_longlong'
20341 d_lseekproto='$d_lseekproto'
20342 d_lstat='$d_lstat'
20343 d_madvise='$d_madvise'
20344 d_mblen='$d_mblen'
20345 d_mbstowcs='$d_mbstowcs'
20346 d_mbtowc='$d_mbtowc'
20347 d_memchr='$d_memchr'
20348 d_memcmp='$d_memcmp'
20349 d_memcpy='$d_memcpy'
20350 d_memmove='$d_memmove'
20351 d_memset='$d_memset'
20352 d_mkdir='$d_mkdir'
20353 d_mkdtemp='$d_mkdtemp'
20354 d_mkfifo='$d_mkfifo'
20355 d_mkstemp='$d_mkstemp'
20356 d_mkstemps='$d_mkstemps'
20357 d_mktime='$d_mktime'
20358 d_mmap='$d_mmap'
20359 d_modfl='$d_modfl'
20360 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20361 d_modflproto='$d_modflproto'
20362 d_mprotect='$d_mprotect'
20363 d_msg='$d_msg'
20364 d_msg_ctrunc='$d_msg_ctrunc'
20365 d_msg_dontroute='$d_msg_dontroute'
20366 d_msg_oob='$d_msg_oob'
20367 d_msg_peek='$d_msg_peek'
20368 d_msg_proxy='$d_msg_proxy'
20369 d_msgctl='$d_msgctl'
20370 d_msgget='$d_msgget'
20371 d_msghdr_s='$d_msghdr_s'
20372 d_msgrcv='$d_msgrcv'
20373 d_msgsnd='$d_msgsnd'
20374 d_msync='$d_msync'
20375 d_munmap='$d_munmap'
20376 d_mymalloc='$d_mymalloc'
20377 d_nanosleep='$d_nanosleep'
20378 d_nice='$d_nice'
20379 d_nl_langinfo='$d_nl_langinfo'
20380 d_nv_preserves_uv='$d_nv_preserves_uv'
20381 d_off64_t='$d_off64_t'
20382 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20383 d_oldpthreads='$d_oldpthreads'
20384 d_oldsock='$d_oldsock'
20385 d_open3='$d_open3'
20386 d_pathconf='$d_pathconf'
20387 d_pause='$d_pause'
20388 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20389 d_phostname='$d_phostname'
20390 d_pipe='$d_pipe'
20391 d_poll='$d_poll'
20392 d_portable='$d_portable'
20393 d_procselfexe='$d_procselfexe'
20394 d_pthread_atfork='$d_pthread_atfork'
20395 d_pthread_yield='$d_pthread_yield'
20396 d_pwage='$d_pwage'
20397 d_pwchange='$d_pwchange'
20398 d_pwclass='$d_pwclass'
20399 d_pwcomment='$d_pwcomment'
20400 d_pwexpire='$d_pwexpire'
20401 d_pwgecos='$d_pwgecos'
20402 d_pwpasswd='$d_pwpasswd'
20403 d_pwquota='$d_pwquota'
20404 d_qgcvt='$d_qgcvt'
20405 d_quad='$d_quad'
20406 d_random_r='$d_random_r'
20407 d_readdir64_r='$d_readdir64_r'
20408 d_readdir='$d_readdir'
20409 d_readdir_r='$d_readdir_r'
20410 d_readlink='$d_readlink'
20411 d_readv='$d_readv'
20412 d_recvmsg='$d_recvmsg'
20413 d_rename='$d_rename'
20414 d_rewinddir='$d_rewinddir'
20415 d_rmdir='$d_rmdir'
20416 d_safebcpy='$d_safebcpy'
20417 d_safemcpy='$d_safemcpy'
20418 d_sanemcmp='$d_sanemcmp'
20419 d_sbrkproto='$d_sbrkproto'
20420 d_sched_yield='$d_sched_yield'
20421 d_scm_rights='$d_scm_rights'
20422 d_seekdir='$d_seekdir'
20423 d_select='$d_select'
20424 d_sem='$d_sem'
20425 d_semctl='$d_semctl'
20426 d_semctl_semid_ds='$d_semctl_semid_ds'
20427 d_semctl_semun='$d_semctl_semun'
20428 d_semget='$d_semget'
20429 d_semop='$d_semop'
20430 d_sendmsg='$d_sendmsg'
20431 d_setegid='$d_setegid'
20432 d_seteuid='$d_seteuid'
20433 d_setgrent='$d_setgrent'
20434 d_setgrent_r='$d_setgrent_r'
20435 d_setgrps='$d_setgrps'
20436 d_sethent='$d_sethent'
20437 d_sethostent_r='$d_sethostent_r'
20438 d_setitimer='$d_setitimer'
20439 d_setlinebuf='$d_setlinebuf'
20440 d_setlocale='$d_setlocale'
20441 d_setlocale_r='$d_setlocale_r'
20442 d_setnent='$d_setnent'
20443 d_setnetent_r='$d_setnetent_r'
20444 d_setpent='$d_setpent'
20445 d_setpgid='$d_setpgid'
20446 d_setpgrp2='$d_setpgrp2'
20447 d_setpgrp='$d_setpgrp'
20448 d_setprior='$d_setprior'
20449 d_setproctitle='$d_setproctitle'
20450 d_setprotoent_r='$d_setprotoent_r'
20451 d_setpwent='$d_setpwent'
20452 d_setpwent_r='$d_setpwent_r'
20453 d_setregid='$d_setregid'
20454 d_setresgid='$d_setresgid'
20455 d_setresuid='$d_setresuid'
20456 d_setreuid='$d_setreuid'
20457 d_setrgid='$d_setrgid'
20458 d_setruid='$d_setruid'
20459 d_setsent='$d_setsent'
20460 d_setservent_r='$d_setservent_r'
20461 d_setsid='$d_setsid'
20462 d_setvbuf='$d_setvbuf'
20463 d_sfio='$d_sfio'
20464 d_shm='$d_shm'
20465 d_shmat='$d_shmat'
20466 d_shmatprototype='$d_shmatprototype'
20467 d_shmctl='$d_shmctl'
20468 d_shmdt='$d_shmdt'
20469 d_shmget='$d_shmget'
20470 d_sigaction='$d_sigaction'
20471 d_sigprocmask='$d_sigprocmask'
20472 d_sigsetjmp='$d_sigsetjmp'
20473 d_sockatmark='$d_sockatmark'
20474 d_sockatmarkproto='$d_sockatmarkproto'
20475 d_socket='$d_socket'
20476 d_socklen_t='$d_socklen_t'
20477 d_sockpair='$d_sockpair'
20478 d_socks5_init='$d_socks5_init'
20479 d_sqrtl='$d_sqrtl'
20480 d_srand48_r='$d_srand48_r'
20481 d_srandom_r='$d_srandom_r'
20482 d_sresgproto='$d_sresgproto'
20483 d_sresuproto='$d_sresuproto'
20484 d_statblks='$d_statblks'
20485 d_statfs_f_flags='$d_statfs_f_flags'
20486 d_statfs_s='$d_statfs_s'
20487 d_statvfs='$d_statvfs'
20488 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20489 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20490 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20491 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20492 d_stdio_stream_array='$d_stdio_stream_array'
20493 d_stdiobase='$d_stdiobase'
20494 d_stdstdio='$d_stdstdio'
20495 d_strchr='$d_strchr'
20496 d_strcoll='$d_strcoll'
20497 d_strctcpy='$d_strctcpy'
20498 d_strerrm='$d_strerrm'
20499 d_strerror='$d_strerror'
20500 d_strerror_r='$d_strerror_r'
20501 d_strftime='$d_strftime'
20502 d_strtod='$d_strtod'
20503 d_strtol='$d_strtol'
20504 d_strtold='$d_strtold'
20505 d_strtoll='$d_strtoll'
20506 d_strtoq='$d_strtoq'
20507 d_strtoul='$d_strtoul'
20508 d_strtoull='$d_strtoull'
20509 d_strtouq='$d_strtouq'
20510 d_strxfrm='$d_strxfrm'
20511 d_suidsafe='$d_suidsafe'
20512 d_symlink='$d_symlink'
20513 d_syscall='$d_syscall'
20514 d_syscallproto='$d_syscallproto'
20515 d_sysconf='$d_sysconf'
20516 d_sysernlst='$d_sysernlst'
20517 d_syserrlst='$d_syserrlst'
20518 d_system='$d_system'
20519 d_tcgetpgrp='$d_tcgetpgrp'
20520 d_tcsetpgrp='$d_tcsetpgrp'
20521 d_telldir='$d_telldir'
20522 d_telldirproto='$d_telldirproto'
20523 d_time='$d_time'
20524 d_times='$d_times'
20525 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20526 d_tm_tm_zone='$d_tm_tm_zone'
20527 d_tmpnam_r='$d_tmpnam_r'
20528 d_truncate='$d_truncate'
20529 d_ttyname_r='$d_ttyname_r'
20530 d_tzname='$d_tzname'
20531 d_u32align='$d_u32align'
20532 d_ualarm='$d_ualarm'
20533 d_umask='$d_umask'
20534 d_uname='$d_uname'
20535 d_union_semun='$d_union_semun'
20536 d_unordered='$d_unordered'
20537 d_usleep='$d_usleep'
20538 d_usleepproto='$d_usleepproto'
20539 d_ustat='$d_ustat'
20540 d_vendorarch='$d_vendorarch'
20541 d_vendorbin='$d_vendorbin'
20542 d_vendorlib='$d_vendorlib'
20543 d_vendorscript='$d_vendorscript'
20544 d_vfork='$d_vfork'
20545 d_void_closedir='$d_void_closedir'
20546 d_voidsig='$d_voidsig'
20547 d_voidtty='$d_voidtty'
20548 d_volatile='$d_volatile'
20549 d_vprintf='$d_vprintf'
20550 d_wait4='$d_wait4'
20551 d_waitpid='$d_waitpid'
20552 d_wcstombs='$d_wcstombs'
20553 d_wctomb='$d_wctomb'
20554 d_writev='$d_writev'
20555 d_xenix='$d_xenix'
20556 date='$date'
20557 db_hashtype='$db_hashtype'
20558 db_prefixtype='$db_prefixtype'
20559 db_version_major='$db_version_major'
20560 db_version_minor='$db_version_minor'
20561 db_version_patch='$db_version_patch'
20562 defvoidused='$defvoidused'
20563 direntrytype='$direntrytype'
20564 dlext='$dlext'
20565 dlsrc='$dlsrc'
20566 doublesize='$doublesize'
20567 drand01='$drand01'
20568 drand48_r_proto='$drand48_r_proto'
20569 dynamic_ext='$dynamic_ext'
20570 eagain='$eagain'
20571 ebcdic='$ebcdic'
20572 echo='$echo'
20573 egrep='$egrep'
20574 emacs='$emacs'
20575 endgrent_r_proto='$endgrent_r_proto'
20576 endhostent_r_proto='$endhostent_r_proto'
20577 endnetent_r_proto='$endnetent_r_proto'
20578 endprotoent_r_proto='$endprotoent_r_proto'
20579 endpwent_r_proto='$endpwent_r_proto'
20580 endservent_r_proto='$endservent_r_proto'
20581 eunicefix='$eunicefix'
20582 exe_ext='$exe_ext'
20583 expr='$expr'
20584 extensions='$extensions'
20585 extras='$extras'
20586 fflushNULL='$fflushNULL'
20587 fflushall='$fflushall'
20588 find='$find'
20589 firstmakefile='$firstmakefile'
20590 flex='$flex'
20591 fpossize='$fpossize'
20592 fpostype='$fpostype'
20593 freetype='$freetype'
20594 from='$from'
20595 full_ar='$full_ar'
20596 full_csh='$full_csh'
20597 full_sed='$full_sed'
20598 gccansipedantic='$gccansipedantic'
20599 gccosandvers='$gccosandvers'
20600 gccversion='$gccversion'
20601 getgrent_r_proto='$getgrent_r_proto'
20602 getgrgid_r_proto='$getgrgid_r_proto'
20603 getgrnam_r_proto='$getgrnam_r_proto'
20604 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20605 gethostbyname_r_proto='$gethostbyname_r_proto'
20606 gethostent_r_proto='$gethostent_r_proto'
20607 getlogin_r_proto='$getlogin_r_proto'
20608 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20609 getnetbyname_r_proto='$getnetbyname_r_proto'
20610 getnetent_r_proto='$getnetent_r_proto'
20611 getprotobyname_r_proto='$getprotobyname_r_proto'
20612 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20613 getprotoent_r_proto='$getprotoent_r_proto'
20614 getpwent_r_proto='$getpwent_r_proto'
20615 getpwnam_r_proto='$getpwnam_r_proto'
20616 getpwuid_r_proto='$getpwuid_r_proto'
20617 getservbyname_r_proto='$getservbyname_r_proto'
20618 getservbyport_r_proto='$getservbyport_r_proto'
20619 getservent_r_proto='$getservent_r_proto'
20620 getspnam_r_proto='$getspnam_r_proto'
20621 gidformat='$gidformat'
20622 gidsign='$gidsign'
20623 gidsize='$gidsize'
20624 gidtype='$gidtype'
20625 glibpth='$glibpth'
20626 gmake='$gmake'
20627 gmtime_r_proto='$gmtime_r_proto'
20628 gnulibc_version='$gnulibc_version'
20629 grep='$grep'
20630 groupcat='$groupcat'
20631 groupstype='$groupstype'
20632 gzip='$gzip'
20633 h_fcntl='$h_fcntl'
20634 h_sysfile='$h_sysfile'
20635 hint='$hint'
20636 hostcat='$hostcat'
20637 html1dir='$html1dir'
20638 html1direxp='$html1direxp'
20639 html3dir='$html3dir'
20640 html3direxp='$html3direxp'
20641 i16size='$i16size'
20642 i16type='$i16type'
20643 i32size='$i32size'
20644 i32type='$i32type'
20645 i64size='$i64size'
20646 i64type='$i64type'
20647 i8size='$i8size'
20648 i8type='$i8type'
20649 i_arpainet='$i_arpainet'
20650 i_bsdioctl='$i_bsdioctl'
20651 i_crypt='$i_crypt'
20652 i_db='$i_db'
20653 i_dbm='$i_dbm'
20654 i_dirent='$i_dirent'
20655 i_dld='$i_dld'
20656 i_dlfcn='$i_dlfcn'
20657 i_fcntl='$i_fcntl'
20658 i_float='$i_float'
20659 i_fp='$i_fp'
20660 i_fp_class='$i_fp_class'
20661 i_gdbm='$i_gdbm'
20662 i_grp='$i_grp'
20663 i_ieeefp='$i_ieeefp'
20664 i_inttypes='$i_inttypes'
20665 i_langinfo='$i_langinfo'
20666 i_libutil='$i_libutil'
20667 i_limits='$i_limits'
20668 i_locale='$i_locale'
20669 i_machcthr='$i_machcthr'
20670 i_malloc='$i_malloc'
20671 i_math='$i_math'
20672 i_memory='$i_memory'
20673 i_mntent='$i_mntent'
20674 i_ndbm='$i_ndbm'
20675 i_netdb='$i_netdb'
20676 i_neterrno='$i_neterrno'
20677 i_netinettcp='$i_netinettcp'
20678 i_niin='$i_niin'
20679 i_poll='$i_poll'
20680 i_prot='$i_prot'
20681 i_pthread='$i_pthread'
20682 i_pwd='$i_pwd'
20683 i_rpcsvcdbm='$i_rpcsvcdbm'
20684 i_sfio='$i_sfio'
20685 i_sgtty='$i_sgtty'
20686 i_shadow='$i_shadow'
20687 i_socks='$i_socks'
20688 i_stdarg='$i_stdarg'
20689 i_stddef='$i_stddef'
20690 i_stdlib='$i_stdlib'
20691 i_string='$i_string'
20692 i_sunmath='$i_sunmath'
20693 i_sysaccess='$i_sysaccess'
20694 i_sysdir='$i_sysdir'
20695 i_sysfile='$i_sysfile'
20696 i_sysfilio='$i_sysfilio'
20697 i_sysin='$i_sysin'
20698 i_sysioctl='$i_sysioctl'
20699 i_syslog='$i_syslog'
20700 i_sysmman='$i_sysmman'
20701 i_sysmode='$i_sysmode'
20702 i_sysmount='$i_sysmount'
20703 i_sysndir='$i_sysndir'
20704 i_sysparam='$i_sysparam'
20705 i_sysresrc='$i_sysresrc'
20706 i_syssecrt='$i_syssecrt'
20707 i_sysselct='$i_sysselct'
20708 i_syssockio='$i_syssockio'
20709 i_sysstat='$i_sysstat'
20710 i_sysstatfs='$i_sysstatfs'
20711 i_sysstatvfs='$i_sysstatvfs'
20712 i_systime='$i_systime'
20713 i_systimek='$i_systimek'
20714 i_systimes='$i_systimes'
20715 i_systypes='$i_systypes'
20716 i_sysuio='$i_sysuio'
20717 i_sysun='$i_sysun'
20718 i_sysutsname='$i_sysutsname'
20719 i_sysvfs='$i_sysvfs'
20720 i_syswait='$i_syswait'
20721 i_termio='$i_termio'
20722 i_termios='$i_termios'
20723 i_time='$i_time'
20724 i_unistd='$i_unistd'
20725 i_ustat='$i_ustat'
20726 i_utime='$i_utime'
20727 i_values='$i_values'
20728 i_varargs='$i_varargs'
20729 i_varhdr='$i_varhdr'
20730 i_vfork='$i_vfork'
20731 ignore_versioned_solibs='$ignore_versioned_solibs'
20732 inc_version_list='$inc_version_list'
20733 inc_version_list_init='$inc_version_list_init'
20734 incpath='$incpath'
20735 inews='$inews'
20736 installarchlib='$installarchlib'
20737 installbin='$installbin'
20738 installhtml1dir='$installhtml1dir'
20739 installhtml3dir='$installhtml3dir'
20740 installman1dir='$installman1dir'
20741 installman3dir='$installman3dir'
20742 installprefix='$installprefix'
20743 installprefixexp='$installprefixexp'
20744 installprivlib='$installprivlib'
20745 installscript='$installscript'
20746 installsitearch='$installsitearch'
20747 installsitebin='$installsitebin'
20748 installsitehtml1='$installsitehtml1'
20749 installsitehtml3='$installsitehtml3'
20750 installsitelib='$installsitelib'
20751 installsiteman1='$installsiteman1'
20752 installsiteman3='$installsiteman3'
20753 installsitescript='$installsitescript'
20754 installstyle='$installstyle'
20755 installusrbinperl='$installusrbinperl'
20756 installvendorarch='$installvendorarch'
20757 installvendorbin='$installvendorbin'
20758 installvendorhtml1='$installvendorhtml1'
20759 installvendorhtml3='$installvendorhtml3'
20760 installvendorlib='$installvendorlib'
20761 installvendorman1='$installvendorman1'
20762 installvendorman3='$installvendorman3'
20763 installvendorscript='$installvendorscript'
20764 intsize='$intsize'
20765 issymlink='$issymlink'
20766 ivdformat='$ivdformat'
20767 ivsize='$ivsize'
20768 ivtype='$ivtype'
20769 known_extensions='$known_extensions'
20770 ksh='$ksh'
20771 ld='$ld'
20772 lddlflags='$lddlflags'
20773 ldflags='$ldflags'
20774 ldflags_uselargefiles='$ldflags_uselargefiles'
20775 ldlibpthname='$ldlibpthname'
20776 less='$less'
20777 lib_ext='$lib_ext'
20778 libc='$libc'
20779 libperl='$libperl'
20780 libpth='$libpth'
20781 libs='$libs'
20782 libsdirs='$libsdirs'
20783 libsfiles='$libsfiles'
20784 libsfound='$libsfound'
20785 libspath='$libspath'
20786 libswanted='$libswanted'
20787 libswanted_uselargefiles='$libswanted_uselargefiles'
20788 line='$line'
20789 lint='$lint'
20790 lkflags='$lkflags'
20791 ln='$ln'
20792 lns='$lns'
20793 localtime_r_proto='$localtime_r_proto'
20794 locincpth='$locincpth'
20795 loclibpth='$loclibpth'
20796 longdblsize='$longdblsize'
20797 longlongsize='$longlongsize'
20798 longsize='$longsize'
20799 lp='$lp'
20800 lpr='$lpr'
20801 ls='$ls'
20802 lseeksize='$lseeksize'
20803 lseektype='$lseektype'
20804 mail='$mail'
20805 mailx='$mailx'
20806 make='$make'
20807 make_set_make='$make_set_make'
20808 mallocobj='$mallocobj'
20809 mallocsrc='$mallocsrc'
20810 malloctype='$malloctype'
20811 man1dir='$man1dir'
20812 man1direxp='$man1direxp'
20813 man1ext='$man1ext'
20814 man3dir='$man3dir'
20815 man3direxp='$man3direxp'
20816 man3ext='$man3ext'
20817 mips_type='$mips_type'
20818 mkdir='$mkdir'
20819 mmaptype='$mmaptype'
20820 modetype='$modetype'
20821 more='$more'
20822 multiarch='$multiarch'
20823 mv='$mv'
20824 myarchname='$myarchname'
20825 mydomain='$mydomain'
20826 myhostname='$myhostname'
20827 myuname='$myuname'
20828 n='$n'
20829 need_va_copy='$need_va_copy'
20830 netdb_hlen_type='$netdb_hlen_type'
20831 netdb_host_type='$netdb_host_type'
20832 netdb_name_type='$netdb_name_type'
20833 netdb_net_type='$netdb_net_type'
20834 nm='$nm'
20835 nm_opt='$nm_opt'
20836 nm_so_opt='$nm_so_opt'
20837 nonxs_ext='$nonxs_ext'
20838 nroff='$nroff'
20839 nvEUformat='$nvEUformat'
20840 nvFUformat='$nvFUformat'
20841 nvGUformat='$nvGUformat'
20842 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20843 nveformat='$nveformat'
20844 nvfformat='$nvfformat'
20845 nvgformat='$nvgformat'
20846 nvsize='$nvsize'
20847 nvtype='$nvtype'
20848 o_nonblock='$o_nonblock'
20849 obj_ext='$obj_ext'
20850 old_pthread_create_joinable='$old_pthread_create_joinable'
20851 optimize='$optimize'
20852 orderlib='$orderlib'
20853 osname='$osname'
20854 osvers='$osvers'
20855 otherlibdirs='$otherlibdirs'
20856 package='$package'
20857 pager='$pager'
20858 passcat='$passcat'
20859 patchlevel='$patchlevel'
20860 path_sep='$path_sep'
20861 perl5='$perl5'
20862 perl='$perl'
20863 perl_patchlevel='$perl_patchlevel'
20864 perladmin='$perladmin'
20865 perllibs='$perllibs'
20866 perlpath='$perlpath'
20867 pg='$pg'
20868 phostname='$phostname'
20869 pidtype='$pidtype'
20870 plibpth='$plibpth'
20871 pm_apiversion='$pm_apiversion'
20872 pmake='$pmake'
20873 pr='$pr'
20874 prefix='$prefix'
20875 prefixexp='$prefixexp'
20876 privlib='$privlib'
20877 privlibexp='$privlibexp'
20878 procselfexe='$procselfexe'
20879 prototype='$prototype'
20880 ptrsize='$ptrsize'
20881 quadkind='$quadkind'
20882 quadtype='$quadtype'
20883 randbits='$randbits'
20884 randfunc='$randfunc'
20885 random_r_proto='$random_r_proto'
20886 randseedtype='$randseedtype'
20887 ranlib='$ranlib'
20888 rd_nodata='$rd_nodata'
20889 readdir64_r_proto='$readdir64_r_proto'
20890 readdir_r_proto='$readdir_r_proto'
20891 revision='$revision'
20892 rm='$rm'
20893 rmail='$rmail'
20894 run='$run'
20895 runnm='$runnm'
20896 sPRIEUldbl='$sPRIEUldbl'
20897 sPRIFUldbl='$sPRIFUldbl'
20898 sPRIGUldbl='$sPRIGUldbl'
20899 sPRIXU64='$sPRIXU64'
20900 sPRId64='$sPRId64'
20901 sPRIeldbl='$sPRIeldbl'
20902 sPRIfldbl='$sPRIfldbl'
20903 sPRIgldbl='$sPRIgldbl'
20904 sPRIi64='$sPRIi64'
20905 sPRIo64='$sPRIo64'
20906 sPRIu64='$sPRIu64'
20907 sPRIx64='$sPRIx64'
20908 sSCNfldbl='$sSCNfldbl'
20909 sched_yield='$sched_yield'
20910 scriptdir='$scriptdir'
20911 scriptdirexp='$scriptdirexp'
20912 sed='$sed'
20913 seedfunc='$seedfunc'
20914 selectminbits='$selectminbits'
20915 selecttype='$selecttype'
20916 sendmail='$sendmail'
20917 setgrent_r_proto='$setgrent_r_proto'
20918 sethostent_r_proto='$sethostent_r_proto'
20919 setlocale_r_proto='$setlocale_r_proto'
20920 setnetent_r_proto='$setnetent_r_proto'
20921 setprotoent_r_proto='$setprotoent_r_proto'
20922 setpwent_r_proto='$setpwent_r_proto'
20923 setservent_r_proto='$setservent_r_proto'
20924 sh='$sh'
20925 shar='$shar'
20926 sharpbang='$sharpbang'
20927 shmattype='$shmattype'
20928 shortsize='$shortsize'
20929 shrpenv='$shrpenv'
20930 shsharp='$shsharp'
20931 sig_count='$sig_count'
20932 sig_name='$sig_name'
20933 sig_name_init='$sig_name_init'
20934 sig_num='$sig_num'
20935 sig_num_init='$sig_num_init'
20936 sig_size='$sig_size'
20937 signal_t='$signal_t'
20938 sitearch='$sitearch'
20939 sitearchexp='$sitearchexp'
20940 sitebin='$sitebin'
20941 sitebinexp='$sitebinexp'
20942 sitehtml1='$sitehtml1'
20943 sitehtml1exp='$sitehtml1exp'
20944 sitehtml3='$sitehtml3'
20945 sitehtml3exp='$sitehtml3exp'
20946 sitelib='$sitelib'
20947 sitelib_stem='$sitelib_stem'
20948 sitelibexp='$sitelibexp'
20949 siteman1='$siteman1'
20950 siteman1exp='$siteman1exp'
20951 siteman3='$siteman3'
20952 siteman3exp='$siteman3exp'
20953 siteprefix='$siteprefix'
20954 siteprefixexp='$siteprefixexp'
20955 sitescript='$sitescript'
20956 sitescriptexp='$sitescriptexp'
20957 sizesize='$sizesize'
20958 sizetype='$sizetype'
20959 sleep='$sleep'
20960 smail='$smail'
20961 so='$so'
20962 sockethdr='$sockethdr'
20963 socketlib='$socketlib'
20964 socksizetype='$socksizetype'
20965 sort='$sort'
20966 spackage='$spackage'
20967 spitshell='$spitshell'
20968 srand48_r_proto='$srand48_r_proto'
20969 srandom_r_proto='$srandom_r_proto'
20970 src='$src'
20971 ssizetype='$ssizetype'
20972 startperl='$startperl'
20973 startsh='$startsh'
20974 static_ext='$static_ext'
20975 stdchar='$stdchar'
20976 stdio_base='$stdio_base'
20977 stdio_bufsiz='$stdio_bufsiz'
20978 stdio_cnt='$stdio_cnt'
20979 stdio_filbuf='$stdio_filbuf'
20980 stdio_ptr='$stdio_ptr'
20981 stdio_stream_array='$stdio_stream_array'
20982 strerror_r_proto='$strerror_r_proto'
20983 strings='$strings'
20984 submit='$submit'
20985 subversion='$subversion'
20986 sysman='$sysman'
20987 tail='$tail'
20988 tar='$tar'
20989 targetarch='$targetarch'
20990 tbl='$tbl'
20991 tee='$tee'
20992 test='$test'
20993 timeincl='$timeincl'
20994 timetype='$timetype'
20995 tmpnam_r_proto='$tmpnam_r_proto'
20996 to='$to'
20997 touch='$touch'
20998 tr='$tr'
20999 trnl='$trnl'
21000 troff='$troff'
21001 ttyname_r_proto='$ttyname_r_proto'
21002 u16size='$u16size'
21003 u16type='$u16type'
21004 u32size='$u32size'
21005 u32type='$u32type'
21006 u64size='$u64size'
21007 u64type='$u64type'
21008 u8size='$u8size'
21009 u8type='$u8type'
21010 uidformat='$uidformat'
21011 uidsign='$uidsign'
21012 uidsize='$uidsize'
21013 uidtype='$uidtype'
21014 uname='$uname'
21015 uniq='$uniq'
21016 uquadtype='$uquadtype'
21017 use5005threads='$use5005threads'
21018 use64bitall='$use64bitall'
21019 use64bitint='$use64bitint'
21020 usecrosscompile='$usecrosscompile'
21021 usedl='$usedl'
21022 useithreads='$useithreads'
21023 uselargefiles='$uselargefiles'
21024 uselongdouble='$uselongdouble'
21025 usemorebits='$usemorebits'
21026 usemultiplicity='$usemultiplicity'
21027 usemymalloc='$usemymalloc'
21028 usenm='$usenm'
21029 useopcode='$useopcode'
21030 useperlio='$useperlio'
21031 useposix='$useposix'
21032 usereentrant='$usereentrant'
21033 usesfio='$usesfio'
21034 useshrplib='$useshrplib'
21035 usesocks='$usesocks'
21036 usethreads='$usethreads'
21037 usevendorprefix='$usevendorprefix'
21038 usevfork='$usevfork'
21039 usrinc='$usrinc'
21040 uuname='$uuname'
21041 uvXUformat='$uvXUformat'
21042 uvoformat='$uvoformat'
21043 uvsize='$uvsize'
21044 uvtype='$uvtype'
21045 uvuformat='$uvuformat'
21046 uvxformat='$uvxformat'
21047 vendorarch='$vendorarch'
21048 vendorarchexp='$vendorarchexp'
21049 vendorbin='$vendorbin'
21050 vendorbinexp='$vendorbinexp'
21051 vendorhtml1='$vendorhtml1'
21052 vendorhtml1exp='$vendorhtml1exp'
21053 vendorhtml3='$vendorhtml3'
21054 vendorhtml3exp='$vendorhtml3exp'
21055 vendorlib='$vendorlib'
21056 vendorlib_stem='$vendorlib_stem'
21057 vendorlibexp='$vendorlibexp'
21058 vendorman1='$vendorman1'
21059 vendorman1exp='$vendorman1exp'
21060 vendorman3='$vendorman3'
21061 vendorman3exp='$vendorman3exp'
21062 vendorprefix='$vendorprefix'
21063 vendorprefixexp='$vendorprefixexp'
21064 vendorscript='$vendorscript'
21065 vendorscriptexp='$vendorscriptexp'
21066 version='$version'
21067 version_patchlevel_string='$version_patchlevel_string'
21068 versiononly='$versiononly'
21069 vi='$vi'
21070 voidflags='$voidflags'
21071 xlibpth='$xlibpth'
21072 xs_apiversion='$xs_apiversion'
21073 yacc='$yacc'
21074 yaccflags='$yaccflags'
21075 zcat='$zcat'
21076 zip='$zip'
21077 EOT
21078
21079 : Add in command line options if available
21080 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21081
21082 : add special variables
21083 $test -f $src/patchlevel.h && \
21084 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21085 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21086 echo "PERL_CONFIG_SH=true" >>config.sh
21087
21088 : propagate old symbols
21089 if $test -f UU/config.sh; then
21090         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21091         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21092         $sort | $uniq -u >UU/oldsyms
21093         set X `cat UU/oldsyms`
21094         shift
21095         case $# in
21096         0) ;;
21097         *)
21098                 cat <<EOM
21099 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21100 EOM
21101                 echo "# Variables propagated from previous config.sh file." >>config.sh
21102                 for sym in `cat UU/oldsyms`; do
21103                         echo "    Propagating $hint variable "'$'"$sym..."
21104                         eval 'tmp="$'"${sym}"'"'
21105                         echo "$tmp" | \
21106                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21107                 done
21108                 ;;
21109         esac
21110 fi
21111
21112 : Finish up by extracting the .SH files
21113 case "$alldone" in
21114 exit)
21115         $rm -rf UU
21116         echo "Extraction done."
21117         exit 0
21118         ;;
21119 cont)
21120         ;;
21121 '')
21122         dflt=''
21123         nostick=true
21124         $cat <<EOM
21125
21126 If you'd like to make any changes to the config.sh file before I begin
21127 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21128
21129 EOM
21130         rp="Press return or use a shell escape to edit config.sh:"
21131         . UU/myread
21132         nostick=''
21133         case "$ans" in
21134         '') ;;
21135         *) : in case they cannot read
21136                 sh 1>&4 -c "$ans";;
21137         esac
21138         ;;
21139 esac
21140
21141 : if this fails, just run all the .SH files by hand
21142 . ./config.sh
21143
21144 echo " "
21145 exec 1>&4
21146 pwd=`pwd`
21147 . ./UU/extract
21148 cd "$pwd"
21149
21150 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21151         dflt=y
21152         case "$silent" in
21153         true) ;;
21154         *)
21155                 $cat <<EOM
21156
21157 Now you need to generate make dependencies by running "$make depend".
21158 You might prefer to run it in background: "$make depend > makedepend.out &"
21159 It can take a while, so you might not want to run it right now.
21160
21161 EOM
21162                 ;;
21163         esac
21164         rp="Run $make depend now?"
21165         . UU/myread
21166         case "$ans" in
21167         y*)
21168                 $make depend && echo "Now you must run '$make'."
21169                 ;;
21170         *)
21171                 echo "You must run '$make depend' then '$make'."
21172                 ;;
21173         esac
21174 elif test -f [Mm]akefile; then
21175         echo " "
21176         echo "Now you must run a $make."
21177 else
21178         echo "Configure done."
21179 fi
21180
21181 if $test -f Policy.sh; then
21182     $cat <<EOM
21183
21184 If you compile $package on a different machine or from a different object
21185 directory, copy the Policy.sh file from this object directory to the
21186 new one before you run Configure -- this will help you with most of
21187 the policy defaults.
21188
21189 EOM
21190 fi
21191 if $test -f config.msg; then
21192     echo "Hmm.  I also noted the following information while running:"
21193     echo " "
21194     $cat config.msg >&4
21195     $rm -f config.msg
21196 fi
21197 $rm -f kit*isdone ark*isdone
21198 $rm -rf UU
21199
21200 : End of Configure
21201