a15eeb76a9deb30ecc1b3d3ceb4af200e4342ba2
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20
21 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
22 #
23 # Generated on Fri Jun 13 16:12:49 EET DST 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:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; 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                 is_os2=yes
80         elif test -n "$DJGPP"; then
81                 case "X${MACHTYPE:-nonesuchmach}" in
82                 *cygwin) ;;
83                 *) p_=\; ;;
84                 esac
85         fi
86 fi
87
88 : Proper PATH setting
89 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
90 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
91 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
92 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
93 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
94 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
95 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
96 paths="$paths /sbin /usr/sbin /usr/libexec"
97 paths="$paths /system/gnu_library/bin"
98
99 for p in $paths
100 do
101         case "$p_$PATH$p_" in
102         *$p_$p$p_*) ;;
103         *) test -d $p && PATH=$PATH$p_$p ;;
104         esac
105 done
106
107 PATH=.$p_$PATH
108 export PATH
109
110 : shall we be using ksh?
111 inksh=''
112 needksh=''
113 avoidksh=''
114 newsh=/bin/ksh
115 changesh=''
116 if (PATH=.; alias -x) >/dev/null 2>&1; then
117                 inksh=true
118 fi
119 if test -f /hp-ux -a -f /bin/ksh; then
120         needksh='to avoid sh bug in "here document" expansion'
121 fi
122 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
123         if test X`/usr/bin/uname -v` = X4; then
124                 avoidksh="to avoid AIX 4's /bin/sh"
125                 newsh=/usr/bin/bsh
126         fi
127 fi
128 if test -f /osf_boot -a -f /usr/sbin/setld; then
129         if test X`/usr/bin/uname -s` = XOSF1; then
130                 avoidksh="to avoid Digital UNIX' ksh"
131                 newsh=/bin/sh
132                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
133         fi
134 fi
135 case "$inksh/$needksh" in
136 /[a-z]*)
137                 ENV=''
138                 changesh=true
139                 reason="$needksh"
140         ;;
141 esac
142 case "$inksh/$avoidksh" in
143 true/[a-z]*)
144         changesh=true
145         reason="$avoidksh"
146         ;;
147 esac
148 case "$inksh/$needksh-$avoidksh-" in
149 true/--)
150                 cat <<EOM
151 (I see you are using the Korn shell.  Some ksh's blow up on $me,
152 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
153 EOM
154         ;;
155 esac
156 case "$changesh" in
157 true)
158         export newsh
159         echo "(Feeding myself to $newsh $reason.)"
160         case "$0" in
161         Configure|*/Configure) exec $newsh $0 "$@";;
162         *) exec $newsh Configure "$@";;
163         esac
164         ;;
165 esac
166
167 : if needed set CDPATH to a harmless value that is not chatty
168 : avoid bash 2.02 problems with empty CDPATH.
169 case "$CDPATH" in
170 '')     ;;
171 *)      case "$SHELL" in
172         *bash*) CDPATH='.' ;;
173         *)              CDPATH='' ;;
174         esac
175         ;;
176 esac
177 : Configure runs within the UU subdirectory
178 test -d UU || mkdir UU
179 cd UU && rm -f ./*
180
181 ccname=''
182 ccversion=''
183 ccsymbols=''
184 cppccsymbols=''
185 cppsymbols=''
186 from=''
187 run=''
188 targetarch=''
189 to=''
190 usecrosscompile=''
191 mistrustnm=''
192 perllibs=''
193 dynamic_ext=''
194 extensions=''
195 known_extensions=''
196 nonxs_ext=''
197 static_ext=''
198 useopcode=''
199 useposix=''
200 extras=''
201 d_bsd=''
202 d_eunice=''
203 d_xenix=''
204 eunicefix=''
205 Mcc=''
206 ar=''
207 awk=''
208 bash=''
209 bison=''
210 byacc=''
211 cat=''
212 chgrp=''
213 chmod=''
214 chown=''
215 comm=''
216 compress=''
217 cp=''
218 cpio=''
219 cpp=''
220 csh=''
221 date=''
222 echo=''
223 egrep=''
224 emacs=''
225 expr=''
226 find=''
227 flex=''
228 gmake=''
229 grep=''
230 gzip=''
231 inews=''
232 ksh=''
233 less=''
234 line=''
235 lint=''
236 ln=''
237 lp=''
238 lpr=''
239 ls=''
240 mail=''
241 mailx=''
242 make=''
243 mkdir=''
244 more=''
245 mv=''
246 nm=''
247 nroff=''
248 perl=''
249 pg=''
250 pmake=''
251 pr=''
252 rm=''
253 rmail=''
254 sed=''
255 sendmail=''
256 shar=''
257 sleep=''
258 smail=''
259 sort=''
260 submit=''
261 tail=''
262 tar=''
263 tbl=''
264 tee=''
265 test=''
266 touch=''
267 tr=''
268 troff=''
269 uname=''
270 uniq=''
271 uuname=''
272 vi=''
273 zcat=''
274 zip=''
275 full_ar=''
276 full_sed=''
277 libswanted=''
278 hint=''
279 myuname=''
280 osname=''
281 osvers=''
282 Author=''
283 Date=''
284 Header=''
285 Id=''
286 Locker=''
287 Log=''
288 RCSfile=''
289 Revision=''
290 Source=''
291 State=''
292 _a=''
293 _exe=''
294 _o=''
295 archobjs=''
296 exe_ext=''
297 firstmakefile=''
298 lib_ext=''
299 obj_ext=''
300 path_sep=''
301 afs=''
302 afsroot=''
303 alignbytes=''
304 ansi2knr=''
305 archlib=''
306 archlibexp=''
307 d_archlib=''
308 installarchlib=''
309 archname=''
310 myarchname=''
311 d_atolf=''
312 d_atoll=''
313 baserev=''
314 bin=''
315 binexp=''
316 installbin=''
317 byteorder=''
318 cc=''
319 ccflags=''
320 cppflags=''
321 ldflags=''
322 lkflags=''
323 locincpth=''
324 optimize=''
325 cf_email=''
326 cf_by=''
327 cf_time=''
328 charsize=''
329 contains=''
330 cpp_stuff=''
331 cpplast=''
332 cppminus=''
333 cpprun=''
334 cppstdin=''
335 d__fwalk=''
336 d_access=''
337 d_accessx=''
338 d_aintl=''
339 d_alarm=''
340 asctime_r_proto=''
341 d_asctime_r=''
342 d_attribut=''
343 d_bcmp=''
344 d_bcopy=''
345 d_bzero=''
346 d_casti32=''
347 castflags=''
348 d_castneg=''
349 d_chown=''
350 d_chroot=''
351 d_chsize=''
352 d_class=''
353 d_closedir=''
354 d_void_closedir=''
355 d_cmsghdr_s=''
356 d_const=''
357 d_copysignl=''
358 cryptlib=''
359 d_crypt=''
360 crypt_r_proto=''
361 d_crypt_r=''
362 d_csh=''
363 full_csh=''
364 ctermid_r_proto=''
365 d_ctermid_r=''
366 ctime_r_proto=''
367 d_ctime_r=''
368 d_cuserid=''
369 d_dbl_dig=''
370 d_dbminitproto=''
371 d_difftime=''
372 d_dirfd=''
373 d_dlerror=''
374 d_dlopen=''
375 d_dlsymun=''
376 d_dosuid=''
377 d_suidsafe=''
378 d_drand48_r=''
379 drand48_r_proto=''
380 d_drand48proto=''
381 d_dup2=''
382 d_eaccess=''
383 d_endgrent=''
384 d_endgrent_r=''
385 endgrent_r_proto=''
386 d_endhent=''
387 d_endhostent_r=''
388 endhostent_r_proto=''
389 d_endnent=''
390 d_endnetent_r=''
391 endnetent_r_proto=''
392 d_endpent=''
393 d_endprotoent_r=''
394 endprotoent_r_proto=''
395 d_endpwent=''
396 d_endpwent_r=''
397 endpwent_r_proto=''
398 d_endsent=''
399 d_endservent_r=''
400 endservent_r_proto=''
401 d_faststdio=''
402 d_fchdir=''
403 d_fchmod=''
404 d_fchown=''
405 d_fcntl=''
406 d_fcntl_can_lock=''
407 d_fd_macros=''
408 d_fd_set=''
409 d_fds_bits=''
410 d_fgetpos=''
411 d_finite=''
412 d_finitel=''
413 d_flexfnam=''
414 d_flock=''
415 d_flockproto=''
416 d_fork=''
417 d_fp_class=''
418 d_fpclass=''
419 d_fpclassify=''
420 d_fpclassl=''
421 d_fpos64_t=''
422 d_frexpl=''
423 d_fs_data_s=''
424 d_fseeko=''
425 d_fsetpos=''
426 d_fstatfs=''
427 d_fsync=''
428 d_ftello=''
429 d_ftime=''
430 d_gettimeod=''
431 d_Gconvert=''
432 d_getcwd=''
433 d_getespwnam=''
434 d_getfsstat=''
435 d_getgrent=''
436 d_getgrent_r=''
437 getgrent_r_proto=''
438 d_getgrgid_r=''
439 getgrgid_r_proto=''
440 d_getgrnam_r=''
441 getgrnam_r_proto=''
442 d_getgrps=''
443 d_gethbyaddr=''
444 d_gethbyname=''
445 d_gethent=''
446 aphostname=''
447 d_gethname=''
448 d_phostname=''
449 d_uname=''
450 d_gethostbyaddr_r=''
451 gethostbyaddr_r_proto=''
452 d_gethostbyname_r=''
453 gethostbyname_r_proto=''
454 d_gethostent_r=''
455 gethostent_r_proto=''
456 d_gethostprotos=''
457 d_getitimer=''
458 d_getlogin=''
459 d_getlogin_r=''
460 getlogin_r_proto=''
461 d_getmnt=''
462 d_getmntent=''
463 d_getnbyaddr=''
464 d_getnbyname=''
465 d_getnent=''
466 d_getnetbyaddr_r=''
467 getnetbyaddr_r_proto=''
468 d_getnetbyname_r=''
469 getnetbyname_r_proto=''
470 d_getnetent_r=''
471 getnetent_r_proto=''
472 d_getnetprotos=''
473 d_getpagsz=''
474 d_getpent=''
475 d_getpgid=''
476 d_getpgrp2=''
477 d_bsdgetpgrp=''
478 d_getpgrp=''
479 d_getppid=''
480 d_getprior=''
481 d_getpbyname=''
482 d_getpbynumber=''
483 d_getprotobyname_r=''
484 getprotobyname_r_proto=''
485 d_getprotobynumber_r=''
486 getprotobynumber_r_proto=''
487 d_getprotoent_r=''
488 getprotoent_r_proto=''
489 d_getprotoprotos=''
490 d_getprpwnam=''
491 d_getpwent=''
492 d_getpwent_r=''
493 getpwent_r_proto=''
494 d_getpwnam_r=''
495 getpwnam_r_proto=''
496 d_getpwuid_r=''
497 getpwuid_r_proto=''
498 d_getsent=''
499 d_getservbyname_r=''
500 getservbyname_r_proto=''
501 d_getservbyport_r=''
502 getservbyport_r_proto=''
503 d_getservent_r=''
504 getservent_r_proto=''
505 d_getservprotos=''
506 d_getspnam=''
507 d_getspnam_r=''
508 getspnam_r_proto=''
509 d_getsbyname=''
510 d_getsbyport=''
511 d_gmtime_r=''
512 gmtime_r_proto=''
513 d_gnulibc=''
514 gnulibc_version=''
515 d_hasmntopt=''
516 d_htonl=''
517 d_ilogbl=''
518 d_inetaton=''
519 d_int64_t=''
520 d_isascii=''
521 d_isfinite=''
522 d_isinf=''
523 d_isnan=''
524 d_isnanl=''
525 d_killpg=''
526 d_lchown=''
527 d_ldbl_dig=''
528 d_link=''
529 d_localtime_r=''
530 localtime_r_proto=''
531 d_locconv=''
532 d_lockf=''
533 d_longdbl=''
534 longdblsize=''
535 d_longlong=''
536 longlongsize=''
537 d_lseekproto=''
538 d_lstat=''
539 d_madvise=''
540 d_mblen=''
541 d_mbstowcs=''
542 d_mbtowc=''
543 d_memchr=''
544 d_memcmp=''
545 d_memcpy=''
546 d_memmove=''
547 d_memset=''
548 d_mkdir=''
549 d_mkdtemp=''
550 d_mkfifo=''
551 d_mkstemp=''
552 d_mkstemps=''
553 d_mktime=''
554 d_mmap=''
555 mmaptype=''
556 d_modfl=''
557 d_modfl_pow32_bug=''
558 d_modflproto=''
559 d_mprotect=''
560 d_msg=''
561 d_msgctl=''
562 d_msgget=''
563 d_msghdr_s=''
564 d_msgrcv=''
565 d_msgsnd=''
566 d_msync=''
567 d_munmap=''
568 d_nanosleep=''
569 d_nice=''
570 d_nl_langinfo=''
571 d_off64_t=''
572 d_open3=''
573 d_fpathconf=''
574 d_pathconf=''
575 d_pause=''
576 d_pipe=''
577 d_poll=''
578 d_portable=''
579 d_procselfexe=''
580 procselfexe=''
581 d_old_pthread_create_joinable=''
582 old_pthread_create_joinable=''
583 d_pthread_atfork=''
584 d_pthread_attr_setscope=''
585 d_pthread_yield=''
586 d_sched_yield=''
587 sched_yield=''
588 d_qgcvt=''
589 d_random_r=''
590 random_r_proto=''
591 d_readdir64_r=''
592 readdir64_r_proto=''
593 d_readdir=''
594 d_rewinddir=''
595 d_seekdir=''
596 d_telldir=''
597 d_readdir_r=''
598 readdir_r_proto=''
599 d_readlink=''
600 d_readv=''
601 d_recvmsg=''
602 d_rename=''
603 d_rmdir=''
604 d_safebcpy=''
605 d_safemcpy=''
606 d_sanemcmp=''
607 d_sbrkproto=''
608 d_scalbnl=''
609 d_select=''
610 d_sem=''
611 d_semctl=''
612 d_semget=''
613 d_semop=''
614 d_sendmsg=''
615 d_setegid=''
616 d_seteuid=''
617 d_setgrent=''
618 d_setgrent_r=''
619 setgrent_r_proto=''
620 d_setgrps=''
621 d_sethent=''
622 d_sethostent_r=''
623 sethostent_r_proto=''
624 d_setitimer=''
625 d_setlinebuf=''
626 d_setlocale=''
627 d_setlocale_r=''
628 setlocale_r_proto=''
629 d_setnent=''
630 d_setnetent_r=''
631 setnetent_r_proto=''
632 d_setpent=''
633 d_setpgid=''
634 d_setpgrp2=''
635 d_bsdsetpgrp=''
636 d_setpgrp=''
637 d_setprior=''
638 d_setproctitle=''
639 d_setprotoent_r=''
640 setprotoent_r_proto=''
641 d_setpwent=''
642 d_setpwent_r=''
643 setpwent_r_proto=''
644 d_setregid=''
645 d_setresgid=''
646 d_setresuid=''
647 d_setreuid=''
648 d_setrgid=''
649 d_setruid=''
650 d_setsent=''
651 d_setservent_r=''
652 setservent_r_proto=''
653 d_setsid=''
654 d_setvbuf=''
655 d_sfio=''
656 usesfio=''
657 d_shm=''
658 d_shmat=''
659 d_shmatprototype=''
660 shmattype=''
661 d_shmctl=''
662 d_shmdt=''
663 d_shmget=''
664 d_sigaction=''
665 d_sigprocmask=''
666 d_sigsetjmp=''
667 d_sockatmark=''
668 d_sockatmarkproto=''
669 d_msg_ctrunc=''
670 d_msg_dontroute=''
671 d_msg_oob=''
672 d_msg_peek=''
673 d_msg_proxy=''
674 d_oldsock=''
675 d_scm_rights=''
676 d_socket=''
677 d_sockpair=''
678 sockethdr=''
679 socketlib=''
680 d_socklen_t=''
681 d_socks5_init=''
682 d_sqrtl=''
683 d_srand48_r=''
684 srand48_r_proto=''
685 d_srandom_r=''
686 srandom_r_proto=''
687 d_sresgproto=''
688 d_sresuproto=''
689 d_statblks=''
690 d_statfs_f_flags=''
691 d_statfs_s=''
692 d_fstatvfs=''
693 d_statvfs=''
694 d_stdio_cnt_lval=''
695 d_stdio_ptr_lval=''
696 d_stdio_ptr_lval_nochange_cnt=''
697 d_stdio_ptr_lval_sets_cnt=''
698 d_stdiobase=''
699 d_stdstdio=''
700 stdio_base=''
701 stdio_bufsiz=''
702 stdio_cnt=''
703 stdio_filbuf=''
704 stdio_ptr=''
705 d_index=''
706 d_strchr=''
707 d_strcoll=''
708 d_strctcpy=''
709 d_strerrm=''
710 d_strerror=''
711 d_sysernlst=''
712 d_syserrlst=''
713 d_strerror_r=''
714 strerror_r_proto=''
715 d_strftime=''
716 d_strtod=''
717 d_strtol=''
718 d_strtold=''
719 d_strtoll=''
720 d_strtoq=''
721 d_strtoul=''
722 d_strtoull=''
723 d_strtouq=''
724 d_strxfrm=''
725 d_symlink=''
726 d_syscall=''
727 d_syscallproto=''
728 d_sysconf=''
729 d_system=''
730 d_tcgetpgrp=''
731 d_tcsetpgrp=''
732 d_telldirproto=''
733 d_time=''
734 timetype=''
735 clocktype=''
736 d_times=''
737 d_tmpnam_r=''
738 tmpnam_r_proto=''
739 d_truncate=''
740 d_ttyname_r=''
741 ttyname_r_proto=''
742 d_tzname=''
743 d_u32align=''
744 d_ualarm=''
745 d_umask=''
746 d_semctl_semid_ds=''
747 d_semctl_semun=''
748 d_union_semun=''
749 d_unordered=''
750 d_usleep=''
751 d_usleepproto=''
752 d_ustat=''
753 d_vfork=''
754 usevfork=''
755 d_voidsig=''
756 signal_t=''
757 d_volatile=''
758 d_charvspr=''
759 d_vprintf=''
760 d_wait4=''
761 d_waitpid=''
762 d_wcstombs=''
763 d_wctomb=''
764 d_writev=''
765 dlext=''
766 cccdlflags=''
767 ccdlflags=''
768 dlsrc=''
769 ld=''
770 lddlflags=''
771 usedl=''
772 doublesize=''
773 ebcdic=''
774 fflushNULL=''
775 fflushall=''
776 fpossize=''
777 fpostype=''
778 gccansipedantic=''
779 gccosandvers=''
780 gccversion=''
781 gidformat=''
782 gidsign=''
783 gidsize=''
784 gidtype=''
785 groupstype=''
786 h_fcntl=''
787 h_sysfile=''
788 html1dir=''
789 html1direxp=''
790 installhtml1dir=''
791 html3dir=''
792 html3direxp=''
793 installhtml3dir=''
794 i_arpainet=''
795 i_crypt=''
796 db_hashtype=''
797 db_prefixtype=''
798 db_version_major=''
799 db_version_minor=''
800 db_version_patch=''
801 i_db=''
802 i_dbm=''
803 i_rpcsvcdbm=''
804 d_dirnamlen=''
805 direntrytype=''
806 i_dirent=''
807 i_dld=''
808 i_dlfcn=''
809 i_fcntl=''
810 i_float=''
811 i_fp=''
812 i_fp_class=''
813 i_gdbm=''
814 d_grpasswd=''
815 i_grp=''
816 i_ieeefp=''
817 i_inttypes=''
818 i_langinfo=''
819 i_libutil=''
820 i_limits=''
821 i_locale=''
822 i_machcthr=''
823 i_malloc=''
824 i_math=''
825 i_memory=''
826 i_mntent=''
827 i_ndbm=''
828 i_netdb=''
829 i_neterrno=''
830 i_netinettcp=''
831 i_niin=''
832 i_sysin=''
833 i_poll=''
834 i_prot=''
835 i_pthread=''
836 d_pwage=''
837 d_pwchange=''
838 d_pwclass=''
839 d_pwcomment=''
840 d_pwexpire=''
841 d_pwgecos=''
842 d_pwpasswd=''
843 d_pwquota=''
844 i_pwd=''
845 i_sfio=''
846 i_shadow=''
847 i_socks=''
848 i_stddef=''
849 i_stdlib=''
850 i_string=''
851 strings=''
852 i_sunmath=''
853 i_sysaccess=''
854 i_sysdir=''
855 i_sysfile=''
856 d_voidtty=''
857 i_bsdioctl=''
858 i_sysfilio=''
859 i_sysioctl=''
860 i_syssockio=''
861 i_syslog=''
862 i_sysmman=''
863 i_sysmode=''
864 i_sysmount=''
865 i_sysndir=''
866 i_sysparam=''
867 i_sysresrc=''
868 i_syssecrt=''
869 i_sysselct=''
870 i_sysstat=''
871 i_sysstatfs=''
872 i_sysstatvfs=''
873 i_systimes=''
874 i_systypes=''
875 i_sysuio=''
876 i_sysun=''
877 i_sysutsname=''
878 i_sysvfs=''
879 i_syswait=''
880 i_sgtty=''
881 i_termio=''
882 i_termios=''
883 d_tm_tm_gmtoff=''
884 d_tm_tm_zone=''
885 i_systime=''
886 i_systimek=''
887 i_time=''
888 timeincl=''
889 i_unistd=''
890 i_ustat=''
891 i_utime=''
892 i_values=''
893 i_stdarg=''
894 i_varargs=''
895 i_varhdr=''
896 i_vfork=''
897 inc_version_list=''
898 inc_version_list_init=''
899 installprefix=''
900 installprefixexp=''
901 installstyle=''
902 installusrbinperl=''
903 intsize=''
904 longsize=''
905 shortsize=''
906 issymlink=''
907 libc=''
908 ldlibpthname=''
909 libperl=''
910 shrpenv=''
911 useshrplib=''
912 glibpth=''
913 libpth=''
914 loclibpth=''
915 plibpth=''
916 xlibpth=''
917 ignore_versioned_solibs=''
918 libs=''
919 libsdirs=''
920 libsfiles=''
921 libsfound=''
922 libspath=''
923 lns=''
924 d_PRIEUldbl=''
925 d_PRIFUldbl=''
926 d_PRIGUldbl=''
927 d_PRIeldbl=''
928 d_PRIfldbl=''
929 d_PRIgldbl=''
930 d_SCNfldbl=''
931 sPRIEUldbl=''
932 sPRIFUldbl=''
933 sPRIGUldbl=''
934 sPRIeldbl=''
935 sPRIfldbl=''
936 sPRIgldbl=''
937 sSCNfldbl=''
938 lseeksize=''
939 lseektype=''
940 make_set_make=''
941 d_mymalloc=''
942 freetype=''
943 mallocobj=''
944 mallocsrc=''
945 malloctype=''
946 usemymalloc=''
947 installman1dir=''
948 man1dir=''
949 man1direxp=''
950 man1ext=''
951 installman3dir=''
952 man3dir=''
953 man3direxp=''
954 man3ext=''
955 modetype=''
956 multiarch=''
957 mydomain=''
958 myhostname=''
959 phostname=''
960 c=''
961 n=''
962 d_eofnblk=''
963 eagain=''
964 o_nonblock=''
965 rd_nodata=''
966 need_va_copy=''
967 netdb_hlen_type=''
968 netdb_host_type=''
969 netdb_name_type=''
970 netdb_net_type=''
971 groupcat=''
972 hostcat=''
973 passcat=''
974 orderlib=''
975 ranlib=''
976 d_perl_otherlibdirs=''
977 otherlibdirs=''
978 package=''
979 spackage=''
980 pager=''
981 api_revision=''
982 api_subversion=''
983 api_version=''
984 api_versionstring=''
985 patchlevel=''
986 perl_patchlevel=''
987 revision=''
988 subversion=''
989 version=''
990 version_patchlevel_string=''
991 perl5=''
992 perladmin=''
993 perlpath=''
994 d_nv_preserves_uv=''
995 i16size=''
996 i16type=''
997 i32size=''
998 i32type=''
999 i64size=''
1000 i64type=''
1001 i8size=''
1002 i8type=''
1003 ivsize=''
1004 ivtype=''
1005 nv_preserves_uv_bits=''
1006 nvsize=''
1007 nvtype=''
1008 u16size=''
1009 u16type=''
1010 u32size=''
1011 u32type=''
1012 u64size=''
1013 u64type=''
1014 u8size=''
1015 u8type=''
1016 uvsize=''
1017 uvtype=''
1018 ivdformat=''
1019 nvEUformat=''
1020 nvFUformat=''
1021 nvGUformat=''
1022 nveformat=''
1023 nvfformat=''
1024 nvgformat=''
1025 uvXUformat=''
1026 uvoformat=''
1027 uvuformat=''
1028 uvxformat=''
1029 pidtype=''
1030 prefix=''
1031 prefixexp=''
1032 installprivlib=''
1033 privlib=''
1034 privlibexp=''
1035 prototype=''
1036 ptrsize=''
1037 d_PRIXU64=''
1038 d_PRId64=''
1039 d_PRIi64=''
1040 d_PRIo64=''
1041 d_PRIu64=''
1042 d_PRIx64=''
1043 sPRIXU64=''
1044 sPRId64=''
1045 sPRIi64=''
1046 sPRIo64=''
1047 sPRIu64=''
1048 sPRIx64=''
1049 d_quad=''
1050 quadkind=''
1051 quadtype=''
1052 uquadtype=''
1053 drand01=''
1054 randbits=''
1055 randfunc=''
1056 randseedtype=''
1057 seedfunc=''
1058 installscript=''
1059 scriptdir=''
1060 scriptdirexp=''
1061 selectminbits=''
1062 selecttype=''
1063 sh=''
1064 sig_count=''
1065 sig_name=''
1066 sig_name_init=''
1067 sig_num=''
1068 sig_num_init=''
1069 sig_size=''
1070 installsitearch=''
1071 sitearch=''
1072 sitearchexp=''
1073 installsitebin=''
1074 sitebin=''
1075 sitebinexp=''
1076 installsitehtml1=''
1077 sitehtml1=''
1078 sitehtml1exp=''
1079 installsitehtml3=''
1080 sitehtml3=''
1081 sitehtml3exp=''
1082 installsitelib=''
1083 sitelib=''
1084 sitelib_stem=''
1085 sitelibexp=''
1086 installsiteman1=''
1087 siteman1=''
1088 siteman1exp=''
1089 installsiteman3=''
1090 siteman3=''
1091 siteman3exp=''
1092 siteprefix=''
1093 siteprefixexp=''
1094 installsitescript=''
1095 sitescript=''
1096 sitescriptexp=''
1097 sizesize=''
1098 sizetype=''
1099 so=''
1100 socksizetype=''
1101 sharpbang=''
1102 shsharp=''
1103 spitshell=''
1104 src=''
1105 ssizetype=''
1106 startperl=''
1107 startsh=''
1108 stdchar=''
1109 d_stdio_stream_array=''
1110 stdio_stream_array=''
1111 sysman=''
1112 trnl=''
1113 uidformat=''
1114 uidsign=''
1115 uidsize=''
1116 uidtype=''
1117 archname64=''
1118 use64bitall=''
1119 use64bitint=''
1120 usefaststdio=''
1121 ccflags_uselargefiles=''
1122 ldflags_uselargefiles=''
1123 libswanted_uselargefiles=''
1124 uselargefiles=''
1125 uselongdouble=''
1126 usemorebits=''
1127 usemultiplicity=''
1128 nm_opt=''
1129 nm_so_opt=''
1130 runnm=''
1131 usenm=''
1132 useperlio=''
1133 usesocks=''
1134 d_oldpthreads=''
1135 use5005threads=''
1136 useithreads=''
1137 usereentrant=''
1138 usethreads=''
1139 incpath=''
1140 mips_type=''
1141 usrinc=''
1142 d_vendorarch=''
1143 installvendorarch=''
1144 vendorarch=''
1145 vendorarchexp=''
1146 d_vendorbin=''
1147 installvendorbin=''
1148 vendorbin=''
1149 vendorbinexp=''
1150 installvendorhtml1=''
1151 vendorhtml1=''
1152 vendorhtml1exp=''
1153 installvendorhtml3=''
1154 vendorhtml3=''
1155 vendorhtml3exp=''
1156 d_vendorlib=''
1157 installvendorlib=''
1158 vendorlib=''
1159 vendorlib_stem=''
1160 vendorlibexp=''
1161 installvendorman1=''
1162 vendorman1=''
1163 vendorman1exp=''
1164 installvendorman3=''
1165 vendorman3=''
1166 vendorman3exp=''
1167 usevendorprefix=''
1168 vendorprefix=''
1169 vendorprefixexp=''
1170 d_vendorscript=''
1171 installvendorscript=''
1172 vendorscript=''
1173 vendorscriptexp=''
1174 versiononly=''
1175 defvoidused=''
1176 voidflags=''
1177 pm_apiversion=''
1178 xs_apiversion=''
1179 yacc=''
1180 yaccflags=''
1181 CONFIG=''
1182
1183 define='define'
1184 undef='undef'
1185 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1186 rmlist=''
1187
1188 : We must find out about Eunice early
1189 eunicefix=':'
1190 if test -f /etc/unixtovms; then
1191         eunicefix=/etc/unixtovms
1192 fi
1193 if test -f /etc/unixtovms.exe; then
1194         eunicefix=/etc/unixtovms.exe
1195 fi
1196
1197 : Set executable suffix now -- needed before hints available
1198 if test -f "/libs/version.library"; then
1199 : Amiga OS
1200     _exe=""
1201 elif test -f "/system/gnu_library/bin/ar.pm"; then
1202 : Stratus VOS
1203     _exe=".pm"
1204 elif test -n "$DJGPP"; then
1205 : DOS DJGPP
1206     _exe=".exe"
1207 elif test -d c:/. -o -n "$is_os2" ; then
1208 : OS/2 or cygwin
1209     _exe=".exe"
1210 fi
1211
1212 i_whoami=''
1213 : Possible local include directories to search.
1214 : Set locincpth to "" in a hint file to defeat local include searches.
1215 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1216 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1217 :
1218 : no include file wanted by default
1219 inclwanted=''
1220
1221 siteman1=''
1222 siteman3=''
1223 sitescript=''
1224 : Trailing extension.  Override this in a hint file, if needed.
1225 : Extra object files, if any, needed on this platform.
1226 archobjs=''
1227 groupstype=''
1228 libnames=''
1229 : change the next line if compiling for Xenix/286 on Xenix/386
1230 xlibpth='/usr/lib/386 /lib/386'
1231 : Possible local library directories to search.
1232 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1233 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1234
1235 : general looking path for locating libraries
1236 glibpth="/lib /usr/lib $xlibpth"
1237 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1238 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1239 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1240
1241 : Private path used by Configure to find libraries.  Its value
1242 : is prepended to libpth. This variable takes care of special
1243 : machines, like the mips.  Usually, it should be empty.
1244 plibpth=''
1245
1246 : default library list
1247 libswanted=''
1248 : some systems want to use only the non-versioned libso:s
1249 ignore_versioned_solibs=''
1250 : full support for void wanted by default
1251 defvoidused=15
1252
1253 ccname=''
1254 ccversion=''
1255 perllibs=''
1256 : set useposix=false in your hint file to disable the POSIX extension.
1257 useposix=true
1258 : set useopcode=false in your hint file to disable the Opcode extension.
1259 useopcode=true
1260 archname64=''
1261 ccflags_uselargefiles=''
1262 ldflags_uselargefiles=''
1263 libswanted_uselargefiles=''
1264 : set usemultiplicity on the Configure command line to enable multiplicity.
1265 : set usesocks on the Configure command line to enable socks.
1266 archname=''
1267 : set usethreads on the Configure command line to enable threads.
1268 usereentrant='undef'
1269 : List of libraries we want.
1270 : If anyone needs -lnet, put it in a hint file.
1271 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1272 libswanted="$libswanted dld ld sun m c cposix posix"
1273 libswanted="$libswanted ndir dir crypt sec"
1274 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1275 : We probably want to search /usr/shlib before most other libraries.
1276 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1277 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1278 glibpth="/usr/shlib $glibpth"
1279 : Do not use vfork unless overridden by a hint file.
1280 usevfork=false
1281
1282 : Find the basic shell for Bourne shell scripts
1283 case "$sh" in
1284 '')
1285         case "$SYSTYPE" in
1286         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1287         *) xxx='/bin/sh';;
1288         esac
1289         if test -f "$xxx"; then
1290                 sh="$xxx"
1291         else
1292                 : Build up a list and do a single loop so we can 'break' out.
1293                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1294                 for xxx in sh bash ksh pdksh ash; do
1295                         for p in $pth; do
1296                                 try="$try ${p}/${xxx}"
1297                         done
1298                 done
1299                 for xxx in $try; do
1300                         if test -f "$xxx"; then
1301                                 sh="$xxx";
1302                                 break
1303                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1304                                 sh="$xxx";
1305                                 break
1306                         elif test -f "$xxx.exe"; then
1307                                 sh="$xxx";
1308                                 break
1309                         fi
1310                 done
1311         fi
1312         ;;
1313 esac
1314
1315 case "$sh" in
1316 '')     cat >&2 <<EOM
1317 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1318
1319 Usually it's in /bin/sh.  How did you even get this far?
1320 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1321 we'll try to straighten this all out.
1322 EOM
1323         exit 1
1324         ;;
1325 esac
1326
1327 : see if sh knows # comments
1328 if `$sh -c '#' >/dev/null 2>&1`; then
1329         shsharp=true
1330         spitshell=cat
1331         xcat=/bin/cat
1332         test -f $xcat$_exe || xcat=/usr/bin/cat
1333         if test ! -f $xcat$_exe; then
1334                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1335                         if test -f $p/cat$_exe; then
1336                                 xcat=$p/cat
1337                                 break
1338                         fi
1339                 done
1340                 if test ! -f $xcat$_exe; then
1341                         echo "Can't find cat anywhere!"
1342                         exit 1
1343                 fi
1344         fi
1345         echo "#!$xcat" >sharp
1346         $eunicefix sharp
1347         chmod +x sharp
1348         ./sharp > today
1349         if test -s today; then
1350                 sharpbang='#!'
1351         else
1352                 echo "#! $xcat" > sharp
1353                 $eunicefix sharp
1354                 chmod +x sharp
1355                 ./sharp > today
1356                 if test -s today; then
1357                         sharpbang='#! '
1358                 else
1359                         sharpbang=': use '
1360                 fi
1361         fi
1362 else
1363         echo " "
1364         echo "Your $sh doesn't grok # comments--I will strip them later on."
1365         shsharp=false
1366         cd ..
1367         echo "exec grep -v '^[  ]*#'" >spitshell
1368         chmod +x spitshell
1369         $eunicefix spitshell
1370         spitshell=`pwd`/spitshell
1371         cd UU
1372         echo "I presume that if # doesn't work, #! won't work either!"
1373         sharpbang=': use '
1374 fi
1375 rm -f sharp today
1376
1377 : figure out how to guarantee sh startup
1378 case "$startsh" in
1379 '') startsh=${sharpbang}${sh} ;;
1380 *)
1381 esac
1382 cat >sharp <<EOSS
1383 $startsh
1384 set abc
1385 test "$?abc" != 1
1386 EOSS
1387
1388 chmod +x sharp
1389 $eunicefix sharp
1390 if ./sharp; then
1391         : echo "Yup, it does."
1392 else
1393         echo "Hmm... '$startsh' does not guarantee sh startup..."
1394         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1395 fi
1396 rm -f sharp
1397
1398
1399 : Save command line options in file UU/cmdline.opt for later use in
1400 : generating config.sh.
1401 cat > cmdline.opt <<EOSH
1402 # Configure command line arguments.
1403 config_arg0='$0'
1404 config_args='$*'
1405 config_argc=$#
1406 EOSH
1407 argn=1
1408 args_exp=''
1409 args_sep=''
1410 for arg in "$@"; do
1411         cat >>cmdline.opt <<EOSH
1412 config_arg$argn='$arg'
1413 EOSH
1414         # Extreme backslashitis: replace each ' by '"'"'
1415         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1416 $arg
1417 EOC
1418         arg_exp=`cat cmdl.opt`
1419         args_exp="$args_exp$args_sep'$arg_exp'"
1420         argn=`expr $argn + 1`
1421         args_sep=' '
1422 done
1423 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1424 # used by ./hints/os2.sh
1425 rm -f cmdl.opt
1426
1427 : produce awk script to parse command line options
1428 cat >options.awk <<'EOF'
1429 BEGIN {
1430         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1431
1432         len = length(optstr);
1433         for (i = 1; i <= len; i++) {
1434                 c = substr(optstr, i, 1);
1435                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1436                 if (a == ":") {
1437                         arg[c] = 1;
1438                         i++;
1439                 }
1440                 opt[c] = 1;
1441         }
1442 }
1443 {
1444         expect = 0;
1445         str = $0;
1446         if (substr(str, 1, 1) != "-") {
1447                 printf("'%s'\n", str);
1448                 next;
1449         }
1450         len = length($0);
1451         for (i = 2; i <= len; i++) {
1452                 c = substr(str, i, 1);
1453                 if (!opt[c]) {
1454                         printf("-%s\n", substr(str, i));
1455                         next;
1456                 }
1457                 printf("-%s\n", c);
1458                 if (arg[c]) {
1459                         if (i < len)
1460                                 printf("'%s'\n", substr(str, i + 1));
1461                         else
1462                                 expect = 1;
1463                         next;
1464                 }
1465         }
1466 }
1467 END {
1468         if (expect)
1469                 print "?";
1470 }
1471 EOF
1472
1473 : process the command line options
1474 set X `for arg in "$@"; do echo "X$arg"; done |
1475         sed -e s/X// | awk -f options.awk`
1476 eval "set $*"
1477 shift
1478 rm -f options.awk
1479
1480 : set up default values
1481 fastread=''
1482 reuseval=false
1483 config_sh=''
1484 alldone=''
1485 error=''
1486 silent=''
1487 extractsh=''
1488 override=''
1489 knowitall=''
1490 rm -f optdef.sh posthint.sh
1491 cat >optdef.sh <<EOS
1492 $startsh
1493 EOS
1494
1495
1496 : option parsing
1497 while test $# -gt 0; do
1498         case "$1" in
1499         -d) shift; fastread=yes;;
1500         -e) shift; alldone=cont;;
1501         -f)
1502                 shift
1503                 cd ..
1504                 if test -r "$1"; then
1505                         config_sh="$1"
1506                 else
1507                         echo "$me: cannot read config file $1." >&2
1508                         error=true
1509                 fi
1510                 cd UU
1511                 shift;;
1512         -h) shift; error=true;;
1513         -r) shift; reuseval=true;;
1514         -s) shift; silent=true; realsilent=true;;
1515         -E) shift; alldone=exit;;
1516         -K) shift; knowitall=true;;
1517         -O) shift; override=true;;
1518         -S) shift; silent=true; extractsh=true;;
1519         -D)
1520                 shift
1521                 case "$1" in
1522                 *=)
1523                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1524                         echo "$me: ignoring -D $1" >&2
1525                         ;;
1526                 *=*) echo "$1" | \
1527                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1528                 *) echo "$1='define'" >> optdef.sh;;
1529                 esac
1530                 shift
1531                 ;;
1532         -U)
1533                 shift
1534                 case "$1" in
1535                 *=) echo "$1" >> optdef.sh;;
1536                 *=*)
1537                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1538                         echo "$me: ignoring -U $1" >&2
1539                         ;;
1540                 *) echo "$1='undef'" >> optdef.sh;;
1541                 esac
1542                 shift
1543                 ;;
1544         -A)
1545             shift
1546             xxx=''
1547             yyy="$1"
1548             zzz=''
1549             uuu=undef
1550             case "$yyy" in
1551             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1552                  case "$zzz" in
1553                  *:*) zzz='' ;;
1554                  *)   xxx=append
1555                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1556                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1557                  esac
1558                  ;;
1559             esac
1560             case "$xxx" in
1561             '')  case "$yyy" in
1562                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1563                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1564                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1565                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1566                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1567                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1568                  esac
1569                  ;;       
1570             esac
1571             case "$xxx" in
1572             append)
1573                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1574             clear)
1575                 echo "$yyy=''"                  >> posthint.sh ;;
1576             define)
1577                 case "$zzz" in
1578                 '') zzz=define ;;
1579                 esac
1580                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1581             eval)
1582                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1583             prepend)
1584                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1585             undef)
1586                 case "$zzz" in
1587                 '') zzz="$uuu" ;;
1588                 esac
1589                 echo "$yyy=$zzz"                >> posthint.sh ;;
1590             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1591             esac
1592             shift
1593             ;;
1594         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1595             exit 0;;
1596         --) break;;
1597         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1598         *) break;;
1599         esac
1600 done
1601
1602 case "$error" in
1603 true)
1604         cat >&2 <<EOM
1605 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1606                  [-U symbol] [-U symbol=] [-A command:symbol...]
1607   -d : use defaults for all answers.
1608   -e : go on without questioning past the production of config.sh.
1609   -f : specify an alternate default configuration file.
1610   -h : print this help message and exit (with an error status).
1611   -r : reuse C symbols value if possible (skips costly nm extraction).
1612   -s : silent mode, only echoes questions and essential information.
1613   -D : define symbol to have some value:
1614          -D symbol         symbol gets the value 'define'
1615          -D symbol=value   symbol gets the value 'value'
1616   -E : stop at the end of questions, after having produced config.sh.
1617   -K : do not use unless you know what you are doing.
1618   -O : let -D and -U override definitions from loaded configuration file.
1619   -S : perform variable substitutions on all .SH files (can mix with -f)
1620   -U : undefine symbol:
1621          -U symbol    symbol gets the value 'undef'
1622          -U symbol=   symbol gets completely empty
1623   -A : manipulate symbol after the platform specific hints have been applied:
1624          -A symbol=value                append " "value to symbol
1625          -A append:symbol=value         append value to symbol
1626          -A define:symbol=value         define symbol to have value
1627          -A clear:symbol                define symbol to be ''
1628          -A define:symbol               define symbol to be 'define'
1629          -A eval:symbol=value           define symbol to be eval of value
1630          -A prepend:symbol=value        prepend value to symbol
1631          -A undef:symbol                define symbol to be 'undef'
1632          -A undef:symbol=               define symbol to be ''
1633   -V : print version number and exit (with a zero status).
1634 EOM
1635         exit 1
1636         ;;
1637 esac
1638
1639 : Sanity checks
1640 case "$fastread$alldone" in
1641 yescont|yesexit) ;;
1642 *)
1643         case "$extractsh" in
1644         true) ;;
1645         *)
1646                 if test ! -t 0; then
1647                         echo "Say 'sh Configure', not 'sh <Configure'"
1648                         exit 1
1649                 fi
1650                 ;;
1651         esac
1652         ;;
1653 esac
1654
1655 exec 4>&1
1656 case "$silent" in
1657 true) exec 1>/dev/null;;
1658 esac
1659
1660 : run the defines and the undefines, if any, but leave the file out there...
1661 touch optdef.sh
1662 . ./optdef.sh
1663 : create the posthint manipulation script and leave the file out there...
1664 touch posthint.sh
1665
1666 : set package name
1667 package=perl5
1668 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1669 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1670 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1671 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1672 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1673 esac
1674
1675 : Some greps do not return status, grrr.
1676 echo "grimblepritz" >grimble
1677 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1678         contains=contains
1679 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1680         contains=grep
1681 else
1682         contains=contains
1683 fi
1684 rm -f grimble
1685 : the following should work in any shell
1686 case "$contains" in
1687 contains*)
1688         echo " "
1689         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1690         cat >contains <<'EOSS'
1691 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1692 EOSS
1693 chmod +x contains
1694 esac
1695
1696 : Find the path to the source tree
1697 case "$src" in
1698 '') case "$0" in
1699     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1700          case "$src" in
1701          /*)    ;;
1702          .)     ;;
1703          *)     src=`cd ../$src && pwd` ;;
1704          esac
1705          ;;
1706     *)   src='.';;
1707     esac;;
1708 esac
1709 case "$src" in
1710 '')     src=/
1711         rsrc=/
1712         ;;
1713 /*) rsrc="$src";;
1714 *) rsrc="../$src";;
1715 esac
1716 if test -f $rsrc/Configure && \
1717         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1718 then
1719    : found it, so we are ok.
1720 else
1721         rsrc=''
1722         for src in . .. ../.. ../../.. ../../../..; do
1723                 if test -f ../$src/Configure && \
1724                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1725                 then
1726                         rsrc=../$src
1727                         break
1728                 fi
1729         done
1730 fi
1731 case "$rsrc" in
1732 '')
1733         cat <<EOM >&4
1734
1735 Sorry, I can't seem to locate the source dir for $package.  Please start
1736 Configure with an explicit path -- i.e. /some/path/Configure.
1737
1738 EOM
1739         exit 1
1740         ;;
1741 ../.)   rsrc='..';;
1742 *)
1743         echo " "
1744         echo "Sources for $package found in \"$src\"." >&4
1745         ;;
1746 esac
1747
1748 : script used to extract .SH files with variable substitutions
1749 cat >extract <<'EOS'
1750 PERL_CONFIG_SH=true
1751 echo "Doing variable substitutions on .SH files..."
1752 if test -f MANIFEST; then
1753         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1754 else
1755         echo "(Looking for .SH files under the source directory.)"
1756         set x `(cd "$src"; find . -name "*.SH" -print)`
1757 fi
1758 shift
1759 case $# in
1760 0) set x `(cd "$src"; echo *.SH)`; shift;;
1761 esac
1762 if test ! -f "$src/$1"; then
1763         shift
1764 fi
1765 mkdir_p='
1766 name=$1;
1767 create="";
1768 while test $name; do
1769         if test ! -d "$name"; then
1770                 create="$name $create";
1771                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1772                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1773         else
1774                 name="";
1775         fi;
1776 done;
1777 for file in $create; do
1778         mkdir $file;
1779 done
1780 '
1781 for file in $*; do
1782         case "$src" in
1783         ".")
1784                 case "$file" in
1785                 */*)
1786                         dir=`expr X$file : 'X\(.*\)/'`
1787                         file=`expr X$file : 'X.*/\(.*\)'`
1788                         (cd "$dir" && . ./$file)
1789                         ;;
1790                 *)
1791                         . ./$file
1792                         ;;
1793                 esac
1794                 ;;
1795         *)
1796                 case "$file" in
1797                 */*)
1798                         dir=`expr X$file : 'X\(.*\)/'`
1799                         file=`expr X$file : 'X.*/\(.*\)'`
1800                         (set x $dir; shift; eval $mkdir_p)
1801                         sh <"$src/$dir/$file"
1802                         ;;
1803                 *)
1804                         sh <"$src/$file"
1805                         ;;
1806                 esac
1807                 ;;
1808         esac
1809 done
1810 if test -f "$src/config_h.SH"; then
1811         if test ! -f config.h; then
1812         : oops, they left it out of MANIFEST, probably, so do it anyway.
1813         . "$src/config_h.SH"
1814         fi
1815 fi
1816 EOS
1817
1818 : extract files and exit if asked to do so
1819 case "$extractsh" in
1820 true)
1821         case "$realsilent" in
1822         true) ;;
1823         *) exec 1>&4;;
1824         esac
1825         case "$config_sh" in
1826         '') config_sh='config.sh';;
1827         esac
1828         echo " "
1829         echo "Fetching answers from $config_sh..."
1830         cd ..
1831         . $config_sh
1832         test "$override" && . ./optdef.sh
1833         echo " "
1834         . UU/extract
1835         rm -rf UU
1836         echo "Extraction done."
1837         exit 0
1838         ;;
1839 esac
1840
1841 : Eunice requires " " instead of "", can you believe it
1842 echo " "
1843 : Here we go...
1844 echo "Beginning of configuration questions for $package."
1845
1846 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1847
1848 : first determine how to suppress newline on echo command
1849 echo " "
1850 echo "Checking echo to see how to suppress newlines..."
1851 (echo "hi there\c" ; echo " ") >.echotmp
1852 if $contains c .echotmp >/dev/null 2>&1 ; then
1853         echo "...using -n."
1854         n='-n'
1855         c=''
1856 else
1857         cat <<'EOM'
1858 ...using \c
1859 EOM
1860         n=''
1861         c='\c'
1862 fi
1863 echo $n "The star should be here-->$c"
1864 echo '*'
1865 rm -f .echotmp
1866
1867 : Now test for existence of everything in MANIFEST
1868 echo " "
1869 if test -f "$rsrc/MANIFEST"; then
1870         echo "First let's make sure your kit is complete.  Checking..." >&4
1871         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1872         rm -f missing
1873         tmppwd=`pwd`
1874         for filelist in x??; do
1875                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1876         done
1877         if test -s missing; then
1878                 cat missing >&4
1879                 cat >&4 <<'EOM'
1880
1881 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1882
1883 You have the option of continuing the configuration process, despite the
1884 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1885 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1886 and contact the author (perlbug@perl.org).
1887
1888 EOM
1889                 echo $n "Continue? [n] $c" >&4
1890                 read ans
1891                 case "$ans" in
1892                 y*)
1893                         echo "Continuing..." >&4
1894                         rm -f missing
1895                         ;;
1896                 *)
1897                         echo "ABORTING..." >&4
1898                         kill $$
1899                         ;;
1900                 esac
1901         else
1902                 echo "Looks good..."
1903         fi
1904 else
1905         echo "There is no MANIFEST file.  I hope your kit is complete !"
1906 fi
1907 rm -f missing x??
1908
1909 echo " "
1910 : Find the appropriate value for a newline for tr
1911 if test -n "$DJGPP"; then
1912        trnl='\012'
1913 fi
1914 if test X"$trnl" = X; then
1915         case "`echo foo|tr '\n' x 2>/dev/null`" in
1916         foox) trnl='\n' ;;
1917         esac
1918 fi
1919 if test X"$trnl" = X; then
1920         case "`echo foo|tr '\012' x 2>/dev/null`" in
1921         foox) trnl='\012' ;;
1922         esac
1923 fi
1924 if test X"$trnl" = X; then
1925        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1926        fooxy) trnl='\n\r' ;;
1927        esac
1928 fi
1929 if test X"$trnl" = X; then
1930         cat <<EOM >&2
1931
1932 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1933
1934 EOM
1935         exit 1
1936 fi
1937
1938 : compute the number of columns on the terminal for proper question formatting
1939 case "$COLUMNS" in
1940 '') COLUMNS='80';;
1941 esac
1942
1943 : set up the echo used in my read
1944 myecho="case \"\$xxxm\" in
1945 '') echo $n \"\$rp $c\" >&4;;
1946 *) case \"\$rp\" in
1947         '') echo $n \"[\$xxxm] $c\";;
1948         *)
1949                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1950                         echo \"\$rp\" >&4
1951                         echo $n \"[\$xxxm] $c\" >&4
1952                 else
1953                         echo $n \"\$rp [\$xxxm] $c\" >&4
1954                 fi
1955                 ;;
1956         esac;;
1957 esac"
1958
1959 : now set up to do reads with possible shell escape and default assignment
1960 cat <<EOSC >myread
1961 $startsh
1962 xxxm=\$dflt
1963 $myecho
1964 ans='!'
1965 case "\$fastread" in
1966 yes) case "\$dflt" in
1967         '') ;;
1968         *) ans='';
1969                 case "\$silent-\$rp" in
1970                 true-) ;;
1971                 *) echo " " >&4;;
1972                 esac;;
1973         esac;;
1974 *) case "\$silent" in
1975         true) case "\$rp" in
1976                 '') ans='';;
1977                 esac;;
1978         esac;;
1979 esac
1980 while expr "X\$ans" : "X!" >/dev/null; do
1981         read answ
1982         set x \$xxxm
1983         shift
1984         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1985         case  "\$answ" in
1986         "!")
1987                 sh 1>&4
1988                 echo " "
1989                 $myecho
1990                 ;;
1991         !*)
1992                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1993                 shift
1994                 sh 1>&4 -c "\$*"
1995                 echo " "
1996                 $myecho
1997                 ;;
1998         "\$ans")
1999                 case "\$ans" in
2000                 \\&*)
2001                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2002                         shift
2003                         case "\$1" in
2004                         -d)
2005                                 fastread=yes
2006                                 echo "(OK, I'll run with -d after this question.)" >&4
2007                                 ;;
2008                         -*)
2009                                 echo "*** Sorry, \$1 not supported yet." >&4
2010                                 ;;
2011                         esac
2012                         $myecho
2013                         ans=!
2014                         ;;
2015                 esac;;
2016         *)
2017                 case "\$aok" in
2018                 y)
2019                         echo "*** Substitution done -- please confirm."
2020                         xxxm="\$ans"
2021                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2022                         xxxm="\$ans"
2023                         ans=!
2024                         ;;
2025                 *)
2026                         echo "*** Error -- try again."
2027                         ans=!
2028                         ;;
2029                 esac
2030                 $myecho
2031                 ;;
2032         esac
2033         case "\$ans\$xxxm\$nostick" in
2034         '')
2035                 ans=!
2036                 $myecho
2037                 ;;
2038         esac
2039 done
2040 case "\$ans" in
2041 '') ans="\$xxxm";;
2042 esac
2043 EOSC
2044
2045 : create .config dir to save info across Configure sessions
2046 test -d ../.config || mkdir ../.config
2047 cat >../.config/README <<EOF
2048 This directory created by Configure to save information that should
2049 persist across sessions for $package.
2050
2051 You may safely delete it if you wish.
2052 EOF
2053
2054 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2055 case "$usedevel" in
2056 $define|true|[yY]*) ;;
2057 *) case "$xversion" in
2058    *[13579])
2059         cat >&4 <<EOH
2060 *** WHOA THERE!!! ***
2061
2062     This is an UNSTABLE DEVELOPMENT release.
2063     The version of this $package distribution is $xversion, that is, odd,
2064     (as opposed to even) and that signifies a development release.
2065     If you want a maintenance release, you want an even-numbered version.
2066
2067     Do ***NOT*** install this into production use.
2068     Data corruption and crashes are possible.
2069
2070     It is most seriously suggested that you do not continue any further
2071     unless you want to help in developing and debugging Perl.
2072
2073     If you *still* want to build perl, you can answer 'y' now,
2074     or pass -Dusedevel to Configure.
2075
2076 EOH
2077         rp='Do you really want to continue?'
2078         dflt='n'
2079         . ./myread
2080         case "$ans" in
2081         [yY]) echo >&4 "Okay, continuing."
2082               usedevel="$define" ;;
2083         *) echo >&4 "Okay, bye."
2084            exit 1
2085            ;;
2086         esac
2087         ;;
2088     esac
2089     ;;
2090 esac
2091 case "$usedevel" in
2092 $define|true|[yY]*)
2093         case "$versiononly" in
2094         '') versiononly="$define" ;;
2095         esac
2096         case "$installusrbinperl" in
2097         '') installusrbinperl="$undef" ;;
2098         esac
2099         ;;
2100 esac
2101
2102 : general instructions
2103 needman=true
2104 firsttime=true
2105 user=`(logname) 2>/dev/null`
2106 case "$user" in
2107 '') user=`whoami 2>&1`;;
2108 esac
2109 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2110         firsttime=false
2111         echo " "
2112         rp='Would you like to see the instructions?'
2113         dflt=n
2114         . ./myread
2115         case "$ans" in
2116         [yY]*) ;;
2117         *) needman=false;;
2118         esac
2119 fi
2120 if $needman; then
2121         cat <<EOH
2122
2123 This installation shell script will examine your system and ask you questions
2124 to determine how the perl5 package should be installed. If you get
2125 stuck on a question, you may use a ! shell escape to start a subshell or
2126 execute a command.  Many of the questions will have default answers in square
2127 brackets; typing carriage return will give you the default.
2128
2129 On some of the questions which ask for file or directory names you are allowed
2130 to use the ~name construct to specify the login directory belonging to "name",
2131 even if you don't have a shell which knows about that.  Questions where this is
2132 allowed will be marked "(~name ok)".
2133
2134 EOH
2135         rp=''
2136         dflt='Type carriage return to continue'
2137         . ./myread
2138         cat <<'EOH'
2139
2140 The prompter used in this script allows you to use shell variables and
2141 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2142 in the default answer, as if the default line was a set of arguments given to a
2143 script shell.  This means you may also use $* to repeat the whole default line,
2144 so you do not have to re-type everything to add something to the default.
2145
2146 Everytime there is a substitution, you will have to confirm.  If there is an
2147 error (e.g. an unmatched backtick), the default answer will remain unchanged
2148 and you will be prompted again.
2149
2150 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2151 the questions and use the computed defaults (or the previous answers if there
2152 was already a config.sh file). Type 'Configure -h' for a list of options.
2153 You may also start interactively and then answer '& -d' at any prompt to turn
2154 on the non-interactive behaviour for the remainder of the execution.
2155
2156 EOH
2157         . ./myread
2158         cat <<EOH
2159
2160 Much effort has been expended to ensure that this shell script will run on any
2161 Unix system.  If despite that it blows up on yours, your best bet is to edit
2162 Configure and run it again.  If you can't run Configure for some reason,
2163 you'll have to generate a config.sh file by hand.  Whatever problems you
2164 have, let me (perlbug@perl.org) know how I blew it.
2165
2166 This installation script affects things in two ways:
2167
2168 1) it may do direct variable substitutions on some of the files included
2169    in this kit.
2170 2) it builds a config.h file for inclusion in C programs.  You may edit
2171    any of these files as the need arises after running this script.
2172
2173 If you make a mistake on a question, there is no easy way to back up to it
2174 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2175 files.  Configure will offer to let you do this before it runs the SH files.
2176
2177 EOH
2178         dflt='Type carriage return to continue'
2179         . ./myread
2180         case "$firsttime" in
2181         true) echo $user >>../.config/instruct;;
2182         esac
2183 fi
2184
2185 : find out where common programs are
2186 echo " "
2187 echo "Locating common programs..." >&4
2188 cat <<EOSC >loc
2189 $startsh
2190 case \$# in
2191 0) exit 1;;
2192 esac
2193 thing=\$1
2194 shift
2195 dflt=\$1
2196 shift
2197 for dir in \$*; do
2198         case "\$thing" in
2199         .)
2200         if test -d \$dir/\$thing; then
2201                 echo \$dir
2202                 exit 0
2203         fi
2204         ;;
2205         *)
2206         for thisthing in \$dir/\$thing; do
2207                 : just loop through to pick last item
2208         done
2209         if test -f \$thisthing; then
2210                 echo \$thisthing
2211                 exit 0
2212         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2213                 echo \$thisthing
2214                 exit 0
2215         elif test -f \$dir/\$thing.exe; then
2216                 if test -n "$DJGPP"; then
2217                         echo \$dir/\$thing.exe
2218                 elif test "$eunicefix" != ":"; then
2219                         : on Eunice apparently
2220                         echo \$dir/\$thing
2221                         exit 0
2222                 fi
2223                 exit 0
2224         fi
2225         ;;
2226         esac
2227 done
2228 echo \$dflt
2229 exit 1
2230 EOSC
2231 chmod +x loc
2232 $eunicefix loc
2233 loclist="
2234 awk
2235 cat
2236 chmod
2237 comm
2238 cp
2239 echo
2240 expr
2241 grep
2242 ls
2243 mkdir
2244 rm
2245 sed
2246 sort
2247 touch
2248 tr
2249 uniq
2250 "
2251 trylist="
2252 Mcc
2253 ar
2254 bison
2255 byacc
2256 cpp
2257 csh
2258 date
2259 egrep
2260 gmake
2261 gzip
2262 less
2263 ln
2264 make
2265 more
2266 nm
2267 nroff
2268 pg
2269 test
2270 uname
2271 zip
2272 "
2273 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2274 pth="$pth /lib /usr/lib"
2275 for file in $loclist; do
2276         eval xxx=\$$file
2277         case "$xxx" in
2278         /*|?:[\\/]*)
2279                 if test -f "$xxx"; then
2280                         : ok
2281                 else
2282                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2283                         xxx=`./loc $file $file $pth`
2284                 fi
2285                 ;;
2286         '') xxx=`./loc $file $file $pth`;;
2287         *) xxx=`./loc $xxx $xxx $pth`;;
2288         esac
2289         eval $file=$xxx$_exe
2290         eval _$file=$xxx
2291         case "$xxx" in
2292         /*)
2293                 echo $file is in $xxx.
2294                 ;;
2295         ?:[\\/]*)
2296                 echo $file is in $xxx.
2297                 ;;
2298         *)
2299                 echo "I don't know where '$file' is, and my life depends on it." >&4
2300                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2301                 exit 1
2302                 ;;
2303         esac
2304 done
2305 echo " "
2306 echo "Don't worry if any of the following aren't found..."
2307 say=offhand
2308 for file in $trylist; do
2309         eval xxx=\$$file
2310         case "$xxx" in
2311         /*|?:[\\/]*)
2312                 if test -f "$xxx"; then
2313                         : ok
2314                 else
2315                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2316                         xxx=`./loc $file $file $pth`
2317                 fi
2318                 ;;
2319         '') xxx=`./loc $file $file $pth`;;
2320         *) xxx=`./loc $xxx $xxx $pth`;;
2321         esac
2322         eval $file=$xxx$_exe
2323         eval _$file=$xxx
2324         case "$xxx" in
2325         /*)
2326                 echo $file is in $xxx.
2327                 ;;
2328         ?:[\\/]*)
2329                 echo $file is in $xxx.
2330                 ;;
2331         *)
2332                 echo "I don't see $file out there, $say."
2333                 say=either
2334                 ;;
2335         esac
2336 done
2337 case "$egrep" in
2338 egrep)
2339         echo "Substituting grep for egrep."
2340         egrep=$grep
2341         _egrep=$grep
2342         ;;
2343 esac
2344 case "$ln" in
2345 ln)
2346         echo "Substituting cp for ln."
2347         ln=$cp
2348         _ln=$cp
2349         ;;
2350 esac
2351 case "$make" in
2352 make)   
2353         case "$gmake" in
2354         gmake)
2355         echo "I can't find make or gmake, and my life depends on it." >&4
2356         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2357         exit 1
2358         ;;
2359         esac
2360         ;;
2361 esac    
2362 case "$gmake" in
2363 gmake)  ;;
2364 *)      # We can't have osname yet.
2365         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2366                 # Assume that gmake, if found, is definitely GNU make
2367                 # and prefer it over the system make.
2368                 echo "Substituting gmake for make."
2369                 make=$gmake
2370                 _make=$gmake
2371         fi
2372         ;;
2373 esac
2374 case "$test" in
2375 test)
2376         echo "Hopefully test is built into your sh."
2377         ;;
2378 *)
2379         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2380                 echo "Using the test built into your sh."
2381                 test=test
2382                 _test=test
2383         fi
2384         ;;
2385 esac
2386 case "$echo" in
2387 echo)
2388         echo "Hopefully echo is built into your sh."
2389         ;;
2390 '') ;;
2391 *)
2392         echo " "
2393 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2394         $echo $n "hi there$c" >foo1
2395         echo $n "hi there$c" >foo2
2396         if cmp foo1 foo2 >/dev/null 2>&1; then
2397                 echo "They are compatible.  In fact, they may be identical."
2398         else
2399                 case "$n" in
2400                 '-n') n='' c='\c';;
2401                 *) n='-n' c='';;
2402                 esac
2403                 cat <<FOO
2404 They are not compatible!  You are probably running ksh on a non-USG system.
2405 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2406 have echo built in and we may have to run some Bourne shell scripts.  That
2407 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2408
2409 FOO
2410                 $echo $n "The star should be here-->$c"
2411                 $echo "*"
2412         fi
2413         $rm -f foo1 foo2
2414         ;;
2415 esac
2416
2417 cat <<EOS >trygcc
2418 $startsh
2419 EOS
2420 cat <<'EOSC' >>trygcc
2421 case "$cc" in
2422 '') ;;
2423 *)  $rm -f try try.*
2424     $cat >try.c <<EOM
2425 int main(int argc, char *argv[]) {
2426   return 0;
2427 }
2428 EOM
2429     if $cc -o try $ccflags $ldflags try.c; then
2430        :
2431     else
2432         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2433         despair=yes
2434         trygcc=yes
2435         case "$cc" in
2436         *gcc*) trygcc=no ;;
2437         esac
2438         case "`$cc -v -c try.c 2>&1`" in
2439         *gcc*) trygcc=no ;;
2440         esac
2441         if $test X"$trygcc" = Xyes; then
2442             if gcc -o try -c try.c; then
2443                 echo " "
2444                 echo "You seem to have a working gcc, though." >&4
2445                 rp="Would you like to use it?"
2446                 dflt=y
2447                 if $test -f myread; then
2448                     . ./myread
2449                 else
2450                     if $test -f UU/myread; then
2451                         . ./UU/myread
2452                     else
2453                         echo "Cannot find myread, sorry.  Aborting." >&2
2454                         exit 1
2455                     fi
2456                 fi  
2457                 case "$ans" in
2458                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2459                        if $test -f usethreads.cbu; then
2460                            $cat >&4 <<EOM 
2461
2462 *** However, any setting of the C compiler flags (e.g. for thread support)
2463 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2464 *** (together with e.g. -Dusethreads).
2465
2466 EOM
2467                        fi;;
2468                 esac
2469             fi
2470         fi
2471     fi
2472     $rm -f try try.*
2473     ;;
2474 esac
2475 EOSC
2476
2477 cat <<EOS >checkcc
2478 $startsh
2479 EOS
2480 cat <<'EOSC' >>checkcc
2481 case "$cc" in        
2482 '') ;;
2483 *)  $rm -f try try.*              
2484     $cat >try.c <<EOM
2485 int main(int argc, char *argv[]) {
2486   return 0;
2487 }
2488 EOM
2489     if $cc -o try $ccflags $ldflags try.c; then
2490        :
2491     else
2492         if $test X"$despair" = Xyes; then
2493            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2494         fi
2495         $cat >&4 <<EOM         
2496 You need to find a working C compiler.
2497 Either (purchase and) install the C compiler supplied by your OS vendor,
2498 or for a free C compiler try http://gcc.gnu.org/
2499 I cannot continue any further, aborting.
2500 EOM
2501         exit 1
2502     fi
2503     $rm -f try try.*
2504     ;;
2505 esac
2506 EOSC
2507
2508 : determine whether symbolic links are supported
2509 echo " "
2510 $touch blurfl
2511 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2512         echo "Symbolic links are supported." >&4
2513         lns="$ln -s"
2514 else
2515         echo "Symbolic links are NOT supported." >&4
2516         lns="$ln"
2517 fi
2518 $rm -f blurfl sym
2519
2520 : determine whether symbolic links are supported
2521 echo " "
2522 case "$lns" in
2523 *"ln"*" -s")
2524         echo "Checking how to test for symbolic links..." >&4
2525         $lns blurfl sym
2526         if $test "X$issymlink" = X; then
2527                 case "$newsh" in
2528                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2529                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2530                 esac
2531                 if test $? = 0; then
2532                         issymlink="test -h"
2533                 else
2534                         echo "Your builtin 'test -h' may be broken." >&4
2535                         case "$test" in
2536                         /*)     ;;
2537                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2538                                 for p in $pth
2539                                 do
2540                                         if test -f "$p/$test"; then
2541                                                 test="$p/$test"
2542                                                 break
2543                                         fi
2544                                 done
2545                                 ;;
2546                         esac
2547                         case "$test" in
2548                         /*)
2549                                 echo "Trying external '$test -h'." >&4
2550                                 issymlink="$test -h"
2551                                 if $test ! -h sym >/dev/null 2>&1; then
2552                                         echo "External '$test -h' is broken, too." >&4
2553                                         issymlink=''
2554                                 fi
2555                                 ;;
2556                         *)      issymlink='' ;;
2557                         esac
2558                 fi              
2559         fi
2560         if $test "X$issymlink" = X; then
2561                 if $test -L sym 2>/dev/null; then
2562                         issymlink="$test -L"
2563                         echo "The builtin '$test -L' worked." >&4
2564                 fi
2565         fi
2566         if $test "X$issymlink" != X; then
2567                 echo "You can test for symbolic links with '$issymlink'." >&4
2568         else
2569                 echo "I do not know how you can test for symbolic links." >&4
2570         fi
2571         $rm -f blurfl sym
2572         ;;
2573 *)      echo "No symbolic links, so not testing for their testing..." >&4
2574         ;;
2575 esac
2576 echo " "
2577
2578
2579 case "$mksymlinks" in
2580 $define|true|[yY]*)
2581         case "$src" in
2582         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2583                 exit 1
2584                 ;;
2585         *)      case "$lns:$issymlink" in
2586                 *"ln"*" -s:"*"test -"?)
2587                         echo "Creating the symbolic links..." >&4
2588                         echo "(First creating the subdirectories...)" >&4
2589                         cd ..
2590                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2591                                 read directory
2592                                 test -z "$directory" && break
2593                                 mkdir -p $directory
2594                         done
2595                         # Sanity check 1.
2596                         if test ! -d t/base; then
2597                                 echo "Failed to create the subdirectories.  Aborting." >&4
2598                                 exit 1
2599                         fi
2600                         echo "(Then creating the symlinks...)" >&4
2601                         awk '{print $1}' $src/MANIFEST | while true; do
2602                                 read filename
2603                                 test -z "$filename" && break
2604                                 if test -f $filename; then
2605                                         if $issymlink $filename; then
2606                                                 rm -f $filename
2607                                         fi
2608                                 fi
2609                                 if test -f $filename; then
2610                                         echo "$filename already exists, not symlinking."
2611                                 else
2612                                         ln -s $src/$filename $filename
2613                                 fi
2614                         done
2615                         # Sanity check 2.
2616                         if test ! -f t/base/lex.t; then
2617                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2618                                 exit 1
2619                         fi
2620                         cd UU
2621                         ;;
2622                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2623                         ;;
2624                 esac
2625                 ;;
2626         esac
2627         ;;
2628 esac
2629
2630
2631 case "$usecrosscompile" in
2632 $define|true|[yY]*)
2633         $echo "Cross-compiling..."
2634         croak=''
2635         case "$cc" in
2636         *-*-gcc) # A cross-compiling gcc, probably.
2637             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2638             ar=$targetarch-ar
2639             # leave out ld, choosing it is more complex
2640             nm=$targetarch-nm
2641             ranlib=$targetarch-ranlib
2642             $echo 'extern int foo;' > try.c
2643             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2644             shift
2645             if $test $# -gt 0; then
2646                 incpth="$incpth $*"
2647                 incpth="`$echo $incpth|$sed 's/^ //'`"
2648                 echo "Guessing incpth '$incpth'." >&4
2649                 for i in $*; do
2650                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2651                     if $test -d $j; then
2652                         libpth="$libpth $j"
2653                     fi
2654                 done   
2655                 libpth="`$echo $libpth|$sed 's/^ //'`"
2656                 echo "Guessing libpth '$libpth'." >&4
2657             fi
2658             $rm -f try.c
2659             ;;
2660         esac
2661         case "$targetarch" in
2662         '') echo "Targetarch not defined." >&4; croak=y ;;
2663         *)  echo "Using targetarch $targetarch." >&4 ;;
2664         esac
2665         case "$incpth" in
2666         '') echo "Incpth not defined." >&4; croak=y ;;
2667         *)  echo "Using incpth '$incpth'." >&4 ;;
2668         esac
2669         case "$libpth" in
2670         '') echo "Libpth not defined." >&4; croak=y ;;
2671         *)  echo "Using libpth '$libpth'." >&4 ;;
2672         esac
2673         case "$usrinc" in
2674         '') for i in $incpth; do
2675                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2676                     usrinc=$i
2677                     echo "Guessing usrinc $usrinc." >&4
2678                     break
2679                 fi
2680             done
2681             case "$usrinc" in
2682             '') echo "Usrinc not defined." >&4; croak=y ;;
2683             esac
2684             ;;
2685         *)  echo "Using usrinc $usrinc." >&4 ;;
2686         esac
2687         case "$targethost" in
2688         '') echo "Targethost not defined." >&4; croak=y ;;
2689         *)  echo "Using targethost $targethost." >&4
2690         esac
2691         locincpth=' '
2692         loclibpth=' '
2693         case "$croak" in
2694         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2695         esac
2696         case "$src" in
2697         /*) run=$src/Cross/run
2698             targetmkdir=$src/Cross/mkdir
2699             to=$src/Cross/to
2700             from=$src/Cross/from
2701             ;;
2702         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2703             run=$pwd/Cross/run
2704             targetmkdir=$pwd/Cross/mkdir
2705             to=$pwd/Cross/to
2706             from=$pwd/Cross/from
2707             ;;
2708         esac
2709         case "$targetrun" in
2710         '') targetrun=ssh ;;
2711         esac
2712         case "$targetto" in
2713         '') targetto=scp ;;
2714         esac
2715         case "$targetfrom" in
2716         '') targetfrom=scp ;;
2717         esac
2718         run=$run-$targetrun
2719         to=$to-$targetto
2720         from=$from-$targetfrom
2721         case "$targetdir" in
2722         '')  targetdir=/tmp
2723              echo "Guessing targetdir $targetdir." >&4
2724              ;;
2725         esac
2726         case "$targetuser" in
2727         '')  targetuser=root
2728              echo "Guessing targetuser $targetuser." >&4
2729              ;;
2730         esac
2731         case "$targetfrom" in
2732         scp)    q=-q ;;
2733         *)      q='' ;;
2734         esac
2735         case "$targetrun" in
2736         ssh|rsh)
2737             cat >$run <<EOF
2738 #!/bin/sh
2739 case "\$1" in
2740 -cwd)
2741   shift
2742   cwd=\$1
2743   shift
2744   ;;
2745 esac
2746 case "\$cwd" in
2747 '') cwd=$targetdir ;;
2748 esac
2749 exe=\$1
2750 shift
2751 if $test ! -f \$exe.xok; then
2752   $to \$exe
2753   $touch \$exe.xok
2754 fi
2755 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2756 EOF
2757             ;;
2758         *)  echo "Unknown targetrun '$targetrun'" >&4
2759             exit 1
2760             ;;
2761         esac
2762         case "$targetmkdir" in
2763         */Cross/mkdir)
2764             cat >$targetmkdir <<EOF
2765 #!/bin/sh
2766 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2767 EOF
2768             $chmod a+rx $targetmkdir
2769             ;;
2770         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2771             exit 1
2772             ;;
2773         esac
2774         case "$targetto" in
2775         scp|rcp)
2776             cat >$to <<EOF
2777 #!/bin/sh
2778 for f in \$@
2779 do
2780   case "\$f" in
2781   /*)
2782     $targetmkdir \`dirname \$f\`
2783     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2784     ;;
2785   *)
2786     $targetmkdir $targetdir/\`dirname \$f\`
2787     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2788     ;;
2789   esac
2790 done
2791 exit 0
2792 EOF
2793             ;;
2794         cp) cat >$to <<EOF
2795 #!/bin/sh
2796 for f in \$@
2797 do
2798   case "\$f" in
2799   /*)
2800     $mkdir -p $targetdir/\`dirname \$f\`
2801     $cp \$f $targetdir/\$f || exit 1
2802     ;;
2803   *)
2804     $targetmkdir $targetdir/\`dirname \$f\`
2805     $cp \$f $targetdir/\$f || exit 1
2806     ;;
2807   esac
2808 done
2809 exit 0
2810 EOF
2811             ;;
2812         *)  echo "Unknown targetto '$targetto'" >&4
2813             exit 1
2814             ;;
2815         esac
2816         case "$targetfrom" in
2817         scp|rcp)
2818           cat >$from <<EOF
2819 #!/bin/sh
2820 for f in \$@
2821 do
2822   $rm -f \$f
2823   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2824 done
2825 exit 0
2826 EOF
2827             ;;
2828         cp) cat >$from <<EOF
2829 #!/bin/sh
2830 for f in \$@
2831 do
2832   $rm -f \$f
2833   cp $targetdir/\$f . || exit 1
2834 done
2835 exit 0
2836 EOF
2837             ;;
2838         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2839             exit 1
2840             ;;
2841         esac
2842         if $test ! -f $run; then
2843             echo "Target 'run' script '$run' not found." >&4
2844         else
2845             $chmod a+rx $run
2846         fi
2847         if $test ! -f $to; then
2848             echo "Target 'to' script '$to' not found." >&4
2849         else
2850             $chmod a+rx $to
2851         fi
2852         if $test ! -f $from; then
2853             echo "Target 'from' script '$from' not found." >&4
2854         else
2855             $chmod a+rx $from
2856         fi
2857         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2858             exit 1
2859         fi
2860         cat >&4 <<EOF
2861 Using '$run' for remote execution,
2862 and '$from' and '$to'
2863 for remote file transfer.
2864 EOF
2865         ;;
2866 *)      run=''
2867         to=:
2868         from=:
2869         usecrosscompile='undef'
2870         targetarch=''
2871         ;;
2872 esac
2873
2874 : see whether [:lower:] and [:upper:] are supported character classes
2875 echo " "
2876 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2877 ABYZ)
2878         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2879         up='[:upper:]'
2880         low='[:lower:]'
2881         ;;
2882 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2883         # (0xc9 and 0xd1), therefore that is a nice testing point.
2884         if test "X$up" = X -o "X$low" = X; then
2885             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2886             ij) up='[A-Z]'
2887                 low='[a-z]'
2888                 ;;
2889             esac
2890         fi
2891         if test "X$up" = X -o "X$low" = X; then
2892             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2893             ij) up='A-Z'
2894                 low='a-z'
2895                 ;;
2896             esac
2897         fi
2898         if test "X$up" = X -o "X$low" = X; then
2899             case "`echo IJ | od -x 2>/dev/null`" in
2900             *C9D1*|*c9d1*)
2901                 echo "Hey, this might be EBCDIC." >&4
2902                 if test "X$up" = X -o "X$low" = X; then
2903                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2904                     ij) up='[A-IJ-RS-Z]'
2905                         low='[a-ij-rs-z]'
2906                         ;;
2907                     esac
2908                 fi
2909                 if test "X$up" = X -o "X$low" = X; then
2910                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2911                     ij) up='A-IJ-RS-Z'
2912                         low='a-ij-rs-z'
2913                         ;;
2914                     esac
2915                 fi
2916                 ;;
2917             esac
2918         fi
2919 esac
2920 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2921 ij)
2922     echo "Using $up and $low to convert case." >&4
2923     ;;
2924 *)
2925     echo "I don't know how to translate letters from upper to lower case." >&4
2926     echo "Your tr is not acting any way I know of." >&4
2927     exit 1
2928     ;;
2929 esac
2930 : set up the translation script tr, must be called with ./tr of course
2931 cat >tr <<EOSC
2932 $startsh
2933 case "\$1\$2" in
2934 '[A-Z][a-z]') exec $tr '$up' '$low';;
2935 '[a-z][A-Z]') exec $tr '$low' '$up';;
2936 esac
2937 exec $tr "\$@"
2938 EOSC
2939 chmod +x tr
2940 $eunicefix tr
2941
2942 : Try to determine whether config.sh was made on this system
2943 case "$config_sh" in
2944 '')
2945 myuname=`$uname -a 2>/dev/null`
2946 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2947 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2948 # because the A-Z/a-z are not consecutive.
2949 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2950         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2951 newmyuname="$myuname"
2952 dflt=n
2953 case "$knowitall" in
2954 '')
2955         if test -f ../config.sh; then
2956                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2957                         eval "`grep myuname= ../config.sh`"
2958                 fi
2959                 if test "X$myuname" = "X$newmyuname"; then
2960                         dflt=y
2961                 fi
2962         fi
2963         ;;
2964 *) dflt=y;;
2965 esac
2966
2967 : Get old answers from old config file if Configure was run on the
2968 : same system, otherwise use the hints.
2969 hint=default
2970 cd ..
2971 if test -f config.sh; then
2972         echo " "
2973         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2974         . UU/myread
2975         case "$ans" in
2976         n*|N*) echo "OK, I'll ignore it."
2977                 mv config.sh config.sh.old
2978                 myuname="$newmyuname"
2979                 ;;
2980         *)  echo "Fetching default answers from your old config.sh file..." >&4
2981                 tmp_n="$n"
2982                 tmp_c="$c"
2983                 tmp_sh="$sh"
2984                 . ./config.sh
2985                 cp config.sh UU
2986                 n="$tmp_n"
2987                 c="$tmp_c"
2988                 : Older versions did not always set $sh.  Catch re-use of such
2989                 : an old config.sh.
2990                 case "$sh" in
2991                 '') sh="$tmp_sh" ;;
2992                 esac
2993                 hint=previous
2994                 ;;
2995         esac
2996 fi
2997 . ./UU/checkcc
2998 if test ! -f config.sh; then
2999         $cat <<EOM
3000
3001 First time through, eh?  I have some defaults handy for some systems
3002 that need some extra help getting the Configure answers right:
3003
3004 EOM
3005         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3006         dflt=''
3007         : Half the following guesses are probably wrong... If you have better
3008         : tests or hints, please send them to perlbug@perl.org
3009         : The metaconfig authors would also appreciate a copy...
3010         $test -f /irix && osname=irix
3011         $test -f /xenix && osname=sco_xenix
3012         $test -f /dynix && osname=dynix
3013         $test -f /dnix && osname=dnix
3014         $test -f /lynx.os && osname=lynxos
3015         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3016         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3017         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3018         $test -f /bin/mips && /bin/mips && osname=mips
3019         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3020                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3021         $test -d /usr/apollo/bin && osname=apollo
3022         $test -f /etc/saf/_sactab && osname=svr4
3023         $test -d /usr/include/minix && osname=minix
3024         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3025         if $test -d /MachTen -o -d /MachTen_Folder; then
3026                 osname=machten
3027                 if $test -x /sbin/version; then
3028                         osvers=`/sbin/version | $awk '{print $2}' |
3029                         $sed -e 's/[A-Za-z]$//'`
3030                 elif $test -x /usr/etc/version; then
3031                         osvers=`/usr/etc/version | $awk '{print $2}' |
3032                         $sed -e 's/[A-Za-z]$//'`
3033                 else
3034                         osvers="$2.$3"
3035                 fi
3036         fi
3037
3038         $test -f /sys/posix.dll &&
3039                 $test -f /usr/bin/what &&
3040                 set X `/usr/bin/what /sys/posix.dll` &&
3041                 $test "$3" = UWIN &&
3042                 osname=uwin &&
3043                 osvers="$5"
3044
3045         if $test -f $uname; then
3046                 set X $myuname
3047                 shift
3048
3049                 case "$5" in
3050                 fps*) osname=fps ;;
3051                 mips*)
3052                         case "$4" in
3053                         umips) osname=umips ;;
3054                         *) osname=mips ;;
3055                         esac;;
3056                 [23]100) osname=mips ;;
3057                 next*) osname=next ;;
3058                 i386*)
3059                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3060                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3061                                 osname='sco'
3062                                 osvers=$tmp
3063                         elif $test -f /etc/kconfig; then
3064                                 osname=isc
3065                                 if test "$lns" = "$ln -s"; then
3066                                         osvers=4
3067                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3068                                         osvers=3
3069                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3070                                         osvers=2
3071                                 fi
3072                         fi
3073                         tmp=''
3074                         ;;
3075                 pc*)
3076                         if test -n "$DJGPP"; then
3077                                 osname=dos
3078                                 osvers=djgpp
3079                         fi
3080                         ;;
3081                 esac
3082
3083                 case "$1" in
3084                 aix) osname=aix
3085                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3086                         case "$tmp" in
3087                         'not found') osvers="$4"."$3" ;;
3088                         '<3240'|'<>3240') osvers=3.2.0 ;;
3089                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3090                         '=3250'|'>3250') osvers=3.2.5 ;;
3091                         *) osvers=$tmp;;
3092                         esac
3093                         ;;
3094                 bsd386) osname=bsd386
3095                         osvers=`$uname -r`
3096                         ;;
3097                 cygwin*) osname=cygwin
3098                         osvers="$3"
3099                         ;;
3100                 *dc.osx) osname=dcosx
3101                         osvers="$3"
3102                         ;;
3103                 dnix) osname=dnix
3104                         osvers="$3"
3105                         ;;
3106                 domainos) osname=apollo
3107                         osvers="$3"
3108                         ;;
3109                 dgux) osname=dgux 
3110                         osvers="$3"
3111                         ;;
3112                 dynixptx*) osname=dynixptx
3113                         osvers=`echo "$4"|sed 's/^v//'`
3114                         ;;
3115                 freebsd) osname=freebsd 
3116                         osvers="$3" ;;
3117                 genix) osname=genix ;;
3118                 hp*) osname=hpux 
3119                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3120                         ;;
3121                 irix*) osname=irix
3122                         case "$3" in
3123                         4*) osvers=4 ;;
3124                         5*) osvers=5 ;;
3125                         *)      osvers="$3" ;;
3126                         esac
3127                         ;;
3128                 linux) osname=linux
3129                         case "$3" in
3130                         *)      osvers="$3" ;;
3131                         esac
3132                         ;;
3133                 MiNT) osname=mint
3134                         ;;
3135                 netbsd*) osname=netbsd
3136                         osvers="$3"
3137                         ;;
3138                 news-os) osvers="$3"
3139                         case "$3" in
3140                         4*) osname=newsos4 ;;
3141                         *) osname=newsos ;;
3142                         esac
3143                         ;;
3144                 next*) osname=next ;;
3145                 nonstop-ux) osname=nonstopux ;;
3146                 openbsd) osname=openbsd
3147                         osvers="$3"
3148                         ;;
3149                 os2)    osname=os2
3150                         osvers="$4"
3151                         ;;
3152                 POSIX-BC | posix-bc ) osname=posix-bc
3153                         osvers="$3"
3154                         ;;
3155                 powerux | power_ux | powermax_os | powermaxos | \
3156                 powerunix | power_unix) osname=powerux
3157                         osvers="$3"
3158                         ;;
3159                 qnx) osname=qnx
3160                         osvers="$4"
3161                         ;;
3162                 solaris) osname=solaris
3163                         case "$3" in
3164                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3165                         *)      osvers="$3" ;;
3166                         esac
3167                         ;;
3168                 sunos) osname=sunos
3169                         case "$3" in
3170                         5*) osname=solaris
3171                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3172                         *)      osvers="$3" ;;
3173                         esac
3174                         ;;
3175                 titanos) osname=titanos
3176                         case "$3" in
3177                         1*) osvers=1 ;;
3178                         2*) osvers=2 ;;
3179                         3*) osvers=3 ;;
3180                         4*) osvers=4 ;;
3181                         *)      osvers="$3" ;;
3182                         esac
3183                         ;;
3184                 ultrix) osname=ultrix
3185                         osvers="$3"
3186                         ;;
3187                 osf1|mls+)      case "$5" in
3188                                 alpha)
3189                                         osname=dec_osf
3190                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3191                                         case "$osvers" in
3192                                         [1-9].[0-9]*) ;;
3193                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3194                                         esac
3195                                         ;;
3196                         hp*)    osname=hp_osf1  ;;
3197                         mips)   osname=mips_osf1 ;;
3198                         esac
3199                         ;;
3200                 # UnixWare 7.1.2 is known as Open UNIX 8
3201                 openunix|unixware) osname=svr5
3202                         osvers="$4"
3203                         ;;
3204                 uts)    osname=uts
3205                         osvers="$3"
3206                         ;;
3207                 vos) osvers="$3"
3208                         ;;
3209                 $2) case "$osname" in
3210                         *isc*) ;;
3211                         *freebsd*) ;;
3212                         svr*)
3213                                 : svr4.x or possibly later
3214                                 case "svr$3" in 
3215                                 ${osname}*)
3216                                         osname=svr$3
3217                                         osvers=$4
3218                                         ;;
3219                                 esac
3220                                 case "$osname" in
3221                                 svr4.0)
3222                                         : Check for ESIX
3223                                         if test -f /stand/boot ; then
3224                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3225                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3226                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3227                                                         if test -n "$isesix"; then
3228                                                                 osname=esix4
3229                                                         fi
3230                                                 fi
3231                                         fi
3232                                         ;;
3233                                 esac
3234                                 ;;
3235                         *)      if test -f /etc/systemid; then
3236                                         osname=sco
3237                                         set `echo $3 | $sed 's/\./ /g'` $4
3238                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3239                                                 osvers=$1.$2.$3
3240                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3241                                                 osvers=$1.$2
3242                                         elif $test -f $src/hints/sco_$1.sh; then
3243                                                 osvers=$1
3244                                         fi
3245                                 else
3246                                         case "$osname" in
3247                                         '') : Still unknown.  Probably a generic Sys V.
3248                                                 osname="sysv"
3249                                                 osvers="$3"
3250                                                 ;;
3251                                         esac
3252                                 fi
3253                                 ;;
3254                         esac
3255                         ;;
3256                 *)      case "$osname" in
3257                         '') : Still unknown.  Probably a generic BSD.
3258                                 osname="$1"
3259                                 osvers="$3"
3260                                 ;;
3261                         esac
3262                         ;;
3263                 esac
3264         else
3265                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3266                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3267                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3268                                 osname=news_os
3269                         fi
3270                         $rm -f UU/kernel.what
3271                 elif test -d c:/. -o -n "$is_os2" ; then
3272                         set X $myuname
3273                         osname=os2
3274                         osvers="$5"
3275                 fi
3276         fi
3277         
3278         case "$targetarch" in
3279         '') ;;
3280         *)  hostarch=$osname
3281             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3282             osvers=''
3283             ;;
3284         esac
3285
3286         : Now look for a hint file osname_osvers, unless one has been
3287         : specified already.
3288         case "$hintfile" in
3289         ''|' ')
3290                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3291                 : Also try without trailing minor version numbers.
3292                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3293                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3294                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3295                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3296                 case "$file" in
3297                 '') dflt=none ;;
3298                 *)  case "$osvers" in
3299                         '') dflt=$file
3300                                 ;;
3301                         *)  if $test -f $src/hints/$file.sh ; then
3302                                         dflt=$file
3303                                 elif $test -f $src/hints/$xfile.sh ; then
3304                                         dflt=$xfile
3305                                 elif $test -f $src/hints/$xxfile.sh ; then
3306                                         dflt=$xxfile
3307                                 elif $test -f $src/hints/$xxxfile.sh ; then
3308                                         dflt=$xxxfile
3309                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3310                                         dflt=$xxxxfile
3311                                 elif $test -f "$src/hints/${osname}.sh" ; then
3312                                         dflt="${osname}"
3313                                 else
3314                                         dflt=none
3315                                 fi
3316                                 ;;
3317                         esac
3318                         ;;
3319                 esac
3320                 if $test -f Policy.sh ; then
3321                         case "$dflt" in
3322                         *Policy*) ;;
3323                         none) dflt="Policy" ;;
3324                         *) dflt="Policy $dflt" ;;
3325                         esac
3326                 fi
3327                 ;;
3328         *)
3329                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3330                 ;;
3331         esac
3332
3333         if $test -f Policy.sh ; then
3334                 $cat <<EOM
3335
3336 There's also a Policy hint file available, which should make the
3337 site-specific (policy) questions easier to answer.
3338 EOM
3339
3340         fi
3341
3342         $cat <<EOM
3343
3344 You may give one or more space-separated answers, or "none" if appropriate.
3345 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3346 is a good thing.  DO NOT give a wrong version or a wrong OS.
3347
3348 EOM
3349
3350         rp="Which of these apply, if any?"
3351         . UU/myread
3352         tans=$ans
3353         for file in $tans; do
3354                 if $test X$file = XPolicy -a -f Policy.sh; then
3355                         . Policy.sh
3356                         $cat Policy.sh >> UU/config.sh
3357                 elif $test -f $src/hints/$file.sh; then
3358                         . $src/hints/$file.sh
3359                         $cat $src/hints/$file.sh >> UU/config.sh
3360                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3361                         : nothing
3362                 else
3363                         : Give one chance to correct a possible typo.
3364                         echo "$file.sh does not exist"
3365                         dflt=$file
3366                         rp="hint to use instead?"
3367                         . UU/myread
3368                         for file in $ans; do
3369                                 if $test -f "$src/hints/$file.sh"; then
3370                                         . $src/hints/$file.sh
3371                                         $cat $src/hints/$file.sh >> UU/config.sh
3372                                 elif $test X$ans = X -o X$ans = Xnone ; then
3373                                         : nothing
3374                                 else
3375                                         echo "$file.sh does not exist -- ignored."
3376                                 fi
3377                         done
3378                 fi
3379         done
3380
3381         hint=recommended
3382         : Remember our hint file for later.
3383         if $test -f "$src/hints/$file.sh" ; then
3384                 hintfile="$file"
3385         else
3386                 hintfile=''
3387         fi
3388 fi
3389 cd UU
3390 ;;
3391 *)
3392         echo " "
3393         echo "Fetching default answers from $config_sh..." >&4
3394         tmp_n="$n"
3395         tmp_c="$c"
3396         cd ..
3397         cp $config_sh config.sh 2>/dev/null
3398         chmod +w config.sh
3399         . ./config.sh
3400         cd UU
3401         cp ../config.sh .
3402         n="$tmp_n"
3403         c="$tmp_c"
3404         hint=previous
3405         ;;
3406 esac
3407 test "$override" && . ./optdef.sh
3408
3409 : Restore computed paths
3410 for file in $loclist $trylist; do
3411         eval $file="\$_$file"
3412 done
3413
3414 cat << EOM
3415
3416 Configure uses the operating system name and version to set some defaults.
3417 The default value is probably right if the name rings a bell. Otherwise,
3418 since spelling matters for me, either accept the default or answer "none"
3419 to leave it blank.
3420
3421 EOM
3422 case "$osname" in
3423         ''|' ')
3424                 case "$hintfile" in
3425                 ''|' '|none) dflt=none ;;
3426                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3427                 esac
3428                 ;;
3429         *) dflt="$osname" ;;
3430 esac
3431 rp="Operating system name?"
3432 . ./myread
3433 case "$ans" in
3434 none)  osname='' ;;
3435 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3436 esac
3437 echo " "
3438 case "$osvers" in
3439         ''|' ')
3440                 case "$hintfile" in
3441                 ''|' '|none) dflt=none ;;
3442                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3443                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3444                         case "$dflt" in
3445                         ''|' ') dflt=none ;;
3446                         esac
3447                         ;;
3448                 esac
3449                 ;;
3450         *) dflt="$osvers" ;;
3451 esac
3452 rp="Operating system version?"
3453 . ./myread
3454 case "$ans" in
3455 none)  osvers='' ;;
3456 *) osvers="$ans" ;;
3457 esac
3458
3459
3460 . ./posthint.sh
3461
3462 : who configured the system
3463 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3464 cf_by=`(logname) 2>/dev/null`
3465 case "$cf_by" in
3466 "")
3467         cf_by=`(whoami) 2>/dev/null`
3468         case "$cf_by" in
3469         "") cf_by=unknown ;;
3470         esac ;;
3471 esac
3472
3473 : set up the script used to warn in case of inconsistency
3474 cat <<EOS >whoa
3475 $startsh
3476 EOS
3477 cat <<'EOSC' >>whoa
3478 dflt=y
3479 echo " "
3480 echo "*** WHOA THERE!!! ***" >&4
3481 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3482 rp="    Keep the $hint value?"
3483 . ./myread
3484 case "$ans" in
3485 y) td=$was; tu=$was;;
3486 esac
3487 EOSC
3488
3489 : function used to set $1 to $val
3490 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3491 case "$val$was" in
3492 $define$undef) . ./whoa; eval "$var=\$td";;
3493 $undef$define) . ./whoa; eval "$var=\$tu";;
3494 *) eval "$var=$val";;
3495 esac'
3496
3497 case "$usesocks" in
3498 $define|true|[yY]*)     dflt='y';;
3499 *) dflt='n';;
3500 esac
3501 cat <<EOM
3502
3503 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3504 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3505 to use the PerlIO abstraction layer, this will be implicitly selected.
3506
3507 If this doesn't make any sense to you, just accept the default '$dflt'.
3508 EOM
3509 rp='Build Perl for SOCKS?'
3510 . ./myread
3511 case "$ans" in
3512 y|Y)    val="$define" ;;     
3513 *)      val="$undef" ;;
3514 esac
3515 set usesocks
3516 eval $setvar
3517
3518 case "$usesocks" in
3519 $define|true|[yY]*) useperlio="$define";;
3520 esac
3521
3522 case "$useperlio" in
3523 $define|true|[yY]*|'')  dflt='y';;
3524 *) dflt='n';;
3525 esac
3526 cat <<EOM
3527
3528 Previous version of $package used the standard IO mechanisms as
3529 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3530 alternate IO mechanisms via the PerlIO abstraction layer, but the
3531 stdio mechanism is still available if needed.  The abstraction layer
3532 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3533 Using PerlIO with sfio may cause problems with some extension modules.
3534
3535 If this doesn't make any sense to you, just accept the default '$dflt'.
3536 EOM
3537 rp='Use the PerlIO abstraction layer?'
3538 . ./myread
3539 case "$ans" in
3540 y|Y) 
3541         val="$define"
3542         ;;
3543 *)      
3544         echo "Ok, doing things the stdio way."
3545         val="$undef"
3546         ;;
3547 esac
3548 set useperlio
3549 eval $setvar 
3550
3551 case "$usesocks" in
3552 $define|true|[yY]*)
3553         case "$useperlio" in
3554         $define|true|[yY]*) ;;
3555         *)      cat >&4 <<EOM
3556
3557 You are using the SOCKS proxy protocol library which means that you
3558 should also use the PerlIO layer.  You may be headed for trouble.
3559
3560 EOM
3561                 ;;
3562         esac
3563         ;;
3564 esac
3565
3566         
3567 case "$usethreads" in
3568 $define|true|[yY]*)     dflt='y';;
3569 *)     # Catch case where user specified ithreads or 5005threads but
3570        # forgot -Dusethreads (A.D. 4/2002)
3571        case "$useithreads$use5005threads" in
3572        *$define*)      
3573                 case "$useperlio" in
3574                 "$define")      dflt='y' ;;
3575                 *)              dflt='n' ;;
3576                 esac
3577                 ;;
3578        *)       dflt='n';;
3579        esac
3580        ;;
3581 esac
3582 cat <<EOM
3583
3584 Perl can be built to take advantage of threads on some systems.
3585 To do so, Configure can be run with -Dusethreads.
3586
3587 Note that Perl built with threading support runs slightly slower
3588 and uses more memory than plain Perl. The current implementation
3589 is believed to be stable, but it is fairly new, and so should be
3590 treated with caution.
3591
3592 If this doesn't make any sense to you, just accept the default '$dflt'.
3593 EOM
3594 rp='Build a threading Perl?'
3595 . ./myread
3596 case "$ans" in
3597 y|Y)    val="$define" ;;
3598 *)      val="$undef" ;;
3599 esac
3600 set usethreads
3601 eval $setvar
3602
3603 case "$usethreads" in
3604 $define)
3605         $cat <<EOM
3606
3607 Since release 5.6, Perl has had two different threading implementations,
3608 the newer interpreter-based version (ithreads) with one interpreter per
3609 thread, and the older 5.005 version (5005threads).
3610 The 5005threads version is effectively unmaintained and will probably be
3611 removed in Perl 5.10, so there should be no need to build a Perl using it
3612 unless needed for backwards compatibility with some existing 5.005threads
3613 code.
3614
3615 EOM
3616         : Default to ithreads unless overridden on command line or with
3617         : old config.sh
3618         dflt='y'
3619         case "$use5005threads" in
3620                 $define|true|[yY]*) dflt='n';;
3621         esac
3622         case "$useithreads" in
3623                 $undef|false|[nN]*) dflt='n';;
3624         esac
3625         rp='Use the newer interpreter-based ithreads?'
3626         . ./myread
3627         case "$ans" in
3628         y|Y)    val="$define" ;;
3629         *)      val="$undef" ;;
3630         esac
3631         set useithreads
3632         eval $setvar
3633         : Now set use5005threads to the opposite value.
3634         case "$useithreads" in
3635         $define) val="$undef" ;;
3636         *) val="$define" ;;
3637         esac
3638         set use5005threads
3639         eval $setvar
3640         ;;
3641 *)
3642         useithreads="$undef"
3643         use5005threads="$undef"
3644         ;;
3645 esac
3646
3647 case "$useithreads$use5005threads" in
3648 "$define$define")
3649         $cat >&4 <<EOM
3650
3651 You cannot have both the ithreads and the 5.005 threads enabled
3652 at the same time.  Disabling the 5.005 threads since they are
3653 much less stable than the ithreads.
3654
3655 EOM
3656         use5005threads="$undef"
3657         ;;
3658 esac
3659
3660 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3661         cat >&4 <<EOF
3662 ***
3663 *** To build with ithreads you must also use the PerlIO layer.
3664 *** Cannot continue, aborting.
3665 ***
3666 EOF
3667         exit 1
3668 fi
3669
3670 case "$d_oldpthreads" in
3671 '')     : Configure tests would be welcome here.  For now, assume undef.
3672         val="$undef" ;;
3673 *)      val="$d_oldpthreads" ;;
3674 esac
3675 set d_oldpthreads
3676 eval $setvar
3677
3678
3679 case "$usethreads" in
3680 "$define"|true|[yY]*)
3681 : Look for a hint-file generated 'call-back-unit'.  If the
3682 : user has specified that a threading perl is to be built,
3683 : we may need to set or change some other defaults.
3684         if $test -f usethreads.cbu; then
3685                 echo "Your platform has some specific hints for threaded builds, using them..."
3686                 . ./usethreads.cbu
3687         else
3688                 $cat <<EOM
3689 (Your platform doesn't have any specific hints for threaded builds.
3690  Assuming POSIX threads, then.)
3691 EOM
3692         fi
3693         ;;
3694 esac
3695
3696 cat <<EOM
3697
3698 Perl can be built so that multiple Perl interpreters can coexist
3699 within the same Perl executable.
3700 EOM
3701
3702 case "$useithreads" in
3703 $define)
3704         cat <<EOM
3705 This multiple interpreter support is required for interpreter-based threads.
3706 EOM
3707         val="$define"
3708         ;;
3709 *)      case "$usemultiplicity" in
3710         $define|true|[yY]*)     dflt='y';;
3711         *) dflt='n';;
3712         esac
3713         echo " "
3714         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3715         rp='Build Perl for multiplicity?'
3716         . ./myread
3717         case "$ans" in
3718         y|Y)    val="$define" ;;
3719         *)      val="$undef" ;;
3720         esac
3721         ;;
3722 esac
3723 set usemultiplicity
3724 eval $setvar
3725
3726
3727 case "$usemorebits" in
3728 "$define"|true|[yY]*)
3729         use64bitint="$define"
3730         uselongdouble="$define"
3731         usemorebits="$define"
3732         ;;
3733 *)      usemorebits="$undef"
3734         ;;
3735 esac
3736
3737 : make some quick guesses about what we are up against
3738 echo " "
3739 $echo $n "Hmm...  $c"
3740 echo exit 1 >bsd
3741 echo exit 1 >usg
3742 echo exit 1 >v7
3743 echo exit 1 >osf1
3744 echo exit 1 >eunice
3745 echo exit 1 >xenix
3746 echo exit 1 >venix
3747 echo exit 1 >os2
3748 d_bsd="$undef"
3749 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3750 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3751 then
3752         echo "Looks kind of like an OSF/1 system, but we'll see..."
3753         echo exit 0 >osf1
3754 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3755         xxx=`./loc addbib blurfl $pth`
3756         if $test -f $xxx; then
3757         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3758                 echo exit 0 >bsd
3759                 echo exit 0 >usg
3760         else
3761                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3762                         echo "Looks kind of like an extended USG system, but we'll see..."
3763                 else
3764                         echo "Looks kind of like a USG system, but we'll see..."
3765                 fi
3766                 echo exit 0 >usg
3767         fi
3768 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3769         echo "Looks kind of like a BSD system, but we'll see..."
3770         d_bsd="$define"
3771         echo exit 0 >bsd
3772 else
3773         echo "Looks kind of like a Version 7 system, but we'll see..."
3774         echo exit 0 >v7
3775 fi
3776 case "$eunicefix" in
3777 *unixtovms*)
3778         $cat <<'EOI'
3779 There is, however, a strange, musty smell in the air that reminds me of
3780 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3781 EOI
3782         echo exit 0 >eunice
3783         d_eunice="$define"
3784 : it so happens the Eunice I know will not run shell scripts in Unix format
3785         ;;
3786 *)
3787         echo " "
3788         echo "Congratulations.  You aren't running Eunice."
3789         d_eunice="$undef"
3790         ;;
3791 esac
3792 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3793 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3794 : semicolon as a patch separator
3795 case "$p_" in
3796 :) ;;
3797 *)
3798         $cat <<'EOI'
3799 I have the feeling something is not exactly right, however...don't tell me...
3800 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3801 (Or you may be running DOS with DJGPP.)
3802 EOI
3803         echo exit 0 >os2
3804         ;;
3805 esac
3806 if test -f /xenix; then
3807         echo "Actually, this looks more like a XENIX system..."
3808         echo exit 0 >xenix
3809         d_xenix="$define"
3810 else
3811         echo " "
3812         echo "It's not Xenix..."
3813         d_xenix="$undef"
3814 fi
3815 chmod +x xenix
3816 $eunicefix xenix
3817 if test -f /venix; then
3818         echo "Actually, this looks more like a VENIX system..."
3819         echo exit 0 >venix
3820 else
3821         echo " "
3822         if ./xenix; then
3823                 : null
3824         else
3825                 echo "Nor is it Venix..."
3826         fi
3827 fi
3828 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3829 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3830 $rm -f foo
3831
3832 case "$cc" in
3833 '') dflt=cc;;
3834 *) dflt="$cc";;
3835 esac
3836 rp="Use which C compiler?"
3837 . ./myread
3838 cc="$ans"
3839
3840 : See if they have not cc but they do have gcc
3841 . ./trygcc
3842 : Look for a hint-file generated 'call-back-unit'.  Now that the
3843 : user has specified the compiler, we may need to set or change some
3844 : other defaults.
3845 if $test -f cc.cbu; then
3846     . ./cc.cbu
3847 fi
3848 . ./checkcc
3849
3850 echo " "
3851 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3852 $cat >try.c <<EOM
3853 #include <stdio.h>
3854 int main() {
3855 #ifdef __GNUC__
3856 #ifdef __VERSION__
3857         printf("%s\n", __VERSION__);
3858 #else
3859         printf("%s\n", "1");
3860 #endif
3861 #endif
3862         return(0);
3863 }
3864 EOM
3865 if $cc -o try $ccflags $ldflags try.c; then
3866         gccversion=`$run ./try`
3867         case "$gccversion" in
3868         '') echo "You are not using GNU cc." ;;
3869         *)  echo "You are using GNU cc $gccversion."
3870             ccname=gcc
3871             ;;
3872         esac
3873 else
3874         echo " "
3875         echo "*** WHOA THERE!!! ***" >&4
3876         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3877         case "$knowitall" in
3878         '')
3879         echo "    You'd better start hunting for one and let me know about it." >&4
3880                 exit 1
3881                 ;;
3882         esac
3883 fi
3884 $rm -f try try.*
3885 case "$gccversion" in
3886 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3887 esac
3888 case "$gccversion" in
3889 '') gccosandvers='' ;;
3890 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3891    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3892    gccshortvers=''
3893    case "$gccosandvers" in
3894    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3895    $osname$osvers) ;; # looking good
3896    $osname*) cat <<EOM >&4
3897
3898 *** WHOA THERE!!! ***
3899
3900     Your gcc has not been compiled for the exact release of
3901     your operating system ($gccosandvers versus $osname$osvers).
3902
3903     In general it is a good idea to keep gcc synchronized with
3904     the operating system because otherwise serious problems
3905     may ensue when trying to compile software, like Perl.
3906
3907     I'm trying to be optimistic here, though, and will continue.
3908     If later during the configuration and build icky compilation
3909     problems appear (headerfile conflicts being the most common
3910     manifestation), I suggest reinstalling the gcc to match
3911     your operating system release.
3912
3913 EOM
3914       ;;
3915    *) gccosandvers='' ;; # failed to parse, better be silent
3916    esac
3917    ;;
3918 esac
3919 case "$ccname" in
3920 '') ccname="$cc" ;;
3921 esac
3922
3923 # gcc 3.* complain about adding -Idirectories that they already know about,
3924 # so we will take those off from locincpth.
3925 case "$gccversion" in
3926 3*)
3927     echo "main(){}">try.c
3928     for incdir in $locincpth; do
3929        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3930              grep '^c[cp]p*[01]: warning: changing search order '`
3931        if test "X$warn" != X; then
3932            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3933        fi
3934     done
3935     $rm -f try try.*
3936 esac
3937
3938 : decide how portable to be.  Allow command line overrides.
3939 case "$d_portable" in
3940 "$undef") ;;
3941 *)      d_portable="$define" ;;
3942 esac
3943
3944 : set up shell script to do ~ expansion
3945 cat >filexp <<EOSS
3946 $startsh
3947 : expand filename
3948 case "\$1" in
3949  ~/*|~)
3950         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3951         ;;
3952  ~*)
3953         if $test -f /bin/csh; then
3954                 /bin/csh -f -c "glob \$1"
3955                 failed=\$?
3956                 echo ""
3957                 exit \$failed
3958         else
3959                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3960                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3961                 if $test ! -d "\$dir"; then
3962                         me=\`basename \$0\`
3963                         echo "\$me: can't locate home directory for: \$name" >&2
3964                         exit 1
3965                 fi
3966                 case "\$1" in
3967                 */*)
3968                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3969                         ;;
3970                 *)
3971                         echo \$dir
3972                         ;;
3973                 esac
3974         fi
3975         ;;
3976 *)
3977         echo \$1
3978         ;;
3979 esac
3980 EOSS
3981 chmod +x filexp
3982 $eunicefix filexp
3983
3984 : now set up to get a file name
3985 cat <<EOS >getfile
3986 $startsh
3987 EOS
3988 cat <<'EOSC' >>getfile
3989 tilde=''
3990 fullpath=''
3991 already=''
3992 skip=''
3993 none_ok=''
3994 exp_file=''
3995 nopath_ok=''
3996 orig_rp="$rp"
3997 orig_dflt="$dflt"
3998 case "$gfpth" in
3999 '') gfpth='.' ;;
4000 esac
4001
4002 case "$fn" in
4003 *\(*)
4004         : getfile will accept an answer from the comma-separated list
4005         : enclosed in parentheses even if it does not meet other criteria.
4006         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4007         fn=`echo $fn | sed 's/(.*)//'`
4008         ;;
4009 esac
4010
4011 case "$fn" in
4012 *:*)
4013         loc_file=`expr $fn : '.*:\(.*\)'`
4014         fn=`expr $fn : '\(.*\):.*'`
4015         ;;
4016 esac
4017
4018 case "$fn" in
4019 *~*) tilde=true;;
4020 esac
4021 case "$fn" in
4022 */*) fullpath=true;;
4023 esac
4024 case "$fn" in
4025 *+*) skip=true;;
4026 esac
4027 case "$fn" in
4028 *n*) none_ok=true;;
4029 esac
4030 case "$fn" in
4031 *e*) exp_file=true;;
4032 esac
4033 case "$fn" in
4034 *p*) nopath_ok=true;;
4035 esac
4036
4037 case "$fn" in
4038 *f*) type='File';;
4039 *d*) type='Directory';;
4040 *l*) type='Locate';;
4041 esac
4042
4043 what="$type"
4044 case "$what" in
4045 Locate) what='File';;
4046 esac
4047
4048 case "$exp_file" in
4049 '')
4050         case "$d_portable" in
4051         "$define") ;;
4052         *) exp_file=true;;
4053         esac
4054         ;;
4055 esac
4056
4057 cd ..
4058 while test "$type"; do
4059         redo=''
4060         rp="$orig_rp"
4061         dflt="$orig_dflt"
4062         case "$tilde" in
4063         true) rp="$rp (~name ok)";;
4064         esac
4065         . UU/myread
4066         if test -f UU/getfile.ok && \
4067                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4068         then
4069                 value="$ans"
4070                 ansexp="$ans"
4071                 break
4072         fi
4073         case "$ans" in
4074         none)
4075                 value=''
4076                 ansexp=''
4077                 case "$none_ok" in
4078                 true) type='';;
4079                 esac
4080                 ;;
4081         *)
4082                 case "$tilde" in
4083                 '') value="$ans"
4084                         ansexp="$ans";;
4085                 *)
4086                         value=`UU/filexp $ans`
4087                         case $? in
4088                         0)
4089                                 if test "$ans" != "$value"; then
4090                                         echo "(That expands to $value on this system.)"
4091                                 fi
4092                                 ;;
4093                         *) value="$ans";;
4094                         esac
4095                         ansexp="$value"
4096                         case "$exp_file" in
4097                         '') value="$ans";;
4098                         esac
4099                         ;;
4100                 esac
4101                 case "$fullpath" in
4102                 true)
4103                         case "$ansexp" in
4104                         /*) value="$ansexp" ;;
4105                         [a-zA-Z]:/*) value="$ansexp" ;;
4106                         *)
4107                                 redo=true
4108                                 case "$already" in
4109                                 true)
4110                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4111                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4112                                         ;;
4113                                 *)
4114                                 echo "Please give a full path name, starting with slash." >&4
4115                                         case "$tilde" in
4116                                         true)
4117                                 echo "Note that using ~name is ok provided it expands well." >&4
4118                                                 already=true
4119                                                 ;;
4120                                         esac
4121                                 esac
4122                                 ;;
4123                         esac
4124                         ;;
4125                 esac
4126                 case "$redo" in
4127                 '')
4128                         case "$type" in
4129                         File)
4130                                 for fp in $gfpth; do
4131                                         if test "X$fp" = X.; then
4132                                             pf="$ansexp"
4133                                         else    
4134                                             pf="$fp/$ansexp"
4135                                         fi
4136                                         if test -f "$pf"; then
4137                                                 type=''
4138                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4139                                         then
4140                                                 echo "($value is not a plain file, but that's ok.)"
4141                                                 type=''
4142                                         fi
4143                                         if test X"$type" = X; then
4144                                             value="$pf"
4145                                             break
4146                                         fi
4147                                 done
4148                                 ;;
4149                         Directory)
4150                                 for fp in $gfpth; do
4151                                         if test "X$fp" = X.; then
4152                                             dir="$ans"
4153                                             direxp="$ansexp"
4154                                         else    
4155                                             dir="$fp/$ansexp"
4156                                             direxp="$fp/$ansexp"
4157                                         fi
4158                                         if test -d "$direxp"; then
4159                                                 type=''
4160                                                 value="$dir"
4161                                                 break
4162                                         fi
4163                                 done
4164                                 ;;
4165                         Locate)
4166                                 if test -d "$ansexp"; then
4167                                         echo "(Looking for $loc_file in directory $value.)"
4168                                         value="$value/$loc_file"
4169                                         ansexp="$ansexp/$loc_file"
4170                                 fi
4171                                 if test -f "$ansexp"; then
4172                                         type=''
4173                                 fi
4174                                 case "$nopath_ok" in
4175                                 true)   case "$value" in
4176                                         */*) ;;
4177                                         *)      echo "Assuming $value will be in people's path."
4178                                                 type=''
4179                                                 ;;
4180                                         esac
4181                                         ;;
4182                                 esac
4183                                 ;;
4184                         esac
4185
4186                         case "$skip" in
4187                         true) type='';
4188                         esac
4189
4190                         case "$type" in
4191                         '') ;;
4192                         *)
4193                                 if test "$fastread" = yes; then
4194                                         dflt=y
4195                                 else
4196                                         dflt=n
4197                                 fi
4198                                 rp="$what $value doesn't exist.  Use that name anyway?"
4199                                 . UU/myread
4200                                 dflt=''
4201                                 case "$ans" in
4202                                 y*) type='';;
4203                                 *) echo " ";;
4204                                 esac
4205                                 ;;
4206                         esac
4207                         ;;
4208                 esac
4209                 ;;
4210         esac
4211 done
4212 cd UU
4213 ans="$value"
4214 rp="$orig_rp"
4215 dflt="$orig_dflt"
4216 rm -f getfile.ok
4217 test "X$gfpthkeep" != Xy && gfpth=""
4218 EOSC
4219
4220 : What should the include directory be ?
4221 echo " "
4222 $echo $n "Hmm...  $c"
4223 dflt='/usr/include'
4224 incpath=''
4225 mips_type=''
4226 if $test -f /bin/mips && /bin/mips; then
4227         echo "Looks like a MIPS system..."
4228         $cat >usr.c <<'EOCP'
4229 #ifdef SYSTYPE_BSD43
4230 /bsd43
4231 #endif
4232 EOCP
4233         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4234                 dflt='/bsd43/usr/include'
4235                 incpath='/bsd43'
4236                 mips_type='BSD 4.3'
4237         else
4238                 mips_type='System V'
4239         fi
4240         $rm -f usr.c usr.out
4241         echo "and you're compiling with the $mips_type compiler and libraries."
4242         xxx_prompt=y
4243         echo "exit 0" >mips
4244 else
4245         echo "Doesn't look like a MIPS system."
4246         xxx_prompt=n
4247         echo "exit 1" >mips
4248 fi
4249 chmod +x mips
4250 $eunicefix mips
4251 case "$usrinc" in
4252 '') ;;
4253 *) dflt="$usrinc";;
4254 esac
4255 case "$xxx_prompt" in
4256 y)      fn=d/
4257         echo " "
4258         rp='Where are the include files you want to use?'
4259         . ./getfile
4260         usrinc="$ans"
4261         ;;
4262 *)      usrinc="$dflt"
4263         ;;
4264 esac
4265
4266 : see how we invoke the C preprocessor
4267 echo " "
4268 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4269 cat <<'EOT' >testcpp.c
4270 #define ABC abc
4271 #define XYZ xyz
4272 ABC.XYZ
4273 EOT
4274 cd ..
4275 if test ! -f cppstdin; then
4276         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4277                 # AIX cc -E doesn't show the absolute headerfile
4278                 # locations but we'll cheat by using the -M flag.
4279                 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
4280         else
4281                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4282         fi
4283 else
4284         echo "Keeping your $hint cppstdin wrapper."
4285 fi
4286 chmod 755 cppstdin
4287 wrapper=`pwd`/cppstdin
4288 ok='false'
4289 cd UU
4290
4291 if $test "X$cppstdin" != "X" && \
4292         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4293         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4294 then
4295         echo "You used to use $cppstdin $cppminus so we'll use that again."
4296         case "$cpprun" in
4297         '') echo "But let's see if we can live without a wrapper..." ;;
4298         *)
4299                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4300                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4301                 then
4302                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4303                         ok='true'
4304                 else
4305                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4306                 fi
4307                 ;;
4308         esac
4309 else
4310         case "$cppstdin" in
4311         '') ;;
4312         *)
4313                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4314                 ;;
4315         esac
4316 fi
4317
4318 if $ok; then
4319         : nothing
4320 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4321         $cc -E <testcpp.c >testcpp.out 2>&1; \
4322         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4323         echo "Yup, it does."
4324         x_cpp="$cc -E"
4325         x_minus='';
4326 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4327         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4328         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4329         echo "Yup, it does."
4330         x_cpp="$cc -E"
4331         x_minus='-';
4332 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4333         $cc -P <testcpp.c >testcpp.out 2>&1; \
4334         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4335         echo "Yipee, that works!"
4336         x_cpp="$cc -P"
4337         x_minus='';
4338 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4339         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4340         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4341         echo "At long last!"
4342         x_cpp="$cc -P"
4343         x_minus='-';
4344 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4345         $cpp <testcpp.c >testcpp.out 2>&1; \
4346         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4347         echo "It works!"
4348         x_cpp="$cpp"
4349         x_minus='';
4350 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4351         $cpp - <testcpp.c >testcpp.out 2>&1; \
4352         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4353         echo "Hooray, it works!  I was beginning to wonder."
4354         x_cpp="$cpp"
4355         x_minus='-';
4356 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4357         $wrapper <testcpp.c >testcpp.out 2>&1; \
4358         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4359         x_cpp="$wrapper"
4360         x_minus=''
4361         echo "Eureka!"
4362 else
4363         dflt=''
4364         rp="No dice.  I can't find a C preprocessor.  Name one:"
4365         . ./myread
4366         x_cpp="$ans"
4367         x_minus=''
4368         $x_cpp <testcpp.c >testcpp.out 2>&1
4369         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4370                 echo "OK, that will do." >&4
4371         else
4372 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4373                 exit 1
4374         fi
4375 fi
4376
4377 case "$ok" in
4378 false)
4379         cppstdin="$x_cpp"
4380         cppminus="$x_minus"
4381         cpprun="$x_cpp"
4382         cpplast="$x_minus"
4383         set X $x_cpp
4384         shift
4385         case "$1" in
4386         "$cpp")
4387                 echo "Perhaps can we force $cc -E using a wrapper..."
4388                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4389                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4390                 then
4391                         echo "Yup, we can."
4392                         cppstdin="$wrapper"
4393                         cppminus='';
4394                 else
4395                         echo "Nope, we'll have to live without it..."
4396                 fi
4397                 ;;
4398         esac
4399         case "$cpprun" in
4400         "$wrapper")
4401                 cpprun=''
4402                 cpplast=''
4403                 ;;
4404         esac
4405         ;;
4406 esac
4407
4408 case "$cppstdin" in
4409 "$wrapper"|'cppstdin') ;;
4410 *) $rm -f $wrapper;;
4411 esac
4412 $rm -f testcpp.c testcpp.out
4413
4414 : Set private lib path
4415 case "$plibpth" in
4416 '') if ./mips; then
4417                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4418         fi;;
4419 esac
4420 case "$libpth" in
4421 ' ') dlist='';;
4422 '') dlist="$loclibpth $plibpth $glibpth";;
4423 *) dlist="$libpth";;
4424 esac
4425
4426 : Now check and see which directories actually exist, avoiding duplicates
4427 libpth=''
4428 for xxx in $dlist
4429 do
4430     if $test -d $xxx; then
4431                 case " $libpth " in
4432                 *" $xxx "*) ;;
4433                 *) libpth="$libpth $xxx";;
4434                 esac
4435     fi
4436 done
4437 $cat <<'EOM'
4438
4439 Some systems have incompatible or broken versions of libraries.  Among
4440 the directories listed in the question below, please remove any you
4441 know not to be holding relevant libraries, and add any that are needed.
4442 Say "none" for none.
4443
4444 EOM
4445 case "$libpth" in
4446 '') dflt='none';;
4447 *)
4448         set X $libpth
4449         shift
4450         dflt=${1+"$@"}
4451         ;;
4452 esac
4453 rp="Directories to use for library searches?"
4454 . ./myread
4455 case "$ans" in
4456 none) libpth=' ';;
4457 *) libpth="$ans";;
4458 esac
4459
4460 : compute shared library extension
4461 case "$so" in
4462 '')
4463         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4464                 dflt='sl'
4465         else
4466                 dflt='so'
4467         fi
4468         ;;
4469 *) dflt="$so";;
4470 esac
4471 $cat <<EOM
4472
4473 On some systems, shared libraries may be available.  Answer 'none' if
4474 you want to suppress searching of shared libraries for the remainder
4475 of this configuration.
4476
4477 EOM
4478 rp='What is the file extension used for shared libraries?'
4479 . ./myread
4480 so="$ans"
4481
4482 : Define several unixisms.
4483 : Hints files or command line option can be used to override them.
4484 : The convoluted testing is in case hints files set either the old
4485 : or the new name.
4486 case "$_exe" in
4487 '')     case "$exe_ext" in
4488         '')     ;;
4489         *)      _exe="$exe_ext" ;;
4490         esac
4491         ;;
4492 esac
4493 case "$_a" in
4494 '')     case "$lib_ext" in
4495     '') _a='.a';;
4496         *)      _a="$lib_ext" ;;
4497         esac
4498         ;;
4499 esac
4500 case "$_o" in
4501 '') case "$obj_ext" in
4502         '')     _o='.o';;
4503         *)      _o="$obj_ext";;
4504         esac
4505         ;;
4506 esac
4507 case "$p_" in
4508 '') case "$path_sep" in
4509         '')     p_=':';;
4510         *)      p_="$path_sep";;
4511         esac
4512         ;;
4513 esac
4514 exe_ext=$_exe
4515 lib_ext=$_a
4516 obj_ext=$_o
4517 path_sep=$p_
4518
4519 : Which makefile gets called first.  This is used by make depend.
4520 case "$firstmakefile" in
4521 '') firstmakefile='makefile';;
4522 esac
4523
4524 case "$ccflags" in
4525 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4526 esac
4527
4528 case "$uselongdouble" in
4529 $define|true|[yY]*)     dflt='y';;
4530 *) dflt='n';;
4531 esac
4532 cat <<EOM
4533
4534 Perl can be built to take advantage of long doubles which
4535 (if available) may give more accuracy and range for floating point numbers.
4536
4537 If this doesn't make any sense to you, just accept the default '$dflt'.
4538 EOM
4539 rp='Try to use long doubles if available?'
4540 . ./myread
4541 case "$ans" in
4542 y|Y)    val="$define"   ;;
4543 *)      val="$undef"    ;;
4544 esac
4545 set uselongdouble
4546 eval $setvar
4547
4548 case "$uselongdouble" in
4549 true|[yY]*) uselongdouble="$define" ;;
4550 esac
4551
4552 case "$uselongdouble" in
4553 $define)
4554 : Look for a hint-file generated 'call-back-unit'.  If the
4555 : user has specified that long doubles should be used,
4556 : we may need to set or change some other defaults.
4557         if $test -f uselongdouble.cbu; then
4558                 echo "Your platform has some specific hints for long doubles, using them..."
4559                 . ./uselongdouble.cbu
4560         else
4561                 $cat <<EOM
4562 (Your platform doesn't have any specific hints for long doubles.)
4563 EOM
4564         fi
4565         ;;
4566 esac
4567
4568 : Looking for optional libraries
4569 echo " "
4570 echo "Checking for optional libraries..." >&4
4571 case "$libs" in
4572 ' '|'') dflt='';;
4573 *) dflt="$libs";;
4574 esac
4575 case "$libswanted" in
4576 '') libswanted='c_s';;
4577 esac
4578 case "$usesocks" in
4579 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4580 esac
4581 libsfound=''
4582 libsfiles=''
4583 libsdirs=''
4584 libspath=''
4585 for thisdir in $libpth $xlibpth; do
4586   test -d $thisdir && libspath="$libspath $thisdir"
4587 done
4588 for thislib in $libswanted; do
4589         for thisdir in $libspath; do
4590             xxx=''
4591             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4592                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4593                 $test -f "$xxx" && eval $libscheck
4594                 $test -f "$xxx" && libstyle=shared
4595             fi
4596             if test ! -f "$xxx"; then
4597                 xxx=$thisdir/lib$thislib.$so
4598                 $test -f "$xxx" && eval $libscheck
4599                 $test -f "$xxx" && libstyle=shared
4600             fi  
4601             if test ! -f "$xxx"; then
4602                 xxx=$thisdir/lib$thislib$_a
4603                 $test -f "$xxx" && eval $libscheck
4604                 $test -f "$xxx" && libstyle=static
4605             fi
4606             if test ! -f "$xxx"; then
4607                 xxx=$thisdir/$thislib$_a
4608                 $test -f "$xxx" && eval $libscheck
4609                 $test -f "$xxx" && libstyle=static
4610             fi
4611             if test ! -f "$xxx"; then
4612                 xxx=$thisdir/lib${thislib}_s$_a
4613                 $test -f "$xxx" && eval $libscheck
4614                 $test -f "$xxx" && libstyle=static
4615                 $test -f "$xxx" && thislib=${thislib}_s
4616             fi
4617             if test ! -f "$xxx"; then
4618                 xxx=$thisdir/Slib$thislib$_a
4619                 $test -f "$xxx" && eval $libscheck
4620                 $test -f "$xxx" && libstyle=static
4621             fi
4622             if $test -f "$xxx"; then
4623                 case "$libstyle" in
4624                 shared) echo "Found -l$thislib (shared)." ;;
4625                 static) echo "Found -l$thislib." ;;
4626                 *)      echo "Found -l$thislib ($libstyle)." ;;
4627                 esac
4628                 case " $dflt " in
4629                 *"-l$thislib "*);;
4630                 *) dflt="$dflt -l$thislib"
4631                    libsfound="$libsfound $xxx"
4632                    yyy=`basename $xxx`
4633                    libsfiles="$libsfiles $yyy"
4634                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4635                    case " $libsdirs " in
4636                    *" $yyy "*) ;;
4637                    *) libsdirs="$libsdirs $yyy" ;;
4638                    esac
4639                    ;;
4640                 esac
4641                 break
4642             fi  
4643         done
4644         if $test ! -f "$xxx"; then
4645             echo "No -l$thislib."
4646         fi
4647 done
4648 set X $dflt
4649 shift
4650 dflt="$*"
4651 case "$libs" in
4652 '') dflt="$dflt";;
4653 *) dflt="$libs";;
4654 esac
4655 case "$dflt" in
4656 ' '|'') dflt='none';;
4657 esac
4658
4659 $cat <<EOM
4660
4661 In order to compile $package on your machine, a number of libraries
4662 are usually needed.  Include any other special libraries here as well.
4663 Say "none" for none.  The default list is almost always right.
4664 EOM
4665
4666 echo " "
4667 rp="What libraries to use?"
4668 . ./myread
4669 case "$ans" in
4670 none) libs=' ';;
4671 *) libs="$ans";;
4672 esac
4673
4674 : determine optimization, if desired, or use for debug flag also
4675 case "$optimize" in
4676 ' '|$undef) dflt='none';;
4677 '') dflt='-O';;
4678 *) dflt="$optimize";;
4679 esac
4680 $cat <<EOH
4681
4682 By default, $package compiles with the -O flag to use the optimizer.
4683 Alternately, you might want to use the symbolic debugger, which uses
4684 the -g flag (on traditional Unix systems).  Either flag can be
4685 specified here.  To use neither flag, specify the word "none".
4686
4687 EOH
4688 rp="What optimizer/debugger flag should be used?"
4689 . ./myread
4690 optimize="$ans"
4691 case "$optimize" in
4692 'none') optimize=" ";;
4693 esac
4694
4695 dflt=''
4696 : We will not override a previous value, but we might want to
4697 : augment a hint file
4698 case "$hint" in
4699 default|recommended)
4700         case "$gccversion" in
4701         1*) dflt='-fpcc-struct-return' ;;
4702         esac
4703         case "$optimize" in
4704         *-g*) dflt="$dflt -DDEBUGGING";;
4705         esac
4706         case "$gccversion" in
4707         2*) if test -d /etc/conf/kconfig.d &&
4708                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4709                 then
4710                         dflt="$dflt -posix"
4711                 fi
4712                 ;;
4713         esac
4714         case "$gccversion" in
4715         1*) ;;
4716         2.[0-8]*) ;;
4717         ?*)     echo " "
4718                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4719                 echo 'int main(void) { return 0; }' > gcctest.c
4720                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4721                         echo "Yes, it does." 2>&1
4722                         case "$ccflags" in
4723                         *strict-aliasing*) 
4724                                 echo "Leaving current flags $ccflags alone." 2>&1
4725                                 ;;
4726                         *) dflt="$dflt -fno-strict-aliasing" ;;
4727                         esac
4728                 else
4729                         echo "Nope, it doesn't, but that's ok." 2>&1
4730                 fi
4731                 ;;
4732         esac
4733         ;;
4734 esac
4735
4736 case "$mips_type" in
4737 *BSD*|'') inclwanted="$locincpth $usrinc";;
4738 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4739 esac
4740 for thisincl in $inclwanted; do
4741         if $test -d $thisincl; then
4742                 if $test x$thisincl != x$usrinc; then
4743                         case "$dflt" in
4744                         *" -I$thisincl "*);;
4745                         *) dflt="$dflt -I$thisincl ";;
4746                         esac
4747                 fi
4748         fi
4749 done
4750
4751 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4752         xxx=true;
4753 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4754         xxx=true;
4755 else
4756         xxx=false;
4757 fi;
4758 if $xxx; then
4759         case "$dflt" in
4760         *$2*);;
4761         *) dflt="$dflt -D$2";;
4762         esac;
4763 fi'
4764
4765 set signal.h LANGUAGE_C; eval $inctest
4766
4767 case "$usesocks" in
4768 $define)
4769         ccflags="$ccflags -DSOCKS"
4770         ;;
4771 esac
4772
4773 case "$hint" in
4774 default|recommended) dflt="$ccflags $dflt" ;;
4775 *) dflt="$ccflags";;
4776 esac
4777
4778 case "$dflt" in
4779 ''|' ') dflt=none;;
4780 esac
4781
4782 $cat <<EOH
4783
4784 Your C compiler may want other flags.  For this question you should include
4785 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4786 but you should NOT include libraries or ld flags like -lwhatever.  If you
4787 want $package to honor its debug switch, you should include -DDEBUGGING here.
4788 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4789
4790 To use no flags, specify the word "none".
4791
4792 EOH
4793 set X $dflt
4794 shift
4795 dflt=${1+"$@"}
4796 rp="Any additional cc flags?"
4797 . ./myread
4798 case "$ans" in
4799 none) ccflags='';;
4800 *) ccflags="$ans";;
4801 esac
4802
4803 : the following weeds options from ccflags that are of no interest to cpp
4804 case "$cppflags" in
4805 '') cppflags="$ccflags" ;;
4806 *)  cppflags="$cppflags $ccflags" ;;
4807 esac
4808 case "$gccversion" in
4809 1*) cppflags="$cppflags -D__GNUC__"
4810 esac
4811 case "$mips_type" in
4812 '');;
4813 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4814 esac
4815 case "$cppflags" in
4816 '');;
4817 *)
4818         echo " "
4819         echo "Let me guess what the preprocessor flags are..." >&4
4820         set X $cppflags
4821         shift
4822         cppflags=''
4823         $cat >cpp.c <<'EOM'
4824 #define BLURFL foo
4825
4826 BLURFL xx LFRULB
4827 EOM
4828         previous=''
4829         for flag in $*
4830         do
4831                 case "$flag" in
4832                 -*) ftry="$flag";;
4833                 *) ftry="$previous $flag";;
4834                 esac
4835                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4836                         >cpp1.out 2>/dev/null && \
4837                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4838                         >cpp2.out 2>/dev/null && \
4839                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4840                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4841                 then
4842                         cppflags="$cppflags $ftry"
4843                         previous=''
4844                 else
4845                         previous="$flag"
4846                 fi
4847         done
4848         set X $cppflags
4849         shift
4850         cppflags=${1+"$@"}
4851         case "$cppflags" in
4852         *-*)  echo "They appear to be: $cppflags";;
4853         esac
4854         $rm -f cpp.c cpp?.out
4855         ;;
4856 esac
4857
4858 : flags used in final linking phase
4859 case "$ldflags" in
4860 '') if ./venix; then
4861                 dflt='-i -z'
4862         else
4863                 dflt=''
4864         fi
4865         case "$ccflags" in
4866         *-posix*) dflt="$dflt -posix" ;;
4867         esac
4868         ;;
4869 *) dflt="$ldflags";;
4870 esac
4871
4872 : Try to guess additional flags to pick up local libraries.
4873 for thislibdir in $libpth; do
4874         case " $loclibpth " in
4875         *" $thislibdir "*)
4876                 case "$dflt " in 
4877                 *"-L$thislibdir "*) ;;
4878                 *)  dflt="$dflt -L$thislibdir" ;;
4879                 esac
4880                 ;;
4881         esac
4882 done
4883
4884 case "$dflt" in
4885 '') dflt='none' ;;
4886 esac
4887
4888 $cat <<EOH
4889
4890 Your C linker may need flags.  For this question you should
4891 include -L/whatever and any other flags used by the C linker, but you
4892 should NOT include libraries like -lwhatever.
4893
4894 Make sure you include the appropriate -L/path flags if your C linker
4895 does not normally search all of the directories you specified above,
4896 namely
4897         $libpth
4898 To use no flags, specify the word "none".
4899
4900 EOH
4901
4902 rp="Any additional ld flags (NOT including libraries)?"
4903 . ./myread
4904 case "$ans" in
4905 none) ldflags='';;
4906 *) ldflags="$ans";;
4907 esac
4908 rmlist="$rmlist pdp11"
4909
4910 : coherency check
4911 echo " "
4912 echo "Checking your choice of C compiler and flags for coherency..." >&4
4913 $cat > try.c <<'EOF'
4914 #include <stdio.h>
4915 int main() { printf("Ok\n"); return(0); }
4916 EOF
4917 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4918 shift
4919 $cat >try.msg <<'EOM'
4920 I've tried to compile and run the following simple program:
4921
4922 EOM
4923 $cat try.c >> try.msg
4924
4925 $cat >> try.msg <<EOM
4926
4927 I used the command:
4928
4929         $*
4930         $run ./try
4931
4932 and I got the following output:
4933
4934 EOM
4935 dflt=y
4936 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4937         if $sh -c "$run ./try" >>try.msg 2>&1; then
4938                 xxx=`$run ./try`
4939                 case "$xxx" in
4940                 "Ok") dflt=n ;;
4941                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4942                         case " $libs " in
4943                         *" -lsfio "*)
4944                                 cat >> try.msg <<'EOQS'
4945 If $libs contains -lsfio, and sfio is mis-configured, then it
4946 sometimes (apparently) runs and exits with a 0 status, but with no
4947 output!  It may have to do with sfio's use of _exit vs. exit.
4948
4949 EOQS
4950                                 rp="You have a big problem.  Shall I abort Configure"
4951                                 dflt=y
4952                                 ;;
4953                         esac
4954                         ;;
4955                 esac
4956         else
4957                 echo "The program compiled OK, but exited with status $?." >>try.msg
4958                 rp="You have a problem.  Shall I abort Configure"
4959                 dflt=y
4960         fi
4961 else
4962         echo "I can't compile the test program." >>try.msg
4963         rp="You have a BIG problem.  Shall I abort Configure"
4964         dflt=y
4965 fi
4966 case "$dflt" in
4967 y)
4968         $cat try.msg >&4
4969         case "$knowitall" in
4970         '')
4971                 echo "(The supplied flags or libraries might be incorrect.)"
4972                 ;;
4973         *) dflt=n;;
4974         esac
4975         echo " "
4976         . ./myread
4977         case "$ans" in
4978         n*|N*) ;;
4979         *)      echo "Ok.  Stopping Configure." >&4
4980                 exit 1
4981                 ;;
4982         esac
4983         ;;
4984 n) echo "OK, that should do.";;
4985 esac
4986 $rm -f try try.* core
4987
4988 : define a shorthand compile call
4989 compile='
4990 mc_file=$1;
4991 shift;
4992 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4993 : define a shorthand compile call for compilations that should be ok.
4994 compile_ok='
4995 mc_file=$1;
4996 shift;
4997 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4998
4999 : determine filename position in cpp output
5000 echo " "
5001 echo "Computing filename position in cpp output for #include directives..." >&4
5002 case "$osname" in
5003 vos) testaccess=-e ;;
5004 *)   testaccess=-r ;;
5005 esac
5006 echo '#include <stdio.h>' > foo.c
5007 $cat >fieldn <<EOF
5008 $startsh
5009 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5010 $grep '^[       ]*#.*stdio\.h' | \
5011 while read cline; do
5012         pos=1
5013         set \$cline
5014         while $test \$# -gt 0; do
5015                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5016                         echo "\$pos"
5017                         exit 0
5018                 fi
5019                 shift
5020                 pos=\`expr \$pos + 1\`
5021         done
5022 done
5023 EOF
5024 chmod +x fieldn
5025 fieldn=`./fieldn`
5026 $rm -f foo.c fieldn
5027 case $fieldn in
5028 '') pos='???';;
5029 1) pos=first;;
5030 2) pos=second;;
5031 3) pos=third;;
5032 *) pos="${fieldn}th";;
5033 esac
5034 echo "Your cpp writes the filename in the $pos field of the line."
5035
5036 case "$osname" in
5037 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5038 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5039 *)   cppfilter='' ;;
5040 esac
5041 : locate header file
5042 $cat >findhdr <<EOF
5043 $startsh
5044 wanted=\$1
5045 name=''
5046 for usrincdir in $usrinc
5047 do
5048         if test -f \$usrincdir/\$wanted; then
5049                 echo "\$usrincdir/\$wanted"
5050                 exit 0
5051         fi
5052 done
5053 awkprg='{ print \$$fieldn }'
5054 echo "#include <\$wanted>" > foo\$\$.c
5055 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5056 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5057 while read cline; do
5058         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5059         case "\$name" in
5060         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5061         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5062         *) exit 2;;
5063         esac;
5064 done;
5065 #
5066 # status = 0: grep returned 0 lines, case statement not executed
5067 # status = 1: headerfile found
5068 # status = 2: while loop executed, no headerfile found
5069 #
5070 status=\$?
5071 $rm -f foo\$\$.c;
5072 if test \$status -eq 1; then
5073         exit 0;
5074 fi
5075 exit 1
5076 EOF
5077 chmod +x findhdr
5078
5079 : define an alternate in-header-list? function
5080 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5081 cont=true; xxf="echo \"<\$1> found.\" >&4";
5082 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5083 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5084 esac;
5085 case $# in 4) instead=instead;; *) instead="at last";; esac;
5086 while $test "$cont"; do
5087         xxx=`./findhdr $1`
5088         var=$2; eval "was=\$$2";
5089         if $test "$xxx" && $test -r "$xxx";
5090         then eval $xxf;
5091         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5092                 cont="";
5093         else eval $xxnf;
5094         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5095         set $yyy; shift; shift; yyy=$@;
5096         case $# in 0) cont="";;
5097         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5098                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5099         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5100                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5101         esac;
5102 done;
5103 while $test "$yyy";
5104 do set $yyy; var=$2; eval "was=\$$2";
5105         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5106         set $yyy; shift; shift; yyy=$@;
5107 done'
5108
5109 : see if stdlib is available
5110 set stdlib.h i_stdlib
5111 eval $inhdr
5112
5113 : check for lengths of integral types
5114 echo " "
5115 case "$intsize" in
5116 '')
5117         echo "Checking to see how big your integers are..." >&4
5118         $cat >try.c <<EOCP
5119 #include <stdio.h>
5120 #$i_stdlib I_STDLIB
5121 #ifdef I_STDLIB
5122 #include <stdlib.h>
5123 #endif
5124 int main()
5125 {
5126         printf("intsize=%d;\n", (int)sizeof(int));
5127         printf("longsize=%d;\n", (int)sizeof(long));
5128         printf("shortsize=%d;\n", (int)sizeof(short));
5129         exit(0);
5130 }
5131 EOCP
5132         set try
5133         if eval $compile_ok && $run ./try > /dev/null; then
5134                 eval `$run ./try`
5135                 echo "Your integers are $intsize bytes long."
5136                 echo "Your long integers are $longsize bytes long."
5137                 echo "Your short integers are $shortsize bytes long."
5138         else
5139                 $cat >&4 <<EOM
5140 !
5141 Help! I can't compile and run the intsize test program: please enlighten me!
5142 (This is probably a misconfiguration in your system or libraries, and
5143 you really ought to fix it.  Still, I'll try anyway.)
5144 !
5145 EOM
5146                 dflt=4
5147                 rp="What is the size of an integer (in bytes)?"
5148                 . ./myread
5149                 intsize="$ans"
5150                 dflt=$intsize
5151                 rp="What is the size of a long integer (in bytes)?"
5152                 . ./myread
5153                 longsize="$ans"
5154                 dflt=2
5155                 rp="What is the size of a short integer (in bytes)?"
5156                 . ./myread
5157                 shortsize="$ans"
5158         fi
5159         ;;
5160 esac
5161 $rm -f try try.*
5162
5163 : check for long long
5164 echo " "
5165 echo "Checking to see if you have long long..." >&4
5166 echo 'int main() { long long x = 7; return 0; }' > try.c
5167 set try
5168 if eval $compile; then
5169         val="$define"
5170         echo "You have long long."
5171 else
5172         val="$undef"
5173         echo "You do not have long long."
5174 fi
5175 $rm try.*
5176 set d_longlong
5177 eval $setvar
5178
5179 : check for length of long long
5180 case "${d_longlong}${longlongsize}" in
5181 $define)
5182         echo " "
5183         echo "Checking to see how big your long longs are..." >&4
5184         $cat >try.c <<'EOCP'
5185 #include <stdio.h>
5186 int main()
5187 {
5188     printf("%d\n", (int)sizeof(long long));
5189     return(0);
5190 }
5191 EOCP
5192         set try
5193         if eval $compile_ok; then
5194                 longlongsize=`$run ./try`
5195                 echo "Your long longs are $longlongsize bytes long."
5196         else
5197                 dflt='8'
5198                 echo " "
5199                 echo "(I can't seem to compile the test program.  Guessing...)"
5200                 rp="What is the size of a long long (in bytes)?"
5201                 . ./myread
5202                 longlongsize="$ans"
5203         fi
5204         if $test "X$longsize" = "X$longlongsize"; then
5205                 echo "(That isn't any different from an ordinary long.)"
5206         fi      
5207         ;;
5208 esac
5209 $rm -f try.* try
5210
5211 : see if inttypes.h is available
5212 : we want a real compile instead of Inhdr because some systems
5213 : have an inttypes.h which includes non-existent headers
5214 echo " "
5215 $cat >try.c <<EOCP
5216 #include <inttypes.h>
5217 int main() {
5218         static int32_t foo32 = 0x12345678;
5219 }
5220 EOCP
5221 set try
5222 if eval $compile; then
5223         echo "<inttypes.h> found." >&4
5224         val="$define"
5225 else
5226         echo "<inttypes.h> NOT found." >&4
5227         val="$undef"
5228 fi
5229 $rm -f try.c try
5230 set i_inttypes
5231 eval $setvar
5232
5233 : check for int64_t
5234 echo " "
5235 echo "Checking to see if you have int64_t..." >&4
5236 $cat >try.c <<EOCP
5237 #include <sys/types.h>
5238 #$i_inttypes I_INTTYPES
5239 #ifdef I_INTTYPES
5240 #include <inttypes.h>
5241 #endif
5242 int main() { int64_t x = 7; }
5243 EOCP
5244 set try
5245 if eval $compile; then
5246         val="$define"
5247         echo "You have int64_t."
5248 else
5249         val="$undef"
5250         echo "You do not have int64_t."
5251 fi
5252 $rm -f try try.*
5253 set d_int64_t
5254 eval $setvar
5255
5256
5257 echo " "
5258 echo "Checking which 64-bit integer type we could use..." >&4
5259
5260 case "$intsize" in
5261 8) val=int
5262    set quadtype
5263    eval $setvar
5264    val='"unsigned int"'
5265    set uquadtype
5266    eval $setvar
5267    quadkind=1
5268    ;;
5269 *) case "$longsize" in
5270    8) val=long
5271       set quadtype
5272       eval $setvar
5273       val='"unsigned long"'
5274       set uquadtype
5275       eval $setvar
5276       quadkind=2
5277       ;;
5278    *) case "$d_longlong:$longlongsize" in
5279       define:8)
5280         val='"long long"'
5281         set quadtype
5282         eval $setvar
5283         val='"unsigned long long"'
5284         set uquadtype
5285         eval $setvar
5286         quadkind=3
5287         ;;
5288       *) case "$d_int64_t" in
5289          define)
5290            val=int64_t
5291            set quadtype
5292            eval $setvar
5293            val=uint64_t
5294            set uquadtype
5295            eval $setvar
5296            quadkind=4
5297            ;;
5298          esac
5299          ;;
5300       esac
5301       ;;
5302    esac
5303    ;;
5304 esac
5305
5306 case "$quadtype" in
5307 '')     echo "Alas, no 64-bit integer types in sight." >&4
5308         d_quad="$undef"
5309         ;;
5310 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5311         d_quad="$define"
5312         ;;
5313 esac
5314
5315
5316 case "$uselonglong" in
5317 "$define"|true|[yY]*)
5318         cat <<EOM >&4
5319
5320 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5321 EOM
5322         use64bitint="$define"
5323         ;;
5324 esac                          
5325 case "$use64bits" in
5326 "$define"|true|[yY]*)
5327         cat <<EOM >&4
5328
5329 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5330 EOM
5331         use64bitint="$define"
5332         ;;
5333 esac                          
5334 case "$use64bitints" in
5335 "$define"|true|[yY]*)
5336         cat <<EOM >&4
5337
5338 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5339 EOM
5340         use64bitint="$define"
5341         ;;
5342 esac                          
5343 case "$use64bitsint" in
5344 "$define"|true|[yY]*)
5345         cat <<EOM >&4
5346
5347 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5348 EOM
5349         use64bitint="$define"
5350         ;;
5351 esac                          
5352 case "$uselonglongs" in
5353 "$define"|true|[yY]*)
5354         cat <<EOM >&4
5355
5356 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5357 EOM
5358         use64bitint="$define"
5359         ;;
5360 esac                          
5361 case "$use64bitsall" in
5362 "$define"|true|[yY]*)
5363         cat <<EOM >&4
5364
5365 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5366 EOM
5367         use64bitall="$define"
5368         ;;
5369 esac                          
5370
5371 case "$ccflags" in
5372 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5373 esac
5374 case "$use64bitall" in
5375 "$define"|true|[yY]*) use64bitint="$define" ;;
5376 esac
5377
5378 case "$longsize" in
5379 8) cat <<EOM
5380
5381 You have natively 64-bit long integers.
5382 EOM
5383    val="$define"
5384    ;;
5385 *) case "$use64bitint" in
5386    "$define"|true|[yY]*) dflt='y';;
5387    *) dflt='n';;
5388    esac
5389    case "$d_quad" in
5390    "$define") ;;
5391    *) dflt='n' ;;
5392    esac
5393    cat <<EOM
5394
5395 Perl can be built to take advantage of 64-bit integer types
5396 on some systems.  To do so, Configure can be run with -Duse64bitint.
5397 Choosing this option will most probably introduce binary incompatibilities.
5398
5399 If this doesn't make any sense to you, just accept the default '$dflt'.
5400 (The default has been chosen based on your configuration.)
5401 EOM
5402    rp='Try to use 64-bit integers, if available?'
5403    . ./myread
5404    case "$ans" in
5405    [yY]*) val="$define" ;;
5406    *)     val="$undef"  ;;
5407    esac
5408    ;;
5409 esac
5410 set use64bitint
5411 eval $setvar
5412
5413 case "$use64bitall" in
5414 "$define"|true|[yY]*) dflt='y' ;;
5415 *) case "$longsize" in
5416    8) dflt='y' ;;
5417    *) dflt='n' ;;
5418    esac
5419    ;;
5420 esac    
5421 cat <<EOM
5422
5423 You may also choose to try maximal 64-bitness.  It means using as much
5424 64-bitness as possible on the platform.  This in turn means even more
5425 binary incompatibilities.  On the other hand, your platform may not
5426 have any more 64-bitness available than what you already have chosen.
5427
5428 If this doesn't make any sense to you, just accept the default '$dflt'.
5429 (The default has been chosen based on your configuration.)
5430 EOM
5431 rp='Try to use maximal 64-bit support, if available?'
5432 . ./myread
5433 case "$ans" in
5434 [yY]*) val="$define" ;;
5435 *)     val="$undef"  ;;
5436 esac
5437 set use64bitall
5438 eval $setvar
5439 case "$use64bitall" in
5440 "$define")
5441         case "$use64bitint" in
5442         "$undef")
5443                 cat <<EOM
5444
5445 Since you have chosen a maximally 64-bit build, I'm also turning on
5446 the use of 64-bit integers.
5447 EOM
5448                 use64bitint="$define" ;;
5449         esac
5450         ;;
5451 esac
5452
5453 case "$use64bitint" in
5454 "$define"|true|[yY]*)
5455 : Look for a hint-file generated 'call-back-unit'.  If the
5456 : user has specified that a 64-bit perl is to be built,
5457 : we may need to set or change some other defaults.
5458         if $test -f use64bitint.cbu; then
5459                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5460                 . ./use64bitint.cbu
5461         fi
5462         case "$longsize" in
5463         4) case "$archname64" in
5464            '') archname64=64int ;;
5465            esac
5466            ;;
5467         esac
5468         ;;
5469 esac
5470
5471 case "$use64bitall" in
5472 "$define"|true|[yY]*)
5473 : Look for a hint-file generated 'call-back-unit'.  If the
5474 : user has specified that a maximally 64-bit perl is to be built,
5475 : we may need to set or change some other defaults.
5476         if $test -f use64bitall.cbu; then
5477                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5478                 . ./use64bitall.cbu
5479         fi
5480         case "$longsize" in
5481         4) case "$archname64" in
5482            ''|64int) archname64=64all ;;
5483            esac
5484            ;;
5485         esac
5486         ;;
5487 esac
5488
5489 case "$d_quad:$use64bitint" in
5490 $undef:$define)
5491         cat >&4 <<EOF
5492
5493 *** You have chosen to use 64-bit integers,
5494 *** but none cannot be found.
5495 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5496 *** Cannot continue, aborting.
5497
5498 EOF
5499         exit 1
5500         ;;
5501 esac
5502
5503 : check for length of double
5504 echo " "
5505 case "$doublesize" in
5506 '')
5507         echo "Checking to see how big your double precision numbers are..." >&4
5508         $cat >try.c <<EOCP
5509 #include <stdio.h>
5510 #$i_stdlib I_STDLIB
5511 #ifdef I_STDLIB
5512 #include <stdlib.h>
5513 #endif
5514 int main()
5515 {
5516     printf("%d\n", (int)sizeof(double));
5517     exit(0);
5518 }
5519 EOCP
5520         set try
5521         if eval $compile_ok; then
5522                 doublesize=`$run ./try`
5523                 echo "Your double is $doublesize bytes long."
5524         else
5525                 dflt='8'
5526                 echo "(I can't seem to compile the test program.  Guessing...)"
5527                 rp="What is the size of a double precision number (in bytes)?"
5528                 . ./myread
5529                 doublesize="$ans"
5530         fi
5531         ;;
5532 esac
5533 $rm -f try.c try
5534
5535 : check for long doubles
5536 echo " "
5537 echo "Checking to see if you have long double..." >&4
5538 echo 'int main() { long double x = 7.0; }' > try.c
5539 set try
5540 if eval $compile; then
5541         val="$define"
5542         echo "You have long double."
5543 else
5544         val="$undef"
5545         echo "You do not have long double."
5546 fi
5547 $rm try.*
5548 set d_longdbl
5549 eval $setvar
5550
5551 : check for length of long double
5552 case "${d_longdbl}${longdblsize}" in
5553 $define)
5554         echo " "
5555         echo "Checking to see how big your long doubles are..." >&4
5556         $cat >try.c <<'EOCP'
5557 #include <stdio.h>
5558 int main()
5559 {
5560         printf("%d\n", sizeof(long double));
5561 }
5562 EOCP
5563         set try
5564         set try
5565         if eval $compile; then
5566                 longdblsize=`$run ./try`
5567                 echo "Your long doubles are $longdblsize bytes long."
5568         else
5569                 dflt='8'
5570                 echo " "
5571                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5572                 rp="What is the size of a long double (in bytes)?"
5573                 . ./myread
5574                 longdblsize="$ans"
5575         fi
5576         if $test "X$doublesize" = "X$longdblsize"; then
5577                 echo "(That isn't any different from an ordinary double.)"
5578         fi      
5579         ;;
5580 esac
5581 $rm -f try.* try
5582
5583 : determine the architecture name
5584 echo " "
5585 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5586         tarch=`arch`"-$osname"
5587 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5588         if uname -m > tmparch 2>&1 ; then
5589                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5590                         -e 's/$/'"-$osname/" tmparch`
5591         else
5592                 tarch="$osname"
5593         fi
5594         $rm -f tmparch
5595 else
5596         tarch="$osname"
5597 fi
5598 case "$myarchname" in
5599 ''|"$tarch") ;;
5600 *)
5601         echo "(Your architecture name used to be $myarchname.)"
5602         archname=''
5603         ;;
5604 esac
5605 case "$targetarch" in
5606 '') ;;
5607 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5608 esac
5609 myarchname="$tarch"
5610 case "$archname" in
5611 '') dflt="$tarch";;
5612 *) dflt="$archname";;
5613 esac
5614 rp='What is your architecture name'
5615 . ./myread
5616 archname="$ans"
5617 case "$usethreads" in
5618 $define)
5619         echo "Threads selected." >&4
5620         case "$archname" in
5621         *-thread*) echo "...and architecture name already has -thread." >&4
5622                 ;;
5623         *)      archname="$archname-thread"
5624                 echo "...setting architecture name to $archname." >&4
5625                 ;;
5626         esac
5627         ;;
5628 esac
5629 case "$usemultiplicity" in
5630 $define)
5631         echo "Multiplicity selected." >&4
5632         case "$archname" in
5633         *-multi*) echo "...and architecture name already has -multi." >&4
5634                 ;;
5635         *)      archname="$archname-multi"
5636                 echo "...setting architecture name to $archname." >&4
5637                 ;;
5638         esac
5639         ;;
5640 esac
5641 case "$use64bitint$use64bitall" in
5642 *"$define"*)
5643         case "$archname64" in
5644         '')
5645                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5646                 ;;
5647         *)
5648                 case "$use64bitint" in
5649                 "$define") echo "64 bit integers selected." >&4 ;;
5650                 esac
5651                 case "$use64bitall" in
5652                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5653                 esac
5654                 case "$archname" in
5655                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5656                         ;;
5657                 *)      archname="$archname-$archname64"
5658                         echo "...setting architecture name to $archname." >&4
5659                         ;;
5660                 esac
5661                 ;;
5662         esac
5663 esac
5664 case "$uselongdouble" in
5665 $define)
5666         echo "Long doubles selected." >&4
5667         case "$longdblsize" in
5668         $doublesize)
5669                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5670                 ;;
5671         *)
5672                 case "$archname" in
5673                 *-ld*) echo "...and architecture name already has -ld." >&4
5674                         ;;
5675                 *)      archname="$archname-ld"
5676                         echo "...setting architecture name to $archname." >&4
5677                         ;;
5678                 esac
5679                 ;;
5680         esac
5681         ;;
5682 esac
5683 case "$useperlio" in
5684 $define)
5685         echo "Perlio selected." >&4
5686         ;;
5687 *)
5688         echo "Perlio not selected, using stdio." >&4
5689         case "$archname" in
5690         *-stdio*) echo "...and architecture name already has -stdio." >&4
5691                 ;;
5692         *)      archname="$archname-stdio"
5693                 echo "...setting architecture name to $archname." >&4
5694                 ;;
5695         esac
5696         ;;
5697 esac
5698 if $test -f archname.cbu; then
5699         echo "Your platform has some specific hints for architecture name, using them..."
5700         . ./archname.cbu
5701 fi
5702
5703 : determine root of directory hierarchy where package will be installed.
5704 case "$prefix" in
5705 '')
5706         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5707         ;;
5708 *?/)
5709         dflt=`echo "$prefix" | sed 's/.$//'`
5710         ;;
5711 *)
5712         dflt="$prefix"
5713         ;;
5714 esac
5715 $cat <<EOM
5716
5717 By default, $package will be installed in $dflt/bin, manual pages
5718 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5719 installation directories. Typically this is something like /usr/local.
5720 If you wish to have binaries under /usr/bin but other parts of the
5721 installation under /usr/local, that's ok: you will be prompted
5722 separately for each of the installation directories, the prefix being
5723 only used to set the defaults.
5724
5725 EOM
5726 fn=d~
5727 rp='Installation prefix to use?'
5728 . ./getfile
5729 oldprefix=''
5730 case "$prefix" in
5731 '') ;;
5732 *)
5733         case "$ans" in
5734         "$prefix") ;;
5735         *) oldprefix="$prefix";;
5736         esac
5737         ;;
5738 esac
5739 prefix="$ans"
5740 prefixexp="$ansexp"
5741
5742 case "$afsroot" in
5743 '')     afsroot=/afs ;;
5744 *)      afsroot=$afsroot ;;
5745 esac
5746
5747 : is AFS running?
5748 echo " "
5749 case "$afs" in
5750 $define|true)   afs=true ;;
5751 $undef|false)   afs=false ;;
5752 *)      if test -d $afsroot; then
5753                 afs=true
5754         else
5755                 afs=false
5756         fi
5757         ;;
5758 esac
5759 if $afs; then
5760         echo "AFS may be running... I'll be extra cautious then..." >&4
5761 else
5762         echo "AFS does not seem to be running..." >&4
5763 fi
5764
5765 : determine installation prefix for where package is to be installed.
5766 if $afs; then 
5767 $cat <<EOM
5768
5769 Since you are running AFS, I need to distinguish the directory in which
5770 files will reside from the directory in which they are installed (and from
5771 which they are presumably copied to the former directory by occult means).
5772
5773 EOM
5774         case "$installprefix" in
5775         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5776         *) dflt="$installprefix";;
5777         esac
5778 else
5779 $cat <<EOM
5780
5781 In some special cases, particularly when building $package for distribution,
5782 it is convenient to distinguish the directory in which files should be
5783 installed from the directory ($prefix) in which they will
5784 eventually reside.  For most users, these two directories are the same.
5785
5786 EOM
5787         case "$installprefix" in
5788         '') dflt=$prefix ;;
5789         *) dflt=$installprefix;;
5790         esac
5791 fi
5792 fn=d~
5793 rp='What installation prefix should I use for installing files?'
5794 . ./getfile
5795 installprefix="$ans"
5796 installprefixexp="$ansexp"
5797
5798 : set the prefixit variable, to compute a suitable default value
5799 prefixit='case "$3" in
5800 ""|none)
5801         case "$oldprefix" in
5802         "") eval "$1=\"\$$2\"";;
5803         *)
5804                 case "$3" in
5805                 "") eval "$1=";;
5806                 none)
5807                         eval "tp=\"\$$2\"";
5808                         case "$tp" in
5809                         ""|" ") eval "$1=\"\$$2\"";;
5810                         *) eval "$1=";;
5811                         esac;;
5812                 esac;;
5813         esac;;
5814 *)
5815         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5816         case "$tp" in
5817         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5818         /*-$oldprefix/*|\~*-$oldprefix/*)
5819                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5820         *) eval "$1=\"\$$2\"";;
5821         esac;;
5822 esac'
5823
5824 : get the patchlevel
5825 echo " "
5826 echo "Getting the current patchlevel..." >&4
5827 if $test -r $rsrc/patchlevel.h;then
5828         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5829         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5830         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5831         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5832         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5833         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5834        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5835 else
5836         revision=0
5837         patchlevel=0
5838         subversion=0
5839         api_revision=0
5840         api_version=0
5841         api_subversion=0
5842         perl_patchlevel=0
5843         $echo "(You do not have patchlevel.h.  Eek.)"
5844 fi
5845 if $test -r $rsrc/.patch ; then  
5846         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5847                 perl_patchlevel=`cat $rsrc/.patch`
5848         fi
5849 fi
5850 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5851 version_patchlevel_string="version $patchlevel subversion $subversion"
5852 case "$perl_patchlevel" in
5853 0|'') ;;
5854 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5855 esac
5856
5857 $echo "(You have $package $version_patchlevel_string.)"
5858
5859 case "$osname" in
5860 dos|vms)
5861         : XXX Should be a Configure test for double-dots in filenames.
5862         version=`echo $revision $patchlevel $subversion | \
5863                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5864         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5865                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5866         ;;
5867 *)
5868         version=`echo $revision $patchlevel $subversion | \
5869                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5870         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5871                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5872         ;;
5873 esac
5874 : Special case the 5.005_xx maintenance series, which used 5.005
5875 : without any subversion label as a subdirectory in $sitelib
5876 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5877         api_versionstring='5.005'
5878 fi
5879
5880 : determine installation style
5881 : For now, try to deduce it from prefix unless it is already set.
5882 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5883 case "$installstyle" in
5884 '')     case "$prefix" in
5885                 *perl*) dflt='lib';;
5886                 *) dflt='lib/perl5' ;;
5887         esac
5888         ;;
5889 *)      dflt="$installstyle" ;;
5890 esac
5891 : Probably not worth prompting for this since we prompt for all
5892 : the directories individually, and the prompt would be too long and
5893 : confusing anyway.
5894 installstyle=$dflt
5895
5896 : determine where private library files go
5897 : Usual default is /usr/local/lib/perl5/$version.
5898 : Also allow things like /opt/perl/lib/$version, since 
5899 : /opt/perl/lib/perl5... would be redundant.
5900 : The default "style" setting is made in installstyle.U
5901 case "$installstyle" in
5902 *lib/perl5*) set dflt privlib lib/$package/$version ;;
5903 *)       set dflt privlib lib/$version ;;
5904 esac
5905 eval $prefixit
5906 $cat <<EOM
5907
5908 There are some auxiliary files for $package that need to be put into a
5909 private library directory that is accessible by everyone.
5910
5911 EOM
5912 fn=d~+
5913 rp='Pathname where the private library files will reside?'
5914 . ./getfile
5915 privlib="$ans"
5916 privlibexp="$ansexp"
5917 : Change installation prefix, if necessary.
5918 if $test X"$prefix" != X"$installprefix"; then
5919         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
5920 else
5921         installprivlib="$privlibexp"
5922 fi
5923
5924 : set the prefixup variable, to restore leading tilda escape
5925 prefixup='case "$prefixexp" in
5926 "$prefix") ;;
5927 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
5928 esac'
5929
5930 : determine where public architecture dependent libraries go
5931 set archlib archlib
5932 eval $prefixit
5933 : privlib default is /usr/local/lib/$package/$version
5934 : archlib default is /usr/local/lib/$package/$version/$archname
5935 : privlib may have an optional trailing /share.
5936 tdflt=`echo $privlib | $sed 's,/share$,,'`
5937 tdflt=$tdflt/$archname
5938 case "$archlib" in
5939 '')     dflt=$tdflt
5940         ;;
5941 *)      dflt="$archlib"
5942     ;;
5943 esac
5944 $cat <<EOM
5945
5946 $spackage contains architecture-dependent library files.  If you are
5947 sharing libraries in a heterogeneous environment, you might store
5948 these files in a separate location.  Otherwise, you can just include
5949 them with the rest of the public library files.
5950
5951 EOM
5952 fn=d+~
5953 rp='Where do you want to put the public architecture-dependent libraries?'
5954 . ./getfile
5955 archlib="$ans"
5956 archlibexp="$ansexp"
5957 if $test X"$archlib" = X"$privlib"; then
5958         d_archlib="$undef"
5959 else
5960         d_archlib="$define"
5961 fi
5962 : Change installation prefix, if necessary.
5963 if $test X"$prefix" != X"$installprefix"; then
5964         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
5965 else
5966         installarchlib="$archlibexp"
5967 fi
5968
5969 : see if setuid scripts can be secure
5970 $cat <<EOM
5971
5972 Some kernels have a bug that prevents setuid #! scripts from being
5973 secure.  Some sites have disabled setuid #! scripts because of this.
5974
5975 First let's decide if your kernel supports secure setuid #! scripts.
5976 (If setuid #! scripts would be secure but have been disabled anyway,
5977 don't say that they are secure if asked.)
5978
5979 EOM
5980
5981 val="$undef"
5982 if $test -d /dev/fd; then
5983         echo "#!$ls" >reflect
5984         chmod +x,u+s reflect
5985         ./reflect >flect 2>&1
5986         if $contains "/dev/fd" flect >/dev/null; then
5987                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
5988                 val="$define"
5989         else
5990                 $cat <<EOM
5991 If you are not sure if they are secure, I can check but I'll need a
5992 username and password different from the one you are using right now.
5993 If you don't have such a username or don't want me to test, simply
5994 enter 'none'.
5995
5996 EOM
5997                 rp='Other username to test security of setuid scripts with?'
5998                 dflt='none'
5999                 . ./myread
6000                 case "$ans" in
6001                 n|none)
6002                         case "$d_suidsafe" in
6003                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6004                                 dflt=n;;
6005                         "$undef")
6006                                 echo "Well, the $hint value is *not* secure." >&4
6007                                 dflt=n;;
6008                         *)      echo "Well, the $hint value *is* secure." >&4
6009                                 dflt=y;;
6010                         esac
6011                         ;;
6012                 *)
6013                         $rm -f reflect flect
6014                         echo "#!$ls" >reflect
6015                         chmod +x,u+s reflect
6016                         echo >flect
6017                         chmod a+w flect
6018                         echo '"su" will (probably) prompt you for '"$ans's password."
6019                         su $ans -c './reflect >flect'
6020                         if $contains "/dev/fd" flect >/dev/null; then
6021                                 echo "Okay, it looks like setuid scripts are secure." >&4
6022                                 dflt=y
6023                         else
6024                                 echo "I don't think setuid scripts are secure." >&4
6025                                 dflt=n
6026                         fi
6027                         ;;
6028                 esac
6029                 rp='Does your kernel have *secure* setuid scripts?'
6030                 . ./myread
6031                 case "$ans" in
6032                 [yY]*)  val="$define";;
6033                 *)      val="$undef";;
6034                 esac
6035         fi
6036 else
6037         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6038         echo "(That's for file descriptors, not floppy disks.)"
6039         val="$undef"
6040 fi
6041 set d_suidsafe
6042 eval $setvar
6043
6044 $rm -f reflect flect
6045
6046 : now see if they want to do setuid emulation
6047 echo " "
6048 val="$undef"
6049 case "$d_suidsafe" in
6050 "$define")
6051         val="$undef"
6052         echo "No need to emulate SUID scripts since they are secure here." >&4
6053         ;;
6054 *)
6055         $cat <<EOM
6056 Some systems have disabled setuid scripts, especially systems where
6057 setuid scripts cannot be secure.  On systems where setuid scripts have
6058 been disabled, the setuid/setgid bits on scripts are currently
6059 useless.  It is possible for $package to detect those bits and emulate
6060 setuid/setgid in a secure fashion.  This emulation will only work if
6061 setuid scripts have been disabled in your kernel.
6062
6063 EOM
6064         case "$d_dosuid" in
6065         "$define") dflt=y ;;
6066         *) dflt=n ;;
6067         esac
6068         rp="Do you want to do setuid/setgid emulation?"
6069         . ./myread
6070         case "$ans" in
6071         [yY]*)  val="$define";;
6072         *)      val="$undef";;
6073         esac
6074         ;;
6075 esac
6076 set d_dosuid
6077 eval $setvar
6078
6079 : see if this is a malloc.h system
6080 : we want a real compile instead of Inhdr because some systems have a
6081 : malloc.h that just gives a compile error saying to use stdlib.h instead
6082 echo " "
6083 $cat >try.c <<EOCP
6084 #include <stdlib.h>
6085 #include <malloc.h>
6086 int main () { return 0; }
6087 EOCP
6088 set try
6089 if eval $compile; then
6090     echo "<malloc.h> found." >&4
6091     val="$define"
6092 else
6093     echo "<malloc.h> NOT found." >&4
6094     val="$undef"
6095 fi
6096 $rm -f try.c try
6097 set i_malloc
6098 eval $setvar
6099
6100 : check for void type
6101 echo " "
6102 echo "Checking to see how well your C compiler groks the void type..." >&4
6103 case "$voidflags" in
6104 '')
6105         $cat >try.c <<EOCP
6106 #$i_stdlib I_STDLIB
6107 #ifdef I_STDLIB
6108 #include <stdlib.h>
6109 #endif
6110 #if TRY & 1
6111 void sub() {
6112 #else
6113 sub() {
6114 #endif
6115         extern void moo();      /* function returning void */
6116         void (*goo)();          /* ptr to func returning void */
6117 #if TRY & 8
6118         void *hue;              /* generic ptr */
6119 #endif
6120 #if TRY & 2
6121         void (*foo[10])();
6122 #endif
6123
6124 #if TRY & 4
6125         if(goo == moo) {
6126                 exit(0);
6127         }
6128 #endif
6129         exit(0);
6130 }
6131 int main() { sub(); }
6132 EOCP
6133         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6134                 voidflags=$defvoidused
6135         echo "Good.  It appears to support void to the level $package wants.">&4
6136                 if $contains warning .out >/dev/null 2>&1; then
6137                         echo "However, you might get some warnings that look like this:"
6138                         $cat .out
6139                 fi
6140         else
6141 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6142                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6143                         echo "It supports 1..."
6144                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6145                                 echo "It also supports 2..."
6146                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6147                                         voidflags=7
6148                                         echo "And it supports 4 but not 8 definitely."
6149                                 else
6150                                         echo "It doesn't support 4..."
6151                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6152                                                 voidflags=11
6153                                                 echo "But it supports 8."
6154                                         else
6155                                                 voidflags=3
6156                                                 echo "Neither does it support 8."
6157                                         fi
6158                                 fi
6159                         else
6160                                 echo "It does not support 2..."
6161                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6162                                         voidflags=13
6163                                         echo "But it supports 4 and 8."
6164                                 else
6165                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6166                                                 voidflags=5
6167                                                 echo "And it supports 4 but has not heard about 8."
6168                                         else
6169                                                 echo "However it supports 8 but not 4."
6170                                         fi
6171                                 fi
6172                         fi
6173                 else
6174                         echo "There is no support at all for void."
6175                         voidflags=0
6176                 fi
6177         fi
6178 esac
6179 case "$voidflags" in
6180 "$defvoidused") ;;
6181 *)      $cat >&4 <<'EOM'
6182   Support flag bits are:
6183     1: basic void declarations.
6184     2: arrays of pointers to functions returning void.
6185     4: operations between pointers to and addresses of void functions.
6186     8: generic void pointers.
6187 EOM
6188         dflt="$voidflags";
6189         rp="Your void support flags add up to what?"
6190         . ./myread
6191         voidflags="$ans"
6192         ;;
6193 esac
6194 $rm -f try.* .out
6195
6196 : check for length of pointer
6197 echo " "
6198 case "$ptrsize" in
6199 '')
6200         echo "Checking to see how big your pointers are..." >&4
6201         if test "$voidflags" -gt 7; then
6202                 echo '#define VOID_PTR char *' > try.c
6203         else
6204                 echo '#define VOID_PTR void *' > try.c
6205         fi
6206         $cat >>try.c <<EOCP
6207 #include <stdio.h>
6208 #$i_stdlib I_STDLIB
6209 #ifdef I_STDLIB
6210 #include <stdlib.h>
6211 #endif
6212 int main()
6213 {
6214     printf("%d\n", (int)sizeof(VOID_PTR));
6215     exit(0);
6216 }
6217 EOCP
6218         set try
6219         if eval $compile_ok; then
6220                 ptrsize=`$run ./try`
6221                 echo "Your pointers are $ptrsize bytes long."
6222         else
6223                 dflt='4'
6224                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6225                 rp="What is the size of a pointer (in bytes)?"
6226                 . ./myread
6227                 ptrsize="$ans"
6228         fi
6229         ;;
6230 esac
6231 $rm -f try.c try
6232 case "$use64bitall" in
6233 "$define"|true|[yY]*)
6234         case "$ptrsize" in
6235         4)      cat <<EOM >&4
6236
6237 *** You have chosen a maximally 64-bit build,
6238 *** but your pointers are only 4 bytes wide.
6239 *** Please rerun Configure without -Duse64bitall.
6240 EOM
6241                 case "$d_quad" in
6242                 define)
6243                         cat <<EOM >&4
6244 *** Since you have quads, you could possibly try with -Duse64bitint.
6245 EOM
6246                         ;;
6247                 esac
6248                 cat <<EOM >&4
6249 *** Cannot continue, aborting.
6250
6251 EOM
6252
6253                 exit 1
6254                 ;;
6255         esac
6256         ;;
6257 esac
6258
6259
6260 : determine which malloc to compile in
6261 echo " "
6262 case "$usemymalloc" in
6263 [yY]*|true|$define)     dflt='y' ;;
6264 [nN]*|false|$undef)     dflt='n' ;;
6265 *)      case "$ptrsize" in
6266         4) dflt='y' ;;
6267         *) dflt='n' ;;
6268         esac
6269         ;;
6270 esac
6271 rp="Do you wish to attempt to use the malloc that comes with $package?"
6272 . ./myread
6273 usemymalloc="$ans"
6274 case "$ans" in
6275 y*|true)
6276         usemymalloc='y'
6277         mallocsrc='malloc.c'
6278         mallocobj="malloc$_o"
6279         d_mymalloc="$define"
6280         case "$libs" in
6281         *-lmalloc*)
6282                 : Remove malloc from list of libraries to use
6283                 echo "Removing unneeded -lmalloc from library list" >&4
6284                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6285                 shift
6286                 libs="$*"
6287                 echo "libs = $libs" >&4
6288                 ;;
6289         esac
6290         ;;
6291 *)
6292         usemymalloc='n'
6293         mallocsrc=''
6294         mallocobj=''
6295         d_mymalloc="$undef"
6296         ;;
6297 esac
6298
6299 : compute the return types of malloc and free
6300 echo " "
6301 $cat >malloc.c <<END
6302 #$i_malloc I_MALLOC
6303 #$i_stdlib I_STDLIB
6304 #include <stdio.h>
6305 #include <sys/types.h>
6306 #ifdef I_MALLOC
6307 #include <malloc.h>
6308 #endif
6309 #ifdef I_STDLIB
6310 #include <stdlib.h>
6311 #endif
6312 #ifdef TRY_MALLOC
6313 void *malloc();
6314 #endif
6315 #ifdef TRY_FREE
6316 void free();
6317 #endif
6318 END
6319 case "$malloctype" in
6320 '')
6321         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6322                 malloctype='void *'
6323         else
6324                 malloctype='char *'
6325         fi
6326         ;;
6327 esac
6328 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6329
6330 case "$freetype" in
6331 '')
6332         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6333                 freetype='void'
6334         else
6335                 freetype='int'
6336         fi
6337         ;;
6338 esac
6339 echo "Your system uses $freetype free(), it would seem." >&4
6340 $rm -f malloc.[co]
6341 $cat <<EOM
6342
6343 After $package is installed, you may wish to install various
6344 add-on modules and utilities.  Typically, these add-ons will
6345 be installed under $prefix with the rest
6346 of this package.  However, you may wish to install such add-ons
6347 elsewhere under a different prefix.
6348
6349 If you do not wish to put everything under a single prefix, that's
6350 ok.  You will be prompted for the individual locations; this siteprefix
6351 is only used to suggest the defaults.
6352
6353 The default should be fine for most people.
6354
6355 EOM
6356 fn=d~+
6357 rp='Installation prefix to use for add-on modules and utilities?'
6358 : XXX Here might be another good place for an installstyle setting.
6359 case "$siteprefix" in
6360 '') dflt=$prefix ;;
6361 *)  dflt=$siteprefix ;;
6362 esac
6363 . ./getfile
6364 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6365 oldsiteprefix=''
6366 case "$siteprefix" in
6367 '') ;;
6368 *)      case "$ans" in
6369         "$prefix") ;;
6370         *) oldsiteprefix="$prefix";;
6371         esac
6372         ;;
6373 esac
6374 siteprefix="$ans"
6375 siteprefixexp="$ansexp"
6376
6377 : determine where site specific libraries go.
6378 : Usual default is /usr/local/lib/perl5/site_perl/$version
6379 : The default "style" setting is made in installstyle.U
6380 : XXX No longer works with Prefixit stuff.
6381 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6382 case "$sitelib" in
6383 '') case "$installstyle" in
6384         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6385         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6386         esac
6387         ;;
6388 *)      dflt="$sitelib"
6389         ;;
6390 esac
6391 $cat <<EOM
6392
6393 The installation process will create a directory for
6394 site-specific extensions and modules.  Most users find it convenient
6395 to place all site-specific files in this directory rather than in the
6396 main distribution directory.
6397
6398 EOM
6399 fn=d~+
6400 rp='Pathname for the site-specific library files?'
6401 . ./getfile
6402 sitelib="$ans"
6403 sitelibexp="$ansexp"
6404 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6405 : Change installation prefix, if necessary.
6406 if $test X"$prefix" != X"$installprefix"; then
6407         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
6408 else
6409         installsitelib="$sitelibexp"
6410 fi
6411
6412 : determine where site specific architecture-dependent libraries go.
6413 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6414 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6415 : sitelib may have an optional trailing /share.
6416 case "$sitearch" in
6417 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6418         dflt="$dflt/$archname"
6419         ;;
6420 *)      dflt="$sitearch"
6421         ;;
6422 esac
6423 set sitearch sitearch none
6424 eval $prefixit
6425 $cat <<EOM
6426
6427 The installation process will also create a directory for
6428 architecture-dependent site-specific extensions and modules.
6429
6430 EOM
6431 fn=d~+
6432 rp='Pathname for the site-specific architecture-dependent library files?'
6433 . ./getfile
6434 sitearch="$ans"
6435 sitearchexp="$ansexp"
6436 : Change installation prefix, if necessary.
6437 if $test X"$prefix" != X"$installprefix"; then
6438         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
6439 else
6440         installsitearch="$sitearchexp"
6441 fi
6442
6443 $cat <<EOM
6444
6445 The installation process will also create a directory for
6446 vendor-supplied add-ons.  Vendors who supply perl with their system
6447 may find it convenient to place all vendor-supplied files in this
6448 directory rather than in the main distribution directory.  This will
6449 ease upgrades between binary-compatible maintenance versions of perl.
6450
6451 Of course you may also use these directories in whatever way you see
6452 fit.  For example, you might use them to access modules shared over a
6453 company-wide network.
6454
6455 The default answer should be fine for most people.
6456 This causes further questions about vendor add-ons to be skipped
6457 and no vendor-specific directories will be configured for perl.
6458
6459 EOM
6460 rp='Do you want to configure vendor-specific add-on directories?'
6461 case "$usevendorprefix" in
6462 define|true|[yY]*) dflt=y ;;
6463 *)      : User may have set vendorprefix directly on Configure command line.
6464         case "$vendorprefix" in
6465         ''|' ') dflt=n ;;
6466         *)      dflt=y ;;
6467         esac
6468         ;;
6469 esac
6470 . ./myread
6471 case "$ans" in
6472 [yY]*)  fn=d~+
6473         rp='Installation prefix to use for vendor-supplied add-ons?'
6474         case "$vendorprefix" in
6475         '') dflt='' ;;
6476         *)  dflt=$vendorprefix ;;
6477         esac
6478         . ./getfile
6479         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6480         oldvendorprefix=''
6481         case "$vendorprefix" in
6482         '') ;;
6483         *)      case "$ans" in
6484                 "$prefix") ;;
6485                 *) oldvendorprefix="$prefix";;
6486                 esac
6487                 ;;
6488         esac
6489         usevendorprefix="$define"
6490         vendorprefix="$ans"
6491         vendorprefixexp="$ansexp"
6492         ;;
6493 *)      usevendorprefix="$undef"
6494         vendorprefix=''
6495         vendorprefixexp=''
6496         ;;
6497 esac
6498
6499 case "$vendorprefix" in
6500 '')     d_vendorlib="$undef"
6501         vendorlib=''
6502         vendorlibexp=''
6503         ;;
6504 *)      d_vendorlib="$define"
6505         : determine where vendor-supplied modules go.
6506         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6507         case "$vendorlib" in
6508         '')
6509                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6510                 case "$installstyle" in
6511                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6512                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6513                 esac
6514                 ;;
6515         *)      dflt="$vendorlib"
6516                 ;;
6517         esac
6518         fn=d~+
6519         rp='Pathname for the vendor-supplied library files?'
6520         . ./getfile
6521         vendorlib="$ans"
6522         vendorlibexp="$ansexp"
6523         ;;
6524 esac
6525 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6526 : Change installation prefix, if necessary.
6527 if $test X"$prefix" != X"$installprefix"; then
6528         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
6529 else
6530         installvendorlib="$vendorlibexp"
6531 fi
6532
6533 case "$vendorprefix" in
6534 '')     d_vendorarch="$undef"
6535         vendorarch=''
6536         vendorarchexp=''
6537         ;;
6538 *)      d_vendorarch="$define"
6539         : determine where vendor-supplied architecture-dependent libraries go.
6540         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6541         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6542         : vendorlib may have an optional trailing /share.
6543         case "$vendorarch" in
6544         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6545                 dflt="$dflt/$archname"
6546                 ;;
6547         *)      dflt="$vendorarch" ;;
6548         esac
6549         fn=d~+
6550         rp='Pathname for vendor-supplied architecture-dependent files?'
6551         . ./getfile
6552         vendorarch="$ans"
6553         vendorarchexp="$ansexp"
6554         ;;
6555 esac
6556 : Change installation prefix, if necessary.
6557 if $test X"$prefix" != X"$installprefix"; then
6558         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
6559 else
6560         installvendorarch="$vendorarchexp"
6561 fi
6562
6563 : Final catch-all directories to search
6564 $cat <<EOM
6565
6566 Lastly, you can have perl look in other directories for extensions and
6567 modules in addition to those already specified.
6568 These directories will be searched after 
6569         $sitearch 
6570         $sitelib 
6571 EOM
6572 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6573 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6574 echo ' '
6575 case "$otherlibdirs" in
6576 ''|' ') dflt='none' ;;
6577 *)      dflt="$otherlibdirs" ;;
6578 esac
6579 $cat <<EOM
6580 Enter a colon-separated set of extra paths to include in perl's @INC
6581 search path, or enter 'none' for no extra paths.
6582
6583 EOM
6584
6585 rp='Colon-separated list of additional directories for perl to search?'
6586 . ./myread
6587 case "$ans" in
6588 ' '|''|none)    otherlibdirs=' ' ;;     
6589 *)      otherlibdirs="$ans" ;;
6590 esac
6591 case "$otherlibdirs" in
6592 ' ') val=$undef ;;
6593 *)      val=$define ;;
6594 esac
6595 set d_perl_otherlibdirs
6596 eval $setvar
6597
6598 : Cruising for prototypes
6599 echo " "
6600 echo "Checking out function prototypes..." >&4
6601 $cat >prototype.c <<EOCP
6602 #$i_stdlib I_STDLIB
6603 #ifdef I_STDLIB
6604 #include <stdlib.h>
6605 #endif
6606 int main(int argc, char *argv[]) {
6607         exit(0);}
6608 EOCP
6609 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6610         echo "Your C compiler appears to support function prototypes."
6611         val="$define"
6612 else
6613         echo "Your C compiler doesn't seem to understand function prototypes."
6614         val="$undef"
6615 fi
6616 set prototype
6617 eval $setvar
6618 $rm -f prototype*
6619
6620 case "$prototype" in
6621 "$define") ;;
6622 *)      ansi2knr='ansi2knr'
6623         echo " "
6624         cat <<EOM >&4
6625
6626 $me:  FATAL ERROR:
6627 This version of $package can only be compiled by a compiler that 
6628 understands function prototypes.  Unfortunately, your C compiler 
6629         $cc $ccflags
6630 doesn't seem to understand them.  Sorry about that.
6631
6632 If GNU cc is available for your system, perhaps you could try that instead.  
6633
6634 Eventually, we hope to support building Perl with pre-ANSI compilers.
6635 If you would like to help in that effort, please contact <perlbug@perl.org>.
6636
6637 Aborting Configure now.
6638 EOM
6639         exit 2
6640         ;;
6641 esac
6642
6643 : determine where public executables go
6644 echo " "
6645 set dflt bin bin
6646 eval $prefixit
6647 fn=d~
6648 rp='Pathname where the public executables will reside?'
6649 . ./getfile
6650 if $test "X$ansexp" != "X$binexp"; then
6651         installbin=''
6652 fi
6653 bin="$ans"
6654 binexp="$ansexp"
6655 : Change installation prefix, if necessary.
6656 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6657 if $test X"$prefix" != X"$installprefix"; then
6658         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
6659 else
6660         installbin="$binexp"
6661 fi
6662
6663 echo " "
6664 case "$extras" in
6665 '') dflt='n';;
6666 *) dflt='y';;
6667 esac
6668 cat <<EOM
6669 Perl can be built with extra modules or bundles of modules which
6670 will be fetched from the CPAN and installed alongside Perl.
6671
6672 Notice that you will need access to the CPAN; either via the Internet,
6673 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6674 be asked later to configure the CPAN.pm module which will in turn do
6675 the installation of the rest of the extra modules or bundles.)
6676
6677 Notice also that if the modules require any external software such as
6678 libraries and headers (the libz library and the zlib.h header for the
6679 Compress::Zlib module, for example) you MUST have any such software
6680 already installed, this configuration process will NOT install such
6681 things for you.
6682
6683 If this doesn't make any sense to you, just accept the default '$dflt'.
6684 EOM
6685 rp='Install any extra modules (y or n)?'
6686 . ./myread
6687 case "$ans" in
6688 y|Y)
6689         cat <<EOM
6690
6691 Please list any extra modules or bundles to be installed from CPAN,
6692 with spaces between the names.  The names can be in any format the
6693 'install' command of CPAN.pm will understand.  (Answer 'none',
6694 without the quotes, to install no extra modules or bundles.)
6695 EOM
6696         rp='Extras?'
6697         dflt="$extras"
6698         . ./myread
6699         extras="$ans"
6700 esac
6701 case "$extras" in
6702 ''|'none')
6703         val=''
6704         $rm -f ../extras.lst
6705         ;;
6706 *)      echo "(Saving the list of extras for later...)"
6707         echo "$extras" > ../extras.lst
6708         val="'$extras'"
6709         ;;
6710 esac
6711 set extras
6712 eval $setvar
6713 echo " "
6714
6715 : determine where html pages for programs go
6716 set html1dir html1dir none
6717 eval $prefixit
6718 $cat <<EOM
6719
6720 If you wish to install html files for programs in $spackage, indicate 
6721 the appropriate directory here.  To skip installing html files,
6722 answer "none".
6723 EOM
6724 case "$html1dir" in
6725 ''|none|$undef|' ') dflt=none ;;
6726 *) dflt=$html1dir ;;
6727 esac
6728 fn=dn+~
6729 rp="Directory for the main $spackage html pages?"
6730 . ./getfile
6731 html1dir="$ans"
6732 html1direxp="$ansexp"
6733 : Use ' ' for none so value is preserved next time through Configure
6734 $test X"$html1dir" = "X" && html1dir=' '
6735 : Change installation prefix, if necessary.
6736 if $test X"$prefix" != X"$installprefix"; then
6737         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
6738 else
6739         installhtml1dir="$html1direxp"
6740 fi
6741
6742 : determine where html pages for libraries and modules go
6743 set html3dir html3dir none
6744 eval $prefixit
6745 $cat <<EOM
6746
6747 If you wish to install html files for modules associated with $spackage,
6748 indicate the appropriate directory here.  To skip installing html files,
6749 answer "none".
6750 EOM
6751 : There is no obvious default.  If they have specified html1dir, then
6752 : try to key off that, possibly changing .../html1 into .../html3.
6753 case "$html3dir" in
6754 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6755 *) dflt=$html3dir ;;
6756 esac
6757 fn=dn+~
6758 rp="Directory for the $spackage module html pages?"
6759 . ./getfile
6760 html3dir="$ans"
6761 html3direxp="$ansexp"
6762 : Use ' ' for none so value is preserved next time through Configure
6763 $test X"$html3dir" = "X" && html3dir=' '
6764 : Change installation prefix, if necessary.
6765 if $test X"$prefix" != X"$installprefix"; then
6766         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
6767 else
6768         installhtml3dir="$html3direxp"
6769 fi
6770
6771 : Find perl5.005 or later.
6772 echo "Looking for a previously installed perl5.005 or later... "
6773 case "$perl5" in
6774 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6775                 : Check if this perl is recent and can load a simple module
6776                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6777                         perl5=$tdir/perl
6778                         break;
6779                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6780                         perl5=$tdir/perl5
6781                         break;
6782                 fi
6783         done
6784         ;;
6785 *)      perl5="$perl5"
6786         ;;
6787 esac
6788 case "$perl5" in
6789 '')     echo "None found.  That's ok.";;
6790 *)      echo "Using $perl5." ;;
6791 esac
6792
6793 : Determine list of previous versions to include in @INC
6794 $cat > getverlist <<EOPL
6795 #!$perl5 -w
6796 use File::Basename;
6797 \$api_versionstring = "$api_versionstring";
6798 \$version = "$version";
6799 \$stem = "$sitelib_stem";
6800 \$archname = "$archname";
6801 EOPL
6802         $cat >> getverlist <<'EOPL'
6803 # Can't have leading @ because metaconfig interprets it as a command!
6804 ;@inc_version_list=();
6805 # XXX Redo to do opendir/readdir? 
6806 if (-d $stem) {
6807     chdir($stem);
6808     ;@candidates = glob("5.*");
6809 }
6810 else {
6811     ;@candidates = ();
6812 }
6813
6814 # XXX ToDo:  These comparisons must be reworked when two-digit
6815 # subversions come along, so that 5.7.10 compares as greater than
6816 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6817 # widespread that we can use the built-in version vectors rather
6818 # than reinventing them here.  For 5.6.0, however, we must
6819 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6820 foreach $d (@candidates) {
6821     if ($d lt $version) {
6822         if ($d ge $api_versionstring) {
6823             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6824         }
6825         elsif ($d ge "5.005") {
6826             unshift(@inc_version_list, grep { -d } $d);
6827         }
6828     }
6829     else {
6830         # Skip newer version.  I.e. don't look in
6831         # 5.7.0 if we're installing 5.6.1.
6832     }
6833 }
6834
6835 if (@inc_version_list) {
6836     print join(' ', @inc_version_list);
6837 }
6838 else {
6839     # Blank space to preserve value for next Configure run.
6840     print " ";
6841 }
6842 EOPL
6843 chmod +x getverlist
6844 case "$inc_version_list" in
6845 '')     if test -x "$perl5$exe_ext"; then
6846                 dflt=`$perl5 getverlist`
6847         else
6848                 dflt='none'
6849         fi
6850         ;;
6851 $undef) dflt='none' ;;
6852 *)  eval dflt=\"$inc_version_list\" ;;
6853 esac
6854 case "$dflt" in
6855 ''|' ') dflt=none ;;
6856 esac
6857 case "$dflt" in
6858 5.005) dflt=none ;;
6859 esac
6860 $cat <<EOM
6861
6862 In order to ease the process of upgrading, this version of perl 
6863 can be configured to use modules built and installed with earlier 
6864 versions of perl that were installed under $prefix.  Specify here
6865 the list of earlier versions that this version of perl should check.
6866 If Configure detected no earlier versions of perl installed under
6867 $prefix, then the list will be empty.  Answer 'none' to tell perl
6868 to not search earlier versions.
6869
6870 The default should almost always be sensible, so if you're not sure,
6871 just accept the default.
6872 EOM
6873
6874 rp='List of earlier versions to include in @INC?'
6875 . ./myread
6876 case "$ans" in
6877 [Nn]one|''|' ') inc_version_list=' ' ;;
6878 *) inc_version_list="$ans" ;;
6879 esac
6880 case "$inc_version_list" in
6881 ''|' ') 
6882         inc_version_list_init='0';;
6883 *)      inc_version_list_init=`echo $inc_version_list |
6884                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6885         ;;
6886 esac
6887 $rm -f getverlist
6888
6889 : determine whether to install perl also as /usr/bin/perl
6890
6891 echo " "
6892 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6893         $cat <<EOM
6894 Many scripts expect perl to be installed as /usr/bin/perl.
6895
6896 If you want to, I can install the perl you are about to compile
6897 as /usr/bin/perl (in addition to $bin/perl).
6898 EOM
6899         if test -f /usr/bin/perl; then
6900             $cat <<EOM
6901
6902 However, please note that because you already have a /usr/bin/perl,
6903 overwriting that with a new Perl would very probably cause problems.
6904 Therefore I'm assuming you don't want to do that (unless you insist).
6905
6906 EOM
6907             case "$installusrbinperl" in
6908             "$define"|[yY]*)    dflt='y';;
6909             *)                  dflt='n';;
6910             esac
6911         else
6912             $cat <<EOM
6913
6914 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6915
6916 EOM
6917             case "$installusrbinperl" in
6918             "$undef"|[nN]*)     dflt='n';;
6919             *)                  dflt='y';;
6920             esac
6921         fi
6922         rp="Do you want to install perl as /usr/bin/perl?"
6923         . ./myread
6924         case "$ans" in
6925         [yY]*)  val="$define";;
6926         *)      val="$undef" ;;
6927         esac
6928 else
6929         val="$undef"
6930 fi
6931 set installusrbinperl
6932 eval $setvar
6933
6934 echo " "
6935 echo "Checking for GNU C Library..." >&4
6936 cat >try.c <<'EOCP'
6937 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
6938    alone are insufficient to distinguish different versions, such as
6939    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
6940    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
6941 */
6942 #include <stdio.h>
6943 int main(void)
6944 {
6945 #ifdef __GLIBC__
6946 #   ifdef __GLIBC_MINOR__
6947 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
6948 #           include <gnu/libc-version.h>
6949             printf("%s\n",  gnu_get_libc_version());
6950 #       else
6951             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
6952 #       endif
6953 #   else
6954         printf("%d\n",  __GLIBC__);
6955 #   endif
6956     return 0;
6957 #else
6958     return 1;
6959 #endif
6960 }
6961 EOCP
6962 set try
6963 if eval $compile_ok && $run ./try > glibc.ver; then
6964         val="$define"
6965         gnulibc_version=`$cat glibc.ver`
6966         echo "You are using the GNU C Library version $gnulibc_version"
6967 else
6968         val="$undef"
6969         gnulibc_version=''
6970         echo "You are not using the GNU C Library"
6971 fi
6972 $rm -f try try.* glibc.ver
6973 set d_gnulibc
6974 eval $setvar
6975
6976 : see if nm is to be used to determine whether a symbol is defined or not
6977 case "$usenm" in
6978 '')
6979         dflt=''
6980         case "$d_gnulibc" in
6981         "$define")
6982                 echo " "
6983                 echo "nm probably won't work on the GNU C Library." >&4
6984                 dflt=n
6985                 ;;
6986         esac
6987         case "$dflt" in
6988         '') 
6989                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
6990                         echo " "
6991                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
6992                         echo "'nm' won't be sufficient on this sytem." >&4
6993                         dflt=n
6994                 fi
6995                 ;;
6996         esac
6997         case "$dflt" in
6998         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
6999                 if $test $dflt -gt 20; then
7000                         dflt=y
7001                 else
7002                         dflt=n
7003                 fi
7004                 ;;
7005         esac
7006         ;;
7007 *)
7008         case "$usenm" in
7009         true|$define) dflt=y;;
7010         *) dflt=n;;
7011         esac
7012         ;;
7013 esac
7014 $cat <<EOM
7015
7016 I can use $nm to extract the symbols from your C libraries. This
7017 is a time consuming task which may generate huge output on the disk (up
7018 to 3 megabytes) but that should make the symbols extraction faster. The
7019 alternative is to skip the 'nm' extraction part and to compile a small
7020 test program instead to determine whether each symbol is present. If
7021 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7022 this may be the best solution.
7023
7024 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7025
7026 EOM
7027 rp="Shall I use $nm to extract C symbols from the libraries?"
7028 . ./myread
7029 case "$ans" in
7030 [Nn]*) usenm=false;;
7031 *) usenm=true;;
7032 esac
7033
7034 runnm=$usenm
7035 case "$reuseval" in
7036 true) runnm=false;;
7037 esac
7038
7039 : nm options which may be necessary
7040 case "$nm_opt" in
7041 '') if $test -f /mach_boot; then
7042                 nm_opt=''       # Mach
7043         elif $test -d /usr/ccs/lib; then
7044                 nm_opt='-p'     # Solaris (and SunOS?)
7045         elif $test -f /dgux; then
7046                 nm_opt='-p'     # DG-UX
7047         elif $test -f /lib64/rld; then
7048                 nm_opt='-p'     # 64-bit Irix
7049         else
7050                 nm_opt=''
7051         fi;;
7052 esac
7053
7054 : nm options which may be necessary for shared libraries but illegal
7055 : for archive libraries.  Thank you, Linux.
7056 case "$nm_so_opt" in
7057 '')     case "$myuname" in
7058         *linux*)
7059                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7060                         nm_so_opt='--dynamic'
7061                 fi
7062                 ;;
7063         esac
7064         ;;
7065 esac
7066
7067 case "$runnm" in
7068 true)
7069 : get list of predefined functions in a handy place
7070 echo " "
7071 case "$libc" in
7072 '') libc=unknown
7073         case "$libs" in
7074         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7075         esac
7076         ;;
7077 esac
7078 case "$libs" in
7079 '') ;;
7080 *)  for thislib in $libs; do
7081         case "$thislib" in
7082         -lc|-lc_s)
7083                 : Handle C library specially below.
7084                 ;;
7085         -l*)
7086                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7087                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7088                         :
7089                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7090                         :
7091                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7092                         :
7093                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7094                         :
7095                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7096                         :
7097                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7098                         :
7099                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7100                         :
7101                 else
7102                         try=''
7103                 fi
7104                 libnames="$libnames $try"
7105                 ;;
7106         *) libnames="$libnames $thislib" ;;
7107         esac
7108         done
7109         ;;
7110 esac
7111 xxx=normal
7112 case "$libc" in
7113 unknown)
7114         set /lib/libc.$so
7115         for xxx in $libpth; do
7116                 $test -r $1 || set $xxx/libc.$so
7117                 : The messy sed command sorts on library version numbers.
7118                 $test -r $1 || \
7119                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7120                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7121                                 h
7122                                 s/[0-9][0-9]*/0000&/g
7123                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7124                                 G
7125                                 s/\n/ /' | \
7126                          $sort | $sed -e 's/^.* //'`
7127                 eval set \$$#
7128         done
7129         $test -r $1 || set /usr/ccs/lib/libc.$so
7130         $test -r $1 || set /lib/libsys_s$_a
7131         ;;
7132 *)
7133         set blurfl
7134         ;;
7135 esac
7136 if $test -r "$1"; then
7137         echo "Your (shared) C library seems to be in $1."
7138         libc="$1"
7139 elif $test -r /lib/libc && $test -r /lib/clib; then
7140         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7141         xxx=apollo
7142         libc='/lib/clib /lib/libc'
7143         if $test -r /lib/syslib; then
7144                 echo "(Your math library is in /lib/syslib.)"
7145                 libc="$libc /lib/syslib"
7146         fi
7147 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7148         echo "Your C library seems to be in $libc, as you said before."
7149 elif $test -r $incpath/usr/lib/libc$_a; then
7150         libc=$incpath/usr/lib/libc$_a;
7151         echo "Your C library seems to be in $libc.  That's fine."
7152 elif $test -r /lib/libc$_a; then
7153         libc=/lib/libc$_a;
7154         echo "Your C library seems to be in $libc.  You're normal."
7155 else
7156         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7157                 :
7158         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7159                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7160         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7161                 :
7162         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7163                 :
7164         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7165                 :
7166         else
7167                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7168         fi
7169         if $test -r "$tans"; then
7170                 echo "Your C library seems to be in $tans, of all places."
7171                 libc=$tans
7172         else
7173                 libc='blurfl'
7174         fi
7175 fi
7176 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7177         dflt="$libc"
7178         cat <<EOM
7179
7180 If the guess above is wrong (which it might be if you're using a strange
7181 compiler, or your machine supports multiple models), you can override it here.
7182
7183 EOM
7184 else
7185         dflt=''
7186         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7187         cat >&4 <<EOM
7188 I can't seem to find your C library.  I've looked in the following places:
7189
7190 EOM
7191         $sed 's/^/      /' libpath
7192         cat <<EOM
7193
7194 None of these seems to contain your C library. I need to get its name...
7195
7196 EOM
7197 fi
7198 fn=f
7199 rp='Where is your C library?'
7200 . ./getfile
7201 libc="$ans"
7202
7203 echo " "
7204 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7205 set X `cat libnames`
7206 shift
7207 xxx=files
7208 case $# in 1) xxx=file; esac
7209 echo "Extracting names from the following $xxx for later perusal:" >&4
7210 echo " "
7211 $sed 's/^/      /' libnames >&4
7212 echo " "
7213 $echo $n "This may take a while...$c" >&4
7214
7215 for file in $*; do
7216         case $file in
7217         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7218         *) $nm $nm_opt $file 2>/dev/null;;
7219         esac
7220 done >libc.tmp
7221
7222 $echo $n ".$c"
7223 $grep fprintf libc.tmp > libc.ptf
7224 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7225 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7226 xxx='[ADTSIW]'
7227 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7228         eval $xscan;\
7229         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7230                 eval $xrun
7231 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7232         eval $xscan;\
7233         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7234                 eval $xrun
7235 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7236         eval $xscan;\
7237         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7238                 eval $xrun
7239 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7240         eval $xscan;\
7241         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7242                 eval $xrun
7243 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7244         eval $xscan;\
7245         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7246                 eval $xrun
7247 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7248         eval $xscan;\
7249         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7250                 eval $xrun
7251 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7252                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7253         eval $xscan;\
7254         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7255                 eval $xrun
7256 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7257         eval $xscan;\
7258         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7259                 eval $xrun
7260 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7261         eval $xscan;\
7262         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7263                 eval $xrun
7264 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7265         eval $xscan;\
7266         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7267                 eval $xrun
7268 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7269         eval $xscan;\
7270         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7271                 eval $xrun
7272 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7273         eval $xscan;\
7274         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7275                 eval $xrun
7276 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7277         eval $xscan;\
7278         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7279                 eval $xrun
7280 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7281         eval $xscan;\
7282         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7283                 eval $xrun
7284 else
7285         $nm -p $* 2>/dev/null >libc.tmp
7286         $grep fprintf libc.tmp > libc.ptf
7287         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7288                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7289         then
7290                 nm_opt='-p'
7291                 eval $xrun
7292         else
7293                 echo " "
7294                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7295                 com=''
7296                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7297                         for thisname in $libnames $libc; do
7298                                 $ar t $thisname >>libc.tmp
7299                         done
7300                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7301                         echo "Ok." >&4
7302                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7303                         # Repeat libc to extract forwarders to DLL entries too
7304                         for thisname in $libnames $libc; do
7305                                 $ar tv $thisname >>libc.tmp
7306                                 # Revision 50 of EMX has bug in $ar.
7307                                 # it will not extract forwarders to DLL entries
7308                                 # Use emximp which will extract exactly them.
7309                                 emximp -o tmp.imp $thisname \
7310                                     2>/dev/null && \
7311                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7312                                     < tmp.imp >>libc.tmp
7313                                 $rm tmp.imp
7314                         done
7315                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7316                         echo "Ok." >&4
7317                 else
7318                         echo "$ar didn't seem to work right." >&4
7319                         echo "Maybe this is a Cray...trying bld instead..." >&4
7320                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7321                         then
7322                                 for thisname in $libnames; do
7323                                         bld t $libnames | \
7324                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7325                                         $ar t $thisname >>libc.tmp
7326                                 done
7327                                 echo "Ok." >&4
7328                         else
7329                                 echo "That didn't work either.  Giving up." >&4
7330                                 exit 1
7331                         fi
7332                 fi
7333         fi
7334 fi
7335 nm_extract="$com"
7336 case "$PASE" in
7337 define)
7338     echo " "
7339     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7340     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7341     ;;
7342 *)  if $test -f /lib/syscalls.exp; then
7343         echo " "
7344         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7345         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7346     fi
7347     ;;
7348 esac
7349 ;;
7350 esac
7351 $rm -f libnames libpath
7352
7353 : see if dld is available
7354 set dld.h i_dld
7355 eval $inhdr
7356
7357 : is a C symbol defined?
7358 csym='tlook=$1;
7359 case "$3" in
7360 -v) tf=libc.tmp; tc=""; tdc="";;
7361 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
7362 *) tlook="^$1\$"; tf=libc.list; tc=""; tdc="()";;
7363 esac;
7364 tx=yes;
7365 case "$reuseval-$4" in
7366 true-) ;;
7367 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7368 esac;
7369 case "$tx" in
7370 yes)
7371         tval=false;
7372         if $test "$runnm" = true; then
7373                 if $contains $tlook $tf >/dev/null 2>&1; then
7374                         tval=true;
7375                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7376                         echo "int main() { extern void *$1$tdc; if (&$1$tc) return(0); else return(1); }" > try.c;
7377                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7378                         $test "$mistrustnm" = run -a -x try && { $run ./try >/dev/null 2>&1 || tval=false; };
7379                         $rm -f try try.c core;
7380                 fi;
7381         else
7382                 echo "#include <stdio.h>" > try.c;
7383                 echo "int main() { extern void *$1$tdc; if(&$1$tc) return(0); else return(1); }" > try.c;
7384                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7385                 $rm -f try try.c;
7386         fi;
7387         ;;
7388 *)
7389         case "$tval" in
7390         $define) tval=true;;
7391         *) tval=false;;
7392         esac;
7393         ;;
7394 esac;
7395 eval "$2=$tval"'
7396
7397 : define an is-in-libc? function
7398 inlibc='echo " "; td=$define; tu=$undef;
7399 sym=$1; var=$2; eval "was=\$$2";
7400 tx=yes;
7401 case "$reuseval$was" in
7402 true) ;;
7403 true*) tx=no;;
7404 esac;
7405 case "$tx" in
7406 yes)
7407         set $sym tres -f;
7408         eval $csym;
7409         case "$tres" in
7410         true)
7411                 echo "$sym() found." >&4;
7412                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7413         *)
7414                 echo "$sym() NOT found." >&4;
7415                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7416         esac;;
7417 *)
7418         case "$was" in
7419         $define) echo "$sym() found." >&4;;
7420         *) echo "$sym() NOT found." >&4;;
7421         esac;;
7422 esac'
7423
7424 : see if dlopen exists
7425 xxx_runnm="$runnm"
7426 runnm=false
7427 set dlopen d_dlopen
7428 eval $inlibc
7429 runnm="$xxx_runnm"
7430
7431 : determine which dynamic loading, if any, to compile in
7432 echo " "
7433 dldir="ext/DynaLoader"
7434 case "$usedl" in
7435 $define|y|true)
7436         dflt='y'
7437         usedl="$define"
7438         ;;
7439 $undef|n|false)
7440         dflt='n'
7441         usedl="$undef"
7442         ;;
7443 *) 
7444         dflt='n'
7445         case "$d_dlopen" in
7446             $define) dflt='y' ;;
7447         esac
7448         case "$i_dld" in
7449             $define) dflt='y' ;;
7450         esac
7451         : Does a dl_xxx.xs file exist for this operating system
7452         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7453         ;;
7454 esac
7455 rp="Do you wish to use dynamic loading?"
7456 . ./myread
7457 usedl="$ans"
7458 case "$ans" in
7459 y*) usedl="$define"
7460         case "$dlsrc" in
7461         '')
7462                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7463                         dflt="$dldir/dl_${osname}.xs"
7464                 elif $test "$d_dlopen" = "$define" ; then
7465                         dflt="$dldir/dl_dlopen.xs"
7466                 elif $test "$i_dld" = "$define" ; then
7467                         dflt="$dldir/dl_dld.xs"
7468                 else
7469                         dflt=''
7470                 fi
7471                 ;;
7472         *)      dflt="$dldir/$dlsrc"
7473                 ;;
7474         esac
7475     echo "The following dynamic loading files are available:"
7476         : Can not go over to $dldir because getfile has path hard-coded in.
7477         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7478         rp="Source file to use for dynamic loading"
7479         fn="fne"
7480         gfpth="$src"
7481         . ./getfile
7482         usedl="$define"
7483         : emulate basename
7484         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7485
7486         $cat << EOM
7487
7488 Some systems may require passing special flags to $cc -c to
7489 compile modules that will be used to create a shared library.
7490 To use no flags, say "none".
7491
7492 EOM
7493     case "$cccdlflags" in
7494     '') case "$gccversion" in
7495                 '') case "$osname" in
7496                         hpux)   dflt='+z' ;;
7497                         next)   dflt='none' ;;
7498                         irix*)  dflt='-KPIC' ;;
7499                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7500                         sunos)  dflt='-pic' ;;
7501                         *)      dflt='none' ;;
7502                     esac
7503                         ;;
7504                 *)  case "$osname" in
7505                         darwin) dflt='none' ;;
7506                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7507                         *)      dflt='-fpic' ;;
7508                     esac ;;
7509             esac ;;
7510         ' ') dflt='none' ;;
7511     *)  dflt="$cccdlflags" ;;
7512     esac
7513     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7514     . ./myread
7515     case "$ans" in
7516     none) cccdlflags=' ' ;;
7517     *) cccdlflags="$ans" ;;
7518     esac
7519
7520     cat << EOM
7521
7522 Some systems use ld to create libraries that can be dynamically loaded,
7523 while other systems (such as those using ELF) use $cc.
7524
7525 EOM
7526         case "$ld" in
7527         '')     $cat >try.c <<EOM
7528 /* Test for whether ELF binaries are produced */
7529 #include <fcntl.h>
7530 #$i_stdlib I_STDLIB
7531 #ifdef I_STDLIB
7532 #include <stdlib.h>
7533 #endif
7534 int main() {
7535         char b[4];
7536         int i = open("a.out",O_RDONLY);
7537         if(i == -1) 
7538                 exit(1); /* fail */
7539         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7540                 exit(0); /* succeed (yes, it's ELF) */
7541         else
7542                 exit(1); /* fail */
7543 }
7544 EOM
7545                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7546                         cat <<EOM
7547 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7548 EOM
7549                         dflt="$cc"
7550                 else
7551                         echo "I'll use ld to build dynamic libraries."
7552                         dflt='ld'
7553                 fi
7554                 rm -f try.c a.out
7555                 ;;
7556         *)      dflt="$ld"
7557                 ;;
7558         esac
7559
7560     rp="What command should be used to create dynamic libraries?"
7561     . ./myread
7562         ld="$ans"
7563
7564     cat << EOM
7565
7566 Some systems may require passing special flags to $ld to create a
7567 library that can be dynamically loaded.  If your ld flags include
7568 -L/other/path options to locate libraries outside your loader's normal
7569 search path, you may need to specify those -L options here as well.  To
7570 use no flags, say "none".
7571
7572 EOM
7573     case "$lddlflags" in
7574     '') case "$osname" in
7575                         beos) dflt='-nostart' ;;
7576                         hpux) dflt='-b';
7577                               case "$gccversion" in
7578                               '') dflt="$dflt +vnocompatwarnings" ;;
7579                               esac
7580                               ;;        
7581                         linux|irix*)    dflt='-shared' ;;
7582                         next)  dflt='none' ;;
7583                         solaris) dflt='-G' ;;
7584                         sunos) dflt='-assert nodefinitions' ;;
7585                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7586                 *)     dflt='none' ;;
7587                         esac
7588                         ;;
7589     *) dflt="$lddlflags" ;;
7590     esac
7591
7592         : Try to guess additional flags to pick up local libraries.
7593         : Be careful not to append to a plain 'none'
7594         case "$dflt" in
7595         none) dflt='' ;;
7596         esac
7597         for thisflag in $ldflags; do
7598                 case "$thisflag" in
7599                 -L*|-R*|-Wl,-R*)
7600                         case " $dflt " in
7601                         *" $thisflag "*) ;;
7602                         *) dflt="$dflt $thisflag" ;;
7603                         esac
7604                         ;;
7605                 esac
7606         done
7607
7608         case "$dflt" in
7609         ''|' ') dflt='none' ;;
7610         esac
7611
7612     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7613     . ./myread
7614     case "$ans" in
7615     none) lddlflags=' ' ;;
7616     *) lddlflags="$ans" ;;
7617     esac
7618
7619         cat <<EOM
7620
7621 Some systems may require passing special flags to $cc to indicate that
7622 the resulting executable will use dynamic linking.  To use no flags,
7623 say "none".
7624
7625 EOM
7626     case "$ccdlflags" in
7627     '') case "$osname" in
7628                 hpux)   dflt='-Wl,-E' ;;
7629                 linux)  dflt='-rdynamic' ;;
7630                 next)   dflt='none' ;;
7631                 sunos)  dflt='none' ;;
7632                 *)      dflt='none' ;;
7633             esac ;;
7634     ' ')  dflt='none' ;;
7635     *)  dflt="$ccdlflags" ;;
7636     esac
7637     rp="Any special flags to pass to $cc to use dynamic linking?"
7638     . ./myread
7639     case "$ans" in
7640     none) ccdlflags=' ' ;;
7641     *) ccdlflags="$ans" ;;
7642     esac
7643     ;;
7644 *)  usedl="$undef"
7645         ld='ld'
7646     dlsrc='dl_none.xs'
7647     lddlflags=''
7648     ccdlflags=''
7649     ;;
7650 esac
7651
7652 also=''
7653 case "$usedl" in
7654 $undef)
7655         # No dynamic loading being used, so don't bother even to prompt.
7656         useshrplib='false'
7657         ;;
7658 *)      case "$useshrplib" in
7659         '')     case "$osname" in
7660                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7661                         dflt=y
7662                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7663                         ;;
7664                 next*)
7665                         case "$osvers" in
7666                         4*)     dflt=y
7667                                 also='Building a shared libperl is needed for MAB support.'
7668                                 ;;
7669                         *)      dflt=n
7670                                 ;;
7671                         esac
7672                         ;;
7673                 *)      dflt=n
7674                         ;;
7675                 esac
7676                 ;;
7677         $define|true|[Yy]*)
7678                 dflt=y
7679                 ;;
7680         *)      dflt=n
7681                 ;;
7682         esac
7683         $cat << EOM
7684
7685 The perl executable is normally obtained by linking perlmain.c with
7686 libperl${_a}, any static extensions (usually just DynaLoader), and
7687 any other libraries needed on this system (such as -lm, etc.).  Since
7688 your system supports dynamic loading, it is probably possible to build
7689 a shared libperl.$so.  If you will have more than one executable linked
7690 to libperl.$so, this will significantly reduce the size of each
7691 executable, but it may have a noticeable affect on performance.  The
7692 default is probably sensible for your system.
7693 $also
7694
7695 EOM
7696         rp="Build a shared libperl.$so (y/n)"
7697         . ./myread
7698         case "$ans" in
7699         true|$define|[Yy]*)
7700                 useshrplib='true'  ;;
7701         *)      useshrplib='false' ;;
7702         esac
7703         ;;
7704 esac
7705
7706 case "$useshrplib" in
7707 true)
7708         case "$libperl" in
7709         '')
7710                 # Figure out a good name for libperl.so.  Since it gets stored in
7711                 # a version-specific architecture-dependent library, the version
7712                 # number isn't really that important, except for making cc/ld happy.
7713                 #
7714                 # A name such as libperl.so.3.1
7715                 majmin="libperl.$so.$patchlevel.$subversion"
7716                 # A name such as libperl.so.301
7717                 majonly=`echo $patchlevel $subversion |
7718                         $awk '{printf "%d%02d", $1, $2}'`
7719                 majonly=libperl.$so.$majonly
7720                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7721                 # rely on figuring it out from the naming of libc.
7722                 case "${osname}${osvers}" in
7723                 next4*)
7724                         dflt=libperl.5.$so
7725                         # XXX How handle the --version stuff for MAB?
7726                         ;;
7727                 linux*)  # ld won't link with a bare -lperl otherwise.
7728                         dflt=libperl.$so
7729                         ;;
7730                 cygwin*) # ld links against an importlib
7731                         dflt=libperl$lib_ext
7732                         ;;
7733                 *)      # Try to guess based on whether libc has major.minor.
7734                         case "$libc" in
7735                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7736                         *libc.$so.[0-9]*) dflt=$majonly ;;
7737                         *)      dflt=libperl.$so ;;
7738                         esac
7739                         ;;
7740                 esac
7741                 ;;
7742         *)      dflt=$libperl
7743                 ;;
7744         esac
7745         cat << EOM
7746
7747 I need to select a good name for the shared libperl.  If your system uses
7748 library names with major and minor numbers, then you might want something
7749 like $majmin.  Alternatively, if your system uses a single version
7750 number for shared libraries, then you might want to use $majonly.
7751 Or, your system might be quite happy with a simple libperl.$so.
7752
7753 Since the shared libperl will get installed into a version-specific
7754 architecture-dependent directory, the version number of the shared perl
7755 library probably isn't important, so the default should be o.k.
7756
7757 EOM
7758         rp='What name do you want to give to the shared libperl?'
7759         . ./myread
7760         libperl=$ans
7761         echo "Ok, I'll use $libperl"
7762         ;;
7763 *)
7764         libperl="libperl${_a}"
7765         ;;
7766 esac
7767
7768 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7769 case "$shrpdir" in
7770 '') ;;
7771 *)      $cat >&4 <<EOM
7772 WARNING:  Use of the shrpdir variable for the installation location of
7773 the shared $libperl is not supported.  It was never documented and
7774 will not work in this version.  Let me (perlbug@perl.org)
7775 know of any problems this may cause.
7776
7777 EOM
7778         case "$shrpdir" in
7779         "$archlibexp/CORE")
7780                 $cat >&4 <<EOM
7781 But your current setting of $shrpdir is
7782 the default anyway, so it's harmless.
7783 EOM
7784                 ;;
7785         *)
7786                 $cat >&4 <<EOM
7787 Further, your current attempted setting of $shrpdir
7788 conflicts with the value of $archlibexp/CORE
7789 that installperl will use.
7790 EOM
7791                 ;;
7792         esac
7793         ;;
7794 esac
7795
7796 # How will the perl executable find the installed shared $libperl?
7797 # Add $xxx to ccdlflags.
7798 # If we can't figure out a command-line option, use $shrpenv to
7799 # set env LD_RUN_PATH.  The main perl makefile uses this.
7800 shrpdir=$archlibexp/CORE
7801 xxx=''
7802 tmp_shrpenv=''
7803 if "$useshrplib"; then
7804     case "$osname" in 
7805         aix)
7806                 # We'll set it in Makefile.SH...
7807                 ;;
7808         solaris)
7809                 xxx="-R $shrpdir"
7810                 ;;
7811         freebsd|netbsd|openbsd)
7812                 xxx="-Wl,-R$shrpdir"
7813                 ;;
7814         bsdos|linux|irix*|dec_osf)
7815                 xxx="-Wl,-rpath,$shrpdir"
7816                 ;;
7817         next)
7818                 # next doesn't like the default...
7819                 ;;
7820         beos)
7821                 # beos doesn't like the default, either.
7822                 ;;
7823         hpux*)
7824                 # hpux doesn't like the default, either.
7825                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7826                 ;;
7827         *)
7828                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7829                 ;;
7830         esac
7831         case "$xxx" in
7832         '') ;;
7833         *)      
7834                 # Only add $xxx if it isn't already in ccdlflags.
7835                 case " $ccdlflags " in
7836                 *" $xxx "*)     ;;
7837                 *)      ccdlflags="$ccdlflags $xxx"
7838                         cat <<EOM >&4
7839
7840 Adding $xxx to the flags
7841 passed to $ld so that the perl executable will find the 
7842 installed shared $libperl.
7843
7844 EOM
7845                         ;;
7846                 esac
7847                 ;;
7848         esac
7849 fi
7850 # Fix ccdlflags in AIX for building external extensions.
7851 # (For building Perl itself bare -bE:perl.exp is needed,
7852 #  Makefile.SH takes care of this.)
7853 case "$osname" in
7854 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7855 esac
7856 # Respect a hint or command-line value.
7857 case "$shrpenv" in
7858 '') shrpenv="$tmp_shrpenv" ;;
7859 esac
7860 case "$ldlibpthname" in
7861 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7862 none)   ldlibpthname='' ;;
7863 esac
7864
7865 : determine where manual pages are on this system
7866 echo " "
7867 case "$sysman" in
7868 '') 
7869         syspath='/usr/share/man/man1 /usr/man/man1'
7870         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7871         syspath="$syspath /usr/man/u_man/man1"
7872         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7873         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7874         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7875         sysman=`./loc . /usr/man/man1 $syspath`
7876         ;;
7877 esac
7878 if $test -d "$sysman"; then
7879         echo "System manual is in $sysman." >&4
7880 else
7881         echo "Could not find manual pages in source form." >&4
7882 fi
7883
7884 : determine where manual pages go
7885 set man1dir man1dir none
7886 eval $prefixit
7887 $cat <<EOM
7888
7889 $spackage has manual pages available in source form.
7890 EOM
7891 case "$nroff" in
7892 nroff)
7893         echo "However, you don't have nroff, so they're probably useless to you."
7894         case "$man1dir" in
7895         '') man1dir="none";;
7896         esac;;
7897 esac
7898 echo "If you don't want the manual sources installed, answer 'none'."
7899 case "$man1dir" in
7900 ' ') dflt=none
7901         ;;
7902 '')
7903         lookpath="$prefixexp/share/man/man1"
7904         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7905         lookpath="$lookpath $prefixexp/man/p_man/man1"
7906         lookpath="$lookpath $prefixexp/man/u_man/man1"
7907         lookpath="$lookpath $prefixexp/man/man.1"
7908         case "$sysman" in
7909         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7910         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7911         esac
7912         set dflt
7913         eval $prefixup
7914         ;;
7915 *)  dflt="$man1dir"
7916         ;;
7917 esac
7918 echo " "
7919 fn=dn+~
7920 rp="Where do the main $spackage manual pages (source) go?"
7921 . ./getfile
7922 if $test "X$man1direxp" != "X$ansexp"; then
7923         installman1dir=''
7924 fi
7925 man1dir="$ans"
7926 man1direxp="$ansexp"
7927 case "$man1dir" in
7928 '')     man1dir=' '
7929         installman1dir='';;
7930 esac
7931
7932 : Change installation prefix, if necessary.
7933 if $test X"$prefix" != X"$installprefix"; then
7934         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
7935 else
7936         installman1dir="$man1direxp"
7937 fi
7938
7939 : What suffix to use on installed man pages
7940
7941 case "$man1dir" in
7942 ' ')
7943         man1ext='0'
7944         ;;
7945 *)
7946         rp="What suffix should be used for the main $spackage man pages?"
7947         case "$man1ext" in
7948         '')     case "$man1dir" in
7949                 *1)  dflt=1 ;;
7950                 *1p) dflt=1p ;;
7951                 *1pm) dflt=1pm ;;
7952                 *l) dflt=l;;
7953                 *n) dflt=n;;
7954                 *o) dflt=o;;
7955                 *p) dflt=p;;
7956                 *C) dflt=C;;
7957                 *L) dflt=L;;
7958                 *L1) dflt=L1;;
7959                 *) dflt=1;;
7960                 esac
7961                 ;;
7962         *)      dflt="$man1ext";;
7963         esac
7964         . ./myread
7965         man1ext="$ans"
7966         ;;
7967 esac
7968
7969 : see if we can have long filenames
7970 echo " "
7971 first=123456789abcdef
7972 $rm -f $first
7973 if (echo hi >$first) 2>/dev/null; then
7974         if $test -f 123456789abcde; then
7975                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
7976                 val="$undef"
7977         else
7978                 echo 'You can have filenames longer than 14 characters.'>&4
7979                 val="$define"
7980         fi
7981 else
7982         $cat <<'EOM'
7983 You can't have filenames longer than 14 chars.
7984 You can't even think about them!
7985 EOM
7986         val="$undef"
7987 fi 
7988 set d_flexfnam
7989 eval $setvar
7990 $rm -rf 123456789abcde*
7991
7992 : determine where library module manual pages go
7993 set man3dir man3dir none
7994 eval $prefixit
7995 $cat <<EOM
7996
7997 $spackage has manual pages for many of the library modules.
7998 EOM
7999
8000 case "$nroff" in
8001 nroff)
8002         $cat <<'EOM'
8003 However, you don't have nroff, so they're probably useless to you.
8004 EOM
8005         case "$man3dir" in
8006         '') man3dir="none";;
8007         esac;;
8008 esac
8009
8010 case "$d_flexfnam" in
8011 undef)
8012         $cat <<'EOM'
8013 However, your system can't handle the long file names like File::Basename.3. 
8014 EOM
8015         case "$man3dir" in
8016         '') man3dir="none";;
8017         esac;;
8018 esac
8019
8020 echo "If you don't want the manual sources installed, answer 'none'."
8021 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8022 case "$man3dir" in
8023 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8024         if $test -d "$privlib/man/man3"; then
8025                 cat <<EOM >&4
8026
8027 WARNING:  Previous versions of perl installed man3 pages into
8028 $privlib/man/man3.  This version will suggest a 
8029 new default of $dflt.  
8030 EOM
8031                 tdflt=$dflt
8032                 dflt='n'
8033                 rp='Do you wish to preserve the old behavior?(y/n)'
8034                 . ./myread
8035                 case "$ans" in
8036                 y*) dflt="$privlib/man/man3" ;;
8037                 *)  dflt=$tdflt ;;
8038                 esac
8039     fi
8040         ;;
8041 *)      dflt="$man3dir" ;;
8042 esac
8043 case "$dflt" in
8044 ' ') dflt=none ;;
8045 esac
8046 echo " "
8047 fn=dn+~
8048 rp="Where do the $package library man pages (source) go?"
8049 . ./getfile
8050 man3dir="$ans"
8051 man3direxp="$ansexp"
8052 case "$man3dir" in
8053 '')     man3dir=' '
8054         installman3dir='';;
8055 esac
8056
8057 : Change installation prefix, if necessary.
8058 if $test X"$prefix" != X"$installprefix"; then
8059         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8060 else
8061         installman3dir="$man3direxp"
8062 fi
8063
8064 : What suffix to use on installed man pages
8065 case "$man3dir" in
8066 ' ')
8067         man3ext='0'
8068         ;;
8069 *)
8070         rp="What suffix should be used for the $package library man pages?"
8071         case "$man3ext" in
8072         '')     case "$man3dir" in
8073                 *3)  dflt=3 ;;
8074                 *3p) dflt=3p ;;
8075                 *3pm) dflt=3pm ;;
8076                 *l) dflt=l;;
8077                 *n) dflt=n;;
8078                 *o) dflt=o;;
8079                 *p) dflt=p;;
8080                 *C) dflt=C;;
8081                 *L) dflt=L;;
8082                 *L3) dflt=L3;;
8083                 *) dflt=3;;
8084                 esac
8085                 ;;
8086         *)      dflt="$man3ext";;
8087         esac
8088         . ./myread
8089         man3ext="$ans"
8090         ;;
8091 esac
8092
8093 : see if we have to deal with yellow pages, now NIS.
8094 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8095         if $test -f /usr/etc/nibindd; then
8096                 echo " "
8097                 echo "I'm fairly confident you're on a NeXT."
8098                 echo " "
8099                 rp='Do you get the hosts file via NetInfo?'
8100                 dflt=y
8101                 case "$hostcat" in
8102                 nidump*) ;;
8103                 '') ;;
8104                 *) dflt=n;;
8105                 esac
8106                 . ./myread
8107                 case "$ans" in
8108                 y*) hostcat='nidump hosts .';;
8109                 *)      case "$hostcat" in
8110                         nidump*) hostcat='';;
8111                         esac
8112                         ;;
8113                 esac
8114         fi
8115         case "$hostcat" in
8116         nidump*) ;;
8117         *)
8118                 case "$hostcat" in
8119                 *ypcat*) dflt=y;;
8120                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8121                                 dflt=y
8122                         else
8123                                 dflt=n
8124                         fi;;
8125                 *) dflt=n;;
8126                 esac
8127                 echo " "
8128                 rp='Are you getting the hosts file via yellow pages?'
8129                 . ./myread
8130                 case "$ans" in
8131                 y*) hostcat='ypcat hosts';;
8132                 *) hostcat='cat /etc/hosts';;
8133                 esac
8134                 ;;
8135         esac
8136 fi
8137 case "$hostcat" in
8138 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8139 esac
8140 case "$groupcat" in
8141 '') test -f /etc/group && groupcat='cat /etc/group';;
8142 esac
8143 case "$passcat" in
8144 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8145 esac
8146
8147 : now get the host name
8148 echo " "
8149 echo "Figuring out host name..." >&4
8150 case "$myhostname" in
8151 '') cont=true
8152         echo 'Maybe "hostname" will work...'
8153         if tans=`sh -c hostname 2>&1` ; then
8154                 myhostname=$tans
8155                 phostname=hostname
8156                 cont=''
8157         fi
8158         ;;
8159 *) cont='';;
8160 esac
8161 if $test "$cont"; then
8162         if ./xenix; then
8163                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8164                 if tans=`cat /etc/systemid 2>&1` ; then
8165                         myhostname=$tans
8166                         phostname='cat /etc/systemid'
8167                         echo "Whadyaknow.  Xenix always was a bit strange..."
8168                         cont=''
8169                 fi
8170         elif $test -r /etc/systemid; then
8171                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8172         fi
8173 fi
8174 if $test "$cont"; then
8175         echo 'No, maybe "uuname -l" will work...'
8176         if tans=`sh -c 'uuname -l' 2>&1` ; then
8177                 myhostname=$tans
8178                 phostname='uuname -l'
8179         else
8180                 echo 'Strange.  Maybe "uname -n" will work...'
8181                 if tans=`sh -c 'uname -n' 2>&1` ; then
8182                         myhostname=$tans
8183                         phostname='uname -n'
8184                 else
8185                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8186                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8187                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8188                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8189                         else
8190                                 case "$myhostname" in
8191                                 '') echo "Does this machine have an identity crisis or something?"
8192                                         phostname='';;
8193                                 *)
8194                                         echo "Well, you said $myhostname before..."
8195                                         phostname='echo $myhostname';;
8196                                 esac
8197                         fi
8198                 fi
8199         fi
8200 fi
8201 case "$myhostname" in
8202 '') myhostname=noname ;;
8203 esac
8204 : you do not want to know about this
8205 set $myhostname
8206 myhostname=$1
8207
8208 : verify guess
8209 if $test "$myhostname" ; then
8210         dflt=y
8211         rp='Your host name appears to be "'$myhostname'".'" Right?"
8212         . ./myread
8213         case "$ans" in
8214         y*) ;;
8215         *) myhostname='';;
8216         esac
8217 fi
8218
8219 : bad guess or no guess
8220 while $test "X$myhostname" = X ; do
8221         dflt=''
8222         rp="Please type the (one word) name of your host:"
8223         . ./myread
8224         myhostname="$ans"
8225 done
8226
8227 : translate upper to lower if necessary
8228 case "$myhostname" in
8229 *[A-Z]*)
8230         echo "(Normalizing case in your host name)"
8231         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8232         ;;
8233 esac
8234
8235 case "$myhostname" in
8236 *.*)
8237         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8238         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8239         echo "(Trimming domain name from host name--host name is now $myhostname)"
8240         ;;
8241 *) case "$mydomain" in
8242         '')
8243                 {
8244                         test "X$hostcat" = "Xypcat hosts" &&
8245                         ypmatch "$myhostname" hosts 2>/dev/null |\
8246                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8247                         $test -s hosts
8248                 } || {
8249                         test "X$hostcat" != "X" &&
8250                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8251                                         /[       ]$myhostname[  . ]/p" > hosts
8252                 }
8253                 tmp_re="[       . ]"
8254                 if $test -f hosts; then
8255                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8256                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8257                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8258                                 hosts | $sort | $uniq | \
8259                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8260                         case `$echo X$dflt` in
8261                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8262                                 dflt=.
8263                                 ;;
8264                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8265                                 ;;
8266                         esac
8267                 else
8268                         echo "(I cannot locate a hosts database anywhere)"
8269                         dflt=.
8270                 fi
8271                 case "$dflt" in
8272                 .)
8273                         tans=`./loc resolv.conf X /etc /usr/etc`
8274                         if $test -f "$tans"; then
8275                                 echo "(Attempting domain name extraction from $tans)"
8276                                 dflt=.`$sed -n -e 's/   / /g' \
8277                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8278                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8279                                 case "$dflt" in
8280                                 .) dflt=.`$sed -n -e 's/        / /g' \
8281                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8282                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8283                                         ;;
8284                                 esac
8285                         fi
8286                         ;;
8287                 esac
8288                 case "$dflt" in
8289                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8290                         dflt=.`sh -c domainname 2>/dev/null`
8291                         case "$dflt" in
8292                         '') dflt='.';;
8293                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8294                         esac
8295                         ;;
8296                 esac
8297                 case "$dflt$osname" in
8298                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8299                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8300                         ;;
8301                 esac
8302                 case "$dflt" in
8303                 .) echo "(Lost all hope -- silly guess then)"
8304                         dflt='.nonet'
8305                         ;;
8306                 esac
8307                 $rm -f hosts
8308                 ;;
8309         *) dflt="$mydomain";;
8310         esac;;
8311 esac
8312 echo " "
8313 rp="What is your domain name?"
8314 . ./myread
8315 tans="$ans"
8316 case "$ans" in
8317 '') ;;
8318 .*) ;;
8319 *) tans=".$tans";;
8320 esac
8321 mydomain="$tans"
8322
8323 : translate upper to lower if necessary
8324 case "$mydomain" in
8325 *[A-Z]*)
8326         echo "(Normalizing case in your domain name)"
8327         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8328         ;;
8329 esac
8330
8331 : a little sanity check here
8332 case "$phostname" in
8333 '') ;;
8334 *)
8335         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8336         $myhostname$mydomain|$myhostname) ;;
8337         *)
8338                 case "$phostname" in
8339                 sed*)
8340                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8341                         ;;
8342                 *)
8343                         echo "(That doesn't agree with your $phostname command, by the way.)"
8344                         ;;
8345                 esac
8346         ;;
8347         esac
8348         ;;
8349 esac
8350
8351 $cat <<EOM
8352
8353 I need to get your e-mail address in Internet format if possible, i.e.
8354 something like user@host.domain. Please answer accurately since I have
8355 no easy means to double check it. The default value provided below
8356 is most probably close to reality but may not be valid from outside
8357 your organization...
8358
8359 EOM
8360 cont=x
8361 while test "$cont"; do
8362         case "$cf_email" in
8363         '') dflt="$cf_by@$myhostname$mydomain";;
8364         *) dflt="$cf_email";;
8365         esac
8366         rp='What is your e-mail address?'
8367         . ./myread
8368         cf_email="$ans"
8369         case "$cf_email" in
8370         *@*.*) cont='' ;;
8371         *)
8372                 rp='Address does not look like an Internet one.  Use it anyway?'
8373                 case "$fastread" in
8374                 yes) dflt=y ;;
8375                 *) dflt=n ;;
8376                 esac
8377                 . ./myread
8378                 case "$ans" in
8379                 y*) cont='' ;;
8380                 *) echo " " ;;
8381                 esac
8382                 ;;
8383         esac
8384 done
8385
8386 $cat <<EOM
8387
8388 If you or somebody else will be maintaining perl at your site, please
8389 fill in the correct e-mail address here so that they may be contacted
8390 if necessary. Currently, the "perlbug" program included with perl
8391 will send mail to this address in addition to perlbug@perl.org. You may
8392 enter "none" for no administrator.
8393
8394 EOM
8395 case "$perladmin" in
8396 '') dflt="$cf_email";;
8397 *) dflt="$perladmin";;
8398 esac
8399 rp='Perl administrator e-mail address'
8400 . ./myread
8401 perladmin="$ans"
8402
8403 : determine whether to only install version-specific parts.
8404 echo " "
8405 $cat <<EOM
8406 Do you want to install only the version-specific parts of the perl
8407 distribution?  Usually you do *not* want to do this.
8408 EOM
8409 case "$versiononly" in
8410 "$define"|[Yy]*|true) dflt='y' ;;
8411 *) dflt='n';
8412 esac
8413 rp="Do you want to install only the version-specific parts of perl?"
8414 . ./myread
8415 case "$ans" in
8416 [yY]*)  val="$define";;
8417 *)      val="$undef" ;;
8418 esac
8419 set versiononly
8420 eval $setvar
8421
8422 case "$versiononly" in
8423 "$define") inc_version_list=''
8424            inc_version_list_init=0
8425            ;;
8426 esac
8427
8428 : figure out how to guarantee perl startup
8429 case "$startperl" in
8430 '')
8431         case "$sharpbang" in
8432         *!)
8433                 $cat <<EOH
8434
8435 I can use the #! construct to start perl on your system. This will
8436 make startup of perl scripts faster, but may cause problems if you
8437 want to share those scripts and perl is not in a standard place
8438 ($binexp/perl) on all your platforms. The alternative is to force
8439 a shell by starting the script with a single ':' character.
8440
8441 EOH
8442                 case "$versiononly" in
8443                 "$define")      dflt="$binexp/perl$version";;  
8444                 *)              dflt="$binexp/perl";;
8445                 esac
8446                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8447                 . ./myread
8448                 case "$ans" in
8449                 none)   startperl=": # use perl";;
8450                 *)      startperl="#!$ans"
8451                         if $test 30 -lt `echo "$ans" | wc -c`; then
8452                                 $cat >&4 <<EOM
8453
8454 WARNING:  Some systems limit the #! command to 32 characters.
8455 If you experience difficulty running Perl scripts with #!, try
8456 installing Perl in a directory with a shorter pathname.
8457
8458 EOM
8459                         fi ;;
8460                 esac
8461                 ;;
8462         *) startperl=": # use perl"
8463                 ;;
8464         esac
8465         ;;
8466 esac
8467 echo "I'll use $startperl to start perl scripts."
8468
8469 : figure best path for perl in scripts
8470 case "$perlpath" in
8471 '')
8472         case "$versiononly" in
8473         "$define")      perlpath="$binexp/perl$version";;
8474         *)              perlpath="$binexp/perl";;
8475         esac
8476         case "$startperl" in
8477         *!*) ;;
8478         *)
8479                 $cat <<EOH
8480
8481 I will use the "eval 'exec'" idiom to start Perl on your system.
8482 I can use the full path of your Perl binary for this purpose, but
8483 doing so may cause problems if you want to share those scripts and
8484 Perl is not always in a standard place ($binexp/perl).
8485
8486 EOH
8487                 dflt="$binexp/perl"
8488                 rp="What path shall I use in \"eval 'exec'\"?"
8489                 . ./myread
8490                 perlpath="$ans"
8491                 ;;
8492         esac
8493         ;;
8494 esac
8495 case "$startperl" in
8496 *!*)    ;;
8497 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8498 esac
8499
8500 : determine where public executable scripts go
8501 set scriptdir scriptdir
8502 eval $prefixit
8503 case "$scriptdir" in
8504 '')
8505         dflt="$bin"
8506         : guess some guesses
8507         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8508         $test -d /usr/share/bin     && dflt=/usr/share/bin
8509         $test -d /usr/local/script  && dflt=/usr/local/script
8510         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8511         $test -d $prefixexp/script  && dflt=$prefixexp/script
8512         set dflt
8513         eval $prefixup
8514         ;;
8515 *)  dflt="$scriptdir"
8516         ;;
8517 esac
8518 $cat <<EOM
8519  
8520 Some installations have a separate directory just for executable scripts so
8521 that they can mount it across multiple architectures but keep the scripts in
8522 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8523 Or you might just lump your scripts in with all your other executables.
8524  
8525 EOM
8526 fn=d~
8527 rp='Where do you keep publicly executable scripts?'
8528 . ./getfile
8529 if $test "X$ansexp" != "X$scriptdirexp"; then
8530         installscript=''
8531 fi
8532 scriptdir="$ans"
8533 scriptdirexp="$ansexp"
8534 : Change installation prefix, if necessary.
8535 if $test X"$prefix" != X"$installprefix"; then
8536         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8537 else
8538         installscript="$scriptdirexp"
8539 fi
8540
8541 : determine where add-on public executables go
8542 case "$sitebin" in
8543 '')     dflt=$siteprefix/bin ;;
8544 *)      dflt=$sitebin ;;
8545 esac
8546 fn=d~
8547 rp='Pathname where the add-on public executables should be installed?'
8548 . ./getfile
8549 sitebin="$ans"
8550 sitebinexp="$ansexp"
8551 : Change installation prefix, if necessary.
8552 if $test X"$prefix" != X"$installprefix"; then
8553         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8554 else
8555         installsitebin="$sitebinexp"
8556 fi
8557
8558 : determine where add-on html pages go
8559 : There is no standard location, so try to copy the previously-selected 
8560 : directory structure for the core html pages.
8561 case "$sitehtml1" in
8562 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8563 *)      dflt=$sitehtml1 ;;
8564 esac
8565 case "$dflt" in
8566 ''|' ') dflt=none ;;
8567 esac
8568 fn=dn+~
8569 rp='Pathname where the site-specific html pages should be installed?'
8570 . ./getfile
8571 sitehtml1="$ans"
8572 sitehtml1exp="$ansexp"
8573 : Use ' ' for none so value is preserved next time through Configure
8574 $test X"$sitehtml1" = "X" && sitehtml1=' '
8575 : Change installation prefix, if necessary.
8576 if $test X"$prefix" != X"$installprefix"; then
8577         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8578 else
8579         installsitehtml1="$sitehtml1exp"
8580 fi
8581
8582 : determine where add-on library html pages go
8583 : There is no standard location, so try to copy the previously-selected
8584 : directory structure for the core html pages.
8585 case "$sitehtml3" in
8586 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8587 *)      dflt=$sitehtml3 ;;
8588 esac
8589 case "$dflt" in
8590 ''|' ') dflt=none ;;
8591 esac
8592 fn=dn+~
8593 rp='Pathname where the site-specific library html pages should be installed?'
8594 . ./getfile
8595 sitehtml3="$ans"
8596 sitehtml3exp="$ansexp"
8597 : Use ' ' for none so value is preserved next time through Configure
8598 $test X"$sitehtml3" = "X" && sitehtml3=' '
8599 : Change installation prefix, if necessary.
8600 if $test X"$prefix" != X"$installprefix"; then
8601         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8602 else
8603         installsitehtml3="$sitehtml3exp"
8604 fi
8605
8606 : determine where add-on manual pages go
8607 case "$siteman1" in
8608 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8609 *)      dflt=$siteman1 ;;
8610 esac
8611 case "$dflt" in
8612 ''|' ') dflt=none ;;
8613 esac
8614 fn=dn+~
8615 rp='Pathname where the site-specific manual pages should be installed?'
8616 . ./getfile
8617 siteman1="$ans"
8618 siteman1exp="$ansexp"
8619 : Use ' ' for none so value is preserved next time through Configure
8620 $test X"$siteman1" = "X" && siteman1=' '
8621 : Change installation prefix, if necessary.
8622 if $test X"$prefix" != X"$installprefix"; then
8623         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8624 else
8625         installsiteman1="$siteman1exp"
8626 fi
8627
8628 : determine where add-on library man pages go
8629 case "$siteman3" in
8630 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8631 *)      dflt=$siteman3 ;;
8632 esac
8633 case "$dflt" in
8634 ''|' ') dflt=none ;;
8635 esac
8636 fn=dn+~
8637 rp='Pathname where the site-specific library manual pages should be installed?'
8638 . ./getfile
8639 siteman3="$ans"
8640 siteman3exp="$ansexp"
8641 : Use ' ' for none so value is preserved next time through Configure
8642 $test X"$siteman3" = "X" && siteman3=' '
8643 : Change installation prefix, if necessary.
8644 if $test X"$prefix" != X"$installprefix"; then
8645         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8646 else
8647         installsiteman3="$siteman3exp"
8648 fi
8649
8650 : determine where add-on public executable scripts go
8651 case "$sitescript" in
8652 '')     dflt=$siteprefix/script
8653         $test -d $dflt || dflt=$sitebin ;;
8654 *)  dflt="$sitescript" ;;
8655 esac
8656 fn=d~+
8657 rp='Pathname where add-on public executable scripts should be installed?'
8658 . ./getfile
8659 sitescript="$ans"
8660 sitescriptexp="$ansexp"
8661 : Change installation prefix, if necessary.
8662 if $test X"$prefix" != X"$installprefix"; then
8663         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8664 else
8665         installsitescript="$sitescriptexp"
8666 fi
8667
8668 case "$usefaststdio" in
8669 $define|true|[yY]*|'')
8670         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8671         case "$xversion" in
8672         [68])   dflt='y' ;;
8673         *)      dflt='n' ;;
8674         esac
8675         ;;
8676 *) dflt='n';;
8677 esac
8678 cat <<EOM
8679
8680 Perl can be built to use 'fast stdio', which means using the stdio
8681 library but also directly manipulating the stdio buffers to enable
8682 faster I/O.  Using stdio is better for backward compatibility (especially
8683 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8684 interface has been preferred instead of stdio.
8685
8686 If this doesn't make any sense to you, just accept the default '$dflt'.
8687 EOM
8688 rp='Use the "fast stdio" if available?'
8689 . ./myread
8690 case "$ans" in
8691 y|Y)    val="$define" ;;     
8692 *)      val="$undef" ;;
8693 esac
8694 set usefaststdio
8695 eval $setvar
8696
8697
8698 : define an is-a-typedef? function
8699 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8700 case "$inclist" in
8701 "") inclist="sys/types.h";;
8702 esac;
8703 eval "varval=\$$var";
8704 case "$varval" in
8705 "")
8706         $rm -f temp.c;
8707         for inc in $inclist; do
8708                 echo "#include <$inc>" >>temp.c;
8709         done;
8710         echo "#ifdef $type" >> temp.c;
8711         echo "printf(\"We have $type\");" >> temp.c;
8712         echo "#endif" >> temp.c;
8713         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8714         if $contains $type temp.E >/dev/null 2>&1; then
8715                 eval "$var=\$type";
8716         else
8717                 eval "$var=\$def";
8718         fi;
8719         $rm -f temp.?;;
8720 *) eval "$var=\$varval";;
8721 esac'
8722
8723 : define an is-a-typedef? function that prompts if the type is not available.
8724 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8725 case "$inclist" in
8726 "") inclist="sys/types.h";;
8727 esac;
8728 eval "varval=\$$var";
8729 case "$varval" in
8730 "")
8731         $rm -f temp.c;
8732         for inc in $inclist; do
8733                 echo "#include <$inc>" >>temp.c;
8734         done;
8735         echo "#ifdef $type" >> temp.c;
8736         echo "printf(\"We have $type\");" >> temp.c;
8737         echo "#endif" >> temp.c;
8738         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8739         echo " " ;
8740         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8741         if $contains $type temp.E >/dev/null 2>&1; then
8742                 echo "$type found." >&4;
8743                 eval "$var=\$type";
8744         else
8745                 echo "$type NOT found." >&4;
8746                 dflt="$def";
8747                 . ./myread ;
8748                 eval "$var=\$ans";
8749         fi;
8750         $rm -f temp.?;;
8751 *) eval "$var=\$varval";;
8752 esac'
8753
8754 : see what type lseek is declared as in the kernel
8755 rp="What is the type used for lseek's offset on this system?"
8756 set off_t lseektype long stdio.h sys/types.h
8757 eval $typedef_ask
8758
8759 echo " "
8760 echo "Checking to see how big your file offsets are..." >&4
8761 $cat >try.c <<EOCP
8762 #include <sys/types.h>
8763 #include <stdio.h>
8764 int main()
8765 {
8766     printf("%d\n", (int)sizeof($lseektype));
8767     return(0); 
8768 }
8769 EOCP
8770 set try
8771 if eval $compile_ok; then
8772         lseeksize=`$run ./try`
8773         echo "Your file offsets are $lseeksize bytes long."
8774 else
8775         dflt=$longsize
8776         echo " "
8777         echo "(I can't seem to compile the test program.  Guessing...)"
8778         rp="What is the size of your file offsets (in bytes)?"
8779         . ./myread
8780         lseeksize="$ans"
8781 fi
8782 $rm -f try.c try
8783
8784 : see what type file positions are declared as in the library
8785 rp="What is the type for file position used by fsetpos()?"
8786 set fpos_t fpostype long stdio.h sys/types.h
8787 eval $typedef_ask
8788
8789 echo " "
8790 case "$fpostype" in
8791 *_t) zzz="$fpostype"    ;;
8792 *)   zzz="fpos_t"       ;;
8793 esac
8794 echo "Checking the size of $zzz..." >&4 
8795 cat > try.c <<EOCP
8796 #include <sys/types.h>
8797 #include <stdio.h>
8798 #$i_stdlib I_STDLIB
8799 #ifdef I_STDLIB
8800 #include <stdlib.h>
8801 #endif
8802 int main() {
8803     printf("%d\n", (int)sizeof($fpostype));
8804     exit(0);
8805 }
8806 EOCP
8807 set try
8808 if eval $compile_ok; then
8809         yyy=`$run ./try`
8810         case "$yyy" in
8811         '')     fpossize=4
8812                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8813                 ;;
8814         *)      fpossize=$yyy
8815                 echo "Your $zzz is $fpossize bytes long."
8816                 ;;
8817         esac
8818 else
8819         dflt="$longsize"
8820         echo " " >&4
8821         echo "(I can't compile the test program.  Guessing...)" >&4
8822         rp="What is the size of your file positions (in bytes)?"
8823         . ./myread
8824         fpossize="$ans"
8825 fi
8826
8827 # Backward compatibility (uselfs is deprecated).
8828 case "$uselfs" in
8829 "$define"|true|[yY]*)
8830         cat <<EOM >&4
8831
8832 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8833 EOM
8834         uselargefiles="$define"
8835         ;;
8836 esac                          
8837
8838 case "$lseeksize:$fpossize" in
8839 8:8) cat <<EOM
8840
8841 You can have files larger than 2 gigabytes.
8842 EOM
8843    val="$define" ;;
8844 *)    case "$uselargefiles" in
8845    "$undef"|false|[nN]*) dflt='n' ;;
8846    *)   dflt='y' ;;
8847    esac
8848    cat <<EOM
8849
8850 Perl can be built to understand large files (files larger than 2 gigabytes)
8851 on some systems.  To do so, Configure can be run with -Duselargefiles.
8852
8853 If this doesn't make any sense to you, just accept the default '$dflt'.
8854 EOM
8855    rp='Try to understand large files, if available?'
8856    . ./myread
8857    case "$ans" in
8858    y|Y)         val="$define" ;;
8859    *)           val="$undef"  ;;
8860    esac
8861    ;;
8862 esac
8863 set uselargefiles
8864 eval $setvar
8865 case "$uselargefiles" in
8866 "$define")
8867 : Look for a hint-file generated 'call-back-unit'.  If the
8868 : user has specified that a large files perl is to be built,
8869 : we may need to set or change some other defaults.
8870         if $test -f uselargefiles.cbu; then
8871                 echo "Your platform has some specific hints for large file builds, using them..."
8872                 . ./uselargefiles.cbu
8873                 echo " "
8874                 echo "Rechecking to see how big your file offsets are..." >&4
8875                 $cat >try.c <<EOCP
8876 #include <sys/types.h>
8877 #include <stdio.h>
8878 int main()
8879 {
8880     printf("%d\n", (int)sizeof($lseektype));
8881     return(0); 
8882 }
8883 EOCP
8884                 set try
8885                 if eval $compile_ok; then
8886                         lseeksize=`$run ./try`
8887                         $echo "Your file offsets are now $lseeksize bytes long."
8888                 else
8889                         dflt="$lseeksize"
8890                         echo " "
8891                         echo "(I can't seem to compile the test program.  Guessing...)"
8892                         rp="What is the size of your file offsets (in bytes)?"
8893                         . ./myread
8894                         lseeksize="$ans"
8895                 fi
8896                 case "$fpostype" in
8897                 *_t) zzz="$fpostype"    ;;
8898                 *)   zzz="fpos_t"       ;;
8899                 esac
8900                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8901                 $cat > try.c <<EOCP
8902 #include <sys/types.h>
8903 #include <stdio.h>
8904 #$i_stdlib I_STDLIB
8905 #ifdef I_STDLIB
8906 #include <stdlib.h>
8907 #endif
8908 int main() {
8909     printf("%d\n", (int)sizeof($fpostype));
8910     return(0);
8911 }
8912 EOCP
8913                 set try
8914                 if eval $compile_ok; then
8915                         yyy=`$run ./try`
8916                         dflt="$lseeksize"
8917                         case "$yyy" in
8918                         '')     echo " "
8919                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8920                                 ;;
8921                         *)      fpossize=$yyy
8922                                 echo " $fpossize bytes." >&4
8923                                 ;;
8924                         esac
8925                 else
8926                         dflt="$fpossize"
8927                         echo " "
8928                         echo "(I can't compile the test program.  Guessing...)" >&4
8929                         rp="What is the size of your file positions (in bytes)?"
8930                         . ./myread
8931                         fpossize="$ans"
8932                 fi
8933                 $rm -f try.c try
8934         fi
8935         ;;
8936 esac
8937
8938 case "$vendorprefix" in
8939 '')     d_vendorbin="$undef"
8940         vendorbin=''
8941         vendorbinexp=''
8942         ;;
8943 *)      d_vendorbin="$define"
8944         : determine where vendor-supplied executables go.
8945         case "$vendorbin" in
8946         '') dflt=$vendorprefix/bin ;;
8947         *)      dflt="$vendorbin" ;;
8948         esac
8949         fn=d~+
8950         rp='Pathname for the vendor-supplied executables directory?'
8951         . ./getfile
8952         vendorbin="$ans"
8953         vendorbinexp="$ansexp"
8954         ;;
8955 esac
8956 : Change installation prefix, if necessary.
8957 if $test X"$prefix" != X"$installprefix"; then
8958         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
8959 else
8960         installvendorbin="$vendorbinexp"
8961 fi
8962
8963 case "$vendorprefix" in
8964 '')     vendorhtml1=''
8965         vendorhtml1exp=''
8966         ;;
8967 *)      : determine where vendor-supplied html pages go.
8968         : There is no standard location, so try to copy the previously-selected
8969         : directory structure for the core html pages.
8970         : XXX Better default suggestions would be welcome.
8971         case "$vendorhtml1" in
8972         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8973         *)      dflt=$vendorhtml1 ;;
8974         esac
8975         case "$dflt" in
8976         ''|' ') dflt=none ;;
8977         esac
8978         fn=dn+~
8979         rp='Pathname for the vendor-supplied html pages?'
8980         . ./getfile
8981         vendorhtml1="$ans"
8982         vendorhtml1exp="$ansexp"
8983         ;;
8984 esac
8985 : Use ' ' for none so value is preserved next time through Configure
8986 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
8987 : Change installation prefix, if necessary.
8988 if $test X"$prefix" != X"$installprefix"; then
8989         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
8990 else
8991         installvendorhtml1="$vendorhtml1exp"
8992 fi
8993
8994 case "$vendorprefix" in
8995 '')     vendorhtml3=''
8996         vendorhtml3exp=''
8997         ;;
8998 *)      : determine where vendor-supplied module html pages go.
8999         : There is no standard location, so try to copy the previously-selected
9000         : directory structure for the core html pages.
9001         : XXX Better default suggestions would be welcome.
9002         case "$vendorhtml3" in
9003         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9004         *)      dflt=$vendorhtml3 ;;
9005         esac
9006         case "$dflt" in
9007         ''|' ') dflt=none ;;
9008         esac
9009         fn=dn+~
9010         rp='Pathname for the vendor-supplied html pages?'
9011         . ./getfile
9012         vendorhtml3="$ans"
9013         vendorhtml3exp="$ansexp"
9014         ;;
9015 esac
9016 : Use ' ' for none so value is preserved next time through Configure
9017 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9018 : Change installation prefix, if necessary.
9019 if $test X"$prefix" != X"$installprefix"; then
9020         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9021 else
9022         installvendorhtml3="$vendorhtml3exp"
9023 fi
9024
9025 case "$vendorprefix" in
9026 '')     vendorman1=''
9027         vendorman1exp=''
9028         ;;
9029 *)      : determine where vendor-supplied manual pages go.
9030         case "$vendorman1" in
9031         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9032         *)      dflt=$vendorman1 ;;
9033         esac
9034         case "$dflt" in
9035         ''|' ') dflt=none ;;
9036         esac
9037         fn=nd~+
9038         rp='Pathname for the vendor-supplied manual section 1 pages?'
9039         . ./getfile
9040         vendorman1="$ans"
9041         vendorman1exp="$ansexp"
9042         ;;
9043 esac
9044 : Use ' ' for none so value is preserved next time through Configure
9045 $test X"$vendorman1" = "X" && vendorman1=' '
9046 : Change installation prefix, if necessary.
9047 if $test X"$prefix" != X"$installprefix"; then
9048         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9049 else
9050         installvendorman1="$vendorman1exp"
9051 fi
9052
9053 case "$vendorprefix" in
9054 '')     vendorman3=''
9055         vendorman3exp=''
9056         ;;
9057 *)      : determine where vendor-supplied module manual pages go.
9058         case "$vendorman3" in
9059         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9060         *)      dflt=$vendorman3 ;;
9061         esac
9062         case "$dflt" in
9063         ''|' ') dflt=none ;;
9064         esac
9065         fn=nd~+
9066         rp='Pathname for the vendor-supplied manual section 3 pages?'
9067         . ./getfile
9068         vendorman3="$ans"
9069         vendorman3exp="$ansexp"
9070         ;;
9071 esac
9072 : Use ' ' for none so value is preserved next time through Configure
9073 $test X"$vendorman3" = "X" && vendorman3=' '
9074 : Change installation prefix, if necessary.
9075 if $test X"$prefix" != X"$installprefix"; then
9076         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9077 else
9078         installvendorman3="$vendorman3exp"
9079 fi
9080
9081 case "$vendorprefix" in
9082 '')     d_vendorscript="$undef"
9083         vendorscript=''
9084         vendorscriptexp=''
9085         ;;
9086 *)      d_vendorscript="$define"
9087         : determine where vendor-supplied scripts go.
9088         case "$vendorscript" in
9089         '')     dflt=$vendorprefix/script
9090                 $test -d $dflt || dflt=$vendorbin ;;
9091         *)  dflt="$vendorscript" ;;
9092         esac
9093         $cat <<EOM
9094
9095 The installation process will create a directory for 
9096 vendor-supplied scripts.
9097
9098 EOM
9099         fn=d~+
9100         rp='Pathname for the vendor-supplied scripts directory?'
9101         . ./getfile
9102         vendorscript="$ans"
9103         vendorscriptexp="$ansexp"
9104         ;;
9105 esac
9106 : Change installation prefix, if necessary.
9107 if $test X"$prefix" != X"$installprefix"; then
9108         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9109 else
9110         installvendorscript="$vendorscriptexp"
9111 fi
9112
9113 : see if qgcvt exists
9114 set qgcvt d_qgcvt
9115 eval $inlibc
9116
9117 echo " "
9118
9119 if $test X"$d_longdbl" = X"$define"; then
9120
9121 echo "Checking how to print long doubles..." >&4
9122
9123 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9124         $cat >try.c <<'EOCP'
9125 #include <sys/types.h>
9126 #include <stdio.h>
9127 int main() {
9128   double d = 123.456;
9129   printf("%.3f\n", d);
9130 }
9131 EOCP
9132         set try
9133         if eval $compile; then
9134                 yyy=`$run ./try`
9135                 case "$yyy" in
9136                 123.456)
9137                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9138                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9139                         echo "We will use %f."
9140                         ;;
9141                 esac
9142         fi
9143 fi
9144
9145 if $test X"$sPRIfldbl" = X; then
9146         $cat >try.c <<'EOCP'
9147 #include <sys/types.h>
9148 #include <stdio.h>
9149 int main() {
9150   long double d = 123.456;
9151   printf("%.3Lf\n", d);
9152 }
9153 EOCP
9154         set try
9155         if eval $compile; then
9156                 yyy=`$run ./try`
9157                 case "$yyy" in
9158                 123.456)
9159                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9160                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9161                         echo "We will use %Lf."
9162                         ;;
9163                 esac
9164         fi
9165 fi
9166
9167 if $test X"$sPRIfldbl" = X; then
9168         $cat >try.c <<'EOCP'
9169 #include <sys/types.h>
9170 #include <stdio.h>
9171 int main() {
9172   long double d = 123.456;
9173   printf("%.3llf\n", d);
9174 }
9175 EOCP
9176         set try
9177         if eval $compile; then
9178                 yyy=`$run ./try`
9179                 case "$yyy" in
9180                 123.456)
9181                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9182                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9183                         echo "We will use %llf."
9184                         ;;
9185                 esac
9186         fi
9187 fi
9188
9189 if $test X"$sPRIfldbl" = X; then
9190         $cat >try.c <<'EOCP'
9191 #include <sys/types.h>
9192 #include <stdio.h>
9193 int main() {
9194   long double d = 123.456;
9195   printf("%.3lf\n", d);
9196 }
9197 EOCP
9198         set try
9199         if eval $compile; then
9200                 yyy=`$run ./try`
9201                 case "$yyy" in
9202                 123.456)
9203                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9204                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9205                         echo "We will use %lf."
9206                         ;;
9207                 esac
9208         fi
9209 fi
9210
9211 if $test X"$sPRIfldbl" = X; then
9212         echo "Cannot figure out how to print long doubles." >&4
9213 else
9214         sSCNfldbl=$sPRIfldbl    # expect consistency
9215 fi
9216
9217 $rm -f try try.*
9218
9219 fi # d_longdbl
9220
9221 case "$sPRIfldbl" in
9222 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9223         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9224         d_SCNfldbl="$undef";
9225         ;;
9226 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9227         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9228         d_SCNfldbl="$define";
9229         ;;
9230 esac
9231
9232 : Check how to convert floats to strings.
9233
9234 if test "X$d_Gconvert" = X; then
9235
9236 echo " "
9237 echo "Checking for an efficient way to convert floats to strings."
9238 echo " " > try.c
9239 case "$uselongdouble" in
9240 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9241 esac
9242 case "$d_longdbl" in
9243 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9244 esac
9245 case "$d_PRIgldbl" in
9246 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9247 esac
9248 $cat >>try.c <<EOP
9249 #ifdef TRY_gconvert
9250 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9251 char *myname = "gconvert";
9252 #endif
9253 #ifdef TRY_gcvt
9254 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9255 char *myname = "gcvt";
9256 #endif
9257 #ifdef TRY_qgcvt
9258 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9259 char *myname = "qgcvt";
9260 #define DOUBLETYPE long double
9261 #endif
9262 #ifdef TRY_sprintf
9263 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9264 #ifdef HAS_PRIgldbl
9265 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9266 #else
9267 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9268 #endif
9269 #else
9270 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9271 #endif
9272 char *myname = "sprintf";
9273 #endif
9274
9275 #ifndef DOUBLETYPE
9276 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9277 #define DOUBLETYPE long double
9278 #else
9279 #define DOUBLETYPE double
9280 #endif
9281 #endif
9282
9283 #include <stdio.h>
9284
9285 #define I_STDLIB $i_stdlib
9286 #ifdef I_STDLIB
9287 #include <stdlib.h>
9288 #endif
9289
9290 int
9291 checkit(expect, got)
9292 char *expect;
9293 char *got;
9294 {
9295     if (strcmp(expect, got)) {
9296                 printf("%s oddity:  Expected %s, got %s\n",
9297                         myname, expect, got);
9298                 exit(1);
9299         }
9300 }
9301
9302 int main()
9303
9304         char buf[64]; 
9305         buf[63] = '\0';
9306
9307         /* This must be 1st test on (which?) platform */
9308         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9309         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9310         checkit("0.1", buf);
9311
9312         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9313         checkit("0.01", buf);
9314
9315         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9316         checkit("0.001", buf);
9317
9318         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9319         checkit("0.0001", buf);
9320
9321         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9322         if (strlen(buf) > 5)
9323             checkit("9e-005", buf); /* for Microsoft ?? */
9324         else
9325             checkit("9e-05", buf);
9326
9327         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9328         checkit("1", buf);
9329
9330         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9331         checkit("1.1", buf);
9332
9333         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9334         checkit("1.01", buf);
9335
9336         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9337         checkit("1.001", buf);
9338
9339         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9340         checkit("1.0001", buf);
9341
9342         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9343         checkit("1.00001", buf);
9344
9345         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9346         checkit("1.000001", buf);
9347
9348         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9349         checkit("0", buf);
9350
9351         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9352         checkit("-1", buf);
9353
9354         /* Some Linux gcvt's give 1.e+5 here. */
9355         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9356         checkit("100000", buf);
9357         
9358         /* Some Linux gcvt's give -1.e+5 here. */
9359         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9360         checkit("-100000", buf);
9361
9362         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9363         checkit("123.456", buf);
9364
9365         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9366         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9367         /* 34 should be enough to scare even long double
9368          * places into using the e notation. */
9369         if (strlen(buf) > 5)
9370             checkit("1e+034", buf); /* for Microsoft */
9371         else
9372             checkit("1e+34", buf);
9373
9374         /* For Perl, if you add additional tests here, also add them to
9375          * t/base/num.t for benefit of platforms not using Configure or
9376          * overriding d_Gconvert */
9377
9378         exit(0);
9379 }
9380 EOP
9381 : first add preferred functions to our list
9382 xxx_list=""
9383 for xxx_convert in $gconvert_preference; do
9384     case $xxx_convert in
9385     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9386     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9387     esac 
9388 done
9389 : then add any others
9390 for xxx_convert in gconvert gcvt sprintf; do
9391     case "$xxx_list" in
9392     *$xxx_convert*) ;;
9393     *) xxx_list="$xxx_list $xxx_convert" ;;
9394     esac 
9395 done
9396
9397 case "$d_longdbl$uselongdouble" in
9398 "$define$define")
9399     : again, add prefered functions to our list first
9400     xxx_ld_list=""
9401     for xxx_convert in $gconvert_ld_preference; do
9402         case $xxx_convert in
9403         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9404         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9405         esac
9406     done
9407     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9408     for xxx_convert in qgcvt sprintf $xxx_list; do
9409         case "$xxx_ld_list" in
9410         $xxx_convert*|*" $xxx_convert"*) ;;
9411         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9412         esac
9413     done
9414     : if sprintf cannot do long doubles, move it to the end
9415     if test "$d_PRIgldbl" != "$define"; then
9416         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9417     fi
9418     : if no qgcvt, remove it
9419     if test "$d_qgcvt" != "$define"; then
9420         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9421     fi
9422     : use the ld_list
9423     xxx_list="$xxx_ld_list"
9424     ;;
9425 esac
9426
9427 for xxx_convert in $xxx_list; do
9428         echo "Trying $xxx_convert..."
9429         $rm -f try try$_o
9430         set try -DTRY_$xxx_convert
9431         if eval $compile; then
9432                 echo "$xxx_convert() found." >&4
9433                 if $run ./try; then
9434                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9435                         break;
9436                 else
9437                         echo "...But $xxx_convert didn't work as I expected."
9438                         xxx_convert=''
9439                 fi
9440         else
9441                 echo "$xxx_convert NOT found." >&4
9442         fi
9443 done
9444
9445 if test X$xxx_convert = X; then
9446     echo "*** WHOA THERE!!! ***" >&4
9447     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9448     xxx_convert=sprintf
9449 fi
9450
9451 case "$xxx_convert" in
9452 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9453 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9454 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9455 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9456    "$define$define$define")
9457       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9458    "$define$define$undef")
9459       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9460    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9461    esac
9462    ;;  
9463 esac
9464
9465 fi
9466
9467 : see if _fwalk exists
9468 set fwalk d__fwalk
9469 eval $inlibc
9470
9471 : Initialize h_fcntl
9472 h_fcntl=false
9473
9474 : Initialize h_sysfile
9475 h_sysfile=false
9476
9477 : access call always available on UNIX
9478 set access d_access
9479 eval $inlibc
9480
9481 : locate the flags for 'access()'
9482 case "$d_access" in
9483 "$define")
9484         echo " "
9485         $cat >access.c <<EOCP
9486 #include <sys/types.h>
9487 #ifdef I_FCNTL
9488 #include <fcntl.h>
9489 #endif
9490 #ifdef I_SYS_FILE
9491 #include <sys/file.h>
9492 #endif
9493 #ifdef I_UNISTD
9494 #include <unistd.h>
9495 #endif
9496 #$i_stdlib I_STDLIB
9497 #ifdef I_STDLIB
9498 #include <stdlib.h>
9499 #endif
9500 int main() {
9501         exit(R_OK);
9502 }
9503 EOCP
9504         : check sys/file.h first, no particular reason here
9505         if $test `./findhdr sys/file.h` && \
9506                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9507                 h_sysfile=true;
9508                 echo "<sys/file.h> defines the *_OK access constants." >&4
9509         elif $test `./findhdr fcntl.h` && \
9510                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9511                 h_fcntl=true;
9512                 echo "<fcntl.h> defines the *_OK access constants." >&4
9513         elif $test `./findhdr unistd.h` && \
9514                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9515                 echo "<unistd.h> defines the *_OK access constants." >&4
9516         else
9517                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9518         fi
9519         ;;
9520 esac
9521 $rm -f access*
9522
9523 : see if accessx exists
9524 set accessx d_accessx
9525 eval $inlibc
9526
9527 : see if aintl exists
9528 set aintl d_aintl
9529 eval $inlibc
9530
9531 : see if alarm exists
9532 set alarm d_alarm
9533 eval $inlibc
9534
9535 : see if POSIX threads are available
9536 set pthread.h i_pthread
9537 eval $inhdr
9538
9539 : define a fucntion to check prototypes
9540 $cat > protochk <<EOSH
9541 $startsh
9542 cc="$cc"
9543 optimize="$optimize"
9544 ccflags="$ccflags"
9545 prototype="$prototype"
9546 define="$define"
9547 rm=$rm
9548 usethreads=$usethreads
9549 i_pthread=$i_pthread
9550 pthread_h_first=$pthread_h_first
9551 EOSH
9552
9553 $cat >> protochk <<'EOSH'
9554
9555 $rm -f try.c
9556 foo="$1"
9557 shift
9558 while test $# -ge 2; do
9559         case "$1" in
9560                 $define) echo "#include <$2>" >> try.c ;;
9561                 literal) echo "$2" >> try.c ;;
9562         esac
9563     # Extra magic for the benefit of systems that need pthread.h
9564     # to be included early to correctly detect threadsafe functions.
9565     # Such functions must guarantee themselves, though, that the usethreads
9566     # and i_pthread have been defined, before calling protochk.
9567     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9568         echo "#include <pthread.h>" >> try.c
9569         pthread_h_done=yes
9570     fi
9571     shift 2
9572 done
9573 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9574 cat >> try.c <<'EOCP'
9575 #ifdef CAN_PROTOTYPE
9576 #define _(args) args
9577 #else
9578 #define _(args) ()
9579 #endif
9580 EOCP
9581 echo "$foo" >> try.c
9582 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9583 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9584 status=$?
9585 $rm -f try.[co]
9586 exit $status
9587 EOSH
9588 chmod +x protochk
9589 $eunicefix protochk
9590
9591 hasproto='varname=$1; func=$2; shift; shift;
9592 while $test $# -ge 2; do
9593         case "$1" in
9594         $define) echo "#include <$2>";;
9595         esac ;
9596     shift 2;
9597 done > try.c;
9598 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9599 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9600         echo "$func() prototype found.";
9601         val="$define";
9602 else
9603         echo "$func() prototype NOT found.";
9604         val="$undef";
9605 fi;
9606 set $varname;
9607 eval $setvar;
9608 $rm -f try.c tryout.c'
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 #$i_stdlib I_STDLIB
9656 #ifdef I_STDLIB
9657 #include <stdlib.h>
9658 #endif
9659 int main()
9660 {
9661         struct tm foo;
9662 #ifdef S_TIMEVAL
9663         struct timeval bar;
9664 #endif
9665 #ifdef S_TIMEZONE
9666         struct timezone tzp;
9667 #endif
9668         if (foo.tm_sec == foo.tm_sec)
9669                 exit(0);
9670 #ifdef S_TIMEVAL
9671         if (bar.tv_sec == bar.tv_sec)
9672                 exit(0);
9673 #endif
9674         exit(1);
9675 }
9676 EOCP
9677         flags=''
9678         for s_timezone in '-DS_TIMEZONE' ''; do
9679         sysselect=''
9680         for s_timeval in '-DS_TIMEVAL' ''; do
9681         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9682         for i_time in '' '-DI_TIME'; do
9683         for i_systime in '-DI_SYSTIME' ''; do
9684                 case "$flags" in
9685                 '') $echo $n ".$c"
9686                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9687                         if eval $compile; then
9688                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9689                                 shift
9690                                 flags="$*"
9691                                 echo " "
9692                                 $echo $n "Succeeded with $flags$c"
9693                         fi
9694                         ;;
9695                 esac
9696         done
9697         done
9698         done
9699         done
9700         done
9701         timeincl=''
9702         echo " "
9703         case "$flags" in
9704         *SYSTIMEKERNEL*) i_systimek="$define"
9705                 timeincl=`./findhdr sys/time.h`
9706                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9707         *) i_systimek="$undef";;
9708         esac
9709         case "$flags" in
9710         *I_TIME*) i_time="$define"
9711                 timeincl=`./findhdr time.h`" $timeincl"
9712                 echo "We'll include <time.h>." >&4;;
9713         *) i_time="$undef";;
9714         esac
9715         case "$flags" in
9716         *I_SYSTIME*) i_systime="$define"
9717                 timeincl=`./findhdr sys/time.h`" $timeincl"
9718                 echo "We'll include <sys/time.h>." >&4;;
9719         *) i_systime="$undef";;
9720         esac
9721         $rm -f try.c try
9722 fi
9723 : see if struct tm knows about tm_zone
9724 case "$i_systime$i_time" in
9725 *$define*) 
9726         echo " "
9727         echo "Checking to see if your struct tm has tm_zone field..." >&4
9728         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9729         eval $hasfield
9730         ;;
9731 *)      val="$undef"
9732         set d_tm_tm_zone
9733         eval $setvar
9734         ;;
9735 esac
9736 case "$d_tm_tm_zone" in
9737 "$define")      echo "Yes, it does."   ;;
9738 *)              echo "No, it doesn't." ;;
9739 esac
9740 : see if struct tm knows about tm_gmtoff
9741 case "$i_systime$i_time" in
9742 *$define*) 
9743         echo " "
9744         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9745         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9746         eval $hasfield
9747         ;;
9748 *)      val="$undef"
9749         set d_tm_tm_gmtoff
9750         eval $setvar
9751         ;;
9752 esac
9753 case "$d_tm_tm_gmtoff" in
9754 "$define")      echo "Yes, it does."   ;;
9755 *)              echo "No, it doesn't." ;;
9756 esac
9757
9758 : see if asctime_r exists
9759 set asctime_r d_asctime_r
9760 eval $inlibc
9761 case "$d_asctime_r" in
9762 "$define")
9763         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9764         case "$d_asctime_r_proto:$usethreads" in
9765         ":define")      d_asctime_r_proto=define
9766                 set d_asctime_r_proto asctime_r $hdrs
9767                 eval $hasproto ;;
9768         *)      ;;
9769         esac
9770         case "$d_asctime_r_proto" in
9771         define)
9772         case "$asctime_r_proto" in
9773         ''|0) try='char* asctime_r(const struct tm*, char*);'
9774         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9775         esac
9776         case "$asctime_r_proto" in
9777         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9778         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9779         esac
9780         case "$asctime_r_proto" in
9781         ''|0) try='int asctime_r(const struct tm*, char*);'
9782         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9783         esac
9784         case "$asctime_r_proto" in
9785         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9786         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9787         esac
9788         case "$asctime_r_proto" in
9789         ''|0)   d_asctime_r=undef
9790                 asctime_r_proto=0
9791                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9792         * )     case "$asctime_r_proto" in
9793                 REENTRANT_PROTO*) ;;
9794                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9795                 esac
9796                 echo "Prototype: $try" ;;
9797         esac
9798         ;;
9799         *)      case "$usethreads" in
9800                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9801                 esac
9802                 d_asctime_r=undef
9803                 asctime_r_proto=0
9804                 ;;
9805         esac
9806         ;;
9807 *)      asctime_r_proto=0
9808         ;;
9809 esac
9810
9811 : see if atolf exists
9812 set atolf d_atolf
9813 eval $inlibc
9814
9815 : see if atoll exists
9816 set atoll d_atoll
9817 eval $inlibc
9818
9819 : Look for GNU-cc style attribute checking
9820 echo " "
9821 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9822 $cat >attrib.c <<'EOCP'
9823 #include <stdio.h>
9824 void croak (char* pat,...) __attribute__((__format__(__printf__,1,2),noreturn));
9825 EOCP
9826 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9827         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9828                 echo "Your C compiler doesn't fully support __attribute__."
9829                 val="$undef"
9830         else
9831                 echo "Your C compiler supports __attribute__."
9832                 val="$define"
9833         fi
9834 else
9835         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9836         val="$undef"
9837 fi
9838 set d_attribut
9839 eval $setvar
9840 $rm -f attrib*
9841
9842 : see if bcmp exists
9843 set bcmp d_bcmp
9844 eval $inlibc
9845
9846 : see if bcopy exists
9847 set bcopy d_bcopy
9848 eval $inlibc
9849
9850 : see if this is a unistd.h system
9851 set unistd.h i_unistd
9852 eval $inhdr
9853
9854 : see if getpgrp exists
9855 set getpgrp d_getpgrp
9856 eval $inlibc
9857
9858 case "$d_getpgrp" in
9859 "$define")
9860         echo " "
9861         echo "Checking to see which flavor of getpgrp is in use..."
9862         $cat >try.c <<EOP
9863 #$i_unistd I_UNISTD
9864 #include <sys/types.h>
9865 #ifdef I_UNISTD
9866 #  include <unistd.h>
9867 #endif
9868 #$i_stdlib I_STDLIB
9869 #ifdef I_STDLIB
9870 #include <stdlib.h>
9871 #endif
9872 int main()
9873 {
9874         if (getuid() == 0) {
9875                 printf("(I see you are running Configure as super-user...)\n");
9876                 setuid(1);
9877         }
9878 #ifdef TRY_BSD_PGRP
9879         if (getpgrp(1) == 0)
9880                 exit(0);
9881 #else
9882         if (getpgrp() > 0)
9883                 exit(0);
9884 #endif
9885         exit(1);
9886 }
9887 EOP
9888         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9889                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9890                 val="$define"
9891         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9892                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9893                 val="$undef"
9894         else
9895                 echo "I can't seem to compile and run the test program."
9896                 if ./usg; then
9897                         xxx="a USG one, i.e. you use getpgrp()."
9898                 else
9899                         # SVR4 systems can appear rather BSD-ish.
9900                         case "$i_unistd" in
9901                         $undef)
9902                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9903                                 val="$define"
9904                                 ;;
9905                         $define)
9906                                 xxx="probably a USG one, i.e. you use getpgrp()."
9907                                 val="$undef"
9908                                 ;;
9909                         esac
9910                 fi
9911                 echo "Assuming your getpgrp is $xxx" >&4
9912         fi
9913         ;;
9914 *) val="$undef";;
9915 esac
9916 set d_bsdgetpgrp
9917 eval $setvar
9918 $rm -f try try.*
9919
9920 : see if setpgrp exists
9921 set setpgrp d_setpgrp
9922 eval $inlibc
9923
9924 case "$d_setpgrp" in
9925 "$define")
9926         echo " "
9927         echo "Checking to see which flavor of setpgrp is in use..."
9928         $cat >try.c <<EOP
9929 #$i_unistd I_UNISTD
9930 #include <sys/types.h>
9931 #ifdef I_UNISTD
9932 #  include <unistd.h>
9933 #endif
9934 #$i_stdlib I_STDLIB
9935 #ifdef I_STDLIB
9936 #include <stdlib.h>
9937 #endif
9938 int main()
9939 {
9940         if (getuid() == 0) {
9941                 printf("(I see you are running Configure as super-user...)\n");
9942                 setuid(1);
9943         }
9944 #ifdef TRY_BSD_PGRP
9945         if (-1 == setpgrp(1, 1))
9946                 exit(0);
9947 #else
9948         if (setpgrp() != -1)
9949                 exit(0);
9950 #endif
9951         exit(1);
9952 }
9953 EOP
9954         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9955                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9956                 val="$define"
9957         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9958                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9959                 val="$undef"
9960         else
9961                 echo "(I can't seem to compile and run the test program.)"
9962                 if ./usg; then
9963                         xxx="a USG one, i.e. you use setpgrp()."
9964                 else
9965                         # SVR4 systems can appear rather BSD-ish.
9966                         case "$i_unistd" in
9967                         $undef)
9968                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9969                                 val="$define"
9970                                 ;;
9971                         $define)
9972                                 xxx="probably a USG one, i.e. you use setpgrp()."
9973                                 val="$undef"
9974                                 ;;
9975                         esac
9976                 fi
9977                 echo "Assuming your setpgrp is $xxx" >&4
9978         fi
9979         ;;
9980 *) val="$undef";;
9981 esac
9982 set d_bsdsetpgrp
9983 eval $setvar
9984 $rm -f try try.*
9985 : see if bzero exists
9986 set bzero d_bzero
9987 eval $inlibc
9988
9989 : see if signal is declared as pointer to function returning int or void
9990 echo " "
9991 xxx=`./findhdr signal.h`
9992 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
9993 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
9994         echo "You have int (*signal())() instead of void." >&4
9995         val="$undef"
9996 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
9997         echo "You have void (*signal())()." >&4
9998         val="$define"
9999 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10000         echo "You have int (*signal())() instead of void." >&4
10001         val="$undef"
10002 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10003         echo "You have void (*signal())()." >&4
10004         val="$define"
10005 else
10006         case "$d_voidsig" in
10007         '')
10008         echo "I can't determine whether signal handler returns void or int..." >&4
10009                 dflt=void
10010                 rp="What type does your signal handler return?"
10011                 . ./myread
10012                 case "$ans" in
10013                 v*) val="$define";;
10014                 *) val="$undef";;
10015                 esac;;
10016         "$define")
10017                 echo "As you already told me, signal handler returns void." >&4
10018                 val="$define"
10019                 ;;
10020         *)      echo "As you already told me, signal handler returns int." >&4
10021                 val="$undef"
10022                 ;;
10023         esac
10024 fi
10025 set d_voidsig
10026 eval $setvar
10027 case "$d_voidsig" in
10028 "$define") signal_t="void";;
10029 *) signal_t="int";;
10030 esac
10031 $rm -f $$.tmp
10032
10033 : check for ability to cast large floats to 32-bit ints.
10034 echo " "
10035 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10036 if $test "$intsize" -ge 4; then
10037         xxx=int
10038 else
10039         xxx=long
10040 fi
10041 $cat >try.c <<EOCP
10042 #include <stdio.h>
10043 #$i_stdlib I_STDLIB
10044 #ifdef I_STDLIB
10045 #include <stdlib.h>
10046 #endif
10047 #include <sys/types.h>
10048 #include <signal.h>
10049 $signal_t blech(s) int s; { exit(3); }
10050 int main()
10051 {
10052         $xxx i32;
10053         double f, g;
10054         int result = 0;
10055         char str[16];
10056         signal(SIGFPE, blech);
10057
10058         /* Don't let compiler optimize the test away.  Store the number 
10059            in a writable string for gcc to pass to sscanf under HP/UX.
10060         */
10061         sprintf(str, "2147483647");
10062         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10063         g = 10 * f;
10064         i32  = ($xxx) g;
10065
10066         /* x86 processors will probably give 0x8000 0000, which is a
10067        sign change.  We don't want that.  We want to mimic SPARC
10068            behavior here, which is to preserve the sign and give
10069            back 0x7fff ffff.
10070         */
10071         if (i32 != ($xxx) f)
10072                 result |= 1;
10073         exit(result);
10074 }
10075 EOCP
10076 set try
10077 if eval $compile_ok; then
10078         $run ./try
10079         yyy=$?
10080 else
10081         echo "(I can't seem to compile the test program--assuming it can't)"
10082         yyy=1
10083 fi
10084 case "$yyy" in
10085 0)      val="$define"
10086         echo "Yup, it can."
10087         ;;
10088 *)      val="$undef"
10089         echo "Nope, it can't."
10090         ;;
10091 esac
10092 set d_casti32
10093 eval $setvar
10094 $rm -f try try.*
10095
10096 : check for ability to cast negative floats to unsigned
10097 echo " "
10098 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10099 $cat >try.c <<EOCP
10100 #include <stdio.h>
10101 #$i_stdlib I_STDLIB
10102 #ifdef I_STDLIB
10103 #include <stdlib.h>
10104 #endif
10105 #include <sys/types.h>
10106 #include <signal.h>
10107 $signal_t blech(s) int s; { exit(7); }
10108 $signal_t blech_in_list(s) int s; { exit(4); }
10109 unsigned long dummy_long(p) unsigned long p; { return p; }
10110 unsigned int dummy_int(p) unsigned int p; { return p; }
10111 unsigned short dummy_short(p) unsigned short p; { return p; }
10112 int main()
10113 {
10114         double f;
10115         unsigned long along;
10116         unsigned int aint;
10117         unsigned short ashort;
10118         int result = 0;
10119         char str[16];
10120         
10121         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10122            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10123            optimized the whole file away
10124         */
10125         /* Store the number in a writable string for gcc to pass to 
10126            sscanf under HP/UX.
10127         */
10128         sprintf(str, "-123");
10129         sscanf(str, "%lf", &f);  /* f = -123.; */
10130
10131         signal(SIGFPE, blech);
10132         along = (unsigned long)f;
10133         aint = (unsigned int)f;
10134         ashort = (unsigned short)f;
10135         if (along != (unsigned long)-123)
10136                 result |= 1;
10137         if (aint != (unsigned int)-123)
10138                 result |= 1;
10139         if (ashort != (unsigned short)-123)
10140                 result |= 1;
10141         sprintf(str, "1073741824.");
10142         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10143         f = f + f;
10144         along = 0;
10145         along = (unsigned long)f;
10146         if (along != 0x80000000)
10147                 result |= 2;
10148         f -= 1.;
10149         along = 0;
10150         along = (unsigned long)f;
10151         if (along != 0x7fffffff)
10152                 result |= 1;
10153         f += 2.;
10154         along = 0;
10155         along = (unsigned long)f;
10156         if (along != 0x80000001)
10157                 result |= 2;
10158         if (result)
10159                 exit(result);
10160         signal(SIGFPE, blech_in_list);
10161         sprintf(str, "123.");
10162         sscanf(str, "%lf", &f);  /* f = 123.; */
10163         along = dummy_long((unsigned long)f);
10164         aint = dummy_int((unsigned int)f);
10165         ashort = dummy_short((unsigned short)f);
10166         if (along != (unsigned long)123)
10167                 result |= 4;
10168         if (aint != (unsigned int)123)
10169                 result |= 4;
10170         if (ashort != (unsigned short)123)
10171                 result |= 4;
10172         exit(result);
10173
10174 }
10175 EOCP
10176 set try
10177 if eval $compile_ok; then
10178         $run ./try
10179         castflags=$?
10180 else
10181         echo "(I can't seem to compile the test program--assuming it can't)"
10182         castflags=7
10183 fi
10184 case "$castflags" in
10185 0)      val="$define"
10186         echo "Yup, it can."
10187         ;;
10188 *)      val="$undef"
10189         echo "Nope, it can't."
10190         ;;
10191 esac
10192 set d_castneg
10193 eval $setvar
10194 $rm -f try.*
10195
10196 : see if vprintf exists
10197 echo " "
10198 if set vprintf val -f d_vprintf; eval $csym; $val; then
10199         echo 'vprintf() found.' >&4
10200         val="$define"
10201         $cat >try.c <<EOF
10202 #include <varargs.h>
10203 #$i_stdlib I_STDLIB
10204 #ifdef I_STDLIB
10205 #include <stdlib.h>
10206 #endif
10207
10208 int main() { xxx("foo"); }
10209
10210 xxx(va_alist)
10211 va_dcl
10212 {
10213         va_list args;
10214         char buf[10];
10215
10216         va_start(args);
10217         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10218 }
10219 EOF
10220         set try
10221         if eval $compile && $run ./try; then
10222                 echo "Your vsprintf() returns (int)." >&4
10223                 val2="$undef"
10224         else
10225                 echo "Your vsprintf() returns (char*)." >&4
10226                 val2="$define"
10227         fi
10228 else
10229         echo 'vprintf() NOT found.' >&4
10230                 val="$undef"
10231                 val2="$undef"
10232 fi
10233 $rm -f try try.*
10234 set d_vprintf
10235 eval $setvar
10236 val=$val2
10237 set d_charvspr
10238 eval $setvar
10239
10240 : see if chown exists
10241 set chown d_chown
10242 eval $inlibc
10243
10244 : see if chroot exists
10245 set chroot d_chroot
10246 eval $inlibc
10247
10248 : see if chsize exists
10249 set chsize d_chsize
10250 eval $inlibc
10251
10252 : see if class exists
10253 set class d_class
10254 eval $inlibc
10255
10256 hasstruct='varname=$1; struct=$2; shift; shift;
10257 while $test $# -ge 2; do
10258         case "$1" in
10259         $define) echo "#include <$2>";;
10260         esac ;
10261     shift 2;
10262 done > try.c;
10263 echo "int main () { struct $struct foo; }" >> try.c;
10264 set try;
10265 if eval $compile; then
10266         val="$define";
10267 else
10268         val="$undef";
10269 fi;
10270 set $varname;
10271 eval $setvar;
10272 $rm -f try.c try.o'
10273
10274 socketlib=''
10275 sockethdr=''
10276 : see whether socket exists
10277 echo " "
10278 $echo $n "Hmm... $c" >&4
10279 if set socket val -f d_socket; eval $csym; $val; then
10280         echo "Looks like you have Berkeley networking support." >&4
10281         d_socket="$define"
10282         if set setsockopt val -f; eval $csym; $val; then
10283                 d_oldsock="$undef"
10284         else
10285                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10286                 d_oldsock="$define"
10287         fi
10288 else
10289         if $contains socklib libc.list >/dev/null 2>&1; then
10290                 echo "Looks like you have Berkeley networking support." >&4
10291                 d_socket="$define"
10292                 : we will have to assume that it supports the 4.2 BSD interface
10293                 d_oldsock="$undef"
10294         else
10295                 echo "You don't have Berkeley networking in libc$_a..." >&4
10296                 if test "X$d_socket" = "X$define"; then
10297                    echo "...but you seem to believe that you have sockets." >&4
10298                 else
10299                         for net in net socket
10300                         do
10301                                 if test -f /usr/lib/lib$net$_a; then
10302                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10303                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10304                                         if $contains socket libc.list >/dev/null 2>&1; then
10305                                                 d_socket="$define"
10306                                                 socketlib="-l$net"
10307                                                 case "$net" in
10308                                                 net)
10309                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10310                                                         sockethdr="-I/usr/netinclude"
10311                                                         ;;
10312                                                 esac
10313                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10314                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10315                                                         d_oldsock="$undef"
10316                                                 else
10317                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10318                                                         d_oldsock="$define"
10319                                                 fi
10320                                                 break
10321                                         fi
10322                                 fi
10323                         done
10324                         if test "X$d_socket" != "X$define"; then
10325                            echo "or anywhere else I see." >&4
10326                            d_socket="$undef"
10327                            d_oldsock="$undef"
10328                         fi
10329                 fi
10330         fi
10331 fi
10332
10333 : see if socketpair exists
10334 set socketpair d_sockpair
10335 eval $inlibc
10336
10337
10338 echo " "
10339 echo "Checking the availability of certain socket constants..." >&4
10340 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10341         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10342         $cat >try.c <<EOF
10343 #include <sys/types.h>
10344 #include <sys/socket.h>
10345 int main() {
10346     int i = $ENUM;
10347 }
10348 EOF
10349         val="$undef"
10350         set try; if eval $compile; then
10351                 val="$define"
10352         fi
10353         set d_${enum}; eval $setvar
10354         $rm -f try.c try
10355 done
10356
10357 : see if this is a sys/uio.h system
10358 set sys/uio.h i_sysuio
10359 eval $inhdr
10360
10361
10362 echo " "
10363 echo "Checking to see if your system supports struct cmsghdr..." >&4
10364 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10365 eval $hasstruct
10366 case "$d_cmsghdr_s" in
10367 "$define")      echo "Yes, it does."   ;;
10368 *)              echo "No, it doesn't." ;;
10369 esac
10370
10371
10372 : check for const keyword
10373 echo " "
10374 echo 'Checking to see if your C compiler knows about "const"...' >&4
10375 $cat >const.c <<'EOCP'
10376 typedef struct spug { int drokk; } spug;
10377 int main()
10378 {
10379         const char *foo;
10380         const spug y;
10381 }
10382 EOCP
10383 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10384         val="$define"
10385         echo "Yup, it does."
10386 else
10387         val="$undef"
10388         echo "Nope, it doesn't."
10389 fi
10390 set d_const
10391 eval $setvar
10392
10393 : see if copysignl exists
10394 set copysignl d_copysignl
10395 eval $inlibc
10396
10397 : see if crypt exists
10398 echo " "
10399 set crypt d_crypt
10400 eval $inlibc
10401 case "$d_crypt" in
10402 $define) cryptlib='' ;;
10403 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10404                 echo 'crypt() found.' >&4
10405                 val="$define"
10406                 cryptlib=''
10407         else
10408                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10409                 if $test -z "$cryptlib"; then
10410                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10411                 else
10412                         cryptlib=-lcrypt
10413                 fi
10414                 if $test -z "$cryptlib"; then
10415                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10416                 else
10417                         cryptlib=-lcrypt
10418                 fi
10419                 if $test -z "$cryptlib"; then
10420                         cryptlib=`./loc libcrypt$_a "" $libpth`
10421                 else
10422                         cryptlib=-lcrypt
10423                 fi
10424                 if $test -z "$cryptlib"; then
10425                         echo 'crypt() NOT found.' >&4
10426                         val="$undef"
10427                 else
10428                         val="$define"
10429                 fi
10430         fi
10431         set d_crypt
10432         eval $setvar
10433         ;;
10434 esac
10435
10436 : see if this is a crypt.h system
10437 set crypt.h i_crypt
10438 eval $inhdr
10439
10440 : see if crypt_r exists
10441 set crypt_r d_crypt_r
10442 eval $inlibc
10443 case "$d_crypt_r" in
10444 "$define")
10445         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10446         case "$d_crypt_r_proto:$usethreads" in
10447         ":define")      d_crypt_r_proto=define
10448                 set d_crypt_r_proto crypt_r $hdrs
10449                 eval $hasproto ;;
10450         *)      ;;
10451         esac
10452         case "$d_crypt_r_proto" in
10453         define)
10454         case "$crypt_r_proto" in
10455         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10456         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10457         esac
10458         case "$crypt_r_proto" in
10459         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10460         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10461         esac
10462         case "$crypt_r_proto" in
10463         ''|0)   d_crypt_r=undef
10464                 crypt_r_proto=0
10465                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10466         * )     case "$crypt_r_proto" in
10467                 REENTRANT_PROTO*) ;;
10468                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10469                 esac
10470                 echo "Prototype: $try" ;;
10471         esac
10472         ;;
10473         *)      case "$usethreads" in
10474                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10475                 esac
10476                 d_crypt_r=undef
10477                 crypt_r_proto=0
10478                 ;;
10479         esac
10480         ;;
10481 *)      crypt_r_proto=0
10482         ;;
10483 esac
10484
10485 : get csh whereabouts
10486 case "$csh" in
10487 'csh') val="$undef" ;;
10488 *) val="$define" ;;
10489 esac
10490 set d_csh
10491 eval $setvar
10492 : Respect a hint or command line value for full_csh.
10493 case "$full_csh" in
10494 '') full_csh=$csh ;;
10495 esac
10496
10497 : see if ctermid_r exists
10498 set ctermid_r d_ctermid_r
10499 eval $inlibc
10500 case "$d_ctermid_r" in
10501 "$define")
10502         hdrs="$i_systypes sys/types.h define stdio.h "
10503         case "$d_ctermid_r_proto:$usethreads" in
10504         ":define")      d_ctermid_r_proto=define
10505                 set d_ctermid_r_proto ctermid_r $hdrs
10506                 eval $hasproto ;;
10507         *)      ;;
10508         esac
10509         case "$d_ctermid_r_proto" in
10510         define)
10511         case "$ctermid_r_proto" in
10512         ''|0) try='char* ctermid_r(char*);'
10513         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10514         esac
10515         case "$ctermid_r_proto" in
10516         ''|0)   d_ctermid_r=undef
10517                 ctermid_r_proto=0
10518                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10519         * )     case "$ctermid_r_proto" in
10520                 REENTRANT_PROTO*) ;;
10521                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10522                 esac
10523                 echo "Prototype: $try" ;;
10524         esac
10525         ;;
10526         *)      case "$usethreads" in
10527                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10528                 esac
10529                 d_ctermid_r=undef
10530                 ctermid_r_proto=0
10531                 ;;
10532         esac
10533         ;;
10534 *)      ctermid_r_proto=0
10535         ;;
10536 esac
10537
10538 : see if ctime_r exists
10539 set ctime_r d_ctime_r
10540 eval $inlibc
10541 case "$d_ctime_r" in
10542 "$define")
10543         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10544         case "$d_ctime_r_proto:$usethreads" in
10545         ":define")      d_ctime_r_proto=define
10546                 set d_ctime_r_proto ctime_r $hdrs
10547                 eval $hasproto ;;
10548         *)      ;;
10549         esac
10550         case "$d_ctime_r_proto" in
10551         define)
10552         case "$ctime_r_proto" in
10553         ''|0) try='char* ctime_r(const time_t*, char*);'
10554         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10555         esac
10556         case "$ctime_r_proto" in
10557         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10558         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10559         esac
10560         case "$ctime_r_proto" in
10561         ''|0) try='int ctime_r(const time_t*, char*);'
10562         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10563         esac
10564         case "$ctime_r_proto" in
10565         ''|0) try='int ctime_r(const time_t*, char*, int);'
10566         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10567         esac
10568         case "$ctime_r_proto" in
10569         ''|0)   d_ctime_r=undef
10570                 ctime_r_proto=0
10571                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10572         * )     case "$ctime_r_proto" in
10573                 REENTRANT_PROTO*) ;;
10574                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10575                 esac
10576                 echo "Prototype: $try" ;;
10577         esac
10578         ;;
10579         *)      case "$usethreads" in
10580                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10581                 esac
10582                 d_ctime_r=undef
10583                 ctime_r_proto=0
10584                 ;;
10585         esac
10586         ;;
10587 *)      ctime_r_proto=0
10588         ;;
10589 esac
10590
10591 : see if cuserid exists
10592 set cuserid d_cuserid
10593 eval $inlibc
10594
10595 : see if this is a limits.h system
10596 set limits.h i_limits
10597 eval $inhdr
10598
10599 : see if this is a float.h system
10600 set float.h i_float
10601 eval $inhdr
10602
10603 : See if number of significant digits in a double precision number is known
10604 echo " "
10605 $cat >dbl_dig.c <<EOM
10606 #$i_limits I_LIMITS
10607 #$i_float I_FLOAT
10608 #ifdef I_LIMITS
10609 #include <limits.h>
10610 #endif
10611 #ifdef I_FLOAT
10612 #include <float.h>
10613 #endif
10614 #ifdef DBL_DIG
10615 printf("Contains DBL_DIG");
10616 #endif
10617 EOM
10618 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10619 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10620         echo "DBL_DIG found." >&4
10621         val="$define"
10622 else
10623         echo "DBL_DIG NOT found." >&4
10624         val="$undef"
10625 fi
10626 $rm -f dbl_dig.?
10627 set d_dbl_dig
10628 eval $setvar
10629
10630 : see if dbm.h is available
10631 : see if dbmclose exists
10632 set dbmclose d_dbmclose
10633 eval $inlibc
10634
10635 case "$d_dbmclose" in
10636 $define)
10637         set dbm.h i_dbm
10638         eval $inhdr
10639         case "$i_dbm" in
10640         $define)
10641                 val="$undef"
10642                 set i_rpcsvcdbm
10643                 eval $setvar
10644                 ;;
10645         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10646                 eval $inhdr
10647                 ;;
10648         esac
10649         ;;
10650 *)      echo "We won't be including <dbm.h>"
10651         val="$undef"
10652         set i_dbm
10653         eval $setvar
10654         val="$undef"
10655         set i_rpcsvcdbm
10656         eval $setvar
10657         ;;
10658 esac
10659
10660 : see if prototype for dbminit is available
10661 echo " "
10662 set d_dbminitproto dbminit $i_dbm dbm.h
10663 eval $hasproto
10664
10665 : see if difftime exists
10666 set difftime d_difftime
10667 eval $inlibc
10668
10669 : see if this is a dirent system
10670 echo " "
10671 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10672         val="$define"
10673         echo "<dirent.h> found." >&4
10674 else
10675         val="$undef"
10676         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10677                 echo "<sys/dir.h> found." >&4
10678                 echo " "
10679         else
10680                 xinc=`./findhdr sys/ndir.h`
10681         fi
10682         echo "<dirent.h> NOT found." >&4
10683 fi
10684 set i_dirent
10685 eval $setvar
10686
10687 : Look for type of directory structure.
10688 echo " "
10689 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10690
10691 case "$direntrytype" in
10692 ''|' ')
10693         case "$i_dirent" in
10694         $define) guess1='struct dirent' ;;
10695         *) guess1='struct direct'  ;;
10696         esac
10697         ;;
10698 *)      guess1="$direntrytype"
10699         ;;
10700 esac
10701
10702 case "$guess1" in
10703 'struct dirent') guess2='struct direct' ;;
10704 *) guess2='struct dirent' ;;
10705 esac
10706                 
10707 if $contains "$guess1" try.c >/dev/null 2>&1; then
10708         direntrytype="$guess1"
10709         echo "Your directory entries are $direntrytype." >&4
10710 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10711         direntrytype="$guess2"
10712         echo "Your directory entries seem to be $direntrytype." >&4
10713 else
10714         echo "I don't recognize your system's directory entries." >&4
10715         rp="What type is used for directory entries on this system?"
10716         dflt="$guess1"
10717         . ./myread
10718         direntrytype="$ans"
10719 fi
10720 $rm -f try.c
10721
10722
10723 : see if the directory entry stores field length
10724 echo " "
10725 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10726 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10727         echo "Good, your directory entry keeps length information in d_namlen." >&4
10728         val="$define"
10729 else
10730         echo "Your directory entry does not know about the d_namlen field." >&4
10731         val="$undef"
10732 fi
10733 set d_dirnamlen
10734 eval $setvar
10735 $rm -f try.c
10736
10737 : see if this is an sysdir system
10738 set sys/dir.h i_sysdir
10739 eval $inhdr
10740
10741 : see if this is an sysndir system
10742 set sys/ndir.h i_sysndir
10743 eval $inhdr
10744
10745 : Look for dirfd
10746 echo " "
10747 $cat >dirfd.c <<EOM
10748 #include <stdio.h>
10749 #$i_stdlib I_STDLIB
10750 #ifdef I_STDLIB
10751 #include <stdlib.h>
10752 #endif
10753 #$i_dirent I_DIRENT             /**/
10754 #$i_sysdir I_SYS_DIR            /**/
10755 #$i_sysndir I_SYS_NDIR          /**/
10756 #$i_systypes I_SYS_TYPES        /**/
10757 #if defined(I_SYS_TYPES)
10758 #include <sys/types.h>
10759 #endif
10760 #if defined(I_DIRENT)
10761 #include <dirent.h>
10762 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10763 #include <sys/dir.h>
10764 #endif
10765 #else
10766 #ifdef I_SYS_NDIR
10767 #include <sys/ndir.h>
10768 #else
10769 #ifdef I_SYS_DIR
10770 #ifdef hp9000s500
10771 #include <ndir.h>       /* may be wrong in the future */
10772 #else
10773 #include <sys/dir.h>
10774 #endif
10775 #endif
10776 #endif
10777 #endif 
10778 int main() {
10779         DIR *dirp = opendir(".");
10780         if (dirfd(dirp) >= 0)
10781                 exit(0);
10782         else
10783                 exit(1);
10784 }
10785 EOM
10786 set dirfd
10787 if eval $compile; then
10788         val="$define"
10789 fi
10790 case "$val" in
10791 $define)        echo "dirfd() found." >&4       ;;
10792 *)              echo "dirfd() NOT found." >&4   ;;
10793 esac
10794 set d_dirfd
10795 eval $setvar
10796 $rm -f dirfd*
10797
10798 : see if dlerror exists
10799 xxx_runnm="$runnm"
10800 runnm=false
10801 set dlerror d_dlerror
10802 eval $inlibc
10803 runnm="$xxx_runnm"
10804
10805 : see if dlfcn is available
10806 set dlfcn.h i_dlfcn
10807 eval $inhdr
10808
10809 case "$usedl" in
10810 $define|y|true)
10811         $cat << EOM
10812
10813 On a few systems, the dynamically loaded modules that perl generates and uses
10814 will need a different extension than shared libs. The default will probably
10815 be appropriate.
10816
10817 EOM
10818         case "$dlext" in
10819         '')     dflt="$so" ;;
10820         *)      dflt="$dlext" ;;
10821         esac
10822         rp='What is the extension of dynamically loaded modules'
10823         . ./myread
10824         dlext="$ans"
10825         ;;
10826 *)
10827         dlext="none"
10828         ;;
10829 esac
10830
10831 : Check if dlsym need a leading underscore
10832 echo " "
10833 val="$undef"
10834
10835 case "$dlsrc" in
10836 dl_dlopen.xs)
10837         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10838         $cat >dyna.c <<'EOM'
10839 fred () { }
10840 EOM
10841
10842 $cat >fred.c<<EOM
10843
10844 #include <stdio.h>
10845 #$i_stdlib I_STDLIB
10846 #ifdef I_STDLIB
10847 #include <stdlib.h>
10848 #endif
10849 #$i_dlfcn I_DLFCN
10850 #ifdef I_DLFCN
10851 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10852 #else
10853 #include <sys/types.h>
10854 #include <nlist.h>
10855 #include <link.h>
10856 #endif
10857
10858 extern int fred() ;
10859
10860 int main()
10861 {
10862     void * handle ;
10863     void * symbol ;
10864 #ifndef RTLD_LAZY
10865     int mode = 1 ;
10866 #else
10867     int mode = RTLD_LAZY ;
10868 #endif
10869     handle = dlopen("./dyna.$dlext", mode) ;
10870     if (handle == NULL) {
10871         printf ("1\n") ;
10872         fflush (stdout) ;
10873         exit(0);
10874     }
10875     symbol = dlsym(handle, "fred") ;
10876     if (symbol == NULL) {
10877         /* try putting a leading underscore */
10878         symbol = dlsym(handle, "_fred") ;
10879         if (symbol == NULL) {
10880             printf ("2\n") ;
10881             fflush (stdout) ;
10882             exit(0);
10883         }
10884         printf ("3\n") ;
10885     }
10886     else
10887         printf ("4\n") ;
10888     fflush (stdout) ;
10889     exit(0);
10890 }
10891 EOM
10892         : Call the object file tmp-dyna.o in case dlext=o.
10893         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10894                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10895                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10896                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10897                 xxx=`$run ./fred`
10898                 case $xxx in
10899                 1)      echo "Test program failed using dlopen." >&4
10900                         echo "Perhaps you should not use dynamic loading." >&4;;
10901                 2)      echo "Test program failed using dlsym." >&4
10902                         echo "Perhaps you should not use dynamic loading." >&4;;
10903                 3)      echo "dlsym needs a leading underscore" >&4
10904                         val="$define" ;;
10905                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10906                 esac
10907         else
10908                 echo "I can't compile and run the test program." >&4
10909                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10910         fi
10911         ;;
10912 esac
10913                 
10914 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10915
10916 set d_dlsymun
10917 eval $setvar
10918
10919 : see if drand48_r exists
10920 set drand48_r d_drand48_r
10921 eval $inlibc
10922 case "$d_drand48_r" in
10923 "$define")
10924         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10925         case "$d_drand48_r_proto:$usethreads" in
10926         ":define")      d_drand48_r_proto=define
10927                 set d_drand48_r_proto drand48_r $hdrs
10928                 eval $hasproto ;;
10929         *)      ;;
10930         esac
10931         case "$d_drand48_r_proto" in
10932         define)
10933         case "$drand48_r_proto" in
10934         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10935         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10936         esac
10937         case "$drand48_r_proto" in
10938         ''|0)   d_drand48_r=undef
10939                 drand48_r_proto=0
10940                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10941         * )     case "$drand48_r_proto" in
10942                 REENTRANT_PROTO*) ;;
10943                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10944                 esac
10945                 echo "Prototype: $try" ;;
10946         esac
10947         ;;
10948         *)      case "$usethreads" in
10949                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10950                 esac
10951                 d_drand48_r=undef
10952                 drand48_r_proto=0
10953                 ;;
10954         esac
10955         ;;
10956 *)      drand48_r_proto=0
10957         ;;
10958 esac
10959
10960 : see if prototype for drand48 is available
10961 echo " "
10962 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10963 eval $hasproto
10964
10965 : see if dup2 exists
10966 set dup2 d_dup2
10967 eval $inlibc
10968
10969 : see if eaccess exists
10970 set eaccess d_eaccess
10971 eval $inlibc
10972
10973 : see if endgrent exists
10974 set endgrent d_endgrent
10975 eval $inlibc
10976
10977 : see if this is an grp system
10978 set grp.h i_grp
10979 eval $inhdr
10980
10981 case "$i_grp" in
10982 $define)
10983         xxx=`./findhdr grp.h`
10984         $cppstdin $cppflags $cppminus < $xxx >$$.h
10985
10986         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10987                 val="$define"
10988         else
10989                 val="$undef"
10990         fi
10991         set d_grpasswd
10992         eval $setvar
10993
10994         $rm -f $$.h
10995         ;;
10996 *)
10997         val="$undef";
10998         set d_grpasswd; eval $setvar
10999         ;;
11000 esac
11001
11002 : see if endgrent_r exists
11003 set endgrent_r d_endgrent_r
11004 eval $inlibc
11005 case "$d_endgrent_r" in
11006 "$define")
11007         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11008         case "$d_endgrent_r_proto:$usethreads" in
11009         ":define")      d_endgrent_r_proto=define
11010                 set d_endgrent_r_proto endgrent_r $hdrs
11011                 eval $hasproto ;;
11012         *)      ;;
11013         esac
11014         case "$d_endgrent_r_proto" in
11015         define)
11016         case "$endgrent_r_proto" in
11017         ''|0) try='int endgrent_r(FILE**);'
11018         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11019         esac
11020         case "$endgrent_r_proto" in
11021         ''|0) try='void endgrent_r(FILE**);'
11022         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11023         esac
11024         case "$endgrent_r_proto" in
11025         ''|0)   d_endgrent_r=undef
11026                 endgrent_r_proto=0
11027                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11028         * )     case "$endgrent_r_proto" in
11029                 REENTRANT_PROTO*) ;;
11030                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11031                 esac
11032                 echo "Prototype: $try" ;;
11033         esac
11034         ;;
11035         *)      case "$usethreads" in
11036                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11037                 esac
11038                 d_endgrent_r=undef
11039                 endgrent_r_proto=0
11040                 ;;
11041         esac
11042         ;;
11043 *)      endgrent_r_proto=0
11044         ;;
11045 esac
11046
11047 : see if endhostent exists
11048 set endhostent d_endhent
11049 eval $inlibc
11050
11051 : see if this is a netdb.h system
11052 set netdb.h i_netdb
11053 eval $inhdr
11054
11055 : see if endhostent_r exists
11056 set endhostent_r d_endhostent_r
11057 eval $inlibc
11058 case "$d_endhostent_r" in
11059 "$define")
11060         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11061         case "$d_endhostent_r_proto:$usethreads" in
11062         ":define")      d_endhostent_r_proto=define
11063                 set d_endhostent_r_proto endhostent_r $hdrs
11064                 eval $hasproto ;;
11065         *)      ;;
11066         esac
11067         case "$d_endhostent_r_proto" in
11068         define)
11069         case "$endhostent_r_proto" in
11070         ''|0) try='int endhostent_r(struct hostent_data*);'
11071         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11072         esac
11073         case "$endhostent_r_proto" in
11074         ''|0) try='void endhostent_r(struct hostent_data*);'
11075         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11076         esac
11077         case "$endhostent_r_proto" in
11078         ''|0)   d_endhostent_r=undef
11079                 endhostent_r_proto=0
11080                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11081         * )     case "$endhostent_r_proto" in
11082                 REENTRANT_PROTO*) ;;
11083                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11084                 esac
11085                 echo "Prototype: $try" ;;
11086         esac
11087         ;;
11088         *)      case "$usethreads" in
11089                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11090                 esac
11091                 d_endhostent_r=undef
11092                 endhostent_r_proto=0
11093                 ;;
11094         esac
11095         ;;
11096 *)      endhostent_r_proto=0
11097         ;;
11098 esac
11099
11100 : see if endnetent exists
11101 set endnetent d_endnent
11102 eval $inlibc
11103
11104 : see if endnetent_r exists
11105 set endnetent_r d_endnetent_r
11106 eval $inlibc
11107 case "$d_endnetent_r" in
11108 "$define")
11109         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11110         case "$d_endnetent_r_proto:$usethreads" in
11111         ":define")      d_endnetent_r_proto=define
11112                 set d_endnetent_r_proto endnetent_r $hdrs
11113                 eval $hasproto ;;
11114         *)      ;;
11115         esac
11116         case "$d_endnetent_r_proto" in
11117         define)
11118         case "$endnetent_r_proto" in
11119         ''|0) try='int endnetent_r(struct netent_data*);'
11120         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11121         esac
11122         case "$endnetent_r_proto" in
11123         ''|0) try='void endnetent_r(struct netent_data*);'
11124         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11125         esac
11126         case "$endnetent_r_proto" in
11127         ''|0)   d_endnetent_r=undef
11128                 endnetent_r_proto=0
11129                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11130         * )     case "$endnetent_r_proto" in
11131                 REENTRANT_PROTO*) ;;
11132                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11133                 esac
11134                 echo "Prototype: $try" ;;
11135         esac
11136         ;;
11137         *)      case "$usethreads" in
11138                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11139                 esac
11140                 d_endnetent_r=undef
11141                 endnetent_r_proto=0
11142                 ;;
11143         esac
11144         ;;
11145 *)      endnetent_r_proto=0
11146         ;;
11147 esac
11148
11149 : see if endprotoent exists
11150 set endprotoent d_endpent
11151 eval $inlibc
11152
11153 : see if endprotoent_r exists
11154 set endprotoent_r d_endprotoent_r
11155 eval $inlibc
11156 case "$d_endprotoent_r" in
11157 "$define")
11158         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11159         case "$d_endprotoent_r_proto:$usethreads" in
11160         ":define")      d_endprotoent_r_proto=define
11161                 set d_endprotoent_r_proto endprotoent_r $hdrs
11162                 eval $hasproto ;;
11163         *)      ;;
11164         esac
11165         case "$d_endprotoent_r_proto" in
11166         define)
11167         case "$endprotoent_r_proto" in
11168         ''|0) try='int endprotoent_r(struct protoent_data*);'
11169         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11170         esac
11171         case "$endprotoent_r_proto" in
11172         ''|0) try='void endprotoent_r(struct protoent_data*);'
11173         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11174         esac
11175         case "$endprotoent_r_proto" in
11176         ''|0)   d_endprotoent_r=undef
11177                 endprotoent_r_proto=0
11178                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11179         * )     case "$endprotoent_r_proto" in
11180                 REENTRANT_PROTO*) ;;
11181                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11182                 esac
11183                 echo "Prototype: $try" ;;
11184         esac
11185         ;;
11186         *)      case "$usethreads" in
11187                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11188                 esac
11189                 d_endprotoent_r=undef
11190                 endprotoent_r_proto=0
11191                 ;;
11192         esac
11193         ;;
11194 *)      endprotoent_r_proto=0
11195         ;;
11196 esac
11197
11198 : see if endpwent exists
11199 set endpwent d_endpwent
11200 eval $inlibc
11201
11202 : see if this is a pwd.h system
11203 set pwd.h i_pwd
11204 eval $inhdr
11205
11206 case "$i_pwd" in
11207 $define)
11208         xxx=`./findhdr pwd.h`
11209         $cppstdin $cppflags $cppminus < $xxx >$$.h
11210
11211         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11212                 val="$define"
11213         else
11214                 val="$undef"
11215         fi
11216         set d_pwquota
11217         eval $setvar
11218
11219         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11220                 val="$define"
11221         else
11222                 val="$undef"
11223         fi
11224         set d_pwage
11225         eval $setvar
11226
11227         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11228                 val="$define"
11229         else
11230                 val="$undef"
11231         fi
11232         set d_pwchange
11233         eval $setvar
11234
11235         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11236                 val="$define"
11237         else
11238                 val="$undef"
11239         fi
11240         set d_pwclass
11241         eval $setvar
11242
11243         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11244                 val="$define"
11245         else
11246                 val="$undef"
11247         fi
11248         set d_pwexpire
11249         eval $setvar
11250
11251         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11252                 val="$define"
11253         else
11254                 val="$undef"
11255         fi
11256         set d_pwcomment
11257         eval $setvar
11258
11259         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11260                 val="$define"
11261         else
11262                 val="$undef"
11263         fi
11264         set d_pwgecos
11265         eval $setvar
11266
11267         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11268                 val="$define"
11269         else
11270                 val="$undef"
11271         fi
11272         set d_pwpasswd
11273         eval $setvar
11274
11275         $rm -f $$.h
11276         ;;
11277 *)
11278         val="$undef"; 
11279         set d_pwquota; eval $setvar
11280         set d_pwage; eval $setvar
11281         set d_pwchange; eval $setvar
11282         set d_pwclass; eval $setvar
11283         set d_pwexpire; eval $setvar
11284         set d_pwcomment; eval $setvar
11285         set d_pwgecos; eval $setvar
11286         set d_pwpasswd; eval $setvar
11287         ;;
11288 esac
11289
11290 : see if endpwent_r exists
11291 set endpwent_r d_endpwent_r
11292 eval $inlibc
11293 case "$d_endpwent_r" in
11294 "$define")
11295         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11296         case "$d_endpwent_r_proto:$usethreads" in
11297         ":define")      d_endpwent_r_proto=define
11298                 set d_endpwent_r_proto endpwent_r $hdrs
11299                 eval $hasproto ;;
11300         *)      ;;
11301         esac
11302         case "$d_endpwent_r_proto" in
11303         define)
11304         case "$endpwent_r_proto" in
11305         ''|0) try='int endpwent_r(FILE**);'
11306         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11307         esac
11308         case "$endpwent_r_proto" in
11309         ''|0) try='void endpwent_r(FILE**);'
11310         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11311         esac
11312         case "$endpwent_r_proto" in
11313         ''|0)   d_endpwent_r=undef
11314                 endpwent_r_proto=0
11315                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11316         * )     case "$endpwent_r_proto" in
11317                 REENTRANT_PROTO*) ;;
11318                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11319                 esac
11320                 echo "Prototype: $try" ;;
11321         esac
11322         ;;
11323         *)      case "$usethreads" in
11324                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11325                 esac
11326                 d_endpwent_r=undef
11327                 endpwent_r_proto=0
11328                 ;;
11329         esac
11330         ;;
11331 *)      endpwent_r_proto=0
11332         ;;
11333 esac
11334
11335 : see if endservent exists
11336 set endservent d_endsent
11337 eval $inlibc
11338
11339 : see if endservent_r exists
11340 set endservent_r d_endservent_r
11341 eval $inlibc
11342 case "$d_endservent_r" in
11343 "$define")
11344         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11345         case "$d_endservent_r_proto:$usethreads" in
11346         ":define")      d_endservent_r_proto=define
11347                 set d_endservent_r_proto endservent_r $hdrs
11348                 eval $hasproto ;;
11349         *)      ;;
11350         esac
11351         case "$d_endservent_r_proto" in
11352         define)
11353         case "$endservent_r_proto" in
11354         ''|0) try='int endservent_r(struct servent_data*);'
11355         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11356         esac
11357         case "$endservent_r_proto" in
11358         ''|0) try='void endservent_r(struct servent_data*);'
11359         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11360         esac
11361         case "$endservent_r_proto" in
11362         ''|0)   d_endservent_r=undef
11363                 endservent_r_proto=0
11364                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11365         * )     case "$endservent_r_proto" in
11366                 REENTRANT_PROTO*) ;;
11367                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11368                 esac
11369                 echo "Prototype: $try" ;;
11370         esac
11371         ;;
11372         *)      case "$usethreads" in
11373                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11374                 esac
11375                 d_endservent_r=undef
11376                 endservent_r_proto=0
11377                 ;;
11378         esac
11379         ;;
11380 *)      endservent_r_proto=0
11381         ;;
11382 esac
11383
11384 : Locate the flags for 'open()'
11385 echo " "
11386 $cat >try.c <<EOCP
11387 #include <sys/types.h>
11388 #ifdef I_FCNTL
11389 #include <fcntl.h>
11390 #endif
11391 #ifdef I_SYS_FILE
11392 #include <sys/file.h>
11393 #endif
11394 #$i_stdlib I_STDLIB
11395 #ifdef I_STDLIB
11396 #include <stdlib.h>
11397 #endif
11398 int main() {
11399         if(O_RDONLY);
11400 #ifdef O_TRUNC
11401         exit(0);
11402 #else
11403         exit(1);
11404 #endif
11405 }
11406 EOCP
11407 : check sys/file.h first to get FREAD on Sun
11408 if $test `./findhdr sys/file.h` && \
11409                 set try -DI_SYS_FILE && eval $compile; then
11410         h_sysfile=true;
11411         echo "<sys/file.h> defines the O_* constants..." >&4
11412         if $run ./try; then
11413                 echo "and you have the 3 argument form of open()." >&4
11414                 val="$define"
11415         else
11416                 echo "but not the 3 argument form of open().  Oh, well." >&4
11417                 val="$undef"
11418         fi
11419 elif $test `./findhdr fcntl.h` && \
11420                 set try -DI_FCNTL && eval $compile; then
11421         h_fcntl=true;
11422         echo "<fcntl.h> defines the O_* constants..." >&4
11423         if $run ./try; then
11424                 echo "and you have the 3 argument form of open()." >&4
11425                 val="$define"
11426         else
11427                 echo "but not the 3 argument form of open().  Oh, well." >&4
11428                 val="$undef"
11429         fi
11430 else
11431         val="$undef"
11432         echo "I can't find the O_* constant definitions!  You got problems." >&4
11433 fi
11434 set d_open3
11435 eval $setvar
11436 $rm -f try try.*
11437
11438 : see which of string.h or strings.h is needed
11439 echo " "
11440 strings=`./findhdr string.h`
11441 if $test "$strings" && $test -r "$strings"; then
11442         echo "Using <string.h> instead of <strings.h>." >&4
11443         val="$define"
11444 else
11445         val="$undef"
11446         strings=`./findhdr strings.h`
11447         if $test "$strings" && $test -r "$strings"; then
11448                 echo "Using <strings.h> instead of <string.h>." >&4
11449         else
11450                 echo "No string header found -- You'll surely have problems." >&4
11451         fi
11452 fi
11453 set i_string
11454 eval $setvar
11455 case "$i_string" in
11456 "$undef") strings=`./findhdr strings.h`;;
11457 *)        strings=`./findhdr string.h`;;
11458 esac
11459
11460 : see if this is a sys/file.h system
11461 val=''
11462 set sys/file.h val
11463 eval $inhdr
11464
11465 : do we need to include sys/file.h ?
11466 case "$val" in
11467 "$define")
11468         echo " "
11469         if $h_sysfile; then
11470                 val="$define"
11471                 echo "We'll be including <sys/file.h>." >&4
11472         else
11473                 val="$undef"
11474                 echo "We won't be including <sys/file.h>." >&4
11475         fi
11476         ;;
11477 *)
11478         h_sysfile=false
11479         ;;
11480 esac
11481 set i_sysfile
11482 eval $setvar
11483
11484 : see if fcntl.h is there
11485 val=''
11486 set fcntl.h val
11487 eval $inhdr
11488
11489 : see if we can include fcntl.h
11490 case "$val" in
11491 "$define")
11492         echo " "
11493         if $h_fcntl; then
11494                 val="$define"
11495                 echo "We'll be including <fcntl.h>." >&4
11496         else
11497                 val="$undef"
11498                 if $h_sysfile; then
11499         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11500                 else
11501                         echo "We won't be including <fcntl.h>." >&4
11502                 fi
11503         fi
11504         ;;
11505 *)
11506         h_fcntl=false
11507         val="$undef"
11508         ;;
11509 esac
11510 set i_fcntl
11511 eval $setvar
11512
11513 : check for non-blocking I/O stuff
11514 case "$h_sysfile" in
11515 true) echo "#include <sys/file.h>" > head.c;;
11516 *)
11517        case "$h_fcntl" in
11518        true) echo "#include <fcntl.h>" > head.c;;
11519        *) echo "#include <sys/fcntl.h>" > head.c;;
11520        esac
11521        ;;
11522 esac
11523 echo " "
11524 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11525 case "$o_nonblock" in
11526 '')
11527         $cat head.c > try.c
11528         $cat >>try.c <<EOCP
11529 #include <stdio.h>
11530 #$i_stdlib I_STDLIB
11531 #ifdef I_STDLIB
11532 #include <stdlib.h>
11533 #endif
11534 #$i_fcntl I_FCNTL
11535 #ifdef I_FCNTL
11536 #include <fcntl.h>
11537 #endif
11538 int main() {
11539 #ifdef O_NONBLOCK
11540         printf("O_NONBLOCK\n");
11541         exit(0);
11542 #endif
11543 #ifdef O_NDELAY
11544         printf("O_NDELAY\n");
11545         exit(0);
11546 #endif
11547 #ifdef FNDELAY
11548         printf("FNDELAY\n");
11549         exit(0);
11550 #endif
11551         exit(0);
11552 }
11553 EOCP
11554         set try
11555         if eval $compile_ok; then
11556                 o_nonblock=`$run ./try`
11557                 case "$o_nonblock" in
11558                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11559                 *) echo "Seems like we can use $o_nonblock.";;
11560                 esac
11561         else
11562                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11563         fi
11564         ;;
11565 *) echo "Using $hint value $o_nonblock.";;
11566 esac
11567 $rm -f try try.* .out core
11568
11569 echo " "
11570 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11571 case "$eagain" in
11572 '')
11573         $cat head.c > try.c
11574         $cat >>try.c <<EOCP
11575 #include <errno.h>
11576 #include <sys/types.h>
11577 #include <signal.h>
11578 #include <stdio.h> 
11579 #$i_stdlib I_STDLIB
11580 #ifdef I_STDLIB
11581 #include <stdlib.h>
11582 #endif
11583 #$i_fcntl I_FCNTL
11584 #ifdef I_FCNTL
11585 #include <fcntl.h>
11586 #endif
11587 #define MY_O_NONBLOCK $o_nonblock
11588 #ifndef errno  /* XXX need better Configure test */
11589 extern int errno;
11590 #endif
11591 #$i_unistd I_UNISTD
11592 #ifdef I_UNISTD
11593 #include <unistd.h>
11594 #endif
11595 #$i_string I_STRING
11596 #ifdef I_STRING
11597 #include <string.h>
11598 #else
11599 #include <strings.h>
11600 #endif
11601 $signal_t blech(x) int x; { exit(3); }
11602 EOCP
11603         $cat >> try.c <<'EOCP'
11604 int main()
11605 {
11606         int pd[2];
11607         int pu[2];
11608         char buf[1];
11609         char string[100];
11610
11611         pipe(pd);       /* Down: child -> parent */
11612         pipe(pu);       /* Up: parent -> child */
11613         if (0 != fork()) {
11614                 int ret;
11615                 close(pd[1]);   /* Parent reads from pd[0] */
11616                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11617 #ifdef F_SETFL
11618                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11619                         exit(1);
11620 #else
11621                 exit(4);
11622 #endif
11623                 signal(SIGALRM, blech);
11624                 alarm(5);
11625                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11626                         exit(2);
11627                 sprintf(string, "%d\n", ret);
11628                 write(2, string, strlen(string));
11629                 alarm(0);
11630 #ifdef EAGAIN
11631                 if (errno == EAGAIN) {
11632                         printf("EAGAIN\n");
11633                         goto ok;
11634                 }
11635 #endif
11636 #ifdef EWOULDBLOCK
11637                 if (errno == EWOULDBLOCK)
11638                         printf("EWOULDBLOCK\n");
11639 #endif
11640         ok:
11641                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11642                 sleep(2);                               /* Give it time to close our pipe */
11643                 alarm(5);
11644                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11645                 alarm(0);
11646                 sprintf(string, "%d\n", ret);
11647                 write(4, string, strlen(string));
11648                 exit(0);
11649         }
11650
11651         close(pd[0]);                   /* We write to pd[1] */
11652         close(pu[1]);                   /* We read from pu[0] */
11653         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11654         close(pd[1]);                   /* Pipe pd is now fully closed! */
11655         exit(0);                                /* Bye bye, thank you for playing! */
11656 }
11657 EOCP
11658         set try
11659         if eval $compile_ok; then
11660                 echo "$startsh" >mtry
11661                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11662                 chmod +x mtry
11663                 ./mtry >/dev/null 2>&1
11664                 case $? in
11665                 0) eagain=`$cat try.out`;;
11666                 1) echo "Could not perform non-blocking setting!";;
11667                 2) echo "I did a successful read() for something that was not there!";;
11668                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11669                 4) echo "Could not find F_SETFL!";;
11670                 *) echo "Something terribly wrong happened during testing.";;
11671                 esac
11672                 rd_nodata=`$cat try.ret`
11673                 echo "A read() system call with no data present returns $rd_nodata."
11674                 case "$rd_nodata" in
11675                 0|-1) ;;
11676                 *)
11677                         echo "(That's peculiar, fixing that to be -1.)"
11678                         rd_nodata=-1
11679                         ;;
11680                 esac
11681                 case "$eagain" in
11682                 '')
11683                         echo "Forcing errno EAGAIN on read() with no data available."
11684                         eagain=EAGAIN
11685                         ;;
11686                 *)
11687                         echo "Your read() sets errno to $eagain when no data is available."
11688                         ;;
11689                 esac
11690                 status=`$cat try.err`
11691                 case "$status" in
11692                 0) echo "And it correctly returns 0 to signal EOF.";;
11693                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11694                 *) echo "However, your read() returns '$status' on EOF??";;
11695                 esac
11696                 val="$define"
11697                 if test "$status" = "$rd_nodata"; then
11698                         echo "WARNING: you can't distinguish between EOF and no data!"
11699                         val="$undef"
11700                 fi
11701         else
11702                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11703                 eagain=EAGAIN
11704         fi
11705         set d_eofnblk
11706         eval $setvar
11707         ;;
11708 *)
11709         echo "Using $hint value $eagain."
11710         echo "Your read() returns $rd_nodata when no data is present."
11711         case "$d_eofnblk" in
11712         "$define") echo "And you can see EOF because read() returns 0.";;
11713         "$undef") echo "But you can't see EOF status from read() returned value.";;
11714         *)
11715                 echo "(Assuming you can't see EOF status from read anyway.)"
11716                 d_eofnblk=$undef
11717                 ;;
11718         esac
11719         ;;
11720 esac
11721 $rm -f try try.* .out core head.c mtry
11722
11723 : see if _ptr and _cnt from stdio act std
11724 echo " "
11725
11726 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11727         echo "(Looks like you have stdio.h from BSD.)"
11728         case "$stdio_ptr" in
11729         '') stdio_ptr='((fp)->_p)'
11730                 ptr_lval=$define
11731                 ;;
11732         *)      ptr_lval=$d_stdio_ptr_lval;;
11733         esac
11734         case "$stdio_cnt" in
11735         '') stdio_cnt='((fp)->_r)'
11736                 cnt_lval=$define
11737                 ;;
11738         *)      cnt_lval=$d_stdio_cnt_lval;;
11739         esac
11740         case "$stdio_base" in
11741         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11742         esac
11743         case "$stdio_bufsiz" in
11744         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11745         esac
11746 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11747         echo "(Looks like you have stdio.h from Linux.)"
11748         case "$stdio_ptr" in
11749         '') stdio_ptr='((fp)->_IO_read_ptr)'
11750                 ptr_lval=$define
11751                 ;;
11752         *)      ptr_lval=$d_stdio_ptr_lval;;
11753         esac
11754         case "$stdio_cnt" in
11755         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11756                 cnt_lval=$undef
11757                 ;;
11758         *)      cnt_lval=$d_stdio_cnt_lval;;
11759         esac
11760         case "$stdio_base" in
11761         '') stdio_base='((fp)->_IO_read_base)';;
11762         esac
11763         case "$stdio_bufsiz" in
11764         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
11765         esac
11766 else
11767         case "$stdio_ptr" in
11768         '') stdio_ptr='((fp)->_ptr)'
11769                 ptr_lval=$define
11770                 ;;
11771         *)      ptr_lval=$d_stdio_ptr_lval;;
11772         esac
11773         case "$stdio_cnt" in
11774         '') stdio_cnt='((fp)->_cnt)'
11775                 cnt_lval=$define
11776                 ;;
11777         *)      cnt_lval=$d_stdio_cnt_lval;;
11778         esac
11779         case "$stdio_base" in
11780         '') stdio_base='((fp)->_base)';;
11781         esac
11782         case "$stdio_bufsiz" in
11783         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
11784         esac
11785 fi
11786
11787 : test whether _ptr and _cnt really work
11788 echo "Checking how std your stdio is..." >&4
11789 $cat >try.c <<EOP
11790 #include <stdio.h>
11791 #$i_stdlib I_STDLIB
11792 #ifdef I_STDLIB
11793 #include <stdlib.h>
11794 #endif
11795 #define FILE_ptr(fp)    $stdio_ptr
11796 #define FILE_cnt(fp)    $stdio_cnt
11797 int main() {
11798         FILE *fp = fopen("try.c", "r");
11799         char c = getc(fp);
11800         if (
11801                 18 <= FILE_cnt(fp) &&
11802                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11803         )
11804                 exit(0);
11805         exit(1);
11806 }
11807 EOP
11808 val="$undef"
11809 set try
11810 if eval $compile && $to try.c; then
11811         if $run ./try; then
11812                 echo "Your stdio acts pretty std."
11813                 val="$define"
11814         else
11815                 echo "Your stdio isn't very std."
11816         fi
11817 else
11818         echo "Your stdio doesn't appear very std."
11819 fi
11820 $rm -f try.c try
11821
11822 # glibc 2.2.90 and above apparently change stdio streams so Perl's
11823 # direct buffer manipulation no longer works.  The Configure tests
11824 # should be changed to correctly detect this, but until then,
11825 # the following check should at least let perl compile and run.
11826 # (This quick fix should be updated before 5.8.1.)
11827 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
11828 # A. Dougherty, June 3, 2002.
11829 case "$d_gnulibc" in
11830 $define)
11831         case "$gnulibc_version" in
11832         2.[01]*)  ;;
11833         2.2) ;;
11834         2.2.[0-9]) ;;
11835         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
11836                 val="$undef"
11837                 ;;
11838         esac
11839         ;;
11840 esac
11841 set d_stdstdio
11842 eval $setvar
11843
11844 : Can _ptr be used as an lvalue?
11845 case "$d_stdstdio$ptr_lval" in
11846 $define$define) val=$define ;;
11847 *) val=$undef ;;
11848 esac
11849 set d_stdio_ptr_lval
11850 eval $setvar
11851
11852 : Can _cnt be used as an lvalue?
11853 case "$d_stdstdio$cnt_lval" in
11854 $define$define) val=$define ;;
11855 *) val=$undef ;;
11856 esac
11857 set d_stdio_cnt_lval
11858 eval $setvar
11859
11860
11861 : test whether setting _ptr sets _cnt as a side effect
11862 d_stdio_ptr_lval_sets_cnt="$undef"
11863 d_stdio_ptr_lval_nochange_cnt="$undef"
11864 case "$d_stdio_ptr_lval$d_stdstdio" in
11865 $define$define)
11866         echo "Checking to see what happens if we set the stdio ptr..." >&4
11867 $cat >try.c <<EOP
11868 #include <stdio.h>
11869 /* Can we scream? */
11870 /* Eat dust sed :-) */
11871 /* In the buffer space, no one can hear you scream. */
11872 #$i_stdlib I_STDLIB
11873 #ifdef I_STDLIB
11874 #include <stdlib.h>
11875 #endif
11876 #define FILE_ptr(fp)    $stdio_ptr
11877 #define FILE_cnt(fp)    $stdio_cnt
11878 #include <sys/types.h>
11879 int main() {
11880         FILE *fp = fopen("try.c", "r");
11881         int c;
11882         char *ptr;
11883         size_t cnt;
11884         if (!fp) {
11885             puts("Fail even to read");
11886             exit(1);
11887         }
11888         c = getc(fp); /* Read away the first # */
11889         if (c == EOF) {
11890             puts("Fail even to read");
11891             exit(1);
11892         }
11893         if (!(
11894                 18 <= FILE_cnt(fp) &&
11895                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
11896         )) {
11897                 puts("Fail even to read");
11898                 exit (1);
11899         }
11900         ptr = (char*) FILE_ptr(fp);
11901         cnt = (size_t)FILE_cnt(fp);
11902
11903         FILE_ptr(fp) += 42;
11904
11905         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
11906                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
11907                 exit (1);
11908         }
11909         if (FILE_cnt(fp) <= 20) {
11910                 printf ("Fail (<20 chars to test)");
11911                 exit (1);
11912         }
11913         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
11914                 puts("Fail compare");
11915                 exit (1);
11916         }
11917         if (cnt == FILE_cnt(fp)) {
11918                 puts("Pass_unchanged");
11919                 exit (0);
11920         }       
11921         if (FILE_cnt(fp) == (cnt - 42)) {
11922                 puts("Pass_changed");
11923                 exit (0);
11924         }
11925         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
11926         return 1;
11927
11928 }
11929 EOP
11930         set try
11931         if eval $compile && $to try.c; then
11932                 case `$run ./try` in
11933                 Pass_changed)
11934                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
11935                         d_stdio_ptr_lval_sets_cnt="$define" ;;
11936                 Pass_unchanged)
11937                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
11938                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
11939                 Fail*)
11940                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
11941                 *)
11942                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
11943         esac
11944         else
11945                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
11946         fi
11947         $rm -f try.c try
11948         ;;
11949 esac
11950
11951 : see if _base is also standard
11952 val="$undef"
11953 case "$d_stdstdio" in
11954 $define)
11955         $cat >try.c <<EOP
11956 #include <stdio.h>
11957 #$i_stdlib I_STDLIB
11958 #ifdef I_STDLIB
11959 #include <stdlib.h>
11960 #endif
11961 #define FILE_base(fp)   $stdio_base
11962 #define FILE_bufsiz(fp) $stdio_bufsiz
11963 int main() {
11964         FILE *fp = fopen("try.c", "r");
11965         char c = getc(fp);
11966         if (
11967                 19 <= FILE_bufsiz(fp) &&
11968                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
11969         )
11970                 exit(0);
11971         exit(1);
11972 }
11973 EOP
11974         set try
11975         if eval $compile && $to try.c; then
11976                 if $run ./try; then
11977                         echo "And its _base field acts std."
11978                         val="$define"
11979                 else
11980                         echo "But its _base field isn't std."
11981                 fi
11982         else
11983                 echo "However, it seems to be lacking the _base field."
11984         fi
11985         $rm -f try.c try
11986         ;;
11987 esac
11988 set d_stdiobase
11989 eval $setvar
11990
11991 : see if fast_stdio exists
11992 val="$undef"
11993 case "$d_stdstdio:$d_stdio_ptr_lval" in
11994 "$define:$define")
11995         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
11996         *$define*)
11997                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
11998                 val="$define"
11999                 ;;
12000         esac
12001         ;;
12002 esac
12003 set d_faststdio
12004 eval $setvar
12005
12006
12007
12008 : see if fchdir exists
12009 set fchdir d_fchdir
12010 eval $inlibc
12011
12012 : see if fchmod exists
12013 set fchmod d_fchmod
12014 eval $inlibc
12015
12016 : see if fchown exists
12017 set fchown d_fchown
12018 eval $inlibc
12019
12020 : see if this is an fcntl system
12021 set fcntl d_fcntl
12022 eval $inlibc
12023
12024 echo " "
12025 : See if fcntl-based locking works.
12026 $cat >try.c <<EOCP
12027 #$i_stdlib I_STDLIB
12028 #ifdef I_STDLIB
12029 #include <stdlib.h>
12030 #endif
12031 #include <unistd.h>
12032 #include <fcntl.h>
12033 #include <signal.h>
12034 $signal_t blech(x) int x; { exit(3); }
12035 int main() {
12036 #if defined(F_SETLK) && defined(F_SETLKW)
12037      struct flock flock;
12038      int retval, fd;
12039      fd = open("try.c", O_RDONLY);
12040      flock.l_type = F_RDLCK;
12041      flock.l_whence = SEEK_SET;
12042      flock.l_start = flock.l_len = 0;
12043      signal(SIGALRM, blech);
12044      alarm(10);
12045      retval = fcntl(fd, F_SETLK, &flock);
12046      close(fd);
12047      (retval < 0 ? exit(2) : exit(0));
12048 #else
12049      exit(2);
12050 #endif
12051 }
12052 EOCP
12053 echo "Checking if fcntl-based file locking works... "
12054 case "$d_fcntl" in
12055 "$define")
12056         set try
12057         if eval $compile_ok; then
12058                 if $run ./try; then
12059                         echo "Yes, it seems to work."
12060                         val="$define"
12061                 else
12062                         echo "Nope, it didn't work."
12063                         val="$undef"
12064                         case "$?" in
12065                         3) $cat >&4 <<EOM
12066 ***
12067 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12068 *** This is (almost) impossible.
12069 *** If your NFS lock daemons are not feeling well, something like
12070 *** this may happen, please investigate.  Cannot continue, aborting.
12071 ***
12072 EOM
12073                                 exit 1
12074                                 ;;
12075                         esac
12076                 fi
12077         else
12078                 echo "I'm unable to compile the test program, so I'll assume not."
12079                 val="$undef"
12080         fi
12081         ;;
12082 *) val="$undef";
12083         echo "Nope, since you don't even have fcntl()."
12084         ;;
12085 esac
12086 set d_fcntl_can_lock
12087 eval $setvar
12088 $rm -f try*
12089
12090
12091 : check for fd_set items
12092 $cat <<EOM
12093
12094 Checking to see how well your C compiler handles fd_set and friends ...
12095 EOM
12096 $cat >try.c <<EOCP
12097 #$i_stdlib I_STDLIB
12098 #ifdef I_STDLIB
12099 #include <stdlib.h>
12100 #endif
12101 #$i_systime I_SYS_TIME
12102 #$i_sysselct I_SYS_SELECT
12103 #$d_socket HAS_SOCKET
12104 #include <sys/types.h>
12105 #ifdef HAS_SOCKET
12106 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12107 #endif
12108 #ifdef I_SYS_TIME
12109 #include <sys/time.h>
12110 #endif
12111 #ifdef I_SYS_SELECT
12112 #include <sys/select.h>
12113 #endif
12114 int main() {
12115         fd_set fds;
12116
12117 #ifdef TRYBITS
12118         if(fds.fds_bits);
12119 #endif
12120
12121 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12122         exit(0);
12123 #else
12124         exit(1);
12125 #endif
12126 }
12127 EOCP
12128 set try -DTRYBITS
12129 if eval $compile; then
12130         d_fds_bits="$define"
12131         d_fd_set="$define"
12132         echo "Well, your system knows about the normal fd_set typedef..." >&4
12133         if $run ./try; then
12134                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12135                 d_fd_macros="$define"
12136         else
12137                 $cat >&4 <<'EOM'
12138 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12139 EOM
12140                 d_fd_macros="$undef"
12141         fi
12142 else
12143         $cat <<'EOM'
12144 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12145 EOM
12146         set try
12147         if eval $compile; then
12148                 d_fds_bits="$undef"
12149                 d_fd_set="$define"
12150                 echo "Well, your system has some sort of fd_set available..." >&4
12151                 if $run ./try; then
12152                         echo "and you have the normal fd_set macros." >&4
12153                         d_fd_macros="$define"
12154                 else
12155                         $cat <<'EOM'
12156 but not the normal fd_set macros!  Gross!  More work for me...
12157 EOM
12158                         d_fd_macros="$undef"
12159                 fi
12160         else
12161         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12162                 d_fd_set="$undef"
12163                 d_fds_bits="$undef"
12164                 d_fd_macros="$undef"
12165         fi
12166 fi
12167 $rm -f try try.*
12168
12169 : see if fgetpos exists
12170 set fgetpos d_fgetpos
12171 eval $inlibc
12172
12173 : see if finite exists
12174 set finite d_finite
12175 eval $inlibc
12176
12177 : see if finitel exists
12178 set finitel d_finitel
12179 eval $inlibc
12180
12181 : see if flock exists
12182 set flock d_flock
12183 eval $inlibc
12184
12185 : see if prototype for flock is available
12186 echo " "
12187 set d_flockproto flock $i_sysfile sys/file.h
12188 eval $hasproto
12189
12190 : see if fork exists
12191 set fork d_fork
12192 eval $inlibc
12193
12194 : see if fp_class exists
12195 set fp_class d_fp_class
12196 eval $inlibc
12197
12198 : see if pathconf exists
12199 set pathconf d_pathconf
12200 eval $inlibc
12201
12202 : see if fpathconf exists
12203 set fpathconf d_fpathconf
12204 eval $inlibc
12205
12206 : see if fpclass exists
12207 set fpclass d_fpclass
12208 eval $inlibc
12209
12210 : see if fpclassify exists
12211 set fpclassify d_fpclassify
12212 eval $inlibc
12213
12214 : see if fpclassl exists
12215 set fpclassl d_fpclassl
12216 eval $inlibc
12217
12218
12219 : check for fpos64_t
12220 echo " "
12221 echo "Checking to see if you have fpos64_t..." >&4
12222 $cat >try.c <<EOCP
12223 #include <stdio.h>
12224 int main() { fpos64_t x = 7; }
12225 EOCP
12226 set try
12227 if eval $compile; then
12228         val="$define"
12229         echo "You have fpos64_t."
12230 else
12231         val="$undef"
12232         echo "You do not have fpos64_t."
12233         case "$fpossize" in
12234         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12235         esac
12236 fi
12237 $rm -f try.* try
12238 set d_fpos64_t
12239 eval $setvar
12240
12241 : see if frexpl exists
12242 set frexpl d_frexpl
12243 eval $inlibc
12244
12245 : see if this is a sys/param system
12246 set sys/param.h i_sysparam
12247 eval $inhdr
12248
12249 : see if this is a sys/mount.h system
12250 set sys/mount.h i_sysmount
12251 eval $inhdr
12252
12253
12254 echo " "
12255 echo "Checking to see if your system supports struct fs_data..." >&4
12256 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12257 eval $hasstruct
12258 case "$d_fs_data_s" in
12259 "$define")      echo "Yes, it does."   ;;
12260 *)              echo "No, it doesn't." ;;
12261 esac
12262
12263 : see if fseeko exists
12264 set fseeko d_fseeko
12265 eval $inlibc
12266 case "$longsize" in
12267 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12268 esac
12269
12270 : see if fsetpos exists
12271 set fsetpos d_fsetpos
12272 eval $inlibc
12273
12274
12275 : see if fstatfs exists
12276 set fstatfs d_fstatfs
12277 eval $inlibc
12278
12279
12280 : see if statvfs exists
12281 set statvfs d_statvfs
12282 eval $inlibc
12283
12284 : see if fstatvfs exists
12285 set fstatvfs d_fstatvfs
12286 eval $inlibc
12287
12288
12289 : see if fsync exists
12290 set fsync d_fsync
12291 eval $inlibc
12292
12293 : see if ftello exists
12294 set ftello d_ftello
12295 eval $inlibc
12296 case "$longsize" in
12297 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12298 esac
12299
12300 : see if getcwd exists
12301 set getcwd d_getcwd
12302 eval $inlibc
12303
12304 : see if getespwnam exists
12305 set getespwnam d_getespwnam
12306 eval $inlibc
12307
12308
12309 : see if getfsstat exists
12310 set getfsstat d_getfsstat
12311 eval $inlibc
12312
12313 : see if getgrent exists
12314 set getgrent d_getgrent
12315 eval $inlibc
12316
12317 : see if getgrent_r exists
12318 set getgrent_r d_getgrent_r
12319 eval $inlibc
12320 case "$d_getgrent_r" in
12321 "$define")
12322         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12323         case "$d_getgrent_r_proto:$usethreads" in
12324         ":define")      d_getgrent_r_proto=define
12325                 set d_getgrent_r_proto getgrent_r $hdrs
12326                 eval $hasproto ;;
12327         *)      ;;
12328         esac
12329         case "$d_getgrent_r_proto" in
12330         define)
12331         case "$getgrent_r_proto" in
12332         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12333         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12334         esac
12335         case "$getgrent_r_proto" in
12336         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12337         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12338         esac
12339         case "$getgrent_r_proto" in
12340         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12341         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12342         esac
12343         case "$getgrent_r_proto" in
12344         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12345         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12346         esac
12347         case "$getgrent_r_proto" in
12348         ''|0) try='int getgrent_r(struct group*, char*, int);'
12349         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12350         esac
12351         case "$getgrent_r_proto" in
12352         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12353         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12354         esac
12355         case "$getgrent_r_proto" in
12356         ''|0)   d_getgrent_r=undef
12357                 getgrent_r_proto=0
12358                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12359         * )     case "$getgrent_r_proto" in
12360                 REENTRANT_PROTO*) ;;
12361                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12362                 esac
12363                 echo "Prototype: $try" ;;
12364         esac
12365         ;;
12366         *)      case "$usethreads" in
12367                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12368                 esac
12369                 d_getgrent_r=undef
12370                 getgrent_r_proto=0
12371                 ;;
12372         esac
12373         ;;
12374 *)      getgrent_r_proto=0
12375         ;;
12376 esac
12377
12378 : see if getgrgid_r exists
12379 set getgrgid_r d_getgrgid_r
12380 eval $inlibc
12381 case "$d_getgrgid_r" in
12382 "$define")
12383         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12384         case "$d_getgrgid_r_proto:$usethreads" in
12385         ":define")      d_getgrgid_r_proto=define
12386                 set d_getgrgid_r_proto getgrgid_r $hdrs
12387                 eval $hasproto ;;
12388         *)      ;;
12389         esac
12390         case "$d_getgrgid_r_proto" in
12391         define)
12392         case "$getgrgid_r_proto" in
12393         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12394         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12395         esac
12396         case "$getgrgid_r_proto" in
12397         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12398         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12399         esac
12400         case "$getgrgid_r_proto" in
12401         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12402         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12403         esac
12404         case "$getgrgid_r_proto" in
12405         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12406         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12407         esac
12408         case "$getgrgid_r_proto" in
12409         ''|0)   d_getgrgid_r=undef
12410                 getgrgid_r_proto=0
12411                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12412         * )     case "$getgrgid_r_proto" in
12413                 REENTRANT_PROTO*) ;;
12414                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12415                 esac
12416                 echo "Prototype: $try" ;;
12417         esac
12418         ;;
12419         *)      case "$usethreads" in
12420                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12421                 esac
12422                 d_getgrgid_r=undef
12423                 getgrgid_r_proto=0
12424                 ;;
12425         esac
12426         ;;
12427 *)      getgrgid_r_proto=0
12428         ;;
12429 esac
12430
12431 : see if getgrnam_r exists
12432 set getgrnam_r d_getgrnam_r
12433 eval $inlibc
12434 case "$d_getgrnam_r" in
12435 "$define")
12436         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12437         case "$d_getgrnam_r_proto:$usethreads" in
12438         ":define")      d_getgrnam_r_proto=define
12439                 set d_getgrnam_r_proto getgrnam_r $hdrs
12440                 eval $hasproto ;;
12441         *)      ;;
12442         esac
12443         case "$d_getgrnam_r_proto" in
12444         define)
12445         case "$getgrnam_r_proto" in
12446         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12447         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12448         esac
12449         case "$getgrnam_r_proto" in
12450         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12451         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12452         esac
12453         case "$getgrnam_r_proto" in
12454         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12455         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12456         esac
12457         case "$getgrnam_r_proto" in
12458         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12459         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12460         esac
12461         case "$getgrnam_r_proto" in
12462         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12463         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12464         esac
12465         case "$getgrnam_r_proto" in
12466         ''|0)   d_getgrnam_r=undef
12467                 getgrnam_r_proto=0
12468                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12469         * )     case "$getgrnam_r_proto" in
12470                 REENTRANT_PROTO*) ;;
12471                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12472                 esac
12473                 echo "Prototype: $try" ;;
12474         esac
12475         ;;
12476         *)      case "$usethreads" in
12477                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12478                 esac
12479                 d_getgrnam_r=undef
12480                 getgrnam_r_proto=0
12481                 ;;
12482         esac
12483         ;;
12484 *)      getgrnam_r_proto=0
12485         ;;
12486 esac
12487
12488 : see if gethostbyaddr exists
12489 set gethostbyaddr d_gethbyaddr
12490 eval $inlibc
12491
12492 : see if gethostbyname exists
12493 set gethostbyname d_gethbyname
12494 eval $inlibc
12495
12496 : see if gethostent exists
12497 set gethostent d_gethent
12498 eval $inlibc
12499
12500 : see how we will look up host name
12501 echo " "
12502 call=''
12503 if set gethostname val -f d_gethname; eval $csym; $val; then
12504         echo 'gethostname() found.' >&4
12505         d_gethname="$define"
12506         call=gethostname
12507 fi
12508 if set uname val -f d_uname; eval $csym; $val; then
12509         if ./xenix; then
12510                 $cat <<'EOM'
12511 uname() was found, but you're running xenix, and older versions of xenix
12512 have a broken uname(). If you don't really know whether your xenix is old
12513 enough to have a broken system call, use the default answer.
12514
12515 EOM
12516                 dflt=y
12517                 case "$d_uname" in
12518                 "$define") dflt=n;;
12519                 esac
12520                 rp='Is your uname() broken?'
12521                 . ./myread
12522                 case "$ans" in
12523                 n*) d_uname="$define"; call=uname;;
12524                 esac
12525         else
12526                 echo 'uname() found.' >&4
12527                 d_uname="$define"
12528                 case "$call" in
12529                 '') call=uname ;;
12530                 esac
12531         fi
12532 fi
12533 case "$d_gethname" in
12534 '') d_gethname="$undef";;
12535 esac
12536 case "$d_uname" in
12537 '') d_uname="$undef";;
12538 esac
12539 case "$d_uname$d_gethname" in
12540 *define*)
12541         dflt=n
12542         cat <<EOM
12543  
12544 Every now and then someone has a $call() that lies about the hostname
12545 but can't be fixed for political or economic reasons.  If you wish, I can
12546 pretend $call() isn't there and maybe compute hostname at run-time
12547 thanks to the '$phostname' command.
12548
12549 EOM
12550         rp="Shall I ignore $call() from now on?"
12551         . ./myread
12552         case "$ans" in
12553         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12554         esac;;
12555 esac
12556 case "$phostname" in
12557 '') aphostname='';;
12558 *) case "$aphostname" in
12559         /*) ;;
12560         *) set X $phostname
12561                 shift
12562                 file=$1
12563                 shift
12564                 file=`./loc $file $file $pth`
12565                 aphostname=`echo $file $*`
12566                 ;;
12567         esac
12568         ;;
12569 esac
12570 case "$d_uname$d_gethname" in
12571 *define*) ;;
12572 *)
12573         case "$phostname" in
12574         '')
12575                 echo "There will be no way for $package to get your hostname." >&4;;
12576         *)
12577         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12578                 ;;
12579         esac;;
12580 esac
12581 case "$d_phostname" in
12582 '') d_phostname="$undef";;
12583 esac
12584
12585 : see if gethostbyaddr_r exists
12586 set gethostbyaddr_r d_gethostbyaddr_r
12587 eval $inlibc
12588 case "$d_gethostbyaddr_r" in
12589 "$define")
12590         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12591         case "$d_gethostbyaddr_r_proto:$usethreads" in
12592         ":define")      d_gethostbyaddr_r_proto=define
12593                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12594                 eval $hasproto ;;
12595         *)      ;;
12596         esac
12597         case "$d_gethostbyaddr_r_proto" in
12598         define)
12599         case "$gethostbyaddr_r_proto" in
12600         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12601         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12602         esac
12603         case "$gethostbyaddr_r_proto" in
12604         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12605         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12606         esac
12607         case "$gethostbyaddr_r_proto" in
12608         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12609         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12610         esac
12611         case "$gethostbyaddr_r_proto" in
12612         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12613         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12614         esac
12615         case "$gethostbyaddr_r_proto" in
12616         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12617         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12618         esac
12619         case "$gethostbyaddr_r_proto" in
12620         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12621         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12622         esac
12623         case "$gethostbyaddr_r_proto" in
12624         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12625         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12626         esac
12627         case "$gethostbyaddr_r_proto" in
12628         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12629         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12630         esac
12631         case "$gethostbyaddr_r_proto" in
12632         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12633         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12634         esac
12635         case "$gethostbyaddr_r_proto" in
12636         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12637         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12638         esac
12639         case "$gethostbyaddr_r_proto" in
12640         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12641         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12642         esac
12643         case "$gethostbyaddr_r_proto" in
12644         ''|0)   d_gethostbyaddr_r=undef
12645                 gethostbyaddr_r_proto=0
12646                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12647         * )     case "$gethostbyaddr_r_proto" in
12648                 REENTRANT_PROTO*) ;;
12649                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12650                 esac
12651                 echo "Prototype: $try" ;;
12652         esac
12653         ;;
12654         *)      case "$usethreads" in
12655                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12656                 esac
12657                 d_gethostbyaddr_r=undef
12658                 gethostbyaddr_r_proto=0
12659                 ;;
12660         esac
12661         ;;
12662 *)      gethostbyaddr_r_proto=0
12663         ;;
12664 esac
12665
12666 : see if gethostbyname_r exists
12667 set gethostbyname_r d_gethostbyname_r
12668 eval $inlibc
12669 case "$d_gethostbyname_r" in
12670 "$define")
12671         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12672         case "$d_gethostbyname_r_proto:$usethreads" in
12673         ":define")      d_gethostbyname_r_proto=define
12674                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12675                 eval $hasproto ;;
12676         *)      ;;
12677         esac
12678         case "$d_gethostbyname_r_proto" in
12679         define)
12680         case "$gethostbyname_r_proto" in
12681         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12682         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12683         esac
12684         case "$gethostbyname_r_proto" in
12685         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12686         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12687         esac
12688         case "$gethostbyname_r_proto" in
12689         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12690         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12691         esac
12692         case "$gethostbyname_r_proto" in
12693         ''|0)   d_gethostbyname_r=undef
12694                 gethostbyname_r_proto=0
12695                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12696         * )     case "$gethostbyname_r_proto" in
12697                 REENTRANT_PROTO*) ;;
12698                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12699                 esac
12700                 echo "Prototype: $try" ;;
12701         esac
12702         ;;
12703         *)      case "$usethreads" in
12704                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12705                 esac
12706                 d_gethostbyname_r=undef
12707                 gethostbyname_r_proto=0
12708                 ;;
12709         esac
12710         ;;
12711 *)      gethostbyname_r_proto=0
12712         ;;
12713 esac
12714
12715 : see if gethostent_r exists
12716 set gethostent_r d_gethostent_r
12717 eval $inlibc
12718 case "$d_gethostent_r" in
12719 "$define")
12720         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12721         case "$d_gethostent_r_proto:$usethreads" in
12722         ":define")      d_gethostent_r_proto=define
12723                 set d_gethostent_r_proto gethostent_r $hdrs
12724                 eval $hasproto ;;
12725         *)      ;;
12726         esac
12727         case "$d_gethostent_r_proto" in
12728         define)
12729         case "$gethostent_r_proto" in
12730         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12731         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12732         esac
12733         case "$gethostent_r_proto" in
12734         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12735         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12736         esac
12737         case "$gethostent_r_proto" in
12738         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12739         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12740         esac
12741         case "$gethostent_r_proto" in
12742         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12743         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12744         esac
12745         case "$gethostent_r_proto" in
12746         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12747         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12748         esac
12749         case "$gethostent_r_proto" in
12750         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12751         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12752         esac
12753         case "$gethostent_r_proto" in
12754         ''|0)   d_gethostent_r=undef
12755                 gethostent_r_proto=0
12756                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12757         * )     case "$gethostent_r_proto" in
12758                 REENTRANT_PROTO*) ;;
12759                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12760                 esac
12761                 echo "Prototype: $try" ;;
12762         esac
12763         ;;
12764         *)      case "$usethreads" in
12765                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12766                 esac
12767                 d_gethostent_r=undef
12768                 gethostent_r_proto=0
12769                 ;;
12770         esac
12771         ;;
12772 *)      gethostent_r_proto=0
12773         ;;
12774 esac
12775
12776 : see if prototypes for various gethostxxx netdb.h functions are available
12777 echo " "
12778 set d_gethostprotos gethostent $i_netdb netdb.h
12779 eval $hasproto
12780
12781 : see if getitimer exists
12782 set getitimer d_getitimer
12783 eval $inlibc
12784
12785 : see if getlogin exists
12786 set getlogin d_getlogin
12787 eval $inlibc
12788
12789 : see if getlogin_r exists
12790 set getlogin_r d_getlogin_r
12791 eval $inlibc
12792 case "$d_getlogin_r" in
12793 "$define")
12794         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12795         case "$d_getlogin_r_proto:$usethreads" in
12796         ":define")      d_getlogin_r_proto=define
12797                 set d_getlogin_r_proto getlogin_r $hdrs
12798                 eval $hasproto ;;
12799         *)      ;;
12800         esac
12801         case "$d_getlogin_r_proto" in
12802         define)
12803         case "$getlogin_r_proto" in
12804         ''|0) try='int getlogin_r(char*, size_t);'
12805         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12806         esac
12807         case "$getlogin_r_proto" in
12808         ''|0) try='int getlogin_r(char*, int);'
12809         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12810         esac
12811         case "$getlogin_r_proto" in
12812         ''|0) try='char* getlogin_r(char*, size_t);'
12813         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12814         esac
12815         case "$getlogin_r_proto" in
12816         ''|0) try='char* getlogin_r(char*, int);'
12817         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12818         esac
12819         case "$getlogin_r_proto" in
12820         ''|0)   d_getlogin_r=undef
12821                 getlogin_r_proto=0
12822                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12823         * )     case "$getlogin_r_proto" in
12824                 REENTRANT_PROTO*) ;;
12825                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12826                 esac
12827                 echo "Prototype: $try" ;;
12828         esac
12829         ;;
12830         *)      case "$usethreads" in
12831                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12832                 esac
12833                 d_getlogin_r=undef
12834                 getlogin_r_proto=0
12835                 ;;
12836         esac
12837         ;;
12838 *)      getlogin_r_proto=0
12839         ;;
12840 esac
12841
12842 : see if getmnt exists
12843 set getmnt d_getmnt
12844 eval $inlibc
12845
12846 : see if getmntent exists
12847 set getmntent d_getmntent
12848 eval $inlibc
12849
12850 : see if getnetbyaddr exists
12851 set getnetbyaddr d_getnbyaddr
12852 eval $inlibc
12853
12854 : see if getnetbyname exists
12855 set getnetbyname d_getnbyname
12856 eval $inlibc
12857
12858 : see if getnetent exists
12859 set getnetent d_getnent
12860 eval $inlibc
12861
12862 : see if getnetbyaddr_r exists
12863 set getnetbyaddr_r d_getnetbyaddr_r
12864 eval $inlibc
12865 case "$d_getnetbyaddr_r" in
12866 "$define")
12867         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12868         case "$d_getnetbyaddr_r_proto:$usethreads" in
12869         ":define")      d_getnetbyaddr_r_proto=define
12870                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12871                 eval $hasproto ;;
12872         *)      ;;
12873         esac
12874         case "$d_getnetbyaddr_r_proto" in
12875         define)
12876         case "$getnetbyaddr_r_proto" in
12877         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12878         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12879         esac
12880         case "$getnetbyaddr_r_proto" in
12881         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12882         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12883         esac
12884         case "$getnetbyaddr_r_proto" in
12885         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12886         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12887         esac
12888         case "$getnetbyaddr_r_proto" in
12889         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12890         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12891         esac
12892         case "$getnetbyaddr_r_proto" in
12893         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12894         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12895         esac
12896         case "$getnetbyaddr_r_proto" in
12897         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12898         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12899         esac
12900         case "$getnetbyaddr_r_proto" in
12901         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12902         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12903         esac
12904         case "$getnetbyaddr_r_proto" in
12905         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12906         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12907         esac
12908         case "$getnetbyaddr_r_proto" in
12909         ''|0)   d_getnetbyaddr_r=undef
12910                 getnetbyaddr_r_proto=0
12911                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12912         * )     case "$getnetbyaddr_r_proto" in
12913                 REENTRANT_PROTO*) ;;
12914                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12915                 esac
12916                 echo "Prototype: $try" ;;
12917         esac
12918         ;;
12919         *)      case "$usethreads" in
12920                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12921                 esac
12922                 d_getnetbyaddr_r=undef
12923                 getnetbyaddr_r_proto=0
12924                 ;;
12925         esac
12926         ;;
12927 *)      getnetbyaddr_r_proto=0
12928         ;;
12929 esac
12930
12931 : see if getnetbyname_r exists
12932 set getnetbyname_r d_getnetbyname_r
12933 eval $inlibc
12934 case "$d_getnetbyname_r" in
12935 "$define")
12936         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12937         case "$d_getnetbyname_r_proto:$usethreads" in
12938         ":define")      d_getnetbyname_r_proto=define
12939                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12940                 eval $hasproto ;;
12941         *)      ;;
12942         esac
12943         case "$d_getnetbyname_r_proto" in
12944         define)
12945         case "$getnetbyname_r_proto" in
12946         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12947         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12948         esac
12949         case "$getnetbyname_r_proto" in
12950         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12951         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12952         esac
12953         case "$getnetbyname_r_proto" in
12954         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12955         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12956         esac
12957         case "$getnetbyname_r_proto" in
12958         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12959         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12960         esac
12961         case "$getnetbyname_r_proto" in
12962         ''|0)   d_getnetbyname_r=undef
12963                 getnetbyname_r_proto=0
12964                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12965         * )     case "$getnetbyname_r_proto" in
12966                 REENTRANT_PROTO*) ;;
12967                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12968                 esac
12969                 echo "Prototype: $try" ;;
12970         esac
12971         ;;
12972         *)      case "$usethreads" in
12973                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12974                 esac
12975                 d_getnetbyname_r=undef
12976                 getnetbyname_r_proto=0
12977                 ;;
12978         esac
12979         ;;
12980 *)      getnetbyname_r_proto=0
12981         ;;
12982 esac
12983
12984 : see if getnetent_r exists
12985 set getnetent_r d_getnetent_r
12986 eval $inlibc
12987 case "$d_getnetent_r" in
12988 "$define")
12989         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12990         case "$d_getnetent_r_proto:$usethreads" in
12991         ":define")      d_getnetent_r_proto=define
12992                 set d_getnetent_r_proto getnetent_r $hdrs
12993                 eval $hasproto ;;
12994         *)      ;;
12995         esac
12996         case "$d_getnetent_r_proto" in
12997         define)
12998         case "$getnetent_r_proto" in
12999         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13000         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13001         esac
13002         case "$getnetent_r_proto" in
13003         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13004         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13005         esac
13006         case "$getnetent_r_proto" in
13007         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13008         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13009         esac
13010         case "$getnetent_r_proto" in
13011         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13012         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13013         esac
13014         case "$getnetent_r_proto" in
13015         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13016         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13017         esac
13018         case "$getnetent_r_proto" in
13019         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13020         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13021         esac
13022         case "$getnetent_r_proto" in
13023         ''|0)   d_getnetent_r=undef
13024                 getnetent_r_proto=0
13025                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13026         * )     case "$getnetent_r_proto" in
13027                 REENTRANT_PROTO*) ;;
13028                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13029                 esac
13030                 echo "Prototype: $try" ;;
13031         esac
13032         ;;
13033         *)      case "$usethreads" in
13034                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13035                 esac
13036                 d_getnetent_r=undef
13037                 getnetent_r_proto=0
13038                 ;;
13039         esac
13040         ;;
13041 *)      getnetent_r_proto=0
13042         ;;
13043 esac
13044
13045 : see if prototypes for various getnetxxx netdb.h functions are available
13046 echo " "
13047 set d_getnetprotos getnetent $i_netdb netdb.h
13048 eval $hasproto
13049
13050 : see if getpagesize exists
13051 set getpagesize d_getpagsz
13052 eval $inlibc
13053
13054
13055 : see if getprotobyname exists
13056 set getprotobyname d_getpbyname
13057 eval $inlibc
13058
13059 : see if getprotobynumber exists
13060 set getprotobynumber d_getpbynumber
13061 eval $inlibc
13062
13063 : see if getprotoent exists
13064 set getprotoent d_getpent
13065 eval $inlibc
13066
13067 : see if getpgid exists
13068 set getpgid d_getpgid
13069 eval $inlibc
13070
13071 : see if getpgrp2 exists
13072 set getpgrp2 d_getpgrp2
13073 eval $inlibc
13074
13075 : see if getppid exists
13076 set getppid d_getppid
13077 eval $inlibc
13078
13079 : see if getpriority exists
13080 set getpriority d_getprior
13081 eval $inlibc
13082
13083 : see if getprotobyname_r exists
13084 set getprotobyname_r d_getprotobyname_r
13085 eval $inlibc
13086 case "$d_getprotobyname_r" in
13087 "$define")
13088         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13089         case "$d_getprotobyname_r_proto:$usethreads" in
13090         ":define")      d_getprotobyname_r_proto=define
13091                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13092                 eval $hasproto ;;
13093         *)      ;;
13094         esac
13095         case "$d_getprotobyname_r_proto" in
13096         define)
13097         case "$getprotobyname_r_proto" in
13098         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13099         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13100         esac
13101         case "$getprotobyname_r_proto" in
13102         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13103         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13104         esac
13105         case "$getprotobyname_r_proto" in
13106         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13107         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13108         esac
13109         case "$getprotobyname_r_proto" in
13110         ''|0)   d_getprotobyname_r=undef
13111                 getprotobyname_r_proto=0
13112                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13113         * )     case "$getprotobyname_r_proto" in
13114                 REENTRANT_PROTO*) ;;
13115                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13116                 esac
13117                 echo "Prototype: $try" ;;
13118         esac
13119         ;;
13120         *)      case "$usethreads" in
13121                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13122                 esac
13123                 d_getprotobyname_r=undef
13124                 getprotobyname_r_proto=0
13125                 ;;
13126         esac
13127         ;;
13128 *)      getprotobyname_r_proto=0
13129         ;;
13130 esac
13131
13132 : see if getprotobynumber_r exists
13133 set getprotobynumber_r d_getprotobynumber_r
13134 eval $inlibc
13135 case "$d_getprotobynumber_r" in
13136 "$define")
13137         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13138         case "$d_getprotobynumber_r_proto:$usethreads" in
13139         ":define")      d_getprotobynumber_r_proto=define
13140                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13141                 eval $hasproto ;;
13142         *)      ;;
13143         esac
13144         case "$d_getprotobynumber_r_proto" in
13145         define)
13146         case "$getprotobynumber_r_proto" in
13147         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13148         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13149         esac
13150         case "$getprotobynumber_r_proto" in
13151         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13152         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13153         esac
13154         case "$getprotobynumber_r_proto" in
13155         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13156         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13157         esac
13158         case "$getprotobynumber_r_proto" in
13159         ''|0)   d_getprotobynumber_r=undef
13160                 getprotobynumber_r_proto=0
13161                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13162         * )     case "$getprotobynumber_r_proto" in
13163                 REENTRANT_PROTO*) ;;
13164                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13165                 esac
13166                 echo "Prototype: $try" ;;
13167         esac
13168         ;;
13169         *)      case "$usethreads" in
13170                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13171                 esac
13172                 d_getprotobynumber_r=undef
13173                 getprotobynumber_r_proto=0
13174                 ;;
13175         esac
13176         ;;
13177 *)      getprotobynumber_r_proto=0
13178         ;;
13179 esac
13180
13181 : see if getprotoent_r exists
13182 set getprotoent_r d_getprotoent_r
13183 eval $inlibc
13184 case "$d_getprotoent_r" in
13185 "$define")
13186         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13187         case "$d_getprotoent_r_proto:$usethreads" in
13188         ":define")      d_getprotoent_r_proto=define
13189                 set d_getprotoent_r_proto getprotoent_r $hdrs
13190                 eval $hasproto ;;
13191         *)      ;;
13192         esac
13193         case "$d_getprotoent_r_proto" in
13194         define)
13195         case "$getprotoent_r_proto" in
13196         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13197         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13198         esac
13199         case "$getprotoent_r_proto" in
13200         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13201         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13202         esac
13203         case "$getprotoent_r_proto" in
13204         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13205         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13206         esac
13207         case "$getprotoent_r_proto" in
13208         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13209         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13210         esac
13211         case "$getprotoent_r_proto" in
13212         ''|0)   d_getprotoent_r=undef
13213                 getprotoent_r_proto=0
13214                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13215         * )     case "$getprotoent_r_proto" in
13216                 REENTRANT_PROTO*) ;;
13217                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13218                 esac
13219                 echo "Prototype: $try" ;;
13220         esac
13221         ;;
13222         *)      case "$usethreads" in
13223                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13224                 esac
13225                 d_getprotoent_r=undef
13226                 getprotoent_r_proto=0
13227                 ;;
13228         esac
13229         ;;
13230 *)      getprotoent_r_proto=0
13231         ;;
13232 esac
13233
13234 : see if prototypes for various getprotoxxx netdb.h functions are available
13235 echo " "
13236 set d_getprotoprotos getprotoent $i_netdb netdb.h
13237 eval $hasproto
13238
13239 : see if getprpwnam exists
13240 set getprpwnam d_getprpwnam
13241 eval $inlibc
13242
13243 : see if getpwent exists
13244 set getpwent d_getpwent
13245 eval $inlibc
13246
13247 : see if getpwent_r exists
13248 set getpwent_r d_getpwent_r
13249 eval $inlibc
13250 case "$d_getpwent_r" in
13251 "$define")
13252         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13253         case "$d_getpwent_r_proto:$usethreads" in
13254         ":define")      d_getpwent_r_proto=define
13255                 set d_getpwent_r_proto getpwent_r $hdrs
13256                 eval $hasproto ;;
13257         *)      ;;
13258         esac
13259         case "$d_getpwent_r_proto" in
13260         define)
13261         case "$getpwent_r_proto" in
13262         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13263         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13264         esac
13265         case "$getpwent_r_proto" in
13266         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13267         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13268         esac
13269         case "$getpwent_r_proto" in
13270         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13271         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13272         esac
13273         case "$getpwent_r_proto" in
13274         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13275         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13276         esac
13277         case "$getpwent_r_proto" in
13278         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13279         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13280         esac
13281         case "$getpwent_r_proto" in
13282         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13283         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13284         esac
13285         case "$getpwent_r_proto" in
13286         ''|0)   d_getpwent_r=undef
13287                 getpwent_r_proto=0
13288                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13289         * )     case "$getpwent_r_proto" in
13290                 REENTRANT_PROTO*) ;;
13291                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13292                 esac
13293                 echo "Prototype: $try" ;;
13294         esac
13295         ;;
13296         *)      case "$usethreads" in
13297                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13298                 esac
13299                 d_getpwent_r=undef
13300                 getpwent_r_proto=0
13301                 ;;
13302         esac
13303         ;;
13304 *)      getpwent_r_proto=0
13305         ;;
13306 esac
13307
13308 : see if getpwnam_r exists
13309 set getpwnam_r d_getpwnam_r
13310 eval $inlibc
13311 case "$d_getpwnam_r" in
13312 "$define")
13313         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13314         case "$d_getpwnam_r_proto:$usethreads" in
13315         ":define")      d_getpwnam_r_proto=define
13316                 set d_getpwnam_r_proto getpwnam_r $hdrs
13317                 eval $hasproto ;;
13318         *)      ;;
13319         esac
13320         case "$d_getpwnam_r_proto" in
13321         define)
13322         case "$getpwnam_r_proto" in
13323         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13324         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13325         esac
13326         case "$getpwnam_r_proto" in
13327         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13328         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13329         esac
13330         case "$getpwnam_r_proto" in
13331         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13332         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13333         esac
13334         case "$getpwnam_r_proto" in
13335         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13336         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13337         esac
13338         case "$getpwnam_r_proto" in
13339         ''|0)   d_getpwnam_r=undef
13340                 getpwnam_r_proto=0
13341                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13342         * )     case "$getpwnam_r_proto" in
13343                 REENTRANT_PROTO*) ;;
13344                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13345                 esac
13346                 echo "Prototype: $try" ;;
13347         esac
13348         ;;
13349         *)      case "$usethreads" in
13350                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13351                 esac
13352                 d_getpwnam_r=undef
13353                 getpwnam_r_proto=0
13354                 ;;
13355         esac
13356         ;;
13357 *)      getpwnam_r_proto=0
13358         ;;
13359 esac
13360
13361 : see if getpwuid_r exists
13362 set getpwuid_r d_getpwuid_r
13363 eval $inlibc
13364 case "$d_getpwuid_r" in
13365 "$define")
13366         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13367         case "$d_getpwuid_r_proto:$usethreads" in
13368         ":define")      d_getpwuid_r_proto=define
13369                 set d_getpwuid_r_proto getpwuid_r $hdrs
13370                 eval $hasproto ;;
13371         *)      ;;
13372         esac
13373         case "$d_getpwuid_r_proto" in
13374         define)
13375         case "$getpwuid_r_proto" in
13376         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13377         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13378         esac
13379         case "$getpwuid_r_proto" in
13380         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13381         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13382         esac
13383         case "$getpwuid_r_proto" in
13384         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13385         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13386         esac
13387         case "$getpwuid_r_proto" in
13388         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13389         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13390         esac
13391         case "$getpwuid_r_proto" in
13392         ''|0)   d_getpwuid_r=undef
13393                 getpwuid_r_proto=0
13394                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13395         * )     case "$getpwuid_r_proto" in
13396                 REENTRANT_PROTO*) ;;
13397                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13398                 esac
13399                 echo "Prototype: $try" ;;
13400         esac
13401         ;;
13402         *)      case "$usethreads" in
13403                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13404                 esac
13405                 d_getpwuid_r=undef
13406                 getpwuid_r_proto=0
13407                 ;;
13408         esac
13409         ;;
13410 *)      getpwuid_r_proto=0
13411         ;;
13412 esac
13413
13414
13415 : see if getservbyname exists
13416 set getservbyname d_getsbyname
13417 eval $inlibc
13418
13419 : see if getservbyport exists
13420 set getservbyport d_getsbyport
13421 eval $inlibc
13422
13423 : see if getservent exists
13424 set getservent d_getsent
13425 eval $inlibc
13426
13427 : see if getservbyname_r exists
13428 set getservbyname_r d_getservbyname_r
13429 eval $inlibc
13430 case "$d_getservbyname_r" in
13431 "$define")
13432         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13433         case "$d_getservbyname_r_proto:$usethreads" in
13434         ":define")      d_getservbyname_r_proto=define
13435                 set d_getservbyname_r_proto getservbyname_r $hdrs
13436                 eval $hasproto ;;
13437         *)      ;;
13438         esac
13439         case "$d_getservbyname_r_proto" in
13440         define)
13441         case "$getservbyname_r_proto" in
13442         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13443         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13444         esac
13445         case "$getservbyname_r_proto" in
13446         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13447         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13448         esac
13449         case "$getservbyname_r_proto" in
13450         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13451         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13452         esac
13453         case "$getservbyname_r_proto" in
13454         ''|0)   d_getservbyname_r=undef
13455                 getservbyname_r_proto=0
13456                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13457         * )     case "$getservbyname_r_proto" in
13458                 REENTRANT_PROTO*) ;;
13459                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13460                 esac
13461                 echo "Prototype: $try" ;;
13462         esac
13463         ;;
13464         *)      case "$usethreads" in
13465                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13466                 esac
13467                 d_getservbyname_r=undef
13468                 getservbyname_r_proto=0
13469                 ;;
13470         esac
13471         ;;
13472 *)      getservbyname_r_proto=0
13473         ;;
13474 esac
13475
13476 : see if getservbyport_r exists
13477 set getservbyport_r d_getservbyport_r
13478 eval $inlibc
13479 case "$d_getservbyport_r" in
13480 "$define")
13481         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13482         case "$d_getservbyport_r_proto:$usethreads" in
13483         ":define")      d_getservbyport_r_proto=define
13484                 set d_getservbyport_r_proto getservbyport_r $hdrs
13485                 eval $hasproto ;;
13486         *)      ;;
13487         esac
13488         case "$d_getservbyport_r_proto" in
13489         define)
13490         case "$getservbyport_r_proto" in
13491         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13492         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13493         esac
13494         case "$getservbyport_r_proto" in
13495         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13496         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13497         esac
13498         case "$getservbyport_r_proto" in
13499         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13500         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13501         esac
13502         case "$getservbyport_r_proto" in
13503         ''|0)   d_getservbyport_r=undef
13504                 getservbyport_r_proto=0
13505                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13506         * )     case "$getservbyport_r_proto" in
13507                 REENTRANT_PROTO*) ;;
13508                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13509                 esac
13510                 echo "Prototype: $try" ;;
13511         esac
13512         ;;
13513         *)      case "$usethreads" in
13514                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13515                 esac
13516                 d_getservbyport_r=undef
13517                 getservbyport_r_proto=0
13518                 ;;
13519         esac
13520         ;;
13521 *)      getservbyport_r_proto=0
13522         ;;
13523 esac
13524
13525 : see if getservent_r exists
13526 set getservent_r d_getservent_r
13527 eval $inlibc
13528 case "$d_getservent_r" in
13529 "$define")
13530         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13531         case "$d_getservent_r_proto:$usethreads" in
13532         ":define")      d_getservent_r_proto=define
13533                 set d_getservent_r_proto getservent_r $hdrs
13534                 eval $hasproto ;;
13535         *)      ;;
13536         esac
13537         case "$d_getservent_r_proto" in
13538         define)
13539         case "$getservent_r_proto" in
13540         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13541         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13542         esac
13543         case "$getservent_r_proto" in
13544         ''|0) try='int getservent_r(struct servent*, char*, int);'
13545         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13546         esac
13547         case "$getservent_r_proto" in
13548         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13549         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13550         esac
13551         case "$getservent_r_proto" in
13552         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13553         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13554         esac
13555         case "$getservent_r_proto" in
13556         ''|0)   d_getservent_r=undef
13557                 getservent_r_proto=0
13558                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13559         * )     case "$getservent_r_proto" in
13560                 REENTRANT_PROTO*) ;;
13561                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13562                 esac
13563                 echo "Prototype: $try" ;;
13564         esac
13565         ;;
13566         *)      case "$usethreads" in
13567                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13568                 esac
13569                 d_getservent_r=undef
13570                 getservent_r_proto=0
13571                 ;;
13572         esac
13573         ;;
13574 *)      getservent_r_proto=0
13575         ;;
13576 esac
13577
13578 : see if prototypes for various getservxxx netdb.h functions are available
13579 echo " "
13580 set d_getservprotos getservent $i_netdb netdb.h
13581 eval $hasproto
13582
13583 : see if getspnam exists
13584 set getspnam d_getspnam
13585 eval $inlibc
13586
13587 : see if this is a shadow.h system
13588 set shadow.h i_shadow
13589 eval $inhdr
13590
13591 : see if getspnam_r exists
13592 set getspnam_r d_getspnam_r
13593 eval $inlibc
13594 case "$d_getspnam_r" in
13595 "$define")
13596         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13597         case "$d_getspnam_r_proto:$usethreads" in
13598         ":define")      d_getspnam_r_proto=define
13599                 set d_getspnam_r_proto getspnam_r $hdrs
13600                 eval $hasproto ;;
13601         *)      ;;
13602         esac
13603         case "$d_getspnam_r_proto" in
13604         define)
13605         case "$getspnam_r_proto" in
13606         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13607         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13608         esac
13609         case "$getspnam_r_proto" in
13610         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13611         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13612         esac
13613         case "$getspnam_r_proto" in
13614         ''|0)   d_getspnam_r=undef
13615                 getspnam_r_proto=0
13616                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13617         * )     case "$getspnam_r_proto" in
13618                 REENTRANT_PROTO*) ;;
13619                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13620                 esac
13621                 echo "Prototype: $try" ;;
13622         esac
13623         ;;
13624         *)      case "$usethreads" in
13625                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13626                 esac
13627                 d_getspnam_r=undef
13628                 getspnam_r_proto=0
13629                 ;;
13630         esac
13631         ;;
13632 *)      getspnam_r_proto=0
13633         ;;
13634 esac
13635
13636 : see if gettimeofday or ftime exists
13637 set gettimeofday d_gettimeod
13638 eval $inlibc
13639 case "$d_gettimeod" in
13640 "$undef")
13641         set ftime d_ftime 
13642         eval $inlibc
13643         ;;
13644 *)
13645         val="$undef"; set d_ftime; eval $setvar
13646         ;;
13647 esac
13648 case "$d_gettimeod$d_ftime" in
13649 "$undef$undef")
13650         echo " "
13651         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13652         ;;
13653 esac
13654
13655 : see if gmtime_r exists
13656 set gmtime_r d_gmtime_r
13657 eval $inlibc
13658 case "$d_gmtime_r" in
13659 "$define")
13660         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13661         case "$d_gmtime_r_proto:$usethreads" in
13662         ":define")      d_gmtime_r_proto=define
13663                 set d_gmtime_r_proto gmtime_r $hdrs
13664                 eval $hasproto ;;
13665         *)      ;;
13666         esac
13667         case "$d_gmtime_r_proto" in
13668         define)
13669         case "$gmtime_r_proto" in
13670         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13671         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13672         esac
13673         case "$gmtime_r_proto" in
13674         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13675         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13676         esac
13677         case "$gmtime_r_proto" in
13678         ''|0)   d_gmtime_r=undef
13679                 gmtime_r_proto=0
13680                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13681         * )     case "$gmtime_r_proto" in
13682                 REENTRANT_PROTO*) ;;
13683                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13684                 esac
13685                 echo "Prototype: $try" ;;
13686         esac
13687         ;;
13688         *)      case "$usethreads" in
13689                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13690                 esac
13691                 d_gmtime_r=undef
13692                 gmtime_r_proto=0
13693                 ;;
13694         esac
13695         ;;
13696 *)      gmtime_r_proto=0
13697         ;;
13698 esac
13699
13700 : see if hasmntopt exists
13701 set hasmntopt d_hasmntopt
13702 eval $inlibc
13703
13704 : see if this is a netinet/in.h or sys/in.h system
13705 set netinet/in.h i_niin sys/in.h i_sysin
13706 eval $inhdr
13707
13708 : see if arpa/inet.h has to be included
13709 set arpa/inet.h i_arpainet
13710 eval $inhdr
13711
13712 : see if htonl --and friends-- exists
13713 val=''
13714 set htonl val
13715 eval $inlibc
13716
13717 : Maybe they are macros.
13718 case "$val" in
13719 $undef)
13720         $cat >htonl.c <<EOM
13721 #include <stdio.h>
13722 #include <sys/types.h>
13723 #$i_niin I_NETINET_IN
13724 #$i_sysin I_SYS_IN
13725 #$i_arpainet I_ARPA_INET
13726 #ifdef I_NETINET_IN
13727 #include <netinet/in.h>
13728 #endif
13729 #ifdef I_SYS_IN
13730 #include <sys/in.h>
13731 #endif
13732 #ifdef I_ARPA_INET
13733 #include <arpa/inet.h>
13734 #endif
13735 #ifdef htonl
13736 printf("Defined as a macro.");
13737 #endif
13738 EOM
13739         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13740         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13741                 val="$define"
13742                 echo "But it seems to be defined as a macro." >&4
13743         fi
13744         $rm -f htonl.?
13745         ;;
13746 esac
13747 set d_htonl
13748 eval $setvar
13749
13750 : see if ilogbl exists
13751 set ilogbl d_ilogbl
13752 eval $inlibc
13753
13754 : index or strchr
13755 echo " "
13756 if set index val -f; eval $csym; $val; then
13757         if set strchr val -f d_strchr; eval $csym; $val; then
13758                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13759                         val="$define"
13760                         vali="$undef"
13761                         echo "strchr() found." >&4
13762                 else
13763                         val="$undef"
13764                         vali="$define"
13765                         echo "index() found." >&4
13766                 fi
13767         else
13768                 val="$undef"
13769                 vali="$define"
13770                 echo "index() found." >&4
13771         fi
13772 else
13773         if set strchr val -f d_strchr; eval $csym; $val; then
13774                 val="$define"
13775                 vali="$undef"
13776                 echo "strchr() found." >&4
13777         else
13778                 echo "No index() or strchr() found!" >&4
13779                 val="$undef"
13780                 vali="$undef"
13781         fi
13782 fi
13783 set d_strchr; eval $setvar
13784 val="$vali"
13785 set d_index; eval $setvar
13786
13787 : check whether inet_aton exists
13788 set inet_aton d_inetaton
13789 eval $inlibc
13790
13791 : Look for isascii
13792 echo " "
13793 $cat >isascii.c <<EOCP
13794 #include <stdio.h>
13795 #include <ctype.h>
13796 #$i_stdlib I_STDLIB
13797 #ifdef I_STDLIB
13798 #include <stdlib.h>
13799 #endif
13800 int main() {
13801         int c = 'A';
13802         if (isascii(c))
13803                 exit(0);
13804         else
13805                 exit(1);
13806 }
13807 EOCP
13808 set isascii
13809 if eval $compile; then
13810         echo "isascii() found." >&4
13811         val="$define"
13812 else
13813         echo "isascii() NOT found." >&4
13814         val="$undef"
13815 fi
13816 set d_isascii
13817 eval $setvar
13818 $rm -f isascii*
13819
13820 : see if isfinite exists
13821 set isfinite d_isfinite
13822 eval $inlibc
13823
13824 : see if isinf exists
13825 set isinf d_isinf
13826 eval $inlibc
13827
13828 : see if isnan exists
13829 set isnan d_isnan
13830 eval $inlibc
13831
13832 : see if isnanl exists
13833 set isnanl d_isnanl
13834 eval $inlibc
13835
13836 : see if killpg exists
13837 set killpg d_killpg
13838 eval $inlibc
13839
13840 : see if lchown exists
13841 echo " "
13842 $cat > try.c <<'EOCP'
13843 /* System header to define __stub macros and hopefully few prototypes,
13844     which can conflict with char lchown(); below.  */
13845 #include <assert.h>
13846 /* Override any gcc2 internal prototype to avoid an error.  */
13847 /* We use char because int might match the return type of a gcc2
13848    builtin and then its argument prototype would still apply.  */
13849 char lchown();
13850 int main() {
13851     /*  The GNU C library defines this for functions which it implements
13852         to always fail with ENOSYS.  Some functions are actually named
13853         something starting with __ and the normal name is an alias.  */
13854 #if defined (__stub_lchown) || defined (__stub___lchown)
13855 choke me
13856 #else
13857 lchown();
13858 #endif
13859 ; return 0; }
13860 EOCP
13861 set try
13862 if eval $compile; then
13863     $echo "lchown() found." >&4
13864     val="$define"
13865 else
13866     $echo "lchown() NOT found." >&4
13867     val="$undef"
13868 fi
13869 set d_lchown
13870 eval $setvar
13871
13872 : See if number of significant digits in a double precision number is known
13873 echo " "
13874 $cat >ldbl_dig.c <<EOM
13875 #$i_limits I_LIMITS
13876 #$i_float I_FLOAT
13877 #ifdef I_LIMITS
13878 #include <limits.h>
13879 #endif
13880 #ifdef I_FLOAT
13881 #include <float.h>
13882 #endif
13883 #ifdef LDBL_DIG
13884 printf("Contains LDBL_DIG");
13885 #endif
13886 EOM
13887 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13888 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13889         echo "LDBL_DIG found." >&4
13890         val="$define"
13891 else
13892         echo "LDBL_DIG NOT found." >&4
13893         val="$undef"
13894 fi
13895 $rm -f ldbl_dig.?
13896 set d_ldbl_dig
13897 eval $setvar
13898
13899 : see if link exists
13900 set link d_link
13901 eval $inlibc
13902
13903 : see if localtime_r exists
13904 set localtime_r d_localtime_r
13905 eval $inlibc
13906 case "$d_localtime_r" in
13907 "$define")
13908         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13909         case "$d_localtime_r_proto:$usethreads" in
13910         ":define")      d_localtime_r_proto=define
13911                 set d_localtime_r_proto localtime_r $hdrs
13912                 eval $hasproto ;;
13913         *)      ;;
13914         esac
13915         case "$d_localtime_r_proto" in
13916         define)
13917         case "$localtime_r_proto" in
13918         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13919         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13920         esac
13921         case "$localtime_r_proto" in
13922         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13923         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13924         esac
13925         case "$localtime_r_proto" in
13926         ''|0)   d_localtime_r=undef
13927                 localtime_r_proto=0
13928                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13929         * )     case "$localtime_r_proto" in
13930                 REENTRANT_PROTO*) ;;
13931                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13932                 esac
13933                 echo "Prototype: $try" ;;
13934         esac
13935         ;;
13936         *)      case "$usethreads" in
13937                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13938                 esac
13939                 d_localtime_r=undef
13940                 localtime_r_proto=0
13941                 ;;
13942         esac
13943         ;;
13944 *)      localtime_r_proto=0
13945         ;;
13946 esac
13947
13948 : see if localeconv exists
13949 set localeconv d_locconv
13950 eval $inlibc
13951
13952 : see if lockf exists
13953 set lockf d_lockf
13954 eval $inlibc
13955
13956 : see if prototype for lseek is available
13957 echo " "
13958 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13959 eval $hasproto
13960
13961 : see if lstat exists
13962 set lstat d_lstat
13963 eval $inlibc
13964
13965 : see if madvise exists
13966 set madvise d_madvise
13967 eval $inlibc
13968
13969 : see if mblen exists
13970 set mblen d_mblen
13971 eval $inlibc
13972
13973 : see if mbstowcs exists
13974 set mbstowcs d_mbstowcs
13975 eval $inlibc
13976
13977 : see if mbtowc exists
13978 set mbtowc d_mbtowc
13979 eval $inlibc
13980
13981 : see if memchr exists
13982 set memchr d_memchr
13983 eval $inlibc
13984
13985 : see if memcmp exists
13986 set memcmp d_memcmp
13987 eval $inlibc
13988
13989 : see if memcpy exists
13990 set memcpy d_memcpy
13991 eval $inlibc
13992
13993 : see if memmove exists
13994 set memmove d_memmove
13995 eval $inlibc
13996
13997 : see if memset exists
13998 set memset d_memset
13999 eval $inlibc
14000
14001 : see if mkdir exists
14002 set mkdir d_mkdir
14003 eval $inlibc
14004
14005 : see if mkdtemp exists
14006 set mkdtemp d_mkdtemp
14007 eval $inlibc
14008
14009 : see if mkfifo exists
14010 set mkfifo d_mkfifo
14011 eval $inlibc
14012
14013 : see if mkstemp exists
14014 set mkstemp d_mkstemp
14015 eval $inlibc
14016
14017 : see if mkstemps exists
14018 set mkstemps d_mkstemps
14019 eval $inlibc
14020
14021 : see if mktime exists
14022 set mktime d_mktime
14023 eval $inlibc
14024
14025 : see if this is a sys/mman.h system
14026 set sys/mman.h i_sysmman
14027 eval $inhdr
14028
14029 : see if mmap exists
14030 set mmap d_mmap
14031 eval $inlibc
14032 : see what shmat returns
14033 : default to something harmless
14034 mmaptype='void *'
14035 case "$i_sysmman$d_mmap" in
14036 "$define$define")
14037         $cat >mmap.c <<'END'
14038 #include <sys/mman.h>
14039 void *mmap();
14040 END
14041         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14042                 mmaptype='void *'
14043         else
14044                 mmaptype='caddr_t'
14045         fi
14046         echo "and it returns ($mmaptype)." >&4
14047         ;;
14048 esac
14049
14050
14051
14052 : see if sqrtl exists
14053 set sqrtl d_sqrtl
14054 eval $inlibc
14055
14056 : see if scalbnl exists
14057 set scalbnl d_scalbnl
14058 eval $inlibc
14059
14060 : see if modfl exists
14061 set modfl d_modfl
14062 eval $inlibc
14063
14064 : see if prototype for modfl is available
14065 echo " "
14066 set d_modflproto modfl math.h
14067 eval $hasproto
14068
14069 d_modfl_pow32_bug="$undef"
14070
14071 case "$d_longdbl$d_modfl" in
14072 $define$define)
14073         $cat <<EOM
14074 Checking to see whether your modfl() is okay for large values...
14075 EOM
14076 $cat >try.c <<EOCP
14077 #include <math.h> 
14078 #include <stdio.h>
14079 EOCP
14080 if $test "X$d_modflproto" != "X$define"; then
14081         $cat >>try.c <<EOCP
14082 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14083 long double modfl (long double, long double *);
14084 EOCP
14085 fi
14086 $cat >>try.c <<EOCP
14087 int main() {
14088     long double nv = 4294967303.15;
14089     long double v, w;
14090     v = modfl(nv, &w);         
14091 #ifdef __GLIBC__
14092     printf("glibc");
14093 #endif
14094     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14095     return 0;
14096 }
14097 EOCP
14098         case "$osname:$gccversion" in
14099         aix:)   saveccflags="$ccflags"
14100                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14101         esac
14102         set try
14103         if eval $compile; then
14104                 foo=`$run ./try`
14105                 case "$foo" in
14106                 *" 4294967303.150000 1.150000 4294967302.000000")
14107                         echo >&4 "Your modfl() is broken for large values."
14108                         d_modfl_pow32_bug="$define"
14109                         case "$foo" in
14110                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14111                         ;;
14112                         esac
14113                         ;;
14114                 *" 4294967303.150000 0.150000 4294967303.000000")
14115                         echo >&4 "Your modfl() seems okay for large values."
14116                         ;;
14117                 *)      echo >&4 "I don't understand your modfl() at all."
14118                         d_modfl="$undef"
14119                         ;;
14120                 esac
14121                 $rm -f try.* try core core.try.*
14122         else
14123                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14124                 d_modfl="$undef"
14125         fi
14126         case "$osname:$gccversion" in
14127         aix:)   ccflags="$saveccflags" ;; # restore
14128         esac
14129         ;;
14130 esac
14131
14132 if $test "$uselongdouble" = "$define"; then
14133     message=""
14134     if $test "$d_sqrtl" != "$define"; then
14135         message="$message sqrtl"
14136     fi
14137     if $test "$d_modfl" != "$define"; then
14138         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14139             echo "You have both aintl and copysignl, so I can emulate modfl."
14140         else
14141             message="$message modfl"
14142         fi
14143     fi
14144     if $test "$d_frexpl" != "$define"; then
14145         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14146             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14147         else
14148             message="$message frexpl"
14149         fi
14150     fi
14151
14152     if $test "$message" != ""; then
14153         $cat <<EOM >&4
14154
14155 *** You requested the use of long doubles but you do not seem to have
14156 *** the following mathematical functions needed for long double support:
14157 ***    $message
14158 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14159 *** Cannot continue, aborting.
14160
14161 EOM
14162
14163         exit 1
14164     fi
14165 fi
14166
14167 : see if mprotect exists
14168 set mprotect d_mprotect
14169 eval $inlibc
14170
14171 : see if msgctl exists
14172 set msgctl d_msgctl
14173 eval $inlibc
14174
14175 : see if msgget exists
14176 set msgget d_msgget
14177 eval $inlibc
14178
14179 : see if msgsnd exists
14180 set msgsnd d_msgsnd
14181 eval $inlibc
14182
14183 : see if msgrcv exists
14184 set msgrcv d_msgrcv
14185 eval $inlibc
14186
14187 : see how much of the 'msg*(2)' library is present.
14188 h_msg=true
14189 echo " "
14190 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14191 *"$undef"*) h_msg=false;;
14192 esac
14193 case "$osname" in
14194 freebsd)
14195     case "`ipcs 2>&1`" in
14196     "SVID messages"*"not configured"*)
14197         echo "Your $osname does not have the msg*(2) configured." >&4
14198         h_msg=false
14199         val="$undef"
14200         set msgctl d_msgctl
14201         eval $setvar
14202         set msgget d_msgget
14203         eval $setvar
14204         set msgsnd d_msgsnd
14205         eval $setvar
14206         set msgrcv d_msgrcv
14207         eval $setvar
14208         ;;
14209     esac
14210     ;;
14211 esac
14212 : we could also check for sys/ipc.h ...
14213 if $h_msg && $test `./findhdr sys/msg.h`; then
14214         echo "You have the full msg*(2) library." >&4
14215         val="$define"
14216 else
14217         echo "You don't have the full msg*(2) library." >&4
14218         val="$undef"
14219 fi
14220 set d_msg
14221 eval $setvar
14222
14223
14224 echo " "
14225 echo "Checking to see if your system supports struct msghdr..." >&4
14226 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14227 eval $hasstruct
14228 case "$d_msghdr_s" in
14229 "$define")      echo "Yes, it does."   ;;
14230 *)              echo "No, it doesn't." ;;
14231 esac
14232
14233
14234 : see if msync exists
14235 set msync d_msync
14236 eval $inlibc
14237
14238 : see if munmap exists
14239 set munmap d_munmap
14240 eval $inlibc
14241
14242 : see if nanosleep exists
14243 set nanosleep d_nanosleep
14244 eval $inlibc
14245
14246 : see if nice exists
14247 set nice d_nice
14248 eval $inlibc
14249
14250 : see if this is a langinfo.h system
14251 set langinfo.h i_langinfo
14252 eval $inhdr
14253
14254 : see if nl_langinfo exists
14255 set nl_langinfo d_nl_langinfo
14256 eval $inlibc
14257
14258 : check for length of character
14259 echo " "
14260 case "$charsize" in
14261 '')
14262         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14263         $cat >try.c <<EOCP
14264 #include <stdio.h>
14265 #$i_stdlib I_STDLIB
14266 #ifdef I_STDLIB
14267 #include <stdlib.h>
14268 #endif
14269 int main()
14270 {
14271     printf("%d\n", (int)sizeof(char));
14272     exit(0);
14273 }
14274 EOCP
14275         set try
14276         if eval $compile_ok; then
14277                 dflt=`$run ./try`
14278         else
14279                 dflt='1'
14280                 echo "(I can't seem to compile the test program.  Guessing...)"
14281         fi
14282         ;;
14283 *)
14284         dflt="$charsize"
14285         ;;
14286 esac
14287 rp="What is the size of a character (in bytes)?"
14288 . ./myread
14289 charsize="$ans"
14290 $rm -f try.c try
14291
14292 : check for volatile keyword
14293 echo " "
14294 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14295 $cat >try.c <<'EOCP'
14296 int main()
14297 {
14298         typedef struct _goo_struct goo_struct;
14299         goo_struct * volatile goo = ((goo_struct *)0);
14300         struct _goo_struct {
14301                 long long_int;
14302                 int reg_int;
14303                 char char_var;
14304         };
14305         typedef unsigned short foo_t;
14306         char *volatile foo;
14307         volatile int bar;
14308         volatile foo_t blech;
14309         foo = foo;
14310 }
14311 EOCP
14312 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14313         val="$define"
14314         echo "Yup, it does."
14315 else
14316         val="$undef"
14317         echo "Nope, it doesn't."
14318 fi
14319 set d_volatile
14320 eval $setvar
14321 $rm -f try.*
14322
14323
14324 echo " "
14325 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14326
14327 case "$use64bitint:$d_quad:$quadtype" in
14328 define:define:?*)
14329         ivtype="$quadtype"
14330         uvtype="$uquadtype"
14331         ivsize=8
14332         uvsize=8
14333         ;;
14334 *)      ivtype="long"
14335         uvtype="unsigned long"
14336         ivsize=$longsize
14337         uvsize=$longsize
14338         ;;
14339 esac
14340
14341 case "$uselongdouble:$d_longdbl" in
14342 define:define)
14343         nvtype="long double"
14344         nvsize=$longdblsize
14345         ;;
14346 *)      nvtype=double
14347         nvsize=$doublesize
14348         ;;
14349 esac
14350
14351 $echo "(IV will be "$ivtype", $ivsize bytes)"
14352 $echo "(UV will be "$uvtype", $uvsize bytes)"
14353 $echo "(NV will be "$nvtype", $nvsize bytes)"
14354
14355 $cat >try.c <<EOCP
14356 #$i_inttypes I_INTTYPES
14357 #ifdef I_INTTYPES
14358 #include <inttypes.h>
14359 #endif
14360 #include <stdio.h>
14361 int main() {
14362 #ifdef INT8
14363    int8_t i =  INT8_MAX;
14364   uint8_t u = UINT8_MAX;
14365   printf("int8_t\n");
14366 #endif
14367 #ifdef INT16
14368    int16_t i =  INT16_MAX;
14369   uint16_t i = UINT16_MAX;
14370   printf("int16_t\n");
14371 #endif
14372 #ifdef INT32
14373    int32_t i =  INT32_MAX;
14374   uint32_t u = UINT32_MAX;
14375   printf("int32_t\n");
14376 #endif
14377 }
14378 EOCP
14379
14380 case "$i8type" in
14381 '')     case "$charsize" in
14382         1)      i8type=char
14383                 u8type="unsigned char"
14384                 i8size=$charsize
14385                 u8size=$charsize
14386                 ;;
14387         esac
14388         ;;
14389 esac
14390 case "$i8type" in
14391 '')     set try -DINT8
14392         if eval $compile; then
14393                 case "`$run ./try`" in
14394                 int8_t) i8type=int8_t
14395                         u8type=uint8_t
14396                         i8size=1
14397                         u8size=1
14398                         ;;
14399                 esac
14400         fi
14401         ;;
14402 esac
14403 case "$i8type" in
14404 '')     if $test $charsize -ge 1; then
14405                 i8type=char
14406                 u8type="unsigned char"
14407                 i8size=$charsize
14408                 u8size=$charsize
14409         fi
14410         ;;
14411 esac
14412
14413 case "$i16type" in
14414 '')     case "$shortsize" in
14415         2)      i16type=short
14416                 u16type="unsigned short"
14417                 i16size=$shortsize
14418                 u16size=$shortsize
14419                 ;;
14420         esac
14421         ;;
14422 esac
14423 case "$i16type" in
14424 '')     set try -DINT16
14425         if eval $compile; then
14426                 case "`$run ./try`" in
14427                 int16_t)
14428                         i16type=int16_t
14429                         u16type=uint16_t
14430                         i16size=2
14431                         u16size=2
14432                         ;;
14433                 esac
14434         fi
14435         ;;
14436 esac
14437 case "$i16type" in
14438 '')     if $test $shortsize -ge 2; then
14439                 i16type=short
14440                 u16type="unsigned short"
14441                 i16size=$shortsize
14442                 u16size=$shortsize
14443         fi
14444         ;;
14445 esac
14446
14447 case "$i32type" in
14448 '')     case "$longsize" in
14449         4)      i32type=long
14450                 u32type="unsigned long"
14451                 i32size=$longsize
14452                 u32size=$longsize
14453                 ;;
14454         *)      case "$intsize" in
14455                 4)      i32type=int
14456                         u32type="unsigned int"
14457                         i32size=$intsize
14458                         u32size=$intsize
14459                         ;;
14460                 esac
14461                 ;;
14462         esac
14463         ;;
14464 esac
14465 case "$i32type" in
14466 '')     set try -DINT32
14467         if eval $compile; then
14468                 case "`$run ./try`" in
14469                 int32_t)
14470                         i32type=int32_t
14471                         u32type=uint32_t
14472                         i32size=4
14473                         u32size=4
14474                         ;;
14475                 esac
14476         fi
14477         ;;
14478 esac
14479 case "$i32type" in
14480 '')     if $test $intsize -ge 4; then
14481                 i32type=int
14482                 u32type="unsigned int"
14483                 i32size=$intsize
14484                 u32size=$intsize
14485         fi
14486         ;;
14487 esac
14488
14489 case "$i64type" in
14490 '')     case "$d_quad:$quadtype" in
14491         define:?*)
14492                 i64type="$quadtype"
14493                 u64type="$uquadtype"
14494                 i64size=8
14495                 u64size=8
14496                 ;;
14497         esac
14498         ;;
14499 esac
14500
14501 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14502 : volatile so that the compiler has to store it out to memory.
14503 if test X"$d_volatile" = X"$define"; then
14504         volatile=volatile
14505 fi
14506 $cat <<EOP >try.c
14507 #include <stdio.h>
14508 #$i_stdlib I_STDLIB
14509 #ifdef I_STDLIB
14510 #include <stdlib.h>
14511 #endif
14512 #include <sys/types.h>
14513 #include <signal.h>
14514 #ifdef SIGFPE
14515 $volatile int bletched = 0;
14516 $signal_t blech(s) int s; { bletched = 1; }
14517 #endif
14518 int main() {
14519     $uvtype u = 0;
14520     $nvtype d;
14521     int     n = 8 * $uvsize;
14522     int     i;
14523 #ifdef SIGFPE
14524     signal(SIGFPE, blech);
14525 #endif
14526
14527     for (i = 0; i < n; i++) {
14528       u = u << 1 | ($uvtype)1;
14529       d = ($nvtype)u;
14530       if (($uvtype)d != u)
14531         break;
14532       if (d <= 0)
14533         break;
14534       d = ($nvtype)(u - 1);
14535       if (($uvtype)d != (u - 1))
14536         break;
14537 #ifdef SIGFPE
14538       if (bletched) {
14539         break;
14540 #endif
14541       } 
14542     }
14543     printf("%d\n", ((i == n) ? -n : i));
14544     exit(0);
14545 }
14546 EOP
14547 set try
14548
14549 d_nv_preserves_uv="$undef"
14550 if eval $compile; then
14551         nv_preserves_uv_bits="`$run ./try`"
14552 fi
14553 case "$nv_preserves_uv_bits" in
14554 \-[1-9]*)       
14555         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14556         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14557         d_nv_preserves_uv="$define"
14558         ;;
14559 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14560         d_nv_preserves_uv="$undef" ;;
14561 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14562         nv_preserves_uv_bits="$undef" ;;
14563 esac
14564
14565 $rm -f try.* try
14566
14567
14568 : check for off64_t
14569 echo " "
14570 echo "Checking to see if you have off64_t..." >&4
14571 $cat >try.c <<EOCP
14572 #include <sys/types.h>
14573 #include <unistd.h>
14574 int main() { off64_t x = 7; }
14575 EOCP
14576 set try
14577 if eval $compile; then
14578         val="$define"
14579         echo "You have off64_t."
14580 else
14581         val="$undef"
14582         echo "You do not have off64_t."
14583         case "$lseeksize" in
14584         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14585         esac
14586 fi
14587 $rm -f try.* try
14588 set d_off64_t
14589 eval $setvar
14590
14591 : how to create joinable pthreads
14592 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14593         echo " "
14594         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14595         $cat >try.c <<'EOCP'
14596 #include <pthread.h>
14597 int main() {
14598     int detachstate = JOINABLE;
14599 }
14600 EOCP
14601         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14602         if eval $compile; then
14603                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14604                 val="$undef" # Yes, undef.
14605                 set d_old_pthread_create_joinable
14606                 eval $setvar
14607                 val=""
14608                 set old_pthread_create_joinable
14609                 eval $setvar
14610         else
14611                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14612                 if eval $compile; then
14613                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14614                         val="$define"
14615                         set d_old_pthread_create_joinable
14616                         eval $setvar
14617                         val=PTHREAD_CREATE_UNDETACHED
14618                         set old_pthread_create_joinable
14619                         eval $setvar
14620                 else            
14621                         set try -DJOINABLE=__UNDETACHED
14622                         if eval $compile; then
14623                                 echo "You seem to use __UNDETACHED." >&4
14624                                 val="$define"
14625                                 set d_old_pthread_create_joinable
14626                                 eval $setvar
14627                                 val=__UNDETACHED
14628                                 set old_pthread_create_joinable
14629                                 eval $setvar
14630                         else
14631                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14632                                 val="$define"
14633                                 set d_old_pthread_create_joinable
14634                                 eval $setvar
14635                                 val=0
14636                                 set old_pthread_create_joinable
14637                                 eval $setvar
14638                         fi
14639                 fi
14640         fi
14641         $rm -f try try.*
14642 else
14643     d_old_pthread_create_joinable="$undef"
14644     old_pthread_create_joinable=""
14645 fi
14646
14647 : see if pause exists
14648 set pause d_pause
14649 eval $inlibc
14650
14651 : see if pipe exists
14652 set pipe d_pipe
14653 eval $inlibc
14654
14655 : see if poll exists
14656 set poll d_poll
14657 eval $inlibc
14658
14659 : see if readlink exists
14660 set readlink d_readlink
14661 eval $inlibc
14662
14663 echo " "
14664 procselfexe=''
14665 val="$undef"
14666 case "$d_readlink" in
14667 "$define")
14668         if $issymlink /proc/self/exe ; then
14669                 $ls -l /proc/self/exe > reflect
14670                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14671                         echo "You have Linux-like /proc/self/exe."
14672                         procselfexe='"/proc/self/exe"'
14673                         val="$define"
14674                 fi
14675         fi
14676         if $issymlink /proc/curproc/file ; then
14677                 $ls -l /proc/curproc/file > reflect
14678                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14679                         echo "You have BSD-like /proc/curproc/file."
14680                         procselfexe='"/proc/curproc/file"'
14681                         val="$define"
14682                 fi
14683         fi
14684         ;;
14685 esac
14686 $rm -f reflect
14687 set d_procselfexe
14688 eval $setvar
14689
14690 : see whether the pthread_atfork exists
14691 $cat >try.c <<EOP
14692 #include <pthread.h>
14693 #include <stdio.h>
14694 int main() {
14695 #ifdef  PTHREAD_ATFORK
14696         pthread_atfork(NULL,NULL,NULL);
14697 #endif
14698 }
14699 EOP
14700
14701 : see if pthread_atfork exists
14702 set try -DPTHREAD_ATFORK
14703 if eval $compile; then
14704     val="$define"
14705 else
14706     val="$undef"
14707 fi
14708 case "$usethreads" in
14709 $define)
14710         case "$val" in
14711         $define) echo 'pthread_atfork found.' >&4        ;;
14712         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14713         esac
14714 esac
14715 set d_pthread_atfork
14716 eval $setvar
14717
14718 : see if pthread_attr_setscope exists
14719 set pthread_attr_setscope d_pthread_attr_setscope
14720 eval $inlibc
14721
14722
14723 : see whether the various POSIXish _yields exist
14724 $cat >try.c <<EOP
14725 #include <pthread.h>
14726 #include <stdio.h>
14727 int main() {
14728 #ifdef SCHED_YIELD
14729         sched_yield();
14730 #else
14731 #ifdef PTHREAD_YIELD
14732         pthread_yield();
14733 #else
14734 #ifdef PTHREAD_YIELD_NULL
14735         pthread_yield(NULL);
14736 #endif
14737 #endif
14738 #endif
14739 }
14740 EOP
14741 : see if sched_yield exists
14742 set try -DSCHED_YIELD
14743 if eval $compile; then
14744     val="$define"
14745     sched_yield='sched_yield()'
14746 else
14747     val="$undef"
14748 fi
14749 case "$usethreads" in
14750 $define)
14751         case "$val" in
14752         $define) echo 'sched_yield() found.' >&4        ;;
14753         *)       echo 'sched_yield() NOT found.' >&4    ;;
14754         esac
14755 esac
14756 set d_sched_yield
14757 eval $setvar
14758
14759 : see if pthread_yield exists
14760 set try -DPTHREAD_YIELD
14761 if eval $compile; then
14762     val="$define"
14763     case "$sched_yield" in
14764     '') sched_yield='pthread_yield()' ;;
14765     esac
14766 else
14767     set try -DPTHREAD_YIELD_NULL
14768     if eval $compile; then
14769         val="$define"
14770         case "$sched_yield" in
14771         '') sched_yield='pthread_yield(NULL)' ;;
14772         esac
14773     else
14774         val="$undef"
14775     fi
14776 fi
14777 case "$usethreads" in
14778 $define)
14779         case "$val" in
14780         $define) echo 'pthread_yield() found.' >&4      ;;
14781         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14782         esac
14783         ;;
14784 esac
14785 set d_pthread_yield
14786 eval $setvar
14787
14788 case "$sched_yield" in
14789 '') sched_yield=undef ;;
14790 esac
14791
14792 $rm -f try try.*
14793
14794 : see if random_r exists
14795 set random_r d_random_r
14796 eval $inlibc
14797 case "$d_random_r" in
14798 "$define")
14799         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14800         case "$d_random_r_proto:$usethreads" in
14801         ":define")      d_random_r_proto=define
14802                 set d_random_r_proto random_r $hdrs
14803                 eval $hasproto ;;
14804         *)      ;;
14805         esac
14806         case "$d_random_r_proto" in
14807         define)
14808         case "$random_r_proto" in
14809         ''|0) try='int random_r(int*, struct random_data*);'
14810         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14811         esac
14812         case "$random_r_proto" in
14813         ''|0) try='int random_r(long*, struct random_data*);'
14814         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14815         esac
14816         case "$random_r_proto" in
14817         ''|0) try='int random_r(struct random_data*, int32_t*);'
14818         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14819         esac
14820         case "$random_r_proto" in
14821         ''|0)   d_random_r=undef
14822                 random_r_proto=0
14823                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14824         * )     case "$random_r_proto" in
14825                 REENTRANT_PROTO*) ;;
14826                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14827                 esac
14828                 echo "Prototype: $try" ;;
14829         esac
14830         ;;
14831         *)      case "$usethreads" in
14832                 define) echo "random_r has no prototype, not using it." >&4 ;;
14833                 esac
14834                 d_random_r=undef
14835                 random_r_proto=0
14836                 ;;
14837         esac
14838         ;;
14839 *)      random_r_proto=0
14840         ;;
14841 esac
14842
14843 : see if readdir and friends exist
14844 set readdir d_readdir
14845 eval $inlibc
14846 set seekdir d_seekdir
14847 eval $inlibc
14848 set telldir d_telldir
14849 eval $inlibc
14850 set rewinddir d_rewinddir
14851 eval $inlibc
14852
14853 : see if readdir64_r exists
14854 set readdir64_r d_readdir64_r
14855 eval $inlibc
14856 case "$d_readdir64_r" in
14857 "$define")
14858         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14859         case "$d_readdir64_r_proto:$usethreads" in
14860         ":define")      d_readdir64_r_proto=define
14861                 set d_readdir64_r_proto readdir64_r $hdrs
14862                 eval $hasproto ;;
14863         *)      ;;
14864         esac
14865         case "$d_readdir64_r_proto" in
14866         define)
14867         case "$readdir64_r_proto" in
14868         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14869         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14870         esac
14871         case "$readdir64_r_proto" in
14872         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14873         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14874         esac
14875         case "$readdir64_r_proto" in
14876         ''|0)   d_readdir64_r=undef
14877                 readdir64_r_proto=0
14878                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14879         * )     case "$readdir64_r_proto" in
14880                 REENTRANT_PROTO*) ;;
14881                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14882                 esac
14883                 echo "Prototype: $try" ;;
14884         esac
14885         ;;
14886         *)      case "$usethreads" in
14887                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14888                 esac
14889                 d_readdir64_r=undef
14890                 readdir64_r_proto=0
14891                 ;;
14892         esac
14893         ;;
14894 *)      readdir64_r_proto=0
14895         ;;
14896 esac
14897
14898 : see if readdir_r exists
14899 set readdir_r d_readdir_r
14900 eval $inlibc
14901 case "$d_readdir_r" in
14902 "$define")
14903         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14904         case "$d_readdir_r_proto:$usethreads" in
14905         ":define")      d_readdir_r_proto=define
14906                 set d_readdir_r_proto readdir_r $hdrs
14907                 eval $hasproto ;;
14908         *)      ;;
14909         esac
14910         case "$d_readdir_r_proto" in
14911         define)
14912         case "$readdir_r_proto" in
14913         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14914         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14915         esac
14916         case "$readdir_r_proto" in
14917         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14918         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14919         esac
14920         case "$readdir_r_proto" in
14921         ''|0)   d_readdir_r=undef
14922                 readdir_r_proto=0
14923                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14924         * )     case "$readdir_r_proto" in
14925                 REENTRANT_PROTO*) ;;
14926                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14927                 esac
14928                 echo "Prototype: $try" ;;
14929         esac
14930         ;;
14931         *)      case "$usethreads" in
14932                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14933                 esac
14934                 d_readdir_r=undef
14935                 readdir_r_proto=0
14936                 ;;
14937         esac
14938         ;;
14939 *)      readdir_r_proto=0
14940         ;;
14941 esac
14942
14943 : see if readv exists
14944 set readv d_readv
14945 eval $inlibc
14946
14947 : see if recvmsg exists
14948 set recvmsg d_recvmsg
14949 eval $inlibc
14950
14951 : see if rename exists
14952 set rename d_rename
14953 eval $inlibc
14954
14955 : see if rmdir exists
14956 set rmdir d_rmdir
14957 eval $inlibc
14958
14959 : see if memory.h is available.
14960 val=''
14961 set memory.h val
14962 eval $inhdr
14963
14964 : See if it conflicts with string.h
14965 case "$val" in
14966 $define)
14967         case "$strings" in
14968         '') ;;
14969         *)
14970                 $cppstdin $cppflags $cppminus < $strings > mem.h
14971                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14972                         echo " "
14973                         echo "We won't be including <memory.h>."
14974                         val="$undef"
14975                 fi
14976                 $rm -f mem.h
14977                 ;;
14978         esac
14979 esac
14980 set i_memory
14981 eval $setvar
14982
14983 : can bcopy handle overlapping blocks?
14984 echo " "
14985 val="$undef"
14986 case "$d_memmove" in
14987 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14988 *)      case "$d_bcopy" in
14989         "$define")
14990                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14991                 $cat >try.c <<EOCP
14992 #$i_memory I_MEMORY
14993 #$i_stdlib I_STDLIB
14994 #$i_string I_STRING
14995 #$i_unistd I_UNISTD
14996 EOCP
14997         $cat >>try.c <<'EOCP'
14998 #include <stdio.h>
14999 #ifdef I_MEMORY
15000 #  include <memory.h>
15001 #endif
15002 #ifdef I_STDLIB
15003 #  include <stdlib.h>
15004 #endif
15005 #ifdef I_STRING
15006 #  include <string.h>
15007 #else
15008 #  include <strings.h>
15009 #endif
15010 #ifdef I_UNISTD
15011 #  include <unistd.h>  /* Needed for NetBSD */
15012 #endif
15013 int main()
15014 {
15015 char buf[128], abc[128];
15016 char *b;
15017 int len;
15018 int off;
15019 int align;
15020
15021 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15022    try to store the string in read-only memory. */
15023 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15024
15025 for (align = 7; align >= 0; align--) {
15026         for (len = 36; len; len--) {
15027                 b = buf+align;
15028                 bcopy(abc, b, len);
15029                 for (off = 1; off <= len; off++) {
15030                         bcopy(b, b+off, len);
15031                         bcopy(b+off, b, len);
15032                         if (bcmp(b, abc, len))
15033                                 exit(1);
15034                 }
15035         }
15036 }
15037 exit(0);
15038 }
15039 EOCP
15040                 set try
15041                 if eval $compile_ok; then
15042                         if ./try 2>/dev/null; then
15043                                 echo "Yes, it can."
15044                                 val="$define"
15045                         else
15046                                 echo "It can't, sorry."
15047                         fi
15048                 else
15049                         echo "(I can't compile the test program, so we'll assume not...)"
15050                 fi
15051                 ;;
15052         esac
15053         $rm -f try.* try core
15054         ;;
15055 esac
15056 set d_safebcpy
15057 eval $setvar
15058
15059 : can memcpy handle overlapping blocks?
15060 echo " "
15061 val="$undef"
15062 case "$d_memmove" in
15063 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15064 *)      case "$d_memcpy" in
15065         "$define")
15066                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15067                 $cat >try.c <<EOCP
15068 #$i_memory I_MEMORY
15069 #$i_stdlib I_STDLIB
15070 #$i_string I_STRING
15071 #$i_unistd I_UNISTD
15072 EOCP
15073         $cat >>try.c <<'EOCP'
15074 #include <stdio.h>
15075 #ifdef I_MEMORY
15076 #  include <memory.h>
15077 #endif
15078 #ifdef I_STDLIB
15079 #  include <stdlib.h>
15080 #endif
15081 #ifdef I_STRING
15082 #  include <string.h>
15083 #else
15084 #  include <strings.h>
15085 #endif
15086 #ifdef I_UNISTD
15087 #  include <unistd.h>  /* Needed for NetBSD */
15088 #endif
15089 int main()
15090 {
15091 char buf[128], abc[128];
15092 char *b;
15093 int len;
15094 int off;
15095 int align;
15096
15097 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15098    try to store the string in read-only memory. */
15099 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15100
15101 for (align = 7; align >= 0; align--) {
15102         for (len = 36; len; len--) {
15103                 b = buf+align;
15104                 memcpy(b, abc, len);
15105                 for (off = 1; off <= len; off++) {
15106                         memcpy(b+off, b, len);
15107                         memcpy(b, b+off, len);
15108                         if (memcmp(b, abc, len))
15109                                 exit(1);
15110                 }
15111         }
15112 }
15113 exit(0);
15114 }
15115 EOCP
15116                 set try
15117                 if eval $compile_ok; then
15118                         if ./try 2>/dev/null; then
15119                                 echo "Yes, it can."
15120                                 val="$define"
15121                         else
15122                                 echo "It can't, sorry."
15123                         fi
15124                 else
15125                         echo "(I can't compile the test program, so we'll assume not...)"
15126                 fi
15127                 ;;
15128         esac
15129         $rm -f try.* try core
15130         ;;
15131 esac
15132 set d_safemcpy
15133 eval $setvar
15134
15135 : can memcmp be trusted to compare relative magnitude?
15136 val="$undef"
15137 case "$d_memcmp" in
15138 "$define")
15139         echo " "
15140         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15141         $cat >try.c <<EOCP
15142 #$i_memory I_MEMORY
15143 #$i_stdlib I_STDLIB
15144 #$i_string I_STRING
15145 #$i_unistd I_UNISTD
15146 EOCP
15147         $cat >>try.c <<'EOCP'
15148 #include <stdio.h>
15149 #ifdef I_MEMORY
15150 #  include <memory.h>
15151 #endif
15152 #ifdef I_STDLIB
15153 #  include <stdlib.h>
15154 #endif
15155 #ifdef I_STRING
15156 #  include <string.h>
15157 #else
15158 #  include <strings.h>
15159 #endif
15160 #ifdef I_UNISTD
15161 #  include <unistd.h>  /* Needed for NetBSD */
15162 #endif
15163 int main()
15164 {
15165 char a = -1;
15166 char b = 0;
15167 if ((a < b) && memcmp(&a, &b, 1) < 0)
15168         exit(1);
15169 exit(0);
15170 }
15171 EOCP
15172         set try
15173         if eval $compile_ok; then
15174                 if $run ./try 2>/dev/null; then
15175                         echo "Yes, it can."
15176                         val="$define"
15177                 else
15178                         echo "No, it can't (it uses signed chars)."
15179                 fi
15180         else
15181                 echo "(I can't compile the test program, so we'll assume not...)"
15182         fi
15183         ;;
15184 esac
15185 $rm -f try.* try core
15186 set d_sanemcmp
15187 eval $setvar
15188
15189 : see if prototype for sbrk is available
15190 echo " "
15191 set d_sbrkproto sbrk $i_unistd unistd.h
15192 eval $hasproto
15193
15194 : see if select exists
15195 set select d_select
15196 eval $inlibc
15197
15198 : see if semctl exists
15199 set semctl d_semctl
15200 eval $inlibc
15201
15202 : see if semget exists
15203 set semget d_semget
15204 eval $inlibc
15205
15206 : see if semop exists
15207 set semop d_semop
15208 eval $inlibc
15209
15210 : see how much of the 'sem*(2)' library is present.
15211 h_sem=true
15212 echo " "
15213 case "$d_semctl$d_semget$d_semop" in
15214 *"$undef"*) h_sem=false;;
15215 esac
15216 case "$osname" in
15217 freebsd)
15218     case "`ipcs 2>&1`" in
15219     "SVID messages"*"not configured"*)
15220         echo "Your $osname does not have the sem*(2) configured." >&4
15221         h_sem=false
15222         val="$undef"
15223         set semctl d_semctl
15224         eval $setvar
15225         set semget d_semget
15226         eval $setvar
15227         set semop d_semop
15228         eval $setvar
15229         ;;
15230     esac
15231     ;;
15232 esac
15233 : we could also check for sys/ipc.h ...
15234 if $h_sem && $test `./findhdr sys/sem.h`; then
15235         echo "You have the full sem*(2) library." >&4
15236         val="$define"
15237 else
15238         echo "You don't have the full sem*(2) library." >&4
15239         val="$undef"
15240 fi
15241 set d_sem
15242 eval $setvar
15243
15244 : see whether sys/sem.h defines union semun
15245 echo " "
15246 $cat > try.c <<'END'
15247 #include <sys/types.h>
15248 #include <sys/ipc.h>
15249 #include <sys/sem.h>
15250 int main () { union semun semun; semun.buf = 0; }
15251 END
15252 set try
15253 if eval $compile; then
15254     echo "You have union semun in <sys/sem.h>." >&4
15255     val="$define"
15256 else
15257     echo "You do not have union semun in <sys/sem.h>." >&4
15258     val="$undef"
15259 fi
15260 $rm -f try try.c try.h
15261 set d_union_semun
15262 eval $setvar
15263
15264 : see how to do semctl IPC_STAT
15265 case "$d_sem" in
15266 $define)
15267     : see whether semctl IPC_STAT can use union semun
15268     echo " "
15269     $cat > try.h <<END
15270 #ifndef S_IRUSR
15271 #   ifdef S_IREAD
15272 #       define S_IRUSR S_IREAD
15273 #       define S_IWUSR S_IWRITE
15274 #       define S_IXUSR S_IEXEC
15275 #   else
15276 #       define S_IRUSR 0400
15277 #       define S_IWUSR 0200
15278 #       define S_IXUSR 0100
15279 #   endif
15280 #   define S_IRGRP (S_IRUSR>>3)
15281 #   define S_IWGRP (S_IWUSR>>3)
15282 #   define S_IXGRP (S_IXUSR>>3)
15283 #   define S_IROTH (S_IRUSR>>6)
15284 #   define S_IWOTH (S_IWUSR>>6)
15285 #   define S_IXOTH (S_IXUSR>>6)
15286 #endif
15287 #ifndef S_IRWXU
15288 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15289 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15290 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15291 #endif
15292 END
15293
15294     $cat > try.c <<END
15295 #include <sys/types.h>
15296 #include <sys/ipc.h>
15297 #include <sys/sem.h>
15298 #include <sys/stat.h>
15299 #include <stdio.h>
15300 #include <errno.h>
15301 #include "try.h"
15302 #ifndef errno
15303 extern int errno;
15304 #endif
15305 #$d_union_semun HAS_UNION_SEMUN
15306 int main() {
15307     union semun
15308 #ifndef HAS_UNION_SEMUN
15309     {
15310         int val;
15311         struct semid_ds *buf;
15312         unsigned short *array;
15313     }
15314 #endif
15315     arg;
15316     int sem, st;
15317
15318 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15319     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15320     if (sem > -1) {
15321         struct semid_ds argbuf;
15322         arg.buf = &argbuf;
15323 #       ifdef IPC_STAT
15324         st = semctl(sem, 0, IPC_STAT, arg);
15325         if (st == 0)
15326             printf("semun\n");
15327         else
15328 #       endif /* IPC_STAT */
15329             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15330 #       ifdef IPC_RMID
15331         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15332 #       endif /* IPC_RMID */
15333             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15334     } else
15335 #endif /* IPC_PRIVATE && ... */
15336         printf("semget failed: errno = %d\n", errno);
15337   return 0;
15338 }
15339 END
15340     val="$undef"
15341     set try
15342     if eval $compile; then
15343         xxx=`$run ./try`
15344         case "$xxx" in
15345         semun) val="$define" ;;
15346         esac
15347     fi
15348     $rm -f try try.c
15349     set d_semctl_semun
15350     eval $setvar
15351     case "$d_semctl_semun" in
15352     $define)
15353         echo "You can use union semun for semctl IPC_STAT." >&4
15354         also='also'
15355         ;;
15356     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15357         also=''
15358         ;;
15359     esac
15360
15361     : see whether semctl IPC_STAT can use struct semid_ds pointer
15362     $cat > try.c <<'END'
15363 #include <sys/types.h>
15364 #include <sys/ipc.h>
15365 #include <sys/sem.h>
15366 #include <sys/stat.h>
15367 #include "try.h"
15368 #include <stdio.h>
15369 #include <errno.h>
15370 #ifndef errno
15371 extern int errno;
15372 #endif
15373 int main() {
15374     struct semid_ds arg;
15375     int sem, st;
15376
15377 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15378     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15379     if (sem > -1) {
15380 #       ifdef IPC_STAT
15381         st = semctl(sem, 0, IPC_STAT, &arg);
15382         if (st == 0)
15383             printf("semid_ds\n");
15384         else
15385 #       endif /* IPC_STAT */
15386             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15387 #       ifdef IPC_RMID
15388         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15389 #       endif /* IPC_RMID */
15390             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15391     } else
15392 #endif /* IPC_PRIVATE && ... */
15393         printf("semget failed: errno = %d\n", errno);
15394
15395     return 0;
15396 }
15397 END
15398     val="$undef"
15399     set try
15400     if eval $compile; then
15401         xxx=`$run ./try`
15402         case "$xxx" in
15403         semid_ds) val="$define" ;;
15404         esac
15405     fi
15406     $rm -f try try.c
15407     set d_semctl_semid_ds
15408     eval $setvar
15409     case "$d_semctl_semid_ds" in
15410     $define)
15411         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15412         ;;
15413     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15414         ;;
15415     esac
15416     $rm -f try.h
15417     ;;
15418 *)  val="$undef"
15419
15420     # We do not have the full sem*(2) library, so assume we can not
15421     # use either.
15422
15423     set d_semctl_semun
15424     eval $setvar
15425
15426     set d_semctl_semid_ds
15427     eval $setvar
15428     ;;
15429 esac
15430
15431 : see if sendmsg exists
15432 set sendmsg d_sendmsg
15433 eval $inlibc
15434
15435 : see if setegid exists
15436 set setegid d_setegid
15437 eval $inlibc
15438
15439 : see if seteuid exists
15440 set seteuid d_seteuid
15441 eval $inlibc
15442
15443 : see if setgrent exists
15444 set setgrent d_setgrent
15445 eval $inlibc
15446
15447 : see if setgrent_r exists
15448 set setgrent_r d_setgrent_r
15449 eval $inlibc
15450 case "$d_setgrent_r" in
15451 "$define")
15452         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15453         case "$d_setgrent_r_proto:$usethreads" in
15454         ":define")      d_setgrent_r_proto=define
15455                 set d_setgrent_r_proto setgrent_r $hdrs
15456                 eval $hasproto ;;
15457         *)      ;;
15458         esac
15459         case "$d_setgrent_r_proto" in
15460         define)
15461         case "$setgrent_r_proto" in
15462         ''|0) try='int setgrent_r(FILE**);'
15463         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15464         esac
15465         case "$setgrent_r_proto" in
15466         ''|0) try='void setgrent_r(FILE**);'
15467         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15468         esac
15469         case "$setgrent_r_proto" in
15470         ''|0)   d_setgrent_r=undef
15471                 setgrent_r_proto=0
15472                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15473         * )     case "$setgrent_r_proto" in
15474                 REENTRANT_PROTO*) ;;
15475                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15476                 esac
15477                 echo "Prototype: $try" ;;
15478         esac
15479         ;;
15480         *)      case "$usethreads" in
15481                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15482                 esac
15483                 d_setgrent_r=undef
15484                 setgrent_r_proto=0
15485                 ;;
15486         esac
15487         ;;
15488 *)      setgrent_r_proto=0
15489         ;;
15490 esac
15491
15492 : see if sethostent exists
15493 set sethostent d_sethent
15494 eval $inlibc
15495
15496 : see if sethostent_r exists
15497 set sethostent_r d_sethostent_r
15498 eval $inlibc
15499 case "$d_sethostent_r" in
15500 "$define")
15501         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15502         case "$d_sethostent_r_proto:$usethreads" in
15503         ":define")      d_sethostent_r_proto=define
15504                 set d_sethostent_r_proto sethostent_r $hdrs
15505                 eval $hasproto ;;
15506         *)      ;;
15507         esac
15508         case "$d_sethostent_r_proto" in
15509         define)
15510         case "$sethostent_r_proto" in
15511         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15512         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15513         esac
15514         case "$sethostent_r_proto" in
15515         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15516         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15517         esac
15518         case "$sethostent_r_proto" in
15519         ''|0)   d_sethostent_r=undef
15520                 sethostent_r_proto=0
15521                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15522         * )     case "$sethostent_r_proto" in
15523                 REENTRANT_PROTO*) ;;
15524                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15525                 esac
15526                 echo "Prototype: $try" ;;
15527         esac
15528         ;;
15529         *)      case "$usethreads" in
15530                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15531                 esac
15532                 d_sethostent_r=undef
15533                 sethostent_r_proto=0
15534                 ;;
15535         esac
15536         ;;
15537 *)      sethostent_r_proto=0
15538         ;;
15539 esac
15540
15541 : see if setitimer exists
15542 set setitimer d_setitimer
15543 eval $inlibc
15544
15545 : see if setlinebuf exists
15546 set setlinebuf d_setlinebuf
15547 eval $inlibc
15548
15549 : see if setlocale exists
15550 set setlocale d_setlocale
15551 eval $inlibc
15552
15553 : see if locale.h is available
15554 set locale.h i_locale
15555 eval $inhdr
15556
15557 : see if setlocale_r exists
15558 set setlocale_r d_setlocale_r
15559 eval $inlibc
15560 case "$d_setlocale_r" in
15561 "$define")
15562         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15563         case "$d_setlocale_r_proto:$usethreads" in
15564         ":define")      d_setlocale_r_proto=define
15565                 set d_setlocale_r_proto setlocale_r $hdrs
15566                 eval $hasproto ;;
15567         *)      ;;
15568         esac
15569         case "$d_setlocale_r_proto" in
15570         define)
15571         case "$setlocale_r_proto" in
15572         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15573         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15574         esac
15575         case "$setlocale_r_proto" in
15576         ''|0)   d_setlocale_r=undef
15577                 setlocale_r_proto=0
15578                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15579         * )     case "$setlocale_r_proto" in
15580                 REENTRANT_PROTO*) ;;
15581                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15582                 esac
15583                 echo "Prototype: $try" ;;
15584         esac
15585         ;;
15586         *)      case "$usethreads" in
15587                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15588                 esac
15589                 d_setlocale_r=undef
15590                 setlocale_r_proto=0
15591                 ;;
15592         esac
15593         ;;
15594 *)      setlocale_r_proto=0
15595         ;;
15596 esac
15597
15598 : see if setnetent exists
15599 set setnetent d_setnent
15600 eval $inlibc
15601
15602 : see if setnetent_r exists
15603 set setnetent_r d_setnetent_r
15604 eval $inlibc
15605 case "$d_setnetent_r" in
15606 "$define")
15607         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15608         case "$d_setnetent_r_proto:$usethreads" in
15609         ":define")      d_setnetent_r_proto=define
15610                 set d_setnetent_r_proto setnetent_r $hdrs
15611                 eval $hasproto ;;
15612         *)      ;;
15613         esac
15614         case "$d_setnetent_r_proto" in
15615         define)
15616         case "$setnetent_r_proto" in
15617         ''|0) try='int setnetent_r(int, struct netent_data*);'
15618         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15619         esac
15620         case "$setnetent_r_proto" in
15621         ''|0) try='void setnetent_r(int, struct netent_data*);'
15622         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15623         esac
15624         case "$setnetent_r_proto" in
15625         ''|0)   d_setnetent_r=undef
15626                 setnetent_r_proto=0
15627                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15628         * )     case "$setnetent_r_proto" in
15629                 REENTRANT_PROTO*) ;;
15630                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15631                 esac
15632                 echo "Prototype: $try" ;;
15633         esac
15634         ;;
15635         *)      case "$usethreads" in
15636                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15637                 esac
15638                 d_setnetent_r=undef
15639                 setnetent_r_proto=0
15640                 ;;
15641         esac
15642         ;;
15643 *)      setnetent_r_proto=0
15644         ;;
15645 esac
15646
15647 : see if setprotoent exists
15648 set setprotoent d_setpent
15649 eval $inlibc
15650
15651 : see if setpgid exists
15652 set setpgid d_setpgid
15653 eval $inlibc
15654
15655 : see if setpgrp2 exists
15656 set setpgrp2 d_setpgrp2
15657 eval $inlibc
15658
15659 : see if setpriority exists
15660 set setpriority d_setprior
15661 eval $inlibc
15662
15663 : see if setproctitle exists
15664 set setproctitle d_setproctitle
15665 eval $inlibc
15666
15667 : see if setprotoent_r exists
15668 set setprotoent_r d_setprotoent_r
15669 eval $inlibc
15670 case "$d_setprotoent_r" in
15671 "$define")
15672         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15673         case "$d_setprotoent_r_proto:$usethreads" in
15674         ":define")      d_setprotoent_r_proto=define
15675                 set d_setprotoent_r_proto setprotoent_r $hdrs
15676                 eval $hasproto ;;
15677         *)      ;;
15678         esac
15679         case "$d_setprotoent_r_proto" in
15680         define)
15681         case "$setprotoent_r_proto" in
15682         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15683         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15684         esac
15685         case "$setprotoent_r_proto" in
15686         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15687         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15688         esac
15689         case "$setprotoent_r_proto" in
15690         ''|0)   d_setprotoent_r=undef
15691                 setprotoent_r_proto=0
15692                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15693         * )     case "$setprotoent_r_proto" in
15694                 REENTRANT_PROTO*) ;;
15695                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15696                 esac
15697                 echo "Prototype: $try" ;;
15698         esac
15699         ;;
15700         *)      case "$usethreads" in
15701                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15702                 esac
15703                 d_setprotoent_r=undef
15704                 setprotoent_r_proto=0
15705                 ;;
15706         esac
15707         ;;
15708 *)      setprotoent_r_proto=0
15709         ;;
15710 esac
15711
15712 : see if setpwent exists
15713 set setpwent d_setpwent
15714 eval $inlibc
15715
15716 : see if setpwent_r exists
15717 set setpwent_r d_setpwent_r
15718 eval $inlibc
15719 case "$d_setpwent_r" in
15720 "$define")
15721         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15722         case "$d_setpwent_r_proto:$usethreads" in
15723         ":define")      d_setpwent_r_proto=define
15724                 set d_setpwent_r_proto setpwent_r $hdrs
15725                 eval $hasproto ;;
15726         *)      ;;
15727         esac
15728         case "$d_setpwent_r_proto" in
15729         define)
15730         case "$setpwent_r_proto" in
15731         ''|0) try='int setpwent_r(FILE**);'
15732         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15733         esac
15734         case "$setpwent_r_proto" in
15735         ''|0) try='void setpwent_r(FILE**);'
15736         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15737         esac
15738         case "$setpwent_r_proto" in
15739         ''|0)   d_setpwent_r=undef
15740                 setpwent_r_proto=0
15741                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15742         * )     case "$setpwent_r_proto" in
15743                 REENTRANT_PROTO*) ;;
15744                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15745                 esac
15746                 echo "Prototype: $try" ;;
15747         esac
15748         ;;
15749         *)      case "$usethreads" in
15750                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15751                 esac
15752                 d_setpwent_r=undef
15753                 setpwent_r_proto=0
15754                 ;;
15755         esac
15756         ;;
15757 *)      setpwent_r_proto=0
15758         ;;
15759 esac
15760
15761 : see if setregid exists
15762 set setregid d_setregid
15763 eval $inlibc
15764 set setresgid d_setresgid
15765 eval $inlibc
15766
15767 : see if setreuid exists
15768 set setreuid d_setreuid
15769 eval $inlibc
15770 set setresuid d_setresuid
15771 eval $inlibc
15772
15773 : see if setrgid exists
15774 set setrgid d_setrgid
15775 eval $inlibc
15776
15777 : see if setruid exists
15778 set setruid d_setruid
15779 eval $inlibc
15780
15781 : see if setservent exists
15782 set setservent d_setsent
15783 eval $inlibc
15784
15785 : see if setservent_r exists
15786 set setservent_r d_setservent_r
15787 eval $inlibc
15788 case "$d_setservent_r" in
15789 "$define")
15790         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15791         case "$d_setservent_r_proto:$usethreads" in
15792         ":define")      d_setservent_r_proto=define
15793                 set d_setservent_r_proto setservent_r $hdrs
15794                 eval $hasproto ;;
15795         *)      ;;
15796         esac
15797         case "$d_setservent_r_proto" in
15798         define)
15799         case "$setservent_r_proto" in
15800         ''|0) try='int setservent_r(int, struct servent_data*);'
15801         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15802         esac
15803         case "$setservent_r_proto" in
15804         ''|0) try='void setservent_r(int, struct servent_data*);'
15805         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15806         esac
15807         case "$setservent_r_proto" in
15808         ''|0)   d_setservent_r=undef
15809                 setservent_r_proto=0
15810                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15811         * )     case "$setservent_r_proto" in
15812                 REENTRANT_PROTO*) ;;
15813                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15814                 esac
15815                 echo "Prototype: $try" ;;
15816         esac
15817         ;;
15818         *)      case "$usethreads" in
15819                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15820                 esac
15821                 d_setservent_r=undef
15822                 setservent_r_proto=0
15823                 ;;
15824         esac
15825         ;;
15826 *)      setservent_r_proto=0
15827         ;;
15828 esac
15829
15830 : see if setsid exists
15831 set setsid d_setsid
15832 eval $inlibc
15833
15834 : see if setvbuf exists
15835 set setvbuf d_setvbuf
15836 eval $inlibc
15837
15838 : see if sfio.h is available
15839 set sfio.h i_sfio
15840 eval $inhdr
15841
15842
15843 : see if sfio library is available
15844 case "$i_sfio" in
15845 $define)
15846         val=''
15847         set sfreserve val
15848         eval $inlibc
15849         ;;
15850 *)
15851         val="$undef"
15852         ;;
15853 esac
15854 : Ok, but do we want to use it.
15855 case "$val" in
15856 $define)
15857         case "$usesfio" in
15858         true|$define|[yY]*) dflt='y';;
15859         *) dflt='n';;
15860         esac
15861         echo "$package can use the sfio library, but it is experimental."
15862         case "$useperlio" in
15863         "$undef")
15864             echo "For sfio also the PerlIO abstraction layer is needed."
15865             echo "Earlier you said you wouldn't want that."
15866             ;;
15867         esac
15868         rp="You seem to have sfio available, do you want to try using it?"
15869         . ./myread
15870         case "$ans" in
15871         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15872                 useperlio="$define"
15873                 val="$define"
15874                 ;;
15875         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15876                 val="$undef"
15877                 ;;
15878         esac
15879         ;;
15880 *)      case "$usesfio" in
15881         true|$define|[yY]*)
15882                 echo "Sorry, cannot find sfio on this machine." >&4
15883                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15884                 val="$undef"
15885                 ;;
15886         esac
15887         ;;
15888 esac
15889 set d_sfio
15890 eval $setvar
15891 case "$d_sfio" in
15892 $define) usesfio='true';;
15893 *) usesfio='false';;
15894 esac
15895 case "$d_sfio" in
15896 $define) ;;
15897 *)      : Remove sfio from list of libraries to use
15898         case "$libs" in
15899         *-lsfio*)
15900                 echo "Removing unneeded -lsfio from library list" >&4
15901                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15902                 shift
15903                 libs="$*"
15904                 echo "libs = $libs" >&4
15905                 ;;
15906         esac
15907 ;;
15908 esac
15909
15910
15911 : see if shmctl exists
15912 set shmctl d_shmctl
15913 eval $inlibc
15914
15915 : see if shmget exists
15916 set shmget d_shmget
15917 eval $inlibc
15918
15919 : see if shmat exists
15920 set shmat d_shmat
15921 eval $inlibc
15922 : see what shmat returns
15923 case "$d_shmat" in
15924 "$define")
15925         $cat >shmat.c <<'END'
15926 #include <sys/shm.h>
15927 void *shmat();
15928 END
15929         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15930                 shmattype='void *'
15931         else
15932                 shmattype='char *'
15933         fi
15934         echo "and it returns ($shmattype)." >&4
15935         : see if a prototype for shmat is available
15936         xxx=`./findhdr sys/shm.h`
15937         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15938         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15939                 val="$define"
15940         else
15941                 val="$undef"
15942         fi
15943         $rm -f shmat.[co]
15944         ;;
15945 *)
15946         val="$undef"
15947         ;;
15948 esac
15949 set d_shmatprototype
15950 eval $setvar
15951
15952 : see if shmdt exists
15953 set shmdt d_shmdt
15954 eval $inlibc
15955
15956 : see how much of the 'shm*(2)' library is present.
15957 h_shm=true
15958 echo " "
15959 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15960 *"$undef"*) h_shm=false;;
15961 esac
15962 case "$osname" in
15963 freebsd)
15964     case "`ipcs 2>&1`" in
15965     "SVID shared memory"*"not configured"*)
15966         echo "Your $osname does not have the shm*(2) configured." >&4
15967         h_shm=false
15968         val="$undef"
15969         set shmctl d_shmctl
15970         evat $setvar
15971         set shmget d_shmget
15972         evat $setvar
15973         set shmat d_shmat
15974         evat $setvar
15975         set shmdt d_shmdt
15976         evat $setvar
15977         ;;
15978     esac
15979     ;;
15980 esac
15981 : we could also check for sys/ipc.h ...
15982 if $h_shm && $test `./findhdr sys/shm.h`; then
15983         echo "You have the full shm*(2) library." >&4
15984         val="$define"
15985 else
15986         echo "You don't have the full shm*(2) library." >&4
15987         val="$undef"
15988 fi
15989 set d_shm
15990 eval $setvar
15991
15992 echo " "
15993 : see if we have sigaction
15994 if set sigaction val -f d_sigaction; eval $csym; $val; then
15995         echo 'sigaction() found.' >&4
15996         $cat > try.c <<EOP
15997 #include <stdio.h>
15998 #include <sys/types.h>
15999 #include <signal.h>
16000 #$i_stdlib I_STDLIB
16001 #ifdef I_STDLIB
16002 #include <stdlib.h>
16003 #endif
16004 int main()
16005 {
16006     struct sigaction act, oact;
16007     act.sa_flags = 0;
16008     oact.sa_handler = 0;
16009     /* so that act and oact are used */
16010     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16011 }
16012 EOP
16013         set try
16014         if eval $compile_ok; then
16015                 val="$define"
16016         else
16017                 echo "But you don't seem to have a useable struct sigaction." >&4
16018                 val="$undef"
16019         fi
16020 else
16021         echo 'sigaction NOT found.' >&4
16022         val="$undef"
16023 fi
16024 set d_sigaction; eval $setvar
16025 $rm -f try try$_o try.c
16026
16027 : see if sigprocmask exists
16028 set sigprocmask d_sigprocmask
16029 eval $inlibc
16030
16031 : see if sigsetjmp exists
16032 echo " "
16033 case "$d_sigsetjmp" in
16034 '')
16035         $cat >try.c <<EOP
16036 #include <setjmp.h>
16037 #$i_stdlib I_STDLIB
16038 #ifdef I_STDLIB
16039 #include <stdlib.h>
16040 #endif
16041 sigjmp_buf env;
16042 int set = 1;
16043 int main()
16044 {
16045         if (sigsetjmp(env,1))
16046                 exit(set);
16047         set = 0;
16048         siglongjmp(env, 1);
16049         exit(1);
16050 }
16051 EOP
16052         set try
16053         if eval $compile; then
16054                 if $run ./try >/dev/null 2>&1; then
16055                         echo "POSIX sigsetjmp found." >&4
16056                         val="$define"
16057                 else
16058                         $cat >&4 <<EOM
16059 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16060 I'll ignore them.
16061 EOM
16062                         val="$undef"
16063                 fi
16064         else
16065                 echo "sigsetjmp not found." >&4
16066                 val="$undef"
16067         fi
16068         ;;
16069 *) val="$d_sigsetjmp"
16070         case "$d_sigsetjmp" in
16071         $define) echo "POSIX sigsetjmp found." >&4;;
16072         $undef) echo "sigsetjmp not found." >&4;;
16073         esac
16074         ;;
16075 esac
16076 set d_sigsetjmp
16077 eval $setvar
16078 $rm -f try.c try
16079
16080 : see if sockatmark exists
16081 set sockatmark d_sockatmark
16082 eval $inlibc
16083
16084 : see if prototype for sockatmark is available
16085 echo " "
16086 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16087 eval $hasproto
16088
16089 : see if socks5_init exists
16090 set socks5_init d_socks5_init
16091 eval $inlibc
16092
16093 : see if srand48_r exists
16094 set srand48_r d_srand48_r
16095 eval $inlibc
16096 case "$d_srand48_r" in
16097 "$define")
16098         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16099         case "$d_srand48_r_proto:$usethreads" in
16100         ":define")      d_srand48_r_proto=define
16101                 set d_srand48_r_proto srand48_r $hdrs
16102                 eval $hasproto ;;
16103         *)      ;;
16104         esac
16105         case "$d_srand48_r_proto" in
16106         define)
16107         case "$srand48_r_proto" in
16108         ''|0) try='int srand48_r(long, struct drand48_data*);'
16109         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16110         esac
16111         case "$srand48_r_proto" in
16112         ''|0)   d_srand48_r=undef
16113                 srand48_r_proto=0
16114                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16115         * )     case "$srand48_r_proto" in
16116                 REENTRANT_PROTO*) ;;
16117                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16118                 esac
16119                 echo "Prototype: $try" ;;
16120         esac
16121         ;;
16122         *)      case "$usethreads" in
16123                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16124                 esac
16125                 d_srand48_r=undef
16126                 srand48_r_proto=0
16127                 ;;
16128         esac
16129         ;;
16130 *)      srand48_r_proto=0
16131         ;;
16132 esac
16133
16134 : see if srandom_r exists
16135 set srandom_r d_srandom_r
16136 eval $inlibc
16137 case "$d_srandom_r" in
16138 "$define")
16139         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16140         case "$d_srandom_r_proto:$usethreads" in
16141         ":define")      d_srandom_r_proto=define
16142                 set d_srandom_r_proto srandom_r $hdrs
16143                 eval $hasproto ;;
16144         *)      ;;
16145         esac
16146         case "$d_srandom_r_proto" in
16147         define)
16148         case "$srandom_r_proto" in
16149         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16150         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16151         esac
16152         case "$srandom_r_proto" in
16153         ''|0)   d_srandom_r=undef
16154                 srandom_r_proto=0
16155                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16156         * )     case "$srandom_r_proto" in
16157                 REENTRANT_PROTO*) ;;
16158                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16159                 esac
16160                 echo "Prototype: $try" ;;
16161         esac
16162         ;;
16163         *)      case "$usethreads" in
16164                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16165                 esac
16166                 d_srandom_r=undef
16167                 srandom_r_proto=0
16168                 ;;
16169         esac
16170         ;;
16171 *)      srandom_r_proto=0
16172         ;;
16173 esac
16174
16175 : see if prototype for setresgid is available
16176 echo " "
16177 set d_sresgproto setresgid $i_unistd unistd.h
16178 eval $hasproto
16179
16180 : see if prototype for setresuid is available
16181 echo " "
16182 set d_sresuproto setresuid $i_unistd unistd.h
16183 eval $hasproto
16184
16185 : see if sys/stat.h is available
16186 set sys/stat.h i_sysstat
16187 eval $inhdr
16188
16189
16190 : see if stat knows about block sizes
16191 echo " "
16192 echo "Checking to see if your struct stat has st_blocks field..." >&4
16193 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16194 eval $hasfield
16195
16196
16197 : see if this is a sys/vfs.h system
16198 set sys/vfs.h i_sysvfs
16199 eval $inhdr
16200
16201
16202 : see if this is a sys/statfs.h system
16203 set sys/statfs.h i_sysstatfs
16204 eval $inhdr
16205
16206
16207 echo " "
16208 echo "Checking to see if your system supports struct statfs..." >&4
16209 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
16210 eval $hasstruct
16211 case "$d_statfs_s" in
16212 "$define")      echo "Yes, it does."   ;;
16213 *)              echo "No, it doesn't." ;;
16214 esac
16215
16216
16217
16218 : see if struct statfs knows about f_flags
16219 case "$d_statfs_s" in
16220 define) 
16221         echo " "
16222         echo "Checking to see if your struct statfs has f_flags field..." >&4
16223         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
16224         eval $hasfield
16225         ;;
16226 *)      val="$undef"
16227         set d_statfs_f_flags
16228         eval $setvar
16229         ;;
16230 esac
16231 case "$d_statfs_f_flags" in
16232 "$define")      echo "Yes, it does."   ;;
16233 *)              echo "No, it doesn't." ;;
16234 esac
16235
16236 $cat >&4 <<EOM
16237 Checking how to access stdio streams by file descriptor number...
16238 EOM
16239 case "$stdio_stream_array" in
16240 '')     $cat >try.c <<EOCP
16241 #include <stdio.h>
16242 int main() {
16243   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16244     printf("yes\n");
16245 }
16246 EOCP
16247         for s in _iob __iob __sF
16248         do
16249                 set try -DSTDIO_STREAM_ARRAY=$s
16250                 if eval $compile; then
16251                         case "`$run ./try`" in
16252                         yes)    stdio_stream_array=$s; break ;;
16253                         esac
16254                 fi
16255         done
16256         $rm -f try.* try$exe_ext
16257 esac
16258 case "$stdio_stream_array" in
16259 '')     $cat >&4 <<EOM
16260 I can't figure out how to access stdio streams by file descriptor number.
16261 EOM
16262         d_stdio_stream_array="$undef"
16263         ;;
16264 *)      $cat >&4 <<EOM
16265 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16266 EOM
16267         d_stdio_stream_array="$define"
16268         ;;
16269 esac
16270
16271 : see if strcoll exists
16272 set strcoll d_strcoll
16273 eval $inlibc
16274
16275 : check for structure copying
16276 echo " "
16277 echo "Checking to see if your C compiler can copy structs..." >&4
16278 $cat >try.c <<'EOCP'
16279 int main()
16280 {
16281         struct blurfl {
16282                 int dyick;
16283         } foo, bar;
16284
16285         foo = bar;
16286 }
16287 EOCP
16288 if $cc -c try.c >/dev/null 2>&1 ; then
16289         val="$define"
16290         echo "Yup, it can."
16291 else
16292         val="$undef"
16293         echo "Nope, it can't."
16294 fi
16295 set d_strctcpy
16296 eval $setvar
16297 $rm -f try.*
16298
16299 : see if strerror and/or sys_errlist[] exist
16300 echo " "
16301 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16302     if set strerror val -f d_strerror; eval $csym; $val; then
16303                 echo 'strerror() found.' >&4
16304                 d_strerror="$define"
16305                 d_strerrm='strerror(e)'
16306                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16307                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16308                         d_syserrlst="$define"
16309                 else
16310                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16311                         d_syserrlst="$undef"
16312                 fi
16313     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16314                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16315                 echo 'strerror() found in string header.' >&4
16316                 d_strerror="$define"
16317                 d_strerrm='strerror(e)'
16318                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16319                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16320                                 d_syserrlst="$define"
16321                 else
16322                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16323                         d_syserrlst="$undef"
16324                 fi
16325     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16326                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16327                 d_strerror="$undef"
16328                 d_syserrlst="$define"
16329                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16330     else
16331                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16332                 d_strerror="$undef"
16333                 d_syserrlst="$undef"
16334                 d_strerrm='"unknown"'
16335     fi
16336 fi
16337
16338 : see if strerror_r exists
16339 set strerror_r d_strerror_r
16340 eval $inlibc
16341 case "$d_strerror_r" in
16342 "$define")
16343         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16344         case "$d_strerror_r_proto:$usethreads" in
16345         ":define")      d_strerror_r_proto=define
16346                 set d_strerror_r_proto strerror_r $hdrs
16347                 eval $hasproto ;;
16348         *)      ;;
16349         esac
16350         case "$d_strerror_r_proto" in
16351         define)
16352         case "$strerror_r_proto" in
16353         ''|0) try='int strerror_r(int, char*, size_t);'
16354         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16355         esac
16356         case "$strerror_r_proto" in
16357         ''|0) try='int strerror_r(int, char*, int);'
16358         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16359         esac
16360         case "$strerror_r_proto" in
16361         ''|0) try='char* strerror_r(int, char*, size_t);'
16362         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16363         esac
16364         case "$strerror_r_proto" in
16365         ''|0)   d_strerror_r=undef
16366                 strerror_r_proto=0
16367                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16368         * )     case "$strerror_r_proto" in
16369                 REENTRANT_PROTO*) ;;
16370                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16371                 esac
16372                 echo "Prototype: $try" ;;
16373         esac
16374         ;;
16375         *)      case "$usethreads" in
16376                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16377                 esac
16378                 d_strerror_r=undef
16379                 strerror_r_proto=0
16380                 ;;
16381         esac
16382         ;;
16383 *)      strerror_r_proto=0
16384         ;;
16385 esac
16386
16387 : see if strftime exists
16388 set strftime d_strftime
16389 eval $inlibc
16390
16391 : see if strtod exists
16392 set strtod d_strtod
16393 eval $inlibc
16394
16395 : see if strtol exists
16396 set strtol d_strtol
16397 eval $inlibc
16398
16399 : see if strtold exists
16400 set strtold d_strtold
16401 eval $inlibc
16402
16403 : see if strtoll exists
16404 set strtoll d_strtoll
16405 eval $inlibc
16406
16407 case "$d_longlong-$d_strtoll" in
16408 "$define-$define")
16409         $cat <<EOM
16410 Checking whether your strtoll() works okay...
16411 EOM
16412         $cat >try.c <<'EOCP'
16413 #include <errno.h>
16414 #ifdef __hpux
16415 #define strtoll __strtoll
16416 #endif
16417 #ifdef __EMX__
16418 #define strtoll _strtoll
16419 #endif
16420 #include <stdio.h>
16421 extern long long int strtoll(char *s, char **, int); 
16422 static int bad = 0;
16423 int check(char *s, long long ell, int een) {
16424         long long gll;
16425         errno = 0;
16426         gll = strtoll(s, 0, 10);
16427         if (!((gll == ell) && (errno == een)))
16428                 bad++;
16429 }
16430 int main() {
16431         check(" 1",                                      1LL, 0);
16432         check(" 0",                                      0LL, 0);
16433         check("-1",                                     -1LL, 0);
16434         check("-9223372036854775808", -9223372036854775808LL, 0);
16435         check("-9223372036854775808", -9223372036854775808LL, 0);
16436         check(" 9223372036854775807",  9223372036854775807LL, 0);
16437         check("-9223372036854775808", -9223372036854775808LL, 0);
16438         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16439         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16440         if (!bad)
16441                 printf("ok\n");
16442 }
16443 EOCP
16444         set try
16445         if eval $compile; then
16446                 yyy=`$run ./try`
16447                 case "$yyy" in
16448                 ok) echo "Your strtoll() seems to be working okay." ;;
16449                 *) cat <<EOM >&4
16450 Your strtoll() doesn't seem to be working okay.
16451 EOM
16452                    d_strtoll="$undef"
16453                    ;;
16454                 esac
16455         else
16456                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16457                 d_strtoll="$undef"
16458         fi
16459         ;;
16460 esac
16461
16462 : see if strtoq exists
16463 set strtoq d_strtoq
16464 eval $inlibc
16465
16466 : see if strtoul exists
16467 set strtoul d_strtoul
16468 eval $inlibc
16469
16470 case "$d_strtoul" in
16471 "$define")
16472         $cat <<EOM
16473 Checking whether your strtoul() works okay...
16474 EOM
16475         $cat >try.c <<'EOCP'
16476 #include <errno.h>
16477 #include <stdio.h>
16478 extern unsigned long int strtoul(char *s, char **, int); 
16479 static int bad = 0;
16480 void check(char *s, unsigned long eul, int een) {
16481         unsigned long gul;
16482         errno = 0;
16483         gul = strtoul(s, 0, 10);
16484         if (!((gul == eul) && (errno == een)))
16485                 bad++;
16486 }
16487 int main() {
16488         check(" 1", 1L, 0);
16489         check(" 0", 0L, 0);
16490 EOCP
16491         case "$longsize" in
16492         8)
16493             $cat >>try.c <<'EOCP'
16494         check("18446744073709551615", 18446744073709551615UL, 0);
16495         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16496 #if 0 /* strtoul() for /^-/ strings is undefined. */
16497         check("-1", 18446744073709551615UL, 0);
16498         check("-18446744073709551614", 2, 0);
16499         check("-18446744073709551615", 1, 0);
16500         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16501         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16502 #endif
16503 EOCP
16504                 ;;
16505         4)
16506                     $cat >>try.c <<'EOCP'
16507         check("4294967295", 4294967295UL, 0);
16508         check("4294967296", 4294967295UL, ERANGE);
16509 #if 0 /* strtoul() for /^-/ strings is undefined. */
16510         check("-1", 4294967295UL, 0);
16511         check("-4294967294", 2, 0);
16512         check("-4294967295", 1, 0);
16513         check("-4294967296", 4294967295UL, ERANGE);
16514         check("-4294967297", 4294967295UL, ERANGE);
16515 #endif
16516 EOCP
16517                 ;;
16518         *)
16519 : Should we write these tests to be more portable by sprintf-ing
16520 : ~0 and then manipulating that char string as input for strtol?
16521                 ;;
16522         esac
16523         $cat >>try.c <<'EOCP'
16524         if (!bad)
16525                 printf("ok\n");
16526         return 0;
16527 }
16528 EOCP
16529         set try
16530         if eval $compile; then
16531                 case "`$run ./try`" in
16532                 ok) echo "Your strtoul() seems to be working okay." ;;
16533                 *) cat <<EOM >&4
16534 Your strtoul() doesn't seem to be working okay.
16535 EOM
16536                    d_strtoul="$undef"
16537                    ;;
16538                 esac
16539         fi
16540         ;;
16541 esac
16542
16543 : see if strtoull exists
16544 set strtoull d_strtoull
16545 eval $inlibc
16546
16547 case "$d_longlong-$d_strtoull" in
16548 "$define-$define")
16549         $cat <<EOM
16550 Checking whether your strtoull() works okay...
16551 EOM
16552         $cat >try.c <<'EOCP'
16553 #include <errno.h>
16554 #ifdef __hpux
16555 #define strtoull __strtoull
16556 #endif
16557 #include <stdio.h>
16558 extern unsigned long long int strtoull(char *s, char **, int); 
16559 static int bad = 0;
16560 int check(char *s, long long eull, int een) {
16561         long long gull;
16562         errno = 0;
16563         gull = strtoull(s, 0, 10);
16564         if (!((gull == eull) && (errno == een)))
16565                 bad++;
16566 }
16567 int main() {
16568         check(" 1",                                        1LL, 0);
16569         check(" 0",                                        0LL, 0);
16570         check("18446744073709551615",  18446744073709551615ULL, 0);
16571         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16572 #if 0 /* strtoull() for /^-/ strings is undefined. */
16573         check("-1",                    18446744073709551615ULL, 0);
16574         check("-18446744073709551614",                     2LL, 0);
16575         check("-18446744073709551615",                     1LL, 0);
16576         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16577         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16578 #endif
16579         if (!bad)
16580                 printf("ok\n");
16581 }
16582 EOCP
16583         set try
16584         if eval $compile; then
16585                 case "`$run ./try`" in
16586                 ok) echo "Your strtoull() seems to be working okay." ;;
16587                 *) cat <<EOM >&4
16588 Your strtoull() doesn't seem to be working okay.
16589 EOM
16590                    d_strtoull="$undef"
16591                    ;;
16592                 esac
16593         fi
16594         ;;
16595 esac
16596
16597 : see if strtouq exists
16598 set strtouq d_strtouq
16599 eval $inlibc
16600
16601 case "$d_strtouq" in
16602 "$define")
16603         $cat <<EOM
16604 Checking whether your strtouq() works okay...
16605 EOM
16606         $cat >try.c <<'EOCP'
16607 #include <errno.h>
16608 #include <stdio.h>
16609 extern unsigned long long int strtouq(char *s, char **, int); 
16610 static int bad = 0;
16611 void check(char *s, unsigned long long eull, int een) {
16612         unsigned long long gull;
16613         errno = 0;
16614         gull = strtouq(s, 0, 10);
16615         if (!((gull == eull) && (errno == een)))
16616                 bad++;
16617 }
16618 int main() {
16619         check(" 1",                                        1LL, 0);
16620         check(" 0",                                        0LL, 0);
16621         check("18446744073709551615",  18446744073709551615ULL, 0);
16622         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16623 #if 0 /* strtouq() for /^-/ strings is undefined. */
16624         check("-1",                    18446744073709551615ULL, 0);
16625         check("-18446744073709551614",                     2LL, 0);
16626         check("-18446744073709551615",                     1LL, 0);
16627         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16628         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16629 #endif
16630         if (!bad)
16631                 printf("ok\n");
16632         return 0;
16633 }
16634 EOCP
16635         set try
16636         if eval $compile; then
16637                 case "`$run ./try`" in
16638                 ok) echo "Your strtouq() seems to be working okay." ;;
16639                 *) cat <<EOM >&4
16640 Your strtouq() doesn't seem to be working okay.
16641 EOM
16642                    d_strtouq="$undef"
16643                    ;;
16644                 esac
16645         fi
16646         ;;
16647 esac
16648
16649 : see if strxfrm exists
16650 set strxfrm d_strxfrm
16651 eval $inlibc
16652
16653 : see if symlink exists
16654 set symlink d_symlink
16655 eval $inlibc
16656
16657 : see if syscall exists
16658 set syscall d_syscall
16659 eval $inlibc
16660
16661 : see if prototype for syscall is available
16662 echo " "
16663 set d_syscallproto syscall $i_unistd unistd.h
16664 eval $hasproto
16665
16666 : see if sysconf exists
16667 set sysconf d_sysconf
16668 eval $inlibc
16669
16670 : see if system exists
16671 set system d_system
16672 eval $inlibc
16673
16674 : see if tcgetpgrp exists
16675 set tcgetpgrp d_tcgetpgrp
16676 eval $inlibc
16677
16678 : see if tcsetpgrp exists
16679 set tcsetpgrp d_tcsetpgrp
16680 eval $inlibc
16681
16682 : see if prototype for telldir is available
16683 echo " "
16684 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16685 eval $hasproto
16686
16687 : see if time exists
16688 echo " "
16689 if test "X$d_time" = X -o X"$timetype" = X; then
16690     if set time val -f d_time; eval $csym; $val; then
16691                 echo 'time() found.' >&4
16692                 val="$define"
16693                 rp="What is the type returned by time() on this system?"
16694                 set time_t timetype long stdio.h sys/types.h
16695                 eval $typedef_ask
16696     else
16697                 echo 'time() not found, hope that will do.' >&4
16698                 val="$undef"
16699                 timetype='int';
16700     fi
16701     set d_time
16702     eval $setvar
16703 fi
16704
16705 : see if this is a sys/times.h system
16706 set sys/times.h i_systimes
16707 eval $inhdr
16708
16709 : see if times exists
16710 echo " "
16711 if set times val -f d_times; eval $csym; $val; then
16712         echo 'times() found.' >&4
16713         d_times="$define"
16714         inc=''
16715         case "$i_systimes" in
16716         "$define") inc='sys/times.h';;
16717         esac
16718         rp="What is the type returned by times() on this system?"
16719         set clock_t clocktype long stdio.h sys/types.h $inc
16720         eval $typedef_ask
16721 else
16722         echo 'times() NOT found, hope that will do.' >&4
16723         d_times="$undef"
16724         clocktype='int'
16725 fi
16726
16727 : see if tmpnam_r exists
16728 set tmpnam_r d_tmpnam_r
16729 eval $inlibc
16730 case "$d_tmpnam_r" in
16731 "$define")
16732         hdrs="$i_systypes sys/types.h define stdio.h "
16733         case "$d_tmpnam_r_proto:$usethreads" in
16734         ":define")      d_tmpnam_r_proto=define
16735                 set d_tmpnam_r_proto tmpnam_r $hdrs
16736                 eval $hasproto ;;
16737         *)      ;;
16738         esac
16739         case "$d_tmpnam_r_proto" in
16740         define)
16741         case "$tmpnam_r_proto" in
16742         ''|0) try='char* tmpnam_r(char*);'
16743         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16744         esac
16745         case "$tmpnam_r_proto" in
16746         ''|0)   d_tmpnam_r=undef
16747                 tmpnam_r_proto=0
16748                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16749         * )     case "$tmpnam_r_proto" in
16750                 REENTRANT_PROTO*) ;;
16751                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16752                 esac
16753                 echo "Prototype: $try" ;;
16754         esac
16755         ;;
16756         *)      case "$usethreads" in
16757                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16758                 esac
16759                 d_tmpnam_r=undef
16760                 tmpnam_r_proto=0
16761                 ;;
16762         esac
16763         ;;
16764 *)      tmpnam_r_proto=0
16765         ;;
16766 esac
16767
16768 : see if truncate exists
16769 set truncate d_truncate
16770 eval $inlibc
16771
16772 : see if ttyname_r exists
16773 set ttyname_r d_ttyname_r
16774 eval $inlibc
16775 case "$d_ttyname_r" in
16776 "$define")
16777         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16778         case "$d_ttyname_r_proto:$usethreads" in
16779         ":define")      d_ttyname_r_proto=define
16780                 set d_ttyname_r_proto ttyname_r $hdrs
16781                 eval $hasproto ;;
16782         *)      ;;
16783         esac
16784         case "$d_ttyname_r_proto" in
16785         define)
16786         case "$ttyname_r_proto" in
16787         ''|0) try='int ttyname_r(int, char*, size_t);'
16788         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16789         esac
16790         case "$ttyname_r_proto" in
16791         ''|0) try='int ttyname_r(int, char*, int);'
16792         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16793         esac
16794         case "$ttyname_r_proto" in
16795         ''|0) try='char* ttyname_r(int, char*, int);'
16796         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16797         esac
16798         case "$ttyname_r_proto" in
16799         ''|0)   d_ttyname_r=undef
16800                 ttyname_r_proto=0
16801                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16802         * )     case "$ttyname_r_proto" in
16803                 REENTRANT_PROTO*) ;;
16804                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16805                 esac
16806                 echo "Prototype: $try" ;;
16807         esac
16808         ;;
16809         *)      case "$usethreads" in
16810                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16811                 esac
16812                 d_ttyname_r=undef
16813                 ttyname_r_proto=0
16814                 ;;
16815         esac
16816         ;;
16817 *)      ttyname_r_proto=0
16818         ;;
16819 esac
16820
16821 : see if tzname[] exists
16822 echo " "
16823 if set tzname val -a d_tzname; eval $csym; $val; then
16824         val="$define"
16825         echo 'tzname[] found.' >&4
16826 else
16827         val="$undef"
16828         echo 'tzname[] NOT found.' >&4
16829 fi
16830 set d_tzname
16831 eval $setvar
16832
16833 case "$osname" in
16834 next|rhapsody|darwin) multiarch="$define" ;;
16835 esac
16836 case "$multiarch" in
16837 ''|[nN]*) multiarch="$undef" ;;
16838 esac
16839
16840 : check for ordering of bytes in a UV
16841 echo " "
16842 case "$usecrosscompile$multiarch" in
16843 *$define*)
16844         $cat <<EOM
16845 You seem to be either cross-compiling or doing a multiarchitecture build,
16846 skipping the byteorder check.
16847
16848 EOM
16849         byteorder='ffff'
16850         ;;
16851 *)
16852         case "$byteorder" in
16853         '')
16854                 $cat <<'EOM'
16855 In the following, larger digits indicate more significance.  A big-endian
16856 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16857 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16858 machines may have weird orders like 3412.  A Cray will report 87654321,
16859 an Alpha will report 12345678. If the test program works the default is
16860 probably right.
16861 I'm now running the test program...
16862 EOM
16863                 $cat >try.c <<EOCP
16864 #include <stdio.h>
16865 #$i_stdlib I_STDLIB
16866 #ifdef I_STDLIB
16867 #include <stdlib.h>
16868 #endif
16869 #include <sys/types.h>
16870 typedef $uvtype UV;
16871 int main()
16872 {
16873         int i;
16874         union {
16875                 UV l;
16876                 char c[$uvsize];
16877         } u;
16878
16879         if ($uvsize > 4)
16880                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16881         else
16882                 u.l = (UV)0x04030201;
16883         for (i = 0; i < $uvsize; i++)
16884                 printf("%c", u.c[i]+'0');
16885         printf("\n");
16886         exit(0);
16887 }
16888 EOCP
16889                 xxx_prompt=y
16890                 set try
16891                 if eval $compile && ./try > /dev/null; then
16892                         dflt=`$run ./try`
16893                         case "$dflt" in
16894                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16895                                 echo "(The test program ran ok.)"
16896                                 echo "byteorder=$dflt"
16897                                 xxx_prompt=n
16898                         ;;
16899                         ????|????????) echo "(The test program ran ok.)" ;;
16900                         *) echo "(The test program didn't run right for some reason.)" ;;
16901                         esac
16902                 else
16903                         dflt='4321'
16904                         cat <<'EOM'
16905 (I can't seem to compile the test program.  Guessing big-endian...)
16906 EOM
16907                 fi
16908                 case "$xxx_prompt" in
16909                 y)
16910                         rp="What is the order of bytes in $uvtype?"
16911                         . ./myread
16912                         byteorder="$ans"
16913                         ;;
16914                 *)      byteorder=$dflt
16915                         ;;
16916                 esac
16917                 ;;
16918         esac
16919         $rm -f try.c try
16920         ;;
16921 esac
16922
16923
16924 $cat <<EOM
16925
16926 Checking to see whether you can access character data unalignedly...
16927 EOM
16928 case "$d_u32align" in
16929 '')   $cat >try.c <<EOCP
16930 #include <stdio.h>
16931 #$i_stdlib I_STDLIB
16932 #ifdef I_STDLIB
16933 #include <stdlib.h>
16934 #endif
16935 #define U32 $u32type
16936 #define BYTEORDER 0x$byteorder
16937 #define U8 $u8type
16938 #include <signal.h>
16939 #ifdef SIGBUS
16940 $signal_t bletch(s) int s; { exit(4); }
16941 #endif
16942 int main() {
16943 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16944     U8 buf[8];
16945     U32 *up;
16946     int i;
16947
16948     if (sizeof(U32) != 4) {
16949         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16950         exit(1);
16951     }
16952
16953     fflush(stdout);
16954
16955 #ifdef SIGBUS
16956     signal(SIGBUS, bletch);
16957 #endif
16958
16959     buf[0] = 0;
16960     buf[1] = 0;
16961     buf[2] = 0;
16962     buf[3] = 1;
16963     buf[5] = 0;
16964     buf[6] = 0;
16965     buf[7] = 0;
16966     buf[8] = 1;
16967
16968     for (i = 0; i < 4; i++) {
16969         up = (U32*)(buf + i);
16970         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16971                (*up == 1 << (8*(3-i)))  /* little-endian */
16972               )
16973            )
16974         {
16975             printf("read failed (%x)\n", *up);
16976             exit(2);
16977         }
16978     }
16979
16980     /* write test */
16981     for (i = 0; i < 4; i++) {
16982         up = (U32*)(buf + i);
16983         *up = 0xBeef;
16984         if (*up != 0xBeef) {
16985             printf("write failed (%x)\n", *up);
16986             exit(3);
16987         }
16988     }
16989
16990     exit(0);
16991 #else
16992     printf("1\n");
16993     exit(1);
16994 #endif
16995     return 0;
16996 }
16997 EOCP
16998 set try
16999 if eval $compile_ok; then
17000         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17001         $run ./try 2>&1 >/dev/null
17002         case "$?" in
17003         0)      cat >&4 <<EOM
17004 You can access character data pretty unalignedly.
17005 EOM
17006                 d_u32align="$undef"
17007                 ;;
17008         *)      cat >&4 <<EOM
17009 It seems that you must access character data in an aligned manner.
17010 EOM
17011                 d_u32align="$define"
17012                 ;;
17013         esac
17014 else
17015         rp='Can you access character data at unaligned addresses?'
17016         dflt='n'
17017         . ./myread
17018         case "$ans" in
17019         [yY]*)  d_u32align="$undef"  ;;
17020         *)      d_u32align="$define" ;;
17021         esac
17022 fi
17023 $rm -f core core.try.* try.core
17024 ;;
17025 esac
17026
17027 : see if ualarm exists
17028 set ualarm d_ualarm
17029 eval $inlibc
17030
17031 : see if umask exists
17032 set umask d_umask
17033 eval $inlibc
17034
17035 : see if unordered exists
17036 set unordered d_unordered
17037 eval $inlibc
17038
17039 : see if usleep exists
17040 set usleep d_usleep
17041 eval $inlibc
17042
17043 : see if prototype for usleep is available
17044 echo " "
17045 set d_usleepproto usleep $i_unistd unistd.h
17046 eval $hasproto
17047
17048 : see if ustat exists
17049 set ustat d_ustat
17050 eval $inlibc
17051
17052 : backward compatibility for d_hvfork
17053 if test X$d_hvfork != X; then
17054         d_vfork="$d_hvfork"
17055         d_hvfork=''
17056 fi
17057 : see if there is a vfork
17058 val=''
17059 set vfork val
17060 eval $inlibc
17061
17062 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17063 : perl on Solaris 2.x, and probably elsewhere.
17064 case "$val" in
17065 $define)
17066         echo " "
17067         case "$usevfork" in
17068         false) dflt='n';;
17069         *) dflt='y';;
17070         esac
17071         cat <<'EOM'
17072  
17073 Perl can only use a vfork() that doesn't suffer from strict
17074 restrictions on calling functions or modifying global data in
17075 the child.  For example, glibc-2.1 contains such a vfork()
17076 that is unsuitable.  If your system provides a proper fork()
17077 call, chances are that you do NOT want perl to use vfork().
17078
17079 EOM
17080         rp="Do you still want to use vfork()?"
17081         . ./myread
17082         case "$ans" in
17083         y|Y) ;;
17084         *)
17085                 echo "Ok, we won't use vfork()."
17086                 val="$undef"
17087                 ;;
17088         esac
17089         ;;
17090 esac
17091 set d_vfork
17092 eval $setvar
17093 case "$d_vfork" in
17094 $define) usevfork='true';;
17095 *) usevfork='false';;
17096 esac
17097
17098 : see if closedir exists
17099 set closedir d_closedir
17100 eval $inlibc
17101
17102 case "$d_closedir" in
17103 "$define")
17104         echo " "
17105         echo "Checking whether closedir() returns a status..." >&4
17106         cat > try.c <<EOM
17107 #$i_dirent I_DIRENT             /**/
17108 #$i_sysdir I_SYS_DIR            /**/
17109 #$i_sysndir I_SYS_NDIR          /**/
17110 #$i_systypes I_SYS_TYPES        /**/
17111
17112 #if defined(I_SYS_TYPES)
17113 #include <sys/types.h>
17114 #endif
17115 #if defined(I_DIRENT)
17116 #include <dirent.h>
17117 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17118 #include <sys/dir.h>
17119 #endif
17120 #else
17121 #ifdef I_SYS_NDIR
17122 #include <sys/ndir.h>
17123 #else
17124 #ifdef I_SYS_DIR
17125 #ifdef hp9000s500
17126 #include <ndir.h>       /* may be wrong in the future */
17127 #else
17128 #include <sys/dir.h>
17129 #endif
17130 #endif
17131 #endif
17132 #endif 
17133 int main() { return closedir(opendir(".")); }
17134 EOM
17135         set try
17136         if eval $compile_ok; then
17137                 if $run ./try > /dev/null 2>&1 ; then
17138                         echo "Yes, it does."
17139                         val="$undef"
17140                 else
17141                         echo "No, it doesn't."
17142                         val="$define"
17143                 fi
17144         else
17145                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17146                 val="$define"
17147         fi
17148         ;;
17149 *)
17150         val="$undef";
17151         ;;
17152 esac
17153 set d_void_closedir
17154 eval $setvar
17155 $rm -f try try.*
17156 : see if there is a wait4
17157 set wait4 d_wait4
17158 eval $inlibc
17159
17160 : see if waitpid exists
17161 set waitpid d_waitpid
17162 eval $inlibc
17163
17164 : see if wcstombs exists
17165 set wcstombs d_wcstombs
17166 eval $inlibc
17167
17168 : see if wctomb exists
17169 set wctomb d_wctomb
17170 eval $inlibc
17171
17172 : see if writev exists
17173 set writev d_writev
17174 eval $inlibc
17175
17176 : preserve RCS keywords in files with variable substitution, grrr
17177 Date='$Date'
17178 Id='$Id'
17179 Log='$Log'
17180 RCSfile='$RCSfile'
17181 Revision='$Revision'
17182
17183 : check for alignment requirements
17184 echo " "
17185 case "$usecrosscompile$multiarch" in
17186 *$define*)
17187         $cat <<EOM
17188 You seem to be either cross-compiling or doing a multiarchitecture build,
17189 skipping the memory alignment check.
17190
17191 EOM
17192         case "$alignbytes" in
17193         '') alignbytes=8 ;;
17194         esac
17195         ;;
17196 *)
17197         case "$alignbytes" in
17198         '') echo "Checking alignment constraints..." >&4
17199                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17200                         $cat >try.c <<'EOCP'
17201 typedef long double NV;
17202 EOCP
17203                 else
17204                         $cat >try.c <<'EOCP'
17205 typedef double NV;
17206 EOCP
17207                 fi
17208                 $cat >>try.c <<'EOCP'
17209 #include <stdio.h>
17210 struct foobar {
17211         char foo;
17212         NV bar;
17213 } try_algn;
17214 int main()
17215 {
17216     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17217     return(0);
17218 }
17219 EOCP
17220                 set try
17221                 if eval $compile_ok; then
17222                         dflt=`$run ./try`
17223                 else
17224                         dflt='8'
17225                         echo "(I can't seem to compile the test program...)"
17226                 fi
17227                 ;;
17228         *) dflt="$alignbytes"
17229                 ;;
17230         esac
17231         rp="Doubles must be aligned on a how-many-byte boundary?"
17232         . ./myread
17233         alignbytes="$ans"
17234         $rm -f try.c try
17235         ;;
17236 esac
17237
17238
17239 : set the base revision
17240 baserev=5.0
17241
17242 : how do we concatenate cpp tokens here?
17243 echo " "
17244 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17245 $cat >cpp_stuff.c <<'EOCP'
17246 #define RCAT(a,b)a/**/b
17247 #define ACAT(a,b)a ## b
17248 RCAT(Rei,ser)
17249 ACAT(Cir,cus)
17250 EOCP
17251 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17252 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17253         echo "Oh!  Smells like ANSI's been here." >&4
17254         echo "We can catify or stringify, separately or together!"
17255         cpp_stuff=42
17256 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17257         echo "Ah, yes!  The good old days!" >&4
17258         echo "However, in the good old days we don't know how to stringify and"
17259         echo "catify at the same time."
17260         cpp_stuff=1
17261 else
17262         $cat >&4 <<EOM
17263 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17264 You're going to have to edit the values of CAT[2-5] in config.h...
17265 EOM
17266         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17267 fi
17268 $rm -f cpp_stuff.*
17269
17270 : see if this is a db.h system
17271 set db.h i_db
17272 eval $inhdr
17273
17274 case "$i_db" in
17275 $define)
17276         : Check db version.
17277         echo " "
17278         echo "Checking Berkeley DB version ..." >&4
17279         $cat >try.c <<EOCP
17280 #$d_const HASCONST
17281 #ifndef HASCONST
17282 #define const
17283 #endif
17284 #include <sys/types.h>
17285 #include <stdio.h>
17286 #$i_stdlib I_STDLIB
17287 #ifdef I_STDLIB
17288 #include <stdlib.h>
17289 #endif
17290 #include <db.h>
17291 int main(int argc, char *argv[])
17292 {
17293 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17294     int Major, Minor, Patch ;
17295     unsigned long Version ;
17296     (void)db_version(&Major, &Minor, &Patch) ;
17297     if (argc == 2) {
17298         printf("%d %d %d %d %d %d\n",
17299                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17300                Major, Minor, Patch);
17301         exit(0);
17302     }
17303     printf("You have Berkeley DB Version 2 or greater.\n");
17304
17305     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17306                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17307     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17308                 Major, Minor, Patch) ;
17309
17310     /* check that db.h & libdb are compatible */
17311     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17312         printf("db.h and libdb are incompatible.\n") ;
17313         exit(3);        
17314     }
17315
17316     printf("db.h and libdb are compatible.\n") ;
17317
17318     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17319                 + DB_VERSION_PATCH ;
17320
17321     /* needs to be >= 2.3.4 */
17322     if (Version < 2003004) {
17323     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17324         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17325         exit(2);        
17326     }
17327
17328     exit(0);
17329 #else
17330 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17331     if (argc == 2) {
17332         printf("1 0 0\n");
17333         exit(0);
17334     }
17335     printf("You have Berkeley DB Version 1.\n");
17336     exit(0);    /* DB version < 2: the coast is clear. */
17337 #else
17338     exit(1);    /* <db.h> not Berkeley DB? */
17339 #endif
17340 #endif
17341 }
17342 EOCP
17343         set try
17344         if eval $compile_ok && $run ./try; then
17345                 echo 'Looks OK.' >&4
17346                 set `$run ./try 1`
17347                 db_version_major=$1
17348                 db_version_minor=$2
17349                 db_version_patch=$3
17350         else
17351                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17352                 i_db=$undef
17353                 case " $libs " in
17354                 *"-ldb "*)
17355                         : Remove db from list of libraries to use
17356                         echo "Removing unusable -ldb from library list" >&4
17357                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17358                         shift
17359                         libs="$*"
17360                         echo "libs = $libs" >&4
17361                         ;;
17362                 esac
17363         fi
17364         $rm -f try.*
17365         ;;
17366 esac
17367
17368 case "$i_db" in
17369 define)
17370         : Check the return type needed for hash 
17371         echo " "
17372         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17373         $cat >try.c <<EOCP
17374 #$d_const HASCONST
17375 #ifndef HASCONST
17376 #define const
17377 #endif
17378 #include <sys/types.h>
17379 #include <db.h>
17380
17381 #ifndef DB_VERSION_MAJOR
17382 u_int32_t hash_cb (ptr, size)
17383 const void *ptr;
17384 size_t size;
17385 {
17386 }
17387 HASHINFO info;
17388 int main()
17389 {
17390         info.hash = hash_cb;
17391 }
17392 #endif
17393 EOCP
17394         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17395                 if $contains warning try.out >>/dev/null 2>&1 ; then
17396                         db_hashtype='int'
17397                 else
17398                         db_hashtype='u_int32_t'
17399                 fi
17400         else
17401                 : XXX Maybe we should just give up here.
17402                 db_hashtype=u_int32_t
17403                 $cat try.out >&4
17404                 echo "Help:  I can't seem to compile the db test program." >&4
17405                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17406         fi
17407         $rm -f try.*
17408         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17409         ;;
17410 *)      db_hashtype=u_int32_t
17411         ;;
17412 esac
17413 case "$i_db" in
17414 define)
17415         : Check the return type needed for prefix 
17416         echo " "
17417         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17418         cat >try.c <<EOCP
17419 #$d_const HASCONST
17420 #ifndef HASCONST
17421 #define const
17422 #endif
17423 #include <sys/types.h>
17424 #include <db.h>
17425
17426 #ifndef DB_VERSION_MAJOR
17427 size_t prefix_cb (key1, key2)
17428 const DBT *key1;
17429 const DBT *key2;
17430 {
17431 }
17432 BTREEINFO info;
17433 int main()
17434 {
17435         info.prefix = prefix_cb;
17436 }
17437 #endif
17438 EOCP
17439         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17440                 if $contains warning try.out >>/dev/null 2>&1 ; then
17441                         db_prefixtype='int'
17442                 else
17443                         db_prefixtype='size_t'
17444                 fi
17445         else
17446                 db_prefixtype='size_t'
17447                 : XXX Maybe we should just give up here.
17448                 $cat try.out >&4
17449                 echo "Help:  I can't seem to compile the db test program." >&4
17450                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17451         fi
17452         $rm -f try.*
17453         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17454         ;;
17455 *)      db_prefixtype='size_t'
17456         ;;
17457 esac
17458
17459
17460 : How can we generate normalized random numbers ?
17461 echo " "
17462 echo "Looking for a random number function..." >&4
17463 case "$randfunc" in
17464 '')
17465         if set drand48 val -f; eval $csym; $val; then
17466                 dflt="drand48"
17467                 echo "Good, found drand48()." >&4
17468         elif set random val -f; eval $csym; $val; then
17469                 dflt="random"
17470                 echo "OK, found random()." >&4
17471         else
17472                 dflt="rand"
17473                 echo "Yick, looks like I have to use rand()." >&4
17474         fi
17475         echo " "
17476         ;;
17477 *)
17478         dflt="$randfunc"
17479         ;;
17480 esac
17481 cont=true
17482
17483 case "$ccflags" in
17484 *-Dmy_rand=*|*-Dmy_srand=*)
17485         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17486         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17487         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17488         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17489         ;;
17490 esac
17491
17492 while $test "$cont"; do
17493         rp="Use which function to generate random numbers?"
17494         . ./myread
17495         if $test "$ans" = "$dflt"; then
17496                 : null
17497         else
17498                 randbits=''
17499         fi
17500         randfunc="$ans"
17501         if set $ans val -f; eval $csym; $val; then
17502                 cont=''
17503         else
17504                 dflt=y
17505                 rp="I cannot find function $ans. Use that name anyway?"
17506                 . ./myread
17507                 dflt=rand
17508                 case "$ans" in
17509                         [yY]*) cont='';;
17510                 esac
17511         fi
17512         case "$cont" in
17513         '')
17514                 case "$randfunc" in
17515                 drand48)
17516                         drand01="drand48()"
17517                         seedfunc="srand48"
17518                         randbits=48
17519                         randseedtype=long
17520                         ;;
17521                 rand|random)
17522                         case "$randbits" in
17523                         '')
17524 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17525                                 $cat >try.c <<EOCP
17526 #$i_unistd I_UNISTD
17527 #$i_stdlib I_STDLIB
17528 #include <stdio.h>
17529 #ifdef I_UNISTD
17530 #  include <unistd.h>
17531 #endif
17532 #ifdef I_STDLIB
17533 #  include <stdlib.h>
17534 #endif
17535 int main()
17536 {
17537         register int i;
17538         register unsigned long tmp;
17539         register unsigned long max = 0L;
17540
17541         for (i = 1000; i; i--) {
17542                 tmp = (unsigned long) $randfunc();
17543                 if (tmp > max) max = tmp;
17544         }
17545         for (i = 0; max; i++)
17546                 max /= 2;
17547         printf("%d\n",i);
17548 }
17549 EOCP
17550                                 set try
17551                                 if eval $compile_ok; then
17552                                         dflt=`try`
17553                                 else
17554                                         dflt='?'
17555                                         echo "(I can't seem to compile the test program...)"
17556                                 fi
17557                                 ;;
17558                         *)
17559                                 dflt="$randbits"
17560                                 ;;
17561                         esac
17562                         rp="How many bits does your $randfunc() function produce?"
17563                         . ./myread
17564                         randbits="$ans"
17565                         $rm -f try.c try
17566                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17567                         seedfunc="s$randfunc"
17568                         randseedtype=unsigned
17569                         ;;
17570                 *)
17571                         dflt="31"
17572                         rp="How many bits does your $randfunc() function produce?"
17573                         . ./myread
17574                         randbits="$ans"
17575                         seedfunc="s$randfunc"
17576                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17577                         if set $seedfunc val -f; eval $csym; $val; then
17578                                 echo "(Using $seedfunc() to seed random generator)"
17579                         else
17580                                 echo "(Warning: no $seedfunc() to seed random generator)"
17581                                 seedfunc=rand
17582                         fi
17583                         randseedtype=unsigned
17584                         ;;
17585                 esac
17586                 ;;
17587         esac
17588 done
17589
17590 echo " "
17591 echo "Determining whether or not we are on an EBCDIC system..." >&4
17592 $cat >try.c <<'EOM'
17593 int main()
17594 {
17595   if ('M'==0xd4) return 0;
17596   return 1;
17597 }
17598 EOM
17599
17600 val=$undef
17601 set try
17602 if eval $compile_ok; then
17603         if $run ./try; then
17604                 echo "You seem to speak EBCDIC." >&4
17605                 val="$define"
17606         else
17607                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17608         fi
17609 else
17610         echo "I'm unable to compile the test program." >&4
17611         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17612 fi
17613 $rm -f try try.*
17614 set ebcdic
17615 eval $setvar
17616
17617 echo " "
17618 $cat >&4 <<EOM
17619 Checking how to flush all pending stdio output...
17620 EOM
17621 # I only know how to find the first 32 possibly open files on SunOS.
17622 # See also hints/sunos_4_1.sh and util.c  --AD
17623 case "$osname" in
17624 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17625 esac
17626 $cat >>try.c <<EOCP
17627 #include <stdio.h>
17628 #$i_stdlib I_STDLIB
17629 #ifdef I_STDLIB
17630 #include <stdlib.h>
17631 #endif
17632 #$i_unistd I_UNISTD
17633 #ifdef I_UNISTD
17634 # include <unistd.h>
17635 #endif
17636 #$d_sysconf HAS_SYSCONF
17637 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17638 #ifdef HAS_STDIO_STREAM_ARRAY
17639 # define STDIO_STREAM_ARRAY $stdio_stream_array
17640 #endif
17641 int main() {
17642   FILE* p;
17643   unlink("try.out");
17644   p = fopen("try.out", "w");
17645 #ifdef TRY_FPUTC
17646   fputc('x', p);
17647 #else
17648 # ifdef TRY_FPRINTF
17649   fprintf(p, "x");
17650 # endif
17651 #endif
17652 #ifdef TRY_FFLUSH_NULL
17653   fflush(NULL);
17654 #endif
17655 #ifdef TRY_FFLUSH_ALL
17656   {
17657     long open_max = -1;
17658 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17659     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17660 # else
17661 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17662     open_max = sysconf(_SC_OPEN_MAX);
17663 #  else
17664 #   ifdef FOPEN_MAX
17665     open_max = FOPEN_MAX;
17666 #   else
17667 #    ifdef OPEN_MAX
17668     open_max = OPEN_MAX;
17669 #    else
17670 #     ifdef _NFILE
17671     open_max = _NFILE;
17672 #     endif
17673 #    endif
17674 #   endif
17675 #  endif
17676 # endif 
17677 # ifdef HAS_STDIO_STREAM_ARRAY
17678     if (open_max > 0) {
17679       long i;
17680       for (i = 0; i < open_max; i++)
17681             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17682                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17683                 STDIO_STREAM_ARRAY[i]._flag)
17684                 fflush(&STDIO_STREAM_ARRAY[i]);
17685     }   
17686   }
17687 # endif
17688 #endif
17689   _exit(42);
17690 }
17691 EOCP
17692 : first we have to find out how _not_ to flush
17693 $to try.c
17694 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17695     output=''
17696     set try -DTRY_FPUTC
17697     if eval $compile; then
17698             $run ./try 2>/dev/null
17699             code="$?"
17700             $from try.out
17701             if $test ! -s try.out -a "X$code" = X42; then
17702                 output=-DTRY_FPUTC
17703             fi
17704     fi
17705     case "$output" in
17706     '')
17707             set try -DTRY_FPRINTF
17708             if eval $compile; then
17709                     $run ./try 2>/dev/null
17710                     code="$?"
17711                     $from try.out
17712                     if $test ! -s try.out -a "X$code" = X42; then
17713                         output=-DTRY_FPRINTF
17714                     fi
17715             fi
17716         ;;
17717     esac
17718 fi
17719 : check for fflush NULL behaviour
17720 case "$fflushNULL" in
17721 '')     set try -DTRY_FFLUSH_NULL $output
17722         if eval $compile; then
17723                 $run ./try 2>/dev/null
17724                 code="$?"
17725                 $from try.out
17726                 if $test -s try.out -a "X$code" = X42; then
17727                         fflushNULL="`$cat try.out`"
17728                 else
17729                         if $test "X$code" != X42; then
17730                                 $cat >&4 <<EOM
17731 (If this test failed, don't worry, we'll try another method shortly.)
17732 EOM
17733                         fi
17734                 fi
17735         fi
17736         $rm -f core try.core core.try.*
17737         case "$fflushNULL" in
17738         x)      $cat >&4 <<EOM
17739 Your fflush(NULL) works okay for output streams.
17740 Let's see if it clobbers input pipes...
17741 EOM
17742 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17743 # bug that improperly flushes the input end of pipes.  So we avoid the
17744 # autoflush on fork/system/exec support for now. :-(
17745 $cat >tryp.c <<EOCP
17746 #include <stdio.h>
17747 int
17748 main(int argc, char **argv)
17749 {
17750     char buf[1024];
17751     int i;
17752     char *bp = buf;
17753     while (1) {
17754         while ((i = getc(stdin)) != -1
17755                && (*bp++ = i) != '\n'
17756                && bp < &buf[1024])
17757         /* DO NOTHING */ ;
17758         *bp = '\0';
17759         fprintf(stdout, "%s", buf);
17760         fflush(NULL);
17761         if (i == -1)
17762             return 0;
17763         bp = buf;
17764     }
17765 }
17766 EOCP
17767                 fflushNULL="$define"
17768                 set tryp
17769                 if eval $compile; then
17770                     $rm -f tryp.out
17771                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17772                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17773                        $cat >&4 <<EOM
17774 fflush(NULL) seems to behave okay with input streams.
17775 EOM
17776                         fflushNULL="$define"
17777                     else
17778                         $cat >&4 <<EOM
17779 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17780 EOM
17781                         fflushNULL="$undef"
17782                     fi
17783                 fi
17784                 $rm -f core tryp.c tryp.core core.tryp.*
17785                 ;;
17786         '')     $cat >&4 <<EOM
17787 Your fflush(NULL) isn't working (contrary to ANSI C).
17788 EOM
17789                 fflushNULL="$undef"
17790                 ;;
17791         *)      $cat >&4 <<EOM
17792 Cannot figure out whether your fflush(NULL) works or not.
17793 I'm assuming it doesn't (contrary to ANSI C).
17794 EOM
17795                 fflushNULL="$undef"
17796                 ;;
17797         esac
17798         ;;
17799 $define|true|[yY]*)
17800         fflushNULL="$define"
17801         ;;
17802 *)
17803         fflushNULL="$undef"
17804         ;;
17805 esac
17806 : check explicit looping only if NULL did not work, and if the pipe
17807 : bug does not show up on an explicit flush too
17808 case "$fflushNULL" in
17809 "$undef")
17810         $cat >tryp.c <<EOCP
17811 #include <stdio.h>
17812 int
17813 main(int argc, char **argv)
17814 {
17815     char buf[1024];
17816     int i;
17817     char *bp = buf;
17818     while (1) {
17819         while ((i = getc(stdin)) != -1
17820                && (*bp++ = i) != '\n'
17821                && bp < &buf[1024])
17822         /* DO NOTHING */ ;
17823         *bp = '\0';
17824         fprintf(stdout, "%s", buf);
17825         fflush(stdin);
17826         if (i == -1)
17827             return 0;
17828         bp = buf;
17829     }
17830 }
17831 EOCP
17832         set tryp
17833         if eval $compile; then
17834             $rm -f tryp.out
17835             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17836             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17837                $cat >&4 <<EOM
17838 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17839 EOM
17840                 : now check for fflushall behaviour
17841                 case "$fflushall" in
17842                 '')     set try -DTRY_FFLUSH_ALL $output
17843                         if eval $compile; then
17844                                 $cat >&4 <<EOM
17845 (Now testing the other method--but note that this also may fail.)
17846 EOM
17847                                 $run ./try 2>/dev/null
17848                                 code=$?
17849                                 $from try.out
17850                                 if $test -s try.out -a "X$code" = X42; then
17851                                         fflushall="`$cat try.out`"
17852                                 fi
17853                         fi
17854                         $rm -f core try.core core.try.*
17855                         case "$fflushall" in
17856                         x)      $cat >&4 <<EOM
17857 Whew. Flushing explicitly all the stdio streams works.
17858 EOM
17859                                 fflushall="$define"
17860                                 ;;
17861                         '')     $cat >&4 <<EOM
17862 Sigh. Flushing explicitly all the stdio streams doesn't work.
17863 EOM
17864                                 fflushall="$undef"
17865                                 ;;
17866                         *)      $cat >&4 <<EOM
17867 Cannot figure out whether flushing stdio streams explicitly works or not.
17868 I'm assuming it doesn't.
17869 EOM
17870                                 fflushall="$undef"
17871                                 ;;
17872                         esac
17873                         ;;
17874                 "$define"|true|[yY]*)
17875                         fflushall="$define"
17876                         ;;
17877                 *)
17878                         fflushall="$undef"
17879                         ;;
17880                 esac
17881             else
17882                 $cat >&4 <<EOM
17883 All is futile.  Even fflush(stdin) clobbers input pipes!
17884 EOM
17885                 fflushall="$undef"
17886             fi
17887         else
17888             fflushall="$undef"
17889         fi
17890         $rm -f core tryp.c tryp.core core.tryp.*
17891         ;;
17892 *)      fflushall="$undef"
17893         ;;
17894 esac
17895
17896 case "$fflushNULL$fflushall" in
17897 undefundef)
17898         $cat <<EOM
17899 OK, I give up.  I cannot figure out how to flush pending stdio output.
17900 We won't be flushing handles at all before fork/exec/popen.
17901 EOM
17902         ;;
17903 esac
17904 $rm -f try.* try$exe_ext
17905
17906 : Store the full pathname to the ar program for use in the C program
17907 : Respect a hint or command line value for full_ar.
17908 case "$full_ar" in
17909 '') full_ar=$ar ;;
17910 esac
17911
17912 : Store the full pathname to the sed program for use in the C program
17913 full_sed=$sed
17914
17915 : see what type gids are declared as in the kernel
17916 echo " "
17917 echo "Looking for the type for group ids returned by getgid()."
17918 set gid_t gidtype xxx stdio.h sys/types.h
17919 eval $typedef
17920 case "$gidtype" in
17921 xxx)
17922         xxx=`./findhdr sys/user.h`
17923         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17924         case $1 in
17925         unsigned) dflt="$1 $2" ;;
17926         *) dflt="$1" ;;
17927         esac
17928         ;;
17929 *) dflt="$gidtype";;
17930 esac
17931 case "$gidtype" in
17932 gid_t) echo "gid_t found." ;;
17933 *)      rp="What is the type for group ids returned by getgid()?"
17934         . ./myread
17935         gidtype="$ans"
17936         ;;
17937 esac
17938
17939 echo " "
17940 case "$gidtype" in
17941 *_t) zzz="$gidtype"     ;;
17942 *)   zzz="gid"          ;;
17943 esac
17944 echo "Checking the size of $zzz..." >&4 
17945 cat > try.c <<EOCP
17946 #include <sys/types.h>
17947 #include <stdio.h>
17948 #$i_stdlib I_STDLIB
17949 #ifdef I_STDLIB
17950 #include <stdlib.h>
17951 #endif
17952 int main() {
17953     printf("%d\n", (int)sizeof($gidtype));
17954     exit(0);
17955 }
17956 EOCP
17957 set try
17958 if eval $compile_ok; then
17959         yyy=`$run ./try`
17960         case "$yyy" in
17961         '')     gidsize=4
17962                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17963                 ;;
17964         *)      gidsize=$yyy
17965                 echo "Your $zzz is $gidsize bytes long."
17966                 ;;
17967         esac
17968 else
17969         gidsize=4
17970         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17971 fi
17972
17973
17974 echo " "
17975 case "$gidtype" in
17976 *_t) zzz="$gidtype"     ;;
17977 *)   zzz="gid"          ;;
17978 esac
17979 echo "Checking the sign of $zzz..." >&4 
17980 cat > try.c <<EOCP
17981 #include <sys/types.h>
17982 #include <stdio.h>
17983 int main() {
17984         $gidtype foo = -1;
17985         if (foo < 0)
17986                 printf("-1\n");
17987         else
17988                 printf("1\n");
17989 }
17990 EOCP
17991 set try
17992 if eval $compile; then
17993         yyy=`$run ./try`
17994         case "$yyy" in
17995         '')     gidsign=1
17996                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17997                 ;;
17998         *)      gidsign=$yyy
17999                 case "$gidsign" in
18000                  1) echo "Your $zzz is unsigned." ;;
18001                 -1) echo "Your $zzz is signed."   ;;
18002                 esac
18003                 ;;
18004         esac
18005 else
18006         gidsign=1
18007         echo "(I can't compile the test program--guessing unsigned.)" >&4
18008 fi
18009
18010
18011 echo " "
18012
18013 if $test X"$quadtype" != X; then
18014
18015 echo "Checking how to print 64-bit integers..." >&4
18016
18017 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18018         $cat >try.c <<'EOCP'
18019 #include <sys/types.h>
18020 #include <stdio.h>
18021 int main() {
18022   int q = 12345678901;
18023   printf("%ld\n", q);
18024 }
18025 EOCP
18026         set try
18027         if eval $compile; then
18028                 yyy=`$run ./try`
18029                 case "$yyy" in
18030                 12345678901)
18031                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18032                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18033                         echo "We will use %d."
18034                         ;;
18035                 esac
18036         fi
18037 fi
18038
18039 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18040         $cat >try.c <<'EOCP'
18041 #include <sys/types.h>
18042 #include <stdio.h>
18043 int main() {
18044   long q = 12345678901;
18045   printf("%ld\n", q);
18046 }
18047 EOCP
18048         set try
18049         if eval $compile; then
18050                 yyy=`$run ./try`
18051                 case "$yyy" in
18052                 12345678901)
18053                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18054                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18055                         echo "We will use %ld."
18056                         ;;
18057                 esac
18058         fi
18059 fi
18060
18061 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18062         $cat >try.c <<'EOCP'
18063 #include <sys/types.h>
18064 #include <inttypes.h>
18065 #include <stdio.h>
18066 int main() {
18067   int64_t q = 12345678901;
18068   printf("%" PRId64 "\n", q);
18069 }
18070 EOCP
18071         set try
18072         if eval $compile; then
18073                 yyy=`$run ./try`
18074                 case "$yyy" in
18075                 12345678901)
18076                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18077                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18078                         echo "We will use the C9X style."
18079                         ;;
18080                 esac
18081         fi
18082 fi
18083
18084 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18085         $cat >try.c <<EOCP
18086 #include <sys/types.h>
18087 #include <stdio.h>
18088 int main() {
18089   $quadtype q = 12345678901;
18090   printf("%Ld\n", q);
18091 }
18092 EOCP
18093         set try
18094         if eval $compile; then
18095                 yyy=`$run ./try`
18096                 case "$yyy" in
18097                 12345678901)
18098                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18099                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18100                         echo "We will use %Ld."
18101                         ;;
18102                 esac
18103         fi
18104 fi
18105
18106 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18107         $cat >try.c <<'EOCP'
18108 #include <sys/types.h>
18109 #include <stdio.h>
18110 int main() {
18111   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18112   printf("%lld\n", q);
18113 }
18114 EOCP
18115         set try
18116         if eval $compile; then
18117                 yyy=`$run ./try`
18118                 case "$yyy" in
18119                 12345678901)
18120                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18121                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18122                         echo "We will use the %lld style."
18123                         ;;
18124                 esac
18125         fi
18126 fi
18127
18128 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18129         $cat >try.c <<EOCP
18130 #include <sys/types.h>
18131 #include <stdio.h>
18132 int main() {
18133   $quadtype q = 12345678901;
18134   printf("%qd\n", q);
18135 }
18136 EOCP
18137         set try
18138         if eval $compile; then
18139                 yyy=`$run ./try`
18140                 case "$yyy" in
18141                 12345678901)
18142                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18143                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18144                         echo "We will use %qd."
18145                         ;;
18146                 esac
18147         fi
18148 fi
18149
18150 if $test X"$sPRId64" = X; then
18151         echo "Cannot figure out how to print 64-bit integers." >&4
18152 fi
18153
18154 $rm -f try try.*
18155
18156 fi
18157
18158 case "$sPRId64" in
18159 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18160         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18161         ;;
18162 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18163         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18164         ;;
18165 esac
18166
18167
18168 echo " "
18169 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18170
18171 if $test X"$ivsize" = X8; then
18172         ivdformat="$sPRId64"
18173         uvuformat="$sPRIu64"
18174         uvoformat="$sPRIo64"
18175         uvxformat="$sPRIx64"
18176         uvXUformat="$sPRIXU64"
18177 else
18178         if $test X"$ivsize" = X"$longsize"; then
18179                 ivdformat='"ld"'
18180                 uvuformat='"lu"'
18181                 uvoformat='"lo"'
18182                 uvxformat='"lx"'
18183                 uvXUformat='"lX"'
18184         else
18185                 if $test X"$ivsize" = X"$intsize"; then
18186                         ivdformat='"d"'
18187                         uvuformat='"u"'
18188                         uvoformat='"o"'
18189                         uvxformat='"x"'
18190                         uvXUformat='"X"'
18191                 else
18192                         : far out
18193                         if $test X"$ivsize" = X"$shortsize"; then
18194                                 ivdformat='"hd"'
18195                                 uvuformat='"hu"'
18196                                 uvoformat='"ho"'
18197                                 uvxformat='"hx"'
18198                                 uvXUformat='"hX"'
18199                         fi
18200                 fi
18201         fi
18202 fi
18203
18204 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18205         nveformat="$sPRIeldbl"
18206         nvfformat="$sPRIfldbl"
18207         nvgformat="$sPRIgldbl"
18208         nvEUformat="$sPRIEUldbl"
18209         nvFUformat="$sPRIFUldbl"
18210         nvGUformat="$sPRIGUldbl"
18211 else
18212         nveformat='"e"'
18213         nvfformat='"f"'
18214         nvgformat='"g"'
18215         nvEUformat='"E"'
18216         nvFUformat='"F"'
18217         nvGUformat='"G"'
18218 fi
18219
18220 case "$ivdformat" in
18221 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18222     exit 1
18223     ;;
18224 esac
18225
18226
18227 echo " "
18228 $echo "Checking the format string to be used for gids..." >&4
18229
18230 case "$gidsign" in
18231 -1)     if $test X"$gidsize" = X"$ivsize"; then
18232                 gidformat="$ivdformat"
18233         else
18234                 if $test X"$gidsize" = X"$longsize"; then
18235                         gidformat='"ld"'
18236                 else
18237                         if $test X"$gidsize" = X"$intsize"; then
18238                                 gidformat='"d"'
18239                         else
18240                                 if $test X"$gidsize" = X"$shortsize"; then
18241                                         gidformat='"hd"'
18242                                 fi
18243                         fi
18244                 fi
18245         fi
18246         ;;
18247 *)      if $test X"$gidsize" = X"$uvsize"; then
18248                 gidformat="$uvuformat"
18249         else
18250                 if $test X"$gidsize" = X"$longsize"; then
18251                         gidformat='"lu"'
18252                 else
18253                         if $test X"$gidsize" = X"$intsize"; then
18254                                 gidformat='"u"'
18255                         else
18256                                 if $test X"$gidsize" = X"$shortsize"; then
18257                                         gidformat='"hu"'
18258                                 fi
18259                         fi
18260                 fi
18261         fi
18262         ;;
18263 esac
18264
18265 : see if getgroups exists
18266 set getgroups d_getgrps
18267 eval $inlibc
18268
18269 : see if setgroups exists
18270 set setgroups d_setgrps
18271 eval $inlibc
18272
18273
18274 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18275 echo " "
18276 case "$d_getgrps$d_setgrps" in
18277 *define*)
18278         case "$groupstype" in
18279         '') dflt="$gidtype" ;;
18280         *)  dflt="$groupstype" ;;
18281         esac
18282         $cat <<EOM
18283 What type of pointer is the second argument to getgroups() and setgroups()?
18284 Usually this is the same as group ids, $gidtype, but not always.
18285
18286 EOM
18287         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18288         . ./myread
18289         groupstype="$ans"
18290         ;;
18291 *)  groupstype="$gidtype";;
18292 esac
18293
18294 echo " "
18295 echo "Checking if your $make program sets \$(MAKE)..." >&4
18296 case "$make_set_make" in
18297 '')
18298         $sed 's/^X //' > testmake.mak << 'EOF'
18299 Xall:
18300 X       @echo 'maketemp="$(MAKE)"'
18301 EOF
18302         case "`$make -f testmake.mak 2>/dev/null`" in
18303         *maketemp=*) make_set_make='#' ;;
18304         *)      make_set_make="MAKE=$make" ;;
18305         esac
18306         $rm -f testmake.mak
18307         ;;
18308 esac
18309 case "$make_set_make" in
18310 '#') echo "Yup, it does.";;
18311 *) echo "Nope, it doesn't.";;
18312 esac
18313
18314 : see what type is used for mode_t
18315 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18316 set mode_t modetype int stdio.h sys/types.h
18317 eval $typedef_ask
18318
18319 : see if stdarg is available
18320 echo " "
18321 if $test `./findhdr stdarg.h`; then
18322         echo "<stdarg.h> found." >&4
18323         valstd="$define"
18324 else
18325         echo "<stdarg.h> NOT found." >&4
18326         valstd="$undef"
18327 fi
18328
18329 : see if varags is available
18330 echo " "
18331 if $test `./findhdr varargs.h`; then
18332         echo "<varargs.h> found." >&4
18333 else
18334         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18335 fi
18336
18337 : set up the varargs testing programs
18338 $cat > varargs.c <<EOP
18339 #ifdef I_STDARG
18340 #include <stdarg.h>
18341 #endif
18342 #ifdef I_VARARGS
18343 #include <varargs.h>
18344 #endif
18345
18346 #ifdef I_STDARG
18347 int f(char *p, ...)
18348 #else
18349 int f(va_alist)
18350 va_dcl
18351 #endif
18352 {
18353         va_list ap;
18354 #ifndef I_STDARG
18355         char *p;
18356 #endif
18357 #ifdef I_STDARG
18358         va_start(ap,p);
18359 #else
18360         va_start(ap);
18361         p = va_arg(ap, char *);
18362 #endif
18363         va_end(ap);
18364 }
18365 EOP
18366 $cat > varargs <<EOP
18367 $startsh
18368 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18369         echo "true"
18370 else
18371         echo "false"
18372 fi
18373 $rm -f varargs$_o
18374 EOP
18375 chmod +x varargs
18376
18377 : now check which varargs header should be included
18378 echo " "
18379 i_varhdr=''
18380 case "$valstd" in
18381 "$define")
18382         if `./varargs I_STDARG`; then
18383                 val='stdarg.h'
18384         elif `./varargs I_VARARGS`; then
18385                 val='varargs.h'
18386         fi
18387         ;;
18388 *)
18389         if `./varargs I_VARARGS`; then
18390                 val='varargs.h'
18391         fi
18392         ;;
18393 esac
18394 case "$val" in
18395 '')
18396 echo "I could not find the definition for va_dcl... You have problems..." >&4
18397         val="$undef"; set i_stdarg; eval $setvar
18398         val="$undef"; set i_varargs; eval $setvar
18399         ;;
18400 *) 
18401         set i_varhdr
18402         eval $setvar
18403         case "$i_varhdr" in
18404         stdarg.h)
18405                 val="$define"; set i_stdarg; eval $setvar
18406                 val="$undef"; set i_varargs; eval $setvar
18407                 ;;
18408         varargs.h)
18409                 val="$undef"; set i_stdarg; eval $setvar
18410                 val="$define"; set i_varargs; eval $setvar
18411                 ;;
18412         esac
18413         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18414 esac
18415 $rm -f varargs*
18416
18417 : see if we need va_copy
18418 echo " "
18419 case "$i_stdarg" in
18420 "$define")
18421         $cat >try.c <<EOCP
18422 #include <stdarg.h>
18423 #include <stdio.h>
18424 #$i_stdlib I_STDLIB
18425 #ifdef I_STDLIB
18426 #include <stdlib.h>
18427 #endif
18428 #include <signal.h>
18429
18430 int
18431 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18432 {
18433   return vfprintf(f, fmt, *valp);
18434 }
18435  
18436 int    
18437 myvfprintf(FILE *f, const  char *fmt, va_list val)
18438 {
18439   return ivfprintf(f, fmt, &val);
18440 }
18441       
18442 int
18443 myprintf(char *fmt, ...) 
18444 {
18445   va_list val;
18446   va_start(val, fmt);
18447   return myvfprintf(stdout, fmt, val); 
18448 }         
18449
18450 int
18451 main(int ac, char **av)
18452 {
18453   signal(SIGSEGV, exit);
18454
18455   myprintf("%s%cs all right, then\n", "that", '\'');                            
18456   exit(0);      
18457 }
18458 EOCP
18459         set try
18460         if eval $compile && $run ./try 2>&1 >/dev/null; then
18461                 case "`$run ./try`" in
18462                 "that's all right, then")
18463                         okay=yes
18464                         ;;
18465                 esac
18466         fi
18467         case "$okay" in
18468         yes)    echo "It seems that you don't need va_copy()." >&4
18469                 need_va_copy="$undef"
18470                 ;;
18471         *)      echo "It seems that va_copy() or similar will be needed." >&4
18472                 need_va_copy="$define"
18473                 ;;
18474         esac
18475         $rm -f try.* core core.* *.core *.core.*
18476         ;;
18477 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18478         ;;
18479 esac
18480
18481 : see what type is used for size_t
18482 rp="What is the type used for the length parameter for string functions?"
18483 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18484 eval $typedef_ask
18485
18486 : check for type of arguments to gethostbyaddr. 
18487 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18488         case "$d_gethbyaddr" in
18489         $define)
18490                 $cat <<EOM
18491
18492 Checking to see what type of arguments are accepted by gethostbyaddr().
18493 EOM
18494                 hdrs="$define sys/types.h
18495                         $d_socket sys/socket.h 
18496                         $i_niin netinet/in.h 
18497                         $i_netdb netdb.h
18498                         $i_unistd unistd.h"
18499                 : The first arg can 'char *' or 'void *'
18500                 : The second arg is some of integral type
18501                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18502                         for yyy in size_t long int; do
18503                                 case "$netdb_host_type" in
18504                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18505                                         if ./protochk "$try" $hdrs; then
18506                                                 echo "Your system accepts $xxx for the first arg."
18507                                                 echo "...and $yyy for the second arg."
18508                                                 netdb_host_type="$xxx"
18509                                                 netdb_hlen_type="$yyy"
18510                                         fi
18511                                         ;;
18512                                 esac
18513                         done
18514                 done
18515                 : In case none of those worked, prompt the user.
18516                 case "$netdb_host_type" in
18517                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18518                         dflt='char *'
18519                         . ./myread
18520                         netdb_host_type=$ans
18521                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18522                         dflt="$sizetype"
18523                         . ./myread
18524                         netdb_hlen_type=$ans
18525                         ;;
18526                 esac
18527                 ;;
18528         *)      : no gethostbyaddr, so pick harmless defaults
18529                 netdb_host_type='char *'
18530                 netdb_hlen_type="$sizetype"
18531                 ;;
18532         esac
18533         # Remove the "const" if needed. -- but then we'll have a 
18534         # prototype clash!
18535         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18536 fi
18537
18538 : check for type of argument to gethostbyname. 
18539 if test "X$netdb_name_type" = X ; then
18540         case "$d_gethbyname" in
18541         $define)
18542                 $cat <<EOM
18543
18544 Checking to see what type of argument is accepted by gethostbyname().
18545 EOM
18546                 hdrs="$define sys/types.h
18547                         $d_socket sys/socket.h 
18548                         $i_niin netinet/in.h 
18549                         $i_netdb netdb.h
18550                         $i_unistd unistd.h"
18551                 for xxx in "const char *" "char *"; do
18552                         case "$netdb_name_type" in
18553                         '')     try="extern struct hostent *gethostbyname($xxx);"
18554                                 if ./protochk "$try" $hdrs; then
18555                                         echo "Your system accepts $xxx."
18556                                         netdb_name_type="$xxx"
18557                                 fi
18558                                 ;;
18559                         esac
18560                 done
18561                 : In case none of those worked, prompt the user.
18562                 case "$netdb_name_type" in
18563                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18564                         dflt='char *'
18565                         . ./myread
18566                         netdb_name_type=$ans
18567                         ;;
18568                 esac
18569                 ;;
18570         *)      : no gethostbyname, so pick harmless default
18571                 netdb_name_type='char *'
18572                 ;;
18573         esac
18574 fi
18575
18576 : check for type of 1st argument to getnetbyaddr. 
18577 if test "X$netdb_net_type" = X ; then
18578         case "$d_getnbyaddr" in
18579         $define)
18580                 $cat <<EOM
18581
18582 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18583 EOM
18584                 hdrs="$define sys/types.h
18585                         $d_socket sys/socket.h 
18586                         $i_niin netinet/in.h 
18587                         $i_netdb netdb.h
18588                         $i_unistd unistd.h"
18589                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18590                         case "$netdb_net_type" in
18591                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18592                                 if ./protochk "$try" $hdrs; then
18593                                         echo "Your system accepts $xxx."
18594                                         netdb_net_type="$xxx"
18595                                 fi
18596                                 ;;
18597                         esac
18598                 done
18599                 : In case none of those worked, prompt the user.
18600                 case "$netdb_net_type" in
18601                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18602                         dflt='long'
18603                         . ./myread
18604                         netdb_net_type=$ans
18605                         ;;
18606                 esac
18607                 ;;
18608         *)      : no getnetbyaddr, so pick harmless default
18609                 netdb_net_type='long'
18610                 ;;
18611         esac
18612 fi
18613 : locate the preferred pager for this system
18614 fn=f/
18615 case "$pager" in
18616 '')
18617         dflt=''
18618         case "$pg" in
18619         /*) dflt=$pg;;
18620         [a-zA-Z]:/*) dflt=$pg;;
18621         esac
18622         case "$more" in
18623         /*) dflt=$more;;
18624         [a-zA-Z]:/*) dflt=$more;;
18625         esac
18626         case "$less" in
18627         /*) dflt=$less;;
18628         [a-zA-Z]:/*) dflt=$less;;
18629         esac
18630         case "$dflt" in
18631         '') dflt=/usr/ucb/more;;
18632         esac
18633         ;;
18634 *)      dflt="$pager"
18635         : Instruct ./getfile to trust the hinted or previous pager value,
18636         : even if it does not begin with a slash.  For example, on os2,
18637         : pager might be cmd /c more.  See comments in UU/getfile.
18638         fn="f/($pager)"
18639         ;;
18640 esac
18641 echo " "
18642 rp='What pager is used on your system?'
18643 . ./getfile
18644 pager="$ans"
18645
18646 : see what type pids are declared as in the kernel
18647 rp="What is the type of process ids on this system?"
18648 set pid_t pidtype int stdio.h sys/types.h
18649 eval $typedef_ask
18650
18651 : Find earliest binary compatible site_perl subdirectory perl can use.
18652 xs_apiversion=$version # The current site_perl version.
18653 : Find earliest pure perl site_perl subdirectory perl can use.
18654 : The versioned directories started at 5.005.
18655 pm_apiversion='5.005'
18656
18657 : see if ar generates random libraries by itself
18658 echo " "
18659 echo "Checking how to generate random libraries on your machine..." >&4
18660 echo 'int bar1() { return bar2(); }' > bar1.c
18661 echo 'int bar2() { return 2; }' > bar2.c
18662 $cat > foo.c <<EOP
18663 #$i_stdlib I_STDLIB
18664 #ifdef I_STDLIB
18665 #include <stdlib.h>
18666 #endif
18667 int main() { printf("%d\n", bar1()); exit(0); }
18668 EOP
18669 $cc $ccflags -c bar1.c >/dev/null 2>&1
18670 $cc $ccflags -c bar2.c >/dev/null 2>&1
18671 $cc $ccflags -c foo.c >/dev/null 2>&1
18672 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18673 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18674         $run ./foobar >/dev/null 2>&1; then
18675         echo "$ar appears to generate random libraries itself."
18676         orderlib=false
18677         ranlib=":"
18678 elif $ar ts bar$_a >/dev/null 2>&1 &&
18679         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18680         $run ./foobar >/dev/null 2>&1; then
18681                 echo "a table of contents needs to be added with '$ar ts'."
18682                 orderlib=false
18683                 ranlib="$ar ts"
18684 else
18685         case "$ranlib" in
18686         :) ranlib='';;
18687         '')
18688                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18689                 $test -f $ranlib || ranlib=''
18690                 ;;
18691         esac
18692         if $test -n "$ranlib"; then
18693                 echo "your system has '$ranlib'; we'll use that."
18694                 orderlib=false
18695         else
18696                 echo "your system doesn't seem to support random libraries"
18697                 echo "so we'll use lorder and tsort to order the libraries."
18698                 orderlib=true
18699                 ranlib=":"
18700         fi
18701 fi
18702 $rm -f foo* bar* 
18703
18704 : check for type of arguments to select. 
18705 case "$selecttype" in
18706 '') case "$d_select" in
18707         $define)
18708                 echo " "
18709                 $cat <<EOM
18710 Checking to see what type of arguments are accepted by select().
18711 EOM
18712                 hdrs="$define sys/types.h
18713                         $i_systime sys/time.h 
18714                         $i_sysselct sys/select.h
18715                         $d_socket sys/socket.h"
18716                 : The first arg can be int, unsigned, or size_t
18717                 : The last arg may or may not be 'const'
18718                 val=''
18719                 : void pointer has been seen but using that
18720                 : breaks the selectminbits test
18721                 for xxx in 'fd_set *' 'int *'; do
18722                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18723                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18724                                         case "$val" in
18725                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18726                                                 if ./protochk "$try" $hdrs; then
18727                                                         echo "Your system accepts $xxx."
18728                                                         val="$xxx"
18729                                                 fi
18730                                                 ;;
18731                                         esac
18732                                 done
18733                         done
18734                 done
18735                 case "$val" in
18736                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18737                         case "$d_fd_set" in
18738                                 $define) dflt="fd_set *" ;;
18739                                 *)              dflt="int *" ;;
18740                         esac
18741                         . ./myread
18742                         val=$ans
18743                         ;;
18744                 esac
18745                 selecttype="$val"
18746                 ;;
18747         *)      : no select, so pick a harmless default
18748                 selecttype='int *'
18749                 ;;
18750         esac
18751         ;;
18752 esac
18753
18754 : check for the select 'width'
18755 case "$selectminbits" in
18756 '') safebits=`expr $ptrsize \* 8`
18757     case "$d_select" in
18758         $define)
18759                 $cat <<EOM
18760
18761 Checking to see on how many bits at a time your select() operates...
18762 EOM
18763                 $cat >try.c <<EOCP
18764 #include <sys/types.h>
18765 #$i_time I_TIME
18766 #$i_systime I_SYS_TIME
18767 #$i_systimek I_SYS_TIME_KERNEL
18768 #ifdef I_TIME
18769 #   include <time.h>
18770 #endif
18771 #ifdef I_SYS_TIME
18772 #   ifdef I_SYS_TIME_KERNEL
18773 #       define KERNEL
18774 #   endif
18775 #   include <sys/time.h>
18776 #   ifdef I_SYS_TIME_KERNEL
18777 #       undef KERNEL
18778 #   endif
18779 #endif
18780 #$i_sysselct I_SYS_SELECT
18781 #ifdef I_SYS_SELECT
18782 #include <sys/select.h>
18783 #endif
18784 #$d_socket HAS_SOCKET
18785 #ifdef HAS_SOCKET
18786 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18787 #endif
18788 #include <stdio.h>
18789 #$i_stdlib I_STDLIB
18790 #ifdef I_STDLIB
18791 #include <stdlib.h>
18792 #endif
18793 $selecttype b;
18794 #define S sizeof(*(b))
18795 #define MINBITS 64
18796 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18797 #define NBITS  (NBYTES * 8)
18798 int main() {
18799     char *s = malloc(NBYTES);
18800     struct timeval t;
18801     int i;
18802     FILE* fp;
18803     int fd;
18804
18805     if (!s)
18806         exit(1);
18807     fclose(stdin);
18808     fp = fopen("try.c", "r");
18809     if (fp == 0)
18810       exit(2);
18811     fd = fileno(fp);
18812     if (fd < 0)
18813       exit(3);
18814     b = ($selecttype)s;
18815     for (i = 0; i < NBITS; i++)
18816         FD_SET(i, b);
18817     t.tv_sec  = 0;
18818     t.tv_usec = 0;
18819     select(fd + 1, b, 0, 0, &t);
18820     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18821     free(s);
18822     printf("%d\n", i + 1);
18823     return 0;
18824 }
18825 EOCP
18826                 set try
18827                 if eval $compile_ok; then
18828                         selectminbits=`$run ./try`
18829                         case "$selectminbits" in
18830                         '')     cat >&4 <<EOM
18831 Cannot figure out on how many bits at a time your select() operates.
18832 I'll play safe and guess it is $safebits bits.
18833 EOM
18834                                 selectminbits=$safebits
18835                                 bits="$safebits bits"
18836                                 ;;
18837                         1)      bits="1 bit" ;;
18838                         *)      bits="$selectminbits bits" ;;
18839                         esac
18840                         echo "Your select() operates on $bits at a time." >&4
18841                 else
18842                         rp='What is the minimum number of bits your select() operates on?'
18843                         case "$byteorder" in
18844                         12345678)       dflt=64 ;;
18845                         1234)           dflt=32 ;;
18846                         *)              dflt=1  ;;
18847                         esac
18848                         . ./myread
18849                         val=$ans
18850                         selectminbits="$val"
18851                 fi
18852                 $rm -f try.* try
18853                 ;;
18854         *)      : no select, so pick a harmless default
18855                 selectminbits=$safebits
18856                 ;;
18857         esac
18858         ;;
18859 esac
18860
18861 : Trace out the files included by signal.h, then look for SIGxxx names.
18862 : Remove SIGARRAYSIZE used by HPUX.
18863 : Remove SIGSTKSIZE used by Linux.
18864 : Remove SIGSTKSZ used by Posix.
18865 : Remove SIGTYP void lines used by OS2.
18866 : Some cpps, like os390, dont give the file name anywhere
18867 if [ "X$fieldn" = X ]; then
18868         : Just make some guesses.  We check them later.
18869         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18870 else
18871         xxx=`echo '#include <signal.h>' |
18872         $cppstdin $cppminus $cppflags 2>/dev/null |
18873         $grep '^[       ]*#.*include' | 
18874         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18875 fi
18876 : Check this list of files to be sure we have parsed the cpp output ok.
18877 : This will also avoid potentially non-existent files, such 
18878 : as ../foo/bar.h
18879 xxxfiles=''
18880 for xx in $xxx /dev/null ; do
18881         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18882 done
18883 : If we have found no files, at least try signal.h
18884 case "$xxxfiles" in
18885 '')     xxxfiles=`./findhdr signal.h` ;;
18886 esac
18887 xxx=`awk '
18888 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18889         print substr($2, 4, 20)
18890 }
18891 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18892         print substr($3, 4, 20)
18893 }' $xxxfiles`
18894 : Append some common names just in case the awk scan failed.
18895 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18896 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18897 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18898 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18899 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18900
18901 : generate a few handy files for later
18902 $cat > signal.c <<EOCP
18903 #include <sys/types.h>
18904 #include <signal.h>
18905 #$i_stdlib I_STDLIB
18906 #ifdef I_STDLIB
18907 #include <stdlib.h>
18908 #endif
18909 #include <stdio.h>
18910 int main() {
18911
18912 /* Strange style to avoid deeply-nested #if/#else/#endif */
18913 #ifndef NSIG
18914 #  ifdef _NSIG
18915 #    define NSIG (_NSIG)
18916 #  endif
18917 #endif
18918
18919 #ifndef NSIG
18920 #  ifdef SIGMAX
18921 #    define NSIG (SIGMAX+1)
18922 #  endif
18923 #endif
18924
18925 #ifndef NSIG
18926 #  ifdef SIG_MAX
18927 #    define NSIG (SIG_MAX+1)
18928 #  endif
18929 #endif
18930
18931 #ifndef NSIG
18932 #  ifdef MAXSIG
18933 #    define NSIG (MAXSIG+1)
18934 #  endif
18935 #endif
18936
18937 #ifndef NSIG
18938 #  ifdef MAX_SIG
18939 #    define NSIG (MAX_SIG+1)
18940 #  endif
18941 #endif
18942
18943 #ifndef NSIG
18944 #  ifdef SIGARRAYSIZE
18945 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18946 #  endif
18947 #endif
18948
18949 #ifndef NSIG
18950 #  ifdef _sys_nsig
18951 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18952 #  endif
18953 #endif
18954
18955 /* Default to some arbitrary number that's big enough to get most
18956    of the common signals.
18957 */
18958 #ifndef NSIG
18959 #    define NSIG 50
18960 #endif
18961
18962 printf("NSIG %d\n", NSIG);
18963
18964 #ifndef JUST_NSIG
18965
18966 EOCP
18967
18968 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18969 {
18970         printf "#ifdef SIG"; printf $1; printf "\n"
18971         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18972         printf $1; printf ");\n"
18973         printf "#endif\n"
18974 }
18975 END {
18976         printf "#endif /* JUST_NSIG */\n";
18977         printf "exit(0);\n}\n";
18978 }
18979 ' >>signal.c
18980 $cat >signal.awk <<'EOP'
18981 BEGIN { ndups = 0 }
18982 $1 ~ /^NSIG$/ { nsig = $2 }
18983 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
18984     if ($2 > maxsig) { maxsig = $2 }
18985     if (sig_name[$2]) {
18986         dup_name[ndups] = $1
18987         dup_num[ndups] = $2
18988         ndups++ 
18989     }
18990     else {
18991         sig_name[$2] = $1
18992         sig_num[$2] = $2
18993     }
18994 }
18995 END { 
18996     if (nsig == 0) {
18997         nsig = maxsig + 1
18998     }
18999     printf("NSIG %d\n", nsig);
19000     for (n = 1; n < nsig; n++) {
19001         if (sig_name[n]) {
19002             printf("%s %d\n", sig_name[n], sig_num[n])
19003         }
19004         else {
19005             printf("NUM%d %d\n", n, n) 
19006         }
19007     }
19008     for (n = 0; n < ndups; n++) {
19009         printf("%s %d\n", dup_name[n], dup_num[n])
19010     }
19011 }
19012 EOP
19013 $cat >signal_cmd <<EOS
19014 $startsh
19015 if $test -s signal.lst; then
19016     echo "Using your existing signal.lst file"
19017         exit 0
19018 fi
19019 xxx="$xxx"
19020 EOS
19021 $cat >>signal_cmd <<'EOS'
19022
19023 set signal
19024 if eval $compile_ok; then
19025         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19026 else
19027         echo "(I can't seem be able to compile the whole test program)" >&4
19028         echo "(I'll try it in little pieces.)" >&4
19029         set signal -DJUST_NSIG
19030         if eval $compile_ok; then
19031                 $run ./signal$_exe > signal.nsg
19032                 $cat signal.nsg
19033         else
19034                 echo "I can't seem to figure out how many signals you have." >&4
19035                 echo "Guessing 50." >&4
19036                 echo 'NSIG 50' > signal.nsg
19037         fi
19038         : Now look at all the signal names, one at a time.
19039         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19040                 $cat > signal.c <<EOCP
19041 #include <sys/types.h>
19042 #include <signal.h>
19043 #include <stdio.h>
19044 int main() {
19045 printf("$xx %d\n", SIG${xx});
19046 return 0;
19047 }
19048 EOCP
19049                 set signal
19050                 if eval $compile; then
19051                         echo "SIG${xx} found."
19052                         $run ./signal$_exe  >> signal.ls1
19053                 else
19054                         echo "SIG${xx} NOT found."
19055                 fi
19056         done
19057         if $test -s signal.ls1; then
19058                 $cat signal.nsg signal.ls1 |
19059                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19060         fi
19061
19062 fi
19063 if $test -s signal.lst; then
19064         :
19065 else
19066         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19067         echo 'kill -l' >signal
19068         set X `csh -f <signal`
19069         $rm -f signal
19070         shift
19071         case $# in
19072         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19073         esac
19074         echo $@ | $tr ' ' $trnl | \
19075             $awk '{ printf "%s %d\n", $1, ++s; }
19076                   END { printf "NSIG %d\n", ++s }' >signal.lst
19077 fi
19078 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19079 EOS
19080 chmod a+x signal_cmd
19081 $eunicefix signal_cmd
19082
19083 : generate list of signal names
19084 echo " "
19085 case "$sig_name_init" in
19086 '') doinit=yes ;;
19087 *)  case "$sig_num_init" in
19088     ''|*,*) doinit=yes ;;
19089     esac ;;
19090 esac
19091 case "$doinit" in
19092 yes)
19093         echo "Generating a list of signal names and numbers..." >&4
19094         . ./signal_cmd
19095         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19096         sig_name=`$awk 'BEGIN { printf "ZERO " }
19097                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19098         sig_num=`$awk  'BEGIN { printf "0 " }
19099                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19100         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19101                              !/^NSIG/   { printf "\"%s\", ", $1 }
19102                              END        { printf "0\n" }' signal.lst`
19103         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19104                              !/^NSIG/   { printf "%d, ", $2}
19105                              END        { printf "0\n"}' signal.lst`
19106         ;;
19107 esac
19108 echo "The following $sig_count signals are available:"
19109 echo " "
19110 echo $sig_name | $awk \
19111 'BEGIN { linelen = 0 }
19112 {
19113         for (i = 1; i <= NF; i++) {
19114                 name = "SIG" $i " "
19115                 linelen = linelen + length(name)
19116                 if (linelen > 70) {
19117                         printf "\n"
19118                         linelen = length(name)
19119                 }
19120                 printf "%s", name
19121         }
19122         printf "\n"
19123 }'
19124 sig_size=`echo $sig_name | awk '{print NF}'`
19125 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19126
19127 echo " "
19128 case "$sizetype" in
19129 *_t) zzz="$sizetype"    ;;
19130 *)   zzz="filesize"     ;;
19131 esac
19132 echo "Checking the size of $zzz..." >&4 
19133 cat > try.c <<EOCP
19134 #include <sys/types.h>
19135 #include <stdio.h>
19136 #$i_stdlib I_STDLIB
19137 #ifdef I_STDLIB
19138 #include <stdlib.h>
19139 #endif
19140 int main() {
19141     printf("%d\n", (int)sizeof($sizetype));
19142     exit(0);
19143 }
19144 EOCP
19145 set try
19146 if eval $compile_ok; then
19147         yyy=`$run ./try`
19148         case "$yyy" in
19149         '')     sizesize=4
19150                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19151                 ;;
19152         *)      sizesize=$yyy
19153                 echo "Your $zzz size is $sizesize bytes."
19154                 ;;
19155         esac
19156 else
19157         sizesize=4
19158         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19159 fi
19160
19161
19162 : check for socklen_t
19163 echo " "
19164 echo "Checking to see if you have socklen_t..." >&4
19165 $cat >try.c <<EOCP
19166 #include <sys/types.h>
19167 #$d_socket HAS_SOCKET
19168 #ifdef HAS_SOCKET
19169 #include <sys/socket.h>
19170 #endif
19171 int main() { socklen_t x = 16; }
19172 EOCP
19173 set try
19174 if eval $compile; then
19175         val="$define"
19176         echo "You have socklen_t."
19177 else
19178         val="$undef"
19179         echo "You do not have socklen_t."
19180         case "$sizetype" in
19181         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19182         esac
19183 fi
19184 $rm -f try try.*
19185 set d_socklen_t
19186 eval $setvar
19187
19188 : see if this is a socks.h system
19189 set socks.h i_socks
19190 eval $inhdr
19191
19192 : check for type of the size argument to socket calls
19193 case "$d_socket" in
19194 "$define")
19195         $cat <<EOM
19196
19197 Checking to see what type is the last argument of accept().
19198 EOM
19199         yyy=''
19200         case "$d_socklen_t" in
19201         "$define") yyy="$yyy socklen_t"
19202         esac
19203         yyy="$yyy $sizetype int long unsigned"
19204         for xxx in $yyy; do
19205                 case "$socksizetype" in
19206                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19207                         case "$usesocks" in
19208                         "$define")
19209                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19210                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19211                                         socksizetype="$xxx"
19212                                 fi
19213                                 ;;
19214                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19215                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19216                                         socksizetype="$xxx"
19217                                 fi
19218                                 ;;
19219                         esac
19220                         ;;
19221                 esac
19222         done
19223 : In case none of those worked, prompt the user.
19224         case "$socksizetype" in
19225         '')     rp='What is the type for socket address structure sizes?'
19226                 dflt='int'
19227                 . ./myread
19228                 socksizetype=$ans
19229                 ;;
19230         esac
19231         ;;
19232 *)      : no sockets, so pick relatively harmless default
19233         socksizetype='int'
19234         ;;
19235 esac
19236
19237 : see what type is used for signed size_t
19238 set ssize_t ssizetype int stdio.h sys/types.h
19239 eval $typedef
19240 dflt="$ssizetype"
19241 $cat > try.c <<EOM
19242 #include <stdio.h>
19243 #$i_stdlib I_STDLIB
19244 #ifdef I_STDLIB
19245 #include <stdlib.h>
19246 #endif
19247 #include <sys/types.h>
19248 #define Size_t $sizetype
19249 #define SSize_t $dflt
19250 int main()
19251 {
19252         if (sizeof(Size_t) == sizeof(SSize_t))
19253                 printf("$dflt\n");
19254         else if (sizeof(Size_t) == sizeof(int))
19255                 printf("int\n");
19256         else 
19257                 printf("long\n");
19258         exit(0);
19259 }
19260 EOM
19261 echo " "
19262 set try
19263 if eval $compile_ok && $run ./try > /dev/null; then
19264         ssizetype=`$run ./try`
19265         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19266 else
19267         $cat >&4 <<EOM
19268 Help! I can't compile and run the ssize_t test program: please enlighten me!
19269 (This is probably a misconfiguration in your system or libraries, and
19270 you really ought to fix it.  Still, I'll try anyway.)
19271
19272 I need a type that is the same size as $sizetype, but is guaranteed to
19273 be signed.  Common values are ssize_t, int and long.
19274
19275 EOM
19276         rp="What signed type is the same size as $sizetype?"
19277         . ./myread
19278         ssizetype="$ans"
19279 fi
19280 $rm -f try try.*
19281
19282 : see what type of char stdio uses.
19283 echo " "
19284 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19285 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19286         echo "Your stdio uses unsigned chars." >&4
19287         stdchar="unsigned char"
19288 else
19289         echo "Your stdio uses signed chars." >&4
19290         stdchar="char"
19291 fi
19292 $rm -f stdioh
19293
19294
19295
19296 : see what type uids are declared as in the kernel
19297 echo " "
19298 echo "Looking for the type for user ids returned by getuid()."
19299 set uid_t uidtype xxx stdio.h sys/types.h
19300 eval $typedef
19301 case "$uidtype" in
19302 xxx)
19303         xxx=`./findhdr sys/user.h`
19304         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19305         case $1 in
19306         unsigned) dflt="$1 $2" ;;
19307         *) dflt="$1" ;;
19308         esac
19309         ;;
19310 *) dflt="$uidtype";;
19311 esac
19312 case "$uidtype" in
19313 uid_t)  echo "uid_t found." ;;
19314 *)      rp="What is the type for user ids returned by getuid()?"
19315         . ./myread
19316         uidtype="$ans"
19317         ;;
19318 esac
19319
19320 echo " "
19321 case "$uidtype" in
19322 *_t) zzz="$uidtype"     ;;
19323 *)   zzz="uid"          ;;
19324 esac
19325 echo "Checking the size of $zzz..." >&4 
19326 cat > try.c <<EOCP
19327 #include <sys/types.h>
19328 #include <stdio.h>
19329 #$i_stdlib I_STDLIB
19330 #ifdef I_STDLIB
19331 #include <stdlib.h>
19332 #endif
19333 int main() {
19334     printf("%d\n", (int)sizeof($uidtype));
19335     exit(0);
19336 }
19337 EOCP
19338 set try
19339 if eval $compile_ok; then
19340         yyy=`$run ./try`
19341         case "$yyy" in
19342         '')     uidsize=4
19343                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19344                 ;;
19345         *)      uidsize=$yyy
19346                 echo "Your $zzz is $uidsize bytes long."
19347                 ;;
19348         esac
19349 else
19350         uidsize=4
19351         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19352 fi
19353
19354 echo " "
19355 case "$uidtype" in
19356 *_t) zzz="$uidtype"     ;;
19357 *)   zzz="uid"          ;;
19358 esac
19359 echo "Checking the sign of $zzz..." >&4
19360 cat > try.c <<EOCP
19361 #include <sys/types.h>
19362 #include <stdio.h>
19363 int main() {
19364         $uidtype foo = -1;
19365         if (foo < 0)
19366                 printf("-1\n");
19367         else
19368                 printf("1\n");
19369 }
19370 EOCP
19371 set try
19372 if eval $compile; then
19373         yyy=`$run ./try`
19374         case "$yyy" in
19375         '')     uidsign=1
19376                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19377                 ;;
19378         *)      uidsign=$yyy
19379                 case "$uidsign" in
19380                  1) echo "Your $zzz is unsigned." ;;
19381                 -1) echo "Your $zzz is signed."   ;;
19382                 esac
19383                 ;;
19384         esac
19385 else
19386         uidsign=1
19387         echo "(I can't compile the test program--guessing unsigned.)" >&4
19388 fi
19389
19390
19391
19392 echo " "
19393 $echo "Checking the format string to be used for uids..." >&4
19394
19395 case "$uidsign" in
19396 -1)     if $test X"$uidsize" = X"$ivsize"; then
19397                 uidformat="$ivdformat"
19398         else
19399                 if $test X"$uidsize" = X"$longsize"; then
19400                         uidformat='"ld"'
19401                 else
19402                         if $test X"$uidsize" = X"$intsize"; then
19403                                 uidformat='"d"'
19404                         else
19405                                 if $test X"$uidsize" = X"$shortsize"; then
19406                                         uidformat='"hd"'
19407                                 fi
19408                         fi
19409                 fi
19410         fi
19411         ;;
19412 *)      if $test X"$uidsize" = X"$uvsize"; then
19413                 uidformat="$uvuformat"
19414         else
19415                 if $test X"$uidsize" = X"$longsize"; then
19416                         uidformat='"lu"'
19417                 else
19418                         if $test X"$uidsize" = X"$intsize"; then
19419                                 uidformat='"u"'
19420                         else
19421                                 if $test X"$uidsize" = X"$shortsize"; then
19422                                         uidformat='"hu"'
19423                                 fi
19424                         fi
19425                 fi
19426         fi
19427         ;;
19428 esac
19429
19430 : determine compiler compiler
19431 case "$yacc" in
19432 '')
19433         dflt=yacc;;
19434 *)
19435         dflt="$yacc";;
19436 esac
19437 echo " "
19438 comp='yacc'
19439 if $test -f "$byacc$_exe"; then
19440         dflt="$byacc"
19441         comp="byacc or $comp"
19442 fi
19443 if $test -f "$bison$_exe"; then
19444         comp="$comp or bison -y"
19445 fi
19446 rp="Which compiler compiler ($comp) shall I use?"
19447 . ./myread
19448 yacc="$ans"
19449 case "$yacc" in
19450 *bis*)
19451         case "$yacc" in
19452         *-y*) ;;
19453         *)
19454                 yacc="$yacc -y"
19455                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19456                 ;;
19457         esac
19458         ;;
19459 esac
19460
19461 : see if this is a fp.h system
19462 set fp.h i_fp
19463 eval $inhdr
19464
19465 : see if this is a fp_class.h system
19466 set fp_class.h i_fp_class
19467 eval $inhdr
19468
19469 : see if this is a ieeefp.h system
19470 case "$i_ieeefp" in
19471 '' ) set ieeefp.h i_ieeefp
19472      eval $inhdr
19473      ;;
19474 esac
19475
19476 : see if this is a libutil.h system
19477 set libutil.h i_libutil
19478 eval $inhdr
19479
19480 : see if mach cthreads are available
19481 if test "X$usethreads" = "X$define"; then
19482         set mach/cthreads.h i_machcthr
19483         eval $inhdr
19484 else
19485         i_machcthr="$undef"
19486 fi
19487
19488
19489
19490 : see if this is a math.h system
19491 set math.h i_math
19492 eval $inhdr
19493
19494 : see if this is a mntent.h system
19495 set mntent.h i_mntent
19496 eval $inhdr
19497
19498 : see if ndbm.h is available
19499 set ndbm.h t_ndbm
19500 eval $inhdr
19501
19502 case "$t_ndbm" in
19503 $undef)
19504     # Some Linux distributions such as RedHat 7.1 put the
19505     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19506     if $test -f /usr/include/gdbm/ndbm.h; then
19507         echo '<gdbm/ndbm.h> found.'
19508         ccflags="$ccflags -I/usr/include/gdbm"
19509         cppflags="$cppflags -I/usr/include/gdbm"
19510         t_ndbm=$define
19511     fi
19512     ;;
19513 esac
19514
19515 case "$t_ndbm" in
19516 $define)
19517         : see if dbm_open exists
19518         set dbm_open d_dbm_open
19519         eval $inlibc
19520         case "$d_dbm_open" in
19521         $undef)
19522                 t_ndbm="$undef"
19523                 echo "We won't be including <ndbm.h>"
19524                 ;;
19525         esac
19526         ;;
19527 esac
19528 val="$t_ndbm"
19529 set i_ndbm
19530 eval $setvar
19531
19532 : see if net/errno.h is available
19533 val=''
19534 set net/errno.h val
19535 eval $inhdr
19536
19537 : Unfortunately, it causes problems on some systems.  Arrgh.
19538 case "$val" in
19539 $define)
19540         cat > try.c <<'EOM'
19541 #include <stdio.h>
19542 #include <errno.h>
19543 #include <net/errno.h>
19544 int func()
19545 {
19546         return ENOTSOCK;
19547 }
19548 EOM
19549         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19550                 echo "We'll be including <net/errno.h>." >&4
19551         else
19552                 echo "We won't be including <net/errno.h>." >&4
19553                 val="$undef"
19554         fi
19555         $rm -f try.* try
19556         ;;
19557 esac
19558 set i_neterrno
19559 eval $setvar
19560
19561 : see if netinet/tcp.h is available
19562 set netinet/tcp.h i_netinettcp
19563 eval $inhdr
19564
19565 : see if this is a poll.h system
19566 set poll.h i_poll
19567 eval $inhdr
19568
19569 : see if this is a prot.h system
19570 set prot.h i_prot
19571 eval $inhdr
19572
19573 echo " "
19574 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19575 $cat <<'EOSH' > Cppsym.know
19576 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19577 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19578 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19579 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19580 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19581 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19582 bull c cadmus clipper CMU COFF COMPILER_VERSION
19583 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19584 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19585 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19586 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19587 GLIBC GLIBC_MINOR
19588 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19589 H3050R H3050RX hbullx20 hcx host_mips
19590 hp200 hp300 hp700 HP700 hp800 hp9000
19591 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19592 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19593 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19594 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19595 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19596 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19597 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19598 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19599 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19600 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19601 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19602 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19603 MATH_HAS_NO_SIDE_EFFECTS
19604 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19605 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19606 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19607 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19608 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19609 NetBSD news1500 news1700 news1800 news1900 news3700
19610 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19611 ns32016 ns32332 ns32k nsc32000
19612 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19613 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19614 pc532 pdp11 PGC PIC plexus PORTAR posix
19615 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19616 POSIX_C_SOURCE POSIX_SOURCE POWER
19617 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19618 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19619 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19620 sony sony_news sonyrisc sparc sparclite spectrum
19621 stardent stdc STDC_EXT stratos sun sun3 sun386
19622 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19623 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19624 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19625 sysV68 sysV88 Tek4132 Tek4300 titan
19626 TM3200 TM5400 TM5600
19627 tower tower32 tower32_200 tower32_600 tower32_700
19628 tower32_800 tower32_850 tss
19629 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19630 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19631 unix UNIX95 UNIX99 unixpc unos
19632 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19633 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19634 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19635 USGr4 USGr4_2
19636 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19637 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19638 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19639 z8000
19640 EOSH
19641 # Maybe put other stuff here too.
19642 cat <<EOSH >>Cppsym.know
19643 $osname
19644 EOSH
19645 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19646 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19647 $cat Cppsym.know > Cppsym.c
19648 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19649 $rm -f Cppsym.a Cppsym.b Cppsym.c
19650 cat <<EOSH > Cppsym
19651 $startsh
19652 if $test \$# -gt 0; then
19653     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19654     if $test -s Cppsym.got; then
19655         $rm -f Cppsym.got
19656         exit 0
19657     fi
19658     $rm -f Cppsym.got
19659     exit 1
19660 else
19661     $tr " " "$trnl" | ./Cppsym.try
19662     exit 0
19663 fi
19664 EOSH
19665 chmod +x Cppsym
19666 $eunicefix Cppsym
19667 cat <<EOSH > Cppsym.try
19668 $startsh
19669 cat <<'EOCP' > try.c
19670 #include <stdio.h>
19671 int main() {
19672 EOCP
19673 $awk \\
19674 EOSH
19675 cat <<'EOSH' >> Cppsym.try
19676 'length($1) > 0 {
19677     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
19678     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
19679     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
19680     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
19681 }'       >> try.c
19682 echo 'return 0;}' >> try.c
19683 EOSH
19684 cat <<EOSH >> Cppsym.try
19685 ccflags="$ccflags"
19686 case "$osname-$gccversion" in
19687 irix-) ccflags="\$ccflags -woff 1178" ;;
19688 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19689 esac
19690 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19691 EOSH
19692 chmod +x Cppsym.try
19693 $eunicefix Cppsym.try
19694 ./Cppsym < Cppsym.know > Cppsym.true
19695 : now check the C compiler for additional symbols
19696 postprocess_cc_v=''
19697 case "$osname" in
19698 aix) postprocess_cc_v="|$tr , ' '" ;;
19699 esac
19700 $cat >ccsym <<EOS
19701 $startsh
19702 $cat >tmp.c <<EOF
19703 extern int foo;
19704 EOF
19705 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19706 do
19707         case "\$i" in
19708         -D*) echo "\$i" | $sed 's/^-D//';;
19709         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19710         esac
19711 done
19712 $rm -f try.c
19713 EOS
19714 postprocess_cc_v=''
19715 chmod +x ccsym
19716 $eunicefix ccsym
19717 ./ccsym > ccsym1.raw
19718 if $test -s ccsym1.raw; then
19719        $sort ccsym1.raw | $uniq >ccsym.raw
19720 else
19721        mv ccsym1.raw ccsym.raw
19722 fi
19723
19724 $awk '/\=/ { print $0; next }
19725         { print $0"=1" }' ccsym.raw >ccsym.list
19726 $awk '/\=/ { print $0; next }
19727         { print $0"=1" }' Cppsym.true >ccsym.true
19728 $comm -13 ccsym.true ccsym.list >ccsym.own
19729 $comm -12 ccsym.true ccsym.list >ccsym.com
19730 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19731 also=''
19732 if $test -z ccsym.raw; then
19733         echo "Your C compiler doesn't seem to define any symbols!" >&4
19734         echo " "
19735         echo "However, your C preprocessor defines the following symbols:"
19736         $cat Cppsym.true
19737         ccsymbols=''
19738         cppsymbols=`$cat Cppsym.true`
19739         cppsymbols=`echo $cppsymbols`
19740         cppccsymbols="$cppsymbols"
19741 else
19742         if $test -s ccsym.com; then
19743                 echo "Your C compiler and pre-processor define these symbols:"
19744                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19745                 also='also '
19746                 symbols='ones'
19747                 cppccsymbols=`$cat ccsym.com`
19748                 cppccsymbols=`echo $cppccsymbols`
19749                 $test "$silent" || sleep 1
19750         fi
19751         if $test -s ccsym.cpp; then
19752                 $test "$also" && echo " "
19753                 echo "Your C pre-processor ${also}defines the following symbols:"
19754                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19755                 also='further '
19756                 cppsymbols=`$cat ccsym.cpp`
19757                 cppsymbols=`echo $cppsymbols`
19758                 $test "$silent" || sleep 1
19759         fi
19760         if $test -s ccsym.own; then
19761                 $test "$also" && echo " "
19762                 echo "Your C compiler ${also}defines the following cpp symbols:"
19763                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19764                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19765                 ccsymbols=`$cat ccsym.own`
19766                 ccsymbols=`echo $ccsymbols`
19767                 $test "$silent" || sleep 1
19768         fi
19769 fi
19770
19771 : see if this is a termio system
19772 val="$undef"
19773 val2="$undef"
19774 val3="$undef"
19775 if $test `./findhdr termios.h`; then
19776         set tcsetattr i_termios
19777         eval $inlibc
19778         val3="$i_termios"
19779 fi
19780 echo " "
19781 case "$val3" in
19782 "$define") echo "You have POSIX termios.h... good!" >&4;;
19783 *) if ./Cppsym pyr; then
19784                 case "`/bin/universe`" in
19785                 ucb) if $test `./findhdr sgtty.h`; then
19786                                 val2="$define"
19787                                 echo "<sgtty.h> found." >&4
19788                         else
19789                                 echo "System is pyramid with BSD universe."
19790                                 echo "<sgtty.h> not found--you could have problems." >&4
19791                         fi;;
19792                 *) if $test `./findhdr termio.h`; then
19793                                 val="$define"
19794                                 echo "<termio.h> found." >&4
19795                         else
19796                                 echo "System is pyramid with USG universe."
19797                                 echo "<termio.h> not found--you could have problems." >&4
19798                         fi;;
19799                 esac
19800         elif ./usg; then
19801                 if $test `./findhdr termio.h`; then
19802                         echo "<termio.h> found." >&4
19803                         val="$define"
19804                 elif $test `./findhdr sgtty.h`; then
19805                         echo "<sgtty.h> found." >&4
19806                         val2="$define"
19807                 else
19808 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19809                 fi
19810         else
19811                 if $test `./findhdr sgtty.h`; then
19812                         echo "<sgtty.h> found." >&4
19813                         val2="$define"
19814                 elif $test `./findhdr termio.h`; then
19815                         echo "<termio.h> found." >&4
19816                         val="$define"
19817                 else
19818 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19819                 fi
19820         fi;;
19821 esac
19822 set i_termio; eval $setvar
19823 val=$val2; set i_sgtty; eval $setvar
19824 val=$val3; set i_termios; eval $setvar
19825
19826 : see if stddef is available
19827 set stddef.h i_stddef
19828 eval $inhdr
19829
19830 : see if this is a sunmath.h system
19831 set sunmath.h i_sunmath
19832 eval $inhdr
19833
19834 : see if sys/access.h is available
19835 set sys/access.h i_sysaccess
19836 eval $inhdr
19837
19838 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19839 set sys/filio.h i_sysfilio
19840 eval $inhdr
19841 echo " "
19842 if $test `./findhdr sys/ioctl.h`; then
19843         val="$define"
19844         echo '<sys/ioctl.h> found.' >&4
19845 else
19846         val="$undef"
19847         if $test $i_sysfilio = "$define"; then
19848             echo '<sys/ioctl.h> NOT found.' >&4
19849         else
19850                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19851                 $test $i_termio = "$define" && xxx="termio.h"
19852                 $test $i_termios = "$define" && xxx="termios.h"
19853 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19854         fi
19855 fi
19856 set i_sysioctl
19857 eval $setvar
19858
19859 : see if socket ioctl defs are in sys/sockio.h
19860 echo " "
19861 xxx=`./findhdr sys/sockio.h`
19862 if $test "$xxx"; then
19863         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19864                 val="$define"
19865                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19866         else
19867                 val="$undef"
19868                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19869         fi
19870 else
19871         val="$undef"
19872         $cat <<EOM
19873 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19874 EOM
19875 fi
19876 set i_syssockio
19877 eval $setvar
19878
19879
19880 : see if this is a syslog.h system
19881 set syslog.h i_syslog
19882 eval $inhdr
19883
19884
19885 : see if this is a sys/mode.h system
19886 set sys/mode.h i_sysmode
19887 eval $inhdr
19888
19889 : see if sys/resource.h has to be included
19890 set sys/resource.h i_sysresrc
19891 eval $inhdr
19892
19893 : see if sys/security.h is available
19894 set sys/security.h i_syssecrt
19895 eval $inhdr
19896
19897 : see if this is a sys/statvfs.h system
19898 set sys/statvfs.h i_sysstatvfs
19899 eval $inhdr
19900
19901 : see if this is a sys/un.h system
19902 set sys/un.h i_sysun
19903 eval $inhdr
19904
19905
19906 : see if this is a sys/utsname.h system
19907 set sys/utsname.h i_sysutsname
19908 eval $inhdr
19909
19910 : see if this is a syswait system
19911 set sys/wait.h i_syswait
19912 eval $inhdr
19913
19914 : see if this is a ustat.h system
19915 set ustat.h i_ustat
19916 eval $inhdr
19917
19918 : see if this is an utime system
19919 set utime.h i_utime
19920 eval $inhdr
19921
19922 : see if this is a values.h system
19923 set values.h i_values
19924 eval $inhdr
19925
19926 : see if this is a vfork system
19927 case "$d_vfork" in
19928 "$define")
19929         set vfork.h i_vfork
19930         eval $inhdr
19931         ;;
19932 *)
19933         i_vfork="$undef"
19934         ;;
19935 esac
19936
19937 : see if gdbm.h is available
19938 set gdbm.h t_gdbm
19939 eval $inhdr
19940 case "$t_gdbm" in
19941 $define)
19942         : see if gdbm_open exists
19943         set gdbm_open d_gdbm_open
19944         eval $inlibc
19945         case "$d_gdbm_open" in
19946         $undef)
19947                 t_gdbm="$undef"
19948                 echo "We won't be including <gdbm.h>"
19949                 ;;
19950         esac
19951         ;;
19952 esac
19953 val="$t_gdbm"
19954 set i_gdbm
19955 eval $setvar
19956
19957 echo " "
19958 echo "Looking for extensions..." >&4
19959 : If we are using the old config.sh, known_extensions may contain
19960 : old or inaccurate or duplicate values.
19961 known_extensions=''
19962 nonxs_extensions=''
19963 : We do not use find because it might not be available.
19964 : We do not just use MANIFEST because the user may have dropped
19965 : some additional extensions into the source tree and expect them
19966 : to be built.
19967
19968 : Function to recursively find available extensions, ignoring DynaLoader
19969 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19970 find_extensions='
19971     for xxx in *; do
19972        case "$xxx" in
19973            DynaLoader|dynaload) ;;
19974            *)
19975            if $test -f $xxx/$xxx.xs; then
19976                known_extensions="$known_extensions $1$xxx";
19977            elif $test -f $xxx/Makefile.PL; then
19978                nonxs_extensions="$nonxs_extensions $1$xxx";
19979            else
19980                if $test -d $xxx -a $# -lt 10; then
19981                    set $1$xxx/ $*;
19982                    cd "$xxx";
19983                    eval $find_extensions;
19984                    cd ..;
19985                    shift;
19986                fi;
19987            fi
19988            ;;
19989        esac;
19990     done'
19991 tdir=`pwd`
19992 cd "$rsrc/ext"
19993 set X
19994 shift
19995 eval $find_extensions
19996 # Special case:  Add in threads/shared since it is not picked up by the
19997 # recursive find above (and adding in general recursive finding breaks
19998 # SDBM_File/sdbm).  A.D.  10/25/2001.
19999 known_extensions="$known_extensions threads/shared"
20000 set X $nonxs_extensions
20001 shift
20002 nonxs_extensions="$*"
20003 set X $known_extensions
20004 shift
20005 known_extensions="$*"
20006 cd "$tdir"
20007
20008 : Now see which are supported on this system.
20009 avail_ext=''
20010 for xxx in $known_extensions ; do
20011         case "$xxx" in
20012         DB_File|db_file)
20013                 case "$i_db" in
20014                 $define) avail_ext="$avail_ext $xxx" ;;
20015                 esac
20016                 ;;
20017         GDBM_File|gdbm_fil)
20018                 case "$i_gdbm" in 
20019                 $define) avail_ext="$avail_ext $xxx" ;;
20020                 esac
20021                 ;;
20022         I18N/Langinfo|i18n_lan)
20023                 case "$i_langinfo$d_nl_langinfo" in 
20024                 $define$define) avail_ext="$avail_ext $xxx" ;;
20025                 esac
20026                 ;;
20027         NDBM_File|ndbm_fil)
20028                 case "$i_ndbm" in
20029                 $define)
20030                     case "$osname-$use64bitint" in
20031                     hpux-define)
20032                         case "$libs" in
20033                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20034                         esac
20035                         ;;
20036                     *) avail_ext="$avail_ext $xxx" ;;
20037                     esac
20038                     ;;
20039                 esac
20040                 ;;
20041         ODBM_File|odbm_fil) 
20042                 case "${i_dbm}${i_rpcsvcdbm}" in
20043                 *"${define}"*)
20044                     case "$osname-$use64bitint" in
20045                     hpux-define)
20046                         case "$libs" in
20047                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20048                         esac
20049                         ;;
20050                     *) avail_ext="$avail_ext $xxx" ;;
20051                     esac
20052                     ;;
20053                 esac
20054                 ;;
20055         POSIX|posix)
20056                 case "$useposix" in
20057                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20058                 esac
20059                 ;;
20060         Opcode|opcode)
20061                 case "$useopcode" in
20062                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20063                 esac
20064                 ;;
20065         Socket|socket)
20066                 case "$d_socket" in 
20067                 true|$define|y)
20068                     case "$osname" in
20069                     beos) ;; # not unless BONE
20070                     *) avail_ext="$avail_ext $xxx" ;;
20071                     esac
20072                     ;;
20073                 esac
20074                 ;;
20075         Sys/Syslog|sys/syslog)
20076                 : XXX syslog requires socket
20077                 case "$d_socket" in 
20078                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20079                 esac
20080                 ;;
20081         Thread|thread)
20082                 case "$usethreads" in
20083                 true|$define|y)
20084                         case "$useithreads" in
20085                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20086                         esac
20087                 esac
20088                 ;;
20089         XS/APItest|xs/apitest)
20090                 # This is just for testing.  Skip it unless we have dynamic loading.
20091
20092                 case "$usedl" in
20093                 $define) avail_ext="$avail_ext $xxx" ;;
20094                 esac
20095                 ;;
20096         XS/Typemap|xs/typemap)
20097                 # This is just for testing.  Skip it unless we have dynamic loading.
20098                 case "$usedl" in
20099                 $define) avail_ext="$avail_ext $xxx" ;;
20100                 esac
20101                 ;;
20102         threads|threads/shared)
20103                 # threads and threads::shared are special cases.
20104                 # To stop people from asking "Perl 5.8.0 was supposed
20105                 # to have this new fancy threads implementation but my
20106                 # perl doesn't have it" and from people trying to
20107                 # (re)install the threads module using CPAN.pm and
20108                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20109                 # the threads.pm and threads/shared.pm will always be
20110                 # there, croaking informatively ("you need to rebuild
20111                 # all of Perl with threads, sorry") when threads haven't
20112                 # been compiled in.
20113                 # --jhi
20114                 avail_ext="$avail_ext $xxx"
20115                 ;;
20116         IPC/SysV|ipc/sysv)
20117                 : XXX Do we need a useipcsysv variable here
20118                 case "${d_msg}${d_sem}${d_shm}" in 
20119                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20120                 esac
20121                 ;;
20122         *)      avail_ext="$avail_ext $xxx"
20123                 ;;
20124         esac
20125 done
20126
20127 set X $avail_ext
20128 shift
20129 avail_ext="$*"
20130
20131 case "$onlyextensions" in
20132 '') ;;
20133 *)  keepextensions=''
20134     echo "You have requested that only certains extensions be included..." >&4
20135     for i in $onlyextensions; do
20136         case " $avail_ext " in
20137         *" $i "*)
20138             echo "Keeping extension $i."
20139             keepextensions="$keepextensions $i"
20140             ;;
20141         *) echo "Ignoring extension $i." ;;
20142         esac
20143     done
20144     avail_ext="$keepextensions"
20145     ;;
20146 esac
20147
20148 case "$noextensions" in
20149 '') ;;
20150 *)  keepextensions=''
20151     echo "You have requested that certain extensions be ignored..." >&4
20152     for i in $avail_ext; do
20153         case " $noextensions " in
20154         *" $i "*) echo "Ignoring extension $i." ;;
20155         *) echo "Keeping extension $i.";
20156            keepextensions="$keepextensions $i"
20157            ;;
20158         esac
20159     done
20160     avail_ext="$keepextensions"
20161     ;;
20162 esac
20163
20164 : Now see which nonxs extensions are supported on this system.
20165 : For now assume all are.
20166 nonxs_ext=''
20167 for xxx in $nonxs_extensions ; do
20168         case "$xxx" in
20169         *)      nonxs_ext="$nonxs_ext $xxx"
20170                 ;;
20171         esac
20172 done
20173
20174 set X $nonxs_ext
20175 shift
20176 nonxs_ext="$*"
20177
20178 case $usedl in
20179 $define)
20180         $cat <<EOM
20181 A number of extensions are supplied with $package.  You may choose to
20182 compile these extensions for dynamic loading (the default), compile
20183 them into the $package executable (static loading), or not include
20184 them at all.  Answer "none" to include no extensions.
20185 Note that DynaLoader is always built and need not be mentioned here.
20186
20187 EOM
20188         case "$dynamic_ext" in
20189         '')
20190                 : Exclude those listed in static_ext
20191                 dflt=''
20192                 for xxx in $avail_ext; do
20193                         case " $static_ext " in
20194                         *" $xxx "*) ;;
20195                         *) dflt="$dflt $xxx" ;;
20196                         esac
20197                 done
20198                 set X $dflt
20199                 shift
20200                 dflt="$*"
20201                 ;;
20202         *)      dflt="$dynamic_ext"
20203                 # Perhaps we are reusing an old out-of-date config.sh.
20204                 case "$hint" in
20205                 previous)
20206                         if test X"$dynamic_ext" != X"$avail_ext"; then
20207                                 $cat <<EOM
20208 NOTICE:  Your previous config.sh list may be incorrect. 
20209 The extensions now available to you are 
20210         ${avail_ext}
20211 but the default list from your previous config.sh is
20212         ${dynamic_ext} 
20213
20214 EOM
20215                         fi
20216                         ;;
20217                 esac
20218                 ;;
20219         esac
20220         case "$dflt" in
20221         '')     dflt=none;;
20222         esac
20223         rp="What extensions do you wish to load dynamically?"
20224         . ./myread
20225         case "$ans" in
20226         none) dynamic_ext=' ' ;;
20227         *) dynamic_ext="$ans" ;;
20228         esac
20229
20230         case "$static_ext" in
20231         '')
20232                 : Exclude those already listed in dynamic linking
20233                 dflt=''
20234                 for xxx in $avail_ext; do
20235                         case " $dynamic_ext " in
20236                         *" $xxx "*) ;;
20237                         *) dflt="$dflt $xxx" ;;
20238                         esac
20239                 done
20240                 set X $dflt
20241                 shift
20242                 dflt="$*"
20243                 ;;
20244         *)  dflt="$static_ext" 
20245                 ;;
20246         esac
20247
20248         case "$dflt" in
20249         '')     dflt=none;;
20250         esac
20251         rp="What extensions do you wish to load statically?"
20252         . ./myread
20253         case "$ans" in
20254         none) static_ext=' ' ;;
20255         *) static_ext="$ans" ;;
20256         esac
20257         ;;
20258 *)
20259         $cat <<EOM
20260 A number of extensions are supplied with $package.  Answer "none" 
20261 to include no extensions. 
20262 Note that DynaLoader is always built and need not be mentioned here.
20263
20264 EOM
20265         case "$static_ext" in
20266         '') dflt="$avail_ext" ;;
20267         *)      dflt="$static_ext"
20268                 # Perhaps we are reusing an old out-of-date config.sh.
20269                 case "$hint" in
20270                 previous)
20271                         if test X"$static_ext" != X"$avail_ext"; then
20272                                 $cat <<EOM
20273 NOTICE:  Your previous config.sh list may be incorrect. 
20274 The extensions now available to you are 
20275         ${avail_ext}
20276 but the default list from your previous config.sh is
20277         ${static_ext} 
20278
20279 EOM
20280                         fi
20281                         ;;
20282                 esac
20283                 ;;
20284         esac
20285         : Exclude those that are not xs extensions
20286         case "$dflt" in
20287         '')     dflt=none;;
20288         esac
20289         rp="What extensions do you wish to include?"
20290         . ./myread
20291         case "$ans" in
20292         none) static_ext=' ' ;;
20293         *) static_ext="$ans" ;;
20294         esac
20295         ;;
20296 esac
20297 #        
20298 # Encode is a special case.  If we are building Encode as a static
20299 # extension, we need to explicitly list its subextensions as well.
20300 # For other nested extensions, this is handled automatically by
20301 # the appropriate Makefile.PL.
20302 case " $static_ext " in
20303         *" Encode "*) # Add the subextensions of Encode
20304         cd "$rsrc/ext"
20305         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20306                 static_ext="$static_ext Encode/$xxx"
20307         done
20308         cd "$tdir"
20309         ;;
20310 esac
20311
20312 set X $dynamic_ext $static_ext $nonxs_ext
20313 shift
20314 extensions="$*"
20315
20316 # Sanity check:  We require an extension suitable for use with
20317 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20318 # should show up as failures in the test suite, but it's helpful to
20319 # catch them now.) The 'extensions' list is normally sorted
20320 # alphabetically, so we need to accept either
20321 #    DB_File ... Fcntl ... IO  ....
20322 # or something like
20323 #    Fcntl ... NDBM_File ... IO  ....
20324 case " $extensions"  in
20325 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20326 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20327 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20328 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20329    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20330    ;;
20331 esac
20332
20333 : Remove libraries needed only for extensions
20334 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20335 : The exception is SunOS 4.x, which needs them.
20336 case "${osname}X${osvers}" in
20337 sunos*X4*)
20338     perllibs="$libs"
20339     ;;
20340 *) case "$usedl" in
20341     $define|true|[yY]*)
20342             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20343             shift
20344             perllibs="$*"
20345             ;;
20346     *)  perllibs="$libs"
20347             ;;
20348     esac
20349     ;;
20350 esac
20351
20352 : Remove build directory name from cppstdin so it can be used from
20353 : either the present location or the final installed location.
20354 echo " "
20355 : Get out of the UU directory to get correct path name.
20356 cd ..
20357 case "$cppstdin" in
20358 `pwd`/cppstdin)
20359         echo "Stripping down cppstdin path name"
20360         cppstdin=cppstdin
20361         ;;
20362 esac
20363 cd UU
20364
20365 : end of configuration questions
20366 echo " "
20367 echo "End of configuration questions."
20368 echo " "
20369
20370 : back to where it started
20371 if test -d ../UU; then
20372         cd ..
20373 fi
20374
20375 : configuration may be patched via a 'config.arch' file
20376 if $test -f config.arch; then
20377         echo "I see a config.arch file, loading it."
20378         . ./config.arch
20379 fi
20380
20381 : configuration may be patched via a 'config.over' file
20382 if $test -f config.over; then
20383         echo " "
20384         dflt=y
20385         rp='I see a config.over file.  Do you wish to load it?'
20386         . UU/myread
20387         case "$ans" in
20388         n*) echo "OK, I'll ignore it.";;
20389         *)      . ./config.over
20390                 echo "Configuration override changes have been loaded."
20391                 ;;
20392         esac
20393 fi
20394
20395 : in case they want portability, strip down executable paths
20396 case "$d_portable" in
20397 "$define")
20398         echo " "
20399         echo "Stripping down executable paths..." >&4
20400         for file in $loclist $trylist; do
20401                 eval temp=\$$file
20402                 eval $file=`basename $temp`
20403         done
20404         ;;
20405 esac
20406
20407 : create config.sh file
20408 echo " "
20409 echo "Creating config.sh..." >&4
20410 $spitshell <<EOT >config.sh
20411 $startsh
20412 #
20413 # This file was produced by running the Configure script. It holds all the
20414 # definitions figured out by Configure. Should you modify one of these values,
20415 # do not forget to propagate your changes by running "Configure -der". You may
20416 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20417 #
20418
20419 # Package name      : $package
20420 # Source directory  : $src
20421 # Configuration time: $cf_time
20422 # Configured by     : $cf_by
20423 # Target system     : $myuname
20424
20425 Author='$Author'
20426 Date='$Date'
20427 Header='$Header'
20428 Id='$Id'
20429 Locker='$Locker'
20430 Log='$Log'
20431 Mcc='$Mcc'
20432 RCSfile='$RCSfile'
20433 Revision='$Revision'
20434 Source='$Source'
20435 State='$State'
20436 _a='$_a'
20437 _exe='$_exe'
20438 _o='$_o'
20439 afs='$afs'
20440 afsroot='$afsroot'
20441 alignbytes='$alignbytes'
20442 ansi2knr='$ansi2knr'
20443 aphostname='$aphostname'
20444 api_revision='$api_revision'
20445 api_subversion='$api_subversion'
20446 api_version='$api_version'
20447 api_versionstring='$api_versionstring'
20448 ar='$ar'
20449 archlib='$archlib'
20450 archlibexp='$archlibexp'
20451 archname64='$archname64'
20452 archname='$archname'
20453 archobjs='$archobjs'
20454 asctime_r_proto='$asctime_r_proto'
20455 awk='$awk'
20456 baserev='$baserev'
20457 bash='$bash'
20458 bin='$bin'
20459 binexp='$binexp'
20460 bison='$bison'
20461 byacc='$byacc'
20462 byteorder='$byteorder'
20463 c='$c'
20464 castflags='$castflags'
20465 cat='$cat'
20466 cc='$cc'
20467 cccdlflags='$cccdlflags'
20468 ccdlflags='$ccdlflags'
20469 ccflags='$ccflags'
20470 ccflags_uselargefiles='$ccflags_uselargefiles'
20471 ccname='$ccname'
20472 ccsymbols='$ccsymbols'
20473 ccversion='$ccversion'
20474 cf_by='$cf_by'
20475 cf_email='$cf_email'
20476 cf_time='$cf_time'
20477 charsize='$charsize'
20478 chgrp='$chgrp'
20479 chmod='$chmod'
20480 chown='$chown'
20481 clocktype='$clocktype'
20482 comm='$comm'
20483 compress='$compress'
20484 contains='$contains'
20485 cp='$cp'
20486 cpio='$cpio'
20487 cpp='$cpp'
20488 cpp_stuff='$cpp_stuff'
20489 cppccsymbols='$cppccsymbols'
20490 cppflags='$cppflags'
20491 cpplast='$cpplast'
20492 cppminus='$cppminus'
20493 cpprun='$cpprun'
20494 cppstdin='$cppstdin'
20495 cppsymbols='$cppsymbols'
20496 crypt_r_proto='$crypt_r_proto'
20497 cryptlib='$cryptlib'
20498 csh='$csh'
20499 ctermid_r_proto='$ctermid_r_proto'
20500 ctime_r_proto='$ctime_r_proto'
20501 d_Gconvert='$d_Gconvert'
20502 d_PRIEUldbl='$d_PRIEUldbl'
20503 d_PRIFUldbl='$d_PRIFUldbl'
20504 d_PRIGUldbl='$d_PRIGUldbl'
20505 d_PRIXU64='$d_PRIXU64'
20506 d_PRId64='$d_PRId64'
20507 d_PRIeldbl='$d_PRIeldbl'
20508 d_PRIfldbl='$d_PRIfldbl'
20509 d_PRIgldbl='$d_PRIgldbl'
20510 d_PRIi64='$d_PRIi64'
20511 d_PRIo64='$d_PRIo64'
20512 d_PRIu64='$d_PRIu64'
20513 d_PRIx64='$d_PRIx64'
20514 d_SCNfldbl='$d_SCNfldbl'
20515 d__fwalk='$d__fwalk'
20516 d_access='$d_access'
20517 d_accessx='$d_accessx'
20518 d_aintl='$d_aintl'
20519 d_alarm='$d_alarm'
20520 d_archlib='$d_archlib'
20521 d_asctime_r='$d_asctime_r'
20522 d_atolf='$d_atolf'
20523 d_atoll='$d_atoll'
20524 d_attribut='$d_attribut'
20525 d_bcmp='$d_bcmp'
20526 d_bcopy='$d_bcopy'
20527 d_bsd='$d_bsd'
20528 d_bsdgetpgrp='$d_bsdgetpgrp'
20529 d_bsdsetpgrp='$d_bsdsetpgrp'
20530 d_bzero='$d_bzero'
20531 d_casti32='$d_casti32'
20532 d_castneg='$d_castneg'
20533 d_charvspr='$d_charvspr'
20534 d_chown='$d_chown'
20535 d_chroot='$d_chroot'
20536 d_chsize='$d_chsize'
20537 d_class='$d_class'
20538 d_closedir='$d_closedir'
20539 d_cmsghdr_s='$d_cmsghdr_s'
20540 d_const='$d_const'
20541 d_copysignl='$d_copysignl'
20542 d_crypt='$d_crypt'
20543 d_crypt_r='$d_crypt_r'
20544 d_csh='$d_csh'
20545 d_ctermid_r='$d_ctermid_r'
20546 d_ctime_r='$d_ctime_r'
20547 d_cuserid='$d_cuserid'
20548 d_dbl_dig='$d_dbl_dig'
20549 d_dbminitproto='$d_dbminitproto'
20550 d_difftime='$d_difftime'
20551 d_dirfd='$d_dirfd'
20552 d_dirnamlen='$d_dirnamlen'
20553 d_dlerror='$d_dlerror'
20554 d_dlopen='$d_dlopen'
20555 d_dlsymun='$d_dlsymun'
20556 d_dosuid='$d_dosuid'
20557 d_drand48_r='$d_drand48_r'
20558 d_drand48proto='$d_drand48proto'
20559 d_dup2='$d_dup2'
20560 d_eaccess='$d_eaccess'
20561 d_endgrent='$d_endgrent'
20562 d_endgrent_r='$d_endgrent_r'
20563 d_endhent='$d_endhent'
20564 d_endhostent_r='$d_endhostent_r'
20565 d_endnent='$d_endnent'
20566 d_endnetent_r='$d_endnetent_r'
20567 d_endpent='$d_endpent'
20568 d_endprotoent_r='$d_endprotoent_r'
20569 d_endpwent='$d_endpwent'
20570 d_endpwent_r='$d_endpwent_r'
20571 d_endsent='$d_endsent'
20572 d_endservent_r='$d_endservent_r'
20573 d_eofnblk='$d_eofnblk'
20574 d_eunice='$d_eunice'
20575 d_faststdio='$d_faststdio'
20576 d_fchdir='$d_fchdir'
20577 d_fchmod='$d_fchmod'
20578 d_fchown='$d_fchown'
20579 d_fcntl='$d_fcntl'
20580 d_fcntl_can_lock='$d_fcntl_can_lock'
20581 d_fd_macros='$d_fd_macros'
20582 d_fd_set='$d_fd_set'
20583 d_fds_bits='$d_fds_bits'
20584 d_fgetpos='$d_fgetpos'
20585 d_finite='$d_finite'
20586 d_finitel='$d_finitel'
20587 d_flexfnam='$d_flexfnam'
20588 d_flock='$d_flock'
20589 d_flockproto='$d_flockproto'
20590 d_fork='$d_fork'
20591 d_fp_class='$d_fp_class'
20592 d_fpathconf='$d_fpathconf'
20593 d_fpclass='$d_fpclass'
20594 d_fpclassify='$d_fpclassify'
20595 d_fpclassl='$d_fpclassl'
20596 d_fpos64_t='$d_fpos64_t'
20597 d_frexpl='$d_frexpl'
20598 d_fs_data_s='$d_fs_data_s'
20599 d_fseeko='$d_fseeko'
20600 d_fsetpos='$d_fsetpos'
20601 d_fstatfs='$d_fstatfs'
20602 d_fstatvfs='$d_fstatvfs'
20603 d_fsync='$d_fsync'
20604 d_ftello='$d_ftello'
20605 d_ftime='$d_ftime'
20606 d_getcwd='$d_getcwd'
20607 d_getespwnam='$d_getespwnam'
20608 d_getfsstat='$d_getfsstat'
20609 d_getgrent='$d_getgrent'
20610 d_getgrent_r='$d_getgrent_r'
20611 d_getgrgid_r='$d_getgrgid_r'
20612 d_getgrnam_r='$d_getgrnam_r'
20613 d_getgrps='$d_getgrps'
20614 d_gethbyaddr='$d_gethbyaddr'
20615 d_gethbyname='$d_gethbyname'
20616 d_gethent='$d_gethent'
20617 d_gethname='$d_gethname'
20618 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20619 d_gethostbyname_r='$d_gethostbyname_r'
20620 d_gethostent_r='$d_gethostent_r'
20621 d_gethostprotos='$d_gethostprotos'
20622 d_getitimer='$d_getitimer'
20623 d_getlogin='$d_getlogin'
20624 d_getlogin_r='$d_getlogin_r'
20625 d_getmnt='$d_getmnt'
20626 d_getmntent='$d_getmntent'
20627 d_getnbyaddr='$d_getnbyaddr'
20628 d_getnbyname='$d_getnbyname'
20629 d_getnent='$d_getnent'
20630 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20631 d_getnetbyname_r='$d_getnetbyname_r'
20632 d_getnetent_r='$d_getnetent_r'
20633 d_getnetprotos='$d_getnetprotos'
20634 d_getpagsz='$d_getpagsz'
20635 d_getpbyname='$d_getpbyname'
20636 d_getpbynumber='$d_getpbynumber'
20637 d_getpent='$d_getpent'
20638 d_getpgid='$d_getpgid'
20639 d_getpgrp2='$d_getpgrp2'
20640 d_getpgrp='$d_getpgrp'
20641 d_getppid='$d_getppid'
20642 d_getprior='$d_getprior'
20643 d_getprotobyname_r='$d_getprotobyname_r'
20644 d_getprotobynumber_r='$d_getprotobynumber_r'
20645 d_getprotoent_r='$d_getprotoent_r'
20646 d_getprotoprotos='$d_getprotoprotos'
20647 d_getprpwnam='$d_getprpwnam'
20648 d_getpwent='$d_getpwent'
20649 d_getpwent_r='$d_getpwent_r'
20650 d_getpwnam_r='$d_getpwnam_r'
20651 d_getpwuid_r='$d_getpwuid_r'
20652 d_getsbyname='$d_getsbyname'
20653 d_getsbyport='$d_getsbyport'
20654 d_getsent='$d_getsent'
20655 d_getservbyname_r='$d_getservbyname_r'
20656 d_getservbyport_r='$d_getservbyport_r'
20657 d_getservent_r='$d_getservent_r'
20658 d_getservprotos='$d_getservprotos'
20659 d_getspnam='$d_getspnam'
20660 d_getspnam_r='$d_getspnam_r'
20661 d_gettimeod='$d_gettimeod'
20662 d_gmtime_r='$d_gmtime_r'
20663 d_gnulibc='$d_gnulibc'
20664 d_grpasswd='$d_grpasswd'
20665 d_hasmntopt='$d_hasmntopt'
20666 d_htonl='$d_htonl'
20667 d_ilogbl='$d_ilogbl'
20668 d_index='$d_index'
20669 d_inetaton='$d_inetaton'
20670 d_int64_t='$d_int64_t'
20671 d_isascii='$d_isascii'
20672 d_isfinite='$d_isfinite'
20673 d_isinf='$d_isinf'
20674 d_isnan='$d_isnan'
20675 d_isnanl='$d_isnanl'
20676 d_killpg='$d_killpg'
20677 d_lchown='$d_lchown'
20678 d_ldbl_dig='$d_ldbl_dig'
20679 d_link='$d_link'
20680 d_localtime_r='$d_localtime_r'
20681 d_locconv='$d_locconv'
20682 d_lockf='$d_lockf'
20683 d_longdbl='$d_longdbl'
20684 d_longlong='$d_longlong'
20685 d_lseekproto='$d_lseekproto'
20686 d_lstat='$d_lstat'
20687 d_madvise='$d_madvise'
20688 d_mblen='$d_mblen'
20689 d_mbstowcs='$d_mbstowcs'
20690 d_mbtowc='$d_mbtowc'
20691 d_memchr='$d_memchr'
20692 d_memcmp='$d_memcmp'
20693 d_memcpy='$d_memcpy'
20694 d_memmove='$d_memmove'
20695 d_memset='$d_memset'
20696 d_mkdir='$d_mkdir'
20697 d_mkdtemp='$d_mkdtemp'
20698 d_mkfifo='$d_mkfifo'
20699 d_mkstemp='$d_mkstemp'
20700 d_mkstemps='$d_mkstemps'
20701 d_mktime='$d_mktime'
20702 d_mmap='$d_mmap'
20703 d_modfl='$d_modfl'
20704 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20705 d_modflproto='$d_modflproto'
20706 d_mprotect='$d_mprotect'
20707 d_msg='$d_msg'
20708 d_msg_ctrunc='$d_msg_ctrunc'
20709 d_msg_dontroute='$d_msg_dontroute'
20710 d_msg_oob='$d_msg_oob'
20711 d_msg_peek='$d_msg_peek'
20712 d_msg_proxy='$d_msg_proxy'
20713 d_msgctl='$d_msgctl'
20714 d_msgget='$d_msgget'
20715 d_msghdr_s='$d_msghdr_s'
20716 d_msgrcv='$d_msgrcv'
20717 d_msgsnd='$d_msgsnd'
20718 d_msync='$d_msync'
20719 d_munmap='$d_munmap'
20720 d_mymalloc='$d_mymalloc'
20721 d_nanosleep='$d_nanosleep'
20722 d_nice='$d_nice'
20723 d_nl_langinfo='$d_nl_langinfo'
20724 d_nv_preserves_uv='$d_nv_preserves_uv'
20725 d_off64_t='$d_off64_t'
20726 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20727 d_oldpthreads='$d_oldpthreads'
20728 d_oldsock='$d_oldsock'
20729 d_open3='$d_open3'
20730 d_pathconf='$d_pathconf'
20731 d_pause='$d_pause'
20732 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20733 d_phostname='$d_phostname'
20734 d_pipe='$d_pipe'
20735 d_poll='$d_poll'
20736 d_portable='$d_portable'
20737 d_procselfexe='$d_procselfexe'
20738 d_pthread_atfork='$d_pthread_atfork'
20739 d_pthread_attr_setscope='$d_pthread_attr_setscope'
20740 d_pthread_yield='$d_pthread_yield'
20741 d_pwage='$d_pwage'
20742 d_pwchange='$d_pwchange'
20743 d_pwclass='$d_pwclass'
20744 d_pwcomment='$d_pwcomment'
20745 d_pwexpire='$d_pwexpire'
20746 d_pwgecos='$d_pwgecos'
20747 d_pwpasswd='$d_pwpasswd'
20748 d_pwquota='$d_pwquota'
20749 d_qgcvt='$d_qgcvt'
20750 d_quad='$d_quad'
20751 d_random_r='$d_random_r'
20752 d_readdir64_r='$d_readdir64_r'
20753 d_readdir='$d_readdir'
20754 d_readdir_r='$d_readdir_r'
20755 d_readlink='$d_readlink'
20756 d_readv='$d_readv'
20757 d_recvmsg='$d_recvmsg'
20758 d_rename='$d_rename'
20759 d_rewinddir='$d_rewinddir'
20760 d_rmdir='$d_rmdir'
20761 d_safebcpy='$d_safebcpy'
20762 d_safemcpy='$d_safemcpy'
20763 d_sanemcmp='$d_sanemcmp'
20764 d_sbrkproto='$d_sbrkproto'
20765 d_scalbnl='$d_scalbnl'
20766 d_sched_yield='$d_sched_yield'
20767 d_scm_rights='$d_scm_rights'
20768 d_seekdir='$d_seekdir'
20769 d_select='$d_select'
20770 d_sem='$d_sem'
20771 d_semctl='$d_semctl'
20772 d_semctl_semid_ds='$d_semctl_semid_ds'
20773 d_semctl_semun='$d_semctl_semun'
20774 d_semget='$d_semget'
20775 d_semop='$d_semop'
20776 d_sendmsg='$d_sendmsg'
20777 d_setegid='$d_setegid'
20778 d_seteuid='$d_seteuid'
20779 d_setgrent='$d_setgrent'
20780 d_setgrent_r='$d_setgrent_r'
20781 d_setgrps='$d_setgrps'
20782 d_sethent='$d_sethent'
20783 d_sethostent_r='$d_sethostent_r'
20784 d_setitimer='$d_setitimer'
20785 d_setlinebuf='$d_setlinebuf'
20786 d_setlocale='$d_setlocale'
20787 d_setlocale_r='$d_setlocale_r'
20788 d_setnent='$d_setnent'
20789 d_setnetent_r='$d_setnetent_r'
20790 d_setpent='$d_setpent'
20791 d_setpgid='$d_setpgid'
20792 d_setpgrp2='$d_setpgrp2'
20793 d_setpgrp='$d_setpgrp'
20794 d_setprior='$d_setprior'
20795 d_setproctitle='$d_setproctitle'
20796 d_setprotoent_r='$d_setprotoent_r'
20797 d_setpwent='$d_setpwent'
20798 d_setpwent_r='$d_setpwent_r'
20799 d_setregid='$d_setregid'
20800 d_setresgid='$d_setresgid'
20801 d_setresuid='$d_setresuid'
20802 d_setreuid='$d_setreuid'
20803 d_setrgid='$d_setrgid'
20804 d_setruid='$d_setruid'
20805 d_setsent='$d_setsent'
20806 d_setservent_r='$d_setservent_r'
20807 d_setsid='$d_setsid'
20808 d_setvbuf='$d_setvbuf'
20809 d_sfio='$d_sfio'
20810 d_shm='$d_shm'
20811 d_shmat='$d_shmat'
20812 d_shmatprototype='$d_shmatprototype'
20813 d_shmctl='$d_shmctl'
20814 d_shmdt='$d_shmdt'
20815 d_shmget='$d_shmget'
20816 d_sigaction='$d_sigaction'
20817 d_sigprocmask='$d_sigprocmask'
20818 d_sigsetjmp='$d_sigsetjmp'
20819 d_sockatmark='$d_sockatmark'
20820 d_sockatmarkproto='$d_sockatmarkproto'
20821 d_socket='$d_socket'
20822 d_socklen_t='$d_socklen_t'
20823 d_sockpair='$d_sockpair'
20824 d_socks5_init='$d_socks5_init'
20825 d_sqrtl='$d_sqrtl'
20826 d_srand48_r='$d_srand48_r'
20827 d_srandom_r='$d_srandom_r'
20828 d_sresgproto='$d_sresgproto'
20829 d_sresuproto='$d_sresuproto'
20830 d_statblks='$d_statblks'
20831 d_statfs_f_flags='$d_statfs_f_flags'
20832 d_statfs_s='$d_statfs_s'
20833 d_statvfs='$d_statvfs'
20834 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20835 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20836 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20837 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20838 d_stdio_stream_array='$d_stdio_stream_array'
20839 d_stdiobase='$d_stdiobase'
20840 d_stdstdio='$d_stdstdio'
20841 d_strchr='$d_strchr'
20842 d_strcoll='$d_strcoll'
20843 d_strctcpy='$d_strctcpy'
20844 d_strerrm='$d_strerrm'
20845 d_strerror='$d_strerror'
20846 d_strerror_r='$d_strerror_r'
20847 d_strftime='$d_strftime'
20848 d_strtod='$d_strtod'
20849 d_strtol='$d_strtol'
20850 d_strtold='$d_strtold'
20851 d_strtoll='$d_strtoll'
20852 d_strtoq='$d_strtoq'
20853 d_strtoul='$d_strtoul'
20854 d_strtoull='$d_strtoull'
20855 d_strtouq='$d_strtouq'
20856 d_strxfrm='$d_strxfrm'
20857 d_suidsafe='$d_suidsafe'
20858 d_symlink='$d_symlink'
20859 d_syscall='$d_syscall'
20860 d_syscallproto='$d_syscallproto'
20861 d_sysconf='$d_sysconf'
20862 d_sysernlst='$d_sysernlst'
20863 d_syserrlst='$d_syserrlst'
20864 d_system='$d_system'
20865 d_tcgetpgrp='$d_tcgetpgrp'
20866 d_tcsetpgrp='$d_tcsetpgrp'
20867 d_telldir='$d_telldir'
20868 d_telldirproto='$d_telldirproto'
20869 d_time='$d_time'
20870 d_times='$d_times'
20871 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20872 d_tm_tm_zone='$d_tm_tm_zone'
20873 d_tmpnam_r='$d_tmpnam_r'
20874 d_truncate='$d_truncate'
20875 d_ttyname_r='$d_ttyname_r'
20876 d_tzname='$d_tzname'
20877 d_u32align='$d_u32align'
20878 d_ualarm='$d_ualarm'
20879 d_umask='$d_umask'
20880 d_uname='$d_uname'
20881 d_union_semun='$d_union_semun'
20882 d_unordered='$d_unordered'
20883 d_usleep='$d_usleep'
20884 d_usleepproto='$d_usleepproto'
20885 d_ustat='$d_ustat'
20886 d_vendorarch='$d_vendorarch'
20887 d_vendorbin='$d_vendorbin'
20888 d_vendorlib='$d_vendorlib'
20889 d_vendorscript='$d_vendorscript'
20890 d_vfork='$d_vfork'
20891 d_void_closedir='$d_void_closedir'
20892 d_voidsig='$d_voidsig'
20893 d_voidtty='$d_voidtty'
20894 d_volatile='$d_volatile'
20895 d_vprintf='$d_vprintf'
20896 d_wait4='$d_wait4'
20897 d_waitpid='$d_waitpid'
20898 d_wcstombs='$d_wcstombs'
20899 d_wctomb='$d_wctomb'
20900 d_writev='$d_writev'
20901 d_xenix='$d_xenix'
20902 date='$date'
20903 db_hashtype='$db_hashtype'
20904 db_prefixtype='$db_prefixtype'
20905 db_version_major='$db_version_major'
20906 db_version_minor='$db_version_minor'
20907 db_version_patch='$db_version_patch'
20908 defvoidused='$defvoidused'
20909 direntrytype='$direntrytype'
20910 dlext='$dlext'
20911 dlsrc='$dlsrc'
20912 doublesize='$doublesize'
20913 drand01='$drand01'
20914 drand48_r_proto='$drand48_r_proto'
20915 dynamic_ext='$dynamic_ext'
20916 eagain='$eagain'
20917 ebcdic='$ebcdic'
20918 echo='$echo'
20919 egrep='$egrep'
20920 emacs='$emacs'
20921 endgrent_r_proto='$endgrent_r_proto'
20922 endhostent_r_proto='$endhostent_r_proto'
20923 endnetent_r_proto='$endnetent_r_proto'
20924 endprotoent_r_proto='$endprotoent_r_proto'
20925 endpwent_r_proto='$endpwent_r_proto'
20926 endservent_r_proto='$endservent_r_proto'
20927 eunicefix='$eunicefix'
20928 exe_ext='$exe_ext'
20929 expr='$expr'
20930 extensions='$extensions'
20931 extras='$extras'
20932 fflushNULL='$fflushNULL'
20933 fflushall='$fflushall'
20934 find='$find'
20935 firstmakefile='$firstmakefile'
20936 flex='$flex'
20937 fpossize='$fpossize'
20938 fpostype='$fpostype'
20939 freetype='$freetype'
20940 from='$from'
20941 full_ar='$full_ar'
20942 full_csh='$full_csh'
20943 full_sed='$full_sed'
20944 gccansipedantic='$gccansipedantic'
20945 gccosandvers='$gccosandvers'
20946 gccversion='$gccversion'
20947 getgrent_r_proto='$getgrent_r_proto'
20948 getgrgid_r_proto='$getgrgid_r_proto'
20949 getgrnam_r_proto='$getgrnam_r_proto'
20950 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20951 gethostbyname_r_proto='$gethostbyname_r_proto'
20952 gethostent_r_proto='$gethostent_r_proto'
20953 getlogin_r_proto='$getlogin_r_proto'
20954 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20955 getnetbyname_r_proto='$getnetbyname_r_proto'
20956 getnetent_r_proto='$getnetent_r_proto'
20957 getprotobyname_r_proto='$getprotobyname_r_proto'
20958 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20959 getprotoent_r_proto='$getprotoent_r_proto'
20960 getpwent_r_proto='$getpwent_r_proto'
20961 getpwnam_r_proto='$getpwnam_r_proto'
20962 getpwuid_r_proto='$getpwuid_r_proto'
20963 getservbyname_r_proto='$getservbyname_r_proto'
20964 getservbyport_r_proto='$getservbyport_r_proto'
20965 getservent_r_proto='$getservent_r_proto'
20966 getspnam_r_proto='$getspnam_r_proto'
20967 gidformat='$gidformat'
20968 gidsign='$gidsign'
20969 gidsize='$gidsize'
20970 gidtype='$gidtype'
20971 glibpth='$glibpth'
20972 gmake='$gmake'
20973 gmtime_r_proto='$gmtime_r_proto'
20974 gnulibc_version='$gnulibc_version'
20975 grep='$grep'
20976 groupcat='$groupcat'
20977 groupstype='$groupstype'
20978 gzip='$gzip'
20979 h_fcntl='$h_fcntl'
20980 h_sysfile='$h_sysfile'
20981 hint='$hint'
20982 hostcat='$hostcat'
20983 html1dir='$html1dir'
20984 html1direxp='$html1direxp'
20985 html3dir='$html3dir'
20986 html3direxp='$html3direxp'
20987 i16size='$i16size'
20988 i16type='$i16type'
20989 i32size='$i32size'
20990 i32type='$i32type'
20991 i64size='$i64size'
20992 i64type='$i64type'
20993 i8size='$i8size'
20994 i8type='$i8type'
20995 i_arpainet='$i_arpainet'
20996 i_bsdioctl='$i_bsdioctl'
20997 i_crypt='$i_crypt'
20998 i_db='$i_db'
20999 i_dbm='$i_dbm'
21000 i_dirent='$i_dirent'
21001 i_dld='$i_dld'
21002 i_dlfcn='$i_dlfcn'
21003 i_fcntl='$i_fcntl'
21004 i_float='$i_float'
21005 i_fp='$i_fp'
21006 i_fp_class='$i_fp_class'
21007 i_gdbm='$i_gdbm'
21008 i_grp='$i_grp'
21009 i_ieeefp='$i_ieeefp'
21010 i_inttypes='$i_inttypes'
21011 i_langinfo='$i_langinfo'
21012 i_libutil='$i_libutil'
21013 i_limits='$i_limits'
21014 i_locale='$i_locale'
21015 i_machcthr='$i_machcthr'
21016 i_malloc='$i_malloc'
21017 i_math='$i_math'
21018 i_memory='$i_memory'
21019 i_mntent='$i_mntent'
21020 i_ndbm='$i_ndbm'
21021 i_netdb='$i_netdb'
21022 i_neterrno='$i_neterrno'
21023 i_netinettcp='$i_netinettcp'
21024 i_niin='$i_niin'
21025 i_poll='$i_poll'
21026 i_prot='$i_prot'
21027 i_pthread='$i_pthread'
21028 i_pwd='$i_pwd'
21029 i_rpcsvcdbm='$i_rpcsvcdbm'
21030 i_sfio='$i_sfio'
21031 i_sgtty='$i_sgtty'
21032 i_shadow='$i_shadow'
21033 i_socks='$i_socks'
21034 i_stdarg='$i_stdarg'
21035 i_stddef='$i_stddef'
21036 i_stdlib='$i_stdlib'
21037 i_string='$i_string'
21038 i_sunmath='$i_sunmath'
21039 i_sysaccess='$i_sysaccess'
21040 i_sysdir='$i_sysdir'
21041 i_sysfile='$i_sysfile'
21042 i_sysfilio='$i_sysfilio'
21043 i_sysin='$i_sysin'
21044 i_sysioctl='$i_sysioctl'
21045 i_syslog='$i_syslog'
21046 i_sysmman='$i_sysmman'
21047 i_sysmode='$i_sysmode'
21048 i_sysmount='$i_sysmount'
21049 i_sysndir='$i_sysndir'
21050 i_sysparam='$i_sysparam'
21051 i_sysresrc='$i_sysresrc'
21052 i_syssecrt='$i_syssecrt'
21053 i_sysselct='$i_sysselct'
21054 i_syssockio='$i_syssockio'
21055 i_sysstat='$i_sysstat'
21056 i_sysstatfs='$i_sysstatfs'
21057 i_sysstatvfs='$i_sysstatvfs'
21058 i_systime='$i_systime'
21059 i_systimek='$i_systimek'
21060 i_systimes='$i_systimes'
21061 i_systypes='$i_systypes'
21062 i_sysuio='$i_sysuio'
21063 i_sysun='$i_sysun'
21064 i_sysutsname='$i_sysutsname'
21065 i_sysvfs='$i_sysvfs'
21066 i_syswait='$i_syswait'
21067 i_termio='$i_termio'
21068 i_termios='$i_termios'
21069 i_time='$i_time'
21070 i_unistd='$i_unistd'
21071 i_ustat='$i_ustat'
21072 i_utime='$i_utime'
21073 i_values='$i_values'
21074 i_varargs='$i_varargs'
21075 i_varhdr='$i_varhdr'
21076 i_vfork='$i_vfork'
21077 ignore_versioned_solibs='$ignore_versioned_solibs'
21078 inc_version_list='$inc_version_list'
21079 inc_version_list_init='$inc_version_list_init'
21080 incpath='$incpath'
21081 inews='$inews'
21082 installarchlib='$installarchlib'
21083 installbin='$installbin'
21084 installhtml1dir='$installhtml1dir'
21085 installhtml3dir='$installhtml3dir'
21086 installman1dir='$installman1dir'
21087 installman3dir='$installman3dir'
21088 installprefix='$installprefix'
21089 installprefixexp='$installprefixexp'
21090 installprivlib='$installprivlib'
21091 installscript='$installscript'
21092 installsitearch='$installsitearch'
21093 installsitebin='$installsitebin'
21094 installsitehtml1='$installsitehtml1'
21095 installsitehtml3='$installsitehtml3'
21096 installsitelib='$installsitelib'
21097 installsiteman1='$installsiteman1'
21098 installsiteman3='$installsiteman3'
21099 installsitescript='$installsitescript'
21100 installstyle='$installstyle'
21101 installusrbinperl='$installusrbinperl'
21102 installvendorarch='$installvendorarch'
21103 installvendorbin='$installvendorbin'
21104 installvendorhtml1='$installvendorhtml1'
21105 installvendorhtml3='$installvendorhtml3'
21106 installvendorlib='$installvendorlib'
21107 installvendorman1='$installvendorman1'
21108 installvendorman3='$installvendorman3'
21109 installvendorscript='$installvendorscript'
21110 intsize='$intsize'
21111 issymlink='$issymlink'
21112 ivdformat='$ivdformat'
21113 ivsize='$ivsize'
21114 ivtype='$ivtype'
21115 known_extensions='$known_extensions'
21116 ksh='$ksh'
21117 ld='$ld'
21118 lddlflags='$lddlflags'
21119 ldflags='$ldflags'
21120 ldflags_uselargefiles='$ldflags_uselargefiles'
21121 ldlibpthname='$ldlibpthname'
21122 less='$less'
21123 lib_ext='$lib_ext'
21124 libc='$libc'
21125 libperl='$libperl'
21126 libpth='$libpth'
21127 libs='$libs'
21128 libsdirs='$libsdirs'
21129 libsfiles='$libsfiles'
21130 libsfound='$libsfound'
21131 libspath='$libspath'
21132 libswanted='$libswanted'
21133 libswanted_uselargefiles='$libswanted_uselargefiles'
21134 line='$line'
21135 lint='$lint'
21136 lkflags='$lkflags'
21137 ln='$ln'
21138 lns='$lns'
21139 localtime_r_proto='$localtime_r_proto'
21140 locincpth='$locincpth'
21141 loclibpth='$loclibpth'
21142 longdblsize='$longdblsize'
21143 longlongsize='$longlongsize'
21144 longsize='$longsize'
21145 lp='$lp'
21146 lpr='$lpr'
21147 ls='$ls'
21148 lseeksize='$lseeksize'
21149 lseektype='$lseektype'
21150 mail='$mail'
21151 mailx='$mailx'
21152 make='$make'
21153 make_set_make='$make_set_make'
21154 mallocobj='$mallocobj'
21155 mallocsrc='$mallocsrc'
21156 malloctype='$malloctype'
21157 man1dir='$man1dir'
21158 man1direxp='$man1direxp'
21159 man1ext='$man1ext'
21160 man3dir='$man3dir'
21161 man3direxp='$man3direxp'
21162 man3ext='$man3ext'
21163 mips_type='$mips_type'
21164 mistrustnm='$mistrustnm'
21165 mkdir='$mkdir'
21166 mmaptype='$mmaptype'
21167 modetype='$modetype'
21168 more='$more'
21169 multiarch='$multiarch'
21170 mv='$mv'
21171 myarchname='$myarchname'
21172 mydomain='$mydomain'
21173 myhostname='$myhostname'
21174 myuname='$myuname'
21175 n='$n'
21176 need_va_copy='$need_va_copy'
21177 netdb_hlen_type='$netdb_hlen_type'
21178 netdb_host_type='$netdb_host_type'
21179 netdb_name_type='$netdb_name_type'
21180 netdb_net_type='$netdb_net_type'
21181 nm='$nm'
21182 nm_opt='$nm_opt'
21183 nm_so_opt='$nm_so_opt'
21184 nonxs_ext='$nonxs_ext'
21185 nroff='$nroff'
21186 nvEUformat='$nvEUformat'
21187 nvFUformat='$nvFUformat'
21188 nvGUformat='$nvGUformat'
21189 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21190 nveformat='$nveformat'
21191 nvfformat='$nvfformat'
21192 nvgformat='$nvgformat'
21193 nvsize='$nvsize'
21194 nvtype='$nvtype'
21195 o_nonblock='$o_nonblock'
21196 obj_ext='$obj_ext'
21197 old_pthread_create_joinable='$old_pthread_create_joinable'
21198 optimize='$optimize'
21199 orderlib='$orderlib'
21200 osname='$osname'
21201 osvers='$osvers'
21202 otherlibdirs='$otherlibdirs'
21203 package='$package'
21204 pager='$pager'
21205 passcat='$passcat'
21206 patchlevel='$patchlevel'
21207 path_sep='$path_sep'
21208 perl5='$perl5'
21209 perl='$perl'
21210 perl_patchlevel='$perl_patchlevel'
21211 perladmin='$perladmin'
21212 perllibs='$perllibs'
21213 perlpath='$perlpath'
21214 pg='$pg'
21215 phostname='$phostname'
21216 pidtype='$pidtype'
21217 plibpth='$plibpth'
21218 pm_apiversion='$pm_apiversion'
21219 pmake='$pmake'
21220 pr='$pr'
21221 prefix='$prefix'
21222 prefixexp='$prefixexp'
21223 privlib='$privlib'
21224 privlibexp='$privlibexp'
21225 procselfexe='$procselfexe'
21226 prototype='$prototype'
21227 ptrsize='$ptrsize'
21228 quadkind='$quadkind'
21229 quadtype='$quadtype'
21230 randbits='$randbits'
21231 randfunc='$randfunc'
21232 random_r_proto='$random_r_proto'
21233 randseedtype='$randseedtype'
21234 ranlib='$ranlib'
21235 rd_nodata='$rd_nodata'
21236 readdir64_r_proto='$readdir64_r_proto'
21237 readdir_r_proto='$readdir_r_proto'
21238 revision='$revision'
21239 rm='$rm'
21240 rmail='$rmail'
21241 run='$run'
21242 runnm='$runnm'
21243 sPRIEUldbl='$sPRIEUldbl'
21244 sPRIFUldbl='$sPRIFUldbl'
21245 sPRIGUldbl='$sPRIGUldbl'
21246 sPRIXU64='$sPRIXU64'
21247 sPRId64='$sPRId64'
21248 sPRIeldbl='$sPRIeldbl'
21249 sPRIfldbl='$sPRIfldbl'
21250 sPRIgldbl='$sPRIgldbl'
21251 sPRIi64='$sPRIi64'
21252 sPRIo64='$sPRIo64'
21253 sPRIu64='$sPRIu64'
21254 sPRIx64='$sPRIx64'
21255 sSCNfldbl='$sSCNfldbl'
21256 sched_yield='$sched_yield'
21257 scriptdir='$scriptdir'
21258 scriptdirexp='$scriptdirexp'
21259 sed='$sed'
21260 seedfunc='$seedfunc'
21261 selectminbits='$selectminbits'
21262 selecttype='$selecttype'
21263 sendmail='$sendmail'
21264 setgrent_r_proto='$setgrent_r_proto'
21265 sethostent_r_proto='$sethostent_r_proto'
21266 setlocale_r_proto='$setlocale_r_proto'
21267 setnetent_r_proto='$setnetent_r_proto'
21268 setprotoent_r_proto='$setprotoent_r_proto'
21269 setpwent_r_proto='$setpwent_r_proto'
21270 setservent_r_proto='$setservent_r_proto'
21271 sh='$sh'
21272 shar='$shar'
21273 sharpbang='$sharpbang'
21274 shmattype='$shmattype'
21275 shortsize='$shortsize'
21276 shrpenv='$shrpenv'
21277 shsharp='$shsharp'
21278 sig_count='$sig_count'
21279 sig_name='$sig_name'
21280 sig_name_init='$sig_name_init'
21281 sig_num='$sig_num'
21282 sig_num_init='$sig_num_init'
21283 sig_size='$sig_size'
21284 signal_t='$signal_t'
21285 sitearch='$sitearch'
21286 sitearchexp='$sitearchexp'
21287 sitebin='$sitebin'
21288 sitebinexp='$sitebinexp'
21289 sitehtml1='$sitehtml1'
21290 sitehtml1exp='$sitehtml1exp'
21291 sitehtml3='$sitehtml3'
21292 sitehtml3exp='$sitehtml3exp'
21293 sitelib='$sitelib'
21294 sitelib_stem='$sitelib_stem'
21295 sitelibexp='$sitelibexp'
21296 siteman1='$siteman1'
21297 siteman1exp='$siteman1exp'
21298 siteman3='$siteman3'
21299 siteman3exp='$siteman3exp'
21300 siteprefix='$siteprefix'
21301 siteprefixexp='$siteprefixexp'
21302 sitescript='$sitescript'
21303 sitescriptexp='$sitescriptexp'
21304 sizesize='$sizesize'
21305 sizetype='$sizetype'
21306 sleep='$sleep'
21307 smail='$smail'
21308 so='$so'
21309 sockethdr='$sockethdr'
21310 socketlib='$socketlib'
21311 socksizetype='$socksizetype'
21312 sort='$sort'
21313 spackage='$spackage'
21314 spitshell='$spitshell'
21315 srand48_r_proto='$srand48_r_proto'
21316 srandom_r_proto='$srandom_r_proto'
21317 src='$src'
21318 ssizetype='$ssizetype'
21319 startperl='$startperl'
21320 startsh='$startsh'
21321 static_ext='$static_ext'
21322 stdchar='$stdchar'
21323 stdio_base='$stdio_base'
21324 stdio_bufsiz='$stdio_bufsiz'
21325 stdio_cnt='$stdio_cnt'
21326 stdio_filbuf='$stdio_filbuf'
21327 stdio_ptr='$stdio_ptr'
21328 stdio_stream_array='$stdio_stream_array'
21329 strerror_r_proto='$strerror_r_proto'
21330 strings='$strings'
21331 submit='$submit'
21332 subversion='$subversion'
21333 sysman='$sysman'
21334 tail='$tail'
21335 tar='$tar'
21336 targetarch='$targetarch'
21337 tbl='$tbl'
21338 tee='$tee'
21339 test='$test'
21340 timeincl='$timeincl'
21341 timetype='$timetype'
21342 tmpnam_r_proto='$tmpnam_r_proto'
21343 to='$to'
21344 touch='$touch'
21345 tr='$tr'
21346 trnl='$trnl'
21347 troff='$troff'
21348 ttyname_r_proto='$ttyname_r_proto'
21349 u16size='$u16size'
21350 u16type='$u16type'
21351 u32size='$u32size'
21352 u32type='$u32type'
21353 u64size='$u64size'
21354 u64type='$u64type'
21355 u8size='$u8size'
21356 u8type='$u8type'
21357 uidformat='$uidformat'
21358 uidsign='$uidsign'
21359 uidsize='$uidsize'
21360 uidtype='$uidtype'
21361 uname='$uname'
21362 uniq='$uniq'
21363 uquadtype='$uquadtype'
21364 use5005threads='$use5005threads'
21365 use64bitall='$use64bitall'
21366 use64bitint='$use64bitint'
21367 usecrosscompile='$usecrosscompile'
21368 usedl='$usedl'
21369 usefaststdio='$usefaststdio'
21370 useithreads='$useithreads'
21371 uselargefiles='$uselargefiles'
21372 uselongdouble='$uselongdouble'
21373 usemorebits='$usemorebits'
21374 usemultiplicity='$usemultiplicity'
21375 usemymalloc='$usemymalloc'
21376 usenm='$usenm'
21377 useopcode='$useopcode'
21378 useperlio='$useperlio'
21379 useposix='$useposix'
21380 usereentrant='$usereentrant'
21381 usesfio='$usesfio'
21382 useshrplib='$useshrplib'
21383 usesocks='$usesocks'
21384 usethreads='$usethreads'
21385 usevendorprefix='$usevendorprefix'
21386 usevfork='$usevfork'
21387 usrinc='$usrinc'
21388 uuname='$uuname'
21389 uvXUformat='$uvXUformat'
21390 uvoformat='$uvoformat'
21391 uvsize='$uvsize'
21392 uvtype='$uvtype'
21393 uvuformat='$uvuformat'
21394 uvxformat='$uvxformat'
21395 vendorarch='$vendorarch'
21396 vendorarchexp='$vendorarchexp'
21397 vendorbin='$vendorbin'
21398 vendorbinexp='$vendorbinexp'
21399 vendorhtml1='$vendorhtml1'
21400 vendorhtml1exp='$vendorhtml1exp'
21401 vendorhtml3='$vendorhtml3'
21402 vendorhtml3exp='$vendorhtml3exp'
21403 vendorlib='$vendorlib'
21404 vendorlib_stem='$vendorlib_stem'
21405 vendorlibexp='$vendorlibexp'
21406 vendorman1='$vendorman1'
21407 vendorman1exp='$vendorman1exp'
21408 vendorman3='$vendorman3'
21409 vendorman3exp='$vendorman3exp'
21410 vendorprefix='$vendorprefix'
21411 vendorprefixexp='$vendorprefixexp'
21412 vendorscript='$vendorscript'
21413 vendorscriptexp='$vendorscriptexp'
21414 version='$version'
21415 version_patchlevel_string='$version_patchlevel_string'
21416 versiononly='$versiononly'
21417 vi='$vi'
21418 voidflags='$voidflags'
21419 xlibpth='$xlibpth'
21420 xs_apiversion='$xs_apiversion'
21421 yacc='$yacc'
21422 yaccflags='$yaccflags'
21423 zcat='$zcat'
21424 zip='$zip'
21425 EOT
21426
21427 : Add in command line options if available
21428 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21429
21430 : add special variables
21431 $test -f $src/patchlevel.h && \
21432 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21433 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21434 echo "PERL_CONFIG_SH=true" >>config.sh
21435
21436 : propagate old symbols
21437 if $test -f UU/config.sh; then
21438         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21439         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21440         $sort | $uniq -u >UU/oldsyms
21441         set X `cat UU/oldsyms`
21442         shift
21443         case $# in
21444         0) ;;
21445         *)
21446                 cat <<EOM
21447 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21448 EOM
21449                 echo "# Variables propagated from previous config.sh file." >>config.sh
21450                 for sym in `cat UU/oldsyms`; do
21451                         echo "    Propagating $hint variable "'$'"$sym..."
21452                         eval 'tmp="$'"${sym}"'"'
21453                         echo "$tmp" | \
21454                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21455                 done
21456                 ;;
21457         esac
21458 fi
21459
21460 : Finish up by extracting the .SH files
21461 case "$alldone" in
21462 exit)
21463         $rm -rf UU
21464         echo "Extraction done."
21465         exit 0
21466         ;;
21467 cont)
21468         ;;
21469 '')
21470         dflt=''
21471         nostick=true
21472         $cat <<EOM
21473
21474 If you'd like to make any changes to the config.sh file before I begin
21475 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21476
21477 EOM
21478         rp="Press return or use a shell escape to edit config.sh:"
21479         . UU/myread
21480         nostick=''
21481         case "$ans" in
21482         '') ;;
21483         *) : in case they cannot read
21484                 sh 1>&4 -c "$ans";;
21485         esac
21486         ;;
21487 esac
21488
21489 : if this fails, just run all the .SH files by hand
21490 . ./config.sh
21491
21492 echo " "
21493 exec 1>&4
21494 pwd=`pwd`
21495 . ./UU/extract
21496 cd "$pwd"
21497
21498 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21499         dflt=y
21500         case "$silent" in
21501         true) ;;
21502         *)
21503                 $cat <<EOM
21504
21505 Now you need to generate make dependencies by running "$make depend".
21506 You might prefer to run it in background: "$make depend > makedepend.out &"
21507 It can take a while, so you might not want to run it right now.
21508
21509 EOM
21510                 ;;
21511         esac
21512         rp="Run $make depend now?"
21513         . UU/myread
21514         case "$ans" in
21515         y*)
21516                 $make depend && echo "Now you must run '$make'."
21517                 ;;
21518         *)
21519                 echo "You must run '$make depend' then '$make'."
21520                 ;;
21521         esac
21522 elif test -f [Mm]akefile; then
21523         echo " "
21524         echo "Now you must run a $make."
21525 else
21526         echo "Configure done."
21527 fi
21528
21529 if $test -f Policy.sh; then
21530     $cat <<EOM
21531
21532 If you compile $package on a different machine or from a different object
21533 directory, copy the Policy.sh file from this object directory to the
21534 new one before you run Configure -- this will help you with most of
21535 the policy defaults.
21536
21537 EOM
21538 fi
21539 if $test -f config.msg; then
21540     echo "Hmm.  I also noted the following information while running:"
21541     echo " "
21542     $cat config.msg >&4
21543     $rm -f config.msg
21544 fi
21545 $rm -f kit*isdone ark*isdone
21546 $rm -rf UU
21547
21548 : End of Configure
21549