Stay within known facts: what platforms the skippage helps,
[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 Mar 14 13:17:23 EET 2003 [metaconfig 3.0 PL70]
24 # (with additional metaconfig patches by perlbug@perl.org)
25
26 cat >c1$$ <<EOF
27 ARGGGHHHH!!!!!
28
29 SCO csh still thinks true is false.  Write to SCO today and tell them that next
30 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
31
32 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
33 we'd have to do is go in and swap the && and || tokens, wherever they are.)
34
35 [End of diatribe. We now return you to your regularly scheduled programming...]
36 EOF
37 cat >c2$$ <<EOF
38
39 OOPS!  You naughty creature!  You didn't run Configure with sh!
40 I will attempt to remedy the situation by running sh for you...
41 EOF
42
43 true || cat c1$$ c2$$
44 true || exec sh $0 $argv:q
45
46 (exit $?0) || cat c2$$
47 (exit $?0) || exec sh $0 $argv:q
48 rm -f c1$$ c2$$
49
50 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
51         cat >&4 <<EOF
52 ***
53 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
54 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
55 *** Please read the README.plan9 for further instructions.
56 *** Cannot continue, aborting.
57 ***
58 EOF
59         exit 1
60 fi
61
62 : compute my invocation name
63 me=$0
64 case "$0" in
65 */*)
66         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
67         test "$me" || me=$0
68         ;;
69 esac
70
71 : Proper separator for the PATH environment variable
72 p_=:
73 : On OS/2 this directory should exist if this is not floppy only system :-]
74 if test -d c:/. ; then
75     if test -n "$OS2_SHELL"; then
76                 p_=\;
77                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
78                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
79         elif test -n "$DJGPP"; then
80                 case "X${MACHTYPE:-nonesuchmach}" in
81                 *cygwin) ;;
82                 *) p_=\; ;;
83                 esac
84         fi
85 fi
86
87 : Proper PATH setting
88 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
89 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
90 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
91 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
92 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
93 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /usr/ccs/bin"
94 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
95 paths="$paths /sbin /usr/sbin /usr/libexec"
96 paths="$paths /system/gnu_library/bin"
97
98 for p in $paths
99 do
100         case "$p_$PATH$p_" in
101         *$p_$p$p_*) ;;
102         *) test -d $p && PATH=$PATH$p_$p ;;
103         esac
104 done
105
106 PATH=.$p_$PATH
107 export PATH
108
109 : shall we be using ksh?
110 inksh=''
111 needksh=''
112 avoidksh=''
113 newsh=/bin/ksh
114 changesh=''
115 if (PATH=.; alias -x) >/dev/null 2>&1; then
116                 inksh=true
117 fi
118 if test -f /hp-ux -a -f /bin/ksh; then
119         needksh='to avoid sh bug in "here document" expansion'
120 fi
121 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
122         if test X`/usr/bin/uname -v` = X4; then
123                 avoidksh="to avoid AIX 4's /bin/sh"
124                 newsh=/usr/bin/bsh
125         fi
126 fi
127 if test -f /osf_boot -a -f /usr/sbin/setld; then
128         if test X`/usr/bin/uname -s` = XOSF1; then
129                 avoidksh="to avoid Digital UNIX' ksh"
130                 newsh=/bin/sh
131                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
132         fi
133 fi
134 case "$inksh/$needksh" in
135 /[a-z]*)
136                 ENV=''
137                 changesh=true
138                 reason="$needksh"
139         ;;
140 esac
141 case "$inksh/$avoidksh" in
142 true/[a-z]*)
143         changesh=true
144         reason="$avoidksh"
145         ;;
146 esac
147 case "$inksh/$needksh-$avoidksh-" in
148 true/--)
149                 cat <<EOM
150 (I see you are using the Korn shell.  Some ksh's blow up on $me,
151 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
152 EOM
153         ;;
154 esac
155 case "$changesh" in
156 true)
157         export newsh
158         echo "(Feeding myself to $newsh $reason.)"
159         case "$0" in
160         Configure|*/Configure) exec $newsh $0 "$@";;
161         *) exec $newsh Configure "$@";;
162         esac
163         ;;
164 esac
165
166 : if needed set CDPATH to a harmless value that is not chatty
167 : avoid bash 2.02 problems with empty CDPATH.
168 case "$CDPATH" in
169 '')     ;;
170 *)      case "$SHELL" in
171         *bash*) CDPATH='.' ;;
172         *)              CDPATH='' ;;
173         esac
174         ;;
175 esac
176 : Configure runs within the UU subdirectory
177 test -d UU || mkdir UU
178 cd UU && rm -f ./*
179
180 ccname=''
181 ccversion=''
182 ccsymbols=''
183 cppccsymbols=''
184 cppsymbols=''
185 from=''
186 run=''
187 targetarch=''
188 to=''
189 usecrosscompile=''
190 perllibs=''
191 dynamic_ext=''
192 extensions=''
193 known_extensions=''
194 nonxs_ext=''
195 static_ext=''
196 useopcode=''
197 useposix=''
198 extras=''
199 d_bsd=''
200 d_eunice=''
201 d_xenix=''
202 eunicefix=''
203 Mcc=''
204 ar=''
205 awk=''
206 bash=''
207 bison=''
208 byacc=''
209 cat=''
210 chgrp=''
211 chmod=''
212 chown=''
213 comm=''
214 compress=''
215 cp=''
216 cpio=''
217 cpp=''
218 csh=''
219 date=''
220 echo=''
221 egrep=''
222 emacs=''
223 expr=''
224 find=''
225 flex=''
226 gmake=''
227 grep=''
228 gzip=''
229 inews=''
230 ksh=''
231 less=''
232 line=''
233 lint=''
234 ln=''
235 lp=''
236 lpr=''
237 ls=''
238 mail=''
239 mailx=''
240 make=''
241 mkdir=''
242 more=''
243 mv=''
244 nm=''
245 nroff=''
246 perl=''
247 pg=''
248 pmake=''
249 pr=''
250 rm=''
251 rmail=''
252 sed=''
253 sendmail=''
254 shar=''
255 sleep=''
256 smail=''
257 sort=''
258 submit=''
259 tail=''
260 tar=''
261 tbl=''
262 tee=''
263 test=''
264 touch=''
265 tr=''
266 troff=''
267 uname=''
268 uniq=''
269 uuname=''
270 vi=''
271 zcat=''
272 zip=''
273 full_ar=''
274 full_sed=''
275 libswanted=''
276 hint=''
277 myuname=''
278 osname=''
279 osvers=''
280 Author=''
281 Date=''
282 Header=''
283 Id=''
284 Locker=''
285 Log=''
286 RCSfile=''
287 Revision=''
288 Source=''
289 State=''
290 _a=''
291 _exe=''
292 _o=''
293 archobjs=''
294 exe_ext=''
295 firstmakefile=''
296 lib_ext=''
297 obj_ext=''
298 path_sep=''
299 afs=''
300 afsroot=''
301 alignbytes=''
302 ansi2knr=''
303 archlib=''
304 archlibexp=''
305 d_archlib=''
306 installarchlib=''
307 archname=''
308 myarchname=''
309 d_atolf=''
310 d_atoll=''
311 baserev=''
312 bin=''
313 binexp=''
314 installbin=''
315 byteorder=''
316 cc=''
317 ccflags=''
318 cppflags=''
319 ldflags=''
320 lkflags=''
321 locincpth=''
322 optimize=''
323 cf_email=''
324 cf_by=''
325 cf_time=''
326 charsize=''
327 contains=''
328 cpp_stuff=''
329 cpplast=''
330 cppminus=''
331 cpprun=''
332 cppstdin=''
333 d__fwalk=''
334 d_access=''
335 d_accessx=''
336 d_alarm=''
337 asctime_r_proto=''
338 d_asctime_r=''
339 d_attribut=''
340 d_bcmp=''
341 d_bcopy=''
342 d_bzero=''
343 d_casti32=''
344 castflags=''
345 d_castneg=''
346 d_chown=''
347 d_chroot=''
348 d_chsize=''
349 d_class=''
350 d_closedir=''
351 d_void_closedir=''
352 d_cmsghdr_s=''
353 d_const=''
354 cryptlib=''
355 d_crypt=''
356 crypt_r_proto=''
357 d_crypt_r=''
358 d_csh=''
359 full_csh=''
360 ctermid_r_proto=''
361 d_ctermid_r=''
362 ctime_r_proto=''
363 d_ctime_r=''
364 d_cuserid=''
365 d_dbl_dig=''
366 d_dbminitproto=''
367 d_difftime=''
368 d_dirfd=''
369 d_dlerror=''
370 d_dlopen=''
371 d_dlsymun=''
372 d_dosuid=''
373 d_suidsafe=''
374 d_drand48_r=''
375 drand48_r_proto=''
376 d_drand48proto=''
377 d_dup2=''
378 d_eaccess=''
379 d_endgrent=''
380 d_endgrent_r=''
381 endgrent_r_proto=''
382 d_endhent=''
383 d_endhostent_r=''
384 endhostent_r_proto=''
385 d_endnent=''
386 d_endnetent_r=''
387 endnetent_r_proto=''
388 d_endpent=''
389 d_endprotoent_r=''
390 endprotoent_r_proto=''
391 d_endpwent=''
392 d_endpwent_r=''
393 endpwent_r_proto=''
394 d_endsent=''
395 d_endservent_r=''
396 endservent_r_proto=''
397 d_fchdir=''
398 d_fchmod=''
399 d_fchown=''
400 d_fcntl=''
401 d_fcntl_can_lock=''
402 d_fd_macros=''
403 d_fd_set=''
404 d_fds_bits=''
405 d_fgetpos=''
406 d_finite=''
407 d_finitel=''
408 d_flexfnam=''
409 d_flock=''
410 d_flockproto=''
411 d_fork=''
412 d_fp_class=''
413 d_fpclass=''
414 d_fpclassify=''
415 d_fpclassl=''
416 d_fpos64_t=''
417 d_frexpl=''
418 d_fs_data_s=''
419 d_fseeko=''
420 d_fsetpos=''
421 d_fstatfs=''
422 d_fsync=''
423 d_ftello=''
424 d_ftime=''
425 d_gettimeod=''
426 d_Gconvert=''
427 d_getcwd=''
428 d_getespwnam=''
429 d_getfsstat=''
430 d_getgrent=''
431 d_getgrent_r=''
432 getgrent_r_proto=''
433 d_getgrgid_r=''
434 getgrgid_r_proto=''
435 d_getgrnam_r=''
436 getgrnam_r_proto=''
437 d_getgrps=''
438 d_gethbyaddr=''
439 d_gethbyname=''
440 d_gethent=''
441 aphostname=''
442 d_gethname=''
443 d_phostname=''
444 d_uname=''
445 d_gethostbyaddr_r=''
446 gethostbyaddr_r_proto=''
447 d_gethostbyname_r=''
448 gethostbyname_r_proto=''
449 d_gethostent_r=''
450 gethostent_r_proto=''
451 d_gethostprotos=''
452 d_getitimer=''
453 d_getlogin=''
454 d_getlogin_r=''
455 getlogin_r_proto=''
456 d_getmnt=''
457 d_getmntent=''
458 d_getnbyaddr=''
459 d_getnbyname=''
460 d_getnent=''
461 d_getnetbyaddr_r=''
462 getnetbyaddr_r_proto=''
463 d_getnetbyname_r=''
464 getnetbyname_r_proto=''
465 d_getnetent_r=''
466 getnetent_r_proto=''
467 d_getnetprotos=''
468 d_getpagsz=''
469 d_getpent=''
470 d_getpgid=''
471 d_getpgrp2=''
472 d_bsdgetpgrp=''
473 d_getpgrp=''
474 d_getppid=''
475 d_getprior=''
476 d_getpbyname=''
477 d_getpbynumber=''
478 d_getprotobyname_r=''
479 getprotobyname_r_proto=''
480 d_getprotobynumber_r=''
481 getprotobynumber_r_proto=''
482 d_getprotoent_r=''
483 getprotoent_r_proto=''
484 d_getprotoprotos=''
485 d_getprpwnam=''
486 d_getpwent=''
487 d_getpwent_r=''
488 getpwent_r_proto=''
489 d_getpwnam_r=''
490 getpwnam_r_proto=''
491 d_getpwuid_r=''
492 getpwuid_r_proto=''
493 d_getsent=''
494 d_getservbyname_r=''
495 getservbyname_r_proto=''
496 d_getservbyport_r=''
497 getservbyport_r_proto=''
498 d_getservent_r=''
499 getservent_r_proto=''
500 d_getservprotos=''
501 d_getspnam=''
502 d_getspnam_r=''
503 getspnam_r_proto=''
504 d_getsbyname=''
505 d_getsbyport=''
506 d_gmtime_r=''
507 gmtime_r_proto=''
508 d_gnulibc=''
509 gnulibc_version=''
510 d_hasmntopt=''
511 d_htonl=''
512 d_inetaton=''
513 d_int64_t=''
514 d_isascii=''
515 d_isfinite=''
516 d_isinf=''
517 d_isnan=''
518 d_isnanl=''
519 d_killpg=''
520 d_lchown=''
521 d_ldbl_dig=''
522 d_link=''
523 d_localtime_r=''
524 localtime_r_proto=''
525 d_locconv=''
526 d_lockf=''
527 d_longdbl=''
528 longdblsize=''
529 d_longlong=''
530 longlongsize=''
531 d_lseekproto=''
532 d_lstat=''
533 d_madvise=''
534 d_mblen=''
535 d_mbstowcs=''
536 d_mbtowc=''
537 d_memchr=''
538 d_memcmp=''
539 d_memcpy=''
540 d_memmove=''
541 d_memset=''
542 d_mkdir=''
543 d_mkdtemp=''
544 d_mkfifo=''
545 d_mkstemp=''
546 d_mkstemps=''
547 d_mktime=''
548 d_mmap=''
549 mmaptype=''
550 d_modfl=''
551 d_modfl_pow32_bug=''
552 d_modflproto=''
553 d_mprotect=''
554 d_msg=''
555 d_msgctl=''
556 d_msgget=''
557 d_msghdr_s=''
558 d_msgrcv=''
559 d_msgsnd=''
560 d_msync=''
561 d_munmap=''
562 d_nanosleep=''
563 d_nice=''
564 d_nl_langinfo=''
565 d_off64_t=''
566 d_open3=''
567 d_fpathconf=''
568 d_pathconf=''
569 d_pause=''
570 d_pipe=''
571 d_poll=''
572 d_portable=''
573 d_procselfexe=''
574 procselfexe=''
575 d_old_pthread_create_joinable=''
576 old_pthread_create_joinable=''
577 d_pthread_atfork=''
578 d_pthread_yield=''
579 d_sched_yield=''
580 sched_yield=''
581 d_qgcvt=''
582 d_random_r=''
583 random_r_proto=''
584 d_readdir64_r=''
585 readdir64_r_proto=''
586 d_readdir=''
587 d_rewinddir=''
588 d_seekdir=''
589 d_telldir=''
590 d_readdir_r=''
591 readdir_r_proto=''
592 d_readlink=''
593 d_readv=''
594 d_recvmsg=''
595 d_rename=''
596 d_rmdir=''
597 d_safebcpy=''
598 d_safemcpy=''
599 d_sanemcmp=''
600 d_sbrkproto=''
601 d_select=''
602 d_sem=''
603 d_semctl=''
604 d_semget=''
605 d_semop=''
606 d_sendmsg=''
607 d_setegid=''
608 d_seteuid=''
609 d_setgrent=''
610 d_setgrent_r=''
611 setgrent_r_proto=''
612 d_setgrps=''
613 d_sethent=''
614 d_sethostent_r=''
615 sethostent_r_proto=''
616 d_setitimer=''
617 d_setlinebuf=''
618 d_setlocale=''
619 d_setlocale_r=''
620 setlocale_r_proto=''
621 d_setnent=''
622 d_setnetent_r=''
623 setnetent_r_proto=''
624 d_setpent=''
625 d_setpgid=''
626 d_setpgrp2=''
627 d_bsdsetpgrp=''
628 d_setpgrp=''
629 d_setprior=''
630 d_setproctitle=''
631 d_setprotoent_r=''
632 setprotoent_r_proto=''
633 d_setpwent=''
634 d_setpwent_r=''
635 setpwent_r_proto=''
636 d_setregid=''
637 d_setresgid=''
638 d_setresuid=''
639 d_setreuid=''
640 d_setrgid=''
641 d_setruid=''
642 d_setsent=''
643 d_setservent_r=''
644 setservent_r_proto=''
645 d_setsid=''
646 d_setvbuf=''
647 d_sfio=''
648 usesfio=''
649 d_shm=''
650 d_shmat=''
651 d_shmatprototype=''
652 shmattype=''
653 d_shmctl=''
654 d_shmdt=''
655 d_shmget=''
656 d_sigaction=''
657 d_sigprocmask=''
658 d_sigsetjmp=''
659 d_sockatmark=''
660 d_sockatmarkproto=''
661 d_msg_ctrunc=''
662 d_msg_dontroute=''
663 d_msg_oob=''
664 d_msg_peek=''
665 d_msg_proxy=''
666 d_oldsock=''
667 d_scm_rights=''
668 d_socket=''
669 d_sockpair=''
670 sockethdr=''
671 socketlib=''
672 d_socklen_t=''
673 d_socks5_init=''
674 d_sqrtl=''
675 d_srand48_r=''
676 srand48_r_proto=''
677 d_srandom_r=''
678 srandom_r_proto=''
679 d_sresgproto=''
680 d_sresuproto=''
681 d_statblks=''
682 d_statfs_f_flags=''
683 d_statfs_s=''
684 d_fstatvfs=''
685 d_statvfs=''
686 d_stdio_cnt_lval=''
687 d_stdio_ptr_lval=''
688 d_stdio_ptr_lval_nochange_cnt=''
689 d_stdio_ptr_lval_sets_cnt=''
690 d_stdiobase=''
691 d_stdstdio=''
692 stdio_base=''
693 stdio_bufsiz=''
694 stdio_cnt=''
695 stdio_filbuf=''
696 stdio_ptr=''
697 d_index=''
698 d_strchr=''
699 d_strcoll=''
700 d_strctcpy=''
701 d_strerrm=''
702 d_strerror=''
703 d_sysernlst=''
704 d_syserrlst=''
705 d_strerror_r=''
706 strerror_r_proto=''
707 d_strftime=''
708 d_strtod=''
709 d_strtol=''
710 d_strtold=''
711 d_strtoll=''
712 d_strtoq=''
713 d_strtoul=''
714 d_strtoull=''
715 d_strtouq=''
716 d_strxfrm=''
717 d_symlink=''
718 d_syscall=''
719 d_syscallproto=''
720 d_sysconf=''
721 d_system=''
722 d_tcgetpgrp=''
723 d_tcsetpgrp=''
724 d_telldirproto=''
725 d_time=''
726 timetype=''
727 clocktype=''
728 d_times=''
729 d_tmpnam_r=''
730 tmpnam_r_proto=''
731 d_truncate=''
732 d_ttyname_r=''
733 ttyname_r_proto=''
734 d_tzname=''
735 d_u32align=''
736 d_ualarm=''
737 d_umask=''
738 d_semctl_semid_ds=''
739 d_semctl_semun=''
740 d_union_semun=''
741 d_unordered=''
742 d_usleep=''
743 d_usleepproto=''
744 d_ustat=''
745 d_vfork=''
746 usevfork=''
747 d_voidsig=''
748 signal_t=''
749 d_volatile=''
750 d_charvspr=''
751 d_vprintf=''
752 d_wait4=''
753 d_waitpid=''
754 d_wcstombs=''
755 d_wctomb=''
756 d_writev=''
757 dlext=''
758 cccdlflags=''
759 ccdlflags=''
760 dlsrc=''
761 ld=''
762 lddlflags=''
763 usedl=''
764 doublesize=''
765 ebcdic=''
766 fflushNULL=''
767 fflushall=''
768 fpossize=''
769 fpostype=''
770 gccansipedantic=''
771 gccosandvers=''
772 gccversion=''
773 gidformat=''
774 gidsign=''
775 gidsize=''
776 gidtype=''
777 groupstype=''
778 h_fcntl=''
779 h_sysfile=''
780 html1dir=''
781 html1direxp=''
782 installhtml1dir=''
783 html3dir=''
784 html3direxp=''
785 installhtml3dir=''
786 i_arpainet=''
787 i_crypt=''
788 db_hashtype=''
789 db_prefixtype=''
790 db_version_major=''
791 db_version_minor=''
792 db_version_patch=''
793 i_db=''
794 i_dbm=''
795 i_rpcsvcdbm=''
796 d_dirnamlen=''
797 direntrytype=''
798 i_dirent=''
799 i_dld=''
800 i_dlfcn=''
801 i_fcntl=''
802 i_float=''
803 i_fp=''
804 i_fp_class=''
805 i_gdbm=''
806 d_grpasswd=''
807 i_grp=''
808 i_ieeefp=''
809 i_inttypes=''
810 i_langinfo=''
811 i_libutil=''
812 i_limits=''
813 i_locale=''
814 i_machcthr=''
815 i_malloc=''
816 i_math=''
817 i_memory=''
818 i_mntent=''
819 i_ndbm=''
820 i_netdb=''
821 i_neterrno=''
822 i_netinettcp=''
823 i_niin=''
824 i_sysin=''
825 i_poll=''
826 i_prot=''
827 i_pthread=''
828 d_pwage=''
829 d_pwchange=''
830 d_pwclass=''
831 d_pwcomment=''
832 d_pwexpire=''
833 d_pwgecos=''
834 d_pwpasswd=''
835 d_pwquota=''
836 i_pwd=''
837 i_sfio=''
838 i_shadow=''
839 i_socks=''
840 i_stddef=''
841 i_stdlib=''
842 i_string=''
843 strings=''
844 i_sunmath=''
845 i_sysaccess=''
846 i_sysdir=''
847 i_sysfile=''
848 d_voidtty=''
849 i_bsdioctl=''
850 i_sysfilio=''
851 i_sysioctl=''
852 i_syssockio=''
853 i_syslog=''
854 i_sysmman=''
855 i_sysmode=''
856 i_sysmount=''
857 i_sysndir=''
858 i_sysparam=''
859 i_sysresrc=''
860 i_syssecrt=''
861 i_sysselct=''
862 i_sysstat=''
863 i_sysstatfs=''
864 i_sysstatvfs=''
865 i_systimes=''
866 i_systypes=''
867 i_sysuio=''
868 i_sysun=''
869 i_sysutsname=''
870 i_sysvfs=''
871 i_syswait=''
872 i_sgtty=''
873 i_termio=''
874 i_termios=''
875 d_tm_tm_gmtoff=''
876 d_tm_tm_zone=''
877 i_systime=''
878 i_systimek=''
879 i_time=''
880 timeincl=''
881 i_unistd=''
882 i_ustat=''
883 i_utime=''
884 i_values=''
885 i_stdarg=''
886 i_varargs=''
887 i_varhdr=''
888 i_vfork=''
889 inc_version_list=''
890 inc_version_list_init=''
891 installprefix=''
892 installprefixexp=''
893 installstyle=''
894 installusrbinperl=''
895 intsize=''
896 longsize=''
897 shortsize=''
898 issymlink=''
899 libc=''
900 ldlibpthname=''
901 libperl=''
902 shrpenv=''
903 useshrplib=''
904 glibpth=''
905 libpth=''
906 loclibpth=''
907 plibpth=''
908 xlibpth=''
909 ignore_versioned_solibs=''
910 libs=''
911 libsdirs=''
912 libsfiles=''
913 libsfound=''
914 libspath=''
915 lns=''
916 d_PRIEUldbl=''
917 d_PRIFUldbl=''
918 d_PRIGUldbl=''
919 d_PRIeldbl=''
920 d_PRIfldbl=''
921 d_PRIgldbl=''
922 d_SCNfldbl=''
923 sPRIEUldbl=''
924 sPRIFUldbl=''
925 sPRIGUldbl=''
926 sPRIeldbl=''
927 sPRIfldbl=''
928 sPRIgldbl=''
929 sSCNfldbl=''
930 lseeksize=''
931 lseektype=''
932 make_set_make=''
933 d_mymalloc=''
934 freetype=''
935 mallocobj=''
936 mallocsrc=''
937 malloctype=''
938 usemymalloc=''
939 installman1dir=''
940 man1dir=''
941 man1direxp=''
942 man1ext=''
943 installman3dir=''
944 man3dir=''
945 man3direxp=''
946 man3ext=''
947 modetype=''
948 multiarch=''
949 mydomain=''
950 myhostname=''
951 phostname=''
952 c=''
953 n=''
954 d_eofnblk=''
955 eagain=''
956 o_nonblock=''
957 rd_nodata=''
958 need_va_copy=''
959 netdb_hlen_type=''
960 netdb_host_type=''
961 netdb_name_type=''
962 netdb_net_type=''
963 groupcat=''
964 hostcat=''
965 passcat=''
966 orderlib=''
967 ranlib=''
968 d_perl_otherlibdirs=''
969 otherlibdirs=''
970 package=''
971 spackage=''
972 pager=''
973 api_revision=''
974 api_subversion=''
975 api_version=''
976 api_versionstring=''
977 patchlevel=''
978 perl_patchlevel=''
979 revision=''
980 subversion=''
981 version=''
982 version_patchlevel_string=''
983 perl5=''
984 perladmin=''
985 perlpath=''
986 d_nv_preserves_uv=''
987 i16size=''
988 i16type=''
989 i32size=''
990 i32type=''
991 i64size=''
992 i64type=''
993 i8size=''
994 i8type=''
995 ivsize=''
996 ivtype=''
997 nv_preserves_uv_bits=''
998 nvsize=''
999 nvtype=''
1000 u16size=''
1001 u16type=''
1002 u32size=''
1003 u32type=''
1004 u64size=''
1005 u64type=''
1006 u8size=''
1007 u8type=''
1008 uvsize=''
1009 uvtype=''
1010 ivdformat=''
1011 nvEUformat=''
1012 nvFUformat=''
1013 nvGUformat=''
1014 nveformat=''
1015 nvfformat=''
1016 nvgformat=''
1017 uvXUformat=''
1018 uvoformat=''
1019 uvuformat=''
1020 uvxformat=''
1021 pidtype=''
1022 prefix=''
1023 prefixexp=''
1024 installprivlib=''
1025 privlib=''
1026 privlibexp=''
1027 prototype=''
1028 ptrsize=''
1029 d_PRIXU64=''
1030 d_PRId64=''
1031 d_PRIi64=''
1032 d_PRIo64=''
1033 d_PRIu64=''
1034 d_PRIx64=''
1035 sPRIXU64=''
1036 sPRId64=''
1037 sPRIi64=''
1038 sPRIo64=''
1039 sPRIu64=''
1040 sPRIx64=''
1041 d_quad=''
1042 quadkind=''
1043 quadtype=''
1044 uquadtype=''
1045 drand01=''
1046 randbits=''
1047 randfunc=''
1048 randseedtype=''
1049 seedfunc=''
1050 installscript=''
1051 scriptdir=''
1052 scriptdirexp=''
1053 selectminbits=''
1054 selecttype=''
1055 sh=''
1056 sig_count=''
1057 sig_name=''
1058 sig_name_init=''
1059 sig_num=''
1060 sig_num_init=''
1061 sig_size=''
1062 installsitearch=''
1063 sitearch=''
1064 sitearchexp=''
1065 installsitebin=''
1066 sitebin=''
1067 sitebinexp=''
1068 installsitehtml1=''
1069 sitehtml1=''
1070 sitehtml1exp=''
1071 installsitehtml3=''
1072 sitehtml3=''
1073 sitehtml3exp=''
1074 installsitelib=''
1075 sitelib=''
1076 sitelib_stem=''
1077 sitelibexp=''
1078 installsiteman1=''
1079 siteman1=''
1080 siteman1exp=''
1081 installsiteman3=''
1082 siteman3=''
1083 siteman3exp=''
1084 siteprefix=''
1085 siteprefixexp=''
1086 installsitescript=''
1087 sitescript=''
1088 sitescriptexp=''
1089 sizesize=''
1090 sizetype=''
1091 so=''
1092 socksizetype=''
1093 sharpbang=''
1094 shsharp=''
1095 spitshell=''
1096 src=''
1097 ssizetype=''
1098 startperl=''
1099 startsh=''
1100 stdchar=''
1101 d_stdio_stream_array=''
1102 stdio_stream_array=''
1103 sysman=''
1104 trnl=''
1105 uidformat=''
1106 uidsign=''
1107 uidsize=''
1108 uidtype=''
1109 archname64=''
1110 use64bitall=''
1111 use64bitint=''
1112 ccflags_uselargefiles=''
1113 ldflags_uselargefiles=''
1114 libswanted_uselargefiles=''
1115 uselargefiles=''
1116 uselongdouble=''
1117 usemorebits=''
1118 usemultiplicity=''
1119 nm_opt=''
1120 nm_so_opt=''
1121 runnm=''
1122 usenm=''
1123 useperlio=''
1124 usesocks=''
1125 d_oldpthreads=''
1126 use5005threads=''
1127 useithreads=''
1128 usereentrant=''
1129 usethreads=''
1130 incpath=''
1131 mips_type=''
1132 usrinc=''
1133 d_vendorarch=''
1134 installvendorarch=''
1135 vendorarch=''
1136 vendorarchexp=''
1137 d_vendorbin=''
1138 installvendorbin=''
1139 vendorbin=''
1140 vendorbinexp=''
1141 installvendorhtml1=''
1142 vendorhtml1=''
1143 vendorhtml1exp=''
1144 installvendorhtml3=''
1145 vendorhtml3=''
1146 vendorhtml3exp=''
1147 d_vendorlib=''
1148 installvendorlib=''
1149 vendorlib=''
1150 vendorlib_stem=''
1151 vendorlibexp=''
1152 installvendorman1=''
1153 vendorman1=''
1154 vendorman1exp=''
1155 installvendorman3=''
1156 vendorman3=''
1157 vendorman3exp=''
1158 usevendorprefix=''
1159 vendorprefix=''
1160 vendorprefixexp=''
1161 d_vendorscript=''
1162 installvendorscript=''
1163 vendorscript=''
1164 vendorscriptexp=''
1165 versiononly=''
1166 defvoidused=''
1167 voidflags=''
1168 pm_apiversion=''
1169 xs_apiversion=''
1170 yacc=''
1171 yaccflags=''
1172 CONFIG=''
1173
1174 define='define'
1175 undef='undef'
1176 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1177 rmlist=''
1178
1179 : We must find out about Eunice early
1180 eunicefix=':'
1181 if test -f /etc/unixtovms; then
1182         eunicefix=/etc/unixtovms
1183 fi
1184 if test -f /etc/unixtovms.exe; then
1185         eunicefix=/etc/unixtovms.exe
1186 fi
1187
1188 : Set executable suffix now -- needed before hints available
1189 if test -f "/libs/version.library"; then
1190 : Amiga OS
1191     _exe=""
1192 elif test -f "/system/gnu_library/bin/ar.pm"; then
1193 : Stratus VOS
1194     _exe=".pm"
1195 elif test -n "$DJGPP"; then
1196 : DOS DJGPP
1197     _exe=".exe"
1198 elif test -d c:/. ; then
1199 : OS/2 or cygwin
1200     _exe=".exe"
1201 fi
1202
1203 i_whoami=''
1204 : Possible local include directories to search.
1205 : Set locincpth to "" in a hint file to defeat local include searches.
1206 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1207 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1208 :
1209 : no include file wanted by default
1210 inclwanted=''
1211
1212 siteman1=''
1213 siteman3=''
1214 sitescript=''
1215 : Trailing extension.  Override this in a hint file, if needed.
1216 : Extra object files, if any, needed on this platform.
1217 archobjs=''
1218 groupstype=''
1219 libnames=''
1220 : change the next line if compiling for Xenix/286 on Xenix/386
1221 xlibpth='/usr/lib/386 /lib/386'
1222 : Possible local library directories to search.
1223 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1224 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1225
1226 : general looking path for locating libraries
1227 glibpth="/lib /usr/lib $xlibpth"
1228 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1229 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1230 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1231
1232 : Private path used by Configure to find libraries.  Its value
1233 : is prepended to libpth. This variable takes care of special
1234 : machines, like the mips.  Usually, it should be empty.
1235 plibpth=''
1236
1237 : default library list
1238 libswanted=''
1239 : some systems want to use only the non-versioned libso:s
1240 ignore_versioned_solibs=''
1241 : full support for void wanted by default
1242 defvoidused=15
1243
1244 ccname=''
1245 ccversion=''
1246 perllibs=''
1247 : set useposix=false in your hint file to disable the POSIX extension.
1248 useposix=true
1249 : set useopcode=false in your hint file to disable the Opcode extension.
1250 useopcode=true
1251 archname64=''
1252 ccflags_uselargefiles=''
1253 ldflags_uselargefiles=''
1254 libswanted_uselargefiles=''
1255 : set usemultiplicity on the Configure command line to enable multiplicity.
1256 : set usesocks on the Configure command line to enable socks.
1257 archname=''
1258 : set usethreads on the Configure command line to enable threads.
1259 usereentrant='undef'
1260 : List of libraries we want.
1261 : If anyone needs -lnet, put it in a hint file.
1262 libswanted='sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl'
1263 libswanted="$libswanted dld ld sun m c cposix posix"
1264 libswanted="$libswanted ndir dir crypt sec"
1265 libswanted="$libswanted ucb bsd BSD PW x util rt posix4"
1266 : We probably want to search /usr/shlib before most other libraries.
1267 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1268 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1269 glibpth="/usr/shlib $glibpth"
1270 : Do not use vfork unless overridden by a hint file.
1271 usevfork=false
1272
1273 : Find the basic shell for Bourne shell scripts
1274 case "$sh" in
1275 '')
1276         case "$SYSTYPE" in
1277         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1278         *) xxx='/bin/sh';;
1279         esac
1280         if test -f "$xxx"; then
1281                 sh="$xxx"
1282         else
1283                 : Build up a list and do a single loop so we can 'break' out.
1284                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1285                 for xxx in sh bash ksh pdksh ash; do
1286                         for p in $pth; do
1287                                 try="$try ${p}/${xxx}"
1288                         done
1289                 done
1290                 for xxx in $try; do
1291                         if test -f "$xxx"; then
1292                                 sh="$xxx";
1293                                 break
1294                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1295                                 sh="$xxx";
1296                                 break
1297                         elif test -f "$xxx.exe"; then
1298                                 sh="$xxx";
1299                                 break
1300                         fi
1301                 done
1302         fi
1303         ;;
1304 esac
1305
1306 case "$sh" in
1307 '')     cat >&2 <<EOM
1308 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1309
1310 Usually it's in /bin/sh.  How did you even get this far?
1311 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1312 we'll try to straighten this all out.
1313 EOM
1314         exit 1
1315         ;;
1316 esac
1317
1318 : see if sh knows # comments
1319 if `$sh -c '#' >/dev/null 2>&1`; then
1320         shsharp=true
1321         spitshell=cat
1322         xcat=/bin/cat
1323         test -f $xcat$_exe || xcat=/usr/bin/cat
1324         if test ! -f $xcat$_exe; then
1325                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1326                         if test -f $p/cat$_exe; then
1327                                 xcat=$p/cat
1328                                 break
1329                         fi
1330                 done
1331                 if test ! -f $xcat$_exe; then
1332                         echo "Can't find cat anywhere!"
1333                         exit 1
1334                 fi
1335         fi
1336         echo "#!$xcat" >sharp
1337         $eunicefix sharp
1338         chmod +x sharp
1339         ./sharp > today
1340         if test -s today; then
1341                 sharpbang='#!'
1342         else
1343                 echo "#! $xcat" > sharp
1344                 $eunicefix sharp
1345                 chmod +x sharp
1346                 ./sharp > today
1347                 if test -s today; then
1348                         sharpbang='#! '
1349                 else
1350                         sharpbang=': use '
1351                 fi
1352         fi
1353 else
1354         echo " "
1355         echo "Your $sh doesn't grok # comments--I will strip them later on."
1356         shsharp=false
1357         cd ..
1358         echo "exec grep -v '^[  ]*#'" >spitshell
1359         chmod +x spitshell
1360         $eunicefix spitshell
1361         spitshell=`pwd`/spitshell
1362         cd UU
1363         echo "I presume that if # doesn't work, #! won't work either!"
1364         sharpbang=': use '
1365 fi
1366 rm -f sharp today
1367
1368 : figure out how to guarantee sh startup
1369 case "$startsh" in
1370 '') startsh=${sharpbang}${sh} ;;
1371 *)
1372 esac
1373 cat >sharp <<EOSS
1374 $startsh
1375 set abc
1376 test "$?abc" != 1
1377 EOSS
1378
1379 chmod +x sharp
1380 $eunicefix sharp
1381 if ./sharp; then
1382         : echo "Yup, it does."
1383 else
1384         echo "Hmm... '$startsh' does not guarantee sh startup..."
1385         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1386 fi
1387 rm -f sharp
1388
1389
1390 : Save command line options in file UU/cmdline.opt for later use in
1391 : generating config.sh.
1392 cat > cmdline.opt <<EOSH
1393 # Configure command line arguments.
1394 config_arg0='$0'
1395 config_args='$*'
1396 config_argc=$#
1397 EOSH
1398 argn=1
1399 args_exp=''
1400 args_sep=''
1401 for arg in "$@"; do
1402         cat >>cmdline.opt <<EOSH
1403 config_arg$argn='$arg'
1404 EOSH
1405         # Extreme backslashitis: replace each ' by '"'"'
1406         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1407 $arg
1408 EOC
1409         arg_exp=`cat cmdl.opt`
1410         args_exp="$args_exp$args_sep'$arg_exp'"
1411         argn=`expr $argn + 1`
1412         args_sep=' '
1413 done
1414 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1415 # used by ./hints/os2.sh
1416 rm -f cmdl.opt
1417
1418 : produce awk script to parse command line options
1419 cat >options.awk <<'EOF'
1420 BEGIN {
1421         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1422
1423         len = length(optstr);
1424         for (i = 1; i <= len; i++) {
1425                 c = substr(optstr, i, 1);
1426                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1427                 if (a == ":") {
1428                         arg[c] = 1;
1429                         i++;
1430                 }
1431                 opt[c] = 1;
1432         }
1433 }
1434 {
1435         expect = 0;
1436         str = $0;
1437         if (substr(str, 1, 1) != "-") {
1438                 printf("'%s'\n", str);
1439                 next;
1440         }
1441         len = length($0);
1442         for (i = 2; i <= len; i++) {
1443                 c = substr(str, i, 1);
1444                 if (!opt[c]) {
1445                         printf("-%s\n", substr(str, i));
1446                         next;
1447                 }
1448                 printf("-%s\n", c);
1449                 if (arg[c]) {
1450                         if (i < len)
1451                                 printf("'%s'\n", substr(str, i + 1));
1452                         else
1453                                 expect = 1;
1454                         next;
1455                 }
1456         }
1457 }
1458 END {
1459         if (expect)
1460                 print "?";
1461 }
1462 EOF
1463
1464 : process the command line options
1465 set X `for arg in "$@"; do echo "X$arg"; done |
1466         sed -e s/X// | awk -f options.awk`
1467 eval "set $*"
1468 shift
1469 rm -f options.awk
1470
1471 : set up default values
1472 fastread=''
1473 reuseval=false
1474 config_sh=''
1475 alldone=''
1476 error=''
1477 silent=''
1478 extractsh=''
1479 override=''
1480 knowitall=''
1481 rm -f optdef.sh posthint.sh
1482 cat >optdef.sh <<EOS
1483 $startsh
1484 EOS
1485
1486
1487 : option parsing
1488 while test $# -gt 0; do
1489         case "$1" in
1490         -d) shift; fastread=yes;;
1491         -e) shift; alldone=cont;;
1492         -f)
1493                 shift
1494                 cd ..
1495                 if test -r "$1"; then
1496                         config_sh="$1"
1497                 else
1498                         echo "$me: cannot read config file $1." >&2
1499                         error=true
1500                 fi
1501                 cd UU
1502                 shift;;
1503         -h) shift; error=true;;
1504         -r) shift; reuseval=true;;
1505         -s) shift; silent=true; realsilent=true;;
1506         -E) shift; alldone=exit;;
1507         -K) shift; knowitall=true;;
1508         -O) shift; override=true;;
1509         -S) shift; silent=true; extractsh=true;;
1510         -D)
1511                 shift
1512                 case "$1" in
1513                 *=)
1514                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1515                         echo "$me: ignoring -D $1" >&2
1516                         ;;
1517                 *=*) echo "$1" | \
1518                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1519                 *) echo "$1='define'" >> optdef.sh;;
1520                 esac
1521                 shift
1522                 ;;
1523         -U)
1524                 shift
1525                 case "$1" in
1526                 *=) echo "$1" >> optdef.sh;;
1527                 *=*)
1528                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1529                         echo "$me: ignoring -U $1" >&2
1530                         ;;
1531                 *) echo "$1='undef'" >> optdef.sh;;
1532                 esac
1533                 shift
1534                 ;;
1535         -A)
1536             shift
1537             xxx=''
1538             yyy="$1"
1539             zzz=''
1540             uuu=undef
1541             case "$yyy" in
1542             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1543                  case "$zzz" in
1544                  *:*) zzz='' ;;
1545                  *)   xxx=append
1546                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1547                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1548                  esac
1549                  ;;
1550             esac
1551             case "$xxx" in
1552             '')  case "$yyy" in
1553                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1554                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1555                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1556                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1557                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1558                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1559                  esac
1560                  ;;       
1561             esac
1562             case "$xxx" in
1563             append)
1564                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1565             clear)
1566                 echo "$yyy=''"                  >> posthint.sh ;;
1567             define)
1568                 case "$zzz" in
1569                 '') zzz=define ;;
1570                 esac
1571                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1572             eval)
1573                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1574             prepend)
1575                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1576             undef)
1577                 case "$zzz" in
1578                 '') zzz="$uuu" ;;
1579                 esac
1580                 echo "$yyy=$zzz"                >> posthint.sh ;;
1581             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1582             esac
1583             shift
1584             ;;
1585         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1586             exit 0;;
1587         --) break;;
1588         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1589         *) break;;
1590         esac
1591 done
1592
1593 case "$error" in
1594 true)
1595         cat >&2 <<EOM
1596 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1597                  [-U symbol] [-U symbol=] [-A command:symbol...]
1598   -d : use defaults for all answers.
1599   -e : go on without questioning past the production of config.sh.
1600   -f : specify an alternate default configuration file.
1601   -h : print this help message and exit (with an error status).
1602   -r : reuse C symbols value if possible (skips costly nm extraction).
1603   -s : silent mode, only echoes questions and essential information.
1604   -D : define symbol to have some value:
1605          -D symbol         symbol gets the value 'define'
1606          -D symbol=value   symbol gets the value 'value'
1607   -E : stop at the end of questions, after having produced config.sh.
1608   -K : do not use unless you know what you are doing.
1609   -O : let -D and -U override definitions from loaded configuration file.
1610   -S : perform variable substitutions on all .SH files (can mix with -f)
1611   -U : undefine symbol:
1612          -U symbol    symbol gets the value 'undef'
1613          -U symbol=   symbol gets completely empty
1614   -A : manipulate symbol after the platform specific hints have been applied:
1615          -A symbol=value                append " "value to symbol
1616          -A append:symbol=value         append value to symbol
1617          -A define:symbol=value         define symbol to have value
1618          -A clear:symbol                define symbol to be ''
1619          -A define:symbol               define symbol to be 'define'
1620          -A eval:symbol=value           define symbol to be eval of value
1621          -A prepend:symbol=value        prepend value to symbol
1622          -A undef:symbol                define symbol to be 'undef'
1623          -A undef:symbol=               define symbol to be ''
1624   -V : print version number and exit (with a zero status).
1625 EOM
1626         exit 1
1627         ;;
1628 esac
1629
1630 : Sanity checks
1631 case "$fastread$alldone" in
1632 yescont|yesexit) ;;
1633 *)
1634         case "$extractsh" in
1635         true) ;;
1636         *)
1637                 if test ! -t 0; then
1638                         echo "Say 'sh Configure', not 'sh <Configure'"
1639                         exit 1
1640                 fi
1641                 ;;
1642         esac
1643         ;;
1644 esac
1645
1646 exec 4>&1
1647 case "$silent" in
1648 true) exec 1>/dev/null;;
1649 esac
1650
1651 : run the defines and the undefines, if any, but leave the file out there...
1652 touch optdef.sh
1653 . ./optdef.sh
1654 : create the posthint manipulation script and leave the file out there...
1655 touch posthint.sh
1656
1657 : set package name
1658 package=perl5
1659 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1660 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1661 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1662 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1663 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1664 esac
1665
1666 : Some greps do not return status, grrr.
1667 echo "grimblepritz" >grimble
1668 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1669         contains=contains
1670 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1671         contains=grep
1672 else
1673         contains=contains
1674 fi
1675 rm -f grimble
1676 : the following should work in any shell
1677 case "$contains" in
1678 contains*)
1679         echo " "
1680         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1681         cat >contains <<'EOSS'
1682 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1683 EOSS
1684 chmod +x contains
1685 esac
1686
1687 : Find the path to the source tree
1688 case "$src" in
1689 '') case "$0" in
1690     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1691          case "$src" in
1692          /*)    ;;
1693          .)     ;;
1694          *)     src=`cd ../$src && pwd` ;;
1695          esac
1696          ;;
1697     *)   src='.';;
1698     esac;;
1699 esac
1700 case "$src" in
1701 '')     src=/
1702         rsrc=/
1703         ;;
1704 /*) rsrc="$src";;
1705 *) rsrc="../$src";;
1706 esac
1707 if test -f $rsrc/Configure && \
1708         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1709 then
1710    : found it, so we are ok.
1711 else
1712         rsrc=''
1713         for src in . .. ../.. ../../.. ../../../..; do
1714                 if test -f ../$src/Configure && \
1715                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1716                 then
1717                         rsrc=../$src
1718                         break
1719                 fi
1720         done
1721 fi
1722 case "$rsrc" in
1723 '')
1724         cat <<EOM >&4
1725
1726 Sorry, I can't seem to locate the source dir for $package.  Please start
1727 Configure with an explicit path -- i.e. /some/path/Configure.
1728
1729 EOM
1730         exit 1
1731         ;;
1732 ../.)   rsrc='..';;
1733 *)
1734         echo " "
1735         echo "Sources for $package found in \"$src\"." >&4
1736         ;;
1737 esac
1738
1739 : script used to extract .SH files with variable substitutions
1740 cat >extract <<'EOS'
1741 PERL_CONFIG_SH=true
1742 echo "Doing variable substitutions on .SH files..."
1743 if test -f MANIFEST; then
1744         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1745 else
1746         echo "(Looking for .SH files under the source directory.)"
1747         set x `(cd "$src"; find . -name "*.SH" -print)`
1748 fi
1749 shift
1750 case $# in
1751 0) set x `(cd "$src"; echo *.SH)`; shift;;
1752 esac
1753 if test ! -f "$src/$1"; then
1754         shift
1755 fi
1756 mkdir_p='
1757 name=$1;
1758 create="";
1759 while test $name; do
1760         if test ! -d "$name"; then
1761                 create="$name $create";
1762                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1763                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1764         else
1765                 name="";
1766         fi;
1767 done;
1768 for file in $create; do
1769         mkdir $file;
1770 done
1771 '
1772 for file in $*; do
1773         case "$src" in
1774         ".")
1775                 case "$file" in
1776                 */*)
1777                         dir=`expr X$file : 'X\(.*\)/'`
1778                         file=`expr X$file : 'X.*/\(.*\)'`
1779                         (cd "$dir" && . ./$file)
1780                         ;;
1781                 *)
1782                         . ./$file
1783                         ;;
1784                 esac
1785                 ;;
1786         *)
1787                 case "$file" in
1788                 */*)
1789                         dir=`expr X$file : 'X\(.*\)/'`
1790                         file=`expr X$file : 'X.*/\(.*\)'`
1791                         (set x $dir; shift; eval $mkdir_p)
1792                         sh <"$src/$dir/$file"
1793                         ;;
1794                 *)
1795                         sh <"$src/$file"
1796                         ;;
1797                 esac
1798                 ;;
1799         esac
1800 done
1801 if test -f "$src/config_h.SH"; then
1802         if test ! -f config.h; then
1803         : oops, they left it out of MANIFEST, probably, so do it anyway.
1804         . "$src/config_h.SH"
1805         fi
1806 fi
1807 EOS
1808
1809 : extract files and exit if asked to do so
1810 case "$extractsh" in
1811 true)
1812         case "$realsilent" in
1813         true) ;;
1814         *) exec 1>&4;;
1815         esac
1816         case "$config_sh" in
1817         '') config_sh='config.sh';;
1818         esac
1819         echo " "
1820         echo "Fetching answers from $config_sh..."
1821         cd ..
1822         . $config_sh
1823         test "$override" && . ./optdef.sh
1824         echo " "
1825         . UU/extract
1826         rm -rf UU
1827         echo "Extraction done."
1828         exit 0
1829         ;;
1830 esac
1831
1832 : Eunice requires " " instead of "", can you believe it
1833 echo " "
1834 : Here we go...
1835 echo "Beginning of configuration questions for $package."
1836
1837 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1838
1839 : first determine how to suppress newline on echo command
1840 echo " "
1841 echo "Checking echo to see how to suppress newlines..."
1842 (echo "hi there\c" ; echo " ") >.echotmp
1843 if $contains c .echotmp >/dev/null 2>&1 ; then
1844         echo "...using -n."
1845         n='-n'
1846         c=''
1847 else
1848         cat <<'EOM'
1849 ...using \c
1850 EOM
1851         n=''
1852         c='\c'
1853 fi
1854 echo $n "The star should be here-->$c"
1855 echo '*'
1856 rm -f .echotmp
1857
1858 : Now test for existence of everything in MANIFEST
1859 echo " "
1860 if test -f "$rsrc/MANIFEST"; then
1861         echo "First let's make sure your kit is complete.  Checking..." >&4
1862         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1863         rm -f missing
1864         tmppwd=`pwd`
1865         for filelist in x??; do
1866                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1867         done
1868         if test -s missing; then
1869                 cat missing >&4
1870                 cat >&4 <<'EOM'
1871
1872 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1873
1874 You have the option of continuing the configuration process, despite the
1875 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1876 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1877 and contact the author (perlbug@perl.org).
1878
1879 EOM
1880                 echo $n "Continue? [n] $c" >&4
1881                 read ans
1882                 case "$ans" in
1883                 y*)
1884                         echo "Continuing..." >&4
1885                         rm -f missing
1886                         ;;
1887                 *)
1888                         echo "ABORTING..." >&4
1889                         kill $$
1890                         ;;
1891                 esac
1892         else
1893                 echo "Looks good..."
1894         fi
1895 else
1896         echo "There is no MANIFEST file.  I hope your kit is complete !"
1897 fi
1898 rm -f missing x??
1899
1900 echo " "
1901 : Find the appropriate value for a newline for tr
1902 if test -n "$DJGPP"; then
1903        trnl='\012'
1904 fi
1905 if test X"$trnl" = X; then
1906         case "`echo foo|tr '\n' x 2>/dev/null`" in
1907         foox) trnl='\n' ;;
1908         esac
1909 fi
1910 if test X"$trnl" = X; then
1911         case "`echo foo|tr '\012' x 2>/dev/null`" in
1912         foox) trnl='\012' ;;
1913         esac
1914 fi
1915 if test X"$trnl" = X; then
1916        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1917        fooxy) trnl='\n\r' ;;
1918        esac
1919 fi
1920 if test X"$trnl" = X; then
1921         cat <<EOM >&2
1922
1923 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1924
1925 EOM
1926         exit 1
1927 fi
1928
1929 : compute the number of columns on the terminal for proper question formatting
1930 case "$COLUMNS" in
1931 '') COLUMNS='80';;
1932 esac
1933
1934 : set up the echo used in my read
1935 myecho="case \"\$xxxm\" in
1936 '') echo $n \"\$rp $c\" >&4;;
1937 *) case \"\$rp\" in
1938         '') echo $n \"[\$xxxm] $c\";;
1939         *)
1940                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1941                         echo \"\$rp\" >&4
1942                         echo $n \"[\$xxxm] $c\" >&4
1943                 else
1944                         echo $n \"\$rp [\$xxxm] $c\" >&4
1945                 fi
1946                 ;;
1947         esac;;
1948 esac"
1949
1950 : now set up to do reads with possible shell escape and default assignment
1951 cat <<EOSC >myread
1952 $startsh
1953 xxxm=\$dflt
1954 $myecho
1955 ans='!'
1956 case "\$fastread" in
1957 yes) case "\$dflt" in
1958         '') ;;
1959         *) ans='';
1960                 case "\$silent-\$rp" in
1961                 true-) ;;
1962                 *) echo " " >&4;;
1963                 esac;;
1964         esac;;
1965 *) case "\$silent" in
1966         true) case "\$rp" in
1967                 '') ans='';;
1968                 esac;;
1969         esac;;
1970 esac
1971 while expr "X\$ans" : "X!" >/dev/null; do
1972         read answ
1973         set x \$xxxm
1974         shift
1975         aok=''; eval "ans=\\"\$answ\\"" && aok=y
1976         case  "\$answ" in
1977         "!")
1978                 sh 1>&4
1979                 echo " "
1980                 $myecho
1981                 ;;
1982         !*)
1983                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
1984                 shift
1985                 sh 1>&4 -c "\$*"
1986                 echo " "
1987                 $myecho
1988                 ;;
1989         "\$ans")
1990                 case "\$ans" in
1991                 \\&*)
1992                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
1993                         shift
1994                         case "\$1" in
1995                         -d)
1996                                 fastread=yes
1997                                 echo "(OK, I'll run with -d after this question.)" >&4
1998                                 ;;
1999                         -*)
2000                                 echo "*** Sorry, \$1 not supported yet." >&4
2001                                 ;;
2002                         esac
2003                         $myecho
2004                         ans=!
2005                         ;;
2006                 esac;;
2007         *)
2008                 case "\$aok" in
2009                 y)
2010                         echo "*** Substitution done -- please confirm."
2011                         xxxm="\$ans"
2012                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2013                         xxxm="\$ans"
2014                         ans=!
2015                         ;;
2016                 *)
2017                         echo "*** Error -- try again."
2018                         ans=!
2019                         ;;
2020                 esac
2021                 $myecho
2022                 ;;
2023         esac
2024         case "\$ans\$xxxm\$nostick" in
2025         '')
2026                 ans=!
2027                 $myecho
2028                 ;;
2029         esac
2030 done
2031 case "\$ans" in
2032 '') ans="\$xxxm";;
2033 esac
2034 EOSC
2035
2036 : create .config dir to save info across Configure sessions
2037 test -d ../.config || mkdir ../.config
2038 cat >../.config/README <<EOF
2039 This directory created by Configure to save information that should
2040 persist across sessions for $package.
2041
2042 You may safely delete it if you wish.
2043 EOF
2044
2045 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2046 case "$usedevel" in
2047 $define|true|[yY]*) ;;
2048 *) case "$xversion" in
2049    *[13579])
2050         cat >&4 <<EOH
2051 *** WHOA THERE!!! ***
2052
2053     This is an UNSTABLE DEVELOPMENT release.
2054     The version of this $package distribution is $xversion, that is, odd,
2055     (as opposed to even) and that signifies a development release.
2056     If you want a maintenance release, you want an even-numbered version.
2057
2058     Do ***NOT*** install this into production use.
2059     Data corruption and crashes are possible.
2060
2061     It is most seriously suggested that you do not continue any further
2062     unless you want to help in developing and debugging Perl.
2063
2064     If you *still* want to build perl, you can answer 'y' now,
2065     or pass -Dusedevel to Configure.
2066
2067 EOH
2068         rp='Do you really want to continue?'
2069         dflt='n'
2070         . ./myread
2071         case "$ans" in
2072         [yY]) echo >&4 "Okay, continuing."
2073               usedevel="$define" ;;
2074         *) echo >&4 "Okay, bye."
2075            exit 1
2076            ;;
2077         esac
2078         ;;
2079     esac
2080     ;;
2081 esac
2082 case "$usedevel" in
2083 $define|true|[yY]*)
2084         case "$versiononly" in
2085         '') versiononly="$define" ;;
2086         esac
2087         case "$installusrbinperl" in
2088         '') installusrbinperl="$undef" ;;
2089         esac
2090         ;;
2091 esac
2092
2093 : general instructions
2094 needman=true
2095 firsttime=true
2096 user=`(logname) 2>/dev/null`
2097 case "$user" in
2098 '') user=`whoami 2>&1`;;
2099 esac
2100 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2101         firsttime=false
2102         echo " "
2103         rp='Would you like to see the instructions?'
2104         dflt=n
2105         . ./myread
2106         case "$ans" in
2107         [yY]*) ;;
2108         *) needman=false;;
2109         esac
2110 fi
2111 if $needman; then
2112         cat <<EOH
2113
2114 This installation shell script will examine your system and ask you questions
2115 to determine how the perl5 package should be installed. If you get
2116 stuck on a question, you may use a ! shell escape to start a subshell or
2117 execute a command.  Many of the questions will have default answers in square
2118 brackets; typing carriage return will give you the default.
2119
2120 On some of the questions which ask for file or directory names you are allowed
2121 to use the ~name construct to specify the login directory belonging to "name",
2122 even if you don't have a shell which knows about that.  Questions where this is
2123 allowed will be marked "(~name ok)".
2124
2125 EOH
2126         rp=''
2127         dflt='Type carriage return to continue'
2128         . ./myread
2129         cat <<'EOH'
2130
2131 The prompter used in this script allows you to use shell variables and
2132 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2133 in the default answer, as if the default line was a set of arguments given to a
2134 script shell.  This means you may also use $* to repeat the whole default line,
2135 so you do not have to re-type everything to add something to the default.
2136
2137 Everytime there is a substitution, you will have to confirm.  If there is an
2138 error (e.g. an unmatched backtick), the default answer will remain unchanged
2139 and you will be prompted again.
2140
2141 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2142 the questions and use the computed defaults (or the previous answers if there
2143 was already a config.sh file). Type 'Configure -h' for a list of options.
2144 You may also start interactively and then answer '& -d' at any prompt to turn
2145 on the non-interactive behaviour for the remainder of the execution.
2146
2147 EOH
2148         . ./myread
2149         cat <<EOH
2150
2151 Much effort has been expended to ensure that this shell script will run on any
2152 Unix system.  If despite that it blows up on yours, your best bet is to edit
2153 Configure and run it again.  If you can't run Configure for some reason,
2154 you'll have to generate a config.sh file by hand.  Whatever problems you
2155 have, let me (perlbug@perl.org) know how I blew it.
2156
2157 This installation script affects things in two ways:
2158
2159 1) it may do direct variable substitutions on some of the files included
2160    in this kit.
2161 2) it builds a config.h file for inclusion in C programs.  You may edit
2162    any of these files as the need arises after running this script.
2163
2164 If you make a mistake on a question, there is no easy way to back up to it
2165 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2166 files.  Configure will offer to let you do this before it runs the SH files.
2167
2168 EOH
2169         dflt='Type carriage return to continue'
2170         . ./myread
2171         case "$firsttime" in
2172         true) echo $user >>../.config/instruct;;
2173         esac
2174 fi
2175
2176 : find out where common programs are
2177 echo " "
2178 echo "Locating common programs..." >&4
2179 cat <<EOSC >loc
2180 $startsh
2181 case \$# in
2182 0) exit 1;;
2183 esac
2184 thing=\$1
2185 shift
2186 dflt=\$1
2187 shift
2188 for dir in \$*; do
2189         case "\$thing" in
2190         .)
2191         if test -d \$dir/\$thing; then
2192                 echo \$dir
2193                 exit 0
2194         fi
2195         ;;
2196         *)
2197         for thisthing in \$dir/\$thing; do
2198                 : just loop through to pick last item
2199         done
2200         if test -f \$thisthing; then
2201                 echo \$thisthing
2202                 exit 0
2203         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2204                 echo \$thisthing
2205                 exit 0
2206         elif test -f \$dir/\$thing.exe; then
2207                 if test -n "$DJGPP"; then
2208                         echo \$dir/\$thing.exe
2209                 elif test "$eunicefix" != ":"; then
2210                         : on Eunice apparently
2211                         echo \$dir/\$thing
2212                         exit 0
2213                 fi
2214                 exit 0
2215         fi
2216         ;;
2217         esac
2218 done
2219 echo \$dflt
2220 exit 1
2221 EOSC
2222 chmod +x loc
2223 $eunicefix loc
2224 loclist="
2225 awk
2226 cat
2227 chmod
2228 comm
2229 cp
2230 echo
2231 expr
2232 grep
2233 ls
2234 mkdir
2235 rm
2236 sed
2237 sort
2238 touch
2239 tr
2240 uniq
2241 "
2242 trylist="
2243 Mcc
2244 ar
2245 bison
2246 byacc
2247 cpp
2248 csh
2249 date
2250 egrep
2251 gmake
2252 gzip
2253 less
2254 ln
2255 make
2256 more
2257 nm
2258 nroff
2259 pg
2260 test
2261 uname
2262 zip
2263 "
2264 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2265 pth="$pth /lib /usr/lib"
2266 for file in $loclist; do
2267         eval xxx=\$$file
2268         case "$xxx" in
2269         /*|?:[\\/]*)
2270                 if test -f "$xxx"; then
2271                         : ok
2272                 else
2273                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2274                         xxx=`./loc $file $file $pth`
2275                 fi
2276                 ;;
2277         '') xxx=`./loc $file $file $pth`;;
2278         *) xxx=`./loc $xxx $xxx $pth`;;
2279         esac
2280         eval $file=$xxx$_exe
2281         eval _$file=$xxx
2282         case "$xxx" in
2283         /*)
2284                 echo $file is in $xxx.
2285                 ;;
2286         ?:[\\/]*)
2287                 echo $file is in $xxx.
2288                 ;;
2289         *)
2290                 echo "I don't know where '$file' is, and my life depends on it." >&4
2291                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2292                 exit 1
2293                 ;;
2294         esac
2295 done
2296 echo " "
2297 echo "Don't worry if any of the following aren't found..."
2298 say=offhand
2299 for file in $trylist; do
2300         eval xxx=\$$file
2301         case "$xxx" in
2302         /*|?:[\\/]*)
2303                 if test -f "$xxx"; then
2304                         : ok
2305                 else
2306                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2307                         xxx=`./loc $file $file $pth`
2308                 fi
2309                 ;;
2310         '') xxx=`./loc $file $file $pth`;;
2311         *) xxx=`./loc $xxx $xxx $pth`;;
2312         esac
2313         eval $file=$xxx$_exe
2314         eval _$file=$xxx
2315         case "$xxx" in
2316         /*)
2317                 echo $file is in $xxx.
2318                 ;;
2319         ?:[\\/]*)
2320                 echo $file is in $xxx.
2321                 ;;
2322         *)
2323                 echo "I don't see $file out there, $say."
2324                 say=either
2325                 ;;
2326         esac
2327 done
2328 case "$egrep" in
2329 egrep)
2330         echo "Substituting grep for egrep."
2331         egrep=$grep
2332         _egrep=$grep
2333         ;;
2334 esac
2335 case "$ln" in
2336 ln)
2337         echo "Substituting cp for ln."
2338         ln=$cp
2339         _ln=$cp
2340         ;;
2341 esac
2342 case "$make" in
2343 make)   
2344         case "$gmake" in
2345         gmake)
2346         echo "I can't find make or gmake, and my life depends on it." >&4
2347         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2348         exit 1
2349         ;;
2350         esac
2351         ;;
2352 esac    
2353 case "$gmake" in
2354 gmake)  ;;
2355 *)      # We can't have osname yet.
2356         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2357                 # Assume that gmake, if found, is definitely GNU make
2358                 # and prefer it over the system make.
2359                 echo "Substituting gmake for make."
2360                 make=$gmake
2361                 _make=$gmake
2362         fi
2363         ;;
2364 esac
2365 case "$test" in
2366 test)
2367         echo "Hopefully test is built into your sh."
2368         ;;
2369 *)
2370         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2371                 echo "Using the test built into your sh."
2372                 test=test
2373                 _test=test
2374         fi
2375         ;;
2376 esac
2377 case "$echo" in
2378 echo)
2379         echo "Hopefully echo is built into your sh."
2380         ;;
2381 '') ;;
2382 *)
2383         echo " "
2384 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2385         $echo $n "hi there$c" >foo1
2386         echo $n "hi there$c" >foo2
2387         if cmp foo1 foo2 >/dev/null 2>&1; then
2388                 echo "They are compatible.  In fact, they may be identical."
2389         else
2390                 case "$n" in
2391                 '-n') n='' c='\c';;
2392                 *) n='-n' c='';;
2393                 esac
2394                 cat <<FOO
2395 They are not compatible!  You are probably running ksh on a non-USG system.
2396 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2397 have echo built in and we may have to run some Bourne shell scripts.  That
2398 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2399
2400 FOO
2401                 $echo $n "The star should be here-->$c"
2402                 $echo "*"
2403         fi
2404         $rm -f foo1 foo2
2405         ;;
2406 esac
2407
2408 cat <<EOS >trygcc
2409 $startsh
2410 EOS
2411 cat <<'EOSC' >>trygcc
2412 case "$cc" in
2413 '') ;;
2414 *)  $rm -f try try.*
2415     $cat >try.c <<EOM
2416 int main(int argc, char *argv[]) {
2417   return 0;
2418 }
2419 EOM
2420     if $cc -o try $ccflags $ldflags try.c; then
2421        :
2422     else
2423         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2424         despair=yes
2425         trygcc=yes
2426         case "$cc" in
2427         *gcc*) trygcc=no ;;
2428         esac
2429         case "`$cc -v -c try.c 2>&1`" in
2430         *gcc*) trygcc=no ;;
2431         esac
2432         if $test X"$trygcc" = Xyes; then
2433             if gcc -o try -c try.c; then
2434                 echo " "
2435                 echo "You seem to have a working gcc, though." >&4
2436                 rp="Would you like to use it?"
2437                 dflt=y
2438                 if $test -f myread; then
2439                     . ./myread
2440                 else
2441                     if $test -f UU/myread; then
2442                         . ./UU/myread
2443                     else
2444                         echo "Cannot find myread, sorry.  Aborting." >&2
2445                         exit 1
2446                     fi
2447                 fi  
2448                 case "$ans" in
2449                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2450                        if $test -f usethreads.cbu; then
2451                            $cat >&4 <<EOM 
2452
2453 *** However, any setting of the C compiler flags (e.g. for thread support)
2454 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2455 *** (together with e.g. -Dusethreads).
2456
2457 EOM
2458                        fi;;
2459                 esac
2460             fi
2461         fi
2462     fi
2463     $rm -f try try.*
2464     ;;
2465 esac
2466 EOSC
2467
2468 cat <<EOS >checkcc
2469 $startsh
2470 EOS
2471 cat <<'EOSC' >>checkcc
2472 case "$cc" in        
2473 '') ;;
2474 *)  $rm -f try try.*              
2475     $cat >try.c <<EOM
2476 int main(int argc, char *argv[]) {
2477   return 0;
2478 }
2479 EOM
2480     if $cc -o try $ccflags $ldflags try.c; then
2481        :
2482     else
2483         if $test X"$despair" = Xyes; then
2484            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2485         fi
2486         $cat >&4 <<EOM         
2487 You need to find a working C compiler.
2488 Either (purchase and) install the C compiler supplied by your OS vendor,
2489 or for a free C compiler try http://gcc.gnu.org/
2490 I cannot continue any further, aborting.
2491 EOM
2492         exit 1
2493     fi
2494     $rm -f try try.*
2495     ;;
2496 esac
2497 EOSC
2498
2499 : determine whether symbolic links are supported
2500 echo " "
2501 $touch blurfl
2502 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2503         echo "Symbolic links are supported." >&4
2504         lns="$ln -s"
2505 else
2506         echo "Symbolic links are NOT supported." >&4
2507         lns="$ln"
2508 fi
2509 $rm -f blurfl sym
2510
2511 : determine whether symbolic links are supported
2512 echo " "
2513 case "$lns" in
2514 *"ln"*" -s")
2515         echo "Checking how to test for symbolic links..." >&4
2516         $lns blurfl sym
2517         if $test "X$issymlink" = X; then
2518                 case "$newsh" in
2519                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2520                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2521                 esac
2522                 if test $? = 0; then
2523                         issymlink="test -h"
2524                 else
2525                         echo "Your builtin 'test -h' may be broken." >&4
2526                         case "$test" in
2527                         /*)     ;;
2528                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2529                                 for p in $pth
2530                                 do
2531                                         if test -f "$p/$test"; then
2532                                                 test="$p/$test"
2533                                                 break
2534                                         fi
2535                                 done
2536                                 ;;
2537                         esac
2538                         case "$test" in
2539                         /*)
2540                                 echo "Trying external '$test -h'." >&4
2541                                 issymlink="$test -h"
2542                                 if $test ! -h sym >/dev/null 2>&1; then
2543                                         echo "External '$test -h' is broken, too." >&4
2544                                         issymlink=''
2545                                 fi
2546                                 ;;
2547                         *)      issymlink='' ;;
2548                         esac
2549                 fi              
2550         fi
2551         if $test "X$issymlink" = X; then
2552                 if $test -L sym 2>/dev/null; then
2553                         issymlink="$test -L"
2554                         echo "The builtin '$test -L' worked." >&4
2555                 fi
2556         fi
2557         if $test "X$issymlink" != X; then
2558                 echo "You can test for symbolic links with '$issymlink'." >&4
2559         else
2560                 echo "I do not know how you can test for symbolic links." >&4
2561         fi
2562         $rm -f blurfl sym
2563         ;;
2564 *)      echo "No symbolic links, so not testing for their testing..." >&4
2565         ;;
2566 esac
2567 echo " "
2568
2569
2570 case "$mksymlinks" in
2571 $define|true|[yY]*)
2572         case "$src" in
2573         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2574                 exit 1
2575                 ;;
2576         *)      case "$lns:$issymlink" in
2577                 *"ln"*" -s:"*"test -"?)
2578                         echo "Creating the symbolic links..." >&4
2579                         echo "(First creating the subdirectories...)" >&4
2580                         cd ..
2581                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2582                                 read directory
2583                                 test -z "$directory" && break
2584                                 mkdir -p $directory
2585                         done
2586                         # Sanity check 1.
2587                         if test ! -d t/base; then
2588                                 echo "Failed to create the subdirectories.  Aborting." >&4
2589                                 exit 1
2590                         fi
2591                         echo "(Then creating the symlinks...)" >&4
2592                         awk '{print $1}' $src/MANIFEST | while true; do
2593                                 read filename
2594                                 test -z "$filename" && break
2595                                 if test -f $filename; then
2596                                         if $issymlink $filename; then
2597                                                 rm -f $filename
2598                                         fi
2599                                 fi
2600                                 if test -f $filename; then
2601                                         echo "$filename already exists, not symlinking."
2602                                 else
2603                                         ln -s $src/$filename $filename
2604                                 fi
2605                         done
2606                         # Sanity check 2.
2607                         if test ! -f t/base/lex.t; then
2608                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2609                                 exit 1
2610                         fi
2611                         cd UU
2612                         ;;
2613                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2614                         ;;
2615                 esac
2616                 ;;
2617         esac
2618         ;;
2619 esac
2620
2621
2622 case "$usecrosscompile" in
2623 $define|true|[yY]*)
2624         $echo "Cross-compiling..."
2625         croak=''
2626         case "$cc" in
2627         *-*-gcc) # A cross-compiling gcc, probably.
2628             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2629             ar=$targetarch-ar
2630             # leave out ld, choosing it is more complex
2631             nm=$targetarch-nm
2632             ranlib=$targetarch-ranlib
2633             $echo 'extern int foo;' > try.c
2634             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2635             shift
2636             if $test $# -gt 0; then
2637                 incpth="$incpth $*"
2638                 incpth="`$echo $incpth|$sed 's/^ //'`"
2639                 echo "Guessing incpth '$incpth'." >&4
2640                 for i in $*; do
2641                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2642                     if $test -d $j; then
2643                         libpth="$libpth $j"
2644                     fi
2645                 done   
2646                 libpth="`$echo $libpth|$sed 's/^ //'`"
2647                 echo "Guessing libpth '$libpth'." >&4
2648             fi
2649             $rm -f try.c
2650             ;;
2651         esac
2652         case "$targetarch" in
2653         '') echo "Targetarch not defined." >&4; croak=y ;;
2654         *)  echo "Using targetarch $targetarch." >&4 ;;
2655         esac
2656         case "$incpth" in
2657         '') echo "Incpth not defined." >&4; croak=y ;;
2658         *)  echo "Using incpth '$incpth'." >&4 ;;
2659         esac
2660         case "$libpth" in
2661         '') echo "Libpth not defined." >&4; croak=y ;;
2662         *)  echo "Using libpth '$libpth'." >&4 ;;
2663         esac
2664         case "$usrinc" in
2665         '') for i in $incpth; do
2666                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2667                     usrinc=$i
2668                     echo "Guessing usrinc $usrinc." >&4
2669                     break
2670                 fi
2671             done
2672             case "$usrinc" in
2673             '') echo "Usrinc not defined." >&4; croak=y ;;
2674             esac
2675             ;;
2676         *)  echo "Using usrinc $usrinc." >&4 ;;
2677         esac
2678         case "$targethost" in
2679         '') echo "Targethost not defined." >&4; croak=y ;;
2680         *)  echo "Using targethost $targethost." >&4
2681         esac
2682         locincpth=' '
2683         loclibpth=' '
2684         case "$croak" in
2685         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2686         esac
2687         case "$src" in
2688         /*) run=$src/Cross/run
2689             targetmkdir=$src/Cross/mkdir
2690             to=$src/Cross/to
2691             from=$src/Cross/from
2692             ;;
2693         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2694             run=$pwd/Cross/run
2695             targetmkdir=$pwd/Cross/mkdir
2696             to=$pwd/Cross/to
2697             from=$pwd/Cross/from
2698             ;;
2699         esac
2700         case "$targetrun" in
2701         '') targetrun=ssh ;;
2702         esac
2703         case "$targetto" in
2704         '') targetto=scp ;;
2705         esac
2706         case "$targetfrom" in
2707         '') targetfrom=scp ;;
2708         esac
2709         run=$run-$targetrun
2710         to=$to-$targetto
2711         from=$from-$targetfrom
2712         case "$targetdir" in
2713         '')  targetdir=/tmp
2714              echo "Guessing targetdir $targetdir." >&4
2715              ;;
2716         esac
2717         case "$targetuser" in
2718         '')  targetuser=root
2719              echo "Guessing targetuser $targetuser." >&4
2720              ;;
2721         esac
2722         case "$targetfrom" in
2723         scp)    q=-q ;;
2724         *)      q='' ;;
2725         esac
2726         case "$targetrun" in
2727         ssh|rsh)
2728             cat >$run <<EOF
2729 #!/bin/sh
2730 case "\$1" in
2731 -cwd)
2732   shift
2733   cwd=\$1
2734   shift
2735   ;;
2736 esac
2737 case "\$cwd" in
2738 '') cwd=$targetdir ;;
2739 esac
2740 exe=\$1
2741 shift
2742 if $test ! -f \$exe.xok; then
2743   $to \$exe
2744   $touch \$exe.xok
2745 fi
2746 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2747 EOF
2748             ;;
2749         *)  echo "Unknown targetrun '$targetrun'" >&4
2750             exit 1
2751             ;;
2752         esac
2753         case "$targetmkdir" in
2754         */Cross/mkdir)
2755             cat >$targetmkdir <<EOF
2756 #!/bin/sh
2757 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2758 EOF
2759             $chmod a+rx $targetmkdir
2760             ;;
2761         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2762             exit 1
2763             ;;
2764         esac
2765         case "$targetto" in
2766         scp|rcp)
2767             cat >$to <<EOF
2768 #!/bin/sh
2769 for f in \$@
2770 do
2771   case "\$f" in
2772   /*)
2773     $targetmkdir \`dirname \$f\`
2774     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2775     ;;
2776   *)
2777     $targetmkdir $targetdir/\`dirname \$f\`
2778     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2779     ;;
2780   esac
2781 done
2782 exit 0
2783 EOF
2784             ;;
2785         cp) cat >$to <<EOF
2786 #!/bin/sh
2787 for f in \$@
2788 do
2789   case "\$f" in
2790   /*)
2791     $mkdir -p $targetdir/\`dirname \$f\`
2792     $cp \$f $targetdir/\$f || exit 1
2793     ;;
2794   *)
2795     $targetmkdir $targetdir/\`dirname \$f\`
2796     $cp \$f $targetdir/\$f || exit 1
2797     ;;
2798   esac
2799 done
2800 exit 0
2801 EOF
2802             ;;
2803         *)  echo "Unknown targetto '$targetto'" >&4
2804             exit 1
2805             ;;
2806         esac
2807         case "$targetfrom" in
2808         scp|rcp)
2809           cat >$from <<EOF
2810 #!/bin/sh
2811 for f in \$@
2812 do
2813   $rm -f \$f
2814   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2815 done
2816 exit 0
2817 EOF
2818             ;;
2819         cp) cat >$from <<EOF
2820 #!/bin/sh
2821 for f in \$@
2822 do
2823   $rm -f \$f
2824   cp $targetdir/\$f . || exit 1
2825 done
2826 exit 0
2827 EOF
2828             ;;
2829         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2830             exit 1
2831             ;;
2832         esac
2833         if $test ! -f $run; then
2834             echo "Target 'run' script '$run' not found." >&4
2835         else
2836             $chmod a+rx $run
2837         fi
2838         if $test ! -f $to; then
2839             echo "Target 'to' script '$to' not found." >&4
2840         else
2841             $chmod a+rx $to
2842         fi
2843         if $test ! -f $from; then
2844             echo "Target 'from' script '$from' not found." >&4
2845         else
2846             $chmod a+rx $from
2847         fi
2848         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2849             exit 1
2850         fi
2851         cat >&4 <<EOF
2852 Using '$run' for remote execution,
2853 and '$from' and '$to'
2854 for remote file transfer.
2855 EOF
2856         ;;
2857 *)      run=''
2858         to=:
2859         from=:
2860         usecrosscompile='undef'
2861         targetarch=''
2862         ;;
2863 esac
2864
2865 : see whether [:lower:] and [:upper:] are supported character classes
2866 echo " "
2867 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2868 ABYZ)
2869         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2870         up='[:upper:]'
2871         low='[:lower:]'
2872         ;;
2873 *)      # There is a discontinuity in EBCDIC between 'I' and 'J'
2874         # (0xc9 and 0xd1), therefore that is a nice testing point.
2875         if test "X$up" = X -o "X$low" = X; then
2876             case "`echo IJ | $tr '[I-J]' '[i-j]' 2>/dev/null`" in
2877             ij) up='[A-Z]'
2878                 low='[a-z]'
2879                 ;;
2880             esac
2881         fi
2882         if test "X$up" = X -o "X$low" = X; then
2883             case "`echo IJ | $tr I-J i-j 2>/dev/null`" in
2884             ij) up='A-Z'
2885                 low='a-z'
2886                 ;;
2887             esac
2888         fi
2889         if test "X$up" = X -o "X$low" = X; then
2890             case "`echo IJ | od -x 2>/dev/null`" in
2891             *C9D1*|*c9d1*)
2892                 echo "Hey, this might be EBCDIC." >&4
2893                 if test "X$up" = X -o "X$low" = X; then
2894                     case "`echo IJ | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2895                     ij) up='[A-IJ-RS-Z]'
2896                         low='[a-ij-rs-z]'
2897                         ;;
2898                     esac
2899                 fi
2900                 if test "X$up" = X -o "X$low" = X; then
2901                     case "`echo IJ | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2902                     ij) up='A-IJ-RS-Z'
2903                         low='a-ij-rs-z'
2904                         ;;
2905                     esac
2906                 fi
2907                 ;;
2908             esac
2909         fi
2910 esac
2911 case "`echo IJ | $tr \"$up\" \"$low\" 2>/dev/null`" in
2912 ij)
2913     echo "Using $up and $low to convert case." >&4
2914     ;;
2915 *)
2916     echo "I don't know how to translate letters from upper to lower case." >&4
2917     echo "Your tr is not acting any way I know of." >&4
2918     exit 1
2919     ;;
2920 esac
2921 : set up the translation script tr, must be called with ./tr of course
2922 cat >tr <<EOSC
2923 $startsh
2924 case "\$1\$2" in
2925 '[A-Z][a-z]') exec $tr '$up' '$low';;
2926 '[a-z][A-Z]') exec $tr '$low' '$up';;
2927 esac
2928 exec $tr "\$@"
2929 EOSC
2930 chmod +x tr
2931 $eunicefix tr
2932
2933 : Try to determine whether config.sh was made on this system
2934 case "$config_sh" in
2935 '')
2936 myuname=`$uname -a 2>/dev/null`
2937 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2938 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2939 # because the A-Z/a-z are not consecutive.
2940 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2941         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2942 newmyuname="$myuname"
2943 dflt=n
2944 case "$knowitall" in
2945 '')
2946         if test -f ../config.sh; then
2947                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2948                         eval "`grep myuname= ../config.sh`"
2949                 fi
2950                 if test "X$myuname" = "X$newmyuname"; then
2951                         dflt=y
2952                 fi
2953         fi
2954         ;;
2955 *) dflt=y;;
2956 esac
2957
2958 : Get old answers from old config file if Configure was run on the
2959 : same system, otherwise use the hints.
2960 hint=default
2961 cd ..
2962 if test -f config.sh; then
2963         echo " "
2964         rp="I see a config.sh file.  Shall I use it to set the defaults?"
2965         . UU/myread
2966         case "$ans" in
2967         n*|N*) echo "OK, I'll ignore it."
2968                 mv config.sh config.sh.old
2969                 myuname="$newmyuname"
2970                 ;;
2971         *)  echo "Fetching default answers from your old config.sh file..." >&4
2972                 tmp_n="$n"
2973                 tmp_c="$c"
2974                 tmp_sh="$sh"
2975                 . ./config.sh
2976                 cp config.sh UU
2977                 n="$tmp_n"
2978                 c="$tmp_c"
2979                 : Older versions did not always set $sh.  Catch re-use of such
2980                 : an old config.sh.
2981                 case "$sh" in
2982                 '') sh="$tmp_sh" ;;
2983                 esac
2984                 hint=previous
2985                 ;;
2986         esac
2987 fi
2988 . ./UU/checkcc
2989 if test ! -f config.sh; then
2990         $cat <<EOM
2991
2992 First time through, eh?  I have some defaults handy for some systems
2993 that need some extra help getting the Configure answers right:
2994
2995 EOM
2996         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
2997         dflt=''
2998         : Half the following guesses are probably wrong... If you have better
2999         : tests or hints, please send them to perlbug@perl.org
3000         : The metaconfig authors would also appreciate a copy...
3001         $test -f /irix && osname=irix
3002         $test -f /xenix && osname=sco_xenix
3003         $test -f /dynix && osname=dynix
3004         $test -f /dnix && osname=dnix
3005         $test -f /lynx.os && osname=lynxos
3006         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3007         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3008         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3009         $test -f /bin/mips && /bin/mips && osname=mips
3010         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3011                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3012         $test -d /usr/apollo/bin && osname=apollo
3013         $test -f /etc/saf/_sactab && osname=svr4
3014         $test -d /usr/include/minix && osname=minix
3015         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3016         if $test -d /MachTen -o -d /MachTen_Folder; then
3017                 osname=machten
3018                 if $test -x /sbin/version; then
3019                         osvers=`/sbin/version | $awk '{print $2}' |
3020                         $sed -e 's/[A-Za-z]$//'`
3021                 elif $test -x /usr/etc/version; then
3022                         osvers=`/usr/etc/version | $awk '{print $2}' |
3023                         $sed -e 's/[A-Za-z]$//'`
3024                 else
3025                         osvers="$2.$3"
3026                 fi
3027         fi
3028
3029         $test -f /sys/posix.dll &&
3030                 $test -f /usr/bin/what &&
3031                 set X `/usr/bin/what /sys/posix.dll` &&
3032                 $test "$3" = UWIN &&
3033                 osname=uwin &&
3034                 osvers="$5"
3035
3036         if $test -f $uname; then
3037                 set X $myuname
3038                 shift
3039
3040                 case "$5" in
3041                 fps*) osname=fps ;;
3042                 mips*)
3043                         case "$4" in
3044                         umips) osname=umips ;;
3045                         *) osname=mips ;;
3046                         esac;;
3047                 [23]100) osname=mips ;;
3048                 next*) osname=next ;;
3049                 i386*)
3050                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3051                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3052                                 osname='sco'
3053                                 osvers=$tmp
3054                         elif $test -f /etc/kconfig; then
3055                                 osname=isc
3056                                 if test "$lns" = "$ln -s"; then
3057                                         osvers=4
3058                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3059                                         osvers=3
3060                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3061                                         osvers=2
3062                                 fi
3063                         fi
3064                         tmp=''
3065                         ;;
3066                 pc*)
3067                         if test -n "$DJGPP"; then
3068                                 osname=dos
3069                                 osvers=djgpp
3070                         fi
3071                         ;;
3072                 esac
3073
3074                 case "$1" in
3075                 aix) osname=aix
3076                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3077                         case "$tmp" in
3078                         'not found') osvers="$4"."$3" ;;
3079                         '<3240'|'<>3240') osvers=3.2.0 ;;
3080                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3081                         '=3250'|'>3250') osvers=3.2.5 ;;
3082                         *) osvers=$tmp;;
3083                         esac
3084                         ;;
3085                 bsd386) osname=bsd386
3086                         osvers=`$uname -r`
3087                         ;;
3088                 cygwin*) osname=cygwin
3089                         osvers="$3"
3090                         ;;
3091                 *dc.osx) osname=dcosx
3092                         osvers="$3"
3093                         ;;
3094                 dnix) osname=dnix
3095                         osvers="$3"
3096                         ;;
3097                 domainos) osname=apollo
3098                         osvers="$3"
3099                         ;;
3100                 dgux) osname=dgux 
3101                         osvers="$3"
3102                         ;;
3103                 dynixptx*) osname=dynixptx
3104                         osvers=`echo "$4"|sed 's/^v//'`
3105                         ;;
3106                 freebsd) osname=freebsd 
3107                         osvers="$3" ;;
3108                 genix) osname=genix ;;
3109                 hp*) osname=hpux 
3110                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3111                         ;;
3112                 irix*) osname=irix
3113                         case "$3" in
3114                         4*) osvers=4 ;;
3115                         5*) osvers=5 ;;
3116                         *)      osvers="$3" ;;
3117                         esac
3118                         ;;
3119                 linux) osname=linux
3120                         case "$3" in
3121                         *)      osvers="$3" ;;
3122                         esac
3123                         ;;
3124                 MiNT) osname=mint
3125                         ;;
3126                 netbsd*) osname=netbsd
3127                         osvers="$3"
3128                         ;;
3129                 news-os) osvers="$3"
3130                         case "$3" in
3131                         4*) osname=newsos4 ;;
3132                         *) osname=newsos ;;
3133                         esac
3134                         ;;
3135                 next*) osname=next ;;
3136                 nonstop-ux) osname=nonstopux ;;
3137                 openbsd) osname=openbsd
3138                         osvers="$3"
3139                         ;;
3140                 POSIX-BC | posix-bc ) osname=posix-bc
3141                         osvers="$3"
3142                         ;;
3143                 powerux | power_ux | powermax_os | powermaxos | \
3144                 powerunix | power_unix) osname=powerux
3145                         osvers="$3"
3146                         ;;
3147                 qnx) osname=qnx
3148                         osvers="$4"
3149                         ;;
3150                 solaris) osname=solaris
3151                         case "$3" in
3152                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3153                         *)      osvers="$3" ;;
3154                         esac
3155                         ;;
3156                 sunos) osname=sunos
3157                         case "$3" in
3158                         5*) osname=solaris
3159                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3160                         *)      osvers="$3" ;;
3161                         esac
3162                         ;;
3163                 titanos) osname=titanos
3164                         case "$3" in
3165                         1*) osvers=1 ;;
3166                         2*) osvers=2 ;;
3167                         3*) osvers=3 ;;
3168                         4*) osvers=4 ;;
3169                         *)      osvers="$3" ;;
3170                         esac
3171                         ;;
3172                 ultrix) osname=ultrix
3173                         osvers="$3"
3174                         ;;
3175                 osf1|mls+)      case "$5" in
3176                                 alpha)
3177                                         osname=dec_osf
3178                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3179                                         case "$osvers" in
3180                                         [1-9].[0-9]*) ;;
3181                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3182                                         esac
3183                                         ;;
3184                         hp*)    osname=hp_osf1  ;;
3185                         mips)   osname=mips_osf1 ;;
3186                         esac
3187                         ;;
3188                 unixware) osname=svr5
3189                         osvers="$4"
3190                         ;;
3191                 uts)    osname=uts
3192                         osvers="$3"
3193                         ;;
3194                 vos) osvers="$3"
3195                         ;;
3196                 $2) case "$osname" in
3197                         *isc*) ;;
3198                         *freebsd*) ;;
3199                         svr*)
3200                                 : svr4.x or possibly later
3201                                 case "svr$3" in 
3202                                 ${osname}*)
3203                                         osname=svr$3
3204                                         osvers=$4
3205                                         ;;
3206                                 esac
3207                                 case "$osname" in
3208                                 svr4.0)
3209                                         : Check for ESIX
3210                                         if test -f /stand/boot ; then
3211                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3212                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3213                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3214                                                         if test -n "$isesix"; then
3215                                                                 osname=esix4
3216                                                         fi
3217                                                 fi
3218                                         fi
3219                                         ;;
3220                                 esac
3221                                 ;;
3222                         *)      if test -f /etc/systemid; then
3223                                         osname=sco
3224                                         set `echo $3 | $sed 's/\./ /g'` $4
3225                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3226                                                 osvers=$1.$2.$3
3227                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3228                                                 osvers=$1.$2
3229                                         elif $test -f $src/hints/sco_$1.sh; then
3230                                                 osvers=$1
3231                                         fi
3232                                 else
3233                                         case "$osname" in
3234                                         '') : Still unknown.  Probably a generic Sys V.
3235                                                 osname="sysv"
3236                                                 osvers="$3"
3237                                                 ;;
3238                                         esac
3239                                 fi
3240                                 ;;
3241                         esac
3242                         ;;
3243                 *)      case "$osname" in
3244                         '') : Still unknown.  Probably a generic BSD.
3245                                 osname="$1"
3246                                 osvers="$3"
3247                                 ;;
3248                         esac
3249                         ;;
3250                 esac
3251         else
3252                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3253                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3254                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3255                                 osname=news_os
3256                         fi
3257                         $rm -f UU/kernel.what
3258                 elif test -d c:/.; then
3259                         set X $myuname
3260                         osname=os2
3261                         osvers="$5"
3262                 fi
3263         fi
3264         
3265         case "$targetarch" in
3266         '') ;;
3267         *)  hostarch=$osname
3268             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3269             osvers=''
3270             ;;
3271         esac
3272
3273         : Now look for a hint file osname_osvers, unless one has been
3274         : specified already.
3275         case "$hintfile" in
3276         ''|' ')
3277                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3278                 : Also try without trailing minor version numbers.
3279                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3280                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3281                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3282                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3283                 case "$file" in
3284                 '') dflt=none ;;
3285                 *)  case "$osvers" in
3286                         '') dflt=$file
3287                                 ;;
3288                         *)  if $test -f $src/hints/$file.sh ; then
3289                                         dflt=$file
3290                                 elif $test -f $src/hints/$xfile.sh ; then
3291                                         dflt=$xfile
3292                                 elif $test -f $src/hints/$xxfile.sh ; then
3293                                         dflt=$xxfile
3294                                 elif $test -f $src/hints/$xxxfile.sh ; then
3295                                         dflt=$xxxfile
3296                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3297                                         dflt=$xxxxfile
3298                                 elif $test -f "$src/hints/${osname}.sh" ; then
3299                                         dflt="${osname}"
3300                                 else
3301                                         dflt=none
3302                                 fi
3303                                 ;;
3304                         esac
3305                         ;;
3306                 esac
3307                 if $test -f Policy.sh ; then
3308                         case "$dflt" in
3309                         *Policy*) ;;
3310                         none) dflt="Policy" ;;
3311                         *) dflt="Policy $dflt" ;;
3312                         esac
3313                 fi
3314                 ;;
3315         *)
3316                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3317                 ;;
3318         esac
3319
3320         if $test -f Policy.sh ; then
3321                 $cat <<EOM
3322
3323 There's also a Policy hint file available, which should make the
3324 site-specific (policy) questions easier to answer.
3325 EOM
3326
3327         fi
3328
3329         $cat <<EOM
3330
3331 You may give one or more space-separated answers, or "none" if appropriate.
3332 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3333 is a good thing.  DO NOT give a wrong version or a wrong OS.
3334
3335 EOM
3336
3337         rp="Which of these apply, if any?"
3338         . UU/myread
3339         tans=$ans
3340         for file in $tans; do
3341                 if $test X$file = XPolicy -a -f Policy.sh; then
3342                         . Policy.sh
3343                         $cat Policy.sh >> UU/config.sh
3344                 elif $test -f $src/hints/$file.sh; then
3345                         . $src/hints/$file.sh
3346                         $cat $src/hints/$file.sh >> UU/config.sh
3347                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3348                         : nothing
3349                 else
3350                         : Give one chance to correct a possible typo.
3351                         echo "$file.sh does not exist"
3352                         dflt=$file
3353                         rp="hint to use instead?"
3354                         . UU/myread
3355                         for file in $ans; do
3356                                 if $test -f "$src/hints/$file.sh"; then
3357                                         . $src/hints/$file.sh
3358                                         $cat $src/hints/$file.sh >> UU/config.sh
3359                                 elif $test X$ans = X -o X$ans = Xnone ; then
3360                                         : nothing
3361                                 else
3362                                         echo "$file.sh does not exist -- ignored."
3363                                 fi
3364                         done
3365                 fi
3366         done
3367
3368         hint=recommended
3369         : Remember our hint file for later.
3370         if $test -f "$src/hints/$file.sh" ; then
3371                 hintfile="$file"
3372         else
3373                 hintfile=''
3374         fi
3375 fi
3376 cd UU
3377 ;;
3378 *)
3379         echo " "
3380         echo "Fetching default answers from $config_sh..." >&4
3381         tmp_n="$n"
3382         tmp_c="$c"
3383         cd ..
3384         cp $config_sh config.sh 2>/dev/null
3385         chmod +w config.sh
3386         . ./config.sh
3387         cd UU
3388         cp ../config.sh .
3389         n="$tmp_n"
3390         c="$tmp_c"
3391         hint=previous
3392         ;;
3393 esac
3394 test "$override" && . ./optdef.sh
3395
3396 : Restore computed paths
3397 for file in $loclist $trylist; do
3398         eval $file="\$_$file"
3399 done
3400
3401 cat << EOM
3402
3403 Configure uses the operating system name and version to set some defaults.
3404 The default value is probably right if the name rings a bell. Otherwise,
3405 since spelling matters for me, either accept the default or answer "none"
3406 to leave it blank.
3407
3408 EOM
3409 case "$osname" in
3410         ''|' ')
3411                 case "$hintfile" in
3412                 ''|' '|none) dflt=none ;;
3413                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3414                 esac
3415                 ;;
3416         *) dflt="$osname" ;;
3417 esac
3418 rp="Operating system name?"
3419 . ./myread
3420 case "$ans" in
3421 none)  osname='' ;;
3422 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3423 esac
3424 echo " "
3425 case "$osvers" in
3426         ''|' ')
3427                 case "$hintfile" in
3428                 ''|' '|none) dflt=none ;;
3429                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3430                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3431                         case "$dflt" in
3432                         ''|' ') dflt=none ;;
3433                         esac
3434                         ;;
3435                 esac
3436                 ;;
3437         *) dflt="$osvers" ;;
3438 esac
3439 rp="Operating system version?"
3440 . ./myread
3441 case "$ans" in
3442 none)  osvers='' ;;
3443 *) osvers="$ans" ;;
3444 esac
3445
3446
3447 . ./posthint.sh
3448
3449 : who configured the system
3450 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3451 cf_by=`(logname) 2>/dev/null`
3452 case "$cf_by" in
3453 "")
3454         cf_by=`(whoami) 2>/dev/null`
3455         case "$cf_by" in
3456         "") cf_by=unknown ;;
3457         esac ;;
3458 esac
3459
3460 : set up the script used to warn in case of inconsistency
3461 cat <<EOS >whoa
3462 $startsh
3463 EOS
3464 cat <<'EOSC' >>whoa
3465 dflt=y
3466 echo " "
3467 echo "*** WHOA THERE!!! ***" >&4
3468 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3469 rp="    Keep the $hint value?"
3470 . ./myread
3471 case "$ans" in
3472 y) td=$was; tu=$was;;
3473 esac
3474 EOSC
3475
3476 : function used to set $1 to $val
3477 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3478 case "$val$was" in
3479 $define$undef) . ./whoa; eval "$var=\$td";;
3480 $undef$define) . ./whoa; eval "$var=\$tu";;
3481 *) eval "$var=$val";;
3482 esac'
3483
3484 case "$usesocks" in
3485 $define|true|[yY]*)     dflt='y';;
3486 *) dflt='n';;
3487 esac
3488 cat <<EOM
3489
3490 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3491 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3492 to use the PerlIO abstraction layer, this will be implicitly selected.
3493
3494 If this doesn't make any sense to you, just accept the default '$dflt'.
3495 EOM
3496 rp='Build Perl for SOCKS?'
3497 . ./myread
3498 case "$ans" in
3499 y|Y)    val="$define" ;;     
3500 *)      val="$undef" ;;
3501 esac
3502 set usesocks
3503 eval $setvar
3504
3505 case "$usesocks" in
3506 $define|true|[yY]*) useperlio="$define";;
3507 esac
3508
3509 case "$useperlio" in
3510 $define|true|[yY]*|'')  dflt='y';;
3511 *) dflt='n';;
3512 esac
3513 cat <<EOM
3514
3515 Previous version of $package used the standard IO mechanisms as
3516 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3517 alternate IO mechanisms via the PerlIO abstraction layer, but the
3518 stdio mechanism is still available if needed.  The abstraction layer
3519 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3520 Using PerlIO with sfio may cause problems with some extension modules.
3521
3522 If this doesn't make any sense to you, just accept the default '$dflt'.
3523 EOM
3524 rp='Use the PerlIO abstraction layer?'
3525 . ./myread
3526 case "$ans" in
3527 y|Y) 
3528         val="$define"
3529         ;;
3530 *)      
3531         echo "Ok, doing things the stdio way."
3532         val="$undef"
3533         ;;
3534 esac
3535 set useperlio
3536 eval $setvar 
3537
3538 case "$usesocks" in
3539 $define|true|[yY]*)
3540         case "$useperlio" in
3541         $define|true|[yY]*) ;;
3542         *)      cat >&4 <<EOM
3543
3544 You are using the SOCKS proxy protocol library which means that you
3545 should also use the PerlIO layer.  You may be headed for trouble.
3546
3547 EOM
3548                 ;;
3549         esac
3550         ;;
3551 esac
3552
3553         
3554 case "$usethreads" in
3555 $define|true|[yY]*)     dflt='y';;
3556 *)     # Catch case where user specified ithreads or 5005threads but
3557        # forgot -Dusethreads (A.D. 4/2002)
3558        case "$useithreads$use5005threads" in
3559        *$define*)      
3560                 case "$useperlio" in
3561                 "$define")      dflt='y' ;;
3562                 *)              dflt='n' ;;
3563                 esac
3564                 ;;
3565        *)       dflt='n';;
3566        esac
3567        ;;
3568 esac
3569 cat <<EOM
3570
3571 Perl can be built to take advantage of threads on some systems.
3572 To do so, Configure can be run with -Dusethreads.
3573
3574 Note that Perl built with threading support runs slightly slower
3575 and uses more memory than plain Perl. The current implementation
3576 is believed to be stable, but it is fairly new, and so should be
3577 treated with caution.
3578
3579 If this doesn't make any sense to you, just accept the default '$dflt'.
3580 EOM
3581 rp='Build a threading Perl?'
3582 . ./myread
3583 case "$ans" in
3584 y|Y)    val="$define" ;;
3585 *)      val="$undef" ;;
3586 esac
3587 set usethreads
3588 eval $setvar
3589
3590 case "$usethreads" in
3591 $define)
3592         $cat <<EOM
3593
3594 Since release 5.6, Perl has had two different threading implementations,
3595 the newer interpreter-based version (ithreads) with one interpreter per
3596 thread, and the older 5.005 version (5005threads).
3597 The 5005threads version is effectively unmaintained and will probably be
3598 removed in Perl 5.10, so there should be no need to build a Perl using it
3599 unless needed for backwards compatibility with some existing 5.005threads
3600 code.
3601
3602 EOM
3603         : Default to ithreads unless overridden on command line or with
3604         : old config.sh
3605         dflt='y'
3606         case "$use5005threads" in
3607                 $define|true|[yY]*) dflt='n';;
3608         esac
3609         case "$useithreads" in
3610                 $undef|false|[nN]*) dflt='n';;
3611         esac
3612         rp='Use the newer interpreter-based ithreads?'
3613         . ./myread
3614         case "$ans" in
3615         y|Y)    val="$define" ;;
3616         *)      val="$undef" ;;
3617         esac
3618         set useithreads
3619         eval $setvar
3620         : Now set use5005threads to the opposite value.
3621         case "$useithreads" in
3622         $define) val="$undef" ;;
3623         *) val="$define" ;;
3624         esac
3625         set use5005threads
3626         eval $setvar
3627         ;;
3628 *)
3629         useithreads="$undef"
3630         use5005threads="$undef"
3631         ;;
3632 esac
3633
3634 case "$useithreads$use5005threads" in
3635 "$define$define")
3636         $cat >&4 <<EOM
3637
3638 You cannot have both the ithreads and the 5.005 threads enabled
3639 at the same time.  Disabling the 5.005 threads since they are
3640 much less stable than the ithreads.
3641
3642 EOM
3643         use5005threads="$undef"
3644         ;;
3645 esac
3646
3647 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3648         cat >&4 <<EOF
3649 ***
3650 *** To build with ithreads you must also use the PerlIO layer.
3651 *** Cannot continue, aborting.
3652 ***
3653 EOF
3654         exit 1
3655 fi
3656
3657 case "$d_oldpthreads" in
3658 '')     : Configure tests would be welcome here.  For now, assume undef.
3659         val="$undef" ;;
3660 *)      val="$d_oldpthreads" ;;
3661 esac
3662 set d_oldpthreads
3663 eval $setvar
3664
3665
3666 case "$usethreads" in
3667 "$define"|true|[yY]*)
3668 : Look for a hint-file generated 'call-back-unit'.  If the
3669 : user has specified that a threading perl is to be built,
3670 : we may need to set or change some other defaults.
3671         if $test -f usethreads.cbu; then
3672                 echo "Your platform has some specific hints for threaded builds, using them..."
3673                 . ./usethreads.cbu
3674         else
3675                 $cat <<EOM
3676 (Your platform doesn't have any specific hints for threaded builds.
3677  Assuming POSIX threads, then.)
3678 EOM
3679         fi
3680         ;;
3681 esac
3682
3683 cat <<EOM
3684
3685 Perl can be built so that multiple Perl interpreters can coexist
3686 within the same Perl executable.
3687 EOM
3688
3689 case "$useithreads" in
3690 $define)
3691         cat <<EOM
3692 This multiple interpreter support is required for interpreter-based threads.
3693 EOM
3694         val="$define"
3695         ;;
3696 *)      case "$usemultiplicity" in
3697         $define|true|[yY]*)     dflt='y';;
3698         *) dflt='n';;
3699         esac
3700         echo " "
3701         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3702         rp='Build Perl for multiplicity?'
3703         . ./myread
3704         case "$ans" in
3705         y|Y)    val="$define" ;;
3706         *)      val="$undef" ;;
3707         esac
3708         ;;
3709 esac
3710 set usemultiplicity
3711 eval $setvar
3712
3713
3714 case "$usemorebits" in
3715 "$define"|true|[yY]*)
3716         use64bitint="$define"
3717         uselongdouble="$define"
3718         usemorebits="$define"
3719         ;;
3720 *)      usemorebits="$undef"
3721         ;;
3722 esac
3723
3724 : make some quick guesses about what we are up against
3725 echo " "
3726 $echo $n "Hmm...  $c"
3727 echo exit 1 >bsd
3728 echo exit 1 >usg
3729 echo exit 1 >v7
3730 echo exit 1 >osf1
3731 echo exit 1 >eunice
3732 echo exit 1 >xenix
3733 echo exit 1 >venix
3734 echo exit 1 >os2
3735 d_bsd="$undef"
3736 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3737 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3738 then
3739         echo "Looks kind of like an OSF/1 system, but we'll see..."
3740         echo exit 0 >osf1
3741 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3742         xxx=`./loc addbib blurfl $pth`
3743         if $test -f $xxx; then
3744         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3745                 echo exit 0 >bsd
3746                 echo exit 0 >usg
3747         else
3748                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3749                         echo "Looks kind of like an extended USG system, but we'll see..."
3750                 else
3751                         echo "Looks kind of like a USG system, but we'll see..."
3752                 fi
3753                 echo exit 0 >usg
3754         fi
3755 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3756         echo "Looks kind of like a BSD system, but we'll see..."
3757         d_bsd="$define"
3758         echo exit 0 >bsd
3759 else
3760         echo "Looks kind of like a Version 7 system, but we'll see..."
3761         echo exit 0 >v7
3762 fi
3763 case "$eunicefix" in
3764 *unixtovms*)
3765         $cat <<'EOI'
3766 There is, however, a strange, musty smell in the air that reminds me of
3767 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3768 EOI
3769         echo exit 0 >eunice
3770         d_eunice="$define"
3771 : it so happens the Eunice I know will not run shell scripts in Unix format
3772         ;;
3773 *)
3774         echo " "
3775         echo "Congratulations.  You aren't running Eunice."
3776         d_eunice="$undef"
3777         ;;
3778 esac
3779 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3780 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3781 : semicolon as a patch separator
3782 case "$p_" in
3783 :) ;;
3784 *)
3785         $cat <<'EOI'
3786 I have the feeling something is not exactly right, however...don't tell me...
3787 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3788 (Or you may be running DOS with DJGPP.)
3789 EOI
3790         echo exit 0 >os2
3791         ;;
3792 esac
3793 if test -f /xenix; then
3794         echo "Actually, this looks more like a XENIX system..."
3795         echo exit 0 >xenix
3796         d_xenix="$define"
3797 else
3798         echo " "
3799         echo "It's not Xenix..."
3800         d_xenix="$undef"
3801 fi
3802 chmod +x xenix
3803 $eunicefix xenix
3804 if test -f /venix; then
3805         echo "Actually, this looks more like a VENIX system..."
3806         echo exit 0 >venix
3807 else
3808         echo " "
3809         if ./xenix; then
3810                 : null
3811         else
3812                 echo "Nor is it Venix..."
3813         fi
3814 fi
3815 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3816 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3817 $rm -f foo
3818
3819 case "$cc" in
3820 '') dflt=cc;;
3821 *) dflt="$cc";;
3822 esac
3823 rp="Use which C compiler?"
3824 . ./myread
3825 cc="$ans"
3826
3827 : See if they have not cc but they do have gcc
3828 . ./trygcc
3829 : Look for a hint-file generated 'call-back-unit'.  Now that the
3830 : user has specified the compiler, we may need to set or change some
3831 : other defaults.
3832 if $test -f cc.cbu; then
3833     . ./cc.cbu
3834 fi
3835 . ./checkcc
3836
3837 echo " "
3838 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3839 $cat >try.c <<EOM
3840 #include <stdio.h>
3841 int main() {
3842 #ifdef __GNUC__
3843 #ifdef __VERSION__
3844         printf("%s\n", __VERSION__);
3845 #else
3846         printf("%s\n", "1");
3847 #endif
3848 #endif
3849         return(0);
3850 }
3851 EOM
3852 if $cc -o try $ccflags $ldflags try.c; then
3853         gccversion=`$run ./try`
3854         case "$gccversion" in
3855         '') echo "You are not using GNU cc." ;;
3856         *)  echo "You are using GNU cc $gccversion."
3857             ccname=gcc
3858             ;;
3859         esac
3860 else
3861         echo " "
3862         echo "*** WHOA THERE!!! ***" >&4
3863         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3864         case "$knowitall" in
3865         '')
3866         echo "    You'd better start hunting for one and let me know about it." >&4
3867                 exit 1
3868                 ;;
3869         esac
3870 fi
3871 $rm -f try try.*
3872 case "$gccversion" in
3873 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3874 esac
3875 case "$gccversion" in
3876 '') gccosandvers='' ;;
3877 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3878    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3879    gccshortvers=''
3880    case "$gccosandvers" in
3881    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3882    $osname$osvers) ;; # looking good
3883    $osname*) cat <<EOM >&4
3884
3885 *** WHOA THERE!!! ***
3886
3887     Your gcc has not been compiled for the exact release of
3888     your operating system ($gccosandvers versus $osname$osvers).
3889
3890     In general it is a good idea to keep gcc synchronized with
3891     the operating system because otherwise serious problems
3892     may ensue when trying to compile software, like Perl.
3893
3894     I'm trying to be optimistic here, though, and will continue.
3895     If later during the configuration and build icky compilation
3896     problems appear (headerfile conflicts being the most common
3897     manifestation), I suggest reinstalling the gcc to match
3898     your operating system release.
3899
3900 EOM
3901       ;;
3902    *) gccosandvers='' ;; # failed to parse, better be silent
3903    esac
3904    ;;
3905 esac
3906 case "$ccname" in
3907 '') ccname="$cc" ;;
3908 esac
3909
3910 # gcc 3.* complain about adding -Idirectories that they already know about,
3911 # so we will take those off from locincpth.
3912 case "$gccversion" in
3913 3*)
3914     echo "main(){}">try.c
3915     for incdir in $locincpth; do
3916        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3917              grep '^c[cp]p*[01]: warning: changing search order '`
3918        if test "X$warn" != X; then
3919            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3920        fi
3921     done
3922     $rm -f try try.*
3923 esac
3924
3925 : decide how portable to be.  Allow command line overrides.
3926 case "$d_portable" in
3927 "$undef") ;;
3928 *)      d_portable="$define" ;;
3929 esac
3930
3931 : set up shell script to do ~ expansion
3932 cat >filexp <<EOSS
3933 $startsh
3934 : expand filename
3935 case "\$1" in
3936  ~/*|~)
3937         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3938         ;;
3939  ~*)
3940         if $test -f /bin/csh; then
3941                 /bin/csh -f -c "glob \$1"
3942                 failed=\$?
3943                 echo ""
3944                 exit \$failed
3945         else
3946                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3947                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3948                 if $test ! -d "\$dir"; then
3949                         me=\`basename \$0\`
3950                         echo "\$me: can't locate home directory for: \$name" >&2
3951                         exit 1
3952                 fi
3953                 case "\$1" in
3954                 */*)
3955                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3956                         ;;
3957                 *)
3958                         echo \$dir
3959                         ;;
3960                 esac
3961         fi
3962         ;;
3963 *)
3964         echo \$1
3965         ;;
3966 esac
3967 EOSS
3968 chmod +x filexp
3969 $eunicefix filexp
3970
3971 : now set up to get a file name
3972 cat <<EOS >getfile
3973 $startsh
3974 EOS
3975 cat <<'EOSC' >>getfile
3976 tilde=''
3977 fullpath=''
3978 already=''
3979 skip=''
3980 none_ok=''
3981 exp_file=''
3982 nopath_ok=''
3983 orig_rp="$rp"
3984 orig_dflt="$dflt"
3985 case "$gfpth" in
3986 '') gfpth='.' ;;
3987 esac
3988
3989 case "$fn" in
3990 *\(*)
3991         : getfile will accept an answer from the comma-separated list
3992         : enclosed in parentheses even if it does not meet other criteria.
3993         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3994         fn=`echo $fn | sed 's/(.*)//'`
3995         ;;
3996 esac
3997
3998 case "$fn" in
3999 *:*)
4000         loc_file=`expr $fn : '.*:\(.*\)'`
4001         fn=`expr $fn : '\(.*\):.*'`
4002         ;;
4003 esac
4004
4005 case "$fn" in
4006 *~*) tilde=true;;
4007 esac
4008 case "$fn" in
4009 */*) fullpath=true;;
4010 esac
4011 case "$fn" in
4012 *+*) skip=true;;
4013 esac
4014 case "$fn" in
4015 *n*) none_ok=true;;
4016 esac
4017 case "$fn" in
4018 *e*) exp_file=true;;
4019 esac
4020 case "$fn" in
4021 *p*) nopath_ok=true;;
4022 esac
4023
4024 case "$fn" in
4025 *f*) type='File';;
4026 *d*) type='Directory';;
4027 *l*) type='Locate';;
4028 esac
4029
4030 what="$type"
4031 case "$what" in
4032 Locate) what='File';;
4033 esac
4034
4035 case "$exp_file" in
4036 '')
4037         case "$d_portable" in
4038         "$define") ;;
4039         *) exp_file=true;;
4040         esac
4041         ;;
4042 esac
4043
4044 cd ..
4045 while test "$type"; do
4046         redo=''
4047         rp="$orig_rp"
4048         dflt="$orig_dflt"
4049         case "$tilde" in
4050         true) rp="$rp (~name ok)";;
4051         esac
4052         . UU/myread
4053         if test -f UU/getfile.ok && \
4054                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4055         then
4056                 value="$ans"
4057                 ansexp="$ans"
4058                 break
4059         fi
4060         case "$ans" in
4061         none)
4062                 value=''
4063                 ansexp=''
4064                 case "$none_ok" in
4065                 true) type='';;
4066                 esac
4067                 ;;
4068         *)
4069                 case "$tilde" in
4070                 '') value="$ans"
4071                         ansexp="$ans";;
4072                 *)
4073                         value=`UU/filexp $ans`
4074                         case $? in
4075                         0)
4076                                 if test "$ans" != "$value"; then
4077                                         echo "(That expands to $value on this system.)"
4078                                 fi
4079                                 ;;
4080                         *) value="$ans";;
4081                         esac
4082                         ansexp="$value"
4083                         case "$exp_file" in
4084                         '') value="$ans";;
4085                         esac
4086                         ;;
4087                 esac
4088                 case "$fullpath" in
4089                 true)
4090                         case "$ansexp" in
4091                         /*) value="$ansexp" ;;
4092                         [a-zA-Z]:/*) value="$ansexp" ;;
4093                         *)
4094                                 redo=true
4095                                 case "$already" in
4096                                 true)
4097                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4098                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4099                                         ;;
4100                                 *)
4101                                 echo "Please give a full path name, starting with slash." >&4
4102                                         case "$tilde" in
4103                                         true)
4104                                 echo "Note that using ~name is ok provided it expands well." >&4
4105                                                 already=true
4106                                                 ;;
4107                                         esac
4108                                 esac
4109                                 ;;
4110                         esac
4111                         ;;
4112                 esac
4113                 case "$redo" in
4114                 '')
4115                         case "$type" in
4116                         File)
4117                                 for fp in $gfpth; do
4118                                         if test "X$fp" = X.; then
4119                                             pf="$ansexp"
4120                                         else    
4121                                             pf="$fp/$ansexp"
4122                                         fi
4123                                         if test -f "$pf"; then
4124                                                 type=''
4125                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4126                                         then
4127                                                 echo "($value is not a plain file, but that's ok.)"
4128                                                 type=''
4129                                         fi
4130                                         if test X"$type" = X; then
4131                                             value="$pf"
4132                                             break
4133                                         fi
4134                                 done
4135                                 ;;
4136                         Directory)
4137                                 for fp in $gfpth; do
4138                                         if test "X$fp" = X.; then
4139                                             dir="$ans"
4140                                             direxp="$ansexp"
4141                                         else    
4142                                             dir="$fp/$ansexp"
4143                                             direxp="$fp/$ansexp"
4144                                         fi
4145                                         if test -d "$direxp"; then
4146                                                 type=''
4147                                                 value="$dir"
4148                                                 break
4149                                         fi
4150                                 done
4151                                 ;;
4152                         Locate)
4153                                 if test -d "$ansexp"; then
4154                                         echo "(Looking for $loc_file in directory $value.)"
4155                                         value="$value/$loc_file"
4156                                         ansexp="$ansexp/$loc_file"
4157                                 fi
4158                                 if test -f "$ansexp"; then
4159                                         type=''
4160                                 fi
4161                                 case "$nopath_ok" in
4162                                 true)   case "$value" in
4163                                         */*) ;;
4164                                         *)      echo "Assuming $value will be in people's path."
4165                                                 type=''
4166                                                 ;;
4167                                         esac
4168                                         ;;
4169                                 esac
4170                                 ;;
4171                         esac
4172
4173                         case "$skip" in
4174                         true) type='';
4175                         esac
4176
4177                         case "$type" in
4178                         '') ;;
4179                         *)
4180                                 if test "$fastread" = yes; then
4181                                         dflt=y
4182                                 else
4183                                         dflt=n
4184                                 fi
4185                                 rp="$what $value doesn't exist.  Use that name anyway?"
4186                                 . UU/myread
4187                                 dflt=''
4188                                 case "$ans" in
4189                                 y*) type='';;
4190                                 *) echo " ";;
4191                                 esac
4192                                 ;;
4193                         esac
4194                         ;;
4195                 esac
4196                 ;;
4197         esac
4198 done
4199 cd UU
4200 ans="$value"
4201 rp="$orig_rp"
4202 dflt="$orig_dflt"
4203 rm -f getfile.ok
4204 test "X$gfpthkeep" != Xy && gfpth=""
4205 EOSC
4206
4207 : What should the include directory be ?
4208 echo " "
4209 $echo $n "Hmm...  $c"
4210 dflt='/usr/include'
4211 incpath=''
4212 mips_type=''
4213 if $test -f /bin/mips && /bin/mips; then
4214         echo "Looks like a MIPS system..."
4215         $cat >usr.c <<'EOCP'
4216 #ifdef SYSTYPE_BSD43
4217 /bsd43
4218 #endif
4219 EOCP
4220         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4221                 dflt='/bsd43/usr/include'
4222                 incpath='/bsd43'
4223                 mips_type='BSD 4.3'
4224         else
4225                 mips_type='System V'
4226         fi
4227         $rm -f usr.c usr.out
4228         echo "and you're compiling with the $mips_type compiler and libraries."
4229         xxx_prompt=y
4230         echo "exit 0" >mips
4231 else
4232         echo "Doesn't look like a MIPS system."
4233         xxx_prompt=n
4234         echo "exit 1" >mips
4235 fi
4236 chmod +x mips
4237 $eunicefix mips
4238 case "$usrinc" in
4239 '') ;;
4240 *) dflt="$usrinc";;
4241 esac
4242 case "$xxx_prompt" in
4243 y)      fn=d/
4244         echo " "
4245         rp='Where are the include files you want to use?'
4246         . ./getfile
4247         usrinc="$ans"
4248         ;;
4249 *)      usrinc="$dflt"
4250         ;;
4251 esac
4252
4253 : see how we invoke the C preprocessor
4254 echo " "
4255 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4256 cat <<'EOT' >testcpp.c
4257 #define ABC abc
4258 #define XYZ xyz
4259 ABC.XYZ
4260 EOT
4261 cd ..
4262 if test ! -f cppstdin; then
4263         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4264                 # AIX cc -E doesn't show the absolute headerfile
4265                 # locations but we'll cheat by using the -M flag.
4266                 echo 'cat >.$$.c; rm -f .$$.u; '"$cc"' ${1+"$@"} -M -c .$$.c 2>/dev/null; test -s .$$.u && awk '"'"'$2 ~ /\.h$/ { print "# 0 \""$2"\"" }'"'"' .$$.u; rm -f .$$.o .$$.u; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' > cppstdin
4267         else
4268                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4269         fi
4270 else
4271         echo "Keeping your $hint cppstdin wrapper."
4272 fi
4273 chmod 755 cppstdin
4274 wrapper=`pwd`/cppstdin
4275 ok='false'
4276 cd UU
4277
4278 if $test "X$cppstdin" != "X" && \
4279         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4280         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4281 then
4282         echo "You used to use $cppstdin $cppminus so we'll use that again."
4283         case "$cpprun" in
4284         '') echo "But let's see if we can live without a wrapper..." ;;
4285         *)
4286                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4287                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4288                 then
4289                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4290                         ok='true'
4291                 else
4292                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4293                 fi
4294                 ;;
4295         esac
4296 else
4297         case "$cppstdin" in
4298         '') ;;
4299         *)
4300                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4301                 ;;
4302         esac
4303 fi
4304
4305 if $ok; then
4306         : nothing
4307 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4308         $cc -E <testcpp.c >testcpp.out 2>&1; \
4309         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4310         echo "Yup, it does."
4311         x_cpp="$cc -E"
4312         x_minus='';
4313 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4314         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4315         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4316         echo "Yup, it does."
4317         x_cpp="$cc -E"
4318         x_minus='-';
4319 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4320         $cc -P <testcpp.c >testcpp.out 2>&1; \
4321         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4322         echo "Yipee, that works!"
4323         x_cpp="$cc -P"
4324         x_minus='';
4325 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4326         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4327         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4328         echo "At long last!"
4329         x_cpp="$cc -P"
4330         x_minus='-';
4331 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4332         $cpp <testcpp.c >testcpp.out 2>&1; \
4333         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4334         echo "It works!"
4335         x_cpp="$cpp"
4336         x_minus='';
4337 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4338         $cpp - <testcpp.c >testcpp.out 2>&1; \
4339         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4340         echo "Hooray, it works!  I was beginning to wonder."
4341         x_cpp="$cpp"
4342         x_minus='-';
4343 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4344         $wrapper <testcpp.c >testcpp.out 2>&1; \
4345         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4346         x_cpp="$wrapper"
4347         x_minus=''
4348         echo "Eureka!"
4349 else
4350         dflt=''
4351         rp="No dice.  I can't find a C preprocessor.  Name one:"
4352         . ./myread
4353         x_cpp="$ans"
4354         x_minus=''
4355         $x_cpp <testcpp.c >testcpp.out 2>&1
4356         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4357                 echo "OK, that will do." >&4
4358         else
4359 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4360                 exit 1
4361         fi
4362 fi
4363
4364 case "$ok" in
4365 false)
4366         cppstdin="$x_cpp"
4367         cppminus="$x_minus"
4368         cpprun="$x_cpp"
4369         cpplast="$x_minus"
4370         set X $x_cpp
4371         shift
4372         case "$1" in
4373         "$cpp")
4374                 echo "Perhaps can we force $cc -E using a wrapper..."
4375                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4376                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4377                 then
4378                         echo "Yup, we can."
4379                         cppstdin="$wrapper"
4380                         cppminus='';
4381                 else
4382                         echo "Nope, we'll have to live without it..."
4383                 fi
4384                 ;;
4385         esac
4386         case "$cpprun" in
4387         "$wrapper")
4388                 cpprun=''
4389                 cpplast=''
4390                 ;;
4391         esac
4392         ;;
4393 esac
4394
4395 case "$cppstdin" in
4396 "$wrapper"|'cppstdin') ;;
4397 *) $rm -f $wrapper;;
4398 esac
4399 $rm -f testcpp.c testcpp.out
4400
4401 : Set private lib path
4402 case "$plibpth" in
4403 '') if ./mips; then
4404                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4405         fi;;
4406 esac
4407 case "$libpth" in
4408 ' ') dlist='';;
4409 '') dlist="$loclibpth $plibpth $glibpth";;
4410 *) dlist="$libpth";;
4411 esac
4412
4413 : Now check and see which directories actually exist, avoiding duplicates
4414 libpth=''
4415 for xxx in $dlist
4416 do
4417     if $test -d $xxx; then
4418                 case " $libpth " in
4419                 *" $xxx "*) ;;
4420                 *) libpth="$libpth $xxx";;
4421                 esac
4422     fi
4423 done
4424 $cat <<'EOM'
4425
4426 Some systems have incompatible or broken versions of libraries.  Among
4427 the directories listed in the question below, please remove any you
4428 know not to be holding relevant libraries, and add any that are needed.
4429 Say "none" for none.
4430
4431 EOM
4432 case "$libpth" in
4433 '') dflt='none';;
4434 *)
4435         set X $libpth
4436         shift
4437         dflt=${1+"$@"}
4438         ;;
4439 esac
4440 rp="Directories to use for library searches?"
4441 . ./myread
4442 case "$ans" in
4443 none) libpth=' ';;
4444 *) libpth="$ans";;
4445 esac
4446
4447 : compute shared library extension
4448 case "$so" in
4449 '')
4450         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4451                 dflt='sl'
4452         else
4453                 dflt='so'
4454         fi
4455         ;;
4456 *) dflt="$so";;
4457 esac
4458 $cat <<EOM
4459
4460 On some systems, shared libraries may be available.  Answer 'none' if
4461 you want to suppress searching of shared libraries for the remainder
4462 of this configuration.
4463
4464 EOM
4465 rp='What is the file extension used for shared libraries?'
4466 . ./myread
4467 so="$ans"
4468
4469 : Define several unixisms.
4470 : Hints files or command line option can be used to override them.
4471 : The convoluted testing is in case hints files set either the old
4472 : or the new name.
4473 case "$_exe" in
4474 '')     case "$exe_ext" in
4475         '')     ;;
4476         *)      _exe="$exe_ext" ;;
4477         esac
4478         ;;
4479 esac
4480 case "$_a" in
4481 '')     case "$lib_ext" in
4482     '') _a='.a';;
4483         *)      _a="$lib_ext" ;;
4484         esac
4485         ;;
4486 esac
4487 case "$_o" in
4488 '') case "$obj_ext" in
4489         '')     _o='.o';;
4490         *)      _o="$obj_ext";;
4491         esac
4492         ;;
4493 esac
4494 case "$p_" in
4495 '') case "$path_sep" in
4496         '')     p_=':';;
4497         *)      p_="$path_sep";;
4498         esac
4499         ;;
4500 esac
4501 exe_ext=$_exe
4502 lib_ext=$_a
4503 obj_ext=$_o
4504 path_sep=$p_
4505
4506 : Which makefile gets called first.  This is used by make depend.
4507 case "$firstmakefile" in
4508 '') firstmakefile='makefile';;
4509 esac
4510
4511 : Looking for optional libraries
4512 echo " "
4513 echo "Checking for optional libraries..." >&4
4514 case "$libs" in
4515 ' '|'') dflt='';;
4516 *) dflt="$libs";;
4517 esac
4518 case "$libswanted" in
4519 '') libswanted='c_s';;
4520 esac
4521 case "$usesocks" in
4522 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4523 esac
4524 libsfound=''
4525 libsfiles=''
4526 libsdirs=''
4527 libspath=''
4528 for thisdir in $libpth $xlibpth; do
4529   test -d $thisdir && libspath="$libspath $thisdir"
4530 done
4531 for thislib in $libswanted; do
4532         for thisdir in $libspath; do
4533             xxx=''
4534             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4535                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4536                 $test -f "$xxx" && eval $libscheck
4537                 $test -f "$xxx" && libstyle=shared
4538             fi
4539             if test ! -f "$xxx"; then
4540                 xxx=$thisdir/lib$thislib.$so
4541                 $test -f "$xxx" && eval $libscheck
4542                 $test -f "$xxx" && libstyle=shared
4543             fi  
4544             if test ! -f "$xxx"; then
4545                 xxx=$thisdir/lib$thislib$_a
4546                 $test -f "$xxx" && eval $libscheck
4547                 $test -f "$xxx" && libstyle=static
4548             fi
4549             if test ! -f "$xxx"; then
4550                 xxx=$thisdir/$thislib$_a
4551                 $test -f "$xxx" && eval $libscheck
4552                 $test -f "$xxx" && libstyle=static
4553             fi
4554             if test ! -f "$xxx"; then
4555                 xxx=$thisdir/lib${thislib}_s$_a
4556                 $test -f "$xxx" && eval $libscheck
4557                 $test -f "$xxx" && libstyle=static
4558                 $test -f "$xxx" && thislib=${thislib}_s
4559             fi
4560             if test ! -f "$xxx"; then
4561                 xxx=$thisdir/Slib$thislib$_a
4562                 $test -f "$xxx" && eval $libscheck
4563                 $test -f "$xxx" && libstyle=static
4564             fi
4565             if $test -f "$xxx"; then
4566                 case "$libstyle" in
4567                 shared) echo "Found -l$thislib (shared)." ;;
4568                 static) echo "Found -l$thislib." ;;
4569                 *)      echo "Found -l$thislib ($libstyle)." ;;
4570                 esac
4571                 case " $dflt " in
4572                 *"-l$thislib "*);;
4573                 *) dflt="$dflt -l$thislib"
4574                    libsfound="$libsfound $xxx"
4575                    yyy=`basename $xxx`
4576                    libsfiles="$libsfiles $yyy"
4577                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4578                    case " $libsdirs " in
4579                    *" $yyy "*) ;;
4580                    *) libsdirs="$libsdirs $yyy" ;;
4581                    esac
4582                    ;;
4583                 esac
4584                 break
4585             fi  
4586         done
4587         if $test ! -f "$xxx"; then
4588             echo "No -l$thislib."
4589         fi
4590 done
4591 set X $dflt
4592 shift
4593 dflt="$*"
4594 case "$libs" in
4595 '') dflt="$dflt";;
4596 *) dflt="$libs";;
4597 esac
4598 case "$dflt" in
4599 ' '|'') dflt='none';;
4600 esac
4601
4602 $cat <<EOM
4603
4604 In order to compile $package on your machine, a number of libraries
4605 are usually needed.  Include any other special libraries here as well.
4606 Say "none" for none.  The default list is almost always right.
4607 EOM
4608
4609 echo " "
4610 rp="What libraries to use?"
4611 . ./myread
4612 case "$ans" in
4613 none) libs=' ';;
4614 *) libs="$ans";;
4615 esac
4616
4617 : determine optimization, if desired, or use for debug flag also
4618 case "$optimize" in
4619 ' '|$undef) dflt='none';;
4620 '') dflt='-O';;
4621 *) dflt="$optimize";;
4622 esac
4623 $cat <<EOH
4624
4625 By default, $package compiles with the -O flag to use the optimizer.
4626 Alternately, you might want to use the symbolic debugger, which uses
4627 the -g flag (on traditional Unix systems).  Either flag can be
4628 specified here.  To use neither flag, specify the word "none".
4629
4630 EOH
4631 rp="What optimizer/debugger flag should be used?"
4632 . ./myread
4633 optimize="$ans"
4634 case "$optimize" in
4635 'none') optimize=" ";;
4636 esac
4637
4638 dflt=''
4639 : We will not override a previous value, but we might want to
4640 : augment a hint file
4641 case "$hint" in
4642 default|recommended)
4643         case "$gccversion" in
4644         1*) dflt='-fpcc-struct-return' ;;
4645         esac
4646         case "$optimize" in
4647         *-g*) dflt="$dflt -DDEBUGGING";;
4648         esac
4649         case "$gccversion" in
4650         2*) if test -d /etc/conf/kconfig.d &&
4651                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4652                 then
4653                         dflt="$dflt -posix"
4654                 fi
4655                 ;;
4656         esac
4657         case "$gccversion" in
4658         1*) ;;
4659         2.[0-8]*) ;;
4660         ?*)     echo " "
4661                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4662                 echo 'int main(void) { return 0; }' > gcctest.c
4663                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4664                         echo "Yes, it does." 2>&1
4665                         case "$ccflags" in
4666                         *strict-aliasing*) 
4667                                 echo "Leaving current flags $ccflags alone." 2>&1
4668                                 ;;
4669                         *) dflt="$dflt -fno-strict-aliasing" ;;
4670                         esac
4671                 else
4672                         echo "Nope, it doesn't, but that's ok." 2>&1
4673                 fi
4674                 ;;
4675         esac
4676         ;;
4677 esac
4678
4679 case "$mips_type" in
4680 *BSD*|'') inclwanted="$locincpth $usrinc";;
4681 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4682 esac
4683 for thisincl in $inclwanted; do
4684         if $test -d $thisincl; then
4685                 if $test x$thisincl != x$usrinc; then
4686                         case "$dflt" in
4687                         *" -I$thisincl "*);;
4688                         *) dflt="$dflt -I$thisincl ";;
4689                         esac
4690                 fi
4691         fi
4692 done
4693
4694 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4695         xxx=true;
4696 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4697         xxx=true;
4698 else
4699         xxx=false;
4700 fi;
4701 if $xxx; then
4702         case "$dflt" in
4703         *$2*);;
4704         *) dflt="$dflt -D$2";;
4705         esac;
4706 fi'
4707
4708 set signal.h LANGUAGE_C; eval $inctest
4709
4710 case "$usesocks" in
4711 $define)
4712         ccflags="$ccflags -DSOCKS"
4713         ;;
4714 esac
4715
4716 case "$hint" in
4717 default|recommended) dflt="$ccflags $dflt" ;;
4718 *) dflt="$ccflags";;
4719 esac
4720
4721 case "$dflt" in
4722 ''|' ') dflt=none;;
4723 esac
4724
4725 $cat <<EOH
4726
4727 Your C compiler may want other flags.  For this question you should include
4728 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4729 but you should NOT include libraries or ld flags like -lwhatever.  If you
4730 want $package to honor its debug switch, you should include -DDEBUGGING here.
4731 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4732
4733 To use no flags, specify the word "none".
4734
4735 EOH
4736 set X $dflt
4737 shift
4738 dflt=${1+"$@"}
4739 rp="Any additional cc flags?"
4740 . ./myread
4741 case "$ans" in
4742 none) ccflags='';;
4743 *) ccflags="$ans";;
4744 esac
4745
4746 : the following weeds options from ccflags that are of no interest to cpp
4747 case "$cppflags" in
4748 '') cppflags="$ccflags" ;;
4749 *)  cppflags="$cppflags $ccflags" ;;
4750 esac
4751 case "$gccversion" in
4752 1*) cppflags="$cppflags -D__GNUC__"
4753 esac
4754 case "$mips_type" in
4755 '');;
4756 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4757 esac
4758 case "$cppflags" in
4759 '');;
4760 *)
4761         echo " "
4762         echo "Let me guess what the preprocessor flags are..." >&4
4763         set X $cppflags
4764         shift
4765         cppflags=''
4766         $cat >cpp.c <<'EOM'
4767 #define BLURFL foo
4768
4769 BLURFL xx LFRULB
4770 EOM
4771         previous=''
4772         for flag in $*
4773         do
4774                 case "$flag" in
4775                 -*) ftry="$flag";;
4776                 *) ftry="$previous $flag";;
4777                 esac
4778                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4779                         >cpp1.out 2>/dev/null && \
4780                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4781                         >cpp2.out 2>/dev/null && \
4782                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4783                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4784                 then
4785                         cppflags="$cppflags $ftry"
4786                         previous=''
4787                 else
4788                         previous="$flag"
4789                 fi
4790         done
4791         set X $cppflags
4792         shift
4793         cppflags=${1+"$@"}
4794         case "$cppflags" in
4795         *-*)  echo "They appear to be: $cppflags";;
4796         esac
4797         $rm -f cpp.c cpp?.out
4798         ;;
4799 esac
4800
4801 : flags used in final linking phase
4802 case "$ldflags" in
4803 '') if ./venix; then
4804                 dflt='-i -z'
4805         else
4806                 dflt=''
4807         fi
4808         case "$ccflags" in
4809         *-posix*) dflt="$dflt -posix" ;;
4810         esac
4811         ;;
4812 *) dflt="$ldflags";;
4813 esac
4814
4815 : Try to guess additional flags to pick up local libraries.
4816 for thislibdir in $libpth; do
4817         case " $loclibpth " in
4818         *" $thislibdir "*)
4819                 case "$dflt " in 
4820                 *"-L$thislibdir "*) ;;
4821                 *)  dflt="$dflt -L$thislibdir" ;;
4822                 esac
4823                 ;;
4824         esac
4825 done
4826
4827 case "$dflt" in
4828 '') dflt='none' ;;
4829 esac
4830
4831 $cat <<EOH
4832
4833 Your C linker may need flags.  For this question you should
4834 include -L/whatever and any other flags used by the C linker, but you
4835 should NOT include libraries like -lwhatever.
4836
4837 Make sure you include the appropriate -L/path flags if your C linker
4838 does not normally search all of the directories you specified above,
4839 namely
4840         $libpth
4841 To use no flags, specify the word "none".
4842
4843 EOH
4844
4845 rp="Any additional ld flags (NOT including libraries)?"
4846 . ./myread
4847 case "$ans" in
4848 none) ldflags='';;
4849 *) ldflags="$ans";;
4850 esac
4851 rmlist="$rmlist pdp11"
4852
4853 : coherency check
4854 echo " "
4855 echo "Checking your choice of C compiler and flags for coherency..." >&4
4856 $cat > try.c <<'EOF'
4857 #include <stdio.h>
4858 int main() { printf("Ok\n"); exit(0); }
4859 EOF
4860 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4861 shift
4862 $cat >try.msg <<'EOM'
4863 I've tried to compile and run the following simple program:
4864
4865 EOM
4866 $cat try.c >> try.msg
4867
4868 $cat >> try.msg <<EOM
4869
4870 I used the command:
4871
4872         $*
4873         $run ./try
4874
4875 and I got the following output:
4876
4877 EOM
4878 dflt=y
4879 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
4880         if $sh -c "$run ./try" >>try.msg 2>&1; then
4881                 xxx=`$run ./try`
4882                 case "$xxx" in
4883                 "Ok") dflt=n ;;
4884                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
4885                         case " $libs " in
4886                         *" -lsfio "*)
4887                                 cat >> try.msg <<'EOQS'
4888 If $libs contains -lsfio, and sfio is mis-configured, then it
4889 sometimes (apparently) runs and exits with a 0 status, but with no
4890 output!  It may have to do with sfio's use of _exit vs. exit.
4891
4892 EOQS
4893                                 rp="You have a big problem.  Shall I abort Configure"
4894                                 dflt=y
4895                                 ;;
4896                         esac
4897                         ;;
4898                 esac
4899         else
4900                 echo "The program compiled OK, but exited with status $?." >>try.msg
4901                 rp="You have a problem.  Shall I abort Configure"
4902                 dflt=y
4903         fi
4904 else
4905         echo "I can't compile the test program." >>try.msg
4906         rp="You have a BIG problem.  Shall I abort Configure"
4907         dflt=y
4908 fi
4909 case "$dflt" in
4910 y)
4911         $cat try.msg >&4
4912         case "$knowitall" in
4913         '')
4914                 echo "(The supplied flags or libraries might be incorrect.)"
4915                 ;;
4916         *) dflt=n;;
4917         esac
4918         echo " "
4919         . ./myread
4920         case "$ans" in
4921         n*|N*) ;;
4922         *)      echo "Ok.  Stopping Configure." >&4
4923                 exit 1
4924                 ;;
4925         esac
4926         ;;
4927 n) echo "OK, that should do.";;
4928 esac
4929 $rm -f try try.* core
4930
4931 : define a shorthand compile call
4932 compile='
4933 mc_file=$1;
4934 shift;
4935 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
4936 : define a shorthand compile call for compilations that should be ok.
4937 compile_ok='
4938 mc_file=$1;
4939 shift;
4940 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
4941
4942 : determine filename position in cpp output
4943 echo " "
4944 echo "Computing filename position in cpp output for #include directives..." >&4
4945 case "$osname" in
4946 vos) testaccess=-e ;;
4947 *)   testaccess=-r ;;
4948 esac
4949 echo '#include <stdio.h>' > foo.c
4950 $cat >fieldn <<EOF
4951 $startsh
4952 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
4953 $grep '^[       ]*#.*stdio\.h' | \
4954 while read cline; do
4955         pos=1
4956         set \$cline
4957         while $test \$# -gt 0; do
4958                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
4959                         echo "\$pos"
4960                         exit 0
4961                 fi
4962                 shift
4963                 pos=\`expr \$pos + 1\`
4964         done
4965 done
4966 EOF
4967 chmod +x fieldn
4968 fieldn=`./fieldn`
4969 $rm -f foo.c fieldn
4970 case $fieldn in
4971 '') pos='???';;
4972 1) pos=first;;
4973 2) pos=second;;
4974 3) pos=third;;
4975 *) pos="${fieldn}th";;
4976 esac
4977 echo "Your cpp writes the filename in the $pos field of the line."
4978
4979 case "$osname" in
4980 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
4981 *)   cppfilter='' ;;
4982 esac
4983 : locate header file
4984 $cat >findhdr <<EOF
4985 $startsh
4986 wanted=\$1
4987 name=''
4988 for usrincdir in $usrinc
4989 do
4990         if test -f \$usrincdir/\$wanted; then
4991                 echo "\$usrincdir/\$wanted"
4992                 exit 0
4993         fi
4994 done
4995 awkprg='{ print \$$fieldn }'
4996 echo "#include <\$wanted>" > foo\$\$.c
4997 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
4998 $cppfilter $grep "^[    ]*#.*\$wanted" | \
4999 while read cline; do
5000         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5001         case "\$name" in
5002         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5003         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5004         *) exit 2;;
5005         esac;
5006 done;
5007 #
5008 # status = 0: grep returned 0 lines, case statement not executed
5009 # status = 1: headerfile found
5010 # status = 2: while loop executed, no headerfile found
5011 #
5012 status=\$?
5013 $rm -f foo\$\$.c;
5014 if test \$status -eq 1; then
5015         exit 0;
5016 fi
5017 exit 1
5018 EOF
5019 chmod +x findhdr
5020
5021 : define an alternate in-header-list? function
5022 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5023 cont=true; xxf="echo \"<\$1> found.\" >&4";
5024 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5025 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5026 esac;
5027 case $# in 4) instead=instead;; *) instead="at last";; esac;
5028 while $test "$cont"; do
5029         xxx=`./findhdr $1`
5030         var=$2; eval "was=\$$2";
5031         if $test "$xxx" && $test -r "$xxx";
5032         then eval $xxf;
5033         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5034                 cont="";
5035         else eval $xxnf;
5036         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5037         set $yyy; shift; shift; yyy=$@;
5038         case $# in 0) cont="";;
5039         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5040                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5041         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5042                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5043         esac;
5044 done;
5045 while $test "$yyy";
5046 do set $yyy; var=$2; eval "was=\$$2";
5047         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5048         set $yyy; shift; shift; yyy=$@;
5049 done'
5050
5051 : see if stdlib is available
5052 set stdlib.h i_stdlib
5053 eval $inhdr
5054
5055 : check for lengths of integral types
5056 echo " "
5057 case "$intsize" in
5058 '')
5059         echo "Checking to see how big your integers are..." >&4
5060         $cat >try.c <<EOCP
5061 #include <stdio.h>
5062 #$i_stdlib I_STDLIB
5063 #ifdef I_STDLIB
5064 #include <stdlib.h>
5065 #endif
5066 int main()
5067 {
5068         printf("intsize=%d;\n", (int)sizeof(int));
5069         printf("longsize=%d;\n", (int)sizeof(long));
5070         printf("shortsize=%d;\n", (int)sizeof(short));
5071         exit(0);
5072 }
5073 EOCP
5074         set try
5075         if eval $compile_ok && $run ./try > /dev/null; then
5076                 eval `$run ./try`
5077                 echo "Your integers are $intsize bytes long."
5078                 echo "Your long integers are $longsize bytes long."
5079                 echo "Your short integers are $shortsize bytes long."
5080         else
5081                 $cat >&4 <<EOM
5082 !
5083 Help! I can't compile and run the intsize test program: please enlighten me!
5084 (This is probably a misconfiguration in your system or libraries, and
5085 you really ought to fix it.  Still, I'll try anyway.)
5086 !
5087 EOM
5088                 dflt=4
5089                 rp="What is the size of an integer (in bytes)?"
5090                 . ./myread
5091                 intsize="$ans"
5092                 dflt=$intsize
5093                 rp="What is the size of a long integer (in bytes)?"
5094                 . ./myread
5095                 longsize="$ans"
5096                 dflt=2
5097                 rp="What is the size of a short integer (in bytes)?"
5098                 . ./myread
5099                 shortsize="$ans"
5100         fi
5101         ;;
5102 esac
5103 $rm -f try try.*
5104
5105 : check for long long
5106 echo " "
5107 echo "Checking to see if you have long long..." >&4
5108 echo 'int main() { long long x = 7; return 0; }' > try.c
5109 set try
5110 if eval $compile; then
5111         val="$define"
5112         echo "You have long long."
5113 else
5114         val="$undef"
5115         echo "You do not have long long."
5116 fi
5117 $rm try.*
5118 set d_longlong
5119 eval $setvar
5120
5121 : check for length of long long
5122 case "${d_longlong}${longlongsize}" in
5123 $define)
5124         echo " "
5125         echo "Checking to see how big your long longs are..." >&4
5126         $cat >try.c <<'EOCP'
5127 #include <stdio.h>
5128 int main()
5129 {
5130     printf("%d\n", (int)sizeof(long long));
5131     return(0);
5132 }
5133 EOCP
5134         set try
5135         if eval $compile_ok; then
5136                 longlongsize=`$run ./try`
5137                 echo "Your long longs are $longlongsize bytes long."
5138         else
5139                 dflt='8'
5140                 echo " "
5141                 echo "(I can't seem to compile the test program.  Guessing...)"
5142                 rp="What is the size of a long long (in bytes)?"
5143                 . ./myread
5144                 longlongsize="$ans"
5145         fi
5146         if $test "X$longsize" = "X$longlongsize"; then
5147                 echo "(That isn't any different from an ordinary long.)"
5148         fi      
5149         ;;
5150 esac
5151 $rm -f try.* try
5152
5153 : see if inttypes.h is available
5154 : we want a real compile instead of Inhdr because some systems
5155 : have an inttypes.h which includes non-existent headers
5156 echo " "
5157 $cat >try.c <<EOCP
5158 #include <inttypes.h>
5159 int main() {
5160         static int32_t foo32 = 0x12345678;
5161 }
5162 EOCP
5163 set try
5164 if eval $compile; then
5165         echo "<inttypes.h> found." >&4
5166         val="$define"
5167 else
5168         echo "<inttypes.h> NOT found." >&4
5169         val="$undef"
5170 fi
5171 $rm -f try.c try
5172 set i_inttypes
5173 eval $setvar
5174
5175 : check for int64_t
5176 echo " "
5177 echo "Checking to see if you have int64_t..." >&4
5178 $cat >try.c <<EOCP
5179 #include <sys/types.h>
5180 #$i_inttypes I_INTTYPES
5181 #ifdef I_INTTYPES
5182 #include <inttypes.h>
5183 #endif
5184 int main() { int64_t x = 7; }
5185 EOCP
5186 set try
5187 if eval $compile; then
5188         val="$define"
5189         echo "You have int64_t."
5190 else
5191         val="$undef"
5192         echo "You do not have int64_t."
5193 fi
5194 $rm -f try try.*
5195 set d_int64_t
5196 eval $setvar
5197
5198
5199 echo " "
5200 echo "Checking which 64-bit integer type we could use..." >&4
5201
5202 case "$intsize" in
5203 8) val=int
5204    set quadtype
5205    eval $setvar
5206    val='"unsigned int"'
5207    set uquadtype
5208    eval $setvar
5209    quadkind=1
5210    ;;
5211 *) case "$longsize" in
5212    8) val=long
5213       set quadtype
5214       eval $setvar
5215       val='"unsigned long"'
5216       set uquadtype
5217       eval $setvar
5218       quadkind=2
5219       ;;
5220    *) case "$d_longlong:$longlongsize" in
5221       define:8)
5222         val='"long long"'
5223         set quadtype
5224         eval $setvar
5225         val='"unsigned long long"'
5226         set uquadtype
5227         eval $setvar
5228         quadkind=3
5229         ;;
5230       *) case "$d_int64_t" in
5231          define)
5232            val=int64_t
5233            set quadtype
5234            eval $setvar
5235            val=uint64_t
5236            set uquadtype
5237            eval $setvar
5238            quadkind=4
5239            ;;
5240          esac
5241          ;;
5242       esac
5243       ;;
5244    esac
5245    ;;
5246 esac
5247
5248 case "$quadtype" in
5249 '')     echo "Alas, no 64-bit integer types in sight." >&4
5250         d_quad="$undef"
5251         ;;
5252 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5253         d_quad="$define"
5254         ;;
5255 esac
5256
5257
5258 case "$uselonglong" in
5259 "$define"|true|[yY]*)
5260         cat <<EOM >&4
5261
5262 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5263 EOM
5264         use64bitint="$define"
5265         ;;
5266 esac                          
5267 case "$use64bits" in
5268 "$define"|true|[yY]*)
5269         cat <<EOM >&4
5270
5271 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5272 EOM
5273         use64bitint="$define"
5274         ;;
5275 esac                          
5276 case "$use64bitints" in
5277 "$define"|true|[yY]*)
5278         cat <<EOM >&4
5279
5280 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5281 EOM
5282         use64bitint="$define"
5283         ;;
5284 esac                          
5285 case "$use64bitsint" in
5286 "$define"|true|[yY]*)
5287         cat <<EOM >&4
5288
5289 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5290 EOM
5291         use64bitint="$define"
5292         ;;
5293 esac                          
5294 case "$uselonglongs" in
5295 "$define"|true|[yY]*)
5296         cat <<EOM >&4
5297
5298 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5299 EOM
5300         use64bitint="$define"
5301         ;;
5302 esac                          
5303 case "$use64bitsall" in
5304 "$define"|true|[yY]*)
5305         cat <<EOM >&4
5306
5307 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5308 EOM
5309         use64bitall="$define"
5310         ;;
5311 esac                          
5312
5313 case "$ccflags" in
5314 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5315 esac
5316 case "$use64bitall" in
5317 "$define"|true|[yY]*) use64bitint="$define" ;;
5318 esac
5319
5320 case "$longsize" in
5321 8) cat <<EOM
5322
5323 You have natively 64-bit long integers.
5324 EOM
5325    val="$define"
5326    ;;
5327 *) case "$use64bitint" in
5328    "$define"|true|[yY]*) dflt='y';;
5329    *) dflt='n';;
5330    esac
5331    case "$d_quad" in
5332    "$define") ;;
5333    *) dflt='n' ;;
5334    esac
5335    cat <<EOM
5336
5337 Perl can be built to take advantage of 64-bit integer types
5338 on some systems.  To do so, Configure can be run with -Duse64bitint.
5339 Choosing this option will most probably introduce binary incompatibilities.
5340
5341 If this doesn't make any sense to you, just accept the default '$dflt'.
5342 (The default has been chosen based on your configuration.)
5343 EOM
5344    rp='Try to use 64-bit integers, if available?'
5345    . ./myread
5346    case "$ans" in
5347    [yY]*) val="$define" ;;
5348    *)     val="$undef"  ;;
5349    esac
5350    ;;
5351 esac
5352 set use64bitint
5353 eval $setvar
5354
5355 case "$use64bitall" in
5356 "$define"|true|[yY]*) dflt='y' ;;
5357 *) case "$longsize" in
5358    8) dflt='y' ;;
5359    *) dflt='n' ;;
5360    esac
5361    ;;
5362 esac    
5363 cat <<EOM
5364
5365 You may also choose to try maximal 64-bitness.  It means using as much
5366 64-bitness as possible on the platform.  This in turn means even more
5367 binary incompatibilities.  On the other hand, your platform may not
5368 have any more 64-bitness available than what you already have chosen.
5369
5370 If this doesn't make any sense to you, just accept the default '$dflt'.
5371 (The default has been chosen based on your configuration.)
5372 EOM
5373 rp='Try to use maximal 64-bit support, if available?'
5374 . ./myread
5375 case "$ans" in
5376 [yY]*) val="$define" ;;
5377 *)     val="$undef"  ;;
5378 esac
5379 set use64bitall
5380 eval $setvar
5381 case "$use64bitall" in
5382 "$define")
5383         case "$use64bitint" in
5384         "$undef")
5385                 cat <<EOM
5386
5387 Since you have chosen a maximally 64-bit build, I'm also turning on
5388 the use of 64-bit integers.
5389 EOM
5390                 use64bitint="$define" ;;
5391         esac
5392         ;;
5393 esac
5394
5395 case "$use64bitint" in
5396 "$define"|true|[yY]*)
5397 : Look for a hint-file generated 'call-back-unit'.  If the
5398 : user has specified that a 64-bit perl is to be built,
5399 : we may need to set or change some other defaults.
5400         if $test -f use64bitint.cbu; then
5401                 echo "Your platform has some specific hints for 64-bit integers, using them..."
5402                 . ./use64bitint.cbu
5403         fi
5404         case "$longsize" in
5405         4) case "$archname64" in
5406            '') archname64=64int ;;
5407            esac
5408            ;;
5409         esac
5410         ;;
5411 esac
5412
5413 case "$use64bitall" in
5414 "$define"|true|[yY]*)
5415 : Look for a hint-file generated 'call-back-unit'.  If the
5416 : user has specified that a maximally 64-bit perl is to be built,
5417 : we may need to set or change some other defaults.
5418         if $test -f use64bitall.cbu; then
5419                 echo "Your platform has some specific hints for 64-bit builds, using them..."
5420                 . ./use64bitall.cbu
5421         fi
5422         case "$longsize" in
5423         4) case "$archname64" in
5424            ''|64int) archname64=64all ;;
5425            esac
5426            ;;
5427         esac
5428         ;;
5429 esac
5430
5431 echo " "
5432 echo "Checking for GNU C Library..." >&4
5433 cat >try.c <<'EOCP'
5434 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
5435    alone are insufficient to distinguish different versions, such as
5436    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
5437    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
5438 */
5439 #include <stdio.h>
5440 int main(void)
5441 {
5442 #ifdef __GLIBC__
5443 #   ifdef __GLIBC_MINOR__
5444 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
5445 #           include <gnu/libc-version.h>
5446             printf("%s\n",  gnu_get_libc_version());
5447 #       else
5448             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
5449 #       endif
5450 #   else
5451         printf("%d\n",  __GLIBC__);
5452 #   endif
5453     return 0;
5454 #else
5455     return 1;
5456 #endif
5457 }
5458 EOCP
5459 set try
5460 if eval $compile_ok && $run ./try > glibc.ver; then
5461         val="$define"
5462         gnulibc_version=`$cat glibc.ver`
5463         echo "You are using the GNU C Library version $gnulibc_version"
5464 else
5465         val="$undef"
5466         gnulibc_version=''
5467         echo "You are not using the GNU C Library"
5468 fi
5469 $rm -f try try.* glibc.ver
5470 set d_gnulibc
5471 eval $setvar
5472
5473 : see if nm is to be used to determine whether a symbol is defined or not
5474 case "$usenm" in
5475 '')
5476         dflt=''
5477         case "$d_gnulibc" in
5478         "$define")
5479                 echo " "
5480                 echo "nm probably won't work on the GNU C Library." >&4
5481                 dflt=n
5482                 ;;
5483         esac
5484         case "$dflt" in
5485         '') 
5486                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
5487                         echo " "
5488                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
5489                         echo "'nm' won't be sufficient on this sytem." >&4
5490                         dflt=n
5491                 fi
5492                 ;;
5493         esac
5494         case "$dflt" in
5495         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
5496                 if $test $dflt -gt 20; then
5497                         dflt=y
5498                 else
5499                         dflt=n
5500                 fi
5501                 ;;
5502         esac
5503         ;;
5504 *)
5505         case "$usenm" in
5506         true|$define) dflt=y;;
5507         *) dflt=n;;
5508         esac
5509         ;;
5510 esac
5511 $cat <<EOM
5512
5513 I can use $nm to extract the symbols from your C libraries. This
5514 is a time consuming task which may generate huge output on the disk (up
5515 to 3 megabytes) but that should make the symbols extraction faster. The
5516 alternative is to skip the 'nm' extraction part and to compile a small
5517 test program instead to determine whether each symbol is present. If
5518 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
5519 this may be the best solution.
5520
5521 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
5522
5523 EOM
5524 rp="Shall I use $nm to extract C symbols from the libraries?"
5525 . ./myread
5526 case "$ans" in
5527 [Nn]*) usenm=false;;
5528 *) usenm=true;;
5529 esac
5530
5531 runnm=$usenm
5532 case "$reuseval" in
5533 true) runnm=false;;
5534 esac
5535
5536 : nm options which may be necessary
5537 case "$nm_opt" in
5538 '') if $test -f /mach_boot; then
5539                 nm_opt=''       # Mach
5540         elif $test -d /usr/ccs/lib; then
5541                 nm_opt='-p'     # Solaris (and SunOS?)
5542         elif $test -f /dgux; then
5543                 nm_opt='-p'     # DG-UX
5544         elif $test -f /lib64/rld; then
5545                 nm_opt='-p'     # 64-bit Irix
5546         else
5547                 nm_opt=''
5548         fi;;
5549 esac
5550
5551 : nm options which may be necessary for shared libraries but illegal
5552 : for archive libraries.  Thank you, Linux.
5553 case "$nm_so_opt" in
5554 '')     case "$myuname" in
5555         *linux*)
5556                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
5557                         nm_so_opt='--dynamic'
5558                 fi
5559                 ;;
5560         esac
5561         ;;
5562 esac
5563
5564 case "$runnm" in
5565 true)
5566 : get list of predefined functions in a handy place
5567 echo " "
5568 case "$libc" in
5569 '') libc=unknown
5570         case "$libs" in
5571         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
5572         esac
5573         ;;
5574 esac
5575 case "$libs" in
5576 '') ;;
5577 *)  for thislib in $libs; do
5578         case "$thislib" in
5579         -lc|-lc_s)
5580                 : Handle C library specially below.
5581                 ;;
5582         -l*)
5583                 thislib=`echo $thislib | $sed -e 's/^-l//'`
5584                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
5585                         :
5586                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
5587                         :
5588                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
5589                         :
5590                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
5591                         :
5592                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
5593                         :
5594                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
5595                         :
5596                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
5597                         :
5598                 else
5599                         try=''
5600                 fi
5601                 libnames="$libnames $try"
5602                 ;;
5603         *) libnames="$libnames $thislib" ;;
5604         esac
5605         done
5606         ;;
5607 esac
5608 xxx=normal
5609 case "$libc" in
5610 unknown)
5611         set /lib/libc.$so
5612         for xxx in $libpth; do
5613                 $test -r $1 || set $xxx/libc.$so
5614                 : The messy sed command sorts on library version numbers.
5615                 $test -r $1 || \
5616                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
5617                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
5618                                 h
5619                                 s/[0-9][0-9]*/0000&/g
5620                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
5621                                 G
5622                                 s/\n/ /' | \
5623                          $sort | $sed -e 's/^.* //'`
5624                 eval set \$$#
5625         done
5626         $test -r $1 || set /usr/ccs/lib/libc.$so
5627         $test -r $1 || set /lib/libsys_s$_a
5628         ;;
5629 *)
5630         set blurfl
5631         ;;
5632 esac
5633 if $test -r "$1"; then
5634         echo "Your (shared) C library seems to be in $1."
5635         libc="$1"
5636 elif $test -r /lib/libc && $test -r /lib/clib; then
5637         echo "Your C library seems to be in both /lib/clib and /lib/libc."
5638         xxx=apollo
5639         libc='/lib/clib /lib/libc'
5640         if $test -r /lib/syslib; then
5641                 echo "(Your math library is in /lib/syslib.)"
5642                 libc="$libc /lib/syslib"
5643         fi
5644 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5645         echo "Your C library seems to be in $libc, as you said before."
5646 elif $test -r $incpath/usr/lib/libc$_a; then
5647         libc=$incpath/usr/lib/libc$_a;
5648         echo "Your C library seems to be in $libc.  That's fine."
5649 elif $test -r /lib/libc$_a; then
5650         libc=/lib/libc$_a;
5651         echo "Your C library seems to be in $libc.  You're normal."
5652 else
5653         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
5654                 :
5655         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
5656                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
5657         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
5658                 :
5659         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5660                 :
5661         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
5662                 :
5663         else
5664                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
5665         fi
5666         if $test -r "$tans"; then
5667                 echo "Your C library seems to be in $tans, of all places."
5668                 libc=$tans
5669         else
5670                 libc='blurfl'
5671         fi
5672 fi
5673 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
5674         dflt="$libc"
5675         cat <<EOM
5676
5677 If the guess above is wrong (which it might be if you're using a strange
5678 compiler, or your machine supports multiple models), you can override it here.
5679
5680 EOM
5681 else
5682         dflt=''
5683         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
5684         cat >&4 <<EOM
5685 I can't seem to find your C library.  I've looked in the following places:
5686
5687 EOM
5688         $sed 's/^/      /' libpath
5689         cat <<EOM
5690
5691 None of these seems to contain your C library. I need to get its name...
5692
5693 EOM
5694 fi
5695 fn=f
5696 rp='Where is your C library?'
5697 . ./getfile
5698 libc="$ans"
5699
5700 echo " "
5701 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
5702 set X `cat libnames`
5703 shift
5704 xxx=files
5705 case $# in 1) xxx=file; esac
5706 echo "Extracting names from the following $xxx for later perusal:" >&4
5707 echo " "
5708 $sed 's/^/      /' libnames >&4
5709 echo " "
5710 $echo $n "This may take a while...$c" >&4
5711
5712 for file in $*; do
5713         case $file in
5714         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
5715         *) $nm $nm_opt $file 2>/dev/null;;
5716         esac
5717 done >libc.tmp
5718
5719 $echo $n ".$c"
5720 $grep fprintf libc.tmp > libc.ptf
5721 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
5722 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
5723 xxx='[ADTSIW]'
5724 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *_[_.]*//p' -e 's/^.* $xxx  *//p'";\
5725         eval $xscan;\
5726         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5727                 eval $xrun
5728 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
5729         eval $xscan;\
5730         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5731                 eval $xrun
5732 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
5733         eval $xscan;\
5734         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5735                 eval $xrun
5736 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
5737         eval $xscan;\
5738         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5739                 eval $xrun
5740 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
5741         eval $xscan;\
5742         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5743                 eval $xrun
5744 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
5745         eval $xscan;\
5746         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5747                 eval $xrun
5748 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
5749                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
5750         eval $xscan;\
5751         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5752                 eval $xrun
5753 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
5754         eval $xscan;\
5755         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5756                 eval $xrun
5757 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
5758         eval $xscan;\
5759         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5760                 eval $xrun
5761 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
5762         eval $xscan;\
5763         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5764                 eval $xrun
5765 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
5766         eval $xscan;\
5767         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5768                 eval $xrun
5769 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
5770         eval $xscan;\
5771         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5772                 eval $xrun
5773 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
5774         eval $xscan;\
5775         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5776                 eval $xrun
5777 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
5778         eval $xscan;\
5779         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
5780                 eval $xrun
5781 else
5782         $nm -p $* 2>/dev/null >libc.tmp
5783         $grep fprintf libc.tmp > libc.ptf
5784         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
5785                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
5786         then
5787                 nm_opt='-p'
5788                 eval $xrun
5789         else
5790                 echo " "
5791                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
5792                 com=''
5793                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
5794                         for thisname in $libnames $libc; do
5795                                 $ar t $thisname >>libc.tmp
5796                         done
5797                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
5798                         echo "Ok." >&4
5799                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
5800                         # Repeat libc to extract forwarders to DLL entries too
5801                         for thisname in $libnames $libc; do
5802                                 $ar tv $thisname >>libc.tmp
5803                                 # Revision 50 of EMX has bug in $ar.
5804                                 # it will not extract forwarders to DLL entries
5805                                 # Use emximp which will extract exactly them.
5806                                 emximp -o tmp.imp $thisname \
5807                                     2>/dev/null && \
5808                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
5809                                     < tmp.imp >>libc.tmp
5810                                 $rm tmp.imp
5811                         done
5812                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
5813                         echo "Ok." >&4
5814                 else
5815                         echo "$ar didn't seem to work right." >&4
5816                         echo "Maybe this is a Cray...trying bld instead..." >&4
5817                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
5818                         then
5819                                 for thisname in $libnames; do
5820                                         bld t $libnames | \
5821                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
5822                                         $ar t $thisname >>libc.tmp
5823                                 done
5824                                 echo "Ok." >&4
5825                         else
5826                                 echo "That didn't work either.  Giving up." >&4
5827                                 exit 1
5828                         fi
5829                 fi
5830         fi
5831 fi
5832 nm_extract="$com"
5833 case "$PASE" in
5834 define)
5835     echo " "
5836     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
5837     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
5838     ;;
5839 *)  if $test -f /lib/syscalls.exp; then
5840         echo " "
5841         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
5842         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
5843     fi
5844     ;;
5845 esac
5846 ;;
5847 esac
5848 $rm -f libnames libpath
5849
5850 : is a C symbol defined?
5851 csym='tlook=$1;
5852 case "$3" in
5853 -v) tf=libc.tmp; tc=""; tdc="";;
5854 -a) tf=libc.tmp; tc="[0]"; tdc="[]";;
5855 *) tlook="^$1\$"; tf=libc.list; tc="()"; tdc="()";;
5856 esac;
5857 tx=yes;
5858 case "$reuseval-$4" in
5859 true-) ;;
5860 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
5861 esac;
5862 case "$tx" in
5863 yes)
5864         case "$runnm" in
5865         true)
5866                 if $contains $tlook $tf >/dev/null 2>&1;
5867                 then tval=true;
5868                 else tval=false;
5869                 fi;;
5870         *)
5871                 echo "int main() { extern short $1$tdc; printf(\"%hd\", $1$tc); }" > t.c;
5872                 if $cc -o t $optimize $ccflags $ldflags t.c $libs >/dev/null 2>&1;
5873                 then tval=true;
5874                 else tval=false;
5875                 fi;
5876                 $rm -f t t.c;;
5877         esac;;
5878 *)
5879         case "$tval" in
5880         $define) tval=true;;
5881         *) tval=false;;
5882         esac;;
5883 esac;
5884 eval "$2=$tval"'
5885
5886 : define an is-in-libc? function
5887 inlibc='echo " "; td=$define; tu=$undef;
5888 sym=$1; var=$2; eval "was=\$$2";
5889 tx=yes;
5890 case "$reuseval$was" in
5891 true) ;;
5892 true*) tx=no;;
5893 esac;
5894 case "$tx" in
5895 yes)
5896         set $sym tres -f;
5897         eval $csym;
5898         case "$tres" in
5899         true)
5900                 echo "$sym() found." >&4;
5901                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
5902         *)
5903                 echo "$sym() NOT found." >&4;
5904                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
5905         esac;;
5906 *)
5907         case "$was" in
5908         $define) echo "$sym() found." >&4;;
5909         *) echo "$sym() NOT found." >&4;;
5910         esac;;
5911 esac'
5912
5913 : see if sqrtl exists
5914 set sqrtl d_sqrtl
5915 eval $inlibc
5916
5917 hasproto='varname=$1; func=$2; shift; shift;
5918 while $test $# -ge 2; do
5919         case "$1" in
5920         $define) echo "#include <$2>";;
5921         esac ;
5922     shift 2;
5923 done > try.c;
5924 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
5925 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
5926         echo "$func() prototype found.";
5927         val="$define";
5928 else
5929         echo "$func() prototype NOT found.";
5930         val="$undef";
5931 fi;
5932 set $varname;
5933 eval $setvar;
5934 $rm -f try.c tryout.c'
5935
5936 : check for length of double
5937 echo " "
5938 case "$doublesize" in
5939 '')
5940         echo "Checking to see how big your double precision numbers are..." >&4
5941         $cat >try.c <<EOCP
5942 #include <stdio.h>
5943 #$i_stdlib I_STDLIB
5944 #ifdef I_STDLIB
5945 #include <stdlib.h>
5946 #endif
5947 int main()
5948 {
5949     printf("%d\n", (int)sizeof(double));
5950     exit(0);
5951 }
5952 EOCP
5953         set try
5954         if eval $compile_ok; then
5955                 doublesize=`$run ./try`
5956                 echo "Your double is $doublesize bytes long."
5957         else
5958                 dflt='8'
5959                 echo "(I can't seem to compile the test program.  Guessing...)"
5960                 rp="What is the size of a double precision number (in bytes)?"
5961                 . ./myread
5962                 doublesize="$ans"
5963         fi
5964         ;;
5965 esac
5966 $rm -f try.c try
5967
5968 : check for long doubles
5969 echo " "
5970 echo "Checking to see if you have long double..." >&4
5971 echo 'int main() { long double x = 7.0; }' > try.c
5972 set try
5973 if eval $compile; then
5974         val="$define"
5975         echo "You have long double."
5976 else
5977         val="$undef"
5978         echo "You do not have long double."
5979 fi
5980 $rm try.*
5981 set d_longdbl
5982 eval $setvar
5983
5984 : check for length of long double
5985 case "${d_longdbl}${longdblsize}" in
5986 $define)
5987         echo " "
5988         echo "Checking to see how big your long doubles are..." >&4
5989         $cat >try.c <<'EOCP'
5990 #include <stdio.h>
5991 int main()
5992 {
5993         printf("%d\n", sizeof(long double));
5994 }
5995 EOCP
5996         set try
5997         set try
5998         if eval $compile; then
5999                 longdblsize=`$run ./try`
6000                 echo "Your long doubles are $longdblsize bytes long."
6001         else
6002                 dflt='8'
6003                 echo " "
6004                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6005                 rp="What is the size of a long double (in bytes)?"
6006                 . ./myread
6007                 longdblsize="$ans"
6008         fi
6009         if $test "X$doublesize" = "X$longdblsize"; then
6010                 echo "(That isn't any different from an ordinary double.)"
6011         fi      
6012         ;;
6013 esac
6014 $rm -f try.* try
6015
6016 echo " "
6017
6018 if $test X"$d_longdbl" = X"$define"; then
6019
6020 echo "Checking how to print long doubles..." >&4
6021
6022 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
6023         $cat >try.c <<'EOCP'
6024 #include <sys/types.h>
6025 #include <stdio.h>
6026 int main() {
6027   double d = 123.456;
6028   printf("%.3f\n", d);
6029 }
6030 EOCP
6031         set try
6032         if eval $compile; then
6033                 yyy=`$run ./try`
6034                 case "$yyy" in
6035                 123.456)
6036                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
6037                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
6038                         echo "We will use %f."
6039                         ;;
6040                 esac
6041         fi
6042 fi
6043
6044 if $test X"$sPRIfldbl" = X; then
6045         $cat >try.c <<'EOCP'
6046 #include <sys/types.h>
6047 #include <stdio.h>
6048 int main() {
6049   long double d = 123.456;
6050   printf("%.3Lf\n", d);
6051 }
6052 EOCP
6053         set try
6054         if eval $compile; then
6055                 yyy=`$run ./try`
6056                 case "$yyy" in
6057                 123.456)
6058                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
6059                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
6060                         echo "We will use %Lf."
6061                         ;;
6062                 esac
6063         fi
6064 fi
6065
6066 if $test X"$sPRIfldbl" = X; then
6067         $cat >try.c <<'EOCP'
6068 #include <sys/types.h>
6069 #include <stdio.h>
6070 int main() {
6071   long double d = 123.456;
6072   printf("%.3llf\n", d);
6073 }
6074 EOCP
6075         set try
6076         if eval $compile; then
6077                 yyy=`$run ./try`
6078                 case "$yyy" in
6079                 123.456)
6080                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
6081                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
6082                         echo "We will use %llf."
6083                         ;;
6084                 esac
6085         fi
6086 fi
6087
6088 if $test X"$sPRIfldbl" = X; then
6089         $cat >try.c <<'EOCP'
6090 #include <sys/types.h>
6091 #include <stdio.h>
6092 int main() {
6093   long double d = 123.456;
6094   printf("%.3lf\n", d);
6095 }
6096 EOCP
6097         set try
6098         if eval $compile; then
6099                 yyy=`$run ./try`
6100                 case "$yyy" in
6101                 123.456)
6102                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
6103                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
6104                         echo "We will use %lf."
6105                         ;;
6106                 esac
6107         fi
6108 fi
6109
6110 if $test X"$sPRIfldbl" = X; then
6111         echo "Cannot figure out how to print long doubles." >&4
6112 else
6113         sSCNfldbl=$sPRIfldbl    # expect consistency
6114 fi
6115
6116 $rm -f try try.*
6117
6118 fi # d_longdbl
6119
6120 case "$sPRIfldbl" in
6121 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
6122         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
6123         d_SCNfldbl="$undef";
6124         ;;
6125 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
6126         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
6127         d_SCNfldbl="$define";
6128         ;;
6129 esac
6130
6131 : see if modfl exists
6132 set modfl d_modfl
6133 eval $inlibc
6134
6135 : see if prototype for modfl is available
6136 echo " "
6137 set d_modflproto modfl math.h
6138 eval $hasproto
6139
6140 d_modfl_pow32_bug="$undef"
6141
6142 case "$d_longdbl$d_modfl" in
6143 $define$define)
6144         $cat <<EOM
6145 Checking to see whether your modfl() is okay for large values...
6146 EOM
6147 $cat >try.c <<EOCP
6148 #include <math.h> 
6149 #include <stdio.h>
6150 EOCP
6151 if $test "X$d_modflproto" != "X$define"; then
6152         $cat >>try.c <<EOCP
6153 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
6154 long double modfl (long double, long double *);
6155 EOCP
6156 fi
6157 $cat >>try.c <<EOCP
6158 int main() {
6159     long double nv = 4294967303.15;
6160     long double v, w;
6161     v = modfl(nv, &w);         
6162 #ifdef __GLIBC__
6163     printf("glibc");
6164 #endif
6165     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
6166     return 0;
6167 }
6168 EOCP
6169         case "$osname:$gccversion" in
6170         aix:)   saveccflags="$ccflags"
6171                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
6172         esac
6173         set try
6174         if eval $compile; then
6175                 foo=`$run ./try`
6176                 case "$foo" in
6177                 *" 4294967303.150000 1.150000 4294967302.000000")
6178                         echo >&4 "Your modfl() is broken for large values."
6179                         d_modfl_pow32_bug="$define"
6180                         case "$foo" in
6181                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
6182                         ;;
6183                         esac
6184                         ;;
6185                 *" 4294967303.150000 0.150000 4294967303.000000")
6186                         echo >&4 "Your modfl() seems okay for large values."
6187                         ;;
6188                 *)      echo >&4 "I don't understand your modfl() at all."
6189                         d_modfl="$undef"
6190                         ;;
6191                 esac
6192                 $rm -f try.* try core core.try.*
6193         else
6194                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
6195                 d_modfl="$undef"
6196         fi
6197         case "$osname:$gccversion" in
6198         aix:)   ccflags="$saveccflags" ;; # restore
6199         esac
6200         ;;
6201 esac
6202
6203 case "$ccflags" in
6204 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
6205 esac
6206
6207 case "$uselongdouble" in
6208 $define|true|[yY]*)     dflt='y';;
6209 *) dflt='n';;
6210 esac
6211 cat <<EOM
6212
6213 Perl can be built to take advantage of long doubles which
6214 (if available) may give more accuracy and range for floating point numbers.
6215
6216 If this doesn't make any sense to you, just accept the default '$dflt'.
6217 EOM
6218 rp='Try to use long doubles if available?'
6219 . ./myread
6220 case "$ans" in
6221 y|Y)    val="$define"   ;;
6222 *)      val="$undef"    ;;
6223 esac
6224 set uselongdouble
6225 eval $setvar
6226
6227 case "$uselongdouble" in
6228 true|[yY]*) uselongdouble="$define" ;;
6229 esac
6230
6231 case "$uselongdouble" in
6232 $define)
6233 : Look for a hint-file generated 'call-back-unit'.  If the
6234 : user has specified that long doubles should be used,
6235 : we may need to set or change some other defaults.
6236         if $test -f uselongdouble.cbu; then
6237                 echo "Your platform has some specific hints for long doubles, using them..."
6238                 . ./uselongdouble.cbu
6239         else
6240                 $cat <<EOM
6241 (Your platform doesn't have any specific hints for long doubles.)
6242 EOM
6243         fi
6244         ;;
6245 esac
6246
6247 message=X
6248 case "$uselongdouble:$d_sqrtl:$d_modfl" in
6249 $define:$define:$define)
6250         : You have both
6251         ;;
6252 $define:$define:$undef)
6253         message="I could not find modfl"
6254         ;;
6255 $define:$undef:$define)
6256         message="I could not find sqrtl"
6257         ;;
6258 $define:$undef:$undef)
6259         message="I found neither sqrtl nor modfl"
6260         ;;
6261 esac
6262
6263 if $test "$message" != X; then
6264         $cat <<EOM >&4
6265
6266 *** You requested the use of long doubles but you do not seem to have
6267 *** the mathematic functions for long doubles.
6268 *** ($message)
6269 *** I'm disabling the use of long doubles.
6270
6271 EOM
6272
6273         uselongdouble=$undef
6274 fi
6275
6276 : determine the architecture name
6277 echo " "
6278 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
6279         tarch=`arch`"-$osname"
6280 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
6281         if uname -m > tmparch 2>&1 ; then
6282                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
6283                         -e 's/$/'"-$osname/" tmparch`
6284         else
6285                 tarch="$osname"
6286         fi
6287         $rm -f tmparch
6288 else
6289         tarch="$osname"
6290 fi
6291 case "$myarchname" in
6292 ''|"$tarch") ;;
6293 *)
6294         echo "(Your architecture name used to be $myarchname.)"
6295         archname=''
6296         ;;
6297 esac
6298 case "$targetarch" in
6299 '') ;;
6300 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
6301 esac
6302 myarchname="$tarch"
6303 case "$archname" in
6304 '') dflt="$tarch";;
6305 *) dflt="$archname";;
6306 esac
6307 rp='What is your architecture name'
6308 . ./myread
6309 archname="$ans"
6310 case "$usethreads" in
6311 $define)
6312         echo "Threads selected." >&4
6313         case "$archname" in
6314         *-thread*) echo "...and architecture name already has -thread." >&4
6315                 ;;
6316         *)      archname="$archname-thread"
6317                 echo "...setting architecture name to $archname." >&4
6318                 ;;
6319         esac
6320         ;;
6321 esac
6322 case "$usemultiplicity" in
6323 $define)
6324         echo "Multiplicity selected." >&4
6325         case "$archname" in
6326         *-multi*) echo "...and architecture name already has -multi." >&4
6327                 ;;
6328         *)      archname="$archname-multi"
6329                 echo "...setting architecture name to $archname." >&4
6330                 ;;
6331         esac
6332         ;;
6333 esac
6334 case "$use64bitint$use64bitall" in
6335 *"$define"*)
6336         case "$archname64" in
6337         '')
6338                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
6339                 ;;
6340         *)
6341                 case "$use64bitint" in
6342                 "$define") echo "64 bit integers selected." >&4 ;;
6343                 esac
6344                 case "$use64bitall" in
6345                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
6346                 esac
6347                 case "$archname" in
6348                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
6349                         ;;
6350                 *)      archname="$archname-$archname64"
6351                         echo "...setting architecture name to $archname." >&4
6352                         ;;
6353                 esac
6354                 ;;
6355         esac
6356 esac
6357 case "$uselongdouble" in
6358 $define)
6359         echo "Long doubles selected." >&4
6360         case "$longdblsize" in
6361         $doublesize)
6362                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6363                 ;;
6364         *)
6365                 case "$archname" in
6366                 *-ld*) echo "...and architecture name already has -ld." >&4
6367                         ;;
6368                 *)      archname="$archname-ld"
6369                         echo "...setting architecture name to $archname." >&4
6370                         ;;
6371                 esac
6372                 ;;
6373         esac
6374         ;;
6375 esac
6376 case "$useperlio" in
6377 $define)
6378         echo "Perlio selected." >&4
6379         ;;
6380 *)
6381         echo "Perlio not selected, using stdio." >&4
6382         case "$archname" in
6383         *-stdio*) echo "...and architecture name already has -stdio." >&4
6384                 ;;
6385         *)      archname="$archname-stdio"
6386                 echo "...setting architecture name to $archname." >&4
6387                 ;;
6388         esac
6389         ;;
6390 esac
6391
6392 : determine root of directory hierarchy where package will be installed.
6393 case "$prefix" in
6394 '')
6395         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
6396         ;;
6397 *?/)
6398         dflt=`echo "$prefix" | sed 's/.$//'`
6399         ;;
6400 *)
6401         dflt="$prefix"
6402         ;;
6403 esac
6404 $cat <<EOM
6405
6406 By default, $package will be installed in $dflt/bin, manual pages
6407 under $dflt/man, etc..., i.e. with $dflt as prefix for all
6408 installation directories. Typically this is something like /usr/local.
6409 If you wish to have binaries under /usr/bin but other parts of the
6410 installation under /usr/local, that's ok: you will be prompted
6411 separately for each of the installation directories, the prefix being
6412 only used to set the defaults.
6413
6414 EOM
6415 fn=d~
6416 rp='Installation prefix to use?'
6417 . ./getfile
6418 oldprefix=''
6419 case "$prefix" in
6420 '') ;;
6421 *)
6422         case "$ans" in
6423         "$prefix") ;;
6424         *) oldprefix="$prefix";;
6425         esac
6426         ;;
6427 esac
6428 prefix="$ans"
6429 prefixexp="$ansexp"
6430
6431 case "$afsroot" in
6432 '')     afsroot=/afs ;;
6433 *)      afsroot=$afsroot ;;
6434 esac
6435
6436 : is AFS running?
6437 echo " "
6438 case "$afs" in
6439 $define|true)   afs=true ;;
6440 $undef|false)   afs=false ;;
6441 *)      if test -d $afsroot; then
6442                 afs=true
6443         else
6444                 afs=false
6445         fi
6446         ;;
6447 esac
6448 if $afs; then
6449         echo "AFS may be running... I'll be extra cautious then..." >&4
6450 else
6451         echo "AFS does not seem to be running..." >&4
6452 fi
6453
6454 : determine installation prefix for where package is to be installed.
6455 if $afs; then 
6456 $cat <<EOM
6457
6458 Since you are running AFS, I need to distinguish the directory in which
6459 files will reside from the directory in which they are installed (and from
6460 which they are presumably copied to the former directory by occult means).
6461
6462 EOM
6463         case "$installprefix" in
6464         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
6465         *) dflt="$installprefix";;
6466         esac
6467 else
6468 $cat <<EOM
6469
6470 In some special cases, particularly when building $package for distribution,
6471 it is convenient to distinguish the directory in which files should be
6472 installed from the directory ($prefix) in which they will
6473 eventually reside.  For most users, these two directories are the same.
6474
6475 EOM
6476         case "$installprefix" in
6477         '') dflt=$prefix ;;
6478         *) dflt=$installprefix;;
6479         esac
6480 fi
6481 fn=d~
6482 rp='What installation prefix should I use for installing files?'
6483 . ./getfile
6484 installprefix="$ans"
6485 installprefixexp="$ansexp"
6486
6487 : set the prefixit variable, to compute a suitable default value
6488 prefixit='case "$3" in
6489 ""|none)
6490         case "$oldprefix" in
6491         "") eval "$1=\"\$$2\"";;
6492         *)
6493                 case "$3" in
6494                 "") eval "$1=";;
6495                 none)
6496                         eval "tp=\"\$$2\"";
6497                         case "$tp" in
6498                         ""|" ") eval "$1=\"\$$2\"";;
6499                         *) eval "$1=";;
6500                         esac;;
6501                 esac;;
6502         esac;;
6503 *)
6504         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6505         case "$tp" in
6506         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6507         /*-$oldprefix/*|\~*-$oldprefix/*)
6508                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6509         *) eval "$1=\"\$$2\"";;
6510         esac;;
6511 esac'
6512
6513 : get the patchlevel
6514 echo " "
6515 echo "Getting the current patchlevel..." >&4
6516 if $test -r $rsrc/patchlevel.h;then
6517         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
6518         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
6519         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6520         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
6521         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
6522         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
6523        perl_patchlevel=`grep ',"DEVEL[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
6524 else
6525         revision=0
6526         patchlevel=0
6527         subversion=0
6528         api_revision=0
6529         api_version=0
6530         api_subversion=0
6531         perl_patchlevel=0
6532         $echo "(You do not have patchlevel.h.  Eek.)"
6533 fi
6534 if $test -r $rsrc/.patch ; then  
6535         if $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
6536                 perl_patchlevel=`cat $rsrc/.patch`
6537         fi
6538 fi
6539 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
6540 version_patchlevel_string="version $patchlevel subversion $subversion"
6541 case "$perl_patchlevel" in
6542 0|'') ;;
6543 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
6544 esac
6545
6546 $echo "(You have $package $version_patchlevel_string.)"
6547
6548 case "$osname" in
6549 dos|vms)
6550         : XXX Should be a Configure test for double-dots in filenames.
6551         version=`echo $revision $patchlevel $subversion | \
6552                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6553         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6554                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
6555         ;;
6556 *)
6557         version=`echo $revision $patchlevel $subversion | \
6558                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6559         api_versionstring=`echo $api_revision $api_version $api_subversion | \
6560                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
6561         ;;
6562 esac
6563 : Special case the 5.005_xx maintenance series, which used 5.005
6564 : without any subversion label as a subdirectory in $sitelib
6565 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
6566         api_versionstring='5.005'
6567 fi
6568
6569 : determine installation style
6570 : For now, try to deduce it from prefix unless it is already set.
6571 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6572 case "$installstyle" in
6573 '')     case "$prefix" in
6574                 *perl*) dflt='lib';;
6575                 *) dflt='lib/perl5' ;;
6576         esac
6577         ;;
6578 *)      dflt="$installstyle" ;;
6579 esac
6580 : Probably not worth prompting for this since we prompt for all
6581 : the directories individually, and the prompt would be too long and
6582 : confusing anyway.
6583 installstyle=$dflt
6584
6585 : determine where private library files go
6586 : Usual default is /usr/local/lib/perl5/$version.
6587 : Also allow things like /opt/perl/lib/$version, since 
6588 : /opt/perl/lib/perl5... would be redundant.
6589 : The default "style" setting is made in installstyle.U
6590 case "$installstyle" in
6591 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6592 *)       set dflt privlib lib/$version ;;
6593 esac
6594 eval $prefixit
6595 $cat <<EOM
6596
6597 There are some auxiliary files for $package that need to be put into a
6598 private library directory that is accessible by everyone.
6599
6600 EOM
6601 fn=d~+
6602 rp='Pathname where the private library files will reside?'
6603 . ./getfile
6604 privlib="$ans"
6605 privlibexp="$ansexp"
6606 : Change installation prefix, if necessary.
6607 if $test X"$prefix" != X"$installprefix"; then
6608         installprivlib=`echo $privlibexp | sed "s#^$prefix#$installprefix#"`
6609 else
6610         installprivlib="$privlibexp"
6611 fi
6612
6613 : set the prefixup variable, to restore leading tilda escape
6614 prefixup='case "$prefixexp" in
6615 "$prefix") ;;
6616 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6617 esac'
6618
6619 : determine where public architecture dependent libraries go
6620 set archlib archlib
6621 eval $prefixit
6622 : privlib default is /usr/local/lib/$package/$version
6623 : archlib default is /usr/local/lib/$package/$version/$archname
6624 : privlib may have an optional trailing /share.
6625 tdflt=`echo $privlib | $sed 's,/share$,,'`
6626 tdflt=$tdflt/$archname
6627 case "$archlib" in
6628 '')     dflt=$tdflt
6629         ;;
6630 *)      dflt="$archlib"
6631     ;;
6632 esac
6633 $cat <<EOM
6634
6635 $spackage contains architecture-dependent library files.  If you are
6636 sharing libraries in a heterogeneous environment, you might store
6637 these files in a separate location.  Otherwise, you can just include
6638 them with the rest of the public library files.
6639
6640 EOM
6641 fn=d+~
6642 rp='Where do you want to put the public architecture-dependent libraries?'
6643 . ./getfile
6644 archlib="$ans"
6645 archlibexp="$ansexp"
6646 if $test X"$archlib" = X"$privlib"; then
6647         d_archlib="$undef"
6648 else
6649         d_archlib="$define"
6650 fi
6651 : Change installation prefix, if necessary.
6652 if $test X"$prefix" != X"$installprefix"; then
6653         installarchlib=`echo $archlibexp | sed "s#^$prefix#$installprefix#"`
6654 else
6655         installarchlib="$archlibexp"
6656 fi
6657
6658 : see if setuid scripts can be secure
6659 $cat <<EOM
6660
6661 Some kernels have a bug that prevents setuid #! scripts from being
6662 secure.  Some sites have disabled setuid #! scripts because of this.
6663
6664 First let's decide if your kernel supports secure setuid #! scripts.
6665 (If setuid #! scripts would be secure but have been disabled anyway,
6666 don't say that they are secure if asked.)
6667
6668 EOM
6669
6670 val="$undef"
6671 if $test -d /dev/fd; then
6672         echo "#!$ls" >reflect
6673         chmod +x,u+s reflect
6674         ./reflect >flect 2>&1
6675         if $contains "/dev/fd" flect >/dev/null; then
6676                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6677                 val="$define"
6678         else
6679                 $cat <<EOM
6680 If you are not sure if they are secure, I can check but I'll need a
6681 username and password different from the one you are using right now.
6682 If you don't have such a username or don't want me to test, simply
6683 enter 'none'.
6684
6685 EOM
6686                 rp='Other username to test security of setuid scripts with?'
6687                 dflt='none'
6688                 . ./myread
6689                 case "$ans" in
6690                 n|none)
6691                         case "$d_suidsafe" in
6692                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6693                                 dflt=n;;
6694                         "$undef")
6695                                 echo "Well, the $hint value is *not* secure." >&4
6696                                 dflt=n;;
6697                         *)      echo "Well, the $hint value *is* secure." >&4
6698                                 dflt=y;;
6699                         esac
6700                         ;;
6701                 *)
6702                         $rm -f reflect flect
6703                         echo "#!$ls" >reflect
6704                         chmod +x,u+s reflect
6705                         echo >flect
6706                         chmod a+w flect
6707                         echo '"su" will (probably) prompt you for '"$ans's password."
6708                         su $ans -c './reflect >flect'
6709                         if $contains "/dev/fd" flect >/dev/null; then
6710                                 echo "Okay, it looks like setuid scripts are secure." >&4
6711                                 dflt=y
6712                         else
6713                                 echo "I don't think setuid scripts are secure." >&4
6714                                 dflt=n
6715                         fi
6716                         ;;
6717                 esac
6718                 rp='Does your kernel have *secure* setuid scripts?'
6719                 . ./myread
6720                 case "$ans" in
6721                 [yY]*)  val="$define";;
6722                 *)      val="$undef";;
6723                 esac
6724         fi
6725 else
6726         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6727         echo "(That's for file descriptors, not floppy disks.)"
6728         val="$undef"
6729 fi
6730 set d_suidsafe
6731 eval $setvar
6732
6733 $rm -f reflect flect
6734
6735 : now see if they want to do setuid emulation
6736 echo " "
6737 val="$undef"
6738 case "$d_suidsafe" in
6739 "$define")
6740         val="$undef"
6741         echo "No need to emulate SUID scripts since they are secure here." >&4
6742         ;;
6743 *)
6744         $cat <<EOM
6745 Some systems have disabled setuid scripts, especially systems where
6746 setuid scripts cannot be secure.  On systems where setuid scripts have
6747 been disabled, the setuid/setgid bits on scripts are currently
6748 useless.  It is possible for $package to detect those bits and emulate
6749 setuid/setgid in a secure fashion.  This emulation will only work if
6750 setuid scripts have been disabled in your kernel.
6751
6752 EOM
6753         case "$d_dosuid" in
6754         "$define") dflt=y ;;
6755         *) dflt=n ;;
6756         esac
6757         rp="Do you want to do setuid/setgid emulation?"
6758         . ./myread
6759         case "$ans" in
6760         [yY]*)  val="$define";;
6761         *)      val="$undef";;
6762         esac
6763         ;;
6764 esac
6765 set d_dosuid
6766 eval $setvar
6767
6768 : see if this is a malloc.h system
6769 : we want a real compile instead of Inhdr because some systems have a
6770 : malloc.h that just gives a compile error saying to use stdlib.h instead
6771 echo " "
6772 $cat >try.c <<EOCP
6773 #include <stdlib.h>
6774 #include <malloc.h>
6775 int main () { return 0; }
6776 EOCP
6777 set try
6778 if eval $compile; then
6779     echo "<malloc.h> found." >&4
6780     val="$define"
6781 else
6782     echo "<malloc.h> NOT found." >&4
6783     val="$undef"
6784 fi
6785 $rm -f try.c try
6786 set i_malloc
6787 eval $setvar
6788
6789 : check for void type
6790 echo " "
6791 echo "Checking to see how well your C compiler groks the void type..." >&4
6792 case "$voidflags" in
6793 '')
6794         $cat >try.c <<EOCP
6795 #$i_stdlib I_STDLIB
6796 #ifdef I_STDLIB
6797 #include <stdlib.h>
6798 #endif
6799 #if TRY & 1
6800 void sub() {
6801 #else
6802 sub() {
6803 #endif
6804         extern void moo();      /* function returning void */
6805         void (*goo)();          /* ptr to func returning void */
6806 #if TRY & 8
6807         void *hue;              /* generic ptr */
6808 #endif
6809 #if TRY & 2
6810         void (*foo[10])();
6811 #endif
6812
6813 #if TRY & 4
6814         if(goo == moo) {
6815                 exit(0);
6816         }
6817 #endif
6818         exit(0);
6819 }
6820 int main() { sub(); }
6821 EOCP
6822         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6823                 voidflags=$defvoidused
6824         echo "Good.  It appears to support void to the level $package wants.">&4
6825                 if $contains warning .out >/dev/null 2>&1; then
6826                         echo "However, you might get some warnings that look like this:"
6827                         $cat .out
6828                 fi
6829         else
6830 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6831                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6832                         echo "It supports 1..."
6833                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6834                                 echo "It also supports 2..."
6835                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6836                                         voidflags=7
6837                                         echo "And it supports 4 but not 8 definitely."
6838                                 else
6839                                         echo "It doesn't support 4..."
6840                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6841                                                 voidflags=11
6842                                                 echo "But it supports 8."
6843                                         else
6844                                                 voidflags=3
6845                                                 echo "Neither does it support 8."
6846                                         fi
6847                                 fi
6848                         else
6849                                 echo "It does not support 2..."
6850                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6851                                         voidflags=13
6852                                         echo "But it supports 4 and 8."
6853                                 else
6854                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6855                                                 voidflags=5
6856                                                 echo "And it supports 4 but has not heard about 8."
6857                                         else
6858                                                 echo "However it supports 8 but not 4."
6859                                         fi
6860                                 fi
6861                         fi
6862                 else
6863                         echo "There is no support at all for void."
6864                         voidflags=0
6865                 fi
6866         fi
6867 esac
6868 case "$voidflags" in
6869 "$defvoidused") ;;
6870 *)      $cat >&4 <<'EOM'
6871   Support flag bits are:
6872     1: basic void declarations.
6873     2: arrays of pointers to functions returning void.
6874     4: operations between pointers to and addresses of void functions.
6875     8: generic void pointers.
6876 EOM
6877         dflt="$voidflags";
6878         rp="Your void support flags add up to what?"
6879         . ./myread
6880         voidflags="$ans"
6881         ;;
6882 esac
6883 $rm -f try.* .out
6884
6885 : check for length of pointer
6886 echo " "
6887 case "$ptrsize" in
6888 '')
6889         echo "Checking to see how big your pointers are..." >&4
6890         if test "$voidflags" -gt 7; then
6891                 echo '#define VOID_PTR char *' > try.c
6892         else
6893                 echo '#define VOID_PTR void *' > try.c
6894         fi
6895         $cat >>try.c <<EOCP
6896 #include <stdio.h>
6897 #$i_stdlib I_STDLIB
6898 #ifdef I_STDLIB
6899 #include <stdlib.h>
6900 #endif
6901 int main()
6902 {
6903     printf("%d\n", (int)sizeof(VOID_PTR));
6904     exit(0);
6905 }
6906 EOCP
6907         set try
6908         if eval $compile_ok; then
6909                 ptrsize=`$run ./try`
6910                 echo "Your pointers are $ptrsize bytes long."
6911         else
6912                 dflt='4'
6913                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6914                 rp="What is the size of a pointer (in bytes)?"
6915                 . ./myread
6916                 ptrsize="$ans"
6917         fi
6918         ;;
6919 esac
6920 $rm -f try.c try
6921 case "$use64bitall" in
6922 "$define"|true|[yY]*)
6923         case "$ptrsize" in
6924         4)      cat <<EOM >&4
6925
6926 *** You have chosen a maximally 64-bit build, but your pointers
6927 *** are only 4 bytes wide, disabling maximal 64-bitness.
6928
6929 EOM
6930                 use64bitall="$undef"
6931                 case "$use64bitint" in
6932                 "$define"|true|[yY]*) ;;
6933                 *)      cat <<EOM >&4
6934
6935 *** Downgrading from maximal 64-bitness to using 64-bit integers.
6936
6937 EOM
6938                         use64bitint="$define"
6939                         ;;
6940                 esac
6941                 ;;
6942         esac
6943         ;;
6944 esac
6945
6946
6947 : determine which malloc to compile in
6948 echo " "
6949 case "$usemymalloc" in
6950 [yY]*|true|$define)     dflt='y' ;;
6951 [nN]*|false|$undef)     dflt='n' ;;
6952 *)      case "$ptrsize" in
6953         4) dflt='y' ;;
6954         *) dflt='n' ;;
6955         esac
6956         ;;
6957 esac
6958 rp="Do you wish to attempt to use the malloc that comes with $package?"
6959 . ./myread
6960 usemymalloc="$ans"
6961 case "$ans" in
6962 y*|true)
6963         usemymalloc='y'
6964         mallocsrc='malloc.c'
6965         mallocobj="malloc$_o"
6966         d_mymalloc="$define"
6967         case "$libs" in
6968         *-lmalloc*)
6969                 : Remove malloc from list of libraries to use
6970                 echo "Removing unneeded -lmalloc from library list" >&4
6971                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6972                 shift
6973                 libs="$*"
6974                 echo "libs = $libs" >&4
6975                 ;;
6976         esac
6977         ;;
6978 *)
6979         usemymalloc='n'
6980         mallocsrc=''
6981         mallocobj=''
6982         d_mymalloc="$undef"
6983         ;;
6984 esac
6985
6986 : compute the return types of malloc and free
6987 echo " "
6988 $cat >malloc.c <<END
6989 #$i_malloc I_MALLOC
6990 #$i_stdlib I_STDLIB
6991 #include <stdio.h>
6992 #include <sys/types.h>
6993 #ifdef I_MALLOC
6994 #include <malloc.h>
6995 #endif
6996 #ifdef I_STDLIB
6997 #include <stdlib.h>
6998 #endif
6999 #ifdef TRY_MALLOC
7000 void *malloc();
7001 #endif
7002 #ifdef TRY_FREE
7003 void free();
7004 #endif
7005 END
7006 case "$malloctype" in
7007 '')
7008         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
7009                 malloctype='void *'
7010         else
7011                 malloctype='char *'
7012         fi
7013         ;;
7014 esac
7015 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
7016
7017 case "$freetype" in
7018 '')
7019         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
7020                 freetype='void'
7021         else
7022                 freetype='int'
7023         fi
7024         ;;
7025 esac
7026 echo "Your system uses $freetype free(), it would seem." >&4
7027 $rm -f malloc.[co]
7028 $cat <<EOM
7029
7030 After $package is installed, you may wish to install various
7031 add-on modules and utilities.  Typically, these add-ons will
7032 be installed under $prefix with the rest
7033 of this package.  However, you may wish to install such add-ons
7034 elsewhere under a different prefix.
7035
7036 If you do not wish to put everything under a single prefix, that's
7037 ok.  You will be prompted for the individual locations; this siteprefix
7038 is only used to suggest the defaults.
7039
7040 The default should be fine for most people.
7041
7042 EOM
7043 fn=d~+
7044 rp='Installation prefix to use for add-on modules and utilities?'
7045 : XXX Here might be another good place for an installstyle setting.
7046 case "$siteprefix" in
7047 '') dflt=$prefix ;;
7048 *)  dflt=$siteprefix ;;
7049 esac
7050 . ./getfile
7051 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7052 oldsiteprefix=''
7053 case "$siteprefix" in
7054 '') ;;
7055 *)      case "$ans" in
7056         "$prefix") ;;
7057         *) oldsiteprefix="$prefix";;
7058         esac
7059         ;;
7060 esac
7061 siteprefix="$ans"
7062 siteprefixexp="$ansexp"
7063
7064 : determine where site specific libraries go.
7065 : Usual default is /usr/local/lib/perl5/site_perl/$version
7066 : The default "style" setting is made in installstyle.U
7067 : XXX No longer works with Prefixit stuff.
7068 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7069 case "$sitelib" in
7070 '') case "$installstyle" in
7071         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
7072         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
7073         esac
7074         ;;
7075 *)      dflt="$sitelib"
7076         ;;
7077 esac
7078 $cat <<EOM
7079
7080 The installation process will create a directory for
7081 site-specific extensions and modules.  Most users find it convenient
7082 to place all site-specific files in this directory rather than in the
7083 main distribution directory.
7084
7085 EOM
7086 fn=d~+
7087 rp='Pathname for the site-specific library files?'
7088 . ./getfile
7089 sitelib="$ans"
7090 sitelibexp="$ansexp"
7091 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
7092 : Change installation prefix, if necessary.
7093 if $test X"$prefix" != X"$installprefix"; then
7094         installsitelib=`echo $sitelibexp | $sed "s#^$prefix#$installprefix#"`
7095 else
7096         installsitelib="$sitelibexp"
7097 fi
7098
7099 : determine where site specific architecture-dependent libraries go.
7100 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
7101 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
7102 : sitelib may have an optional trailing /share.
7103 case "$sitearch" in
7104 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
7105         dflt="$dflt/$archname"
7106         ;;
7107 *)      dflt="$sitearch"
7108         ;;
7109 esac
7110 set sitearch sitearch none
7111 eval $prefixit
7112 $cat <<EOM
7113
7114 The installation process will also create a directory for
7115 architecture-dependent site-specific extensions and modules.
7116
7117 EOM
7118 fn=d~+
7119 rp='Pathname for the site-specific architecture-dependent library files?'
7120 . ./getfile
7121 sitearch="$ans"
7122 sitearchexp="$ansexp"
7123 : Change installation prefix, if necessary.
7124 if $test X"$prefix" != X"$installprefix"; then
7125         installsitearch=`echo $sitearchexp | sed "s#^$prefix#$installprefix#"`
7126 else
7127         installsitearch="$sitearchexp"
7128 fi
7129
7130 $cat <<EOM
7131
7132 The installation process will also create a directory for
7133 vendor-supplied add-ons.  Vendors who supply perl with their system
7134 may find it convenient to place all vendor-supplied files in this
7135 directory rather than in the main distribution directory.  This will
7136 ease upgrades between binary-compatible maintenance versions of perl.
7137
7138 Of course you may also use these directories in whatever way you see
7139 fit.  For example, you might use them to access modules shared over a
7140 company-wide network.
7141
7142 The default answer should be fine for most people.
7143 This causes further questions about vendor add-ons to be skipped
7144 and no vendor-specific directories will be configured for perl.
7145
7146 EOM
7147 rp='Do you want to configure vendor-specific add-on directories?'
7148 case "$usevendorprefix" in
7149 define|true|[yY]*) dflt=y ;;
7150 *)      : User may have set vendorprefix directly on Configure command line.
7151         case "$vendorprefix" in
7152         ''|' ') dflt=n ;;
7153         *)      dflt=y ;;
7154         esac
7155         ;;
7156 esac
7157 . ./myread
7158 case "$ans" in
7159 [yY]*)  fn=d~+
7160         rp='Installation prefix to use for vendor-supplied add-ons?'
7161         case "$vendorprefix" in
7162         '') dflt='' ;;
7163         *)  dflt=$vendorprefix ;;
7164         esac
7165         . ./getfile
7166         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
7167         oldvendorprefix=''
7168         case "$vendorprefix" in
7169         '') ;;
7170         *)      case "$ans" in
7171                 "$prefix") ;;
7172                 *) oldvendorprefix="$prefix";;
7173                 esac
7174                 ;;
7175         esac
7176         usevendorprefix="$define"
7177         vendorprefix="$ans"
7178         vendorprefixexp="$ansexp"
7179         ;;
7180 *)      usevendorprefix="$undef"
7181         vendorprefix=''
7182         vendorprefixexp=''
7183         ;;
7184 esac
7185
7186 case "$vendorprefix" in
7187 '')     d_vendorlib="$undef"
7188         vendorlib=''
7189         vendorlibexp=''
7190         ;;
7191 *)      d_vendorlib="$define"
7192         : determine where vendor-supplied modules go.
7193         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
7194         case "$vendorlib" in
7195         '')
7196                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
7197                 case "$installstyle" in
7198                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
7199                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
7200                 esac
7201                 ;;
7202         *)      dflt="$vendorlib"
7203                 ;;
7204         esac
7205         fn=d~+
7206         rp='Pathname for the vendor-supplied library files?'
7207         . ./getfile
7208         vendorlib="$ans"
7209         vendorlibexp="$ansexp"
7210         ;;
7211 esac
7212 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
7213 : Change installation prefix, if necessary.
7214 if $test X"$prefix" != X"$installprefix"; then
7215         installvendorlib=`echo $vendorlibexp | $sed "s#^$prefix#$installprefix#"`
7216 else
7217         installvendorlib="$vendorlibexp"
7218 fi
7219
7220 case "$vendorprefix" in
7221 '')     d_vendorarch="$undef"
7222         vendorarch=''
7223         vendorarchexp=''
7224         ;;
7225 *)      d_vendorarch="$define"
7226         : determine where vendor-supplied architecture-dependent libraries go.
7227         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
7228         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
7229         : vendorlib may have an optional trailing /share.
7230         case "$vendorarch" in
7231         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
7232                 dflt="$dflt/$archname"
7233                 ;;
7234         *)      dflt="$vendorarch" ;;
7235         esac
7236         fn=d~+
7237         rp='Pathname for vendor-supplied architecture-dependent files?'
7238         . ./getfile
7239         vendorarch="$ans"
7240         vendorarchexp="$ansexp"
7241         ;;
7242 esac
7243 : Change installation prefix, if necessary.
7244 if $test X"$prefix" != X"$installprefix"; then
7245         installvendorarch=`echo $vendorarchexp | sed "s#^$prefix#$installprefix#"`
7246 else
7247         installvendorarch="$vendorarchexp"
7248 fi
7249
7250 : Final catch-all directories to search
7251 $cat <<EOM
7252
7253 Lastly, you can have perl look in other directories for extensions and
7254 modules in addition to those already specified.
7255 These directories will be searched after 
7256         $sitearch 
7257         $sitelib 
7258 EOM
7259 test X"$vendorlib" != "X" && echo '     ' $vendorlib
7260 test X"$vendorarch" != "X" && echo '    ' $vendorarch
7261 echo ' '
7262 case "$otherlibdirs" in
7263 ''|' ') dflt='none' ;;
7264 *)      dflt="$otherlibdirs" ;;
7265 esac
7266 $cat <<EOM
7267 Enter a colon-separated set of extra paths to include in perl's @INC
7268 search path, or enter 'none' for no extra paths.
7269
7270 EOM
7271
7272 rp='Colon-separated list of additional directories for perl to search?'
7273 . ./myread
7274 case "$ans" in
7275 ' '|''|none)    otherlibdirs=' ' ;;     
7276 *)      otherlibdirs="$ans" ;;
7277 esac
7278 case "$otherlibdirs" in
7279 ' ') val=$undef ;;
7280 *)      val=$define ;;
7281 esac
7282 set d_perl_otherlibdirs
7283 eval $setvar
7284
7285 : Cruising for prototypes
7286 echo " "
7287 echo "Checking out function prototypes..." >&4
7288 $cat >prototype.c <<'EOCP'
7289 int main(int argc, char *argv[]) {
7290         exit(0);}
7291 EOCP
7292 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
7293         echo "Your C compiler appears to support function prototypes."
7294         val="$define"
7295 else
7296         echo "Your C compiler doesn't seem to understand function prototypes."
7297         val="$undef"
7298 fi
7299 set prototype
7300 eval $setvar
7301 $rm -f prototype*
7302
7303 case "$prototype" in
7304 "$define") ;;
7305 *)      ansi2knr='ansi2knr'
7306         echo " "
7307         cat <<EOM >&4
7308
7309 $me:  FATAL ERROR:
7310 This version of $package can only be compiled by a compiler that 
7311 understands function prototypes.  Unfortunately, your C compiler 
7312         $cc $ccflags
7313 doesn't seem to understand them.  Sorry about that.
7314
7315 If GNU cc is available for your system, perhaps you could try that instead.  
7316
7317 Eventually, we hope to support building Perl with pre-ANSI compilers.
7318 If you would like to help in that effort, please contact <perlbug@perl.org>.
7319
7320 Aborting Configure now.
7321 EOM
7322         exit 2
7323         ;;
7324 esac
7325
7326 : determine where public executables go
7327 echo " "
7328 set dflt bin bin
7329 eval $prefixit
7330 fn=d~
7331 rp='Pathname where the public executables will reside?'
7332 . ./getfile
7333 if $test "X$ansexp" != "X$binexp"; then
7334         installbin=''
7335 fi
7336 bin="$ans"
7337 binexp="$ansexp"
7338 : Change installation prefix, if necessary.
7339 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
7340 if $test X"$prefix" != X"$installprefix"; then
7341         installbin=`echo $binexp | sed "s#^$prefix#$installprefix#"`
7342 else
7343         installbin="$binexp"
7344 fi
7345
7346 echo " "
7347 case "$extras" in
7348 '') dflt='n';;
7349 *) dflt='y';;
7350 esac
7351 cat <<EOM
7352 Perl can be built with extra modules or bundles of modules which
7353 will be fetched from the CPAN and installed alongside Perl.
7354
7355 Notice that you will need access to the CPAN; either via the Internet,
7356 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7357 be asked later to configure the CPAN.pm module which will in turn do
7358 the installation of the rest of the extra modules or bundles.)
7359
7360 Notice also that if the modules require any external software such as
7361 libraries and headers (the libz library and the zlib.h header for the
7362 Compress::Zlib module, for example) you MUST have any such software
7363 already installed, this configuration process will NOT install such
7364 things for you.
7365
7366 If this doesn't make any sense to you, just accept the default '$dflt'.
7367 EOM
7368 rp='Install any extra modules (y or n)?'
7369 . ./myread
7370 case "$ans" in
7371 y|Y)
7372         cat <<EOM
7373
7374 Please list any extra modules or bundles to be installed from CPAN,
7375 with spaces between the names.  The names can be in any format the
7376 'install' command of CPAN.pm will understand.  (Answer 'none',
7377 without the quotes, to install no extra modules or bundles.)
7378 EOM
7379         rp='Extras?'
7380         dflt="$extras"
7381         . ./myread
7382         extras="$ans"
7383 esac
7384 case "$extras" in
7385 ''|'none')
7386         val=''
7387         $rm -f ../extras.lst
7388         ;;
7389 *)      echo "(Saving the list of extras for later...)"
7390         echo "$extras" > ../extras.lst
7391         val="'$extras'"
7392         ;;
7393 esac
7394 set extras
7395 eval $setvar
7396 echo " "
7397
7398 : determine where html pages for programs go
7399 set html1dir html1dir none
7400 eval $prefixit
7401 $cat <<EOM
7402
7403 If you wish to install html files for programs in $spackage, indicate 
7404 the appropriate directory here.  To skip installing html files,
7405 answer "none".
7406 EOM
7407 case "$html1dir" in
7408 ''|none|$undef|' ') dflt=none ;;
7409 *) dflt=$html1dir ;;
7410 esac
7411 fn=dn+~
7412 rp="Directory for the main $spackage html pages?"
7413 . ./getfile
7414 html1dir="$ans"
7415 html1direxp="$ansexp"
7416 : Use ' ' for none so value is preserved next time through Configure
7417 $test X"$html1dir" = "X" && html1dir=' '
7418 : Change installation prefix, if necessary.
7419 if $test X"$prefix" != X"$installprefix"; then
7420         installhtml1dir=`echo $html1direxp | sed "s#^$prefix#$installprefix#"`
7421 else
7422         installhtml1dir="$html1direxp"
7423 fi
7424
7425 : determine where html pages for libraries and modules go
7426 set html3dir html3dir none
7427 eval $prefixit
7428 $cat <<EOM
7429
7430 If you wish to install html files for modules associated with $spackage,
7431 indicate the appropriate directory here.  To skip installing html files,
7432 answer "none".
7433 EOM
7434 : There is no obvious default.  If they have specified html1dir, then
7435 : try to key off that, possibly changing .../html1 into .../html3.
7436 case "$html3dir" in
7437 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7438 *) dflt=$html3dir ;;
7439 esac
7440 fn=dn+~
7441 rp="Directory for the $spackage module html pages?"
7442 . ./getfile
7443 html3dir="$ans"
7444 html3direxp="$ansexp"
7445 : Use ' ' for none so value is preserved next time through Configure
7446 $test X"$html3dir" = "X" && html3dir=' '
7447 : Change installation prefix, if necessary.
7448 if $test X"$prefix" != X"$installprefix"; then
7449         installhtml3dir=`echo $html3direxp | sed "s#^$prefix#$installprefix#"`
7450 else
7451         installhtml3dir="$html3direxp"
7452 fi
7453
7454 : Find perl5.005 or later.
7455 echo "Looking for a previously installed perl5.005 or later... "
7456 case "$perl5" in
7457 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
7458                 : Check if this perl is recent and can load a simple module
7459                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7460                         perl5=$tdir/perl
7461                         break;
7462                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
7463                         perl5=$tdir/perl5
7464                         break;
7465                 fi
7466         done
7467         ;;
7468 *)      perl5="$perl5"
7469         ;;
7470 esac
7471 case "$perl5" in
7472 '')     echo "None found.  That's ok.";;
7473 *)      echo "Using $perl5." ;;
7474 esac
7475
7476 : Determine list of previous versions to include in @INC
7477 $cat > getverlist <<EOPL
7478 #!$perl5 -w
7479 use File::Basename;
7480 \$api_versionstring = "$api_versionstring";
7481 \$version = "$version";
7482 \$stem = "$sitelib_stem";
7483 \$archname = "$archname";
7484 EOPL
7485         $cat >> getverlist <<'EOPL'
7486 # Can't have leading @ because metaconfig interprets it as a command!
7487 ;@inc_version_list=();
7488 # XXX Redo to do opendir/readdir? 
7489 if (-d $stem) {
7490     chdir($stem);
7491     ;@candidates = glob("5.*");
7492 }
7493 else {
7494     ;@candidates = ();
7495 }
7496
7497 # XXX ToDo:  These comparisons must be reworked when two-digit
7498 # subversions come along, so that 5.7.10 compares as greater than
7499 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
7500 # widespread that we can use the built-in version vectors rather
7501 # than reinventing them here.  For 5.6.0, however, we must
7502 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
7503 foreach $d (@candidates) {
7504     if ($d lt $version) {
7505         if ($d ge $api_versionstring) {
7506             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
7507         }
7508         elsif ($d ge "5.005") {
7509             unshift(@inc_version_list, grep { -d } $d);
7510         }
7511     }
7512     else {
7513         # Skip newer version.  I.e. don't look in
7514         # 5.7.0 if we're installing 5.6.1.
7515     }
7516 }
7517
7518 if (@inc_version_list) {
7519     print join(' ', @inc_version_list);
7520 }
7521 else {
7522     # Blank space to preserve value for next Configure run.
7523     print " ";
7524 }
7525 EOPL
7526 chmod +x getverlist
7527 case "$inc_version_list" in
7528 '')     if test -x "$perl5$exe_ext"; then
7529                 dflt=`$perl5 getverlist`
7530         else
7531                 dflt='none'
7532         fi
7533         ;;
7534 $undef) dflt='none' ;;
7535 *)  eval dflt=\"$inc_version_list\" ;;
7536 esac
7537 case "$dflt" in
7538 ''|' ') dflt=none ;;
7539 esac
7540 case "$dflt" in
7541 5.005) dflt=none ;;
7542 esac
7543 $cat <<EOM
7544
7545 In order to ease the process of upgrading, this version of perl 
7546 can be configured to use modules built and installed with earlier 
7547 versions of perl that were installed under $prefix.  Specify here
7548 the list of earlier versions that this version of perl should check.
7549 If Configure detected no earlier versions of perl installed under
7550 $prefix, then the list will be empty.  Answer 'none' to tell perl
7551 to not search earlier versions.
7552
7553 The default should almost always be sensible, so if you're not sure,
7554 just accept the default.
7555 EOM
7556
7557 rp='List of earlier versions to include in @INC?'
7558 . ./myread
7559 case "$ans" in
7560 [Nn]one|''|' ') inc_version_list=' ' ;;
7561 *) inc_version_list="$ans" ;;
7562 esac
7563 case "$inc_version_list" in
7564 ''|' ') 
7565         inc_version_list_init='0';;
7566 *)      inc_version_list_init=`echo $inc_version_list |
7567                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
7568         ;;
7569 esac
7570 $rm -f getverlist
7571
7572 : determine whether to install perl also as /usr/bin/perl
7573
7574 echo " "
7575 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7576         $cat <<EOM
7577 Many scripts expect perl to be installed as /usr/bin/perl.
7578
7579 If you want to, I can install the perl you are about to compile
7580 as /usr/bin/perl (in addition to $bin/perl).
7581 EOM
7582         if test -f /usr/bin/perl; then
7583             $cat <<EOM
7584
7585 However, please note that because you already have a /usr/bin/perl,
7586 overwriting that with a new Perl would very probably cause problems.
7587 Therefore I'm assuming you don't want to do that (unless you insist).
7588
7589 EOM
7590             case "$installusrbinperl" in
7591             "$define"|[yY]*)    dflt='y';;
7592             *)                  dflt='n';;
7593             esac
7594         else
7595             $cat <<EOM
7596
7597 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7598
7599 EOM
7600             case "$installusrbinperl" in
7601             "$undef"|[nN]*)     dflt='n';;
7602             *)                  dflt='y';;
7603             esac
7604         fi
7605         rp="Do you want to install perl as /usr/bin/perl?"
7606         . ./myread
7607         case "$ans" in
7608         [yY]*)  val="$define";;
7609         *)      val="$undef" ;;
7610         esac
7611 else
7612         val="$undef"
7613 fi
7614 set installusrbinperl
7615 eval $setvar
7616
7617 : see if dld is available
7618 set dld.h i_dld
7619 eval $inhdr
7620
7621 : see if dlopen exists
7622 xxx_runnm="$runnm"
7623 runnm=false
7624 set dlopen d_dlopen
7625 eval $inlibc
7626 runnm="$xxx_runnm"
7627
7628 : determine which dynamic loading, if any, to compile in
7629 echo " "
7630 dldir="ext/DynaLoader"
7631 case "$usedl" in
7632 $define|y|true)
7633         dflt='y'
7634         usedl="$define"
7635         ;;
7636 $undef|n|false)
7637         dflt='n'
7638         usedl="$undef"
7639         ;;
7640 *) 
7641         dflt='n'
7642         case "$d_dlopen" in
7643             $define) dflt='y' ;;
7644         esac
7645         case "$i_dld" in
7646             $define) dflt='y' ;;
7647         esac
7648         : Does a dl_xxx.xs file exist for this operating system
7649         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7650         ;;
7651 esac
7652 rp="Do you wish to use dynamic loading?"
7653 . ./myread
7654 usedl="$ans"
7655 case "$ans" in
7656 y*) usedl="$define"
7657         case "$dlsrc" in
7658         '')
7659                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7660                         dflt="$dldir/dl_${osname}.xs"
7661                 elif $test "$d_dlopen" = "$define" ; then
7662                         dflt="$dldir/dl_dlopen.xs"
7663                 elif $test "$i_dld" = "$define" ; then
7664                         dflt="$dldir/dl_dld.xs"
7665                 else
7666                         dflt=''
7667                 fi
7668                 ;;
7669         *)      dflt="$dldir/$dlsrc"
7670                 ;;
7671         esac
7672     echo "The following dynamic loading files are available:"
7673         : Can not go over to $dldir because getfile has path hard-coded in.
7674         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7675         rp="Source file to use for dynamic loading"
7676         fn="fne"
7677         gfpth="$src"
7678         . ./getfile
7679         usedl="$define"
7680         : emulate basename
7681         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7682
7683         $cat << EOM
7684
7685 Some systems may require passing special flags to $cc -c to
7686 compile modules that will be used to create a shared library.
7687 To use no flags, say "none".
7688
7689 EOM
7690     case "$cccdlflags" in
7691     '') case "$gccversion" in
7692                 '') case "$osname" in
7693                         hpux)   dflt='+z' ;;
7694                         next)   dflt='none' ;;
7695                         irix*)  dflt='-KPIC' ;;
7696                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7697                         sunos)  dflt='-pic' ;;
7698                         *)      dflt='none' ;;
7699                     esac
7700                         ;;
7701                 *)  case "$osname" in
7702                         darwin) dflt='none' ;;
7703                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7704                         *)      dflt='-fpic' ;;
7705                     esac ;;
7706             esac ;;
7707         ' ') dflt='none' ;;
7708     *)  dflt="$cccdlflags" ;;
7709     esac
7710     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7711     . ./myread
7712     case "$ans" in
7713     none) cccdlflags=' ' ;;
7714     *) cccdlflags="$ans" ;;
7715     esac
7716
7717     cat << EOM
7718
7719 Some systems use ld to create libraries that can be dynamically loaded,
7720 while other systems (such as those using ELF) use $cc.
7721
7722 EOM
7723         case "$ld" in
7724         '')     $cat >try.c <<'EOM'
7725 /* Test for whether ELF binaries are produced */
7726 #include <fcntl.h>
7727 #include <stdlib.h>
7728 int main() {
7729         char b[4];
7730         int i = open("a.out",O_RDONLY);
7731         if(i == -1) 
7732                 exit(1); /* fail */
7733         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7734                 exit(0); /* succeed (yes, it's ELF) */
7735         else
7736                 exit(1); /* fail */
7737 }
7738 EOM
7739                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7740                         cat <<EOM
7741 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7742 EOM
7743                         dflt="$cc"
7744                 else
7745                         echo "I'll use ld to build dynamic libraries."
7746                         dflt='ld'
7747                 fi
7748                 rm -f try.c a.out
7749                 ;;
7750         *)      dflt="$ld"
7751                 ;;
7752         esac
7753
7754     rp="What command should be used to create dynamic libraries?"
7755     . ./myread
7756         ld="$ans"
7757
7758     cat << EOM
7759
7760 Some systems may require passing special flags to $ld to create a
7761 library that can be dynamically loaded.  If your ld flags include
7762 -L/other/path options to locate libraries outside your loader's normal
7763 search path, you may need to specify those -L options here as well.  To
7764 use no flags, say "none".
7765
7766 EOM
7767     case "$lddlflags" in
7768     '') case "$osname" in
7769                         beos) dflt='-nostart' ;;
7770                         hpux) dflt='-b';
7771                               case "$gccversion" in
7772                               '') dflt="$dflt +vnocompatwarnings" ;;
7773                               esac
7774                               ;;        
7775                         linux|irix*)    dflt='-shared' ;;
7776                         next)  dflt='none' ;;
7777                         solaris) dflt='-G' ;;
7778                         sunos) dflt='-assert nodefinitions' ;;
7779                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7780                 *)     dflt='none' ;;
7781                         esac
7782                         ;;
7783     *) dflt="$lddlflags" ;;
7784     esac
7785
7786         : Try to guess additional flags to pick up local libraries.
7787         : Be careful not to append to a plain 'none'
7788         case "$dflt" in
7789         none) dflt='' ;;
7790         esac
7791         for thisflag in $ldflags; do
7792                 case "$thisflag" in
7793                 -L*|-R*|-Wl,-R*)
7794                         case " $dflt " in
7795                         *" $thisflag "*) ;;
7796                         *) dflt="$dflt $thisflag" ;;
7797                         esac
7798                         ;;
7799                 esac
7800         done
7801
7802         case "$dflt" in
7803         ''|' ') dflt='none' ;;
7804         esac
7805
7806     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7807     . ./myread
7808     case "$ans" in
7809     none) lddlflags=' ' ;;
7810     *) lddlflags="$ans" ;;
7811     esac
7812
7813         cat <<EOM
7814
7815 Some systems may require passing special flags to $cc to indicate that
7816 the resulting executable will use dynamic linking.  To use no flags,
7817 say "none".
7818
7819 EOM
7820     case "$ccdlflags" in
7821     '') case "$osname" in
7822                 hpux)   dflt='-Wl,-E' ;;
7823                 linux)  dflt='-rdynamic' ;;
7824                 next)   dflt='none' ;;
7825                 sunos)  dflt='none' ;;
7826                 *)      dflt='none' ;;
7827             esac ;;
7828     ' ')  dflt='none' ;;
7829     *)  dflt="$ccdlflags" ;;
7830     esac
7831     rp="Any special flags to pass to $cc to use dynamic linking?"
7832     . ./myread
7833     case "$ans" in
7834     none) ccdlflags=' ' ;;
7835     *) ccdlflags="$ans" ;;
7836     esac
7837     ;;
7838 *)  usedl="$undef"
7839         ld='ld'
7840     dlsrc='dl_none.xs'
7841     lddlflags=''
7842     ccdlflags=''
7843     ;;
7844 esac
7845
7846 also=''
7847 case "$usedl" in
7848 $undef)
7849         # No dynamic loading being used, so don't bother even to prompt.
7850         useshrplib='false'
7851         ;;
7852 *)      case "$useshrplib" in
7853         '')     case "$osname" in
7854                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7855                         dflt=y
7856                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7857                         ;;
7858                 next*)
7859                         case "$osvers" in
7860                         4*)     dflt=y
7861                                 also='Building a shared libperl is needed for MAB support.'
7862                                 ;;
7863                         *)      dflt=n
7864                                 ;;
7865                         esac
7866                         ;;
7867                 *)      dflt=n
7868                         ;;
7869                 esac
7870                 ;;
7871         $define|true|[Yy]*)
7872                 dflt=y
7873                 ;;
7874         *)      dflt=n
7875                 ;;
7876         esac
7877         $cat << EOM
7878
7879 The perl executable is normally obtained by linking perlmain.c with
7880 libperl${_a}, any static extensions (usually just DynaLoader), and
7881 any other libraries needed on this system (such as -lm, etc.).  Since
7882 your system supports dynamic loading, it is probably possible to build
7883 a shared libperl.$so.  If you will have more than one executable linked
7884 to libperl.$so, this will significantly reduce the size of each
7885 executable, but it may have a noticeable affect on performance.  The
7886 default is probably sensible for your system.
7887 $also
7888
7889 EOM
7890         rp="Build a shared libperl.$so (y/n)"
7891         . ./myread
7892         case "$ans" in
7893         true|$define|[Yy]*)
7894                 useshrplib='true'  ;;
7895         *)      useshrplib='false' ;;
7896         esac
7897         ;;
7898 esac
7899
7900 case "$useshrplib" in
7901 true)
7902         case "$libperl" in
7903         '')
7904                 # Figure out a good name for libperl.so.  Since it gets stored in
7905                 # a version-specific architecture-dependent library, the version
7906                 # number isn't really that important, except for making cc/ld happy.
7907                 #
7908                 # A name such as libperl.so.3.1
7909                 majmin="libperl.$so.$patchlevel.$subversion"
7910                 # A name such as libperl.so.301
7911                 majonly=`echo $patchlevel $subversion |
7912                         $awk '{printf "%d%02d", $1, $2}'`
7913                 majonly=libperl.$so.$majonly
7914                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7915                 # rely on figuring it out from the naming of libc.
7916                 case "${osname}${osvers}" in
7917                 next4*)
7918                         dflt=libperl.5.$so
7919                         # XXX How handle the --version stuff for MAB?
7920                         ;;
7921                 linux*)  # ld won't link with a bare -lperl otherwise.
7922                         dflt=libperl.$so
7923                         ;;
7924                 cygwin*) # ld links against an importlib
7925                         dflt=libperl$lib_ext
7926                         ;;
7927                 *)      # Try to guess based on whether libc has major.minor.
7928                         case "$libc" in
7929                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7930                         *libc.$so.[0-9]*) dflt=$majonly ;;
7931                         *)      dflt=libperl.$so ;;
7932                         esac
7933                         ;;
7934                 esac
7935                 ;;
7936         *)      dflt=$libperl
7937                 ;;
7938         esac
7939         cat << EOM
7940
7941 I need to select a good name for the shared libperl.  If your system uses
7942 library names with major and minor numbers, then you might want something
7943 like $majmin.  Alternatively, if your system uses a single version
7944 number for shared libraries, then you might want to use $majonly.
7945 Or, your system might be quite happy with a simple libperl.$so.
7946
7947 Since the shared libperl will get installed into a version-specific
7948 architecture-dependent directory, the version number of the shared perl
7949 library probably isn't important, so the default should be o.k.
7950
7951 EOM
7952         rp='What name do you want to give to the shared libperl?'
7953         . ./myread
7954         libperl=$ans
7955         echo "Ok, I'll use $libperl"
7956         ;;
7957 *)
7958         libperl="libperl${_a}"
7959         ;;
7960 esac
7961
7962 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7963 case "$shrpdir" in
7964 '') ;;
7965 *)      $cat >&4 <<EOM
7966 WARNING:  Use of the shrpdir variable for the installation location of
7967 the shared $libperl is not supported.  It was never documented and
7968 will not work in this version.  Let me (perlbug@perl.org)
7969 know of any problems this may cause.
7970
7971 EOM
7972         case "$shrpdir" in
7973         "$archlibexp/CORE")
7974                 $cat >&4 <<EOM
7975 But your current setting of $shrpdir is
7976 the default anyway, so it's harmless.
7977 EOM
7978                 ;;
7979         *)
7980                 $cat >&4 <<EOM
7981 Further, your current attempted setting of $shrpdir
7982 conflicts with the value of $archlibexp/CORE
7983 that installperl will use.
7984 EOM
7985                 ;;
7986         esac
7987         ;;
7988 esac
7989
7990 # How will the perl executable find the installed shared $libperl?
7991 # Add $xxx to ccdlflags.
7992 # If we can't figure out a command-line option, use $shrpenv to
7993 # set env LD_RUN_PATH.  The main perl makefile uses this.
7994 shrpdir=$archlibexp/CORE
7995 xxx=''
7996 tmp_shrpenv=''
7997 if "$useshrplib"; then
7998     case "$osname" in 
7999         aix)
8000                 # We'll set it in Makefile.SH...
8001                 ;;
8002         solaris)
8003                 xxx="-R $shrpdir"
8004                 ;;
8005         freebsd|netbsd|openbsd)
8006                 xxx="-Wl,-R$shrpdir"
8007                 ;;
8008         bsdos|linux|irix*|dec_osf)
8009                 xxx="-Wl,-rpath,$shrpdir"
8010                 ;;
8011         next)
8012                 # next doesn't like the default...
8013                 ;;
8014         beos)
8015                 # beos doesn't like the default, either.
8016                 ;;
8017         hpux*)
8018                 # hpux doesn't like the default, either.
8019                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8020                 ;;
8021         *)
8022                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8023                 ;;
8024         esac
8025         case "$xxx" in
8026         '') ;;
8027         *)      
8028                 # Only add $xxx if it isn't already in ccdlflags.
8029                 case " $ccdlflags " in
8030                 *" $xxx "*)     ;;
8031                 *)      ccdlflags="$ccdlflags $xxx"
8032                         cat <<EOM >&4
8033
8034 Adding $xxx to the flags
8035 passed to $ld so that the perl executable will find the 
8036 installed shared $libperl.
8037
8038 EOM
8039                         ;;
8040                 esac
8041                 ;;
8042         esac
8043 fi
8044 # Fix ccdlflags in AIX for building external extensions.
8045 # (For building Perl itself bare -bE:perl.exp is needed,
8046 #  Makefile.SH takes care of this.)
8047 case "$osname" in
8048 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8049 esac
8050 # Respect a hint or command-line value.
8051 case "$shrpenv" in
8052 '') shrpenv="$tmp_shrpenv" ;;
8053 esac
8054 case "$ldlibpthname" in
8055 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8056 none)   ldlibpthname='' ;;
8057 esac
8058
8059 : determine where manual pages are on this system
8060 echo " "
8061 case "$sysman" in
8062 '') 
8063         syspath='/usr/share/man/man1 /usr/man/man1'
8064         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8065         syspath="$syspath /usr/man/u_man/man1"
8066         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8067         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8068         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8069         sysman=`./loc . /usr/man/man1 $syspath`
8070         ;;
8071 esac
8072 if $test -d "$sysman"; then
8073         echo "System manual is in $sysman." >&4
8074 else
8075         echo "Could not find manual pages in source form." >&4
8076 fi
8077
8078 : determine where manual pages go
8079 set man1dir man1dir none
8080 eval $prefixit
8081 $cat <<EOM
8082
8083 $spackage has manual pages available in source form.
8084 EOM
8085 case "$nroff" in
8086 nroff)
8087         echo "However, you don't have nroff, so they're probably useless to you."
8088         case "$man1dir" in
8089         '') man1dir="none";;
8090         esac;;
8091 esac
8092 echo "If you don't want the manual sources installed, answer 'none'."
8093 case "$man1dir" in
8094 ' ') dflt=none
8095         ;;
8096 '')
8097         lookpath="$prefixexp/share/man/man1"
8098         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8099         lookpath="$lookpath $prefixexp/man/p_man/man1"
8100         lookpath="$lookpath $prefixexp/man/u_man/man1"
8101         lookpath="$lookpath $prefixexp/man/man.1"
8102         case "$sysman" in
8103         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8104         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8105         esac
8106         set dflt
8107         eval $prefixup
8108         ;;
8109 *)  dflt="$man1dir"
8110         ;;
8111 esac
8112 echo " "
8113 fn=dn+~
8114 rp="Where do the main $spackage manual pages (source) go?"
8115 . ./getfile
8116 if $test "X$man1direxp" != "X$ansexp"; then
8117         installman1dir=''
8118 fi
8119 man1dir="$ans"
8120 man1direxp="$ansexp"
8121 case "$man1dir" in
8122 '')     man1dir=' '
8123         installman1dir='';;
8124 esac
8125
8126 : Change installation prefix, if necessary.
8127 if $test X"$prefix" != X"$installprefix"; then
8128         installman1dir=`echo $man1direxp | $sed "s#^$prefix#$installprefix#"`
8129 else
8130         installman1dir="$man1direxp"
8131 fi
8132
8133 : What suffix to use on installed man pages
8134
8135 case "$man1dir" in
8136 ' ')
8137         man1ext='0'
8138         ;;
8139 *)
8140         rp="What suffix should be used for the main $spackage man pages?"
8141         case "$man1ext" in
8142         '')     case "$man1dir" in
8143                 *1)  dflt=1 ;;
8144                 *1p) dflt=1p ;;
8145                 *1pm) dflt=1pm ;;
8146                 *l) dflt=l;;
8147                 *n) dflt=n;;
8148                 *o) dflt=o;;
8149                 *p) dflt=p;;
8150                 *C) dflt=C;;
8151                 *L) dflt=L;;
8152                 *L1) dflt=L1;;
8153                 *) dflt=1;;
8154                 esac
8155                 ;;
8156         *)      dflt="$man1ext";;
8157         esac
8158         . ./myread
8159         man1ext="$ans"
8160         ;;
8161 esac
8162
8163 : see if we can have long filenames
8164 echo " "
8165 first=123456789abcdef
8166 $rm -f $first
8167 if (echo hi >$first) 2>/dev/null; then
8168         if $test -f 123456789abcde; then
8169                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8170                 val="$undef"
8171         else
8172                 echo 'You can have filenames longer than 14 characters.'>&4
8173                 val="$define"
8174         fi
8175 else
8176         $cat <<'EOM'
8177 You can't have filenames longer than 14 chars.
8178 You can't even think about them!
8179 EOM
8180         val="$undef"
8181 fi 
8182 set d_flexfnam
8183 eval $setvar
8184 $rm -rf 123456789abcde*
8185
8186 : determine where library module manual pages go
8187 set man3dir man3dir none
8188 eval $prefixit
8189 $cat <<EOM
8190
8191 $spackage has manual pages for many of the library modules.
8192 EOM
8193
8194 case "$nroff" in
8195 nroff)
8196         $cat <<'EOM'
8197 However, you don't have nroff, so they're probably useless to you.
8198 EOM
8199         case "$man3dir" in
8200         '') man3dir="none";;
8201         esac;;
8202 esac
8203
8204 case "$d_flexfnam" in
8205 undef)
8206         $cat <<'EOM'
8207 However, your system can't handle the long file names like File::Basename.3. 
8208 EOM
8209         case "$man3dir" in
8210         '') man3dir="none";;
8211         esac;;
8212 esac
8213
8214 echo "If you don't want the manual sources installed, answer 'none'."
8215 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8216 case "$man3dir" in
8217 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8218         if $test -d "$privlib/man/man3"; then
8219                 cat <<EOM >&4
8220
8221 WARNING:  Previous versions of perl installed man3 pages into
8222 $privlib/man/man3.  This version will suggest a 
8223 new default of $dflt.  
8224 EOM
8225                 tdflt=$dflt
8226                 dflt='n'
8227                 rp='Do you wish to preserve the old behavior?(y/n)'
8228                 . ./myread
8229                 case "$ans" in
8230                 y*) dflt="$privlib/man/man3" ;;
8231                 *)  dflt=$tdflt ;;
8232                 esac
8233     fi
8234         ;;
8235 *)      dflt="$man3dir" ;;
8236 esac
8237 case "$dflt" in
8238 ' ') dflt=none ;;
8239 esac
8240 echo " "
8241 fn=dn+~
8242 rp="Where do the $package library man pages (source) go?"
8243 . ./getfile
8244 man3dir="$ans"
8245 man3direxp="$ansexp"
8246 case "$man3dir" in
8247 '')     man3dir=' '
8248         installman3dir='';;
8249 esac
8250
8251 : Change installation prefix, if necessary.
8252 if $test X"$prefix" != X"$installprefix"; then
8253         installman3dir=`echo $man3direxp | $sed "s#^$prefix#$installprefix#"`
8254 else
8255         installman3dir="$man3direxp"
8256 fi
8257
8258 : What suffix to use on installed man pages
8259 case "$man3dir" in
8260 ' ')
8261         man3ext='0'
8262         ;;
8263 *)
8264         rp="What suffix should be used for the $package library man pages?"
8265         case "$man3ext" in
8266         '')     case "$man3dir" in
8267                 *3)  dflt=3 ;;
8268                 *3p) dflt=3p ;;
8269                 *3pm) dflt=3pm ;;
8270                 *l) dflt=l;;
8271                 *n) dflt=n;;
8272                 *o) dflt=o;;
8273                 *p) dflt=p;;
8274                 *C) dflt=C;;
8275                 *L) dflt=L;;
8276                 *L3) dflt=L3;;
8277                 *) dflt=3;;
8278                 esac
8279                 ;;
8280         *)      dflt="$man3ext";;
8281         esac
8282         . ./myread
8283         man3ext="$ans"
8284         ;;
8285 esac
8286
8287 : see if we have to deal with yellow pages, now NIS.
8288 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8289         if $test -f /usr/etc/nibindd; then
8290                 echo " "
8291                 echo "I'm fairly confident you're on a NeXT."
8292                 echo " "
8293                 rp='Do you get the hosts file via NetInfo?'
8294                 dflt=y
8295                 case "$hostcat" in
8296                 nidump*) ;;
8297                 '') ;;
8298                 *) dflt=n;;
8299                 esac
8300                 . ./myread
8301                 case "$ans" in
8302                 y*) hostcat='nidump hosts .';;
8303                 *)      case "$hostcat" in
8304                         nidump*) hostcat='';;
8305                         esac
8306                         ;;
8307                 esac
8308         fi
8309         case "$hostcat" in
8310         nidump*) ;;
8311         *)
8312                 case "$hostcat" in
8313                 *ypcat*) dflt=y;;
8314                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8315                                 dflt=y
8316                         else
8317                                 dflt=n
8318                         fi;;
8319                 *) dflt=n;;
8320                 esac
8321                 echo " "
8322                 rp='Are you getting the hosts file via yellow pages?'
8323                 . ./myread
8324                 case "$ans" in
8325                 y*) hostcat='ypcat hosts';;
8326                 *) hostcat='cat /etc/hosts';;
8327                 esac
8328                 ;;
8329         esac
8330 fi
8331 case "$hostcat" in
8332 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8333 esac
8334 case "$groupcat" in
8335 '') test -f /etc/group && groupcat='cat /etc/group';;
8336 esac
8337 case "$passcat" in
8338 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8339 esac
8340
8341 : now get the host name
8342 echo " "
8343 echo "Figuring out host name..." >&4
8344 case "$myhostname" in
8345 '') cont=true
8346         echo 'Maybe "hostname" will work...'
8347         if tans=`sh -c hostname 2>&1` ; then
8348                 myhostname=$tans
8349                 phostname=hostname
8350                 cont=''
8351         fi
8352         ;;
8353 *) cont='';;
8354 esac
8355 if $test "$cont"; then
8356         if ./xenix; then
8357                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8358                 if tans=`cat /etc/systemid 2>&1` ; then
8359                         myhostname=$tans
8360                         phostname='cat /etc/systemid'
8361                         echo "Whadyaknow.  Xenix always was a bit strange..."
8362                         cont=''
8363                 fi
8364         elif $test -r /etc/systemid; then
8365                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8366         fi
8367 fi
8368 if $test "$cont"; then
8369         echo 'No, maybe "uuname -l" will work...'
8370         if tans=`sh -c 'uuname -l' 2>&1` ; then
8371                 myhostname=$tans
8372                 phostname='uuname -l'
8373         else
8374                 echo 'Strange.  Maybe "uname -n" will work...'
8375                 if tans=`sh -c 'uname -n' 2>&1` ; then
8376                         myhostname=$tans
8377                         phostname='uname -n'
8378                 else
8379                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8380                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8381                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8382                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8383                         else
8384                                 case "$myhostname" in
8385                                 '') echo "Does this machine have an identity crisis or something?"
8386                                         phostname='';;
8387                                 *)
8388                                         echo "Well, you said $myhostname before..."
8389                                         phostname='echo $myhostname';;
8390                                 esac
8391                         fi
8392                 fi
8393         fi
8394 fi
8395 case "$myhostname" in
8396 '') myhostname=noname ;;
8397 esac
8398 : you do not want to know about this
8399 set $myhostname
8400 myhostname=$1
8401
8402 : verify guess
8403 if $test "$myhostname" ; then
8404         dflt=y
8405         rp='Your host name appears to be "'$myhostname'".'" Right?"
8406         . ./myread
8407         case "$ans" in
8408         y*) ;;
8409         *) myhostname='';;
8410         esac
8411 fi
8412
8413 : bad guess or no guess
8414 while $test "X$myhostname" = X ; do
8415         dflt=''
8416         rp="Please type the (one word) name of your host:"
8417         . ./myread
8418         myhostname="$ans"
8419 done
8420
8421 : translate upper to lower if necessary
8422 case "$myhostname" in
8423 *[A-Z]*)
8424         echo "(Normalizing case in your host name)"
8425         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8426         ;;
8427 esac
8428
8429 case "$myhostname" in
8430 *.*)
8431         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8432         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8433         echo "(Trimming domain name from host name--host name is now $myhostname)"
8434         ;;
8435 *) case "$mydomain" in
8436         '')
8437                 {
8438                         test "X$hostcat" = "Xypcat hosts" &&
8439                         ypmatch "$myhostname" hosts 2>/dev/null |\
8440                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8441                         $test -s hosts
8442                 } || {
8443                         test "X$hostcat" != "X" &&
8444                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8445                                         /[       ]$myhostname[  . ]/p" > hosts
8446                 }
8447                 tmp_re="[       . ]"
8448                 if $test -f hosts; then
8449                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8450                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8451                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8452                                 hosts | $sort | $uniq | \
8453                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8454                         case `$echo X$dflt` in
8455                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8456                                 dflt=.
8457                                 ;;
8458                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8459                                 ;;
8460                         esac
8461                 else
8462                         echo "(I cannot locate a hosts database anywhere)"
8463                         dflt=.
8464                 fi
8465                 case "$dflt" in
8466                 .)
8467                         tans=`./loc resolv.conf X /etc /usr/etc`
8468                         if $test -f "$tans"; then
8469                                 echo "(Attempting domain name extraction from $tans)"
8470                                 dflt=.`$sed -n -e 's/   / /g' \
8471                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8472                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8473                                 case "$dflt" in
8474                                 .) dflt=.`$sed -n -e 's/        / /g' \
8475                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8476                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8477                                         ;;
8478                                 esac
8479                         fi
8480                         ;;
8481                 esac
8482                 case "$dflt" in
8483                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8484                         dflt=.`sh -c domainname 2>/dev/null`
8485                         case "$dflt" in
8486                         '') dflt='.';;
8487                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8488                         esac
8489                         ;;
8490                 esac
8491                 case "$dflt$osname" in
8492                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8493                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8494                         ;;
8495                 esac
8496                 case "$dflt" in
8497                 .) echo "(Lost all hope -- silly guess then)"
8498                         dflt='.nonet'
8499                         ;;
8500                 esac
8501                 $rm -f hosts
8502                 ;;
8503         *) dflt="$mydomain";;
8504         esac;;
8505 esac
8506 echo " "
8507 rp="What is your domain name?"
8508 . ./myread
8509 tans="$ans"
8510 case "$ans" in
8511 '') ;;
8512 .*) ;;
8513 *) tans=".$tans";;
8514 esac
8515 mydomain="$tans"
8516
8517 : translate upper to lower if necessary
8518 case "$mydomain" in
8519 *[A-Z]*)
8520         echo "(Normalizing case in your domain name)"
8521         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8522         ;;
8523 esac
8524
8525 : a little sanity check here
8526 case "$phostname" in
8527 '') ;;
8528 *)
8529         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8530         $myhostname$mydomain|$myhostname) ;;
8531         *)
8532                 case "$phostname" in
8533                 sed*)
8534                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8535                         ;;
8536                 *)
8537                         echo "(That doesn't agree with your $phostname command, by the way.)"
8538                         ;;
8539                 esac
8540         ;;
8541         esac
8542         ;;
8543 esac
8544
8545 $cat <<EOM
8546
8547 I need to get your e-mail address in Internet format if possible, i.e.
8548 something like user@host.domain. Please answer accurately since I have
8549 no easy means to double check it. The default value provided below
8550 is most probably close to reality but may not be valid from outside
8551 your organization...
8552
8553 EOM
8554 cont=x
8555 while test "$cont"; do
8556         case "$cf_email" in
8557         '') dflt="$cf_by@$myhostname$mydomain";;
8558         *) dflt="$cf_email";;
8559         esac
8560         rp='What is your e-mail address?'
8561         . ./myread
8562         cf_email="$ans"
8563         case "$cf_email" in
8564         *@*.*) cont='' ;;
8565         *)
8566                 rp='Address does not look like an Internet one.  Use it anyway?'
8567                 case "$fastread" in
8568                 yes) dflt=y ;;
8569                 *) dflt=n ;;
8570                 esac
8571                 . ./myread
8572                 case "$ans" in
8573                 y*) cont='' ;;
8574                 *) echo " " ;;
8575                 esac
8576                 ;;
8577         esac
8578 done
8579
8580 $cat <<EOM
8581
8582 If you or somebody else will be maintaining perl at your site, please
8583 fill in the correct e-mail address here so that they may be contacted
8584 if necessary. Currently, the "perlbug" program included with perl
8585 will send mail to this address in addition to perlbug@perl.org. You may
8586 enter "none" for no administrator.
8587
8588 EOM
8589 case "$perladmin" in
8590 '') dflt="$cf_email";;
8591 *) dflt="$perladmin";;
8592 esac
8593 rp='Perl administrator e-mail address'
8594 . ./myread
8595 perladmin="$ans"
8596
8597 : determine whether to only install version-specific parts.
8598 echo " "
8599 $cat <<EOM
8600 Do you want to install only the version-specific parts of the perl
8601 distribution?  Usually you do *not* want to do this.
8602 EOM
8603 case "$versiononly" in
8604 "$define"|[Yy]*|true) dflt='y' ;;
8605 *) dflt='n';
8606 esac
8607 rp="Do you want to install only the version-specific parts of perl?"
8608 . ./myread
8609 case "$ans" in
8610 [yY]*)  val="$define";;
8611 *)      val="$undef" ;;
8612 esac
8613 set versiononly
8614 eval $setvar
8615
8616 case "$versiononly" in
8617 "$define") inc_version_list=''
8618            inc_version_list_init=0
8619            ;;
8620 esac
8621
8622 : figure out how to guarantee perl startup
8623 case "$startperl" in
8624 '')
8625         case "$sharpbang" in
8626         *!)
8627                 $cat <<EOH
8628
8629 I can use the #! construct to start perl on your system. This will
8630 make startup of perl scripts faster, but may cause problems if you
8631 want to share those scripts and perl is not in a standard place
8632 ($binexp/perl) on all your platforms. The alternative is to force
8633 a shell by starting the script with a single ':' character.
8634
8635 EOH
8636                 case "$versiononly" in
8637                 "$define")      dflt="$binexp/perl$version";;  
8638                 *)              dflt="$binexp/perl";;
8639                 esac
8640                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8641                 . ./myread
8642                 case "$ans" in
8643                 none)   startperl=": # use perl";;
8644                 *)      startperl="#!$ans"
8645                         if $test 30 -lt `echo "$ans" | wc -c`; then
8646                                 $cat >&4 <<EOM
8647
8648 WARNING:  Some systems limit the #! command to 32 characters.
8649 If you experience difficulty running Perl scripts with #!, try
8650 installing Perl in a directory with a shorter pathname.
8651
8652 EOM
8653                         fi ;;
8654                 esac
8655                 ;;
8656         *) startperl=": # use perl"
8657                 ;;
8658         esac
8659         ;;
8660 esac
8661 echo "I'll use $startperl to start perl scripts."
8662
8663 : figure best path for perl in scripts
8664 case "$perlpath" in
8665 '')
8666         case "$versiononly" in
8667         "$define")      perlpath="$binexp/perl$version";;
8668         *)              perlpath="$binexp/perl";;
8669         esac
8670         case "$startperl" in
8671         *!*) ;;
8672         *)
8673                 $cat <<EOH
8674
8675 I will use the "eval 'exec'" idiom to start Perl on your system.
8676 I can use the full path of your Perl binary for this purpose, but
8677 doing so may cause problems if you want to share those scripts and
8678 Perl is not always in a standard place ($binexp/perl).
8679
8680 EOH
8681                 dflt="$binexp/perl"
8682                 rp="What path shall I use in \"eval 'exec'\"?"
8683                 . ./myread
8684                 perlpath="$ans"
8685                 ;;
8686         esac
8687         ;;
8688 esac
8689 case "$startperl" in
8690 *!*)    ;;
8691 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8692 esac
8693
8694 : determine where public executable scripts go
8695 set scriptdir scriptdir
8696 eval $prefixit
8697 case "$scriptdir" in
8698 '')
8699         dflt="$bin"
8700         : guess some guesses
8701         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8702         $test -d /usr/share/bin     && dflt=/usr/share/bin
8703         $test -d /usr/local/script  && dflt=/usr/local/script
8704         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8705         $test -d $prefixexp/script  && dflt=$prefixexp/script
8706         set dflt
8707         eval $prefixup
8708         ;;
8709 *)  dflt="$scriptdir"
8710         ;;
8711 esac
8712 $cat <<EOM
8713  
8714 Some installations have a separate directory just for executable scripts so
8715 that they can mount it across multiple architectures but keep the scripts in
8716 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8717 Or you might just lump your scripts in with all your other executables.
8718  
8719 EOM
8720 fn=d~
8721 rp='Where do you keep publicly executable scripts?'
8722 . ./getfile
8723 if $test "X$ansexp" != "X$scriptdirexp"; then
8724         installscript=''
8725 fi
8726 scriptdir="$ans"
8727 scriptdirexp="$ansexp"
8728 : Change installation prefix, if necessary.
8729 if $test X"$prefix" != X"$installprefix"; then
8730         installscript=`echo $scriptdirexp | sed "s#^$prefix#$installprefix#"`
8731 else
8732         installscript="$scriptdirexp"
8733 fi
8734
8735 : determine where add-on public executables go
8736 case "$sitebin" in
8737 '')     dflt=$siteprefix/bin ;;
8738 *)      dflt=$sitebin ;;
8739 esac
8740 fn=d~
8741 rp='Pathname where the add-on public executables should be installed?'
8742 . ./getfile
8743 sitebin="$ans"
8744 sitebinexp="$ansexp"
8745 : Change installation prefix, if necessary.
8746 if $test X"$prefix" != X"$installprefix"; then
8747         installsitebin=`echo $sitebinexp | sed "s#^$prefix#$installprefix#"`
8748 else
8749         installsitebin="$sitebinexp"
8750 fi
8751
8752 : determine where add-on html pages go
8753 : There is no standard location, so try to copy the previously-selected 
8754 : directory structure for the core html pages.
8755 case "$sitehtml1" in
8756 '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8757 *)      dflt=$sitehtml1 ;;
8758 esac
8759 case "$dflt" in
8760 ''|' ') dflt=none ;;
8761 esac
8762 fn=dn+~
8763 rp='Pathname where the site-specific html pages should be installed?'
8764 . ./getfile
8765 sitehtml1="$ans"
8766 sitehtml1exp="$ansexp"
8767 : Use ' ' for none so value is preserved next time through Configure
8768 $test X"$sitehtml1" = "X" && sitehtml1=' '
8769 : Change installation prefix, if necessary.
8770 if $test X"$prefix" != X"$installprefix"; then
8771         installsitehtml1=`echo "$sitehtml1exp" | $sed "s#^$prefix#$installprefix#"`
8772 else
8773         installsitehtml1="$sitehtml1exp"
8774 fi
8775
8776 : determine where add-on library html pages go
8777 : There is no standard location, so try to copy the previously-selected
8778 : directory structure for the core html pages.
8779 case "$sitehtml3" in
8780 '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8781 *)      dflt=$sitehtml3 ;;
8782 esac
8783 case "$dflt" in
8784 ''|' ') dflt=none ;;
8785 esac
8786 fn=dn+~
8787 rp='Pathname where the site-specific library html pages should be installed?'
8788 . ./getfile
8789 sitehtml3="$ans"
8790 sitehtml3exp="$ansexp"
8791 : Use ' ' for none so value is preserved next time through Configure
8792 $test X"$sitehtml3" = "X" && sitehtml3=' '
8793 : Change installation prefix, if necessary.
8794 if $test X"$prefix" != X"$installprefix"; then
8795         installsitehtml3=`echo "$sitehtml3exp" | $sed "s#^$prefix#$installprefix#"`
8796 else
8797         installsitehtml3="$sitehtml3exp"
8798 fi
8799
8800 : determine where add-on manual pages go
8801 case "$siteman1" in
8802 '')     dflt=`echo "$man1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8803 *)      dflt=$siteman1 ;;
8804 esac
8805 case "$dflt" in
8806 ''|' ') dflt=none ;;
8807 esac
8808 fn=dn+~
8809 rp='Pathname where the site-specific manual pages should be installed?'
8810 . ./getfile
8811 siteman1="$ans"
8812 siteman1exp="$ansexp"
8813 : Use ' ' for none so value is preserved next time through Configure
8814 $test X"$siteman1" = "X" && siteman1=' '
8815 : Change installation prefix, if necessary.
8816 if $test X"$prefix" != X"$installprefix"; then
8817         installsiteman1=`echo "$siteman1exp" | $sed "s#^$prefix#$installprefix#"`
8818 else
8819         installsiteman1="$siteman1exp"
8820 fi
8821
8822 : determine where add-on library man pages go
8823 case "$siteman3" in
8824 '')     dflt=`echo "$man3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8825 *)      dflt=$siteman3 ;;
8826 esac
8827 case "$dflt" in
8828 ''|' ') dflt=none ;;
8829 esac
8830 fn=dn+~
8831 rp='Pathname where the site-specific library manual pages should be installed?'
8832 . ./getfile
8833 siteman3="$ans"
8834 siteman3exp="$ansexp"
8835 : Use ' ' for none so value is preserved next time through Configure
8836 $test X"$siteman3" = "X" && siteman3=' '
8837 : Change installation prefix, if necessary.
8838 if $test X"$prefix" != X"$installprefix"; then
8839         installsiteman3=`echo "$siteman3exp" | $sed "s#^$prefix#$installprefix#"`
8840 else
8841         installsiteman3="$siteman3exp"
8842 fi
8843
8844 : determine where add-on public executable scripts go
8845 case "$sitescript" in
8846 '')     dflt=$siteprefix/script
8847         $test -d $dflt || dflt=$sitebin ;;
8848 *)  dflt="$sitescript" ;;
8849 esac
8850 fn=d~+
8851 rp='Pathname where add-on public executable scripts should be installed?'
8852 . ./getfile
8853 sitescript="$ans"
8854 sitescriptexp="$ansexp"
8855 : Change installation prefix, if necessary.
8856 if $test X"$prefix" != X"$installprefix"; then
8857         installsitescript=`echo $sitescriptexp | sed "s#^$prefix#$installprefix#"`
8858 else
8859         installsitescript="$sitescriptexp"
8860 fi
8861
8862 : define an is-a-typedef? function
8863 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8864 case "$inclist" in
8865 "") inclist="sys/types.h";;
8866 esac;
8867 eval "varval=\$$var";
8868 case "$varval" in
8869 "")
8870         $rm -f temp.c;
8871         for inc in $inclist; do
8872                 echo "#include <$inc>" >>temp.c;
8873         done;
8874         echo "#ifdef $type" >> temp.c;
8875         echo "printf(\"We have $type\");" >> temp.c;
8876         echo "#endif" >> temp.c;
8877         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8878         if $contains $type temp.E >/dev/null 2>&1; then
8879                 eval "$var=\$type";
8880         else
8881                 eval "$var=\$def";
8882         fi;
8883         $rm -f temp.?;;
8884 *) eval "$var=\$varval";;
8885 esac'
8886
8887 : define an is-a-typedef? function that prompts if the type is not available.
8888 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8889 case "$inclist" in
8890 "") inclist="sys/types.h";;
8891 esac;
8892 eval "varval=\$$var";
8893 case "$varval" in
8894 "")
8895         $rm -f temp.c;
8896         for inc in $inclist; do
8897                 echo "#include <$inc>" >>temp.c;
8898         done;
8899         echo "#ifdef $type" >> temp.c;
8900         echo "printf(\"We have $type\");" >> temp.c;
8901         echo "#endif" >> temp.c;
8902         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8903         echo " " ;
8904         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8905         if $contains $type temp.E >/dev/null 2>&1; then
8906                 echo "$type found." >&4;
8907                 eval "$var=\$type";
8908         else
8909                 echo "$type NOT found." >&4;
8910                 dflt="$def";
8911                 . ./myread ;
8912                 eval "$var=\$ans";
8913         fi;
8914         $rm -f temp.?;;
8915 *) eval "$var=\$varval";;
8916 esac'
8917
8918 : see what type lseek is declared as in the kernel
8919 rp="What is the type used for lseek's offset on this system?"
8920 set off_t lseektype long stdio.h sys/types.h
8921 eval $typedef_ask
8922
8923 echo " "
8924 echo "Checking to see how big your file offsets are..." >&4
8925 $cat >try.c <<EOCP
8926 #include <sys/types.h>
8927 #include <stdio.h>
8928 int main()
8929 {
8930     printf("%d\n", (int)sizeof($lseektype));
8931     return(0); 
8932 }
8933 EOCP
8934 set try
8935 if eval $compile_ok; then
8936         lseeksize=`$run ./try`
8937         echo "Your file offsets are $lseeksize bytes long."
8938 else
8939         dflt=$longsize
8940         echo " "
8941         echo "(I can't seem to compile the test program.  Guessing...)"
8942         rp="What is the size of your file offsets (in bytes)?"
8943         . ./myread
8944         lseeksize="$ans"
8945 fi
8946 $rm -f try.c try
8947
8948 : see what type file positions are declared as in the library
8949 rp="What is the type for file position used by fsetpos()?"
8950 set fpos_t fpostype long stdio.h sys/types.h
8951 eval $typedef_ask
8952
8953 echo " "
8954 case "$fpostype" in
8955 *_t) zzz="$fpostype"    ;;
8956 *)   zzz="fpos_t"       ;;
8957 esac
8958 echo "Checking the size of $zzz..." >&4 
8959 cat > try.c <<EOCP
8960 #include <sys/types.h>
8961 #include <stdio.h>
8962 #$i_stdlib I_STDLIB
8963 #ifdef I_STDLIB
8964 #include <stdlib.h>
8965 #endif
8966 int main() {
8967     printf("%d\n", (int)sizeof($fpostype));
8968     exit(0);
8969 }
8970 EOCP
8971 set try
8972 if eval $compile_ok; then
8973         yyy=`$run ./try`
8974         case "$yyy" in
8975         '')     fpossize=4
8976                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8977                 ;;
8978         *)      fpossize=$yyy
8979                 echo "Your $zzz is $fpossize bytes long."
8980                 ;;
8981         esac
8982 else
8983         dflt="$longsize"
8984         echo " " >&4
8985         echo "(I can't compile the test program.  Guessing...)" >&4
8986         rp="What is the size of your file positions (in bytes)?"
8987         . ./myread
8988         fpossize="$ans"
8989 fi
8990
8991
8992
8993 # Backward compatibility (uselfs is deprecated).
8994 case "$uselfs" in
8995 "$define"|true|[yY]*)
8996         cat <<EOM >&4
8997
8998 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8999 EOM
9000         uselargefiles="$define"
9001         ;;
9002 esac                          
9003
9004 case "$lseeksize:$fpossize" in
9005 8:8) cat <<EOM
9006
9007 You can have files larger than 2 gigabytes.
9008 EOM
9009    val="$define" ;;
9010 *)    case "$uselargefiles" in
9011    "$undef"|false|[nN]*) dflt='n' ;;
9012    *)   dflt='y' ;;
9013    esac
9014    cat <<EOM
9015
9016 Perl can be built to understand large files (files larger than 2 gigabytes)
9017 on some systems.  To do so, Configure can be run with -Duselargefiles.
9018
9019 If this doesn't make any sense to you, just accept the default '$dflt'.
9020 EOM
9021    rp='Try to understand large files, if available?'
9022    . ./myread
9023    case "$ans" in
9024    y|Y)         val="$define" ;;
9025    *)           val="$undef"  ;;
9026    esac
9027    ;;
9028 esac
9029 set uselargefiles
9030 eval $setvar
9031 case "$uselargefiles" in
9032 "$define")
9033 : Look for a hint-file generated 'call-back-unit'.  If the
9034 : user has specified that a large files perl is to be built,
9035 : we may need to set or change some other defaults.
9036         if $test -f uselargefiles.cbu; then
9037                 echo "Your platform has some specific hints for large file builds, using them..."
9038                 . ./uselargefiles.cbu
9039                 echo " "
9040                 echo "Rechecking to see how big your file offsets are..." >&4
9041                 $cat >try.c <<EOCP
9042 #include <sys/types.h>
9043 #include <stdio.h>
9044 int main()
9045 {
9046     printf("%d\n", (int)sizeof($lseektype));
9047     return(0); 
9048 }
9049 EOCP
9050                 set try
9051                 if eval $compile_ok; then
9052                         lseeksize=`$run ./try`
9053                         $echo "Your file offsets are now $lseeksize bytes long."
9054                 else
9055                         dflt="$lseeksize"
9056                         echo " "
9057                         echo "(I can't seem to compile the test program.  Guessing...)"
9058                         rp="What is the size of your file offsets (in bytes)?"
9059                         . ./myread
9060                         lseeksize="$ans"
9061                 fi
9062                 case "$fpostype" in
9063                 *_t) zzz="$fpostype"    ;;
9064                 *)   zzz="fpos_t"       ;;
9065                 esac
9066                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9067                 $cat > try.c <<EOCP
9068 #include <sys/types.h>
9069 #include <stdio.h>
9070 int main() {
9071     printf("%d\n", (int)sizeof($fpostype));
9072     return(0);
9073 }
9074 EOCP
9075                 set try
9076                 if eval $compile_ok; then
9077                         yyy=`$run ./try`
9078                         dflt="$lseeksize"
9079                         case "$yyy" in
9080                         '')     echo " "
9081                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9082                                 ;;
9083                         *)      fpossize=$yyy
9084                                 echo " $fpossize bytes." >&4
9085                                 ;;
9086                         esac
9087                 else
9088                         dflt="$fpossize"
9089                         echo " "
9090                         echo "(I can't compile the test program.  Guessing...)" >&4
9091                         rp="What is the size of your file positions (in bytes)?"
9092                         . ./myread
9093                         fpossize="$ans"
9094                 fi
9095                 $rm -f try.c try
9096         fi
9097         ;;
9098 esac
9099
9100 case "$vendorprefix" in
9101 '')     d_vendorbin="$undef"
9102         vendorbin=''
9103         vendorbinexp=''
9104         ;;
9105 *)      d_vendorbin="$define"
9106         : determine where vendor-supplied executables go.
9107         case "$vendorbin" in
9108         '') dflt=$vendorprefix/bin ;;
9109         *)      dflt="$vendorbin" ;;
9110         esac
9111         fn=d~+
9112         rp='Pathname for the vendor-supplied executables directory?'
9113         . ./getfile
9114         vendorbin="$ans"
9115         vendorbinexp="$ansexp"
9116         ;;
9117 esac
9118 : Change installation prefix, if necessary.
9119 if $test X"$prefix" != X"$installprefix"; then
9120         installvendorbin=`echo $vendorbinexp | $sed "s#^$prefix#$installprefix#"`
9121 else
9122         installvendorbin="$vendorbinexp"
9123 fi
9124
9125 case "$vendorprefix" in
9126 '')     vendorhtml1=''
9127         vendorhtml1exp=''
9128         ;;
9129 *)      : determine where vendor-supplied html pages go.
9130         : There is no standard location, so try to copy the previously-selected
9131         : directory structure for the core html pages.
9132         : XXX Better default suggestions would be welcome.
9133         case "$vendorhtml1" in
9134         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9135         *)      dflt=$vendorhtml1 ;;
9136         esac
9137         case "$dflt" in
9138         ''|' ') dflt=none ;;
9139         esac
9140         fn=dn+~
9141         rp='Pathname for the vendor-supplied html pages?'
9142         . ./getfile
9143         vendorhtml1="$ans"
9144         vendorhtml1exp="$ansexp"
9145         ;;
9146 esac
9147 : Use ' ' for none so value is preserved next time through Configure
9148 $test X"$vendorhtml1" = "X" && vendorhtml1=' '
9149 : Change installation prefix, if necessary.
9150 if $test X"$prefix" != X"$installprefix"; then
9151         installvendorhtml1=`echo $vendorhtml1exp | $sed "s#^$prefix#$installprefix#"`
9152 else
9153         installvendorhtml1="$vendorhtml1exp"
9154 fi
9155
9156 case "$vendorprefix" in
9157 '')     vendorhtml3=''
9158         vendorhtml3exp=''
9159         ;;
9160 *)      : determine where vendor-supplied module html pages go.
9161         : There is no standard location, so try to copy the previously-selected
9162         : directory structure for the core html pages.
9163         : XXX Better default suggestions would be welcome.
9164         case "$vendorhtml3" in
9165         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9166         *)      dflt=$vendorhtml3 ;;
9167         esac
9168         case "$dflt" in
9169         ''|' ') dflt=none ;;
9170         esac
9171         fn=dn+~
9172         rp='Pathname for the vendor-supplied html pages?'
9173         . ./getfile
9174         vendorhtml3="$ans"
9175         vendorhtml3exp="$ansexp"
9176         ;;
9177 esac
9178 : Use ' ' for none so value is preserved next time through Configure
9179 $test X"$vendorhtml3" = "X" && vendorhtml3=' '
9180 : Change installation prefix, if necessary.
9181 if $test X"$prefix" != X"$installprefix"; then
9182         installvendorhtml3=`echo $vendorhtml3exp | $sed "s#^$prefix#$installprefix#"`
9183 else
9184         installvendorhtml3="$vendorhtml3exp"
9185 fi
9186
9187 case "$vendorprefix" in
9188 '')     vendorman1=''
9189         vendorman1exp=''
9190         ;;
9191 *)      : determine where vendor-supplied manual pages go.
9192         case "$vendorman1" in
9193         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9194         *)      dflt=$vendorman1 ;;
9195         esac
9196         case "$dflt" in
9197         ''|' ') dflt=none ;;
9198         esac
9199         fn=nd~+
9200         rp='Pathname for the vendor-supplied manual section 1 pages?'
9201         . ./getfile
9202         vendorman1="$ans"
9203         vendorman1exp="$ansexp"
9204         ;;
9205 esac
9206 : Use ' ' for none so value is preserved next time through Configure
9207 $test X"$vendorman1" = "X" && vendorman1=' '
9208 : Change installation prefix, if necessary.
9209 if $test X"$prefix" != X"$installprefix"; then
9210         installvendorman1=`echo "$vendorman1exp" | $sed "s#^$prefix#$installprefix#"`
9211 else
9212         installvendorman1="$vendorman1exp"
9213 fi
9214
9215 case "$vendorprefix" in
9216 '')     vendorman3=''
9217         vendorman3exp=''
9218         ;;
9219 *)      : determine where vendor-supplied module manual pages go.
9220         case "$vendorman3" in
9221         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9222         *)      dflt=$vendorman3 ;;
9223         esac
9224         case "$dflt" in
9225         ''|' ') dflt=none ;;
9226         esac
9227         fn=nd~+
9228         rp='Pathname for the vendor-supplied manual section 3 pages?'
9229         . ./getfile
9230         vendorman3="$ans"
9231         vendorman3exp="$ansexp"
9232         ;;
9233 esac
9234 : Use ' ' for none so value is preserved next time through Configure
9235 $test X"$vendorman3" = "X" && vendorman3=' '
9236 : Change installation prefix, if necessary.
9237 if $test X"$prefix" != X"$installprefix"; then
9238         installvendorman3=`echo "$vendorman3exp" | $sed "s#^$prefix#$installprefix#"`
9239 else
9240         installvendorman3="$vendorman3exp"
9241 fi
9242
9243 case "$vendorprefix" in
9244 '')     d_vendorscript="$undef"
9245         vendorscript=''
9246         vendorscriptexp=''
9247         ;;
9248 *)      d_vendorscript="$define"
9249         : determine where vendor-supplied scripts go.
9250         case "$vendorscript" in
9251         '')     dflt=$vendorprefix/script
9252                 $test -d $dflt || dflt=$vendorbin ;;
9253         *)  dflt="$vendorscript" ;;
9254         esac
9255         $cat <<EOM
9256
9257 The installation process will create a directory for 
9258 vendor-supplied scripts.
9259
9260 EOM
9261         fn=d~+
9262         rp='Pathname for the vendor-supplied scripts directory?'
9263         . ./getfile
9264         vendorscript="$ans"
9265         vendorscriptexp="$ansexp"
9266         ;;
9267 esac
9268 : Change installation prefix, if necessary.
9269 if $test X"$prefix" != X"$installprefix"; then
9270         installvendorscript=`echo $vendorscriptexp | $sed "s#^$prefix#$installprefix#"`
9271 else
9272         installvendorscript="$vendorscriptexp"
9273 fi
9274
9275 : see if qgcvt exists
9276 set qgcvt d_qgcvt
9277 eval $inlibc
9278
9279 : Check how to convert floats to strings.
9280
9281 if test "X$d_Gconvert" = X; then
9282
9283 echo " "
9284 echo "Checking for an efficient way to convert floats to strings."
9285 echo " " > try.c
9286 case "$uselongdouble" in
9287 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9288 esac
9289 case "$d_longdbl" in
9290 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9291 esac
9292 case "$d_PRIgldbl" in
9293 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9294 esac
9295 $cat >>try.c <<EOP
9296 #ifdef TRY_gconvert
9297 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9298 char *myname = "gconvert";
9299 #endif
9300 #ifdef TRY_gcvt
9301 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9302 char *myname = "gcvt";
9303 #endif
9304 #ifdef TRY_qgcvt
9305 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9306 char *myname = "qgcvt";
9307 #define DOUBLETYPE long double
9308 #endif
9309 #ifdef TRY_sprintf
9310 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9311 #ifdef HAS_PRIgldbl
9312 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9313 #else
9314 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9315 #endif
9316 #else
9317 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9318 #endif
9319 char *myname = "sprintf";
9320 #endif
9321
9322 #ifndef DOUBLETYPE
9323 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9324 #define DOUBLETYPE long double
9325 #else
9326 #define DOUBLETYPE double
9327 #endif
9328 #endif
9329
9330 #include <stdio.h>
9331
9332 #define I_STDLIB $i_stdlib
9333 #ifdef I_STDLIB
9334 #include <stdlib.h>
9335 #endif
9336
9337 int
9338 checkit(expect, got)
9339 char *expect;
9340 char *got;
9341 {
9342     if (strcmp(expect, got)) {
9343                 printf("%s oddity:  Expected %s, got %s\n",
9344                         myname, expect, got);
9345                 exit(1);
9346         }
9347 }
9348
9349 int main()
9350
9351         char buf[64]; 
9352         buf[63] = '\0';
9353
9354         /* This must be 1st test on (which?) platform */
9355         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9356         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9357         checkit("0.1", buf);
9358
9359         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9360         checkit("0.01", buf);
9361
9362         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9363         checkit("0.001", buf);
9364
9365         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9366         checkit("0.0001", buf);
9367
9368         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9369         if (strlen(buf) > 5)
9370             checkit("9e-005", buf); /* for Microsoft ?? */
9371         else
9372             checkit("9e-05", buf);
9373
9374         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9375         checkit("1", buf);
9376
9377         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9378         checkit("1.1", buf);
9379
9380         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9381         checkit("1.01", buf);
9382
9383         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9384         checkit("1.001", buf);
9385
9386         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9387         checkit("1.0001", buf);
9388
9389         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9390         checkit("1.00001", buf);
9391
9392         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9393         checkit("1.000001", buf);
9394
9395         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9396         checkit("0", buf);
9397
9398         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9399         checkit("-1", buf);
9400
9401         /* Some Linux gcvt's give 1.e+5 here. */
9402         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9403         checkit("100000", buf);
9404         
9405         /* Some Linux gcvt's give -1.e+5 here. */
9406         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9407         checkit("-100000", buf);
9408
9409         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9410         checkit("123.456", buf);
9411
9412         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9413         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9414         /* 34 should be enough to scare even long double
9415          * places into using the e notation. */
9416         if (strlen(buf) > 5)
9417             checkit("1e+034", buf); /* for Microsoft */
9418         else
9419             checkit("1e+34", buf);
9420
9421         /* For Perl, if you add additional tests here, also add them to
9422          * t/base/num.t for benefit of platforms not using Configure or
9423          * overriding d_Gconvert */
9424
9425         exit(0);
9426 }
9427 EOP
9428 : first add preferred functions to our list
9429 xxx_list=""
9430 for xxx_convert in $gconvert_preference; do
9431     case $xxx_convert in
9432     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9433     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9434     esac 
9435 done
9436 : then add any others
9437 for xxx_convert in gconvert gcvt sprintf; do
9438     case "$xxx_list" in
9439     *$xxx_convert*) ;;
9440     *) xxx_list="$xxx_list $xxx_convert" ;;
9441     esac 
9442 done
9443
9444 case "$d_longdbl$uselongdouble" in
9445 "$define$define")
9446     : again, add prefered functions to our list first
9447     xxx_ld_list=""
9448     for xxx_convert in $gconvert_ld_preference; do
9449         case $xxx_convert in
9450         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9451         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9452         esac
9453     done
9454     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9455     for xxx_convert in qgcvt sprintf $xxx_list; do
9456         case "$xxx_ld_list" in
9457         $xxx_convert*|*" $xxx_convert"*) ;;
9458         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9459         esac
9460     done
9461     : if sprintf cannot do long doubles, move it to the end
9462     if test "$d_PRIgldbl" != "$define"; then
9463         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9464     fi
9465     : if no qgcvt, remove it
9466     if test "$d_qgcvt" != "$define"; then
9467         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9468     fi
9469     : use the ld_list
9470     xxx_list="$xxx_ld_list"
9471     ;;
9472 esac
9473
9474 for xxx_convert in $xxx_list; do
9475         echo "Trying $xxx_convert..."
9476         $rm -f try try$_o
9477         set try -DTRY_$xxx_convert
9478         if eval $compile; then
9479                 echo "$xxx_convert() found." >&4
9480                 if $run ./try; then
9481                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9482                         break;
9483                 else
9484                         echo "...But $xxx_convert didn't work as I expected."
9485                         xxx_convert=''
9486                 fi
9487         else
9488                 echo "$xxx_convert NOT found." >&4
9489         fi
9490 done
9491
9492 if test X$xxx_convert = X; then
9493     echo "*** WHOA THERE!!! ***" >&4
9494     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9495     xxx_convert=sprintf
9496 fi
9497
9498 case "$xxx_convert" in
9499 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9500 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9501 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9502 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9503    "$define$define$define")
9504       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9505    "$define$define$undef")
9506       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9507    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9508    esac
9509    ;;  
9510 esac
9511
9512 fi
9513
9514 : see if _fwalk exists
9515 set fwalk d__fwalk
9516 eval $inlibc
9517
9518 : Initialize h_fcntl
9519 h_fcntl=false
9520
9521 : Initialize h_sysfile
9522 h_sysfile=false
9523
9524 : access call always available on UNIX
9525 set access d_access
9526 eval $inlibc
9527
9528 : locate the flags for 'access()'
9529 case "$d_access" in
9530 "$define")
9531         echo " "
9532         $cat >access.c <<'EOCP'
9533 #include <sys/types.h>
9534 #ifdef I_FCNTL
9535 #include <fcntl.h>
9536 #endif
9537 #ifdef I_SYS_FILE
9538 #include <sys/file.h>
9539 #endif
9540 #ifdef I_UNISTD
9541 #include <unistd.h>
9542 #endif
9543 int main() {
9544         exit(R_OK);
9545 }
9546 EOCP
9547         : check sys/file.h first, no particular reason here
9548         if $test `./findhdr sys/file.h` && \
9549                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9550                 h_sysfile=true;
9551                 echo "<sys/file.h> defines the *_OK access constants." >&4
9552         elif $test `./findhdr fcntl.h` && \
9553                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9554                 h_fcntl=true;
9555                 echo "<fcntl.h> defines the *_OK access constants." >&4
9556         elif $test `./findhdr unistd.h` && \
9557                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9558                 echo "<unistd.h> defines the *_OK access constants." >&4
9559         else
9560                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9561         fi
9562         ;;
9563 esac
9564 $rm -f access*
9565
9566 : see if accessx exists
9567 set accessx d_accessx
9568 eval $inlibc
9569
9570 : see if alarm exists
9571 set alarm d_alarm
9572 eval $inlibc
9573
9574 : see if POSIX threads are available
9575 set pthread.h i_pthread
9576 eval $inhdr
9577
9578 : define a fucntion to check prototypes
9579 $cat > protochk <<EOSH
9580 $startsh
9581 cc="$cc"
9582 optimize="$optimize"
9583 ccflags="$ccflags"
9584 prototype="$prototype"
9585 define="$define"
9586 rm=$rm
9587 usethreads=$usethreads
9588 i_pthread=$i_pthread
9589 pthread_h_first=$pthread_h_first
9590 EOSH
9591
9592 $cat >> protochk <<'EOSH'
9593
9594 $rm -f try.c
9595 foo="$1"
9596 shift
9597 while test $# -ge 2; do
9598         case "$1" in
9599                 $define) echo "#include <$2>" >> try.c ;;
9600                 literal) echo "$2" >> try.c ;;
9601         esac
9602     # Extra magic for the benefit of systems that need pthread.h
9603     # to be included early to correctly detect threadsafe functions.
9604     # Such functions must guarantee themselves, though, that the usethreads
9605     # and i_pthread have been defined, before calling protochk.
9606     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9607         echo "#include <pthread.h>" >> try.c
9608         pthread_h_done=yes
9609     fi
9610     shift 2
9611 done
9612 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9613 cat >> try.c <<'EOCP'
9614 #ifdef CAN_PROTOTYPE
9615 #define _(args) args
9616 #else
9617 #define _(args) ()
9618 #endif
9619 EOCP
9620 echo "$foo" >> try.c
9621 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9622 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9623 status=$?
9624 $rm -f try.[co]
9625 exit $status
9626 EOSH
9627 chmod +x protochk
9628 $eunicefix protochk
9629
9630 : see if sys/types.h has to be included
9631 set sys/types.h i_systypes
9632 eval $inhdr
9633
9634 : see if sys/select.h has to be included
9635 set sys/select.h i_sysselct
9636 eval $inhdr
9637
9638 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9639 while $test $# -ge 2; do
9640         case "$1" in
9641         $define) echo "#include <$2>";;
9642         esac ;
9643     shift 2;
9644 done > try.c;
9645 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9646 set try;
9647 if eval $compile; then
9648         val="$define";
9649 else
9650         val="$undef";
9651 fi;
9652 set $varname;
9653 eval $setvar;
9654 $rm -f try.c try.o'
9655
9656 : see if we should include time.h, sys/time.h, or both
9657 echo " "
9658 if test "X$timeincl" = X; then
9659         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9660         $echo $n "I'm now running the test program...$c"
9661         $cat >try.c <<'EOCP'
9662 #include <sys/types.h>
9663 #ifdef I_TIME
9664 #include <time.h>
9665 #endif
9666 #ifdef I_SYSTIME
9667 #ifdef SYSTIMEKERNEL
9668 #define KERNEL
9669 #endif
9670 #include <sys/time.h>
9671 #endif
9672 #ifdef I_SYSSELECT
9673 #include <sys/select.h>
9674 #endif
9675 int main()
9676 {
9677         struct tm foo;
9678 #ifdef S_TIMEVAL
9679         struct timeval bar;
9680 #endif
9681 #ifdef S_TIMEZONE
9682         struct timezone tzp;
9683 #endif
9684         if (foo.tm_sec == foo.tm_sec)
9685                 exit(0);
9686 #ifdef S_TIMEVAL
9687         if (bar.tv_sec == bar.tv_sec)
9688                 exit(0);
9689 #endif
9690         exit(1);
9691 }
9692 EOCP
9693         flags=''
9694         for s_timezone in '-DS_TIMEZONE' ''; do
9695         sysselect=''
9696         for s_timeval in '-DS_TIMEVAL' ''; do
9697         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9698         for i_time in '' '-DI_TIME'; do
9699         for i_systime in '-DI_SYSTIME' ''; do
9700                 case "$flags" in
9701                 '') $echo $n ".$c"
9702                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9703                         if eval $compile; then
9704                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9705                                 shift
9706                                 flags="$*"
9707                                 echo " "
9708                                 $echo $n "Succeeded with $flags$c"
9709                         fi
9710                         ;;
9711                 esac
9712         done
9713         done
9714         done
9715         done
9716         done
9717         timeincl=''
9718         echo " "
9719         case "$flags" in
9720         *SYSTIMEKERNEL*) i_systimek="$define"
9721                 timeincl=`./findhdr sys/time.h`
9722                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9723         *) i_systimek="$undef";;
9724         esac
9725         case "$flags" in
9726         *I_TIME*) i_time="$define"
9727                 timeincl=`./findhdr time.h`" $timeincl"
9728                 echo "We'll include <time.h>." >&4;;
9729         *) i_time="$undef";;
9730         esac
9731         case "$flags" in
9732         *I_SYSTIME*) i_systime="$define"
9733                 timeincl=`./findhdr sys/time.h`" $timeincl"
9734                 echo "We'll include <sys/time.h>." >&4;;
9735         *) i_systime="$undef";;
9736         esac
9737         $rm -f try.c try
9738 fi
9739 : see if struct tm knows about tm_zone
9740 case "$i_systime$i_time" in
9741 *$define*) 
9742         echo " "
9743         echo "Checking to see if your struct tm has tm_zone field..." >&4
9744         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9745         eval $hasfield
9746         ;;
9747 *)      val="$undef"
9748         set d_tm_tm_zone
9749         eval $setvar
9750         ;;
9751 esac
9752 case "$d_tm_tm_zone" in
9753 "$define")      echo "Yes, it does."   ;;
9754 *)              echo "No, it doesn't." ;;
9755 esac
9756 : see if struct tm knows about tm_gmtoff
9757 case "$i_systime$i_time" in
9758 *$define*) 
9759         echo " "
9760         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9761         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9762         eval $hasfield
9763         ;;
9764 *)      val="$undef"
9765         set d_tm_tm_gmtoff
9766         eval $setvar
9767         ;;
9768 esac
9769 case "$d_tm_tm_gmtoff" in
9770 "$define")      echo "Yes, it does."   ;;
9771 *)              echo "No, it doesn't." ;;
9772 esac
9773
9774 : see if asctime_r exists
9775 set asctime_r d_asctime_r
9776 eval $inlibc
9777 case "$d_asctime_r" in
9778 "$define")
9779         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9780         case "$d_asctime_r_proto:$usethreads" in
9781         ":define")      d_asctime_r_proto=define
9782                 set d_asctime_r_proto asctime_r $hdrs
9783                 eval $hasproto ;;
9784         *)      ;;
9785         esac
9786         case "$d_asctime_r_proto" in
9787         define)
9788         case "$asctime_r_proto" in
9789         ''|0) try='char* asctime_r(const struct tm*, char*);'
9790         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9791         esac
9792         case "$asctime_r_proto" in
9793         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9794         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9795         esac
9796         case "$asctime_r_proto" in
9797         ''|0) try='int asctime_r(const struct tm*, char*);'
9798         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9799         esac
9800         case "$asctime_r_proto" in
9801         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9802         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9803         esac
9804         case "$asctime_r_proto" in
9805         ''|0)   d_asctime_r=undef
9806                 asctime_r_proto=0
9807                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9808         * )     case "$asctime_r_proto" in
9809                 REENTRANT_PROTO*) ;;
9810                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9811                 esac
9812                 echo "Prototype: $try" ;;
9813         esac
9814         ;;
9815         *)      case "$usethreads" in
9816                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9817                 esac
9818                 d_asctime_r=undef
9819                 asctime_r_proto=0
9820                 ;;
9821         esac
9822         ;;
9823 *)      asctime_r_proto=0
9824         ;;
9825 esac
9826
9827 : see if atolf exists
9828 set atolf d_atolf
9829 eval $inlibc
9830
9831 : see if atoll exists
9832 set atoll d_atoll
9833 eval $inlibc
9834
9835 : Look for GNU-cc style attribute checking
9836 echo " "
9837 echo "Checking whether your compiler can handle __attribute__ ..." >&4
9838 $cat >attrib.c <<'EOCP'
9839 #include <stdio.h>
9840 void croak (char* pat,...) __attribute__((format(printf,1,2),noreturn));
9841 EOCP
9842 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9843         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9844                 echo "Your C compiler doesn't fully support __attribute__."
9845                 val="$undef"
9846         else
9847                 echo "Your C compiler supports __attribute__."
9848                 val="$define"
9849         fi
9850 else
9851         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9852         val="$undef"
9853 fi
9854 set d_attribut
9855 eval $setvar
9856 $rm -f attrib*
9857
9858 : see if bcmp exists
9859 set bcmp d_bcmp
9860 eval $inlibc
9861
9862 : see if bcopy exists
9863 set bcopy d_bcopy
9864 eval $inlibc
9865
9866 : see if this is a unistd.h system
9867 set unistd.h i_unistd
9868 eval $inhdr
9869
9870 : see if getpgrp exists
9871 set getpgrp d_getpgrp
9872 eval $inlibc
9873
9874 case "$d_getpgrp" in
9875 "$define")
9876         echo " "
9877         echo "Checking to see which flavor of getpgrp is in use..."
9878         $cat >try.c <<EOP
9879 #$i_unistd I_UNISTD
9880 #include <sys/types.h>
9881 #ifdef I_UNISTD
9882 #  include <unistd.h>
9883 #endif
9884 int main()
9885 {
9886         if (getuid() == 0) {
9887                 printf("(I see you are running Configure as super-user...)\n");
9888                 setuid(1);
9889         }
9890 #ifdef TRY_BSD_PGRP
9891         if (getpgrp(1) == 0)
9892                 exit(0);
9893 #else
9894         if (getpgrp() > 0)
9895                 exit(0);
9896 #endif
9897         exit(1);
9898 }
9899 EOP
9900         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9901                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
9902                 val="$define"
9903         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9904                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
9905                 val="$undef"
9906         else
9907                 echo "I can't seem to compile and run the test program."
9908                 if ./usg; then
9909                         xxx="a USG one, i.e. you use getpgrp()."
9910                 else
9911                         # SVR4 systems can appear rather BSD-ish.
9912                         case "$i_unistd" in
9913                         $undef)
9914                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
9915                                 val="$define"
9916                                 ;;
9917                         $define)
9918                                 xxx="probably a USG one, i.e. you use getpgrp()."
9919                                 val="$undef"
9920                                 ;;
9921                         esac
9922                 fi
9923                 echo "Assuming your getpgrp is $xxx" >&4
9924         fi
9925         ;;
9926 *) val="$undef";;
9927 esac
9928 set d_bsdgetpgrp
9929 eval $setvar
9930 $rm -f try try.*
9931
9932 : see if setpgrp exists
9933 set setpgrp d_setpgrp
9934 eval $inlibc
9935
9936 case "$d_setpgrp" in
9937 "$define")
9938         echo " "
9939         echo "Checking to see which flavor of setpgrp is in use..."
9940         $cat >try.c <<EOP
9941 #$i_unistd I_UNISTD
9942 #include <sys/types.h>
9943 #ifdef I_UNISTD
9944 #  include <unistd.h>
9945 #endif
9946 int main()
9947 {
9948         if (getuid() == 0) {
9949                 printf("(I see you are running Configure as super-user...)\n");
9950                 setuid(1);
9951         }
9952 #ifdef TRY_BSD_PGRP
9953         if (-1 == setpgrp(1, 1))
9954                 exit(0);
9955 #else
9956         if (setpgrp() != -1)
9957                 exit(0);
9958 #endif
9959         exit(1);
9960 }
9961 EOP
9962         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9963                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
9964                 val="$define"
9965         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
9966                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
9967                 val="$undef"
9968         else
9969                 echo "(I can't seem to compile and run the test program.)"
9970                 if ./usg; then
9971                         xxx="a USG one, i.e. you use setpgrp()."
9972                 else
9973                         # SVR4 systems can appear rather BSD-ish.
9974                         case "$i_unistd" in
9975                         $undef)
9976                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
9977                                 val="$define"
9978                                 ;;
9979                         $define)
9980                                 xxx="probably a USG one, i.e. you use setpgrp()."
9981                                 val="$undef"
9982                                 ;;
9983                         esac
9984                 fi
9985                 echo "Assuming your setpgrp is $xxx" >&4
9986         fi
9987         ;;
9988 *) val="$undef";;
9989 esac
9990 set d_bsdsetpgrp
9991 eval $setvar
9992 $rm -f try try.*
9993 : see if bzero exists
9994 set bzero d_bzero
9995 eval $inlibc
9996
9997 : see if signal is declared as pointer to function returning int or void
9998 echo " "
9999 xxx=`./findhdr signal.h`
10000 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10001 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10002         echo "You have int (*signal())() instead of void." >&4
10003         val="$undef"
10004 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10005         echo "You have void (*signal())()." >&4
10006         val="$define"
10007 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10008         echo "You have int (*signal())() instead of void." >&4
10009         val="$undef"
10010 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10011         echo "You have void (*signal())()." >&4
10012         val="$define"
10013 else
10014         case "$d_voidsig" in
10015         '')
10016         echo "I can't determine whether signal handler returns void or int..." >&4
10017                 dflt=void
10018                 rp="What type does your signal handler return?"
10019                 . ./myread
10020                 case "$ans" in
10021                 v*) val="$define";;
10022                 *) val="$undef";;
10023                 esac;;
10024         "$define")
10025                 echo "As you already told me, signal handler returns void." >&4
10026                 val="$define"
10027                 ;;
10028         *)      echo "As you already told me, signal handler returns int." >&4
10029                 val="$undef"
10030                 ;;
10031         esac
10032 fi
10033 set d_voidsig
10034 eval $setvar
10035 case "$d_voidsig" in
10036 "$define") signal_t="void";;
10037 *) signal_t="int";;
10038 esac
10039 $rm -f $$.tmp
10040
10041 : check for ability to cast large floats to 32-bit ints.
10042 echo " "
10043 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10044 if $test "$intsize" -ge 4; then
10045         xxx=int
10046 else
10047         xxx=long
10048 fi
10049 $cat >try.c <<EOCP
10050 #include <stdio.h>
10051 #$i_stdlib I_STDLIB
10052 #ifdef I_STDLIB
10053 #include <stdlib.h>
10054 #endif
10055 #include <sys/types.h>
10056 #include <signal.h>
10057 $signal_t blech(s) int s; { exit(3); }
10058 int main()
10059 {
10060         $xxx i32;
10061         double f, g;
10062         int result = 0;
10063         char str[16];
10064         signal(SIGFPE, blech);
10065
10066         /* Don't let compiler optimize the test away.  Store the number 
10067            in a writable string for gcc to pass to sscanf under HP/UX.
10068         */
10069         sprintf(str, "2147483647");
10070         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10071         g = 10 * f;
10072         i32  = ($xxx) g;
10073
10074         /* x86 processors will probably give 0x8000 0000, which is a
10075        sign change.  We don't want that.  We want to mimic SPARC
10076            behavior here, which is to preserve the sign and give
10077            back 0x7fff ffff.
10078         */
10079         if (i32 != ($xxx) f)
10080                 result |= 1;
10081         exit(result);
10082 }
10083 EOCP
10084 set try
10085 if eval $compile_ok; then
10086         $run ./try
10087         yyy=$?
10088 else
10089         echo "(I can't seem to compile the test program--assuming it can't)"
10090         yyy=1
10091 fi
10092 case "$yyy" in
10093 0)      val="$define"
10094         echo "Yup, it can."
10095         ;;
10096 *)      val="$undef"
10097         echo "Nope, it can't."
10098         ;;
10099 esac
10100 set d_casti32
10101 eval $setvar
10102 $rm -f try try.*
10103
10104 : check for ability to cast negative floats to unsigned
10105 echo " "
10106 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10107 $cat >try.c <<EOCP
10108 #include <stdio.h>
10109 #$i_stdlib I_STDLIB
10110 #ifdef I_STDLIB
10111 #include <stdlib.h>
10112 #endif
10113 #include <sys/types.h>
10114 #include <signal.h>
10115 $signal_t blech(s) int s; { exit(7); }
10116 $signal_t blech_in_list(s) int s; { exit(4); }
10117 unsigned long dummy_long(p) unsigned long p; { return p; }
10118 unsigned int dummy_int(p) unsigned int p; { return p; }
10119 unsigned short dummy_short(p) unsigned short p; { return p; }
10120 int main()
10121 {
10122         double f;
10123         unsigned long along;
10124         unsigned int aint;
10125         unsigned short ashort;
10126         int result = 0;
10127         char str[16];
10128         
10129         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10130            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10131            optimized the whole file away
10132         */
10133         /* Store the number in a writable string for gcc to pass to 
10134            sscanf under HP/UX.
10135         */
10136         sprintf(str, "-123");
10137         sscanf(str, "%lf", &f);  /* f = -123.; */
10138
10139         signal(SIGFPE, blech);
10140         along = (unsigned long)f;
10141         aint = (unsigned int)f;
10142         ashort = (unsigned short)f;
10143         if (along != (unsigned long)-123)
10144                 result |= 1;
10145         if (aint != (unsigned int)-123)
10146                 result |= 1;
10147         if (ashort != (unsigned short)-123)
10148                 result |= 1;
10149         sprintf(str, "1073741824.");
10150         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10151         f = f + f;
10152         along = 0;
10153         along = (unsigned long)f;
10154         if (along != 0x80000000)
10155                 result |= 2;
10156         f -= 1.;
10157         along = 0;
10158         along = (unsigned long)f;
10159         if (along != 0x7fffffff)
10160                 result |= 1;
10161         f += 2.;
10162         along = 0;
10163         along = (unsigned long)f;
10164         if (along != 0x80000001)
10165                 result |= 2;
10166         if (result)
10167                 exit(result);
10168         signal(SIGFPE, blech_in_list);
10169         sprintf(str, "123.");
10170         sscanf(str, "%lf", &f);  /* f = 123.; */
10171         along = dummy_long((unsigned long)f);
10172         aint = dummy_int((unsigned int)f);
10173         ashort = dummy_short((unsigned short)f);
10174         if (along != (unsigned long)123)
10175                 result |= 4;
10176         if (aint != (unsigned int)123)
10177                 result |= 4;
10178         if (ashort != (unsigned short)123)
10179                 result |= 4;
10180         exit(result);
10181
10182 }
10183 EOCP
10184 set try
10185 if eval $compile_ok; then
10186         $run ./try
10187         castflags=$?
10188 else
10189         echo "(I can't seem to compile the test program--assuming it can't)"
10190         castflags=7
10191 fi
10192 case "$castflags" in
10193 0)      val="$define"
10194         echo "Yup, it can."
10195         ;;
10196 *)      val="$undef"
10197         echo "Nope, it can't."
10198         ;;
10199 esac
10200 set d_castneg
10201 eval $setvar
10202 $rm -f try.*
10203
10204 : see if vprintf exists
10205 echo " "
10206 if set vprintf val -f d_vprintf; eval $csym; $val; then
10207         echo 'vprintf() found.' >&4
10208         val="$define"
10209         $cat >try.c <<'EOF'
10210 #include <varargs.h>
10211
10212 int main() { xxx("foo"); }
10213
10214 xxx(va_alist)
10215 va_dcl
10216 {
10217         va_list args;
10218         char buf[10];
10219
10220         va_start(args);
10221         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10222 }
10223 EOF
10224         set try
10225         if eval $compile && $run ./try; then
10226                 echo "Your vsprintf() returns (int)." >&4
10227                 val2="$undef"
10228         else
10229                 echo "Your vsprintf() returns (char*)." >&4
10230                 val2="$define"
10231         fi
10232 else
10233         echo 'vprintf() NOT found.' >&4
10234                 val="$undef"
10235                 val2="$undef"
10236 fi
10237 $rm -f try try.*
10238 set d_vprintf
10239 eval $setvar
10240 val=$val2
10241 set d_charvspr
10242 eval $setvar
10243
10244 : see if chown exists
10245 set chown d_chown
10246 eval $inlibc
10247
10248 : see if chroot exists
10249 set chroot d_chroot
10250 eval $inlibc
10251
10252 : see if chsize exists
10253 set chsize d_chsize
10254 eval $inlibc
10255
10256 : see if class exists
10257 set class d_class
10258 eval $inlibc
10259
10260 hasstruct='varname=$1; struct=$2; shift; shift;
10261 while $test $# -ge 2; do
10262         case "$1" in
10263         $define) echo "#include <$2>";;
10264         esac ;
10265     shift 2;
10266 done > try.c;
10267 echo "int main () { struct $struct foo; }" >> try.c;
10268 set try;
10269 if eval $compile; then
10270         val="$define";
10271 else
10272         val="$undef";
10273 fi;
10274 set $varname;
10275 eval $setvar;
10276 $rm -f try.c try.o'
10277
10278 socketlib=''
10279 sockethdr=''
10280 : see whether socket exists
10281 echo " "
10282 $echo $n "Hmm... $c" >&4
10283 if set socket val -f d_socket; eval $csym; $val; then
10284         echo "Looks like you have Berkeley networking support." >&4
10285         d_socket="$define"
10286         if set setsockopt val -f; eval $csym; $val; then
10287                 d_oldsock="$undef"
10288         else
10289                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10290                 d_oldsock="$define"
10291         fi
10292 else
10293         if $contains socklib libc.list >/dev/null 2>&1; then
10294                 echo "Looks like you have Berkeley networking support." >&4
10295                 d_socket="$define"
10296                 : we will have to assume that it supports the 4.2 BSD interface
10297                 d_oldsock="$undef"
10298         else
10299                 echo "You don't have Berkeley networking in libc$_a..." >&4
10300                 if test "X$d_socket" = "X$define"; then
10301                    echo "...but you seem to believe that you have sockets." >&4
10302                 else
10303                         for net in net socket
10304                         do
10305                                 if test -f /usr/lib/lib$net$_a; then
10306                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10307                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10308                                         if $contains socket libc.list >/dev/null 2>&1; then
10309                                                 d_socket="$define"
10310                                                 socketlib="-l$net"
10311                                                 case "$net" in
10312                                                 net)
10313                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10314                                                         sockethdr="-I/usr/netinclude"
10315                                                         ;;
10316                                                 esac
10317                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10318                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10319                                                         d_oldsock="$undef"
10320                                                 else
10321                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10322                                                         d_oldsock="$define"
10323                                                 fi
10324                                                 break
10325                                         fi
10326                                 fi
10327                         done
10328                         if test "X$d_socket" != "X$define"; then
10329                            echo "or anywhere else I see." >&4
10330                            d_socket="$undef"
10331                            d_oldsock="$undef"
10332                         fi
10333                 fi
10334         fi
10335 fi
10336
10337 : see if socketpair exists
10338 set socketpair d_sockpair
10339 eval $inlibc
10340
10341
10342 echo " "
10343 echo "Checking the availability of certain socket constants..." >&4
10344 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10345         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10346         $cat >try.c <<EOF
10347 #include <sys/types.h>
10348 #include <sys/socket.h>
10349 int main() {
10350     int i = $ENUM;
10351 }
10352 EOF
10353         val="$undef"
10354         set try; if eval $compile; then
10355                 val="$define"
10356         fi
10357         set d_${enum}; eval $setvar
10358         $rm -f try.c try
10359 done
10360
10361 : see if this is a sys/uio.h system
10362 set sys/uio.h i_sysuio
10363 eval $inhdr
10364
10365
10366 echo " "
10367 echo "Checking to see if your system supports struct cmsghdr..." >&4
10368 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10369 eval $hasstruct
10370 case "$d_cmsghdr_s" in
10371 "$define")      echo "Yes, it does."   ;;
10372 *)              echo "No, it doesn't." ;;
10373 esac
10374
10375
10376 : check for const keyword
10377 echo " "
10378 echo 'Checking to see if your C compiler knows about "const"...' >&4
10379 $cat >const.c <<'EOCP'
10380 typedef struct spug { int drokk; } spug;
10381 int main()
10382 {
10383         const char *foo;
10384         const spug y;
10385 }
10386 EOCP
10387 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10388         val="$define"
10389         echo "Yup, it does."
10390 else
10391         val="$undef"
10392         echo "Nope, it doesn't."
10393 fi
10394 set d_const
10395 eval $setvar
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_dirent I_DIRENT             /**/
10750 #$i_sysdir I_SYS_DIR            /**/
10751 #$i_sysndir I_SYS_NDIR          /**/
10752 #$i_systypes I_SYS_TYPES        /**/
10753 #if defined(I_SYS_TYPES)
10754 #include <sys/types.h>
10755 #endif
10756 #if defined(I_DIRENT)
10757 #include <dirent.h>
10758 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10759 #include <sys/dir.h>
10760 #endif
10761 #else
10762 #ifdef I_SYS_NDIR
10763 #include <sys/ndir.h>
10764 #else
10765 #ifdef I_SYS_DIR
10766 #ifdef hp9000s500
10767 #include <ndir.h>       /* may be wrong in the future */
10768 #else
10769 #include <sys/dir.h>
10770 #endif
10771 #endif
10772 #endif
10773 #endif 
10774 int main() {
10775         DIR *dirp = opendir(".");
10776         if (dirfd(dirp) >= 0)
10777                 exit(0);
10778         else
10779                 exit(1);
10780 }
10781 EOM
10782 set dirfd
10783 if eval $compile; then
10784         val="$define"
10785 fi
10786 case "$val" in
10787 $define)        echo "dirfd() found." >&4       ;;
10788 *)              echo "dirfd() NOT found." >&4   ;;
10789 esac
10790 set d_dirfd
10791 eval $setvar
10792 $rm -f dirfd*
10793
10794 : see if dlerror exists
10795 xxx_runnm="$runnm"
10796 runnm=false
10797 set dlerror d_dlerror
10798 eval $inlibc
10799 runnm="$xxx_runnm"
10800
10801 : see if dlfcn is available
10802 set dlfcn.h i_dlfcn
10803 eval $inhdr
10804
10805 case "$usedl" in
10806 $define|y|true)
10807         $cat << EOM
10808
10809 On a few systems, the dynamically loaded modules that perl generates and uses
10810 will need a different extension than shared libs. The default will probably
10811 be appropriate.
10812
10813 EOM
10814         case "$dlext" in
10815         '')     dflt="$so" ;;
10816         *)      dflt="$dlext" ;;
10817         esac
10818         rp='What is the extension of dynamically loaded modules'
10819         . ./myread
10820         dlext="$ans"
10821         ;;
10822 *)
10823         dlext="none"
10824         ;;
10825 esac
10826
10827 : Check if dlsym need a leading underscore
10828 echo " "
10829 val="$undef"
10830
10831 case "$dlsrc" in
10832 dl_dlopen.xs)
10833         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
10834         $cat >dyna.c <<'EOM'
10835 fred () { }
10836 EOM
10837
10838 $cat >fred.c<<EOM
10839
10840 #include <stdio.h>
10841 #$i_dlfcn I_DLFCN
10842 #ifdef I_DLFCN
10843 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
10844 #else
10845 #include <sys/types.h>
10846 #include <nlist.h>
10847 #include <link.h>
10848 #endif
10849
10850 extern int fred() ;
10851
10852 int main()
10853 {
10854     void * handle ;
10855     void * symbol ;
10856 #ifndef RTLD_LAZY
10857     int mode = 1 ;
10858 #else
10859     int mode = RTLD_LAZY ;
10860 #endif
10861     handle = dlopen("./dyna.$dlext", mode) ;
10862     if (handle == NULL) {
10863         printf ("1\n") ;
10864         fflush (stdout) ;
10865         exit(0);
10866     }
10867     symbol = dlsym(handle, "fred") ;
10868     if (symbol == NULL) {
10869         /* try putting a leading underscore */
10870         symbol = dlsym(handle, "_fred") ;
10871         if (symbol == NULL) {
10872             printf ("2\n") ;
10873             fflush (stdout) ;
10874             exit(0);
10875         }
10876         printf ("3\n") ;
10877     }
10878     else
10879         printf ("4\n") ;
10880     fflush (stdout) ;
10881     exit(0);
10882 }
10883 EOM
10884         : Call the object file tmp-dyna.o in case dlext=o.
10885         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
10886                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
10887                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
10888                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
10889                 xxx=`$run ./fred`
10890                 case $xxx in
10891                 1)      echo "Test program failed using dlopen." >&4
10892                         echo "Perhaps you should not use dynamic loading." >&4;;
10893                 2)      echo "Test program failed using dlsym." >&4
10894                         echo "Perhaps you should not use dynamic loading." >&4;;
10895                 3)      echo "dlsym needs a leading underscore" >&4
10896                         val="$define" ;;
10897                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
10898                 esac
10899         else
10900                 echo "I can't compile and run the test program." >&4
10901                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
10902         fi
10903         ;;
10904 esac
10905                 
10906 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
10907
10908 set d_dlsymun
10909 eval $setvar
10910
10911 : see if drand48_r exists
10912 set drand48_r d_drand48_r
10913 eval $inlibc
10914 case "$d_drand48_r" in
10915 "$define")
10916         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
10917         case "$d_drand48_r_proto:$usethreads" in
10918         ":define")      d_drand48_r_proto=define
10919                 set d_drand48_r_proto drand48_r $hdrs
10920                 eval $hasproto ;;
10921         *)      ;;
10922         esac
10923         case "$d_drand48_r_proto" in
10924         define)
10925         case "$drand48_r_proto" in
10926         ''|0) try='int drand48_r(struct drand48_data*, double*);'
10927         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
10928         esac
10929         case "$drand48_r_proto" in
10930         ''|0)   d_drand48_r=undef
10931                 drand48_r_proto=0
10932                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
10933         * )     case "$drand48_r_proto" in
10934                 REENTRANT_PROTO*) ;;
10935                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
10936                 esac
10937                 echo "Prototype: $try" ;;
10938         esac
10939         ;;
10940         *)      case "$usethreads" in
10941                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
10942                 esac
10943                 d_drand48_r=undef
10944                 drand48_r_proto=0
10945                 ;;
10946         esac
10947         ;;
10948 *)      drand48_r_proto=0
10949         ;;
10950 esac
10951
10952 : see if prototype for drand48 is available
10953 echo " "
10954 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
10955 eval $hasproto
10956
10957 : see if dup2 exists
10958 set dup2 d_dup2
10959 eval $inlibc
10960
10961 : see if eaccess exists
10962 set eaccess d_eaccess
10963 eval $inlibc
10964
10965 : see if endgrent exists
10966 set endgrent d_endgrent
10967 eval $inlibc
10968
10969 : see if this is an grp system
10970 set grp.h i_grp
10971 eval $inhdr
10972
10973 case "$i_grp" in
10974 $define)
10975         xxx=`./findhdr grp.h`
10976         $cppstdin $cppflags $cppminus < $xxx >$$.h
10977
10978         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
10979                 val="$define"
10980         else
10981                 val="$undef"
10982         fi
10983         set d_grpasswd
10984         eval $setvar
10985
10986         $rm -f $$.h
10987         ;;
10988 *)
10989         val="$undef";
10990         set d_grpasswd; eval $setvar
10991         ;;
10992 esac
10993
10994 : see if endgrent_r exists
10995 set endgrent_r d_endgrent_r
10996 eval $inlibc
10997 case "$d_endgrent_r" in
10998 "$define")
10999         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11000         case "$d_endgrent_r_proto:$usethreads" in
11001         ":define")      d_endgrent_r_proto=define
11002                 set d_endgrent_r_proto endgrent_r $hdrs
11003                 eval $hasproto ;;
11004         *)      ;;
11005         esac
11006         case "$d_endgrent_r_proto" in
11007         define)
11008         case "$endgrent_r_proto" in
11009         ''|0) try='int endgrent_r(FILE**);'
11010         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11011         esac
11012         case "$endgrent_r_proto" in
11013         ''|0) try='void endgrent_r(FILE**);'
11014         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11015         esac
11016         case "$endgrent_r_proto" in
11017         ''|0)   d_endgrent_r=undef
11018                 endgrent_r_proto=0
11019                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11020         * )     case "$endgrent_r_proto" in
11021                 REENTRANT_PROTO*) ;;
11022                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11023                 esac
11024                 echo "Prototype: $try" ;;
11025         esac
11026         ;;
11027         *)      case "$usethreads" in
11028                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11029                 esac
11030                 d_endgrent_r=undef
11031                 endgrent_r_proto=0
11032                 ;;
11033         esac
11034         ;;
11035 *)      endgrent_r_proto=0
11036         ;;
11037 esac
11038
11039 : see if endhostent exists
11040 set endhostent d_endhent
11041 eval $inlibc
11042
11043 : see if this is a netdb.h system
11044 set netdb.h i_netdb
11045 eval $inhdr
11046
11047 : see if endhostent_r exists
11048 set endhostent_r d_endhostent_r
11049 eval $inlibc
11050 case "$d_endhostent_r" in
11051 "$define")
11052         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11053         case "$d_endhostent_r_proto:$usethreads" in
11054         ":define")      d_endhostent_r_proto=define
11055                 set d_endhostent_r_proto endhostent_r $hdrs
11056                 eval $hasproto ;;
11057         *)      ;;
11058         esac
11059         case "$d_endhostent_r_proto" in
11060         define)
11061         case "$endhostent_r_proto" in
11062         ''|0) try='int endhostent_r(struct hostent_data*);'
11063         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11064         esac
11065         case "$endhostent_r_proto" in
11066         ''|0) try='void endhostent_r(struct hostent_data*);'
11067         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11068         esac
11069         case "$endhostent_r_proto" in
11070         ''|0)   d_endhostent_r=undef
11071                 endhostent_r_proto=0
11072                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11073         * )     case "$endhostent_r_proto" in
11074                 REENTRANT_PROTO*) ;;
11075                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11076                 esac
11077                 echo "Prototype: $try" ;;
11078         esac
11079         ;;
11080         *)      case "$usethreads" in
11081                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11082                 esac
11083                 d_endhostent_r=undef
11084                 endhostent_r_proto=0
11085                 ;;
11086         esac
11087         ;;
11088 *)      endhostent_r_proto=0
11089         ;;
11090 esac
11091
11092 : see if endnetent exists
11093 set endnetent d_endnent
11094 eval $inlibc
11095
11096 : see if endnetent_r exists
11097 set endnetent_r d_endnetent_r
11098 eval $inlibc
11099 case "$d_endnetent_r" in
11100 "$define")
11101         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11102         case "$d_endnetent_r_proto:$usethreads" in
11103         ":define")      d_endnetent_r_proto=define
11104                 set d_endnetent_r_proto endnetent_r $hdrs
11105                 eval $hasproto ;;
11106         *)      ;;
11107         esac
11108         case "$d_endnetent_r_proto" in
11109         define)
11110         case "$endnetent_r_proto" in
11111         ''|0) try='int endnetent_r(struct netent_data*);'
11112         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11113         esac
11114         case "$endnetent_r_proto" in
11115         ''|0) try='void endnetent_r(struct netent_data*);'
11116         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11117         esac
11118         case "$endnetent_r_proto" in
11119         ''|0)   d_endnetent_r=undef
11120                 endnetent_r_proto=0
11121                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11122         * )     case "$endnetent_r_proto" in
11123                 REENTRANT_PROTO*) ;;
11124                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11125                 esac
11126                 echo "Prototype: $try" ;;
11127         esac
11128         ;;
11129         *)      case "$usethreads" in
11130                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11131                 esac
11132                 d_endnetent_r=undef
11133                 endnetent_r_proto=0
11134                 ;;
11135         esac
11136         ;;
11137 *)      endnetent_r_proto=0
11138         ;;
11139 esac
11140
11141 : see if endprotoent exists
11142 set endprotoent d_endpent
11143 eval $inlibc
11144
11145 : see if endprotoent_r exists
11146 set endprotoent_r d_endprotoent_r
11147 eval $inlibc
11148 case "$d_endprotoent_r" in
11149 "$define")
11150         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11151         case "$d_endprotoent_r_proto:$usethreads" in
11152         ":define")      d_endprotoent_r_proto=define
11153                 set d_endprotoent_r_proto endprotoent_r $hdrs
11154                 eval $hasproto ;;
11155         *)      ;;
11156         esac
11157         case "$d_endprotoent_r_proto" in
11158         define)
11159         case "$endprotoent_r_proto" in
11160         ''|0) try='int endprotoent_r(struct protoent_data*);'
11161         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11162         esac
11163         case "$endprotoent_r_proto" in
11164         ''|0) try='void endprotoent_r(struct protoent_data*);'
11165         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11166         esac
11167         case "$endprotoent_r_proto" in
11168         ''|0)   d_endprotoent_r=undef
11169                 endprotoent_r_proto=0
11170                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11171         * )     case "$endprotoent_r_proto" in
11172                 REENTRANT_PROTO*) ;;
11173                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11174                 esac
11175                 echo "Prototype: $try" ;;
11176         esac
11177         ;;
11178         *)      case "$usethreads" in
11179                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11180                 esac
11181                 d_endprotoent_r=undef
11182                 endprotoent_r_proto=0
11183                 ;;
11184         esac
11185         ;;
11186 *)      endprotoent_r_proto=0
11187         ;;
11188 esac
11189
11190 : see if endpwent exists
11191 set endpwent d_endpwent
11192 eval $inlibc
11193
11194 : see if this is a pwd.h system
11195 set pwd.h i_pwd
11196 eval $inhdr
11197
11198 case "$i_pwd" in
11199 $define)
11200         xxx=`./findhdr pwd.h`
11201         $cppstdin $cppflags $cppminus < $xxx >$$.h
11202
11203         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11204                 val="$define"
11205         else
11206                 val="$undef"
11207         fi
11208         set d_pwquota
11209         eval $setvar
11210
11211         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11212                 val="$define"
11213         else
11214                 val="$undef"
11215         fi
11216         set d_pwage
11217         eval $setvar
11218
11219         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11220                 val="$define"
11221         else
11222                 val="$undef"
11223         fi
11224         set d_pwchange
11225         eval $setvar
11226
11227         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11228                 val="$define"
11229         else
11230                 val="$undef"
11231         fi
11232         set d_pwclass
11233         eval $setvar
11234
11235         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11236                 val="$define"
11237         else
11238                 val="$undef"
11239         fi
11240         set d_pwexpire
11241         eval $setvar
11242
11243         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11244                 val="$define"
11245         else
11246                 val="$undef"
11247         fi
11248         set d_pwcomment
11249         eval $setvar
11250
11251         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11252                 val="$define"
11253         else
11254                 val="$undef"
11255         fi
11256         set d_pwgecos
11257         eval $setvar
11258
11259         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11260                 val="$define"
11261         else
11262                 val="$undef"
11263         fi
11264         set d_pwpasswd
11265         eval $setvar
11266
11267         $rm -f $$.h
11268         ;;
11269 *)
11270         val="$undef"; 
11271         set d_pwquota; eval $setvar
11272         set d_pwage; eval $setvar
11273         set d_pwchange; eval $setvar
11274         set d_pwclass; eval $setvar
11275         set d_pwexpire; eval $setvar
11276         set d_pwcomment; eval $setvar
11277         set d_pwgecos; eval $setvar
11278         set d_pwpasswd; eval $setvar
11279         ;;
11280 esac
11281
11282 : see if endpwent_r exists
11283 set endpwent_r d_endpwent_r
11284 eval $inlibc
11285 case "$d_endpwent_r" in
11286 "$define")
11287         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11288         case "$d_endpwent_r_proto:$usethreads" in
11289         ":define")      d_endpwent_r_proto=define
11290                 set d_endpwent_r_proto endpwent_r $hdrs
11291                 eval $hasproto ;;
11292         *)      ;;
11293         esac
11294         case "$d_endpwent_r_proto" in
11295         define)
11296         case "$endpwent_r_proto" in
11297         ''|0) try='int endpwent_r(FILE**);'
11298         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11299         esac
11300         case "$endpwent_r_proto" in
11301         ''|0) try='void endpwent_r(FILE**);'
11302         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11303         esac
11304         case "$endpwent_r_proto" in
11305         ''|0)   d_endpwent_r=undef
11306                 endpwent_r_proto=0
11307                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11308         * )     case "$endpwent_r_proto" in
11309                 REENTRANT_PROTO*) ;;
11310                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11311                 esac
11312                 echo "Prototype: $try" ;;
11313         esac
11314         ;;
11315         *)      case "$usethreads" in
11316                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11317                 esac
11318                 d_endpwent_r=undef
11319                 endpwent_r_proto=0
11320                 ;;
11321         esac
11322         ;;
11323 *)      endpwent_r_proto=0
11324         ;;
11325 esac
11326
11327 : see if endservent exists
11328 set endservent d_endsent
11329 eval $inlibc
11330
11331 : see if endservent_r exists
11332 set endservent_r d_endservent_r
11333 eval $inlibc
11334 case "$d_endservent_r" in
11335 "$define")
11336         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11337         case "$d_endservent_r_proto:$usethreads" in
11338         ":define")      d_endservent_r_proto=define
11339                 set d_endservent_r_proto endservent_r $hdrs
11340                 eval $hasproto ;;
11341         *)      ;;
11342         esac
11343         case "$d_endservent_r_proto" in
11344         define)
11345         case "$endservent_r_proto" in
11346         ''|0) try='int endservent_r(struct servent_data*);'
11347         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11348         esac
11349         case "$endservent_r_proto" in
11350         ''|0) try='void endservent_r(struct servent_data*);'
11351         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11352         esac
11353         case "$endservent_r_proto" in
11354         ''|0)   d_endservent_r=undef
11355                 endservent_r_proto=0
11356                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11357         * )     case "$endservent_r_proto" in
11358                 REENTRANT_PROTO*) ;;
11359                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11360                 esac
11361                 echo "Prototype: $try" ;;
11362         esac
11363         ;;
11364         *)      case "$usethreads" in
11365                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11366                 esac
11367                 d_endservent_r=undef
11368                 endservent_r_proto=0
11369                 ;;
11370         esac
11371         ;;
11372 *)      endservent_r_proto=0
11373         ;;
11374 esac
11375
11376 : Locate the flags for 'open()'
11377 echo " "
11378 $cat >try.c <<'EOCP'
11379 #include <sys/types.h>
11380 #ifdef I_FCNTL
11381 #include <fcntl.h>
11382 #endif
11383 #ifdef I_SYS_FILE
11384 #include <sys/file.h>
11385 #endif
11386 int main() {
11387         if(O_RDONLY);
11388 #ifdef O_TRUNC
11389         exit(0);
11390 #else
11391         exit(1);
11392 #endif
11393 }
11394 EOCP
11395 : check sys/file.h first to get FREAD on Sun
11396 if $test `./findhdr sys/file.h` && \
11397                 set try -DI_SYS_FILE && eval $compile; then
11398         h_sysfile=true;
11399         echo "<sys/file.h> defines the O_* constants..." >&4
11400         if $run ./try; then
11401                 echo "and you have the 3 argument form of open()." >&4
11402                 val="$define"
11403         else
11404                 echo "but not the 3 argument form of open().  Oh, well." >&4
11405                 val="$undef"
11406         fi
11407 elif $test `./findhdr fcntl.h` && \
11408                 set try -DI_FCNTL && eval $compile; then
11409         h_fcntl=true;
11410         echo "<fcntl.h> defines the O_* constants..." >&4
11411         if $run ./try; then
11412                 echo "and you have the 3 argument form of open()." >&4
11413                 val="$define"
11414         else
11415                 echo "but not the 3 argument form of open().  Oh, well." >&4
11416                 val="$undef"
11417         fi
11418 else
11419         val="$undef"
11420         echo "I can't find the O_* constant definitions!  You got problems." >&4
11421 fi
11422 set d_open3
11423 eval $setvar
11424 $rm -f try try.*
11425
11426 : see which of string.h or strings.h is needed
11427 echo " "
11428 strings=`./findhdr string.h`
11429 if $test "$strings" && $test -r "$strings"; then
11430         echo "Using <string.h> instead of <strings.h>." >&4
11431         val="$define"
11432 else
11433         val="$undef"
11434         strings=`./findhdr strings.h`
11435         if $test "$strings" && $test -r "$strings"; then
11436                 echo "Using <strings.h> instead of <string.h>." >&4
11437         else
11438                 echo "No string header found -- You'll surely have problems." >&4
11439         fi
11440 fi
11441 set i_string
11442 eval $setvar
11443 case "$i_string" in
11444 "$undef") strings=`./findhdr strings.h`;;
11445 *)        strings=`./findhdr string.h`;;
11446 esac
11447
11448 : see if this is a sys/file.h system
11449 val=''
11450 set sys/file.h val
11451 eval $inhdr
11452
11453 : do we need to include sys/file.h ?
11454 case "$val" in
11455 "$define")
11456         echo " "
11457         if $h_sysfile; then
11458                 val="$define"
11459                 echo "We'll be including <sys/file.h>." >&4
11460         else
11461                 val="$undef"
11462                 echo "We won't be including <sys/file.h>." >&4
11463         fi
11464         ;;
11465 *)
11466         h_sysfile=false
11467         ;;
11468 esac
11469 set i_sysfile
11470 eval $setvar
11471
11472 : see if fcntl.h is there
11473 val=''
11474 set fcntl.h val
11475 eval $inhdr
11476
11477 : see if we can include fcntl.h
11478 case "$val" in
11479 "$define")
11480         echo " "
11481         if $h_fcntl; then
11482                 val="$define"
11483                 echo "We'll be including <fcntl.h>." >&4
11484         else
11485                 val="$undef"
11486                 if $h_sysfile; then
11487         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11488                 else
11489                         echo "We won't be including <fcntl.h>." >&4
11490                 fi
11491         fi
11492         ;;
11493 *)
11494         h_fcntl=false
11495         val="$undef"
11496         ;;
11497 esac
11498 set i_fcntl
11499 eval $setvar
11500
11501 : check for non-blocking I/O stuff
11502 case "$h_sysfile" in
11503 true) echo "#include <sys/file.h>" > head.c;;
11504 *)
11505        case "$h_fcntl" in
11506        true) echo "#include <fcntl.h>" > head.c;;
11507        *) echo "#include <sys/fcntl.h>" > head.c;;
11508        esac
11509        ;;
11510 esac
11511 echo " "
11512 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11513 case "$o_nonblock" in
11514 '')
11515         $cat head.c > try.c
11516         $cat >>try.c <<EOCP
11517 #include <stdio.h>
11518 #include <stdlib.h>
11519 #$i_fcntl I_FCNTL
11520 #ifdef I_FCNTL
11521 #include <fcntl.h>
11522 #endif
11523 int main() {
11524 #ifdef O_NONBLOCK
11525         printf("O_NONBLOCK\n");
11526         exit(0);
11527 #endif
11528 #ifdef O_NDELAY
11529         printf("O_NDELAY\n");
11530         exit(0);
11531 #endif
11532 #ifdef FNDELAY
11533         printf("FNDELAY\n");
11534         exit(0);
11535 #endif
11536         exit(0);
11537 }
11538 EOCP
11539         set try
11540         if eval $compile_ok; then
11541                 o_nonblock=`$run ./try`
11542                 case "$o_nonblock" in
11543                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11544                 *) echo "Seems like we can use $o_nonblock.";;
11545                 esac
11546         else
11547                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11548         fi
11549         ;;
11550 *) echo "Using $hint value $o_nonblock.";;
11551 esac
11552 $rm -f try try.* .out core
11553
11554 echo " "
11555 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11556 case "$eagain" in
11557 '')
11558         $cat head.c > try.c
11559         $cat >>try.c <<EOCP
11560 #include <errno.h>
11561 #include <sys/types.h>
11562 #include <signal.h>
11563 #include <stdio.h> 
11564 #include <stdlib.h> 
11565 #$i_fcntl I_FCNTL
11566 #ifdef I_FCNTL
11567 #include <fcntl.h>
11568 #endif
11569 #define MY_O_NONBLOCK $o_nonblock
11570 #ifndef errno  /* XXX need better Configure test */
11571 extern int errno;
11572 #endif
11573 #$i_unistd I_UNISTD
11574 #ifdef I_UNISTD
11575 #include <unistd.h>
11576 #endif
11577 #$i_string I_STRING
11578 #ifdef I_STRING
11579 #include <string.h>
11580 #else
11581 #include <strings.h>
11582 #endif
11583 $signal_t blech(x) int x; { exit(3); }
11584 EOCP
11585         $cat >> try.c <<'EOCP'
11586 int main()
11587 {
11588         int pd[2];
11589         int pu[2];
11590         char buf[1];
11591         char string[100];
11592
11593         pipe(pd);       /* Down: child -> parent */
11594         pipe(pu);       /* Up: parent -> child */
11595         if (0 != fork()) {
11596                 int ret;
11597                 close(pd[1]);   /* Parent reads from pd[0] */
11598                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11599 #ifdef F_SETFL
11600                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11601                         exit(1);
11602 #else
11603                 exit(4);
11604 #endif
11605                 signal(SIGALRM, blech);
11606                 alarm(5);
11607                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11608                         exit(2);
11609                 sprintf(string, "%d\n", ret);
11610                 write(2, string, strlen(string));
11611                 alarm(0);
11612 #ifdef EAGAIN
11613                 if (errno == EAGAIN) {
11614                         printf("EAGAIN\n");
11615                         goto ok;
11616                 }
11617 #endif
11618 #ifdef EWOULDBLOCK
11619                 if (errno == EWOULDBLOCK)
11620                         printf("EWOULDBLOCK\n");
11621 #endif
11622         ok:
11623                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11624                 sleep(2);                               /* Give it time to close our pipe */
11625                 alarm(5);
11626                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11627                 alarm(0);
11628                 sprintf(string, "%d\n", ret);
11629                 write(4, string, strlen(string));
11630                 exit(0);
11631         }
11632
11633         close(pd[0]);                   /* We write to pd[1] */
11634         close(pu[1]);                   /* We read from pu[0] */
11635         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11636         close(pd[1]);                   /* Pipe pd is now fully closed! */
11637         exit(0);                                /* Bye bye, thank you for playing! */
11638 }
11639 EOCP
11640         set try
11641         if eval $compile_ok; then
11642                 echo "$startsh" >mtry
11643                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11644                 chmod +x mtry
11645                 ./mtry >/dev/null 2>&1
11646                 case $? in
11647                 0) eagain=`$cat try.out`;;
11648                 1) echo "Could not perform non-blocking setting!";;
11649                 2) echo "I did a successful read() for something that was not there!";;
11650                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11651                 4) echo "Could not find F_SETFL!";;
11652                 *) echo "Something terribly wrong happened during testing.";;
11653                 esac
11654                 rd_nodata=`$cat try.ret`
11655                 echo "A read() system call with no data present returns $rd_nodata."
11656                 case "$rd_nodata" in
11657                 0|-1) ;;
11658                 *)
11659                         echo "(That's peculiar, fixing that to be -1.)"
11660                         rd_nodata=-1
11661                         ;;
11662                 esac
11663                 case "$eagain" in
11664                 '')
11665                         echo "Forcing errno EAGAIN on read() with no data available."
11666                         eagain=EAGAIN
11667                         ;;
11668                 *)
11669                         echo "Your read() sets errno to $eagain when no data is available."
11670                         ;;
11671                 esac
11672                 status=`$cat try.err`
11673                 case "$status" in
11674                 0) echo "And it correctly returns 0 to signal EOF.";;
11675                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11676                 *) echo "However, your read() returns '$status' on EOF??";;
11677                 esac
11678                 val="$define"
11679                 if test "$status" = "$rd_nodata"; then
11680                         echo "WARNING: you can't distinguish between EOF and no data!"
11681                         val="$undef"
11682                 fi
11683         else
11684                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11685                 eagain=EAGAIN
11686         fi
11687         set d_eofnblk
11688         eval $setvar
11689         ;;
11690 *)
11691         echo "Using $hint value $eagain."
11692         echo "Your read() returns $rd_nodata when no data is present."
11693         case "$d_eofnblk" in
11694         "$define") echo "And you can see EOF because read() returns 0.";;
11695         "$undef") echo "But you can't see EOF status from read() returned value.";;
11696         *)
11697                 echo "(Assuming you can't see EOF status from read anyway.)"
11698                 d_eofnblk=$undef
11699                 ;;
11700         esac
11701         ;;
11702 esac
11703 $rm -f try try.* .out core head.c mtry
11704
11705 : see if fchdir exists
11706 set fchdir d_fchdir
11707 eval $inlibc
11708
11709 : see if fchmod exists
11710 set fchmod d_fchmod
11711 eval $inlibc
11712
11713 : see if fchown exists
11714 set fchown d_fchown
11715 eval $inlibc
11716
11717 : see if this is an fcntl system
11718 set fcntl d_fcntl
11719 eval $inlibc
11720
11721 echo " "
11722 : See if fcntl-based locking works.
11723 $cat >try.c <<EOCP
11724 #include <stdlib.h>
11725 #include <unistd.h>
11726 #include <fcntl.h>
11727 #include <signal.h>
11728 $signal_t blech(x) int x; { exit(3); }
11729 int main() {
11730 #if defined(F_SETLK) && defined(F_SETLKW)
11731      struct flock flock;
11732      int retval, fd;
11733      fd = open("try.c", O_RDONLY);
11734      flock.l_type = F_RDLCK;
11735      flock.l_whence = SEEK_SET;
11736      flock.l_start = flock.l_len = 0;
11737      signal(SIGALRM, blech);
11738      alarm(10);
11739      retval = fcntl(fd, F_SETLK, &flock);
11740      close(fd);
11741      (retval < 0 ? exit(2) : exit(0));
11742 #else
11743      exit(2);
11744 #endif
11745 }
11746 EOCP
11747 echo "Checking if fcntl-based file locking works... "
11748 case "$d_fcntl" in
11749 "$define")
11750         set try
11751         if eval $compile_ok; then
11752                 if $run ./try; then
11753                         echo "Yes, it seems to work."
11754                         val="$define"
11755                 else
11756                         echo "Nope, it didn't work."
11757                         val="$undef"
11758                         case "$?" in
11759                         3) $cat >&4 <<EOM
11760 ***
11761 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
11762 *** This is (almost) impossible.
11763 *** If your NFS lock daemons are not feeling well, something like
11764 *** this may happen, please investigate.  Cannot continue, aborting.
11765 ***
11766 EOM
11767                                 exit 1
11768                                 ;;
11769                         esac
11770                 fi
11771         else
11772                 echo "I'm unable to compile the test program, so I'll assume not."
11773                 val="$undef"
11774         fi
11775         ;;
11776 *) val="$undef";
11777         echo "Nope, since you don't even have fcntl()."
11778         ;;
11779 esac
11780 set d_fcntl_can_lock
11781 eval $setvar
11782 $rm -f try*
11783
11784
11785 : check for fd_set items
11786 $cat <<EOM
11787
11788 Checking to see how well your C compiler handles fd_set and friends ...
11789 EOM
11790 $cat >try.c <<EOCP
11791 #$i_systime I_SYS_TIME
11792 #$i_sysselct I_SYS_SELECT
11793 #$d_socket HAS_SOCKET
11794 #include <sys/types.h>
11795 #ifdef HAS_SOCKET
11796 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
11797 #endif
11798 #ifdef I_SYS_TIME
11799 #include <sys/time.h>
11800 #endif
11801 #ifdef I_SYS_SELECT
11802 #include <sys/select.h>
11803 #endif
11804 int main() {
11805         fd_set fds;
11806
11807 #ifdef TRYBITS
11808         if(fds.fds_bits);
11809 #endif
11810
11811 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
11812         exit(0);
11813 #else
11814         exit(1);
11815 #endif
11816 }
11817 EOCP
11818 set try -DTRYBITS
11819 if eval $compile; then
11820         d_fds_bits="$define"
11821         d_fd_set="$define"
11822         echo "Well, your system knows about the normal fd_set typedef..." >&4
11823         if $run ./try; then
11824                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
11825                 d_fd_macros="$define"
11826         else
11827                 $cat >&4 <<'EOM'
11828 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
11829 EOM
11830                 d_fd_macros="$undef"
11831         fi
11832 else
11833         $cat <<'EOM'
11834 Hmm, your compiler has some difficulty with fd_set.  Checking further...
11835 EOM
11836         set try
11837         if eval $compile; then
11838                 d_fds_bits="$undef"
11839                 d_fd_set="$define"
11840                 echo "Well, your system has some sort of fd_set available..." >&4
11841                 if $run ./try; then
11842                         echo "and you have the normal fd_set macros." >&4
11843                         d_fd_macros="$define"
11844                 else
11845                         $cat <<'EOM'
11846 but not the normal fd_set macros!  Gross!  More work for me...
11847 EOM
11848                         d_fd_macros="$undef"
11849                 fi
11850         else
11851         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
11852                 d_fd_set="$undef"
11853                 d_fds_bits="$undef"
11854                 d_fd_macros="$undef"
11855         fi
11856 fi
11857 $rm -f try try.*
11858
11859 : see if fgetpos exists
11860 set fgetpos d_fgetpos
11861 eval $inlibc
11862
11863 : see if finite exists
11864 set finite d_finite
11865 eval $inlibc
11866
11867 : see if finitel exists
11868 set finitel d_finitel
11869 eval $inlibc
11870
11871 : see if flock exists
11872 set flock d_flock
11873 eval $inlibc
11874
11875 : see if prototype for flock is available
11876 echo " "
11877 set d_flockproto flock $i_sysfile sys/file.h
11878 eval $hasproto
11879
11880 : see if fork exists
11881 set fork d_fork
11882 eval $inlibc
11883
11884 : see if fp_class exists
11885 set fp_class d_fp_class
11886 eval $inlibc
11887
11888 : see if pathconf exists
11889 set pathconf d_pathconf
11890 eval $inlibc
11891
11892 : see if fpathconf exists
11893 set fpathconf d_fpathconf
11894 eval $inlibc
11895
11896 : see if fpclass exists
11897 set fpclass d_fpclass
11898 eval $inlibc
11899
11900 : see if fpclassify exists
11901 set fpclassify d_fpclassify
11902 eval $inlibc
11903
11904 : see if fpclassl exists
11905 set fpclassl d_fpclassl
11906 eval $inlibc
11907
11908
11909 : check for fpos64_t
11910 echo " "
11911 echo "Checking to see if you have fpos64_t..." >&4
11912 $cat >try.c <<EOCP
11913 #include <stdio.h>
11914 int main() { fpos64_t x = 7; }
11915 EOCP
11916 set try
11917 if eval $compile; then
11918         val="$define"
11919         echo "You have fpos64_t."
11920 else
11921         val="$undef"
11922         echo "You do not have fpos64_t."
11923         case "$fpossize" in
11924         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
11925         esac
11926 fi
11927 $rm -f try.* try
11928 set d_fpos64_t
11929 eval $setvar
11930
11931 : see if frexpl exists
11932 set frexpl d_frexpl
11933 eval $inlibc
11934
11935 : see if this is a sys/param system
11936 set sys/param.h i_sysparam
11937 eval $inhdr
11938
11939 : see if this is a sys/mount.h system
11940 set sys/mount.h i_sysmount
11941 eval $inhdr
11942
11943
11944 echo " "
11945 echo "Checking to see if your system supports struct fs_data..." >&4
11946 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
11947 eval $hasstruct
11948 case "$d_fs_data_s" in
11949 "$define")      echo "Yes, it does."   ;;
11950 *)              echo "No, it doesn't." ;;
11951 esac
11952
11953 : see if fseeko exists
11954 set fseeko d_fseeko
11955 eval $inlibc
11956 case "$longsize" in
11957 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
11958 esac
11959
11960 : see if fsetpos exists
11961 set fsetpos d_fsetpos
11962 eval $inlibc
11963
11964
11965 : see if fstatfs exists
11966 set fstatfs d_fstatfs
11967 eval $inlibc
11968
11969
11970 : see if statvfs exists
11971 set statvfs d_statvfs
11972 eval $inlibc
11973
11974 : see if fstatvfs exists
11975 set fstatvfs d_fstatvfs
11976 eval $inlibc
11977
11978
11979 : see if fsync exists
11980 set fsync d_fsync
11981 eval $inlibc
11982
11983 : see if ftello exists
11984 set ftello d_ftello
11985 eval $inlibc
11986 case "$longsize" in
11987 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
11988 esac
11989
11990 : see if getcwd exists
11991 set getcwd d_getcwd
11992 eval $inlibc
11993
11994 : see if getespwnam exists
11995 set getespwnam d_getespwnam
11996 eval $inlibc
11997
11998
11999 : see if getfsstat exists
12000 set getfsstat d_getfsstat
12001 eval $inlibc
12002
12003 : see if getgrent exists
12004 set getgrent d_getgrent
12005 eval $inlibc
12006
12007 : see if getgrent_r exists
12008 set getgrent_r d_getgrent_r
12009 eval $inlibc
12010 case "$d_getgrent_r" in
12011 "$define")
12012         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12013         case "$d_getgrent_r_proto:$usethreads" in
12014         ":define")      d_getgrent_r_proto=define
12015                 set d_getgrent_r_proto getgrent_r $hdrs
12016                 eval $hasproto ;;
12017         *)      ;;
12018         esac
12019         case "$d_getgrent_r_proto" in
12020         define)
12021         case "$getgrent_r_proto" in
12022         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12023         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12024         esac
12025         case "$getgrent_r_proto" in
12026         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12027         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12028         esac
12029         case "$getgrent_r_proto" in
12030         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12031         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12032         esac
12033         case "$getgrent_r_proto" in
12034         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12035         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12036         esac
12037         case "$getgrent_r_proto" in
12038         ''|0) try='int getgrent_r(struct group*, char*, int);'
12039         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12040         esac
12041         case "$getgrent_r_proto" in
12042         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12043         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12044         esac
12045         case "$getgrent_r_proto" in
12046         ''|0)   d_getgrent_r=undef
12047                 getgrent_r_proto=0
12048                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12049         * )     case "$getgrent_r_proto" in
12050                 REENTRANT_PROTO*) ;;
12051                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12052                 esac
12053                 echo "Prototype: $try" ;;
12054         esac
12055         ;;
12056         *)      case "$usethreads" in
12057                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12058                 esac
12059                 d_getgrent_r=undef
12060                 getgrent_r_proto=0
12061                 ;;
12062         esac
12063         ;;
12064 *)      getgrent_r_proto=0
12065         ;;
12066 esac
12067
12068 : see if getgrgid_r exists
12069 set getgrgid_r d_getgrgid_r
12070 eval $inlibc
12071 case "$d_getgrgid_r" in
12072 "$define")
12073         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12074         case "$d_getgrgid_r_proto:$usethreads" in
12075         ":define")      d_getgrgid_r_proto=define
12076                 set d_getgrgid_r_proto getgrgid_r $hdrs
12077                 eval $hasproto ;;
12078         *)      ;;
12079         esac
12080         case "$d_getgrgid_r_proto" in
12081         define)
12082         case "$getgrgid_r_proto" in
12083         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12084         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12085         esac
12086         case "$getgrgid_r_proto" in
12087         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12088         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12089         esac
12090         case "$getgrgid_r_proto" in
12091         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12092         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12093         esac
12094         case "$getgrgid_r_proto" in
12095         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12096         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12097         esac
12098         case "$getgrgid_r_proto" in
12099         ''|0)   d_getgrgid_r=undef
12100                 getgrgid_r_proto=0
12101                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12102         * )     case "$getgrgid_r_proto" in
12103                 REENTRANT_PROTO*) ;;
12104                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12105                 esac
12106                 echo "Prototype: $try" ;;
12107         esac
12108         ;;
12109         *)      case "$usethreads" in
12110                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12111                 esac
12112                 d_getgrgid_r=undef
12113                 getgrgid_r_proto=0
12114                 ;;
12115         esac
12116         ;;
12117 *)      getgrgid_r_proto=0
12118         ;;
12119 esac
12120
12121 : see if getgrnam_r exists
12122 set getgrnam_r d_getgrnam_r
12123 eval $inlibc
12124 case "$d_getgrnam_r" in
12125 "$define")
12126         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12127         case "$d_getgrnam_r_proto:$usethreads" in
12128         ":define")      d_getgrnam_r_proto=define
12129                 set d_getgrnam_r_proto getgrnam_r $hdrs
12130                 eval $hasproto ;;
12131         *)      ;;
12132         esac
12133         case "$d_getgrnam_r_proto" in
12134         define)
12135         case "$getgrnam_r_proto" in
12136         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12137         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12138         esac
12139         case "$getgrnam_r_proto" in
12140         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12141         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12142         esac
12143         case "$getgrnam_r_proto" in
12144         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12145         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12146         esac
12147         case "$getgrnam_r_proto" in
12148         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12149         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12150         esac
12151         case "$getgrnam_r_proto" in
12152         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12153         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12154         esac
12155         case "$getgrnam_r_proto" in
12156         ''|0)   d_getgrnam_r=undef
12157                 getgrnam_r_proto=0
12158                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12159         * )     case "$getgrnam_r_proto" in
12160                 REENTRANT_PROTO*) ;;
12161                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12162                 esac
12163                 echo "Prototype: $try" ;;
12164         esac
12165         ;;
12166         *)      case "$usethreads" in
12167                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12168                 esac
12169                 d_getgrnam_r=undef
12170                 getgrnam_r_proto=0
12171                 ;;
12172         esac
12173         ;;
12174 *)      getgrnam_r_proto=0
12175         ;;
12176 esac
12177
12178 : see if gethostbyaddr exists
12179 set gethostbyaddr d_gethbyaddr
12180 eval $inlibc
12181
12182 : see if gethostbyname exists
12183 set gethostbyname d_gethbyname
12184 eval $inlibc
12185
12186 : see if gethostent exists
12187 set gethostent d_gethent
12188 eval $inlibc
12189
12190 : see how we will look up host name
12191 echo " "
12192 call=''
12193 if set gethostname val -f d_gethname; eval $csym; $val; then
12194         echo 'gethostname() found.' >&4
12195         d_gethname="$define"
12196         call=gethostname
12197 fi
12198 if set uname val -f d_uname; eval $csym; $val; then
12199         if ./xenix; then
12200                 $cat <<'EOM'
12201 uname() was found, but you're running xenix, and older versions of xenix
12202 have a broken uname(). If you don't really know whether your xenix is old
12203 enough to have a broken system call, use the default answer.
12204
12205 EOM
12206                 dflt=y
12207                 case "$d_uname" in
12208                 "$define") dflt=n;;
12209                 esac
12210                 rp='Is your uname() broken?'
12211                 . ./myread
12212                 case "$ans" in
12213                 n*) d_uname="$define"; call=uname;;
12214                 esac
12215         else
12216                 echo 'uname() found.' >&4
12217                 d_uname="$define"
12218                 case "$call" in
12219                 '') call=uname ;;
12220                 esac
12221         fi
12222 fi
12223 case "$d_gethname" in
12224 '') d_gethname="$undef";;
12225 esac
12226 case "$d_uname" in
12227 '') d_uname="$undef";;
12228 esac
12229 case "$d_uname$d_gethname" in
12230 *define*)
12231         dflt=n
12232         cat <<EOM
12233  
12234 Every now and then someone has a $call() that lies about the hostname
12235 but can't be fixed for political or economic reasons.  If you wish, I can
12236 pretend $call() isn't there and maybe compute hostname at run-time
12237 thanks to the '$phostname' command.
12238
12239 EOM
12240         rp="Shall I ignore $call() from now on?"
12241         . ./myread
12242         case "$ans" in
12243         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12244         esac;;
12245 esac
12246 case "$phostname" in
12247 '') aphostname='';;
12248 *) case "$aphostname" in
12249         /*) ;;
12250         *) set X $phostname
12251                 shift
12252                 file=$1
12253                 shift
12254                 file=`./loc $file $file $pth`
12255                 aphostname=`echo $file $*`
12256                 ;;
12257         esac
12258         ;;
12259 esac
12260 case "$d_uname$d_gethname" in
12261 *define*) ;;
12262 *)
12263         case "$phostname" in
12264         '')
12265                 echo "There will be no way for $package to get your hostname." >&4;;
12266         *)
12267         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12268                 ;;
12269         esac;;
12270 esac
12271 case "$d_phostname" in
12272 '') d_phostname="$undef";;
12273 esac
12274
12275 : see if gethostbyaddr_r exists
12276 set gethostbyaddr_r d_gethostbyaddr_r
12277 eval $inlibc
12278 case "$d_gethostbyaddr_r" in
12279 "$define")
12280         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12281         case "$d_gethostbyaddr_r_proto:$usethreads" in
12282         ":define")      d_gethostbyaddr_r_proto=define
12283                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12284                 eval $hasproto ;;
12285         *)      ;;
12286         esac
12287         case "$d_gethostbyaddr_r_proto" in
12288         define)
12289         case "$gethostbyaddr_r_proto" in
12290         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12291         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12292         esac
12293         case "$gethostbyaddr_r_proto" in
12294         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12295         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12296         esac
12297         case "$gethostbyaddr_r_proto" in
12298         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12299         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12300         esac
12301         case "$gethostbyaddr_r_proto" in
12302         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12303         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12304         esac
12305         case "$gethostbyaddr_r_proto" in
12306         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12307         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12308         esac
12309         case "$gethostbyaddr_r_proto" in
12310         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12311         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12312         esac
12313         case "$gethostbyaddr_r_proto" in
12314         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12315         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12316         esac
12317         case "$gethostbyaddr_r_proto" in
12318         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12319         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12320         esac
12321         case "$gethostbyaddr_r_proto" in
12322         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12323         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12324         esac
12325         case "$gethostbyaddr_r_proto" in
12326         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12327         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12328         esac
12329         case "$gethostbyaddr_r_proto" in
12330         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12331         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12332         esac
12333         case "$gethostbyaddr_r_proto" in
12334         ''|0)   d_gethostbyaddr_r=undef
12335                 gethostbyaddr_r_proto=0
12336                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12337         * )     case "$gethostbyaddr_r_proto" in
12338                 REENTRANT_PROTO*) ;;
12339                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12340                 esac
12341                 echo "Prototype: $try" ;;
12342         esac
12343         ;;
12344         *)      case "$usethreads" in
12345                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12346                 esac
12347                 d_gethostbyaddr_r=undef
12348                 gethostbyaddr_r_proto=0
12349                 ;;
12350         esac
12351         ;;
12352 *)      gethostbyaddr_r_proto=0
12353         ;;
12354 esac
12355
12356 : see if gethostbyname_r exists
12357 set gethostbyname_r d_gethostbyname_r
12358 eval $inlibc
12359 case "$d_gethostbyname_r" in
12360 "$define")
12361         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12362         case "$d_gethostbyname_r_proto:$usethreads" in
12363         ":define")      d_gethostbyname_r_proto=define
12364                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12365                 eval $hasproto ;;
12366         *)      ;;
12367         esac
12368         case "$d_gethostbyname_r_proto" in
12369         define)
12370         case "$gethostbyname_r_proto" in
12371         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12372         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12373         esac
12374         case "$gethostbyname_r_proto" in
12375         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12376         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12377         esac
12378         case "$gethostbyname_r_proto" in
12379         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12380         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12381         esac
12382         case "$gethostbyname_r_proto" in
12383         ''|0)   d_gethostbyname_r=undef
12384                 gethostbyname_r_proto=0
12385                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12386         * )     case "$gethostbyname_r_proto" in
12387                 REENTRANT_PROTO*) ;;
12388                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12389                 esac
12390                 echo "Prototype: $try" ;;
12391         esac
12392         ;;
12393         *)      case "$usethreads" in
12394                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12395                 esac
12396                 d_gethostbyname_r=undef
12397                 gethostbyname_r_proto=0
12398                 ;;
12399         esac
12400         ;;
12401 *)      gethostbyname_r_proto=0
12402         ;;
12403 esac
12404
12405 : see if gethostent_r exists
12406 set gethostent_r d_gethostent_r
12407 eval $inlibc
12408 case "$d_gethostent_r" in
12409 "$define")
12410         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12411         case "$d_gethostent_r_proto:$usethreads" in
12412         ":define")      d_gethostent_r_proto=define
12413                 set d_gethostent_r_proto gethostent_r $hdrs
12414                 eval $hasproto ;;
12415         *)      ;;
12416         esac
12417         case "$d_gethostent_r_proto" in
12418         define)
12419         case "$gethostent_r_proto" in
12420         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
12421         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
12422         esac
12423         case "$gethostent_r_proto" in
12424         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
12425         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
12426         esac
12427         case "$gethostent_r_proto" in
12428         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
12429         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
12430         esac
12431         case "$gethostent_r_proto" in
12432         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
12433         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
12434         esac
12435         case "$gethostent_r_proto" in
12436         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
12437         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
12438         esac
12439         case "$gethostent_r_proto" in
12440         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
12441         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
12442         esac
12443         case "$gethostent_r_proto" in
12444         ''|0)   d_gethostent_r=undef
12445                 gethostent_r_proto=0
12446                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
12447         * )     case "$gethostent_r_proto" in
12448                 REENTRANT_PROTO*) ;;
12449                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
12450                 esac
12451                 echo "Prototype: $try" ;;
12452         esac
12453         ;;
12454         *)      case "$usethreads" in
12455                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
12456                 esac
12457                 d_gethostent_r=undef
12458                 gethostent_r_proto=0
12459                 ;;
12460         esac
12461         ;;
12462 *)      gethostent_r_proto=0
12463         ;;
12464 esac
12465
12466 : see if prototypes for various gethostxxx netdb.h functions are available
12467 echo " "
12468 set d_gethostprotos gethostent $i_netdb netdb.h
12469 eval $hasproto
12470
12471 : see if getitimer exists
12472 set getitimer d_getitimer
12473 eval $inlibc
12474
12475 : see if getlogin exists
12476 set getlogin d_getlogin
12477 eval $inlibc
12478
12479 : see if getlogin_r exists
12480 set getlogin_r d_getlogin_r
12481 eval $inlibc
12482 case "$d_getlogin_r" in
12483 "$define")
12484         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
12485         case "$d_getlogin_r_proto:$usethreads" in
12486         ":define")      d_getlogin_r_proto=define
12487                 set d_getlogin_r_proto getlogin_r $hdrs
12488                 eval $hasproto ;;
12489         *)      ;;
12490         esac
12491         case "$d_getlogin_r_proto" in
12492         define)
12493         case "$getlogin_r_proto" in
12494         ''|0) try='int getlogin_r(char*, size_t);'
12495         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
12496         esac
12497         case "$getlogin_r_proto" in
12498         ''|0) try='int getlogin_r(char*, int);'
12499         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
12500         esac
12501         case "$getlogin_r_proto" in
12502         ''|0) try='char* getlogin_r(char*, size_t);'
12503         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
12504         esac
12505         case "$getlogin_r_proto" in
12506         ''|0) try='char* getlogin_r(char*, int);'
12507         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
12508         esac
12509         case "$getlogin_r_proto" in
12510         ''|0)   d_getlogin_r=undef
12511                 getlogin_r_proto=0
12512                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
12513         * )     case "$getlogin_r_proto" in
12514                 REENTRANT_PROTO*) ;;
12515                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
12516                 esac
12517                 echo "Prototype: $try" ;;
12518         esac
12519         ;;
12520         *)      case "$usethreads" in
12521                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
12522                 esac
12523                 d_getlogin_r=undef
12524                 getlogin_r_proto=0
12525                 ;;
12526         esac
12527         ;;
12528 *)      getlogin_r_proto=0
12529         ;;
12530 esac
12531
12532 : see if getmnt exists
12533 set getmnt d_getmnt
12534 eval $inlibc
12535
12536 : see if getmntent exists
12537 set getmntent d_getmntent
12538 eval $inlibc
12539
12540 : see if getnetbyaddr exists
12541 set getnetbyaddr d_getnbyaddr
12542 eval $inlibc
12543
12544 : see if getnetbyname exists
12545 set getnetbyname d_getnbyname
12546 eval $inlibc
12547
12548 : see if getnetent exists
12549 set getnetent d_getnent
12550 eval $inlibc
12551
12552 : see if getnetbyaddr_r exists
12553 set getnetbyaddr_r d_getnetbyaddr_r
12554 eval $inlibc
12555 case "$d_getnetbyaddr_r" in
12556 "$define")
12557         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12558         case "$d_getnetbyaddr_r_proto:$usethreads" in
12559         ":define")      d_getnetbyaddr_r_proto=define
12560                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
12561                 eval $hasproto ;;
12562         *)      ;;
12563         esac
12564         case "$d_getnetbyaddr_r_proto" in
12565         define)
12566         case "$getnetbyaddr_r_proto" in
12567         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
12568         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
12569         esac
12570         case "$getnetbyaddr_r_proto" in
12571         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
12572         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
12573         esac
12574         case "$getnetbyaddr_r_proto" in
12575         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
12576         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
12577         esac
12578         case "$getnetbyaddr_r_proto" in
12579         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
12580         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
12581         esac
12582         case "$getnetbyaddr_r_proto" in
12583         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
12584         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
12585         esac
12586         case "$getnetbyaddr_r_proto" in
12587         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
12588         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
12589         esac
12590         case "$getnetbyaddr_r_proto" in
12591         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
12592         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
12593         esac
12594         case "$getnetbyaddr_r_proto" in
12595         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
12596         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
12597         esac
12598         case "$getnetbyaddr_r_proto" in
12599         ''|0)   d_getnetbyaddr_r=undef
12600                 getnetbyaddr_r_proto=0
12601                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
12602         * )     case "$getnetbyaddr_r_proto" in
12603                 REENTRANT_PROTO*) ;;
12604                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
12605                 esac
12606                 echo "Prototype: $try" ;;
12607         esac
12608         ;;
12609         *)      case "$usethreads" in
12610                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
12611                 esac
12612                 d_getnetbyaddr_r=undef
12613                 getnetbyaddr_r_proto=0
12614                 ;;
12615         esac
12616         ;;
12617 *)      getnetbyaddr_r_proto=0
12618         ;;
12619 esac
12620
12621 : see if getnetbyname_r exists
12622 set getnetbyname_r d_getnetbyname_r
12623 eval $inlibc
12624 case "$d_getnetbyname_r" in
12625 "$define")
12626         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12627         case "$d_getnetbyname_r_proto:$usethreads" in
12628         ":define")      d_getnetbyname_r_proto=define
12629                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
12630                 eval $hasproto ;;
12631         *)      ;;
12632         esac
12633         case "$d_getnetbyname_r_proto" in
12634         define)
12635         case "$getnetbyname_r_proto" in
12636         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
12637         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
12638         esac
12639         case "$getnetbyname_r_proto" in
12640         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
12641         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
12642         esac
12643         case "$getnetbyname_r_proto" in
12644         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
12645         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
12646         esac
12647         case "$getnetbyname_r_proto" in
12648         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
12649         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
12650         esac
12651         case "$getnetbyname_r_proto" in
12652         ''|0)   d_getnetbyname_r=undef
12653                 getnetbyname_r_proto=0
12654                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
12655         * )     case "$getnetbyname_r_proto" in
12656                 REENTRANT_PROTO*) ;;
12657                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
12658                 esac
12659                 echo "Prototype: $try" ;;
12660         esac
12661         ;;
12662         *)      case "$usethreads" in
12663                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
12664                 esac
12665                 d_getnetbyname_r=undef
12666                 getnetbyname_r_proto=0
12667                 ;;
12668         esac
12669         ;;
12670 *)      getnetbyname_r_proto=0
12671         ;;
12672 esac
12673
12674 : see if getnetent_r exists
12675 set getnetent_r d_getnetent_r
12676 eval $inlibc
12677 case "$d_getnetent_r" in
12678 "$define")
12679         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12680         case "$d_getnetent_r_proto:$usethreads" in
12681         ":define")      d_getnetent_r_proto=define
12682                 set d_getnetent_r_proto getnetent_r $hdrs
12683                 eval $hasproto ;;
12684         *)      ;;
12685         esac
12686         case "$d_getnetent_r_proto" in
12687         define)
12688         case "$getnetent_r_proto" in
12689         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
12690         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
12691         esac
12692         case "$getnetent_r_proto" in
12693         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
12694         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
12695         esac
12696         case "$getnetent_r_proto" in
12697         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
12698         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
12699         esac
12700         case "$getnetent_r_proto" in
12701         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
12702         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
12703         esac
12704         case "$getnetent_r_proto" in
12705         ''|0) try='int getnetent_r(struct netent*, char*, int);'
12706         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
12707         esac
12708         case "$getnetent_r_proto" in
12709         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
12710         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
12711         esac
12712         case "$getnetent_r_proto" in
12713         ''|0)   d_getnetent_r=undef
12714                 getnetent_r_proto=0
12715                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
12716         * )     case "$getnetent_r_proto" in
12717                 REENTRANT_PROTO*) ;;
12718                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
12719                 esac
12720                 echo "Prototype: $try" ;;
12721         esac
12722         ;;
12723         *)      case "$usethreads" in
12724                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
12725                 esac
12726                 d_getnetent_r=undef
12727                 getnetent_r_proto=0
12728                 ;;
12729         esac
12730         ;;
12731 *)      getnetent_r_proto=0
12732         ;;
12733 esac
12734
12735 : see if prototypes for various getnetxxx netdb.h functions are available
12736 echo " "
12737 set d_getnetprotos getnetent $i_netdb netdb.h
12738 eval $hasproto
12739
12740 : see if getpagesize exists
12741 set getpagesize d_getpagsz
12742 eval $inlibc
12743
12744
12745 : see if getprotobyname exists
12746 set getprotobyname d_getpbyname
12747 eval $inlibc
12748
12749 : see if getprotobynumber exists
12750 set getprotobynumber d_getpbynumber
12751 eval $inlibc
12752
12753 : see if getprotoent exists
12754 set getprotoent d_getpent
12755 eval $inlibc
12756
12757 : see if getpgid exists
12758 set getpgid d_getpgid
12759 eval $inlibc
12760
12761 : see if getpgrp2 exists
12762 set getpgrp2 d_getpgrp2
12763 eval $inlibc
12764
12765 : see if getppid exists
12766 set getppid d_getppid
12767 eval $inlibc
12768
12769 : see if getpriority exists
12770 set getpriority d_getprior
12771 eval $inlibc
12772
12773 : see if getprotobyname_r exists
12774 set getprotobyname_r d_getprotobyname_r
12775 eval $inlibc
12776 case "$d_getprotobyname_r" in
12777 "$define")
12778         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12779         case "$d_getprotobyname_r_proto:$usethreads" in
12780         ":define")      d_getprotobyname_r_proto=define
12781                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
12782                 eval $hasproto ;;
12783         *)      ;;
12784         esac
12785         case "$d_getprotobyname_r_proto" in
12786         define)
12787         case "$getprotobyname_r_proto" in
12788         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
12789         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
12790         esac
12791         case "$getprotobyname_r_proto" in
12792         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
12793         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
12794         esac
12795         case "$getprotobyname_r_proto" in
12796         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
12797         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
12798         esac
12799         case "$getprotobyname_r_proto" in
12800         ''|0)   d_getprotobyname_r=undef
12801                 getprotobyname_r_proto=0
12802                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
12803         * )     case "$getprotobyname_r_proto" in
12804                 REENTRANT_PROTO*) ;;
12805                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
12806                 esac
12807                 echo "Prototype: $try" ;;
12808         esac
12809         ;;
12810         *)      case "$usethreads" in
12811                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
12812                 esac
12813                 d_getprotobyname_r=undef
12814                 getprotobyname_r_proto=0
12815                 ;;
12816         esac
12817         ;;
12818 *)      getprotobyname_r_proto=0
12819         ;;
12820 esac
12821
12822 : see if getprotobynumber_r exists
12823 set getprotobynumber_r d_getprotobynumber_r
12824 eval $inlibc
12825 case "$d_getprotobynumber_r" in
12826 "$define")
12827         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12828         case "$d_getprotobynumber_r_proto:$usethreads" in
12829         ":define")      d_getprotobynumber_r_proto=define
12830                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
12831                 eval $hasproto ;;
12832         *)      ;;
12833         esac
12834         case "$d_getprotobynumber_r_proto" in
12835         define)
12836         case "$getprotobynumber_r_proto" in
12837         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
12838         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
12839         esac
12840         case "$getprotobynumber_r_proto" in
12841         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
12842         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
12843         esac
12844         case "$getprotobynumber_r_proto" in
12845         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
12846         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
12847         esac
12848         case "$getprotobynumber_r_proto" in
12849         ''|0)   d_getprotobynumber_r=undef
12850                 getprotobynumber_r_proto=0
12851                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
12852         * )     case "$getprotobynumber_r_proto" in
12853                 REENTRANT_PROTO*) ;;
12854                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
12855                 esac
12856                 echo "Prototype: $try" ;;
12857         esac
12858         ;;
12859         *)      case "$usethreads" in
12860                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
12861                 esac
12862                 d_getprotobynumber_r=undef
12863                 getprotobynumber_r_proto=0
12864                 ;;
12865         esac
12866         ;;
12867 *)      getprotobynumber_r_proto=0
12868         ;;
12869 esac
12870
12871 : see if getprotoent_r exists
12872 set getprotoent_r d_getprotoent_r
12873 eval $inlibc
12874 case "$d_getprotoent_r" in
12875 "$define")
12876         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12877         case "$d_getprotoent_r_proto:$usethreads" in
12878         ":define")      d_getprotoent_r_proto=define
12879                 set d_getprotoent_r_proto getprotoent_r $hdrs
12880                 eval $hasproto ;;
12881         *)      ;;
12882         esac
12883         case "$d_getprotoent_r_proto" in
12884         define)
12885         case "$getprotoent_r_proto" in
12886         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
12887         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
12888         esac
12889         case "$getprotoent_r_proto" in
12890         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
12891         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
12892         esac
12893         case "$getprotoent_r_proto" in
12894         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
12895         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
12896         esac
12897         case "$getprotoent_r_proto" in
12898         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
12899         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
12900         esac
12901         case "$getprotoent_r_proto" in
12902         ''|0)   d_getprotoent_r=undef
12903                 getprotoent_r_proto=0
12904                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
12905         * )     case "$getprotoent_r_proto" in
12906                 REENTRANT_PROTO*) ;;
12907                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
12908                 esac
12909                 echo "Prototype: $try" ;;
12910         esac
12911         ;;
12912         *)      case "$usethreads" in
12913                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
12914                 esac
12915                 d_getprotoent_r=undef
12916                 getprotoent_r_proto=0
12917                 ;;
12918         esac
12919         ;;
12920 *)      getprotoent_r_proto=0
12921         ;;
12922 esac
12923
12924 : see if prototypes for various getprotoxxx netdb.h functions are available
12925 echo " "
12926 set d_getprotoprotos getprotoent $i_netdb netdb.h
12927 eval $hasproto
12928
12929 : see if getprpwnam exists
12930 set getprpwnam d_getprpwnam
12931 eval $inlibc
12932
12933 : see if getpwent exists
12934 set getpwent d_getpwent
12935 eval $inlibc
12936
12937 : see if getpwent_r exists
12938 set getpwent_r d_getpwent_r
12939 eval $inlibc
12940 case "$d_getpwent_r" in
12941 "$define")
12942         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
12943         case "$d_getpwent_r_proto:$usethreads" in
12944         ":define")      d_getpwent_r_proto=define
12945                 set d_getpwent_r_proto getpwent_r $hdrs
12946                 eval $hasproto ;;
12947         *)      ;;
12948         esac
12949         case "$d_getpwent_r_proto" in
12950         define)
12951         case "$getpwent_r_proto" in
12952         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
12953         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
12954         esac
12955         case "$getpwent_r_proto" in
12956         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
12957         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
12958         esac
12959         case "$getpwent_r_proto" in
12960         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
12961         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
12962         esac
12963         case "$getpwent_r_proto" in
12964         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
12965         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
12966         esac
12967         case "$getpwent_r_proto" in
12968         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
12969         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
12970         esac
12971         case "$getpwent_r_proto" in
12972         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
12973         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
12974         esac
12975         case "$getpwent_r_proto" in
12976         ''|0)   d_getpwent_r=undef
12977                 getpwent_r_proto=0
12978                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
12979         * )     case "$getpwent_r_proto" in
12980                 REENTRANT_PROTO*) ;;
12981                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
12982                 esac
12983                 echo "Prototype: $try" ;;
12984         esac
12985         ;;
12986         *)      case "$usethreads" in
12987                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
12988                 esac
12989                 d_getpwent_r=undef
12990                 getpwent_r_proto=0
12991                 ;;
12992         esac
12993         ;;
12994 *)      getpwent_r_proto=0
12995         ;;
12996 esac
12997
12998 : see if getpwnam_r exists
12999 set getpwnam_r d_getpwnam_r
13000 eval $inlibc
13001 case "$d_getpwnam_r" in
13002 "$define")
13003         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13004         case "$d_getpwnam_r_proto:$usethreads" in
13005         ":define")      d_getpwnam_r_proto=define
13006                 set d_getpwnam_r_proto getpwnam_r $hdrs
13007                 eval $hasproto ;;
13008         *)      ;;
13009         esac
13010         case "$d_getpwnam_r_proto" in
13011         define)
13012         case "$getpwnam_r_proto" in
13013         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13014         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13015         esac
13016         case "$getpwnam_r_proto" in
13017         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13018         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13019         esac
13020         case "$getpwnam_r_proto" in
13021         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13022         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13023         esac
13024         case "$getpwnam_r_proto" in
13025         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13026         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13027         esac
13028         case "$getpwnam_r_proto" in
13029         ''|0)   d_getpwnam_r=undef
13030                 getpwnam_r_proto=0
13031                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13032         * )     case "$getpwnam_r_proto" in
13033                 REENTRANT_PROTO*) ;;
13034                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13035                 esac
13036                 echo "Prototype: $try" ;;
13037         esac
13038         ;;
13039         *)      case "$usethreads" in
13040                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13041                 esac
13042                 d_getpwnam_r=undef
13043                 getpwnam_r_proto=0
13044                 ;;
13045         esac
13046         ;;
13047 *)      getpwnam_r_proto=0
13048         ;;
13049 esac
13050
13051 : see if getpwuid_r exists
13052 set getpwuid_r d_getpwuid_r
13053 eval $inlibc
13054 case "$d_getpwuid_r" in
13055 "$define")
13056         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13057         case "$d_getpwuid_r_proto:$usethreads" in
13058         ":define")      d_getpwuid_r_proto=define
13059                 set d_getpwuid_r_proto getpwuid_r $hdrs
13060                 eval $hasproto ;;
13061         *)      ;;
13062         esac
13063         case "$d_getpwuid_r_proto" in
13064         define)
13065         case "$getpwuid_r_proto" in
13066         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13067         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13068         esac
13069         case "$getpwuid_r_proto" in
13070         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13071         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13072         esac
13073         case "$getpwuid_r_proto" in
13074         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13075         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13076         esac
13077         case "$getpwuid_r_proto" in
13078         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13079         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13080         esac
13081         case "$getpwuid_r_proto" in
13082         ''|0)   d_getpwuid_r=undef
13083                 getpwuid_r_proto=0
13084                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13085         * )     case "$getpwuid_r_proto" in
13086                 REENTRANT_PROTO*) ;;
13087                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13088                 esac
13089                 echo "Prototype: $try" ;;
13090         esac
13091         ;;
13092         *)      case "$usethreads" in
13093                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13094                 esac
13095                 d_getpwuid_r=undef
13096                 getpwuid_r_proto=0
13097                 ;;
13098         esac
13099         ;;
13100 *)      getpwuid_r_proto=0
13101         ;;
13102 esac
13103
13104
13105 : see if getservbyname exists
13106 set getservbyname d_getsbyname
13107 eval $inlibc
13108
13109 : see if getservbyport exists
13110 set getservbyport d_getsbyport
13111 eval $inlibc
13112
13113 : see if getservent exists
13114 set getservent d_getsent
13115 eval $inlibc
13116
13117 : see if getservbyname_r exists
13118 set getservbyname_r d_getservbyname_r
13119 eval $inlibc
13120 case "$d_getservbyname_r" in
13121 "$define")
13122         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13123         case "$d_getservbyname_r_proto:$usethreads" in
13124         ":define")      d_getservbyname_r_proto=define
13125                 set d_getservbyname_r_proto getservbyname_r $hdrs
13126                 eval $hasproto ;;
13127         *)      ;;
13128         esac
13129         case "$d_getservbyname_r_proto" in
13130         define)
13131         case "$getservbyname_r_proto" in
13132         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13133         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13134         esac
13135         case "$getservbyname_r_proto" in
13136         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13137         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13138         esac
13139         case "$getservbyname_r_proto" in
13140         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13141         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13142         esac
13143         case "$getservbyname_r_proto" in
13144         ''|0)   d_getservbyname_r=undef
13145                 getservbyname_r_proto=0
13146                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13147         * )     case "$getservbyname_r_proto" in
13148                 REENTRANT_PROTO*) ;;
13149                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13150                 esac
13151                 echo "Prototype: $try" ;;
13152         esac
13153         ;;
13154         *)      case "$usethreads" in
13155                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13156                 esac
13157                 d_getservbyname_r=undef
13158                 getservbyname_r_proto=0
13159                 ;;
13160         esac
13161         ;;
13162 *)      getservbyname_r_proto=0
13163         ;;
13164 esac
13165
13166 : see if getservbyport_r exists
13167 set getservbyport_r d_getservbyport_r
13168 eval $inlibc
13169 case "$d_getservbyport_r" in
13170 "$define")
13171         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13172         case "$d_getservbyport_r_proto:$usethreads" in
13173         ":define")      d_getservbyport_r_proto=define
13174                 set d_getservbyport_r_proto getservbyport_r $hdrs
13175                 eval $hasproto ;;
13176         *)      ;;
13177         esac
13178         case "$d_getservbyport_r_proto" in
13179         define)
13180         case "$getservbyport_r_proto" in
13181         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13182         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13183         esac
13184         case "$getservbyport_r_proto" in
13185         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13186         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13187         esac
13188         case "$getservbyport_r_proto" in
13189         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13190         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13191         esac
13192         case "$getservbyport_r_proto" in
13193         ''|0)   d_getservbyport_r=undef
13194                 getservbyport_r_proto=0
13195                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13196         * )     case "$getservbyport_r_proto" in
13197                 REENTRANT_PROTO*) ;;
13198                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13199                 esac
13200                 echo "Prototype: $try" ;;
13201         esac
13202         ;;
13203         *)      case "$usethreads" in
13204                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13205                 esac
13206                 d_getservbyport_r=undef
13207                 getservbyport_r_proto=0
13208                 ;;
13209         esac
13210         ;;
13211 *)      getservbyport_r_proto=0
13212         ;;
13213 esac
13214
13215 : see if getservent_r exists
13216 set getservent_r d_getservent_r
13217 eval $inlibc
13218 case "$d_getservent_r" in
13219 "$define")
13220         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13221         case "$d_getservent_r_proto:$usethreads" in
13222         ":define")      d_getservent_r_proto=define
13223                 set d_getservent_r_proto getservent_r $hdrs
13224                 eval $hasproto ;;
13225         *)      ;;
13226         esac
13227         case "$d_getservent_r_proto" in
13228         define)
13229         case "$getservent_r_proto" in
13230         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13231         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13232         esac
13233         case "$getservent_r_proto" in
13234         ''|0) try='int getservent_r(struct servent*, char*, int);'
13235         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13236         esac
13237         case "$getservent_r_proto" in
13238         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13239         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13240         esac
13241         case "$getservent_r_proto" in
13242         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13243         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13244         esac
13245         case "$getservent_r_proto" in
13246         ''|0)   d_getservent_r=undef
13247                 getservent_r_proto=0
13248                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13249         * )     case "$getservent_r_proto" in
13250                 REENTRANT_PROTO*) ;;
13251                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13252                 esac
13253                 echo "Prototype: $try" ;;
13254         esac
13255         ;;
13256         *)      case "$usethreads" in
13257                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13258                 esac
13259                 d_getservent_r=undef
13260                 getservent_r_proto=0
13261                 ;;
13262         esac
13263         ;;
13264 *)      getservent_r_proto=0
13265         ;;
13266 esac
13267
13268 : see if prototypes for various getservxxx netdb.h functions are available
13269 echo " "
13270 set d_getservprotos getservent $i_netdb netdb.h
13271 eval $hasproto
13272
13273 : see if getspnam exists
13274 set getspnam d_getspnam
13275 eval $inlibc
13276
13277 : see if this is a shadow.h system
13278 set shadow.h i_shadow
13279 eval $inhdr
13280
13281 : see if getspnam_r exists
13282 set getspnam_r d_getspnam_r
13283 eval $inlibc
13284 case "$d_getspnam_r" in
13285 "$define")
13286         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13287         case "$d_getspnam_r_proto:$usethreads" in
13288         ":define")      d_getspnam_r_proto=define
13289                 set d_getspnam_r_proto getspnam_r $hdrs
13290                 eval $hasproto ;;
13291         *)      ;;
13292         esac
13293         case "$d_getspnam_r_proto" in
13294         define)
13295         case "$getspnam_r_proto" in
13296         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13297         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13298         esac
13299         case "$getspnam_r_proto" in
13300         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13301         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13302         esac
13303         case "$getspnam_r_proto" in
13304         ''|0)   d_getspnam_r=undef
13305                 getspnam_r_proto=0
13306                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13307         * )     case "$getspnam_r_proto" in
13308                 REENTRANT_PROTO*) ;;
13309                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13310                 esac
13311                 echo "Prototype: $try" ;;
13312         esac
13313         ;;
13314         *)      case "$usethreads" in
13315                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13316                 esac
13317                 d_getspnam_r=undef
13318                 getspnam_r_proto=0
13319                 ;;
13320         esac
13321         ;;
13322 *)      getspnam_r_proto=0
13323         ;;
13324 esac
13325
13326 : see if gettimeofday or ftime exists
13327 set gettimeofday d_gettimeod
13328 eval $inlibc
13329 case "$d_gettimeod" in
13330 "$undef")
13331         set ftime d_ftime 
13332         eval $inlibc
13333         ;;
13334 *)
13335         val="$undef"; set d_ftime; eval $setvar
13336         ;;
13337 esac
13338 case "$d_gettimeod$d_ftime" in
13339 "$undef$undef")
13340         echo " "
13341         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13342         ;;
13343 esac
13344
13345 : see if gmtime_r exists
13346 set gmtime_r d_gmtime_r
13347 eval $inlibc
13348 case "$d_gmtime_r" in
13349 "$define")
13350         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13351         case "$d_gmtime_r_proto:$usethreads" in
13352         ":define")      d_gmtime_r_proto=define
13353                 set d_gmtime_r_proto gmtime_r $hdrs
13354                 eval $hasproto ;;
13355         *)      ;;
13356         esac
13357         case "$d_gmtime_r_proto" in
13358         define)
13359         case "$gmtime_r_proto" in
13360         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13361         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13362         esac
13363         case "$gmtime_r_proto" in
13364         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13365         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13366         esac
13367         case "$gmtime_r_proto" in
13368         ''|0)   d_gmtime_r=undef
13369                 gmtime_r_proto=0
13370                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13371         * )     case "$gmtime_r_proto" in
13372                 REENTRANT_PROTO*) ;;
13373                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13374                 esac
13375                 echo "Prototype: $try" ;;
13376         esac
13377         ;;
13378         *)      case "$usethreads" in
13379                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13380                 esac
13381                 d_gmtime_r=undef
13382                 gmtime_r_proto=0
13383                 ;;
13384         esac
13385         ;;
13386 *)      gmtime_r_proto=0
13387         ;;
13388 esac
13389
13390 : see if hasmntopt exists
13391 set hasmntopt d_hasmntopt
13392 eval $inlibc
13393
13394 : see if this is a netinet/in.h or sys/in.h system
13395 set netinet/in.h i_niin sys/in.h i_sysin
13396 eval $inhdr
13397
13398 : see if arpa/inet.h has to be included
13399 set arpa/inet.h i_arpainet
13400 eval $inhdr
13401
13402 : see if htonl --and friends-- exists
13403 val=''
13404 set htonl val
13405 eval $inlibc
13406
13407 : Maybe they are macros.
13408 case "$val" in
13409 $undef)
13410         $cat >htonl.c <<EOM
13411 #include <stdio.h>
13412 #include <sys/types.h>
13413 #$i_niin I_NETINET_IN
13414 #$i_sysin I_SYS_IN
13415 #$i_arpainet I_ARPA_INET
13416 #ifdef I_NETINET_IN
13417 #include <netinet/in.h>
13418 #endif
13419 #ifdef I_SYS_IN
13420 #include <sys/in.h>
13421 #endif
13422 #ifdef I_ARPA_INET
13423 #include <arpa/inet.h>
13424 #endif
13425 #ifdef htonl
13426 printf("Defined as a macro.");
13427 #endif
13428 EOM
13429         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
13430         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
13431                 val="$define"
13432                 echo "But it seems to be defined as a macro." >&4
13433         fi
13434         $rm -f htonl.?
13435         ;;
13436 esac
13437 set d_htonl
13438 eval $setvar
13439
13440 : index or strchr
13441 echo " "
13442 if set index val -f; eval $csym; $val; then
13443         if set strchr val -f d_strchr; eval $csym; $val; then
13444                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
13445                         val="$define"
13446                         vali="$undef"
13447                         echo "strchr() found." >&4
13448                 else
13449                         val="$undef"
13450                         vali="$define"
13451                         echo "index() found." >&4
13452                 fi
13453         else
13454                 val="$undef"
13455                 vali="$define"
13456                 echo "index() found." >&4
13457         fi
13458 else
13459         if set strchr val -f d_strchr; eval $csym; $val; then
13460                 val="$define"
13461                 vali="$undef"
13462                 echo "strchr() found." >&4
13463         else
13464                 echo "No index() or strchr() found!" >&4
13465                 val="$undef"
13466                 vali="$undef"
13467         fi
13468 fi
13469 set d_strchr; eval $setvar
13470 val="$vali"
13471 set d_index; eval $setvar
13472
13473 : check whether inet_aton exists
13474 set inet_aton d_inetaton
13475 eval $inlibc
13476
13477 : Look for isascii
13478 echo " "
13479 $cat >isascii.c <<'EOCP'
13480 #include <stdio.h>
13481 #include <ctype.h>
13482 int main() {
13483         int c = 'A';
13484         if (isascii(c))
13485                 exit(0);
13486         else
13487                 exit(1);
13488 }
13489 EOCP
13490 set isascii
13491 if eval $compile; then
13492         echo "isascii() found." >&4
13493         val="$define"
13494 else
13495         echo "isascii() NOT found." >&4
13496         val="$undef"
13497 fi
13498 set d_isascii
13499 eval $setvar
13500 $rm -f isascii*
13501
13502 : see if isfinite exists
13503 set isfinite d_isfinite
13504 eval $inlibc
13505
13506 : see if isinf exists
13507 set isinf d_isinf
13508 eval $inlibc
13509
13510 : see if isnan exists
13511 set isnan d_isnan
13512 eval $inlibc
13513
13514 : see if isnanl exists
13515 set isnanl d_isnanl
13516 eval $inlibc
13517
13518 : see if killpg exists
13519 set killpg d_killpg
13520 eval $inlibc
13521
13522 : see if lchown exists
13523 echo " "
13524 $cat > try.c <<'EOCP'
13525 /* System header to define __stub macros and hopefully few prototypes,
13526     which can conflict with char lchown(); below.  */
13527 #include <assert.h>
13528 /* Override any gcc2 internal prototype to avoid an error.  */
13529 /* We use char because int might match the return type of a gcc2
13530    builtin and then its argument prototype would still apply.  */
13531 char lchown();
13532 int main() {
13533     /*  The GNU C library defines this for functions which it implements
13534         to always fail with ENOSYS.  Some functions are actually named
13535         something starting with __ and the normal name is an alias.  */
13536 #if defined (__stub_lchown) || defined (__stub___lchown)
13537 choke me
13538 #else
13539 lchown();
13540 #endif
13541 ; return 0; }
13542 EOCP
13543 set try
13544 if eval $compile; then
13545     $echo "lchown() found." >&4
13546     val="$define"
13547 else
13548     $echo "lchown() NOT found." >&4
13549     val="$undef"
13550 fi
13551 set d_lchown
13552 eval $setvar
13553
13554 : See if number of significant digits in a double precision number is known
13555 echo " "
13556 $cat >ldbl_dig.c <<EOM
13557 #$i_limits I_LIMITS
13558 #$i_float I_FLOAT
13559 #ifdef I_LIMITS
13560 #include <limits.h>
13561 #endif
13562 #ifdef I_FLOAT
13563 #include <float.h>
13564 #endif
13565 #ifdef LDBL_DIG
13566 printf("Contains LDBL_DIG");
13567 #endif
13568 EOM
13569 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
13570 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
13571         echo "LDBL_DIG found." >&4
13572         val="$define"
13573 else
13574         echo "LDBL_DIG NOT found." >&4
13575         val="$undef"
13576 fi
13577 $rm -f ldbl_dig.?
13578 set d_ldbl_dig
13579 eval $setvar
13580
13581 : see if link exists
13582 set link d_link
13583 eval $inlibc
13584
13585 : see if localtime_r exists
13586 set localtime_r d_localtime_r
13587 eval $inlibc
13588 case "$d_localtime_r" in
13589 "$define")
13590         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13591         case "$d_localtime_r_proto:$usethreads" in
13592         ":define")      d_localtime_r_proto=define
13593                 set d_localtime_r_proto localtime_r $hdrs
13594                 eval $hasproto ;;
13595         *)      ;;
13596         esac
13597         case "$d_localtime_r_proto" in
13598         define)
13599         case "$localtime_r_proto" in
13600         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
13601         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
13602         esac
13603         case "$localtime_r_proto" in
13604         ''|0) try='int localtime_r(const time_t*, struct tm*);'
13605         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
13606         esac
13607         case "$localtime_r_proto" in
13608         ''|0)   d_localtime_r=undef
13609                 localtime_r_proto=0
13610                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
13611         * )     case "$localtime_r_proto" in
13612                 REENTRANT_PROTO*) ;;
13613                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
13614                 esac
13615                 echo "Prototype: $try" ;;
13616         esac
13617         ;;
13618         *)      case "$usethreads" in
13619                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
13620                 esac
13621                 d_localtime_r=undef
13622                 localtime_r_proto=0
13623                 ;;
13624         esac
13625         ;;
13626 *)      localtime_r_proto=0
13627         ;;
13628 esac
13629
13630 : see if localeconv exists
13631 set localeconv d_locconv
13632 eval $inlibc
13633
13634 : see if lockf exists
13635 set lockf d_lockf
13636 eval $inlibc
13637
13638 : see if prototype for lseek is available
13639 echo " "
13640 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
13641 eval $hasproto
13642
13643 : see if lstat exists
13644 set lstat d_lstat
13645 eval $inlibc
13646
13647 : see if madvise exists
13648 set madvise d_madvise
13649 eval $inlibc
13650
13651 : see if mblen exists
13652 set mblen d_mblen
13653 eval $inlibc
13654
13655 : see if mbstowcs exists
13656 set mbstowcs d_mbstowcs
13657 eval $inlibc
13658
13659 : see if mbtowc exists
13660 set mbtowc d_mbtowc
13661 eval $inlibc
13662
13663 : see if memchr exists
13664 set memchr d_memchr
13665 eval $inlibc
13666
13667 : see if memcmp exists
13668 set memcmp d_memcmp
13669 eval $inlibc
13670
13671 : see if memcpy exists
13672 set memcpy d_memcpy
13673 eval $inlibc
13674
13675 : see if memmove exists
13676 set memmove d_memmove
13677 eval $inlibc
13678
13679 : see if memset exists
13680 set memset d_memset
13681 eval $inlibc
13682
13683 : see if mkdir exists
13684 set mkdir d_mkdir
13685 eval $inlibc
13686
13687 : see if mkdtemp exists
13688 set mkdtemp d_mkdtemp
13689 eval $inlibc
13690
13691 : see if mkfifo exists
13692 set mkfifo d_mkfifo
13693 eval $inlibc
13694
13695 : see if mkstemp exists
13696 set mkstemp d_mkstemp
13697 eval $inlibc
13698
13699 : see if mkstemps exists
13700 set mkstemps d_mkstemps
13701 eval $inlibc
13702
13703 : see if mktime exists
13704 set mktime d_mktime
13705 eval $inlibc
13706
13707 : see if this is a sys/mman.h system
13708 set sys/mman.h i_sysmman
13709 eval $inhdr
13710
13711 : see if mmap exists
13712 set mmap d_mmap
13713 eval $inlibc
13714 : see what shmat returns
13715 : default to something harmless
13716 mmaptype='void *'
13717 case "$i_sysmman$d_mmap" in
13718 "$define$define")
13719         $cat >mmap.c <<'END'
13720 #include <sys/mman.h>
13721 void *mmap();
13722 END
13723         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
13724                 mmaptype='void *'
13725         else
13726                 mmaptype='caddr_t'
13727         fi
13728         echo "and it returns ($mmaptype)." >&4
13729         ;;
13730 esac
13731
13732
13733
13734 : see if mprotect exists
13735 set mprotect d_mprotect
13736 eval $inlibc
13737
13738 : see if msgctl exists
13739 set msgctl d_msgctl
13740 eval $inlibc
13741
13742 : see if msgget exists
13743 set msgget d_msgget
13744 eval $inlibc
13745
13746 : see if msgsnd exists
13747 set msgsnd d_msgsnd
13748 eval $inlibc
13749
13750 : see if msgrcv exists
13751 set msgrcv d_msgrcv
13752 eval $inlibc
13753
13754 : see how much of the 'msg*(2)' library is present.
13755 h_msg=true
13756 echo " "
13757 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
13758 *"$undef"*) h_msg=false;;
13759 esac
13760 case "$osname" in
13761 freebsd)
13762     case "`ipcs 2>&1`" in
13763     "SVID messages"*"not configured"*)
13764         echo "Your $osname does not have the msg*(2) configured." >&4
13765         h_msg=false
13766         val="$undef"
13767         set msgctl d_msgctl
13768         eval $setvar
13769         set msgget d_msgget
13770         eval $setvar
13771         set msgsnd d_msgsnd
13772         eval $setvar
13773         set msgrcv d_msgrcv
13774         eval $setvar
13775         ;;
13776     esac
13777     ;;
13778 esac
13779 : we could also check for sys/ipc.h ...
13780 if $h_msg && $test `./findhdr sys/msg.h`; then
13781         echo "You have the full msg*(2) library." >&4
13782         val="$define"
13783 else
13784         echo "You don't have the full msg*(2) library." >&4
13785         val="$undef"
13786 fi
13787 set d_msg
13788 eval $setvar
13789
13790
13791 echo " "
13792 echo "Checking to see if your system supports struct msghdr..." >&4
13793 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
13794 eval $hasstruct
13795 case "$d_msghdr_s" in
13796 "$define")      echo "Yes, it does."   ;;
13797 *)              echo "No, it doesn't." ;;
13798 esac
13799
13800
13801 : see if msync exists
13802 set msync d_msync
13803 eval $inlibc
13804
13805 : see if munmap exists
13806 set munmap d_munmap
13807 eval $inlibc
13808
13809 : see if nanosleep exists
13810 set nanosleep d_nanosleep
13811 eval $inlibc
13812
13813 : see if nice exists
13814 set nice d_nice
13815 eval $inlibc
13816
13817 : see if this is a langinfo.h system
13818 set langinfo.h i_langinfo
13819 eval $inhdr
13820
13821 : see if nl_langinfo exists
13822 set nl_langinfo d_nl_langinfo
13823 eval $inlibc
13824
13825 : check for length of character
13826 echo " "
13827 case "$charsize" in
13828 '')
13829         echo "Checking to see how big your characters are (hey, you never know)..." >&4
13830         $cat >try.c <<EOCP
13831 #include <stdio.h>
13832 #$i_stdlib I_STDLIB
13833 #ifdef I_STDLIB
13834 #include <stdlib.h>
13835 #endif
13836 int main()
13837 {
13838     printf("%d\n", (int)sizeof(char));
13839     exit(0);
13840 }
13841 EOCP
13842         set try
13843         if eval $compile_ok; then
13844                 dflt=`$run ./try`
13845         else
13846                 dflt='1'
13847                 echo "(I can't seem to compile the test program.  Guessing...)"
13848         fi
13849         ;;
13850 *)
13851         dflt="$charsize"
13852         ;;
13853 esac
13854 rp="What is the size of a character (in bytes)?"
13855 . ./myread
13856 charsize="$ans"
13857 $rm -f try.c try
13858
13859 : check for volatile keyword
13860 echo " "
13861 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
13862 $cat >try.c <<'EOCP'
13863 int main()
13864 {
13865         typedef struct _goo_struct goo_struct;
13866         goo_struct * volatile goo = ((goo_struct *)0);
13867         struct _goo_struct {
13868                 long long_int;
13869                 int reg_int;
13870                 char char_var;
13871         };
13872         typedef unsigned short foo_t;
13873         char *volatile foo;
13874         volatile int bar;
13875         volatile foo_t blech;
13876         foo = foo;
13877 }
13878 EOCP
13879 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
13880         val="$define"
13881         echo "Yup, it does."
13882 else
13883         val="$undef"
13884         echo "Nope, it doesn't."
13885 fi
13886 set d_volatile
13887 eval $setvar
13888 $rm -f try.*
13889
13890
13891 echo " "
13892 $echo "Choosing the C types to be used for Perl's internal types..." >&4
13893
13894 case "$use64bitint:$d_quad:$quadtype" in
13895 define:define:?*)
13896         ivtype="$quadtype"
13897         uvtype="$uquadtype"
13898         ivsize=8
13899         uvsize=8
13900         ;;
13901 *)      ivtype="long"
13902         uvtype="unsigned long"
13903         ivsize=$longsize
13904         uvsize=$longsize
13905         ;;
13906 esac
13907
13908 case "$uselongdouble:$d_longdbl" in
13909 define:define)
13910         nvtype="long double"
13911         nvsize=$longdblsize
13912         ;;
13913 *)      nvtype=double
13914         nvsize=$doublesize
13915         ;;
13916 esac
13917
13918 $echo "(IV will be "$ivtype", $ivsize bytes)"
13919 $echo "(UV will be "$uvtype", $uvsize bytes)"
13920 $echo "(NV will be "$nvtype", $nvsize bytes)"
13921
13922 $cat >try.c <<EOCP
13923 #$i_inttypes I_INTTYPES
13924 #ifdef I_INTTYPES
13925 #include <inttypes.h>
13926 #endif
13927 #include <stdio.h>
13928 int main() {
13929 #ifdef INT8
13930    int8_t i =  INT8_MAX;
13931   uint8_t u = UINT8_MAX;
13932   printf("int8_t\n");
13933 #endif
13934 #ifdef INT16
13935    int16_t i =  INT16_MAX;
13936   uint16_t i = UINT16_MAX;
13937   printf("int16_t\n");
13938 #endif
13939 #ifdef INT32
13940    int32_t i =  INT32_MAX;
13941   uint32_t u = UINT32_MAX;
13942   printf("int32_t\n");
13943 #endif
13944 }
13945 EOCP
13946
13947 case "$i8type" in
13948 '')     case "$charsize" in
13949         1)      i8type=char
13950                 u8type="unsigned char"
13951                 i8size=$charsize
13952                 u8size=$charsize
13953                 ;;
13954         esac
13955         ;;
13956 esac
13957 case "$i8type" in
13958 '')     set try -DINT8
13959         if eval $compile; then
13960                 case "`$run ./try`" in
13961                 int8_t) i8type=int8_t
13962                         u8type=uint8_t
13963                         i8size=1
13964                         u8size=1
13965                         ;;
13966                 esac
13967         fi
13968         ;;
13969 esac
13970 case "$i8type" in
13971 '')     if $test $charsize -ge 1; then
13972                 i8type=char
13973                 u8type="unsigned char"
13974                 i8size=$charsize
13975                 u8size=$charsize
13976         fi
13977         ;;
13978 esac
13979
13980 case "$i16type" in
13981 '')     case "$shortsize" in
13982         2)      i16type=short
13983                 u16type="unsigned short"
13984                 i16size=$shortsize
13985                 u16size=$shortsize
13986                 ;;
13987         esac
13988         ;;
13989 esac
13990 case "$i16type" in
13991 '')     set try -DINT16
13992         if eval $compile; then
13993                 case "`$run ./try`" in
13994                 int16_t)
13995                         i16type=int16_t
13996                         u16type=uint16_t
13997                         i16size=2
13998                         u16size=2
13999                         ;;
14000                 esac
14001         fi
14002         ;;
14003 esac
14004 case "$i16type" in
14005 '')     if $test $shortsize -ge 2; then
14006                 i16type=short
14007                 u16type="unsigned short"
14008                 i16size=$shortsize
14009                 u16size=$shortsize
14010         fi
14011         ;;
14012 esac
14013
14014 case "$i32type" in
14015 '')     case "$longsize" in
14016         4)      i32type=long
14017                 u32type="unsigned long"
14018                 i32size=$longsize
14019                 u32size=$longsize
14020                 ;;
14021         *)      case "$intsize" in
14022                 4)      i32type=int
14023                         u32type="unsigned int"
14024                         i32size=$intsize
14025                         u32size=$intsize
14026                         ;;
14027                 esac
14028                 ;;
14029         esac
14030         ;;
14031 esac
14032 case "$i32type" in
14033 '')     set try -DINT32
14034         if eval $compile; then
14035                 case "`$run ./try`" in
14036                 int32_t)
14037                         i32type=int32_t
14038                         u32type=uint32_t
14039                         i32size=4
14040                         u32size=4
14041                         ;;
14042                 esac
14043         fi
14044         ;;
14045 esac
14046 case "$i32type" in
14047 '')     if $test $intsize -ge 4; then
14048                 i32type=int
14049                 u32type="unsigned int"
14050                 i32size=$intsize
14051                 u32size=$intsize
14052         fi
14053         ;;
14054 esac
14055
14056 case "$i64type" in
14057 '')     case "$d_quad:$quadtype" in
14058         define:?*)
14059                 i64type="$quadtype"
14060                 u64type="$uquadtype"
14061                 i64size=8
14062                 u64size=8
14063                 ;;
14064         esac
14065         ;;
14066 esac
14067
14068 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14069 : volatile so that the compiler has to store it out to memory.
14070 if test X"$d_volatile" = X"$define"; then
14071         volatile=volatile
14072 fi
14073 $cat <<EOP >try.c
14074 #include <stdio.h>
14075 #include <sys/types.h>
14076 #include <signal.h>
14077 #ifdef SIGFPE
14078 $volatile int bletched = 0;
14079 $signal_t blech(s) int s; { bletched = 1; }
14080 #endif
14081 int main() {
14082     $uvtype u = 0;
14083     $nvtype d;
14084     int     n = 8 * $uvsize;
14085     int     i;
14086 #ifdef SIGFPE
14087     signal(SIGFPE, blech);
14088 #endif
14089
14090     for (i = 0; i < n; i++) {
14091       u = u << 1 | ($uvtype)1;
14092       d = ($nvtype)u;
14093       if (($uvtype)d != u)
14094         break;
14095       if (d <= 0)
14096         break;
14097       d = ($nvtype)(u - 1);
14098       if (($uvtype)d != (u - 1))
14099         break;
14100 #ifdef SIGFPE
14101       if (bletched) {
14102         break;
14103 #endif
14104       } 
14105     }
14106     printf("%d\n", ((i == n) ? -n : i));
14107     exit(0);
14108 }
14109 EOP
14110 set try
14111
14112 d_nv_preserves_uv="$undef"
14113 if eval $compile; then
14114         nv_preserves_uv_bits="`$run ./try`"
14115 fi
14116 case "$nv_preserves_uv_bits" in
14117 \-[1-9]*)       
14118         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14119         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14120         d_nv_preserves_uv="$define"
14121         ;;
14122 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14123         d_nv_preserves_uv="$undef" ;;
14124 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14125         nv_preserves_uv_bits="$undef" ;;
14126 esac
14127
14128 $rm -f try.* try
14129
14130
14131 : check for off64_t
14132 echo " "
14133 echo "Checking to see if you have off64_t..." >&4
14134 $cat >try.c <<EOCP
14135 #include <sys/types.h>
14136 #include <unistd.h>
14137 int main() { off64_t x = 7; }
14138 EOCP
14139 set try
14140 if eval $compile; then
14141         val="$define"
14142         echo "You have off64_t."
14143 else
14144         val="$undef"
14145         echo "You do not have off64_t."
14146         case "$lseeksize" in
14147         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
14148         esac
14149 fi
14150 $rm -f try.* try
14151 set d_off64_t
14152 eval $setvar
14153
14154 : how to create joinable pthreads
14155 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
14156         echo " "
14157         echo "Checking what constant to use for creating joinable pthreads..." >&4 
14158         $cat >try.c <<'EOCP'
14159 #include <pthread.h>
14160 int main() {
14161     int detachstate = JOINABLE;
14162 }
14163 EOCP
14164         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
14165         if eval $compile; then
14166                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
14167                 val="$undef" # Yes, undef.
14168                 set d_old_pthread_create_joinable
14169                 eval $setvar
14170                 val=""
14171                 set old_pthread_create_joinable
14172                 eval $setvar
14173         else
14174                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
14175                 if eval $compile; then
14176                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
14177                         val="$define"
14178                         set d_old_pthread_create_joinable
14179                         eval $setvar
14180                         val=PTHREAD_CREATE_UNDETACHED
14181                         set old_pthread_create_joinable
14182                         eval $setvar
14183                 else            
14184                         set try -DJOINABLE=__UNDETACHED
14185                         if eval $compile; then
14186                                 echo "You seem to use __UNDETACHED." >&4
14187                                 val="$define"
14188                                 set d_old_pthread_create_joinable
14189                                 eval $setvar
14190                                 val=__UNDETACHED
14191                                 set old_pthread_create_joinable
14192                                 eval $setvar
14193                         else
14194                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
14195                                 val="$define"
14196                                 set d_old_pthread_create_joinable
14197                                 eval $setvar
14198                                 val=0
14199                                 set old_pthread_create_joinable
14200                                 eval $setvar
14201                         fi
14202                 fi
14203         fi
14204         $rm -f try try.*
14205 else
14206     d_old_pthread_create_joinable="$undef"
14207     old_pthread_create_joinable=""
14208 fi
14209
14210 : see if pause exists
14211 set pause d_pause
14212 eval $inlibc
14213
14214 : see if pipe exists
14215 set pipe d_pipe
14216 eval $inlibc
14217
14218 : see if poll exists
14219 set poll d_poll
14220 eval $inlibc
14221
14222 : see if readlink exists
14223 set readlink d_readlink
14224 eval $inlibc
14225
14226 echo " "
14227 procselfexe=''
14228 val="$undef"
14229 case "$d_readlink" in
14230 "$define")
14231         if $issymlink /proc/self/exe ; then
14232                 $ls -l /proc/self/exe > reflect
14233                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14234                         echo "You have Linux-like /proc/self/exe."
14235                         procselfexe='"/proc/self/exe"'
14236                         val="$define"
14237                 fi
14238         fi
14239         if $issymlink /proc/curproc/file ; then
14240                 $ls -l /proc/curproc/file > reflect
14241                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
14242                         echo "You have BSD-like /proc/curproc/file."
14243                         procselfexe='"/proc/curproc/file"'
14244                         val="$define"
14245                 fi
14246         fi
14247         ;;
14248 esac
14249 $rm -f reflect
14250 set d_procselfexe
14251 eval $setvar
14252
14253 : see whether the pthread_atfork exists
14254 $cat >try.c <<EOP
14255 #include <pthread.h>
14256 #include <stdio.h>
14257 int main() {
14258 #ifdef  PTHREAD_ATFORK
14259         pthread_atfork(NULL,NULL,NULL);
14260 #endif
14261 }
14262 EOP
14263
14264 : see if pthread_atfork exists
14265 set try -DPTHREAD_ATFORK
14266 if eval $compile; then
14267     val="$define"
14268 else
14269     val="$undef"
14270 fi
14271 case "$usethreads" in
14272 $define)
14273         case "$val" in
14274         $define) echo 'pthread_atfork found.' >&4        ;;
14275         *)       echo 'pthread_atfork NOT found.' >&4    ;;
14276         esac
14277 esac
14278 set d_pthread_atfork
14279 eval $setvar
14280
14281
14282 : see whether the various POSIXish _yields exist
14283 $cat >try.c <<EOP
14284 #include <pthread.h>
14285 #include <stdio.h>
14286 int main() {
14287 #ifdef SCHED_YIELD
14288         sched_yield();
14289 #else
14290 #ifdef PTHREAD_YIELD
14291         pthread_yield();
14292 #else
14293 #ifdef PTHREAD_YIELD_NULL
14294         pthread_yield(NULL);
14295 #endif
14296 #endif
14297 #endif
14298 }
14299 EOP
14300 : see if sched_yield exists
14301 set try -DSCHED_YIELD
14302 if eval $compile; then
14303     val="$define"
14304     sched_yield='sched_yield()'
14305 else
14306     val="$undef"
14307 fi
14308 case "$usethreads" in
14309 $define)
14310         case "$val" in
14311         $define) echo 'sched_yield() found.' >&4        ;;
14312         *)       echo 'sched_yield() NOT found.' >&4    ;;
14313         esac
14314 esac
14315 set d_sched_yield
14316 eval $setvar
14317
14318 : see if pthread_yield exists
14319 set try -DPTHREAD_YIELD
14320 if eval $compile; then
14321     val="$define"
14322     case "$sched_yield" in
14323     '') sched_yield='pthread_yield()' ;;
14324     esac
14325 else
14326     set try -DPTHREAD_YIELD_NULL
14327     if eval $compile; then
14328         val="$define"
14329         case "$sched_yield" in
14330         '') sched_yield='pthread_yield(NULL)' ;;
14331         esac
14332     else
14333         val="$undef"
14334     fi
14335 fi
14336 case "$usethreads" in
14337 $define)
14338         case "$val" in
14339         $define) echo 'pthread_yield() found.' >&4      ;;
14340         *)       echo 'pthread_yield() NOT found.' >&4  ;;
14341         esac
14342         ;;
14343 esac
14344 set d_pthread_yield
14345 eval $setvar
14346
14347 case "$sched_yield" in
14348 '') sched_yield=undef ;;
14349 esac
14350
14351 $rm -f try try.*
14352
14353 : see if random_r exists
14354 set random_r d_random_r
14355 eval $inlibc
14356 case "$d_random_r" in
14357 "$define")
14358         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
14359         case "$d_random_r_proto:$usethreads" in
14360         ":define")      d_random_r_proto=define
14361                 set d_random_r_proto random_r $hdrs
14362                 eval $hasproto ;;
14363         *)      ;;
14364         esac
14365         case "$d_random_r_proto" in
14366         define)
14367         case "$random_r_proto" in
14368         ''|0) try='int random_r(int*, struct random_data*);'
14369         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
14370         esac
14371         case "$random_r_proto" in
14372         ''|0) try='int random_r(long*, struct random_data*);'
14373         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
14374         esac
14375         case "$random_r_proto" in
14376         ''|0) try='int random_r(struct random_data*, int32_t*);'
14377         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
14378         esac
14379         case "$random_r_proto" in
14380         ''|0)   d_random_r=undef
14381                 random_r_proto=0
14382                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
14383         * )     case "$random_r_proto" in
14384                 REENTRANT_PROTO*) ;;
14385                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
14386                 esac
14387                 echo "Prototype: $try" ;;
14388         esac
14389         ;;
14390         *)      case "$usethreads" in
14391                 define) echo "random_r has no prototype, not using it." >&4 ;;
14392                 esac
14393                 d_random_r=undef
14394                 random_r_proto=0
14395                 ;;
14396         esac
14397         ;;
14398 *)      random_r_proto=0
14399         ;;
14400 esac
14401
14402 : see if readdir and friends exist
14403 set readdir d_readdir
14404 eval $inlibc
14405 set seekdir d_seekdir
14406 eval $inlibc
14407 set telldir d_telldir
14408 eval $inlibc
14409 set rewinddir d_rewinddir
14410 eval $inlibc
14411
14412 : see if readdir64_r exists
14413 set readdir64_r d_readdir64_r
14414 eval $inlibc
14415 case "$d_readdir64_r" in
14416 "$define")
14417         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14418         case "$d_readdir64_r_proto:$usethreads" in
14419         ":define")      d_readdir64_r_proto=define
14420                 set d_readdir64_r_proto readdir64_r $hdrs
14421                 eval $hasproto ;;
14422         *)      ;;
14423         esac
14424         case "$d_readdir64_r_proto" in
14425         define)
14426         case "$readdir64_r_proto" in
14427         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
14428         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
14429         esac
14430         case "$readdir64_r_proto" in
14431         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
14432         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
14433         esac
14434         case "$readdir64_r_proto" in
14435         ''|0)   d_readdir64_r=undef
14436                 readdir64_r_proto=0
14437                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
14438         * )     case "$readdir64_r_proto" in
14439                 REENTRANT_PROTO*) ;;
14440                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
14441                 esac
14442                 echo "Prototype: $try" ;;
14443         esac
14444         ;;
14445         *)      case "$usethreads" in
14446                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
14447                 esac
14448                 d_readdir64_r=undef
14449                 readdir64_r_proto=0
14450                 ;;
14451         esac
14452         ;;
14453 *)      readdir64_r_proto=0
14454         ;;
14455 esac
14456
14457 : see if readdir_r exists
14458 set readdir_r d_readdir_r
14459 eval $inlibc
14460 case "$d_readdir_r" in
14461 "$define")
14462         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
14463         case "$d_readdir_r_proto:$usethreads" in
14464         ":define")      d_readdir_r_proto=define
14465                 set d_readdir_r_proto readdir_r $hdrs
14466                 eval $hasproto ;;
14467         *)      ;;
14468         esac
14469         case "$d_readdir_r_proto" in
14470         define)
14471         case "$readdir_r_proto" in
14472         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
14473         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
14474         esac
14475         case "$readdir_r_proto" in
14476         ''|0) try='int readdir_r(DIR*, struct dirent*);'
14477         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
14478         esac
14479         case "$readdir_r_proto" in
14480         ''|0)   d_readdir_r=undef
14481                 readdir_r_proto=0
14482                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
14483         * )     case "$readdir_r_proto" in
14484                 REENTRANT_PROTO*) ;;
14485                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
14486                 esac
14487                 echo "Prototype: $try" ;;
14488         esac
14489         ;;
14490         *)      case "$usethreads" in
14491                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
14492                 esac
14493                 d_readdir_r=undef
14494                 readdir_r_proto=0
14495                 ;;
14496         esac
14497         ;;
14498 *)      readdir_r_proto=0
14499         ;;
14500 esac
14501
14502 : see if readv exists
14503 set readv d_readv
14504 eval $inlibc
14505
14506 : see if recvmsg exists
14507 set recvmsg d_recvmsg
14508 eval $inlibc
14509
14510 : see if rename exists
14511 set rename d_rename
14512 eval $inlibc
14513
14514 : see if rmdir exists
14515 set rmdir d_rmdir
14516 eval $inlibc
14517
14518 : see if memory.h is available.
14519 val=''
14520 set memory.h val
14521 eval $inhdr
14522
14523 : See if it conflicts with string.h
14524 case "$val" in
14525 $define)
14526         case "$strings" in
14527         '') ;;
14528         *)
14529                 $cppstdin $cppflags $cppminus < $strings > mem.h
14530                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
14531                         echo " "
14532                         echo "We won't be including <memory.h>."
14533                         val="$undef"
14534                 fi
14535                 $rm -f mem.h
14536                 ;;
14537         esac
14538 esac
14539 set i_memory
14540 eval $setvar
14541
14542 : can bcopy handle overlapping blocks?
14543 echo " "
14544 val="$undef"
14545 case "$d_memmove" in
14546 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
14547 *)      case "$d_bcopy" in
14548         "$define")
14549                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
14550                 $cat >try.c <<EOCP
14551 #$i_memory I_MEMORY
14552 #$i_stdlib I_STDLIB
14553 #$i_string I_STRING
14554 #$i_unistd I_UNISTD
14555 EOCP
14556         $cat >>try.c <<'EOCP'
14557 #include <stdio.h>
14558 #ifdef I_MEMORY
14559 #  include <memory.h>
14560 #endif
14561 #ifdef I_STDLIB
14562 #  include <stdlib.h>
14563 #endif
14564 #ifdef I_STRING
14565 #  include <string.h>
14566 #else
14567 #  include <strings.h>
14568 #endif
14569 #ifdef I_UNISTD
14570 #  include <unistd.h>  /* Needed for NetBSD */
14571 #endif
14572 int main()
14573 {
14574 char buf[128], abc[128];
14575 char *b;
14576 int len;
14577 int off;
14578 int align;
14579
14580 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14581    try to store the string in read-only memory. */
14582 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
14583
14584 for (align = 7; align >= 0; align--) {
14585         for (len = 36; len; len--) {
14586                 b = buf+align;
14587                 bcopy(abc, b, len);
14588                 for (off = 1; off <= len; off++) {
14589                         bcopy(b, b+off, len);
14590                         bcopy(b+off, b, len);
14591                         if (bcmp(b, abc, len))
14592                                 exit(1);
14593                 }
14594         }
14595 }
14596 exit(0);
14597 }
14598 EOCP
14599                 set try
14600                 if eval $compile_ok; then
14601                         if ./try 2>/dev/null; then
14602                                 echo "Yes, it can."
14603                                 val="$define"
14604                         else
14605                                 echo "It can't, sorry."
14606                         fi
14607                 else
14608                         echo "(I can't compile the test program, so we'll assume not...)"
14609                 fi
14610                 ;;
14611         esac
14612         $rm -f try.* try core
14613         ;;
14614 esac
14615 set d_safebcpy
14616 eval $setvar
14617
14618 : can memcpy handle overlapping blocks?
14619 echo " "
14620 val="$undef"
14621 case "$d_memmove" in
14622 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
14623 *)      case "$d_memcpy" in
14624         "$define")
14625                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
14626                 $cat >try.c <<EOCP
14627 #$i_memory I_MEMORY
14628 #$i_stdlib I_STDLIB
14629 #$i_string I_STRING
14630 #$i_unistd I_UNISTD
14631 EOCP
14632         $cat >>try.c <<'EOCP'
14633 #include <stdio.h>
14634 #ifdef I_MEMORY
14635 #  include <memory.h>
14636 #endif
14637 #ifdef I_STDLIB
14638 #  include <stdlib.h>
14639 #endif
14640 #ifdef I_STRING
14641 #  include <string.h>
14642 #else
14643 #  include <strings.h>
14644 #endif
14645 #ifdef I_UNISTD
14646 #  include <unistd.h>  /* Needed for NetBSD */
14647 #endif
14648 int main()
14649 {
14650 char buf[128], abc[128];
14651 char *b;
14652 int len;
14653 int off;
14654 int align;
14655
14656 /* Copy "abcde..." string to char abc[] so that gcc doesn't
14657    try to store the string in read-only memory. */
14658 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
14659
14660 for (align = 7; align >= 0; align--) {
14661         for (len = 36; len; len--) {
14662                 b = buf+align;
14663                 memcpy(b, abc, len);
14664                 for (off = 1; off <= len; off++) {
14665                         memcpy(b+off, b, len);
14666                         memcpy(b, b+off, len);
14667                         if (memcmp(b, abc, len))
14668                                 exit(1);
14669                 }
14670         }
14671 }
14672 exit(0);
14673 }
14674 EOCP
14675                 set try
14676                 if eval $compile_ok; then
14677                         if ./try 2>/dev/null; then
14678                                 echo "Yes, it can."
14679                                 val="$define"
14680                         else
14681                                 echo "It can't, sorry."
14682                         fi
14683                 else
14684                         echo "(I can't compile the test program, so we'll assume not...)"
14685                 fi
14686                 ;;
14687         esac
14688         $rm -f try.* try core
14689         ;;
14690 esac
14691 set d_safemcpy
14692 eval $setvar
14693
14694 : can memcmp be trusted to compare relative magnitude?
14695 val="$undef"
14696 case "$d_memcmp" in
14697 "$define")
14698         echo " "
14699         echo "Checking if your memcmp() can compare relative magnitude..." >&4
14700         $cat >try.c <<EOCP
14701 #$i_memory I_MEMORY
14702 #$i_stdlib I_STDLIB
14703 #$i_string I_STRING
14704 #$i_unistd I_UNISTD
14705 EOCP
14706         $cat >>try.c <<'EOCP'
14707 #include <stdio.h>
14708 #ifdef I_MEMORY
14709 #  include <memory.h>
14710 #endif
14711 #ifdef I_STDLIB
14712 #  include <stdlib.h>
14713 #endif
14714 #ifdef I_STRING
14715 #  include <string.h>
14716 #else
14717 #  include <strings.h>
14718 #endif
14719 #ifdef I_UNISTD
14720 #  include <unistd.h>  /* Needed for NetBSD */
14721 #endif
14722 int main()
14723 {
14724 char a = -1;
14725 char b = 0;
14726 if ((a < b) && memcmp(&a, &b, 1) < 0)
14727         exit(1);
14728 exit(0);
14729 }
14730 EOCP
14731         set try
14732         if eval $compile_ok; then
14733                 if $run ./try 2>/dev/null; then
14734                         echo "Yes, it can."
14735                         val="$define"
14736                 else
14737                         echo "No, it can't (it uses signed chars)."
14738                 fi
14739         else
14740                 echo "(I can't compile the test program, so we'll assume not...)"
14741         fi
14742         ;;
14743 esac
14744 $rm -f try.* try core
14745 set d_sanemcmp
14746 eval $setvar
14747
14748 : see if prototype for sbrk is available
14749 echo " "
14750 set d_sbrkproto sbrk $i_unistd unistd.h
14751 eval $hasproto
14752
14753 : see if select exists
14754 set select d_select
14755 eval $inlibc
14756
14757 : see if semctl exists
14758 set semctl d_semctl
14759 eval $inlibc
14760
14761 : see if semget exists
14762 set semget d_semget
14763 eval $inlibc
14764
14765 : see if semop exists
14766 set semop d_semop
14767 eval $inlibc
14768
14769 : see how much of the 'sem*(2)' library is present.
14770 h_sem=true
14771 echo " "
14772 case "$d_semctl$d_semget$d_semop" in
14773 *"$undef"*) h_sem=false;;
14774 esac
14775 case "$osname" in
14776 freebsd)
14777     case "`ipcs 2>&1`" in
14778     "SVID messages"*"not configured"*)
14779         echo "Your $osname does not have the sem*(2) configured." >&4
14780         h_sem=false
14781         val="$undef"
14782         set semctl d_semctl
14783         eval $setvar
14784         set semget d_semget
14785         eval $setvar
14786         set semop d_semop
14787         eval $setvar
14788         ;;
14789     esac
14790     ;;
14791 esac
14792 : we could also check for sys/ipc.h ...
14793 if $h_sem && $test `./findhdr sys/sem.h`; then
14794         echo "You have the full sem*(2) library." >&4
14795         val="$define"
14796 else
14797         echo "You don't have the full sem*(2) library." >&4
14798         val="$undef"
14799 fi
14800 set d_sem
14801 eval $setvar
14802
14803 : see whether sys/sem.h defines union semun
14804 echo " "
14805 $cat > try.c <<'END'
14806 #include <sys/types.h>
14807 #include <sys/ipc.h>
14808 #include <sys/sem.h>
14809 int main () { union semun semun; semun.buf = 0; }
14810 END
14811 set try
14812 if eval $compile; then
14813     echo "You have union semun in <sys/sem.h>." >&4
14814     val="$define"
14815 else
14816     echo "You do not have union semun in <sys/sem.h>." >&4
14817     val="$undef"
14818 fi
14819 $rm -f try try.c try.h
14820 set d_union_semun
14821 eval $setvar
14822
14823 : see how to do semctl IPC_STAT
14824 case "$d_sem" in
14825 $define)
14826     : see whether semctl IPC_STAT can use union semun
14827     echo " "
14828     $cat > try.h <<END
14829 #ifndef S_IRUSR
14830 #   ifdef S_IREAD
14831 #       define S_IRUSR S_IREAD
14832 #       define S_IWUSR S_IWRITE
14833 #       define S_IXUSR S_IEXEC
14834 #   else
14835 #       define S_IRUSR 0400
14836 #       define S_IWUSR 0200
14837 #       define S_IXUSR 0100
14838 #   endif
14839 #   define S_IRGRP (S_IRUSR>>3)
14840 #   define S_IWGRP (S_IWUSR>>3)
14841 #   define S_IXGRP (S_IXUSR>>3)
14842 #   define S_IROTH (S_IRUSR>>6)
14843 #   define S_IWOTH (S_IWUSR>>6)
14844 #   define S_IXOTH (S_IXUSR>>6)
14845 #endif
14846 #ifndef S_IRWXU
14847 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
14848 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
14849 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
14850 #endif
14851 END
14852
14853     $cat > try.c <<END
14854 #include <sys/types.h>
14855 #include <sys/ipc.h>
14856 #include <sys/sem.h>
14857 #include <sys/stat.h>
14858 #include <stdio.h>
14859 #include <errno.h>
14860 #include "try.h"
14861 #ifndef errno
14862 extern int errno;
14863 #endif
14864 #$d_union_semun HAS_UNION_SEMUN
14865 int main() {
14866     union semun
14867 #ifndef HAS_UNION_SEMUN
14868     {
14869         int val;
14870         struct semid_ds *buf;
14871         unsigned short *array;
14872     }
14873 #endif
14874     arg;
14875     int sem, st;
14876
14877 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
14878     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14879     if (sem > -1) {
14880         struct semid_ds argbuf;
14881         arg.buf = &argbuf;
14882 #       ifdef IPC_STAT
14883         st = semctl(sem, 0, IPC_STAT, arg);
14884         if (st == 0)
14885             printf("semun\n");
14886         else
14887 #       endif /* IPC_STAT */
14888             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14889 #       ifdef IPC_RMID
14890         if (semctl(sem, 0, IPC_RMID, arg) != 0)
14891 #       endif /* IPC_RMID */
14892             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14893     } else
14894 #endif /* IPC_PRIVATE && ... */
14895         printf("semget failed: errno = %d\n", errno);
14896   return 0;
14897 }
14898 END
14899     val="$undef"
14900     set try
14901     if eval $compile; then
14902         xxx=`$run ./try`
14903         case "$xxx" in
14904         semun) val="$define" ;;
14905         esac
14906     fi
14907     $rm -f try try.c
14908     set d_semctl_semun
14909     eval $setvar
14910     case "$d_semctl_semun" in
14911     $define)
14912         echo "You can use union semun for semctl IPC_STAT." >&4
14913         also='also'
14914         ;;
14915     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
14916         also=''
14917         ;;
14918     esac
14919
14920     : see whether semctl IPC_STAT can use struct semid_ds pointer
14921     $cat > try.c <<'END'
14922 #include <sys/types.h>
14923 #include <sys/ipc.h>
14924 #include <sys/sem.h>
14925 #include <sys/stat.h>
14926 #include "try.h"
14927 #include <stdio.h>
14928 #include <errno.h>
14929 #ifndef errno
14930 extern int errno;
14931 #endif
14932 int main() {
14933     struct semid_ds arg;
14934     int sem, st;
14935
14936 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
14937     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
14938     if (sem > -1) {
14939 #       ifdef IPC_STAT
14940         st = semctl(sem, 0, IPC_STAT, &arg);
14941         if (st == 0)
14942             printf("semid_ds\n");
14943         else
14944 #       endif /* IPC_STAT */
14945             printf("semctl IPC_STAT failed: errno = %d\n", errno);
14946 #       ifdef IPC_RMID
14947         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
14948 #       endif /* IPC_RMID */
14949             printf("semctl IPC_RMID failed: errno = %d\n", errno);
14950     } else
14951 #endif /* IPC_PRIVATE && ... */
14952         printf("semget failed: errno = %d\n", errno);
14953
14954     return 0;
14955 }
14956 END
14957     val="$undef"
14958     set try
14959     if eval $compile; then
14960         xxx=`$run ./try`
14961         case "$xxx" in
14962         semid_ds) val="$define" ;;
14963         esac
14964     fi
14965     $rm -f try try.c
14966     set d_semctl_semid_ds
14967     eval $setvar
14968     case "$d_semctl_semid_ds" in
14969     $define)
14970         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
14971         ;;
14972     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
14973         ;;
14974     esac
14975     $rm -f try.h
14976     ;;
14977 *)  val="$undef"
14978
14979     # We do not have the full sem*(2) library, so assume we can not
14980     # use either.
14981
14982     set d_semctl_semun
14983     eval $setvar
14984
14985     set d_semctl_semid_ds
14986     eval $setvar
14987     ;;
14988 esac
14989
14990 : see if sendmsg exists
14991 set sendmsg d_sendmsg
14992 eval $inlibc
14993
14994 : see if setegid exists
14995 set setegid d_setegid
14996 eval $inlibc
14997
14998 : see if seteuid exists
14999 set seteuid d_seteuid
15000 eval $inlibc
15001
15002 : see if setgrent exists
15003 set setgrent d_setgrent
15004 eval $inlibc
15005
15006 : see if setgrent_r exists
15007 set setgrent_r d_setgrent_r
15008 eval $inlibc
15009 case "$d_setgrent_r" in
15010 "$define")
15011         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15012         case "$d_setgrent_r_proto:$usethreads" in
15013         ":define")      d_setgrent_r_proto=define
15014                 set d_setgrent_r_proto setgrent_r $hdrs
15015                 eval $hasproto ;;
15016         *)      ;;
15017         esac
15018         case "$d_setgrent_r_proto" in
15019         define)
15020         case "$setgrent_r_proto" in
15021         ''|0) try='int setgrent_r(FILE**);'
15022         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15023         esac
15024         case "$setgrent_r_proto" in
15025         ''|0) try='void setgrent_r(FILE**);'
15026         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15027         esac
15028         case "$setgrent_r_proto" in
15029         ''|0)   d_setgrent_r=undef
15030                 setgrent_r_proto=0
15031                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15032         * )     case "$setgrent_r_proto" in
15033                 REENTRANT_PROTO*) ;;
15034                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15035                 esac
15036                 echo "Prototype: $try" ;;
15037         esac
15038         ;;
15039         *)      case "$usethreads" in
15040                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15041                 esac
15042                 d_setgrent_r=undef
15043                 setgrent_r_proto=0
15044                 ;;
15045         esac
15046         ;;
15047 *)      setgrent_r_proto=0
15048         ;;
15049 esac
15050
15051 : see if sethostent exists
15052 set sethostent d_sethent
15053 eval $inlibc
15054
15055 : see if sethostent_r exists
15056 set sethostent_r d_sethostent_r
15057 eval $inlibc
15058 case "$d_sethostent_r" in
15059 "$define")
15060         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15061         case "$d_sethostent_r_proto:$usethreads" in
15062         ":define")      d_sethostent_r_proto=define
15063                 set d_sethostent_r_proto sethostent_r $hdrs
15064                 eval $hasproto ;;
15065         *)      ;;
15066         esac
15067         case "$d_sethostent_r_proto" in
15068         define)
15069         case "$sethostent_r_proto" in
15070         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15071         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15072         esac
15073         case "$sethostent_r_proto" in
15074         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15075         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15076         esac
15077         case "$sethostent_r_proto" in
15078         ''|0)   d_sethostent_r=undef
15079                 sethostent_r_proto=0
15080                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15081         * )     case "$sethostent_r_proto" in
15082                 REENTRANT_PROTO*) ;;
15083                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15084                 esac
15085                 echo "Prototype: $try" ;;
15086         esac
15087         ;;
15088         *)      case "$usethreads" in
15089                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15090                 esac
15091                 d_sethostent_r=undef
15092                 sethostent_r_proto=0
15093                 ;;
15094         esac
15095         ;;
15096 *)      sethostent_r_proto=0
15097         ;;
15098 esac
15099
15100 : see if setitimer exists
15101 set setitimer d_setitimer
15102 eval $inlibc
15103
15104 : see if setlinebuf exists
15105 set setlinebuf d_setlinebuf
15106 eval $inlibc
15107
15108 : see if setlocale exists
15109 set setlocale d_setlocale
15110 eval $inlibc
15111
15112 : see if locale.h is available
15113 set locale.h i_locale
15114 eval $inhdr
15115
15116 : see if setlocale_r exists
15117 set setlocale_r d_setlocale_r
15118 eval $inlibc
15119 case "$d_setlocale_r" in
15120 "$define")
15121         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15122         case "$d_setlocale_r_proto:$usethreads" in
15123         ":define")      d_setlocale_r_proto=define
15124                 set d_setlocale_r_proto setlocale_r $hdrs
15125                 eval $hasproto ;;
15126         *)      ;;
15127         esac
15128         case "$d_setlocale_r_proto" in
15129         define)
15130         case "$setlocale_r_proto" in
15131         ''|0) try='int setlocale_r(int, const char*, char*, int);'
15132         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
15133         esac
15134         case "$setlocale_r_proto" in
15135         ''|0)   d_setlocale_r=undef
15136                 setlocale_r_proto=0
15137                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
15138         * )     case "$setlocale_r_proto" in
15139                 REENTRANT_PROTO*) ;;
15140                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
15141                 esac
15142                 echo "Prototype: $try" ;;
15143         esac
15144         ;;
15145         *)      case "$usethreads" in
15146                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
15147                 esac
15148                 d_setlocale_r=undef
15149                 setlocale_r_proto=0
15150                 ;;
15151         esac
15152         ;;
15153 *)      setlocale_r_proto=0
15154         ;;
15155 esac
15156
15157 : see if setnetent exists
15158 set setnetent d_setnent
15159 eval $inlibc
15160
15161 : see if setnetent_r exists
15162 set setnetent_r d_setnetent_r
15163 eval $inlibc
15164 case "$d_setnetent_r" in
15165 "$define")
15166         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15167         case "$d_setnetent_r_proto:$usethreads" in
15168         ":define")      d_setnetent_r_proto=define
15169                 set d_setnetent_r_proto setnetent_r $hdrs
15170                 eval $hasproto ;;
15171         *)      ;;
15172         esac
15173         case "$d_setnetent_r_proto" in
15174         define)
15175         case "$setnetent_r_proto" in
15176         ''|0) try='int setnetent_r(int, struct netent_data*);'
15177         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
15178         esac
15179         case "$setnetent_r_proto" in
15180         ''|0) try='void setnetent_r(int, struct netent_data*);'
15181         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
15182         esac
15183         case "$setnetent_r_proto" in
15184         ''|0)   d_setnetent_r=undef
15185                 setnetent_r_proto=0
15186                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
15187         * )     case "$setnetent_r_proto" in
15188                 REENTRANT_PROTO*) ;;
15189                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
15190                 esac
15191                 echo "Prototype: $try" ;;
15192         esac
15193         ;;
15194         *)      case "$usethreads" in
15195                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
15196                 esac
15197                 d_setnetent_r=undef
15198                 setnetent_r_proto=0
15199                 ;;
15200         esac
15201         ;;
15202 *)      setnetent_r_proto=0
15203         ;;
15204 esac
15205
15206 : see if setprotoent exists
15207 set setprotoent d_setpent
15208 eval $inlibc
15209
15210 : see if setpgid exists
15211 set setpgid d_setpgid
15212 eval $inlibc
15213
15214 : see if setpgrp2 exists
15215 set setpgrp2 d_setpgrp2
15216 eval $inlibc
15217
15218 : see if setpriority exists
15219 set setpriority d_setprior
15220 eval $inlibc
15221
15222 : see if setproctitle exists
15223 set setproctitle d_setproctitle
15224 eval $inlibc
15225
15226 : see if setprotoent_r exists
15227 set setprotoent_r d_setprotoent_r
15228 eval $inlibc
15229 case "$d_setprotoent_r" in
15230 "$define")
15231         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15232         case "$d_setprotoent_r_proto:$usethreads" in
15233         ":define")      d_setprotoent_r_proto=define
15234                 set d_setprotoent_r_proto setprotoent_r $hdrs
15235                 eval $hasproto ;;
15236         *)      ;;
15237         esac
15238         case "$d_setprotoent_r_proto" in
15239         define)
15240         case "$setprotoent_r_proto" in
15241         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
15242         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
15243         esac
15244         case "$setprotoent_r_proto" in
15245         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
15246         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
15247         esac
15248         case "$setprotoent_r_proto" in
15249         ''|0)   d_setprotoent_r=undef
15250                 setprotoent_r_proto=0
15251                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
15252         * )     case "$setprotoent_r_proto" in
15253                 REENTRANT_PROTO*) ;;
15254                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
15255                 esac
15256                 echo "Prototype: $try" ;;
15257         esac
15258         ;;
15259         *)      case "$usethreads" in
15260                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
15261                 esac
15262                 d_setprotoent_r=undef
15263                 setprotoent_r_proto=0
15264                 ;;
15265         esac
15266         ;;
15267 *)      setprotoent_r_proto=0
15268         ;;
15269 esac
15270
15271 : see if setpwent exists
15272 set setpwent d_setpwent
15273 eval $inlibc
15274
15275 : see if setpwent_r exists
15276 set setpwent_r d_setpwent_r
15277 eval $inlibc
15278 case "$d_setpwent_r" in
15279 "$define")
15280         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
15281         case "$d_setpwent_r_proto:$usethreads" in
15282         ":define")      d_setpwent_r_proto=define
15283                 set d_setpwent_r_proto setpwent_r $hdrs
15284                 eval $hasproto ;;
15285         *)      ;;
15286         esac
15287         case "$d_setpwent_r_proto" in
15288         define)
15289         case "$setpwent_r_proto" in
15290         ''|0) try='int setpwent_r(FILE**);'
15291         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
15292         esac
15293         case "$setpwent_r_proto" in
15294         ''|0) try='void setpwent_r(FILE**);'
15295         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
15296         esac
15297         case "$setpwent_r_proto" in
15298         ''|0)   d_setpwent_r=undef
15299                 setpwent_r_proto=0
15300                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
15301         * )     case "$setpwent_r_proto" in
15302                 REENTRANT_PROTO*) ;;
15303                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
15304                 esac
15305                 echo "Prototype: $try" ;;
15306         esac
15307         ;;
15308         *)      case "$usethreads" in
15309                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
15310                 esac
15311                 d_setpwent_r=undef
15312                 setpwent_r_proto=0
15313                 ;;
15314         esac
15315         ;;
15316 *)      setpwent_r_proto=0
15317         ;;
15318 esac
15319
15320 : see if setregid exists
15321 set setregid d_setregid
15322 eval $inlibc
15323 set setresgid d_setresgid
15324 eval $inlibc
15325
15326 : see if setreuid exists
15327 set setreuid d_setreuid
15328 eval $inlibc
15329 set setresuid d_setresuid
15330 eval $inlibc
15331
15332 : see if setrgid exists
15333 set setrgid d_setrgid
15334 eval $inlibc
15335
15336 : see if setruid exists
15337 set setruid d_setruid
15338 eval $inlibc
15339
15340 : see if setservent exists
15341 set setservent d_setsent
15342 eval $inlibc
15343
15344 : see if setservent_r exists
15345 set setservent_r d_setservent_r
15346 eval $inlibc
15347 case "$d_setservent_r" in
15348 "$define")
15349         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15350         case "$d_setservent_r_proto:$usethreads" in
15351         ":define")      d_setservent_r_proto=define
15352                 set d_setservent_r_proto setservent_r $hdrs
15353                 eval $hasproto ;;
15354         *)      ;;
15355         esac
15356         case "$d_setservent_r_proto" in
15357         define)
15358         case "$setservent_r_proto" in
15359         ''|0) try='int setservent_r(int, struct servent_data*);'
15360         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
15361         esac
15362         case "$setservent_r_proto" in
15363         ''|0) try='void setservent_r(int, struct servent_data*);'
15364         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
15365         esac
15366         case "$setservent_r_proto" in
15367         ''|0)   d_setservent_r=undef
15368                 setservent_r_proto=0
15369                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
15370         * )     case "$setservent_r_proto" in
15371                 REENTRANT_PROTO*) ;;
15372                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
15373                 esac
15374                 echo "Prototype: $try" ;;
15375         esac
15376         ;;
15377         *)      case "$usethreads" in
15378                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
15379                 esac
15380                 d_setservent_r=undef
15381                 setservent_r_proto=0
15382                 ;;
15383         esac
15384         ;;
15385 *)      setservent_r_proto=0
15386         ;;
15387 esac
15388
15389 : see if setsid exists
15390 set setsid d_setsid
15391 eval $inlibc
15392
15393 : see if setvbuf exists
15394 set setvbuf d_setvbuf
15395 eval $inlibc
15396
15397 : see if sfio.h is available
15398 set sfio.h i_sfio
15399 eval $inhdr
15400
15401
15402 : see if sfio library is available
15403 case "$i_sfio" in
15404 $define)
15405         val=''
15406         set sfreserve val
15407         eval $inlibc
15408         ;;
15409 *)
15410         val="$undef"
15411         ;;
15412 esac
15413 : Ok, but do we want to use it.
15414 case "$val" in
15415 $define)
15416         case "$usesfio" in
15417         true|$define|[yY]*) dflt='y';;
15418         *) dflt='n';;
15419         esac
15420         echo "$package can use the sfio library, but it is experimental."
15421         case "$useperlio" in
15422         "$undef")
15423             echo "For sfio also the PerlIO abstraction layer is needed."
15424             echo "Earlier you said you wouldn't want that."
15425             ;;
15426         esac
15427         rp="You seem to have sfio available, do you want to try using it?"
15428         . ./myread
15429         case "$ans" in
15430         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
15431                 useperlio="$define"
15432                 val="$define"
15433                 ;;
15434         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
15435                 val="$undef"
15436                 ;;
15437         esac
15438         ;;
15439 *)      case "$usesfio" in
15440         true|$define|[yY]*)
15441                 echo "Sorry, cannot find sfio on this machine." >&4
15442                 echo "Ignoring your setting of usesfio=$usesfio." >&4
15443                 val="$undef"
15444                 ;;
15445         esac
15446         ;;
15447 esac
15448 set d_sfio
15449 eval $setvar
15450 case "$d_sfio" in
15451 $define) usesfio='true';;
15452 *) usesfio='false';;
15453 esac
15454 case "$d_sfio" in
15455 $define) ;;
15456 *)      : Remove sfio from list of libraries to use
15457         case "$libs" in
15458         *-lsfio*)
15459                 echo "Removing unneeded -lsfio from library list" >&4
15460                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
15461                 shift
15462                 libs="$*"
15463                 echo "libs = $libs" >&4
15464                 ;;
15465         esac
15466 ;;
15467 esac
15468
15469
15470 : see if shmctl exists
15471 set shmctl d_shmctl
15472 eval $inlibc
15473
15474 : see if shmget exists
15475 set shmget d_shmget
15476 eval $inlibc
15477
15478 : see if shmat exists
15479 set shmat d_shmat
15480 eval $inlibc
15481 : see what shmat returns
15482 case "$d_shmat" in
15483 "$define")
15484         $cat >shmat.c <<'END'
15485 #include <sys/shm.h>
15486 void *shmat();
15487 END
15488         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
15489                 shmattype='void *'
15490         else
15491                 shmattype='char *'
15492         fi
15493         echo "and it returns ($shmattype)." >&4
15494         : see if a prototype for shmat is available
15495         xxx=`./findhdr sys/shm.h`
15496         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
15497         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
15498                 val="$define"
15499         else
15500                 val="$undef"
15501         fi
15502         $rm -f shmat.[co]
15503         ;;
15504 *)
15505         val="$undef"
15506         ;;
15507 esac
15508 set d_shmatprototype
15509 eval $setvar
15510
15511 : see if shmdt exists
15512 set shmdt d_shmdt
15513 eval $inlibc
15514
15515 : see how much of the 'shm*(2)' library is present.
15516 h_shm=true
15517 echo " "
15518 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
15519 *"$undef"*) h_shm=false;;
15520 esac
15521 case "$osname" in
15522 freebsd)
15523     case "`ipcs 2>&1`" in
15524     "SVID shared memory"*"not configured"*)
15525         echo "Your $osname does not have the shm*(2) configured." >&4
15526         h_shm=false
15527         val="$undef"
15528         set shmctl d_shmctl
15529         evat $setvar
15530         set shmget d_shmget
15531         evat $setvar
15532         set shmat d_shmat
15533         evat $setvar
15534         set shmdt d_shmdt
15535         evat $setvar
15536         ;;
15537     esac
15538     ;;
15539 esac
15540 : we could also check for sys/ipc.h ...
15541 if $h_shm && $test `./findhdr sys/shm.h`; then
15542         echo "You have the full shm*(2) library." >&4
15543         val="$define"
15544 else
15545         echo "You don't have the full shm*(2) library." >&4
15546         val="$undef"
15547 fi
15548 set d_shm
15549 eval $setvar
15550
15551 echo " "
15552 : see if we have sigaction
15553 if set sigaction val -f d_sigaction; eval $csym; $val; then
15554         echo 'sigaction() found.' >&4
15555         $cat > try.c <<EOP
15556 #include <stdio.h>
15557 #include <sys/types.h>
15558 #include <signal.h>
15559 #$i_stdlib I_STDLIB
15560 #ifdef I_STDLIB
15561 #include <stdlib.h>
15562 #endif
15563 int main()
15564 {
15565     struct sigaction act, oact;
15566     act.sa_flags = 0;
15567     oact.sa_handler = 0;
15568     /* so that act and oact are used */
15569     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
15570 }
15571 EOP
15572         set try
15573         if eval $compile_ok; then
15574                 val="$define"
15575         else
15576                 echo "But you don't seem to have a useable struct sigaction." >&4
15577                 val="$undef"
15578         fi
15579 else
15580         echo 'sigaction NOT found.' >&4
15581         val="$undef"
15582 fi
15583 set d_sigaction; eval $setvar
15584 $rm -f try try$_o try.c
15585
15586 : see if sigprocmask exists
15587 set sigprocmask d_sigprocmask
15588 eval $inlibc
15589
15590 : see if sigsetjmp exists
15591 echo " "
15592 case "$d_sigsetjmp" in
15593 '')
15594         $cat >try.c <<EOP
15595 #include <setjmp.h>
15596 #$i_stdlib I_STDLIB
15597 #ifdef I_STDLIB
15598 #include <stdlib.h>
15599 #endif
15600 sigjmp_buf env;
15601 int set = 1;
15602 int main()
15603 {
15604         if (sigsetjmp(env,1))
15605                 exit(set);
15606         set = 0;
15607         siglongjmp(env, 1);
15608         exit(1);
15609 }
15610 EOP
15611         set try
15612         if eval $compile; then
15613                 if $run ./try >/dev/null 2>&1; then
15614                         echo "POSIX sigsetjmp found." >&4
15615                         val="$define"
15616                 else
15617                         $cat >&4 <<EOM
15618 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
15619 I'll ignore them.
15620 EOM
15621                         val="$undef"
15622                 fi
15623         else
15624                 echo "sigsetjmp not found." >&4
15625                 val="$undef"
15626         fi
15627         ;;
15628 *) val="$d_sigsetjmp"
15629         case "$d_sigsetjmp" in
15630         $define) echo "POSIX sigsetjmp found." >&4;;
15631         $undef) echo "sigsetjmp not found." >&4;;
15632         esac
15633         ;;
15634 esac
15635 set d_sigsetjmp
15636 eval $setvar
15637 $rm -f try.c try
15638
15639 : see if sockatmark exists
15640 set sockatmark d_sockatmark
15641 eval $inlibc
15642
15643 : see if prototype for sockatmark is available
15644 echo " "
15645 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
15646 eval $hasproto
15647
15648 : see if socks5_init exists
15649 set socks5_init d_socks5_init
15650 eval $inlibc
15651
15652 : see if srand48_r exists
15653 set srand48_r d_srand48_r
15654 eval $inlibc
15655 case "$d_srand48_r" in
15656 "$define")
15657         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15658         case "$d_srand48_r_proto:$usethreads" in
15659         ":define")      d_srand48_r_proto=define
15660                 set d_srand48_r_proto srand48_r $hdrs
15661                 eval $hasproto ;;
15662         *)      ;;
15663         esac
15664         case "$d_srand48_r_proto" in
15665         define)
15666         case "$srand48_r_proto" in
15667         ''|0) try='int srand48_r(long, struct drand48_data*);'
15668         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
15669         esac
15670         case "$srand48_r_proto" in
15671         ''|0)   d_srand48_r=undef
15672                 srand48_r_proto=0
15673                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
15674         * )     case "$srand48_r_proto" in
15675                 REENTRANT_PROTO*) ;;
15676                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
15677                 esac
15678                 echo "Prototype: $try" ;;
15679         esac
15680         ;;
15681         *)      case "$usethreads" in
15682                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
15683                 esac
15684                 d_srand48_r=undef
15685                 srand48_r_proto=0
15686                 ;;
15687         esac
15688         ;;
15689 *)      srand48_r_proto=0
15690         ;;
15691 esac
15692
15693 : see if srandom_r exists
15694 set srandom_r d_srandom_r
15695 eval $inlibc
15696 case "$d_srandom_r" in
15697 "$define")
15698         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15699         case "$d_srandom_r_proto:$usethreads" in
15700         ":define")      d_srandom_r_proto=define
15701                 set d_srandom_r_proto srandom_r $hdrs
15702                 eval $hasproto ;;
15703         *)      ;;
15704         esac
15705         case "$d_srandom_r_proto" in
15706         define)
15707         case "$srandom_r_proto" in
15708         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
15709         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
15710         esac
15711         case "$srandom_r_proto" in
15712         ''|0)   d_srandom_r=undef
15713                 srandom_r_proto=0
15714                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
15715         * )     case "$srandom_r_proto" in
15716                 REENTRANT_PROTO*) ;;
15717                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
15718                 esac
15719                 echo "Prototype: $try" ;;
15720         esac
15721         ;;
15722         *)      case "$usethreads" in
15723                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
15724                 esac
15725                 d_srandom_r=undef
15726                 srandom_r_proto=0
15727                 ;;
15728         esac
15729         ;;
15730 *)      srandom_r_proto=0
15731         ;;
15732 esac
15733
15734 : see if prototype for setresgid is available
15735 echo " "
15736 set d_sresgproto setresgid $i_unistd unistd.h
15737 eval $hasproto
15738
15739 : see if prototype for setresuid is available
15740 echo " "
15741 set d_sresuproto setresuid $i_unistd unistd.h
15742 eval $hasproto
15743
15744 : see if sys/stat.h is available
15745 set sys/stat.h i_sysstat
15746 eval $inhdr
15747
15748
15749 : see if stat knows about block sizes
15750 echo " "
15751 echo "Checking to see if your struct stat has st_blocks field..." >&4
15752 set d_statblks stat st_blocks $i_sysstat sys/stat.h
15753 eval $hasfield
15754
15755
15756 : see if this is a sys/vfs.h system
15757 set sys/vfs.h i_sysvfs
15758 eval $inhdr
15759
15760
15761 : see if this is a sys/statfs.h system
15762 set sys/statfs.h i_sysstatfs
15763 eval $inhdr
15764
15765
15766 echo " "
15767 echo "Checking to see if your system supports struct statfs..." >&4
15768 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
15769 eval $hasstruct
15770 case "$d_statfs_s" in
15771 "$define")      echo "Yes, it does."   ;;
15772 *)              echo "No, it doesn't." ;;
15773 esac
15774
15775
15776
15777 : see if struct statfs knows about f_flags
15778 case "$d_statfs_s" in
15779 define) 
15780         echo " "
15781         echo "Checking to see if your struct statfs has f_flags field..." >&4
15782         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
15783         eval $hasfield
15784         ;;
15785 *)      val="$undef"
15786         set d_statfs_f_flags
15787         eval $setvar
15788         ;;
15789 esac
15790 case "$d_statfs_f_flags" in
15791 "$define")      echo "Yes, it does."   ;;
15792 *)              echo "No, it doesn't." ;;
15793 esac
15794
15795 : see if _ptr and _cnt from stdio act std
15796 echo " "
15797
15798 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
15799         echo "(Looks like you have stdio.h from BSD.)"
15800         case "$stdio_ptr" in
15801         '') stdio_ptr='((fp)->_p)'
15802                 ptr_lval=$define
15803                 ;;
15804         *)      ptr_lval=$d_stdio_ptr_lval;;
15805         esac
15806         case "$stdio_cnt" in
15807         '') stdio_cnt='((fp)->_r)'
15808                 cnt_lval=$define
15809                 ;;
15810         *)      cnt_lval=$d_stdio_cnt_lval;;
15811         esac
15812         case "$stdio_base" in
15813         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
15814         esac
15815         case "$stdio_bufsiz" in
15816         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
15817         esac
15818 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
15819         echo "(Looks like you have stdio.h from Linux.)"
15820         case "$stdio_ptr" in
15821         '') stdio_ptr='((fp)->_IO_read_ptr)'
15822                 ptr_lval=$define
15823                 ;;
15824         *)      ptr_lval=$d_stdio_ptr_lval;;
15825         esac
15826         case "$stdio_cnt" in
15827         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
15828                 cnt_lval=$undef
15829                 ;;
15830         *)      cnt_lval=$d_stdio_cnt_lval;;
15831         esac
15832         case "$stdio_base" in
15833         '') stdio_base='((fp)->_IO_read_base)';;
15834         esac
15835         case "$stdio_bufsiz" in
15836         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
15837         esac
15838 else
15839         case "$stdio_ptr" in
15840         '') stdio_ptr='((fp)->_ptr)'
15841                 ptr_lval=$define
15842                 ;;
15843         *)      ptr_lval=$d_stdio_ptr_lval;;
15844         esac
15845         case "$stdio_cnt" in
15846         '') stdio_cnt='((fp)->_cnt)'
15847                 cnt_lval=$define
15848                 ;;
15849         *)      cnt_lval=$d_stdio_cnt_lval;;
15850         esac
15851         case "$stdio_base" in
15852         '') stdio_base='((fp)->_base)';;
15853         esac
15854         case "$stdio_bufsiz" in
15855         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
15856         esac
15857 fi
15858
15859 : test whether _ptr and _cnt really work
15860 echo "Checking how std your stdio is..." >&4
15861 $cat >try.c <<EOP
15862 #include <stdio.h>
15863 #define FILE_ptr(fp)    $stdio_ptr
15864 #define FILE_cnt(fp)    $stdio_cnt
15865 int main() {
15866         FILE *fp = fopen("try.c", "r");
15867         char c = getc(fp);
15868         if (
15869                 18 <= FILE_cnt(fp) &&
15870                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15871         )
15872                 exit(0);
15873         exit(1);
15874 }
15875 EOP
15876 val="$undef"
15877 set try
15878 if eval $compile && $to try.c; then
15879         if $run ./try; then
15880                 echo "Your stdio acts pretty std."
15881                 val="$define"
15882         else
15883                 echo "Your stdio isn't very std."
15884         fi
15885 else
15886         echo "Your stdio doesn't appear very std."
15887 fi
15888 $rm -f try.c try
15889
15890 # glibc 2.2.90 and above apparently change stdio streams so Perl's
15891 # direct buffer manipulation no longer works.  The Configure tests
15892 # should be changed to correctly detect this, but until then,
15893 # the following check should at least let perl compile and run.
15894 # (This quick fix should be updated before 5.8.1.)
15895 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
15896 # A. Dougherty, June 3, 2002.
15897 case "$d_gnulibc" in
15898 $define)
15899         case "$gnulibc_version" in
15900         2.[01]*)  ;;
15901         2.2) ;;
15902         2.2.[0-9]) ;;
15903         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
15904                 val="$undef"
15905                 ;;
15906         esac
15907         ;;
15908 esac
15909 set d_stdstdio
15910 eval $setvar
15911
15912 : Can _ptr be used as an lvalue?
15913 case "$d_stdstdio$ptr_lval" in
15914 $define$define) val=$define ;;
15915 *) val=$undef ;;
15916 esac
15917 set d_stdio_ptr_lval
15918 eval $setvar
15919
15920 : Can _cnt be used as an lvalue?
15921 case "$d_stdstdio$cnt_lval" in
15922 $define$define) val=$define ;;
15923 *) val=$undef ;;
15924 esac
15925 set d_stdio_cnt_lval
15926 eval $setvar
15927
15928
15929 : test whether setting _ptr sets _cnt as a side effect
15930 d_stdio_ptr_lval_sets_cnt="$undef"
15931 d_stdio_ptr_lval_nochange_cnt="$undef"
15932 case "$d_stdio_ptr_lval$d_stdstdio" in
15933 $define$define)
15934         echo "Checking to see what happens if we set the stdio ptr..." >&4
15935 $cat >try.c <<EOP
15936 #include <stdio.h>
15937 /* Can we scream? */
15938 /* Eat dust sed :-) */
15939 /* In the buffer space, no one can hear you scream. */
15940 #define FILE_ptr(fp)    $stdio_ptr
15941 #define FILE_cnt(fp)    $stdio_cnt
15942 #include <sys/types.h>
15943 int main() {
15944         FILE *fp = fopen("try.c", "r");
15945         int c;
15946         char *ptr;
15947         size_t cnt;
15948         if (!fp) {
15949             puts("Fail even to read");
15950             exit(1);
15951         }
15952         c = getc(fp); /* Read away the first # */
15953         if (c == EOF) {
15954             puts("Fail even to read");
15955             exit(1);
15956         }
15957         if (!(
15958                 18 <= FILE_cnt(fp) &&
15959                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
15960         )) {
15961                 puts("Fail even to read");
15962                 exit (1);
15963         }
15964         ptr = (char*) FILE_ptr(fp);
15965         cnt = (size_t)FILE_cnt(fp);
15966
15967         FILE_ptr(fp) += 42;
15968
15969         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
15970                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
15971                 exit (1);
15972         }
15973         if (FILE_cnt(fp) <= 20) {
15974                 printf ("Fail (<20 chars to test)");
15975                 exit (1);
15976         }
15977         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
15978                 puts("Fail compare");
15979                 exit (1);
15980         }
15981         if (cnt == FILE_cnt(fp)) {
15982                 puts("Pass_unchanged");
15983                 exit (0);
15984         }       
15985         if (FILE_cnt(fp) == (cnt - 42)) {
15986                 puts("Pass_changed");
15987                 exit (0);
15988         }
15989         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
15990         return 1;
15991
15992 }
15993 EOP
15994         set try
15995         if eval $compile && $to try.c; then
15996                 case `$run ./try` in
15997                 Pass_changed)
15998                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
15999                         d_stdio_ptr_lval_sets_cnt="$define" ;;
16000                 Pass_unchanged)
16001                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
16002                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
16003                 Fail*)
16004                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
16005                 *)
16006                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
16007         esac
16008         else
16009                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
16010         fi
16011         $rm -f try.c try
16012         ;;
16013 esac
16014
16015 : see if _base is also standard
16016 val="$undef"
16017 case "$d_stdstdio" in
16018 $define)
16019         $cat >try.c <<EOP
16020 #include <stdio.h>
16021 #define FILE_base(fp)   $stdio_base
16022 #define FILE_bufsiz(fp) $stdio_bufsiz
16023 int main() {
16024         FILE *fp = fopen("try.c", "r");
16025         char c = getc(fp);
16026         if (
16027                 19 <= FILE_bufsiz(fp) &&
16028                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
16029         )
16030                 exit(0);
16031         exit(1);
16032 }
16033 EOP
16034         set try
16035         if eval $compile && $to try.c; then
16036                 if $run ./try; then
16037                         echo "And its _base field acts std."
16038                         val="$define"
16039                 else
16040                         echo "But its _base field isn't std."
16041                 fi
16042         else
16043                 echo "However, it seems to be lacking the _base field."
16044         fi
16045         $rm -f try.c try
16046         ;;
16047 esac
16048 set d_stdiobase
16049 eval $setvar
16050
16051 $cat >&4 <<EOM
16052 Checking how to access stdio streams by file descriptor number...
16053 EOM
16054 case "$stdio_stream_array" in
16055 '')     $cat >try.c <<EOCP
16056 #include <stdio.h>
16057 int main() {
16058   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16059     printf("yes\n");
16060 }
16061 EOCP
16062         for s in _iob __iob __sF
16063         do
16064                 set try -DSTDIO_STREAM_ARRAY=$s
16065                 if eval $compile; then
16066                         case "`$run ./try`" in
16067                         yes)    stdio_stream_array=$s; break ;;
16068                         esac
16069                 fi
16070         done
16071         $rm -f try.* try$exe_ext
16072 esac
16073 case "$stdio_stream_array" in
16074 '')     $cat >&4 <<EOM
16075 I can't figure out how to access stdio streams by file descriptor number.
16076 EOM
16077         d_stdio_stream_array="$undef"
16078         ;;
16079 *)      $cat >&4 <<EOM
16080 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16081 EOM
16082         d_stdio_stream_array="$define"
16083         ;;
16084 esac
16085
16086 : see if strcoll exists
16087 set strcoll d_strcoll
16088 eval $inlibc
16089
16090 : check for structure copying
16091 echo " "
16092 echo "Checking to see if your C compiler can copy structs..." >&4
16093 $cat >try.c <<'EOCP'
16094 int main()
16095 {
16096         struct blurfl {
16097                 int dyick;
16098         } foo, bar;
16099
16100         foo = bar;
16101 }
16102 EOCP
16103 if $cc -c try.c >/dev/null 2>&1 ; then
16104         val="$define"
16105         echo "Yup, it can."
16106 else
16107         val="$undef"
16108         echo "Nope, it can't."
16109 fi
16110 set d_strctcpy
16111 eval $setvar
16112 $rm -f try.*
16113
16114 : see if strerror and/or sys_errlist[] exist
16115 echo " "
16116 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16117     if set strerror val -f d_strerror; eval $csym; $val; then
16118                 echo 'strerror() found.' >&4
16119                 d_strerror="$define"
16120                 d_strerrm='strerror(e)'
16121                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16122                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16123                         d_syserrlst="$define"
16124                 else
16125                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16126                         d_syserrlst="$undef"
16127                 fi
16128     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16129                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16130                 echo 'strerror() found in string header.' >&4
16131                 d_strerror="$define"
16132                 d_strerrm='strerror(e)'
16133                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16134                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16135                                 d_syserrlst="$define"
16136                 else
16137                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16138                         d_syserrlst="$undef"
16139                 fi
16140     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16141                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16142                 d_strerror="$undef"
16143                 d_syserrlst="$define"
16144                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16145     else
16146                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16147                 d_strerror="$undef"
16148                 d_syserrlst="$undef"
16149                 d_strerrm='"unknown"'
16150     fi
16151 fi
16152
16153 : see if strerror_r exists
16154 set strerror_r d_strerror_r
16155 eval $inlibc
16156 case "$d_strerror_r" in
16157 "$define")
16158         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16159         case "$d_strerror_r_proto:$usethreads" in
16160         ":define")      d_strerror_r_proto=define
16161                 set d_strerror_r_proto strerror_r $hdrs
16162                 eval $hasproto ;;
16163         *)      ;;
16164         esac
16165         case "$d_strerror_r_proto" in
16166         define)
16167         case "$strerror_r_proto" in
16168         ''|0) try='int strerror_r(int, char*, size_t);'
16169         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16170         esac
16171         case "$strerror_r_proto" in
16172         ''|0) try='int strerror_r(int, char*, int);'
16173         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16174         esac
16175         case "$strerror_r_proto" in
16176         ''|0) try='char* strerror_r(int, char*, size_t);'
16177         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16178         esac
16179         case "$strerror_r_proto" in
16180         ''|0)   d_strerror_r=undef
16181                 strerror_r_proto=0
16182                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16183         * )     case "$strerror_r_proto" in
16184                 REENTRANT_PROTO*) ;;
16185                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16186                 esac
16187                 echo "Prototype: $try" ;;
16188         esac
16189         ;;
16190         *)      case "$usethreads" in
16191                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16192                 esac
16193                 d_strerror_r=undef
16194                 strerror_r_proto=0
16195                 ;;
16196         esac
16197         ;;
16198 *)      strerror_r_proto=0
16199         ;;
16200 esac
16201
16202 : see if strftime exists
16203 set strftime d_strftime
16204 eval $inlibc
16205
16206 : see if strtod exists
16207 set strtod d_strtod
16208 eval $inlibc
16209
16210 : see if strtol exists
16211 set strtol d_strtol
16212 eval $inlibc
16213
16214 : see if strtold exists
16215 set strtold d_strtold
16216 eval $inlibc
16217
16218 : see if strtoll exists
16219 set strtoll d_strtoll
16220 eval $inlibc
16221
16222 case "$d_longlong-$d_strtoll" in
16223 "$define-$define")
16224         $cat <<EOM
16225 Checking whether your strtoll() works okay...
16226 EOM
16227         $cat >try.c <<'EOCP'
16228 #include <errno.h>
16229 #ifdef __hpux
16230 #define strtoll __strtoll
16231 #endif
16232 #ifdef __EMX__
16233 #define strtoll _strtoll
16234 #endif
16235 #include <stdio.h>
16236 extern long long int strtoll(char *s, char **, int); 
16237 static int bad = 0;
16238 int check(char *s, long long ell, int een) {
16239         long long gll;
16240         errno = 0;
16241         gll = strtoll(s, 0, 10);
16242         if (!((gll == ell) && (errno == een)))
16243                 bad++;
16244 }
16245 int main() {
16246         check(" 1",                                      1LL, 0);
16247         check(" 0",                                      0LL, 0);
16248         check("-1",                                     -1LL, 0);
16249         check("-9223372036854775808", -9223372036854775808LL, 0);
16250         check("-9223372036854775808", -9223372036854775808LL, 0);
16251         check(" 9223372036854775807",  9223372036854775807LL, 0);
16252         check("-9223372036854775808", -9223372036854775808LL, 0);
16253         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
16254         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
16255         if (!bad)
16256                 printf("ok\n");
16257 }
16258 EOCP
16259         set try
16260         if eval $compile; then
16261                 yyy=`$run ./try`
16262                 case "$yyy" in
16263                 ok) echo "Your strtoll() seems to be working okay." ;;
16264                 *) cat <<EOM >&4
16265 Your strtoll() doesn't seem to be working okay.
16266 EOM
16267                    d_strtoll="$undef"
16268                    ;;
16269                 esac
16270         else
16271                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16272                 d_strtoll="$undef"
16273         fi
16274         ;;
16275 esac
16276
16277 : see if strtoq exists
16278 set strtoq d_strtoq
16279 eval $inlibc
16280
16281 : see if strtoul exists
16282 set strtoul d_strtoul
16283 eval $inlibc
16284
16285 case "$d_strtoul" in
16286 "$define")
16287         $cat <<EOM
16288 Checking whether your strtoul() works okay...
16289 EOM
16290         $cat >try.c <<'EOCP'
16291 #include <errno.h>
16292 #include <stdio.h>
16293 extern unsigned long int strtoul(char *s, char **, int); 
16294 static int bad = 0;
16295 void check(char *s, unsigned long eul, int een) {
16296         unsigned long gul;
16297         errno = 0;
16298         gul = strtoul(s, 0, 10);
16299         if (!((gul == eul) && (errno == een)))
16300                 bad++;
16301 }
16302 int main() {
16303         check(" 1", 1L, 0);
16304         check(" 0", 0L, 0);
16305 EOCP
16306         case "$longsize" in
16307         8)
16308             $cat >>try.c <<'EOCP'
16309         check("18446744073709551615", 18446744073709551615UL, 0);
16310         check("18446744073709551616", 18446744073709551615UL, ERANGE);
16311 #if 0 /* strtoul() for /^-/ strings is undefined. */
16312         check("-1", 18446744073709551615UL, 0);
16313         check("-18446744073709551614", 2, 0);
16314         check("-18446744073709551615", 1, 0);
16315         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
16316         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
16317 #endif
16318 EOCP
16319                 ;;
16320         4)
16321                     $cat >>try.c <<'EOCP'
16322         check("4294967295", 4294967295UL, 0);
16323         check("4294967296", 4294967295UL, ERANGE);
16324 #if 0 /* strtoul() for /^-/ strings is undefined. */
16325         check("-1", 4294967295UL, 0);
16326         check("-4294967294", 2, 0);
16327         check("-4294967295", 1, 0);
16328         check("-4294967296", 4294967295UL, ERANGE);
16329         check("-4294967297", 4294967295UL, ERANGE);
16330 #endif
16331 EOCP
16332                 ;;
16333         *)
16334 : Should we write these tests to be more portable by sprintf-ing
16335 : ~0 and then manipulating that char string as input for strtol?
16336                 ;;
16337         esac
16338         $cat >>try.c <<'EOCP'
16339         if (!bad)
16340                 printf("ok\n");
16341         return 0;
16342 }
16343 EOCP
16344         set try
16345         if eval $compile; then
16346                 case "`$run ./try`" in
16347                 ok) echo "Your strtoul() seems to be working okay." ;;
16348                 *) cat <<EOM >&4
16349 Your strtoul() doesn't seem to be working okay.
16350 EOM
16351                    d_strtoul="$undef"
16352                    ;;
16353                 esac
16354         fi
16355         ;;
16356 esac
16357
16358 : see if strtoull exists
16359 set strtoull d_strtoull
16360 eval $inlibc
16361
16362 case "$d_longlong-$d_strtoull" in
16363 "$define-$define")
16364         $cat <<EOM
16365 Checking whether your strtoull() works okay...
16366 EOM
16367         $cat >try.c <<'EOCP'
16368 #include <errno.h>
16369 #ifdef __hpux
16370 #define strtoull __strtoull
16371 #endif
16372 #include <stdio.h>
16373 extern unsigned long long int strtoull(char *s, char **, int); 
16374 static int bad = 0;
16375 int check(char *s, long long eull, int een) {
16376         long long gull;
16377         errno = 0;
16378         gull = strtoull(s, 0, 10);
16379         if (!((gull == eull) && (errno == een)))
16380                 bad++;
16381 }
16382 int main() {
16383         check(" 1",                                        1LL, 0);
16384         check(" 0",                                        0LL, 0);
16385         check("18446744073709551615",  18446744073709551615ULL, 0);
16386         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16387 #if 0 /* strtoull() for /^-/ strings is undefined. */
16388         check("-1",                    18446744073709551615ULL, 0);
16389         check("-18446744073709551614",                     2LL, 0);
16390         check("-18446744073709551615",                     1LL, 0);
16391         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16392         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16393 #endif
16394         if (!bad)
16395                 printf("ok\n");
16396 }
16397 EOCP
16398         set try
16399         if eval $compile; then
16400                 case "`$run ./try`" in
16401                 ok) echo "Your strtoull() seems to be working okay." ;;
16402                 *) cat <<EOM >&4
16403 Your strtoull() doesn't seem to be working okay.
16404 EOM
16405                    d_strtoull="$undef"
16406                    ;;
16407                 esac
16408         fi
16409         ;;
16410 esac
16411
16412 : see if strtouq exists
16413 set strtouq d_strtouq
16414 eval $inlibc
16415
16416 case "$d_strtouq" in
16417 "$define")
16418         $cat <<EOM
16419 Checking whether your strtouq() works okay...
16420 EOM
16421         $cat >try.c <<'EOCP'
16422 #include <errno.h>
16423 #include <stdio.h>
16424 extern unsigned long long int strtouq(char *s, char **, int); 
16425 static int bad = 0;
16426 void check(char *s, unsigned long long eull, int een) {
16427         unsigned long long gull;
16428         errno = 0;
16429         gull = strtouq(s, 0, 10);
16430         if (!((gull == eull) && (errno == een)))
16431                 bad++;
16432 }
16433 int main() {
16434         check(" 1",                                        1LL, 0);
16435         check(" 0",                                        0LL, 0);
16436         check("18446744073709551615",  18446744073709551615ULL, 0);
16437         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
16438 #if 0 /* strtouq() for /^-/ strings is undefined. */
16439         check("-1",                    18446744073709551615ULL, 0);
16440         check("-18446744073709551614",                     2LL, 0);
16441         check("-18446744073709551615",                     1LL, 0);
16442         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
16443         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
16444 #endif
16445         if (!bad)
16446                 printf("ok\n");
16447         return 0;
16448 }
16449 EOCP
16450         set try
16451         if eval $compile; then
16452                 case "`$run ./try`" in
16453                 ok) echo "Your strtouq() seems to be working okay." ;;
16454                 *) cat <<EOM >&4
16455 Your strtouq() doesn't seem to be working okay.
16456 EOM
16457                    d_strtouq="$undef"
16458                    ;;
16459                 esac
16460         fi
16461         ;;
16462 esac
16463
16464 : see if strxfrm exists
16465 set strxfrm d_strxfrm
16466 eval $inlibc
16467
16468 : see if symlink exists
16469 set symlink d_symlink
16470 eval $inlibc
16471
16472 : see if syscall exists
16473 set syscall d_syscall
16474 eval $inlibc
16475
16476 : see if prototype for syscall is available
16477 echo " "
16478 set d_syscallproto syscall $i_unistd unistd.h
16479 eval $hasproto
16480
16481 : see if sysconf exists
16482 set sysconf d_sysconf
16483 eval $inlibc
16484
16485 : see if system exists
16486 set system d_system
16487 eval $inlibc
16488
16489 : see if tcgetpgrp exists
16490 set tcgetpgrp d_tcgetpgrp
16491 eval $inlibc
16492
16493 : see if tcsetpgrp exists
16494 set tcsetpgrp d_tcsetpgrp
16495 eval $inlibc
16496
16497 : see if prototype for telldir is available
16498 echo " "
16499 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
16500 eval $hasproto
16501
16502 : see if time exists
16503 echo " "
16504 if test "X$d_time" = X -o X"$timetype" = X; then
16505     if set time val -f d_time; eval $csym; $val; then
16506                 echo 'time() found.' >&4
16507                 val="$define"
16508                 rp="What is the type returned by time() on this system?"
16509                 set time_t timetype long stdio.h sys/types.h
16510                 eval $typedef_ask
16511     else
16512                 echo 'time() not found, hope that will do.' >&4
16513                 val="$undef"
16514                 timetype='int';
16515     fi
16516     set d_time
16517     eval $setvar
16518 fi
16519
16520 : see if this is a sys/times.h system
16521 set sys/times.h i_systimes
16522 eval $inhdr
16523
16524 : see if times exists
16525 echo " "
16526 if set times val -f d_times; eval $csym; $val; then
16527         echo 'times() found.' >&4
16528         d_times="$define"
16529         inc=''
16530         case "$i_systimes" in
16531         "$define") inc='sys/times.h';;
16532         esac
16533         rp="What is the type returned by times() on this system?"
16534         set clock_t clocktype long stdio.h sys/types.h $inc
16535         eval $typedef_ask
16536 else
16537         echo 'times() NOT found, hope that will do.' >&4
16538         d_times="$undef"
16539         clocktype='int'
16540 fi
16541
16542 : see if tmpnam_r exists
16543 set tmpnam_r d_tmpnam_r
16544 eval $inlibc
16545 case "$d_tmpnam_r" in
16546 "$define")
16547         hdrs="$i_systypes sys/types.h define stdio.h "
16548         case "$d_tmpnam_r_proto:$usethreads" in
16549         ":define")      d_tmpnam_r_proto=define
16550                 set d_tmpnam_r_proto tmpnam_r $hdrs
16551                 eval $hasproto ;;
16552         *)      ;;
16553         esac
16554         case "$d_tmpnam_r_proto" in
16555         define)
16556         case "$tmpnam_r_proto" in
16557         ''|0) try='char* tmpnam_r(char*);'
16558         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
16559         esac
16560         case "$tmpnam_r_proto" in
16561         ''|0)   d_tmpnam_r=undef
16562                 tmpnam_r_proto=0
16563                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
16564         * )     case "$tmpnam_r_proto" in
16565                 REENTRANT_PROTO*) ;;
16566                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
16567                 esac
16568                 echo "Prototype: $try" ;;
16569         esac
16570         ;;
16571         *)      case "$usethreads" in
16572                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
16573                 esac
16574                 d_tmpnam_r=undef
16575                 tmpnam_r_proto=0
16576                 ;;
16577         esac
16578         ;;
16579 *)      tmpnam_r_proto=0
16580         ;;
16581 esac
16582
16583 : see if truncate exists
16584 set truncate d_truncate
16585 eval $inlibc
16586
16587 : see if ttyname_r exists
16588 set ttyname_r d_ttyname_r
16589 eval $inlibc
16590 case "$d_ttyname_r" in
16591 "$define")
16592         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
16593         case "$d_ttyname_r_proto:$usethreads" in
16594         ":define")      d_ttyname_r_proto=define
16595                 set d_ttyname_r_proto ttyname_r $hdrs
16596                 eval $hasproto ;;
16597         *)      ;;
16598         esac
16599         case "$d_ttyname_r_proto" in
16600         define)
16601         case "$ttyname_r_proto" in
16602         ''|0) try='int ttyname_r(int, char*, size_t);'
16603         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
16604         esac
16605         case "$ttyname_r_proto" in
16606         ''|0) try='int ttyname_r(int, char*, int);'
16607         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
16608         esac
16609         case "$ttyname_r_proto" in
16610         ''|0) try='char* ttyname_r(int, char*, int);'
16611         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
16612         esac
16613         case "$ttyname_r_proto" in
16614         ''|0)   d_ttyname_r=undef
16615                 ttyname_r_proto=0
16616                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
16617         * )     case "$ttyname_r_proto" in
16618                 REENTRANT_PROTO*) ;;
16619                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
16620                 esac
16621                 echo "Prototype: $try" ;;
16622         esac
16623         ;;
16624         *)      case "$usethreads" in
16625                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
16626                 esac
16627                 d_ttyname_r=undef
16628                 ttyname_r_proto=0
16629                 ;;
16630         esac
16631         ;;
16632 *)      ttyname_r_proto=0
16633         ;;
16634 esac
16635
16636 : see if tzname[] exists
16637 echo " "
16638 if set tzname val -a d_tzname; eval $csym; $val; then
16639         val="$define"
16640         echo 'tzname[] found.' >&4
16641 else
16642         val="$undef"
16643         echo 'tzname[] NOT found.' >&4
16644 fi
16645 set d_tzname
16646 eval $setvar
16647
16648 case "$osname" in
16649 next|rhapsody|darwin) multiarch="$define" ;;
16650 esac
16651 case "$multiarch" in
16652 ''|[nN]*) multiarch="$undef" ;;
16653 esac
16654
16655 : check for ordering of bytes in a UV
16656 echo " "
16657 case "$usecrosscompile$multiarch" in
16658 *$define*)
16659         $cat <<EOM
16660 You seem to be either cross-compiling or doing a multiarchitecture build,
16661 skipping the byteorder check.
16662
16663 EOM
16664         byteorder='ffff'
16665         ;;
16666 *)
16667         case "$byteorder" in
16668         '')
16669                 $cat <<'EOM'
16670 In the following, larger digits indicate more significance.  A big-endian
16671 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
16672 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
16673 machines may have weird orders like 3412.  A Cray will report 87654321,
16674 an Alpha will report 12345678. If the test program works the default is
16675 probably right.
16676 I'm now running the test program...
16677 EOM
16678                 $cat >try.c <<EOCP
16679 #include <stdio.h>
16680 #include <sys/types.h>
16681 typedef $uvtype UV;
16682 int main()
16683 {
16684         int i;
16685         union {
16686                 UV l;
16687                 char c[$uvsize];
16688         } u;
16689
16690         if ($uvsize > 4)
16691                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
16692         else
16693                 u.l = (UV)0x04030201;
16694         for (i = 0; i < $uvsize; i++)
16695                 printf("%c", u.c[i]+'0');
16696         printf("\n");
16697         exit(0);
16698 }
16699 EOCP
16700                 xxx_prompt=y
16701                 set try
16702                 if eval $compile && ./try > /dev/null; then
16703                         dflt=`$run ./try`
16704                         case "$dflt" in
16705                         [1-4][1-4][1-4][1-4]|12345678|87654321)
16706                                 echo "(The test program ran ok.)"
16707                                 echo "byteorder=$dflt"
16708                                 xxx_prompt=n
16709                         ;;
16710                         ????|????????) echo "(The test program ran ok.)" ;;
16711                         *) echo "(The test program didn't run right for some reason.)" ;;
16712                         esac
16713                 else
16714                         dflt='4321'
16715                         cat <<'EOM'
16716 (I can't seem to compile the test program.  Guessing big-endian...)
16717 EOM
16718                 fi
16719                 case "$xxx_prompt" in
16720                 y)
16721                         rp="What is the order of bytes in $uvtype?"
16722                         . ./myread
16723                         byteorder="$ans"
16724                         ;;
16725                 *)      byteorder=$dflt
16726                         ;;
16727                 esac
16728                 ;;
16729         esac
16730         $rm -f try.c try
16731         ;;
16732 esac
16733
16734
16735 $cat <<EOM
16736
16737 Checking to see whether you can access character data unalignedly...
16738 EOM
16739 case "$d_u32align" in
16740 '')   $cat >try.c <<EOCP
16741 #include <stdio.h>
16742 #$i_stdlib I_STDLIB
16743 #ifdef I_STDLIB
16744 #include <stdlib.h>
16745 #endif
16746 #define U32 $u32type
16747 #define BYTEORDER 0x$byteorder
16748 #define U8 $u8type
16749 #include <signal.h>
16750 #ifdef SIGBUS
16751 $signal_t bletch(s) int s; { exit(4); }
16752 #endif
16753 int main() {
16754 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
16755     U8 buf[8];
16756     U32 *up;
16757     int i;
16758
16759     if (sizeof(U32) != 4) {
16760         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
16761         exit(1);
16762     }
16763
16764     fflush(stdout);
16765
16766 #ifdef SIGBUS
16767     signal(SIGBUS, bletch);
16768 #endif
16769
16770     buf[0] = 0;
16771     buf[1] = 0;
16772     buf[2] = 0;
16773     buf[3] = 1;
16774     buf[5] = 0;
16775     buf[6] = 0;
16776     buf[7] = 0;
16777     buf[8] = 1;
16778
16779     for (i = 0; i < 4; i++) {
16780         up = (U32*)(buf + i);
16781         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
16782                (*up == 1 << (8*(3-i)))  /* little-endian */
16783               )
16784            )
16785         {
16786             printf("read failed (%x)\n", *up);
16787             exit(2);
16788         }
16789     }
16790
16791     /* write test */
16792     for (i = 0; i < 4; i++) {
16793         up = (U32*)(buf + i);
16794         *up = 0xBeef;
16795         if (*up != 0xBeef) {
16796             printf("write failed (%x)\n", *up);
16797             exit(3);
16798         }
16799     }
16800
16801     exit(0);
16802 #else
16803     printf("1\n");
16804     exit(1);
16805 #endif
16806     return 0;
16807 }
16808 EOCP
16809 set try
16810 if eval $compile_ok; then
16811         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
16812         $run ./try 2>&1 >/dev/null
16813         case "$?" in
16814         0)      cat >&4 <<EOM
16815 You can access character data pretty unalignedly.
16816 EOM
16817                 d_u32align="$undef"
16818                 ;;
16819         *)      cat >&4 <<EOM
16820 It seems that you must access character data in an aligned manner.
16821 EOM
16822                 d_u32align="$define"
16823                 ;;
16824         esac
16825 else
16826         rp='Can you access character data at unaligned addresses?'
16827         dflt='n'
16828         . ./myread
16829         case "$ans" in
16830         [yY]*)  d_u32align="$undef"  ;;
16831         *)      d_u32align="$define" ;;
16832         esac
16833 fi
16834 $rm -f core core.try.* try.core
16835 ;;
16836 esac
16837
16838 : see if ualarm exists
16839 set ualarm d_ualarm
16840 eval $inlibc
16841
16842 : see if umask exists
16843 set umask d_umask
16844 eval $inlibc
16845
16846 : see if unordered exists
16847 set unordered d_unordered
16848 eval $inlibc
16849
16850 : see if usleep exists
16851 set usleep d_usleep
16852 eval $inlibc
16853
16854 : see if prototype for usleep is available
16855 echo " "
16856 set d_usleepproto usleep $i_unistd unistd.h
16857 eval $hasproto
16858
16859 : see if ustat exists
16860 set ustat d_ustat
16861 eval $inlibc
16862
16863 : backward compatibility for d_hvfork
16864 if test X$d_hvfork != X; then
16865         d_vfork="$d_hvfork"
16866         d_hvfork=''
16867 fi
16868 : see if there is a vfork
16869 val=''
16870 set vfork val
16871 eval $inlibc
16872
16873 : Ok, but do we want to use it. vfork is reportedly unreliable in 
16874 : perl on Solaris 2.x, and probably elsewhere.
16875 case "$val" in
16876 $define)
16877         echo " "
16878         case "$usevfork" in
16879         false) dflt='n';;
16880         *) dflt='y';;
16881         esac
16882         cat <<'EOM'
16883  
16884 Perl can only use a vfork() that doesn't suffer from strict
16885 restrictions on calling functions or modifying global data in
16886 the child.  For example, glibc-2.1 contains such a vfork()
16887 that is unsuitable.  If your system provides a proper fork()
16888 call, chances are that you do NOT want perl to use vfork().
16889
16890 EOM
16891         rp="Do you still want to use vfork()?"
16892         . ./myread
16893         case "$ans" in
16894         y|Y) ;;
16895         *)
16896                 echo "Ok, we won't use vfork()."
16897                 val="$undef"
16898                 ;;
16899         esac
16900         ;;
16901 esac
16902 set d_vfork
16903 eval $setvar
16904 case "$d_vfork" in
16905 $define) usevfork='true';;
16906 *) usevfork='false';;
16907 esac
16908
16909 : see if closedir exists
16910 set closedir d_closedir
16911 eval $inlibc
16912
16913 case "$d_closedir" in
16914 "$define")
16915         echo " "
16916         echo "Checking whether closedir() returns a status..." >&4
16917         cat > try.c <<EOM
16918 #$i_dirent I_DIRENT             /**/
16919 #$i_sysdir I_SYS_DIR            /**/
16920 #$i_sysndir I_SYS_NDIR          /**/
16921 #$i_systypes I_SYS_TYPES        /**/
16922
16923 #if defined(I_SYS_TYPES)
16924 #include <sys/types.h>
16925 #endif
16926 #if defined(I_DIRENT)
16927 #include <dirent.h>
16928 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
16929 #include <sys/dir.h>
16930 #endif
16931 #else
16932 #ifdef I_SYS_NDIR
16933 #include <sys/ndir.h>
16934 #else
16935 #ifdef I_SYS_DIR
16936 #ifdef hp9000s500
16937 #include <ndir.h>       /* may be wrong in the future */
16938 #else
16939 #include <sys/dir.h>
16940 #endif
16941 #endif
16942 #endif
16943 #endif 
16944 int main() { return closedir(opendir(".")); }
16945 EOM
16946         set try
16947         if eval $compile_ok; then
16948                 if $run ./try > /dev/null 2>&1 ; then
16949                         echo "Yes, it does."
16950                         val="$undef"
16951                 else
16952                         echo "No, it doesn't."
16953                         val="$define"
16954                 fi
16955         else
16956                 echo "(I can't seem to compile the test program--assuming it doesn't)"
16957                 val="$define"
16958         fi
16959         ;;
16960 *)
16961         val="$undef";
16962         ;;
16963 esac
16964 set d_void_closedir
16965 eval $setvar
16966 $rm -f try try.*
16967 : see if there is a wait4
16968 set wait4 d_wait4
16969 eval $inlibc
16970
16971 : see if waitpid exists
16972 set waitpid d_waitpid
16973 eval $inlibc
16974
16975 : see if wcstombs exists
16976 set wcstombs d_wcstombs
16977 eval $inlibc
16978
16979 : see if wctomb exists
16980 set wctomb d_wctomb
16981 eval $inlibc
16982
16983 : see if writev exists
16984 set writev d_writev
16985 eval $inlibc
16986
16987 : preserve RCS keywords in files with variable substitution, grrr
16988 Date='$Date'
16989 Id='$Id'
16990 Log='$Log'
16991 RCSfile='$RCSfile'
16992 Revision='$Revision'
16993
16994 : check for alignment requirements
16995 echo " "
16996 case "$usecrosscompile$multiarch" in
16997 *$define*)
16998         $cat <<EOM
16999 You seem to be either cross-compiling or doing a multiarchitecture build,
17000 skipping the memory alignment check.
17001
17002 EOM
17003         case "$alignbytes" in
17004         '') alignbytes=8 ;;
17005         esac
17006         ;;
17007 *)
17008         case "$alignbytes" in
17009         '') echo "Checking alignment constraints..." >&4
17010                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17011                         $cat >try.c <<'EOCP'
17012 typedef long double NV;
17013 EOCP
17014                 else
17015                         $cat >try.c <<'EOCP'
17016 typedef double NV;
17017 EOCP
17018                 fi
17019                 $cat >>try.c <<'EOCP'
17020 #include <stdio.h>
17021 struct foobar {
17022         char foo;
17023         NV bar;
17024 } try_algn;
17025 int main()
17026 {
17027     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17028     return(0);
17029 }
17030 EOCP
17031                 set try
17032                 if eval $compile_ok; then
17033                         dflt=`$run ./try`
17034                 else
17035                         dflt='8'
17036                         echo "(I can't seem to compile the test program...)"
17037                 fi
17038                 ;;
17039         *) dflt="$alignbytes"
17040                 ;;
17041         esac
17042         rp="Doubles must be aligned on a how-many-byte boundary?"
17043         . ./myread
17044         alignbytes="$ans"
17045         $rm -f try.c try
17046         ;;
17047 esac
17048
17049
17050 : set the base revision
17051 baserev=5.0
17052
17053 : how do we catenate cpp tokens here?
17054 echo " "
17055 echo "Checking to see how your cpp does stuff like catenate tokens..." >&4
17056 $cat >cpp_stuff.c <<'EOCP'
17057 #define RCAT(a,b)a/**/b
17058 #define ACAT(a,b)a ## b
17059 RCAT(Rei,ser)
17060 ACAT(Cir,cus)
17061 EOCP
17062 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17063 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17064         echo "Oh!  Smells like ANSI's been here." >&4
17065         echo "We can catify or stringify, separately or together!"
17066         cpp_stuff=42
17067 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17068         echo "Ah, yes!  The good old days!" >&4
17069         echo "However, in the good old days we don't know how to stringify and"
17070         echo "catify at the same time."
17071         cpp_stuff=1
17072 else
17073         $cat >&4 <<EOM
17074 Hmm, I don't seem to be able to catenate tokens with your cpp.  You're going
17075 to have to edit the values of CAT[2-5] in config.h...
17076 EOM
17077         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17078 fi
17079 $rm -f cpp_stuff.*
17080
17081 : see if this is a db.h system
17082 set db.h i_db
17083 eval $inhdr
17084
17085 case "$i_db" in
17086 $define)
17087         : Check db version.
17088         echo " "
17089         echo "Checking Berkeley DB version ..." >&4
17090         $cat >try.c <<EOCP
17091 #$d_const HASCONST
17092 #ifndef HASCONST
17093 #define const
17094 #endif
17095 #include <sys/types.h>
17096 #include <stdio.h>
17097 #include <db.h>
17098 int main(int argc, char *argv[])
17099 {
17100 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17101     int Major, Minor, Patch ;
17102     unsigned long Version ;
17103     (void)db_version(&Major, &Minor, &Patch) ;
17104     if (argc == 2) {
17105         printf("%d %d %d %d %d %d\n",
17106                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17107                Major, Minor, Patch);
17108         exit(0);
17109     }
17110     printf("You have Berkeley DB Version 2 or greater.\n");
17111
17112     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17113                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17114     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17115                 Major, Minor, Patch) ;
17116
17117     /* check that db.h & libdb are compatible */
17118     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17119         printf("db.h and libdb are incompatible.\n") ;
17120         exit(3);        
17121     }
17122
17123     printf("db.h and libdb are compatible.\n") ;
17124
17125     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17126                 + DB_VERSION_PATCH ;
17127
17128     /* needs to be >= 2.3.4 */
17129     if (Version < 2003004) {
17130     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17131         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17132         exit(2);        
17133     }
17134
17135     exit(0);
17136 #else
17137 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17138     if (argc == 2) {
17139         printf("1 0 0\n");
17140         exit(0);
17141     }
17142     printf("You have Berkeley DB Version 1.\n");
17143     exit(0);    /* DB version < 2: the coast is clear. */
17144 #else
17145     exit(1);    /* <db.h> not Berkeley DB? */
17146 #endif
17147 #endif
17148 }
17149 EOCP
17150         set try
17151         if eval $compile_ok && $run ./try; then
17152                 echo 'Looks OK.' >&4
17153                 set `$run ./try 1`
17154                 db_version_major=$1
17155                 db_version_minor=$2
17156                 db_version_patch=$3
17157         else
17158                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17159                 i_db=$undef
17160                 case " $libs " in
17161                 *"-ldb "*)
17162                         : Remove db from list of libraries to use
17163                         echo "Removing unusable -ldb from library list" >&4
17164                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17165                         shift
17166                         libs="$*"
17167                         echo "libs = $libs" >&4
17168                         ;;
17169                 esac
17170         fi
17171         $rm -f try.*
17172         ;;
17173 esac
17174
17175 case "$i_db" in
17176 define)
17177         : Check the return type needed for hash 
17178         echo " "
17179         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17180         $cat >try.c <<EOCP
17181 #$d_const HASCONST
17182 #ifndef HASCONST
17183 #define const
17184 #endif
17185 #include <sys/types.h>
17186 #include <db.h>
17187
17188 #ifndef DB_VERSION_MAJOR
17189 u_int32_t hash_cb (ptr, size)
17190 const void *ptr;
17191 size_t size;
17192 {
17193 }
17194 HASHINFO info;
17195 int main()
17196 {
17197         info.hash = hash_cb;
17198 }
17199 #endif
17200 EOCP
17201         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17202                 if $contains warning try.out >>/dev/null 2>&1 ; then
17203                         db_hashtype='int'
17204                 else
17205                         db_hashtype='u_int32_t'
17206                 fi
17207         else
17208                 : XXX Maybe we should just give up here.
17209                 db_hashtype=u_int32_t
17210                 $cat try.out >&4
17211                 echo "Help:  I can't seem to compile the db test program." >&4
17212                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17213         fi
17214         $rm -f try.*
17215         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17216         ;;
17217 *)      db_hashtype=u_int32_t
17218         ;;
17219 esac
17220 case "$i_db" in
17221 define)
17222         : Check the return type needed for prefix 
17223         echo " "
17224         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17225         cat >try.c <<EOCP
17226 #$d_const HASCONST
17227 #ifndef HASCONST
17228 #define const
17229 #endif
17230 #include <sys/types.h>
17231 #include <db.h>
17232
17233 #ifndef DB_VERSION_MAJOR
17234 size_t prefix_cb (key1, key2)
17235 const DBT *key1;
17236 const DBT *key2;
17237 {
17238 }
17239 BTREEINFO info;
17240 int main()
17241 {
17242         info.prefix = prefix_cb;
17243 }
17244 #endif
17245 EOCP
17246         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
17247                 if $contains warning try.out >>/dev/null 2>&1 ; then
17248                         db_prefixtype='int'
17249                 else
17250                         db_prefixtype='size_t'
17251                 fi
17252         else
17253                 db_prefixtype='size_t'
17254                 : XXX Maybe we should just give up here.
17255                 $cat try.out >&4
17256                 echo "Help:  I can't seem to compile the db test program." >&4
17257                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
17258         fi
17259         $rm -f try.*
17260         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
17261         ;;
17262 *)      db_prefixtype='size_t'
17263         ;;
17264 esac
17265
17266
17267 : How can we generate normalized random numbers ?
17268 echo " "
17269 echo "Looking for a random number function..." >&4
17270 case "$randfunc" in
17271 '')
17272         if set drand48 val -f; eval $csym; $val; then
17273                 dflt="drand48"
17274                 echo "Good, found drand48()." >&4
17275         elif set random val -f; eval $csym; $val; then
17276                 dflt="random"
17277                 echo "OK, found random()." >&4
17278         else
17279                 dflt="rand"
17280                 echo "Yick, looks like I have to use rand()." >&4
17281         fi
17282         echo " "
17283         ;;
17284 *)
17285         dflt="$randfunc"
17286         ;;
17287 esac
17288 cont=true
17289
17290 case "$ccflags" in
17291 *-Dmy_rand=*|*-Dmy_srand=*)
17292         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
17293         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
17294         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
17295         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
17296         ;;
17297 esac
17298
17299 while $test "$cont"; do
17300         rp="Use which function to generate random numbers?"
17301         . ./myread
17302         if $test "$ans" = "$dflt"; then
17303                 : null
17304         else
17305                 randbits=''
17306         fi
17307         randfunc="$ans"
17308         if set $ans val -f; eval $csym; $val; then
17309                 cont=''
17310         else
17311                 dflt=y
17312                 rp="I cannot find function $ans. Use that name anyway?"
17313                 . ./myread
17314                 dflt=rand
17315                 case "$ans" in
17316                         [yY]*) cont='';;
17317                 esac
17318         fi
17319         case "$cont" in
17320         '')
17321                 case "$randfunc" in
17322                 drand48)
17323                         drand01="drand48()"
17324                         seedfunc="srand48"
17325                         randbits=48
17326                         randseedtype=long
17327                         ;;
17328                 rand|random)
17329                         case "$randbits" in
17330                         '')
17331 echo "Checking to see how many bits your $randfunc() function produces..." >&4
17332                                 $cat >try.c <<EOCP
17333 #$i_unistd I_UNISTD
17334 #$i_stdlib I_STDLIB
17335 #include <stdio.h>
17336 #ifdef I_UNISTD
17337 #  include <unistd.h>
17338 #endif
17339 #ifdef I_STDLIB
17340 #  include <stdlib.h>
17341 #endif
17342 int main()
17343 {
17344         register int i;
17345         register unsigned long tmp;
17346         register unsigned long max = 0L;
17347
17348         for (i = 1000; i; i--) {
17349                 tmp = (unsigned long) $randfunc();
17350                 if (tmp > max) max = tmp;
17351         }
17352         for (i = 0; max; i++)
17353                 max /= 2;
17354         printf("%d\n",i);
17355 }
17356 EOCP
17357                                 set try
17358                                 if eval $compile_ok; then
17359                                         dflt=`try`
17360                                 else
17361                                         dflt='?'
17362                                         echo "(I can't seem to compile the test program...)"
17363                                 fi
17364                                 ;;
17365                         *)
17366                                 dflt="$randbits"
17367                                 ;;
17368                         esac
17369                         rp="How many bits does your $randfunc() function produce?"
17370                         . ./myread
17371                         randbits="$ans"
17372                         $rm -f try.c try
17373                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17374                         seedfunc="s$randfunc"
17375                         randseedtype=unsigned
17376                         ;;
17377                 *)
17378                         dflt="31"
17379                         rp="How many bits does your $randfunc() function produce?"
17380                         . ./myread
17381                         randbits="$ans"
17382                         seedfunc="s$randfunc"
17383                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
17384                         if set $seedfunc val -f; eval $csym; $val; then
17385                                 echo "(Using $seedfunc() to seed random generator)"
17386                         else
17387                                 echo "(Warning: no $seedfunc() to seed random generator)"
17388                                 seedfunc=rand
17389                         fi
17390                         randseedtype=unsigned
17391                         ;;
17392                 esac
17393                 ;;
17394         esac
17395 done
17396
17397 echo " "
17398 echo "Determining whether or not we are on an EBCDIC system..." >&4
17399 $cat >try.c <<'EOM'
17400 int main()
17401 {
17402   if ('M'==0xd4) return 0;
17403   return 1;
17404 }
17405 EOM
17406
17407 val=$undef
17408 set try
17409 if eval $compile_ok; then
17410         if $run ./try; then
17411                 echo "You seem to speak EBCDIC." >&4
17412                 val="$define"
17413         else
17414                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
17415         fi
17416 else
17417         echo "I'm unable to compile the test program." >&4
17418         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
17419 fi
17420 $rm -f try try.*
17421 set ebcdic
17422 eval $setvar
17423
17424 echo " "
17425 $cat >&4 <<EOM
17426 Checking how to flush all pending stdio output...
17427 EOM
17428 # I only know how to find the first 32 possibly open files on SunOS.
17429 # See also hints/sunos_4_1.sh and util.c  --AD
17430 case "$osname" in
17431 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
17432 esac
17433 $cat >>try.c <<EOCP
17434 #include <stdio.h>
17435 #$i_unistd I_UNISTD
17436 #ifdef I_UNISTD
17437 # include <unistd.h>
17438 #endif
17439 #$d_sysconf HAS_SYSCONF
17440 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
17441 #ifdef HAS_STDIO_STREAM_ARRAY
17442 # define STDIO_STREAM_ARRAY $stdio_stream_array
17443 #endif
17444 int main() {
17445   FILE* p;
17446   unlink("try.out");
17447   p = fopen("try.out", "w");
17448 #ifdef TRY_FPUTC
17449   fputc('x', p);
17450 #else
17451 # ifdef TRY_FPRINTF
17452   fprintf(p, "x");
17453 # endif
17454 #endif
17455 #ifdef TRY_FFLUSH_NULL
17456   fflush(NULL);
17457 #endif
17458 #ifdef TRY_FFLUSH_ALL
17459   {
17460     long open_max = -1;
17461 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
17462     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
17463 # else
17464 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
17465     open_max = sysconf(_SC_OPEN_MAX);
17466 #  else
17467 #   ifdef FOPEN_MAX
17468     open_max = FOPEN_MAX;
17469 #   else
17470 #    ifdef OPEN_MAX
17471     open_max = OPEN_MAX;
17472 #    else
17473 #     ifdef _NFILE
17474     open_max = _NFILE;
17475 #     endif
17476 #    endif
17477 #   endif
17478 #  endif
17479 # endif 
17480 # ifdef HAS_STDIO_STREAM_ARRAY
17481     if (open_max > 0) {
17482       long i;
17483       for (i = 0; i < open_max; i++)
17484             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
17485                 STDIO_STREAM_ARRAY[i]._file < open_max &&
17486                 STDIO_STREAM_ARRAY[i]._flag)
17487                 fflush(&STDIO_STREAM_ARRAY[i]);
17488     }   
17489   }
17490 # endif
17491 #endif
17492   _exit(42);
17493 }
17494 EOCP
17495 : first we have to find out how _not_ to flush
17496 $to try.c
17497 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
17498     output=''
17499     set try -DTRY_FPUTC
17500     if eval $compile; then
17501             $run ./try 2>/dev/null
17502             code="$?"
17503             $from try.out
17504             if $test ! -s try.out -a "X$code" = X42; then
17505                 output=-DTRY_FPUTC
17506             fi
17507     fi
17508     case "$output" in
17509     '')
17510             set try -DTRY_FPRINTF
17511             if eval $compile; then
17512                     $run ./try 2>/dev/null
17513                     code="$?"
17514                     $from try.out
17515                     if $test ! -s try.out -a "X$code" = X42; then
17516                         output=-DTRY_FPRINTF
17517                     fi
17518             fi
17519         ;;
17520     esac
17521 fi
17522 : check for fflush NULL behaviour
17523 case "$fflushNULL" in
17524 '')     set try -DTRY_FFLUSH_NULL $output
17525         if eval $compile; then
17526                 $run ./try 2>/dev/null
17527                 code="$?"
17528                 $from try.out
17529                 if $test -s try.out -a "X$code" = X42; then
17530                         fflushNULL="`$cat try.out`"
17531                 else
17532                         if $test "X$code" != X42; then
17533                                 $cat >&4 <<EOM
17534 (If this test failed, don't worry, we'll try another method shortly.)
17535 EOM
17536                         fi
17537                 fi
17538         fi
17539         $rm -f core try.core core.try.*
17540         case "$fflushNULL" in
17541         x)      $cat >&4 <<EOM
17542 Your fflush(NULL) works okay for output streams.
17543 Let's see if it clobbers input pipes...
17544 EOM
17545 # As of mid-March 2000 all versions of Solaris appear to have a stdio
17546 # bug that improperly flushes the input end of pipes.  So we avoid the
17547 # autoflush on fork/system/exec support for now. :-(
17548 $cat >tryp.c <<EOCP
17549 #include <stdio.h>
17550 int
17551 main(int argc, char **argv)
17552 {
17553     char buf[1024];
17554     int i;
17555     char *bp = buf;
17556     while (1) {
17557         while ((i = getc(stdin)) != -1
17558                && (*bp++ = i) != '\n'
17559                && bp < &buf[1024])
17560         /* DO NOTHING */ ;
17561         *bp = '\0';
17562         fprintf(stdout, "%s", buf);
17563         fflush(NULL);
17564         if (i == -1)
17565             return 0;
17566         bp = buf;
17567     }
17568 }
17569 EOCP
17570                 fflushNULL="$define"
17571                 set tryp
17572                 if eval $compile; then
17573                     $rm -f tryp.out
17574                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17575                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
17576                        $cat >&4 <<EOM
17577 fflush(NULL) seems to behave okay with input streams.
17578 EOM
17579                         fflushNULL="$define"
17580                     else
17581                         $cat >&4 <<EOM
17582 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
17583 EOM
17584                         fflushNULL="$undef"
17585                     fi
17586                 fi
17587                 $rm -f core tryp.c tryp.core core.tryp.*
17588                 ;;
17589         '')     $cat >&4 <<EOM
17590 Your fflush(NULL) isn't working (contrary to ANSI C).
17591 EOM
17592                 fflushNULL="$undef"
17593                 ;;
17594         *)      $cat >&4 <<EOM
17595 Cannot figure out whether your fflush(NULL) works or not.
17596 I'm assuming it doesn't (contrary to ANSI C).
17597 EOM
17598                 fflushNULL="$undef"
17599                 ;;
17600         esac
17601         ;;
17602 $define|true|[yY]*)
17603         fflushNULL="$define"
17604         ;;
17605 *)
17606         fflushNULL="$undef"
17607         ;;
17608 esac
17609 : check explicit looping only if NULL did not work, and if the pipe
17610 : bug does not show up on an explicit flush too
17611 case "$fflushNULL" in
17612 "$undef")
17613         $cat >tryp.c <<EOCP
17614 #include <stdio.h>
17615 int
17616 main(int argc, char **argv)
17617 {
17618     char buf[1024];
17619     int i;
17620     char *bp = buf;
17621     while (1) {
17622         while ((i = getc(stdin)) != -1
17623                && (*bp++ = i) != '\n'
17624                && bp < &buf[1024])
17625         /* DO NOTHING */ ;
17626         *bp = '\0';
17627         fprintf(stdout, "%s", buf);
17628         fflush(stdin);
17629         if (i == -1)
17630             return 0;
17631         bp = buf;
17632     }
17633 }
17634 EOCP
17635         set tryp
17636         if eval $compile; then
17637             $rm -f tryp.out
17638             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
17639             if cmp tryp.c tryp.out >/dev/null 2>&1; then
17640                $cat >&4 <<EOM
17641 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
17642 EOM
17643                 : now check for fflushall behaviour
17644                 case "$fflushall" in
17645                 '')     set try -DTRY_FFLUSH_ALL $output
17646                         if eval $compile; then
17647                                 $cat >&4 <<EOM
17648 (Now testing the other method--but note that this also may fail.)
17649 EOM
17650                                 $run ./try 2>/dev/null
17651                                 code=$?
17652                                 $from try.out
17653                                 if $test -s try.out -a "X$code" = X42; then
17654                                         fflushall="`$cat try.out`"
17655                                 fi
17656                         fi
17657                         $rm -f core try.core core.try.*
17658                         case "$fflushall" in
17659                         x)      $cat >&4 <<EOM
17660 Whew. Flushing explicitly all the stdio streams works.
17661 EOM
17662                                 fflushall="$define"
17663                                 ;;
17664                         '')     $cat >&4 <<EOM
17665 Sigh. Flushing explicitly all the stdio streams doesn't work.
17666 EOM
17667                                 fflushall="$undef"
17668                                 ;;
17669                         *)      $cat >&4 <<EOM
17670 Cannot figure out whether flushing stdio streams explicitly works or not.
17671 I'm assuming it doesn't.
17672 EOM
17673                                 fflushall="$undef"
17674                                 ;;
17675                         esac
17676                         ;;
17677                 "$define"|true|[yY]*)
17678                         fflushall="$define"
17679                         ;;
17680                 *)
17681                         fflushall="$undef"
17682                         ;;
17683                 esac
17684             else
17685                 $cat >&4 <<EOM
17686 All is futile.  Even fflush(stdin) clobbers input pipes!
17687 EOM
17688                 fflushall="$undef"
17689             fi
17690         else
17691             fflushall="$undef"
17692         fi
17693         $rm -f core tryp.c tryp.core core.tryp.*
17694         ;;
17695 *)      fflushall="$undef"
17696         ;;
17697 esac
17698
17699 case "$fflushNULL$fflushall" in
17700 undefundef)
17701         $cat <<EOM
17702 OK, I give up.  I cannot figure out how to flush pending stdio output.
17703 We won't be flushing handles at all before fork/exec/popen.
17704 EOM
17705         ;;
17706 esac
17707 $rm -f try.* try$exe_ext
17708
17709 : Store the full pathname to the ar program for use in the C program
17710 : Respect a hint or command line value for full_ar.
17711 case "$full_ar" in
17712 '') full_ar=$ar ;;
17713 esac
17714
17715 : Store the full pathname to the sed program for use in the C program
17716 full_sed=$sed
17717
17718 : see what type gids are declared as in the kernel
17719 echo " "
17720 echo "Looking for the type for group ids returned by getgid()."
17721 set gid_t gidtype xxx stdio.h sys/types.h
17722 eval $typedef
17723 case "$gidtype" in
17724 xxx)
17725         xxx=`./findhdr sys/user.h`
17726         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
17727         case $1 in
17728         unsigned) dflt="$1 $2" ;;
17729         *) dflt="$1" ;;
17730         esac
17731         ;;
17732 *) dflt="$gidtype";;
17733 esac
17734 case "$gidtype" in
17735 gid_t) echo "gid_t found." ;;
17736 *)      rp="What is the type for group ids returned by getgid()?"
17737         . ./myread
17738         gidtype="$ans"
17739         ;;
17740 esac
17741
17742 echo " "
17743 case "$gidtype" in
17744 *_t) zzz="$gidtype"     ;;
17745 *)   zzz="gid"          ;;
17746 esac
17747 echo "Checking the size of $zzz..." >&4 
17748 cat > try.c <<EOCP
17749 #include <sys/types.h>
17750 #include <stdio.h>
17751 #$i_stdlib I_STDLIB
17752 #ifdef I_STDLIB
17753 #include <stdlib.h>
17754 #endif
17755 int main() {
17756     printf("%d\n", (int)sizeof($gidtype));
17757     exit(0);
17758 }
17759 EOCP
17760 set try
17761 if eval $compile_ok; then
17762         yyy=`$run ./try`
17763         case "$yyy" in
17764         '')     gidsize=4
17765                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
17766                 ;;
17767         *)      gidsize=$yyy
17768                 echo "Your $zzz is $gidsize bytes long."
17769                 ;;
17770         esac
17771 else
17772         gidsize=4
17773         echo "(I can't compile the test program--guessing $gidsize.)" >&4
17774 fi
17775
17776
17777 echo " "
17778 case "$gidtype" in
17779 *_t) zzz="$gidtype"     ;;
17780 *)   zzz="gid"          ;;
17781 esac
17782 echo "Checking the sign of $zzz..." >&4 
17783 cat > try.c <<EOCP
17784 #include <sys/types.h>
17785 #include <stdio.h>
17786 int main() {
17787         $gidtype foo = -1;
17788         if (foo < 0)
17789                 printf("-1\n");
17790         else
17791                 printf("1\n");
17792 }
17793 EOCP
17794 set try
17795 if eval $compile; then
17796         yyy=`$run ./try`
17797         case "$yyy" in
17798         '')     gidsign=1
17799                 echo "(I can't execute the test program--guessing unsigned.)" >&4
17800                 ;;
17801         *)      gidsign=$yyy
17802                 case "$gidsign" in
17803                  1) echo "Your $zzz is unsigned." ;;
17804                 -1) echo "Your $zzz is signed."   ;;
17805                 esac
17806                 ;;
17807         esac
17808 else
17809         gidsign=1
17810         echo "(I can't compile the test program--guessing unsigned.)" >&4
17811 fi
17812
17813
17814 echo " "
17815
17816 if $test X"$quadtype" != X; then
17817
17818 echo "Checking how to print 64-bit integers..." >&4
17819
17820 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
17821         $cat >try.c <<'EOCP'
17822 #include <sys/types.h>
17823 #include <stdio.h>
17824 int main() {
17825   int q = 12345678901;
17826   printf("%ld\n", q);
17827 }
17828 EOCP
17829         set try
17830         if eval $compile; then
17831                 yyy=`$run ./try`
17832                 case "$yyy" in
17833                 12345678901)
17834                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
17835                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
17836                         echo "We will use %d."
17837                         ;;
17838                 esac
17839         fi
17840 fi
17841
17842 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
17843         $cat >try.c <<'EOCP'
17844 #include <sys/types.h>
17845 #include <stdio.h>
17846 int main() {
17847   long q = 12345678901;
17848   printf("%ld\n", q);
17849 }
17850 EOCP
17851         set try
17852         if eval $compile; then
17853                 yyy=`$run ./try`
17854                 case "$yyy" in
17855                 12345678901)
17856                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
17857                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
17858                         echo "We will use %ld."
17859                         ;;
17860                 esac
17861         fi
17862 fi
17863
17864 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
17865         $cat >try.c <<'EOCP'
17866 #include <sys/types.h>
17867 #include <inttypes.h>
17868 #include <stdio.h>
17869 int main() {
17870   int64_t q = 12345678901;
17871   printf("%" PRId64 "\n", q);
17872 }
17873 EOCP
17874         set try
17875         if eval $compile; then
17876                 yyy=`$run ./try`
17877                 case "$yyy" in
17878                 12345678901)
17879                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
17880                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
17881                         echo "We will use the C9X style."
17882                         ;;
17883                 esac
17884         fi
17885 fi
17886
17887 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17888         $cat >try.c <<EOCP
17889 #include <sys/types.h>
17890 #include <stdio.h>
17891 int main() {
17892   $quadtype q = 12345678901;
17893   printf("%Ld\n", q);
17894 }
17895 EOCP
17896         set try
17897         if eval $compile; then
17898                 yyy=`$run ./try`
17899                 case "$yyy" in
17900                 12345678901)
17901                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
17902                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
17903                         echo "We will use %Ld."
17904                         ;;
17905                 esac
17906         fi
17907 fi
17908
17909 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
17910         $cat >try.c <<'EOCP'
17911 #include <sys/types.h>
17912 #include <stdio.h>
17913 int main() {
17914   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
17915   printf("%lld\n", q);
17916 }
17917 EOCP
17918         set try
17919         if eval $compile; then
17920                 yyy=`$run ./try`
17921                 case "$yyy" in
17922                 12345678901)
17923                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
17924                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
17925                         echo "We will use the %lld style."
17926                         ;;
17927                 esac
17928         fi
17929 fi
17930
17931 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
17932         $cat >try.c <<EOCP
17933 #include <sys/types.h>
17934 #include <stdio.h>
17935 int main() {
17936   $quadtype q = 12345678901;
17937   printf("%qd\n", q);
17938 }
17939 EOCP
17940         set try
17941         if eval $compile; then
17942                 yyy=`$run ./try`
17943                 case "$yyy" in
17944                 12345678901)
17945                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
17946                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
17947                         echo "We will use %qd."
17948                         ;;
17949                 esac
17950         fi
17951 fi
17952
17953 if $test X"$sPRId64" = X; then
17954         echo "Cannot figure out how to print 64-bit integers." >&4
17955 fi
17956
17957 $rm -f try try.*
17958
17959 fi
17960
17961 case "$sPRId64" in
17962 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
17963         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
17964         ;;
17965 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
17966         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
17967         ;;
17968 esac
17969
17970
17971 echo " "
17972 $echo "Checking the format strings to be used for Perl's internal types..." >&4
17973
17974 if $test X"$ivsize" = X8; then
17975         ivdformat="$sPRId64"
17976         uvuformat="$sPRIu64"
17977         uvoformat="$sPRIo64"
17978         uvxformat="$sPRIx64"
17979         uvXUformat="$sPRIXU64"
17980 else
17981         if $test X"$ivsize" = X"$longsize"; then
17982                 ivdformat='"ld"'
17983                 uvuformat='"lu"'
17984                 uvoformat='"lo"'
17985                 uvxformat='"lx"'
17986                 uvXUformat='"lX"'
17987         else
17988                 if $test X"$ivsize" = X"$intsize"; then
17989                         ivdformat='"d"'
17990                         uvuformat='"u"'
17991                         uvoformat='"o"'
17992                         uvxformat='"x"'
17993                         uvXUformat='"X"'
17994                 else
17995                         : far out
17996                         if $test X"$ivsize" = X"$shortsize"; then
17997                                 ivdformat='"hd"'
17998                                 uvuformat='"hu"'
17999                                 uvoformat='"ho"'
18000                                 uvxformat='"hx"'
18001                                 uvXUformat='"hX"'
18002                         fi
18003                 fi
18004         fi
18005 fi
18006
18007 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18008         nveformat="$sPRIeldbl"
18009         nvfformat="$sPRIfldbl"
18010         nvgformat="$sPRIgldbl"
18011         nvEUformat="$sPRIEUldbl"
18012         nvFUformat="$sPRIFUldbl"
18013         nvGUformat="$sPRIGUldbl"
18014 else
18015         nveformat='"e"'
18016         nvfformat='"f"'
18017         nvgformat='"g"'
18018         nvEUformat='"E"'
18019         nvFUformat='"F"'
18020         nvGUformat='"G"'
18021 fi
18022
18023 case "$ivdformat" in
18024 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18025     exit 1
18026     ;;
18027 esac
18028
18029
18030 echo " "
18031 $echo "Checking the format string to be used for gids..." >&4
18032
18033 case "$gidsign" in
18034 -1)     if $test X"$gidsize" = X"$ivsize"; then
18035                 gidformat="$ivdformat"
18036         else
18037                 if $test X"$gidsize" = X"$longsize"; then
18038                         gidformat='"ld"'
18039                 else
18040                         if $test X"$gidsize" = X"$intsize"; then
18041                                 gidformat='"d"'
18042                         else
18043                                 if $test X"$gidsize" = X"$shortsize"; then
18044                                         gidformat='"hd"'
18045                                 fi
18046                         fi
18047                 fi
18048         fi
18049         ;;
18050 *)      if $test X"$gidsize" = X"$uvsize"; then
18051                 gidformat="$uvuformat"
18052         else
18053                 if $test X"$gidsize" = X"$longsize"; then
18054                         gidformat='"lu"'
18055                 else
18056                         if $test X"$gidsize" = X"$intsize"; then
18057                                 gidformat='"u"'
18058                         else
18059                                 if $test X"$gidsize" = X"$shortsize"; then
18060                                         gidformat='"hu"'
18061                                 fi
18062                         fi
18063                 fi
18064         fi
18065         ;;
18066 esac
18067
18068 : see if getgroups exists
18069 set getgroups d_getgrps
18070 eval $inlibc
18071
18072 : see if setgroups exists
18073 set setgroups d_setgrps
18074 eval $inlibc
18075
18076
18077 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18078 echo " "
18079 case "$d_getgrps$d_setgrps" in
18080 *define*)
18081         case "$groupstype" in
18082         '') dflt="$gidtype" ;;
18083         *)  dflt="$groupstype" ;;
18084         esac
18085         $cat <<EOM
18086 What type of pointer is the second argument to getgroups() and setgroups()?
18087 Usually this is the same as group ids, $gidtype, but not always.
18088
18089 EOM
18090         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18091         . ./myread
18092         groupstype="$ans"
18093         ;;
18094 *)  groupstype="$gidtype";;
18095 esac
18096
18097 echo " "
18098 echo "Checking if your $make program sets \$(MAKE)..." >&4
18099 case "$make_set_make" in
18100 '')
18101         $sed 's/^X //' > testmake.mak << 'EOF'
18102 Xall:
18103 X       @echo 'maketemp="$(MAKE)"'
18104 EOF
18105         case "`$make -f testmake.mak 2>/dev/null`" in
18106         *maketemp=*) make_set_make='#' ;;
18107         *)      make_set_make="MAKE=$make" ;;
18108         esac
18109         $rm -f testmake.mak
18110         ;;
18111 esac
18112 case "$make_set_make" in
18113 '#') echo "Yup, it does.";;
18114 *) echo "Nope, it doesn't.";;
18115 esac
18116
18117 : see what type is used for mode_t
18118 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18119 set mode_t modetype int stdio.h sys/types.h
18120 eval $typedef_ask
18121
18122 : see if stdarg is available
18123 echo " "
18124 if $test `./findhdr stdarg.h`; then
18125         echo "<stdarg.h> found." >&4
18126         valstd="$define"
18127 else
18128         echo "<stdarg.h> NOT found." >&4
18129         valstd="$undef"
18130 fi
18131
18132 : see if varags is available
18133 echo " "
18134 if $test `./findhdr varargs.h`; then
18135         echo "<varargs.h> found." >&4
18136 else
18137         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18138 fi
18139
18140 : set up the varargs testing programs
18141 $cat > varargs.c <<EOP
18142 #ifdef I_STDARG
18143 #include <stdarg.h>
18144 #endif
18145 #ifdef I_VARARGS
18146 #include <varargs.h>
18147 #endif
18148
18149 #ifdef I_STDARG
18150 int f(char *p, ...)
18151 #else
18152 int f(va_alist)
18153 va_dcl
18154 #endif
18155 {
18156         va_list ap;
18157 #ifndef I_STDARG
18158         char *p;
18159 #endif
18160 #ifdef I_STDARG
18161         va_start(ap,p);
18162 #else
18163         va_start(ap);
18164         p = va_arg(ap, char *);
18165 #endif
18166         va_end(ap);
18167 }
18168 EOP
18169 $cat > varargs <<EOP
18170 $startsh
18171 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18172         echo "true"
18173 else
18174         echo "false"
18175 fi
18176 $rm -f varargs$_o
18177 EOP
18178 chmod +x varargs
18179
18180 : now check which varargs header should be included
18181 echo " "
18182 i_varhdr=''
18183 case "$valstd" in
18184 "$define")
18185         if `./varargs I_STDARG`; then
18186                 val='stdarg.h'
18187         elif `./varargs I_VARARGS`; then
18188                 val='varargs.h'
18189         fi
18190         ;;
18191 *)
18192         if `./varargs I_VARARGS`; then
18193                 val='varargs.h'
18194         fi
18195         ;;
18196 esac
18197 case "$val" in
18198 '')
18199 echo "I could not find the definition for va_dcl... You have problems..." >&4
18200         val="$undef"; set i_stdarg; eval $setvar
18201         val="$undef"; set i_varargs; eval $setvar
18202         ;;
18203 *) 
18204         set i_varhdr
18205         eval $setvar
18206         case "$i_varhdr" in
18207         stdarg.h)
18208                 val="$define"; set i_stdarg; eval $setvar
18209                 val="$undef"; set i_varargs; eval $setvar
18210                 ;;
18211         varargs.h)
18212                 val="$undef"; set i_stdarg; eval $setvar
18213                 val="$define"; set i_varargs; eval $setvar
18214                 ;;
18215         esac
18216         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
18217 esac
18218 $rm -f varargs*
18219
18220 : see if we need va_copy
18221 echo " "
18222 case "$i_stdarg" in
18223 "$define")
18224         $cat >try.c <<EOCP
18225 #include <stdarg.h>
18226 #include <stdio.h>
18227 #$i_stdlib I_STDLIB
18228 #ifdef I_STDLIB
18229 #include <stdlib.h>
18230 #endif
18231 #include <signal.h>
18232
18233 int
18234 ivfprintf(FILE *f, const char *fmt, va_list *valp)
18235 {
18236   return vfprintf(f, fmt, *valp);
18237 }
18238  
18239 int    
18240 myvfprintf(FILE *f, const  char *fmt, va_list val)
18241 {
18242   return ivfprintf(f, fmt, &val);
18243 }
18244       
18245 int
18246 myprintf(char *fmt, ...) 
18247 {
18248   va_list val;
18249   va_start(val, fmt);
18250   return myvfprintf(stdout, fmt, val); 
18251 }         
18252
18253 int
18254 main(int ac, char **av)
18255 {
18256   signal(SIGSEGV, exit);
18257
18258   myprintf("%s%cs all right, then\n", "that", '\'');                            
18259   exit(0);      
18260 }
18261 EOCP
18262         set try
18263         if eval $compile && $run ./try 2>&1 >/dev/null; then
18264                 case "`$run ./try`" in
18265                 "that's all right, then")
18266                         okay=yes
18267                         ;;
18268                 esac
18269         fi
18270         case "$okay" in
18271         yes)    echo "It seems that you don't need va_copy()." >&4
18272                 need_va_copy="$undef"
18273                 ;;
18274         *)      echo "It seems that va_copy() or similar will be needed." >&4
18275                 need_va_copy="$define"
18276                 ;;
18277         esac
18278         $rm -f try.* core core.* *.core *.core.*
18279         ;;
18280 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
18281         ;;
18282 esac
18283
18284 : see what type is used for size_t
18285 rp="What is the type used for the length parameter for string functions?"
18286 set size_t sizetype 'unsigned int' stdio.h sys/types.h
18287 eval $typedef_ask
18288
18289 : check for type of arguments to gethostbyaddr. 
18290 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
18291         case "$d_gethbyaddr" in
18292         $define)
18293                 $cat <<EOM
18294
18295 Checking to see what type of arguments are accepted by gethostbyaddr().
18296 EOM
18297                 hdrs="$define sys/types.h
18298                         $d_socket sys/socket.h 
18299                         $i_niin netinet/in.h 
18300                         $i_netdb netdb.h
18301                         $i_unistd unistd.h"
18302                 : The first arg can 'char *' or 'void *'
18303                 : The second arg is some of integral type
18304                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
18305                         for yyy in size_t long int; do
18306                                 case "$netdb_host_type" in
18307                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
18308                                         if ./protochk "$try" $hdrs; then
18309                                                 echo "Your system accepts $xxx for the first arg."
18310                                                 echo "...and $yyy for the second arg."
18311                                                 netdb_host_type="$xxx"
18312                                                 netdb_hlen_type="$yyy"
18313                                         fi
18314                                         ;;
18315                                 esac
18316                         done
18317                 done
18318                 : In case none of those worked, prompt the user.
18319                 case "$netdb_host_type" in
18320                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
18321                         dflt='char *'
18322                         . ./myread
18323                         netdb_host_type=$ans
18324                         rp='What is the type for the 2nd argument to gethostbyaddr?'
18325                         dflt="$sizetype"
18326                         . ./myread
18327                         netdb_hlen_type=$ans
18328                         ;;
18329                 esac
18330                 ;;
18331         *)      : no gethostbyaddr, so pick harmless defaults
18332                 netdb_host_type='char *'
18333                 netdb_hlen_type="$sizetype"
18334                 ;;
18335         esac
18336         # Remove the "const" if needed. -- but then we'll have a 
18337         # prototype clash!
18338         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
18339 fi
18340
18341 : check for type of argument to gethostbyname. 
18342 if test "X$netdb_name_type" = X ; then
18343         case "$d_gethbyname" in
18344         $define)
18345                 $cat <<EOM
18346
18347 Checking to see what type of argument is accepted by gethostbyname().
18348 EOM
18349                 hdrs="$define sys/types.h
18350                         $d_socket sys/socket.h 
18351                         $i_niin netinet/in.h 
18352                         $i_netdb netdb.h
18353                         $i_unistd unistd.h"
18354                 for xxx in "const char *" "char *"; do
18355                         case "$netdb_name_type" in
18356                         '')     try="extern struct hostent *gethostbyname($xxx);"
18357                                 if ./protochk "$try" $hdrs; then
18358                                         echo "Your system accepts $xxx."
18359                                         netdb_name_type="$xxx"
18360                                 fi
18361                                 ;;
18362                         esac
18363                 done
18364                 : In case none of those worked, prompt the user.
18365                 case "$netdb_name_type" in
18366                 '')     rp='What is the type for the 1st argument to gethostbyname?'
18367                         dflt='char *'
18368                         . ./myread
18369                         netdb_name_type=$ans
18370                         ;;
18371                 esac
18372                 ;;
18373         *)      : no gethostbyname, so pick harmless default
18374                 netdb_name_type='char *'
18375                 ;;
18376         esac
18377 fi
18378
18379 : check for type of 1st argument to getnetbyaddr. 
18380 if test "X$netdb_net_type" = X ; then
18381         case "$d_getnbyaddr" in
18382         $define)
18383                 $cat <<EOM
18384
18385 Checking to see what type of 1st argument is accepted by getnetbyaddr().
18386 EOM
18387                 hdrs="$define sys/types.h
18388                         $d_socket sys/socket.h 
18389                         $i_niin netinet/in.h 
18390                         $i_netdb netdb.h
18391                         $i_unistd unistd.h"
18392                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
18393                         case "$netdb_net_type" in
18394                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
18395                                 if ./protochk "$try" $hdrs; then
18396                                         echo "Your system accepts $xxx."
18397                                         netdb_net_type="$xxx"
18398                                 fi
18399                                 ;;
18400                         esac
18401                 done
18402                 : In case none of those worked, prompt the user.
18403                 case "$netdb_net_type" in
18404                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
18405                         dflt='long'
18406                         . ./myread
18407                         netdb_net_type=$ans
18408                         ;;
18409                 esac
18410                 ;;
18411         *)      : no getnetbyaddr, so pick harmless default
18412                 netdb_net_type='long'
18413                 ;;
18414         esac
18415 fi
18416 : locate the preferred pager for this system
18417 fn=f/
18418 case "$pager" in
18419 '')
18420         dflt=''
18421         case "$pg" in
18422         /*) dflt=$pg;;
18423         [a-zA-Z]:/*) dflt=$pg;;
18424         esac
18425         case "$more" in
18426         /*) dflt=$more;;
18427         [a-zA-Z]:/*) dflt=$more;;
18428         esac
18429         case "$less" in
18430         /*) dflt=$less;;
18431         [a-zA-Z]:/*) dflt=$less;;
18432         esac
18433         case "$dflt" in
18434         '') dflt=/usr/ucb/more;;
18435         esac
18436         ;;
18437 *)      dflt="$pager"
18438         : Instruct ./getfile to trust the hinted or previous pager value,
18439         : even if it does not begin with a slash.  For example, on os2,
18440         : pager might be cmd /c more.  See comments in UU/getfile.
18441         fn="f/($pager)"
18442         ;;
18443 esac
18444 echo " "
18445 rp='What pager is used on your system?'
18446 . ./getfile
18447 pager="$ans"
18448
18449 : see what type pids are declared as in the kernel
18450 rp="What is the type of process ids on this system?"
18451 set pid_t pidtype int stdio.h sys/types.h
18452 eval $typedef_ask
18453
18454 : Find earliest binary compatible site_perl subdirectory perl can use.
18455 xs_apiversion=$version # The current site_perl version.
18456 : Find earliest pure perl site_perl subdirectory perl can use.
18457 : The versioned directories started at 5.005.
18458 pm_apiversion='5.005'
18459
18460 : see if ar generates random libraries by itself
18461 echo " "
18462 echo "Checking how to generate random libraries on your machine..." >&4
18463 echo 'int bar1() { return bar2(); }' > bar1.c
18464 echo 'int bar2() { return 2; }' > bar2.c
18465 $cat > foo.c <<'EOP'
18466 int main() { printf("%d\n", bar1()); exit(0); }
18467 EOP
18468 $cc $ccflags -c bar1.c >/dev/null 2>&1
18469 $cc $ccflags -c bar2.c >/dev/null 2>&1
18470 $cc $ccflags -c foo.c >/dev/null 2>&1
18471 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
18472 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18473         $run ./foobar >/dev/null 2>&1; then
18474         echo "$ar appears to generate random libraries itself."
18475         orderlib=false
18476         ranlib=":"
18477 elif $ar ts bar$_a >/dev/null 2>&1 &&
18478         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
18479         $run ./foobar >/dev/null 2>&1; then
18480                 echo "a table of contents needs to be added with '$ar ts'."
18481                 orderlib=false
18482                 ranlib="$ar ts"
18483 else
18484         case "$ranlib" in
18485         :) ranlib='';;
18486         '')
18487                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
18488                 $test -f $ranlib || ranlib=''
18489                 ;;
18490         esac
18491         if $test -n "$ranlib"; then
18492                 echo "your system has '$ranlib'; we'll use that."
18493                 orderlib=false
18494         else
18495                 echo "your system doesn't seem to support random libraries"
18496                 echo "so we'll use lorder and tsort to order the libraries."
18497                 orderlib=true
18498                 ranlib=":"
18499         fi
18500 fi
18501 $rm -f foo* bar* 
18502
18503 : check for type of arguments to select. 
18504 case "$selecttype" in
18505 '') case "$d_select" in
18506         $define)
18507                 echo " "
18508                 $cat <<EOM
18509 Checking to see what type of arguments are accepted by select().
18510 EOM
18511                 hdrs="$define sys/types.h
18512                         $i_systime sys/time.h 
18513                         $i_sysselct sys/select.h
18514                         $d_socket sys/socket.h"
18515                 : The first arg can be int, unsigned, or size_t
18516                 : The last arg may or may not be 'const'
18517                 val=''
18518                 : void pointer has been seen but using that
18519                 : breaks the selectminbits test
18520                 for xxx in 'fd_set *' 'int *'; do
18521                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
18522                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
18523                                         case "$val" in
18524                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
18525                                                 if ./protochk "$try" $hdrs; then
18526                                                         echo "Your system accepts $xxx."
18527                                                         val="$xxx"
18528                                                 fi
18529                                                 ;;
18530                                         esac
18531                                 done
18532                         done
18533                 done
18534                 case "$val" in
18535                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
18536                         case "$d_fd_set" in
18537                                 $define) dflt="fd_set *" ;;
18538                                 *)              dflt="int *" ;;
18539                         esac
18540                         . ./myread
18541                         val=$ans
18542                         ;;
18543                 esac
18544                 selecttype="$val"
18545                 ;;
18546         *)      : no select, so pick a harmless default
18547                 selecttype='int *'
18548                 ;;
18549         esac
18550         ;;
18551 esac
18552
18553 : check for the select 'width'
18554 case "$selectminbits" in
18555 '') case "$d_select" in
18556         $define)
18557                 $cat <<EOM
18558
18559 Checking to see on how many bits at a time your select() operates...
18560 EOM
18561                 $cat >try.c <<EOCP
18562 #include <sys/types.h>
18563 #$i_time I_TIME
18564 #$i_systime I_SYS_TIME
18565 #$i_systimek I_SYS_TIME_KERNEL
18566 #ifdef I_TIME
18567 #   include <time.h>
18568 #endif
18569 #ifdef I_SYS_TIME
18570 #   ifdef I_SYS_TIME_KERNEL
18571 #       define KERNEL
18572 #   endif
18573 #   include <sys/time.h>
18574 #   ifdef I_SYS_TIME_KERNEL
18575 #       undef KERNEL
18576 #   endif
18577 #endif
18578 #$i_sysselct I_SYS_SELECT
18579 #ifdef I_SYS_SELECT
18580 #include <sys/select.h>
18581 #endif
18582 #$d_socket HAS_SOCKET
18583 #ifdef HAS_SOCKET
18584 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
18585 #endif
18586 #include <stdio.h>
18587 #$i_stdlib I_STDLIB
18588 #ifdef I_STDLIB
18589 #include <stdlib.h>
18590 #endif
18591 $selecttype b;
18592 #define S sizeof(*(b))
18593 #define MINBITS 64
18594 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
18595 #define NBITS  (NBYTES * 8)
18596 int main() {
18597     char s[NBYTES];
18598     struct timeval t;
18599     int i;
18600     FILE* fp;
18601     int fd;
18602
18603     fclose(stdin);
18604     fp = fopen("try.c", "r");
18605     if (fp == 0)
18606       exit(1);
18607     fd = fileno(fp);
18608     if (fd < 0)
18609       exit(2);
18610     b = ($selecttype)s;
18611     for (i = 0; i < NBITS; i++)
18612         FD_SET(i, b);
18613     t.tv_sec  = 0;
18614     t.tv_usec = 0;
18615     select(fd + 1, b, 0, 0, &t);
18616     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
18617     printf("%d\n", i + 1);
18618     return 0;
18619 }
18620 EOCP
18621                 set try
18622                 if eval $compile_ok; then
18623                         selectminbits=`$run ./try`
18624                         case "$selectminbits" in
18625                         '')     cat >&4 <<EOM
18626 Cannot figure out on how many bits at a time your select() operates.
18627 I'll play safe and guess it is 32 bits.
18628 EOM
18629                                 selectminbits=32
18630                                 bits="32 bits"
18631                                 ;;
18632                         1)      bits="1 bit" ;;
18633                         *)      bits="$selectminbits bits" ;;
18634                         esac
18635                         echo "Your select() operates on $bits at a time." >&4
18636                 else
18637                         rp='What is the minimum number of bits your select() operates on?'
18638                         case "$byteorder" in
18639                         1234|12345678)  dflt=32 ;;
18640                         *)              dflt=1  ;;
18641                         esac
18642                         . ./myread
18643                         val=$ans
18644                         selectminbits="$val"
18645                 fi
18646                 $rm -f try.* try
18647                 ;;
18648         *)      : no select, so pick a harmless default
18649                 selectminbits='32'
18650                 ;;
18651         esac
18652         ;;
18653 esac
18654
18655 : Trace out the files included by signal.h, then look for SIGxxx names.
18656 : Remove SIGARRAYSIZE used by HPUX.
18657 : Remove SIGSTKSIZE used by Linux.
18658 : Remove SIGSTKSZ used by Posix.
18659 : Remove SIGTYP void lines used by OS2.
18660 : Some cpps, like os390, dont give the file name anywhere
18661 if [ "X$fieldn" = X ]; then
18662         : Just make some guesses.  We check them later.
18663         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
18664 else
18665         xxx=`echo '#include <signal.h>' |
18666         $cppstdin $cppminus $cppflags 2>/dev/null |
18667         $grep '^[       ]*#.*include' | 
18668         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
18669 fi
18670 : Check this list of files to be sure we have parsed the cpp output ok.
18671 : This will also avoid potentially non-existent files, such 
18672 : as ../foo/bar.h
18673 xxxfiles=''
18674 for xx in $xxx /dev/null ; do
18675         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
18676 done
18677 : If we have found no files, at least try signal.h
18678 case "$xxxfiles" in
18679 '')     xxxfiles=`./findhdr signal.h` ;;
18680 esac
18681 xxx=`awk '
18682 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
18683         print substr($2, 4, 20)
18684 }
18685 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
18686         print substr($3, 4, 20)
18687 }' $xxxfiles`
18688 : Append some common names just in case the awk scan failed.
18689 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
18690 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
18691 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
18692 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
18693 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
18694
18695 : generate a few handy files for later
18696 $cat > signal.c <<'EOCP'
18697 #include <sys/types.h>
18698 #include <signal.h>
18699 #include <stdio.h>
18700 int main() {
18701
18702 /* Strange style to avoid deeply-nested #if/#else/#endif */
18703 #ifndef NSIG
18704 #  ifdef _NSIG
18705 #    define NSIG (_NSIG)
18706 #  endif
18707 #endif
18708
18709 #ifndef NSIG
18710 #  ifdef SIGMAX
18711 #    define NSIG (SIGMAX+1)
18712 #  endif
18713 #endif
18714
18715 #ifndef NSIG
18716 #  ifdef SIG_MAX
18717 #    define NSIG (SIG_MAX+1)
18718 #  endif
18719 #endif
18720
18721 #ifndef NSIG
18722 #  ifdef MAXSIG
18723 #    define NSIG (MAXSIG+1)
18724 #  endif
18725 #endif
18726
18727 #ifndef NSIG
18728 #  ifdef MAX_SIG
18729 #    define NSIG (MAX_SIG+1)
18730 #  endif
18731 #endif
18732
18733 #ifndef NSIG
18734 #  ifdef SIGARRAYSIZE
18735 #    define NSIG (SIGARRAYSIZE+1) /* Not sure of the +1 */
18736 #  endif
18737 #endif
18738
18739 #ifndef NSIG
18740 #  ifdef _sys_nsig
18741 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
18742 #  endif
18743 #endif
18744
18745 /* Default to some arbitrary number that's big enough to get most
18746    of the common signals.
18747 */
18748 #ifndef NSIG
18749 #    define NSIG 50
18750 #endif
18751
18752 printf("NSIG %d\n", NSIG);
18753
18754 #ifndef JUST_NSIG
18755
18756 EOCP
18757
18758 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
18759 {
18760         printf "#ifdef SIG"; printf $1; printf "\n"
18761         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
18762         printf $1; printf ");\n"
18763         printf "#endif\n"
18764 }
18765 END {
18766         printf "#endif /* JUST_NSIG */\n";
18767         printf "exit(0);\n}\n";
18768 }
18769 ' >>signal.c
18770 $cat >signal.awk <<'EOP'
18771 BEGIN { ndups = 0 }
18772 $1 ~ /^NSIG$/ { nsig = $2 }
18773 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
18774     if ($2 > maxsig) { maxsig = $2 }
18775     if (sig_name[$2]) {
18776         dup_name[ndups] = $1
18777         dup_num[ndups] = $2
18778         ndups++ 
18779     }
18780     else {
18781         sig_name[$2] = $1
18782         sig_num[$2] = $2
18783     }
18784 }
18785 END { 
18786     if (nsig == 0) {
18787         nsig = maxsig + 1
18788     }
18789     printf("NSIG %d\n", nsig);
18790     for (n = 1; n < nsig; n++) {
18791         if (sig_name[n]) {
18792             printf("%s %d\n", sig_name[n], sig_num[n])
18793         }
18794         else {
18795             printf("NUM%d %d\n", n, n) 
18796         }
18797     }
18798     for (n = 0; n < ndups; n++) {
18799         printf("%s %d\n", dup_name[n], dup_num[n])
18800     }
18801 }
18802 EOP
18803 $cat >signal_cmd <<EOS
18804 $startsh
18805 if $test -s signal.lst; then
18806     echo "Using your existing signal.lst file"
18807         exit 0
18808 fi
18809 xxx="$xxx"
18810 EOS
18811 $cat >>signal_cmd <<'EOS'
18812
18813 set signal
18814 if eval $compile_ok; then
18815         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
18816 else
18817         echo "(I can't seem be able to compile the whole test program)" >&4
18818         echo "(I'll try it in little pieces.)" >&4
18819         set signal -DJUST_NSIG
18820         if eval $compile_ok; then
18821                 $run ./signal$_exe > signal.nsg
18822                 $cat signal.nsg
18823         else
18824                 echo "I can't seem to figure out how many signals you have." >&4
18825                 echo "Guessing 50." >&4
18826                 echo 'NSIG 50' > signal.nsg
18827         fi
18828         : Now look at all the signal names, one at a time.
18829         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
18830                 $cat > signal.c <<EOCP
18831 #include <sys/types.h>
18832 #include <signal.h>
18833 #include <stdio.h>
18834 int main() {
18835 printf("$xx %d\n", SIG${xx});
18836 return 0;
18837 }
18838 EOCP
18839                 set signal
18840                 if eval $compile; then
18841                         echo "SIG${xx} found."
18842                         $run ./signal$_exe  >> signal.ls1
18843                 else
18844                         echo "SIG${xx} NOT found."
18845                 fi
18846         done
18847         if $test -s signal.ls1; then
18848                 $cat signal.nsg signal.ls1 |
18849                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
18850         fi
18851
18852 fi
18853 if $test -s signal.lst; then
18854         :
18855 else
18856         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
18857         echo 'kill -l' >signal
18858         set X `csh -f <signal`
18859         $rm -f signal
18860         shift
18861         case $# in
18862         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
18863         esac
18864         echo $@ | $tr ' ' $trnl | \
18865             $awk '{ printf "%s %d\n", $1, ++s; }
18866                   END { printf "NSIG %d\n", ++s }' >signal.lst
18867 fi
18868 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
18869 EOS
18870 chmod a+x signal_cmd
18871 $eunicefix signal_cmd
18872
18873 : generate list of signal names
18874 echo " "
18875 case "$sig_name_init" in
18876 '') doinit=yes ;;
18877 *)  case "$sig_num_init" in
18878     ''|*,*) doinit=yes ;;
18879     esac ;;
18880 esac
18881 case "$doinit" in
18882 yes)
18883         echo "Generating a list of signal names and numbers..." >&4
18884         . ./signal_cmd
18885         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
18886         sig_name=`$awk 'BEGIN { printf "ZERO " }
18887                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
18888         sig_num=`$awk  'BEGIN { printf "0 " }
18889                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
18890         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
18891                              !/^NSIG/   { printf "\"%s\", ", $1 }
18892                              END        { printf "0\n" }' signal.lst`
18893         sig_num_init=`$awk  'BEGIN      { printf "0, " }
18894                              !/^NSIG/   { printf "%d, ", $2}
18895                              END        { printf "0\n"}' signal.lst`
18896         ;;
18897 esac
18898 echo "The following $sig_count signals are available:"
18899 echo " "
18900 echo $sig_name | $awk \
18901 'BEGIN { linelen = 0 }
18902 {
18903         for (i = 1; i <= NF; i++) {
18904                 name = "SIG" $i " "
18905                 linelen = linelen + length(name)
18906                 if (linelen > 70) {
18907                         printf "\n"
18908                         linelen = length(name)
18909                 }
18910                 printf "%s", name
18911         }
18912         printf "\n"
18913 }'
18914 sig_size=`echo $sig_name | awk '{print NF}'`
18915 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
18916
18917 echo " "
18918 case "$sizetype" in
18919 *_t) zzz="$sizetype"    ;;
18920 *)   zzz="filesize"     ;;
18921 esac
18922 echo "Checking the size of $zzz..." >&4 
18923 cat > try.c <<EOCP
18924 #include <sys/types.h>
18925 #include <stdio.h>
18926 #$i_stdlib I_STDLIB
18927 #ifdef I_STDLIB
18928 #include <stdlib.h>
18929 #endif
18930 int main() {
18931     printf("%d\n", (int)sizeof($sizetype));
18932     exit(0);
18933 }
18934 EOCP
18935 set try
18936 if eval $compile_ok; then
18937         yyy=`$run ./try`
18938         case "$yyy" in
18939         '')     sizesize=4
18940                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
18941                 ;;
18942         *)      sizesize=$yyy
18943                 echo "Your $zzz size is $sizesize bytes."
18944                 ;;
18945         esac
18946 else
18947         sizesize=4
18948         echo "(I can't compile the test program--guessing $sizesize.)" >&4
18949 fi
18950
18951
18952 : check for socklen_t
18953 echo " "
18954 echo "Checking to see if you have socklen_t..." >&4
18955 $cat >try.c <<EOCP
18956 #include <sys/types.h>
18957 #$d_socket HAS_SOCKET
18958 #ifdef HAS_SOCKET
18959 #include <sys/socket.h>
18960 #endif
18961 int main() { socklen_t x = 16; }
18962 EOCP
18963 set try
18964 if eval $compile; then
18965         val="$define"
18966         echo "You have socklen_t."
18967 else
18968         val="$undef"
18969         echo "You do not have socklen_t."
18970         case "$sizetype" in
18971         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
18972         esac
18973 fi
18974 $rm -f try try.*
18975 set d_socklen_t
18976 eval $setvar
18977
18978 : see if this is a socks.h system
18979 set socks.h i_socks
18980 eval $inhdr
18981
18982 : check for type of the size argument to socket calls
18983 case "$d_socket" in
18984 "$define")
18985         $cat <<EOM
18986
18987 Checking to see what type is the last argument of accept().
18988 EOM
18989         yyy=''
18990         case "$d_socklen_t" in
18991         "$define") yyy="$yyy socklen_t"
18992         esac
18993         yyy="$yyy $sizetype int long unsigned"
18994         for xxx in $yyy; do
18995                 case "$socksizetype" in
18996                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
18997                         case "$usesocks" in
18998                         "$define")
18999                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19000                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19001                                         socksizetype="$xxx"
19002                                 fi
19003                                 ;;
19004                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19005                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19006                                         socksizetype="$xxx"
19007                                 fi
19008                                 ;;
19009                         esac
19010                         ;;
19011                 esac
19012         done
19013 : In case none of those worked, prompt the user.
19014         case "$socksizetype" in
19015         '')     rp='What is the type for socket address structure sizes?'
19016                 dflt='int'
19017                 . ./myread
19018                 socksizetype=$ans
19019                 ;;
19020         esac
19021         ;;
19022 *)      : no sockets, so pick relatively harmless default
19023         socksizetype='int'
19024         ;;
19025 esac
19026
19027 : see what type is used for signed size_t
19028 set ssize_t ssizetype int stdio.h sys/types.h
19029 eval $typedef
19030 dflt="$ssizetype"
19031 $cat > try.c <<EOM
19032 #include <stdio.h>
19033 #$i_stdlib I_STDLIB
19034 #ifdef I_STDLIB
19035 #include <stdlib.h>
19036 #endif
19037 #include <sys/types.h>
19038 #define Size_t $sizetype
19039 #define SSize_t $dflt
19040 int main()
19041 {
19042         if (sizeof(Size_t) == sizeof(SSize_t))
19043                 printf("$dflt\n");
19044         else if (sizeof(Size_t) == sizeof(int))
19045                 printf("int\n");
19046         else 
19047                 printf("long\n");
19048         exit(0);
19049 }
19050 EOM
19051 echo " "
19052 set try
19053 if eval $compile_ok && $run ./try > /dev/null; then
19054         ssizetype=`$run ./try`
19055         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19056 else
19057         $cat >&4 <<EOM
19058 Help! I can't compile and run the ssize_t test program: please enlighten me!
19059 (This is probably a misconfiguration in your system or libraries, and
19060 you really ought to fix it.  Still, I'll try anyway.)
19061
19062 I need a type that is the same size as $sizetype, but is guaranteed to
19063 be signed.  Common values are ssize_t, int and long.
19064
19065 EOM
19066         rp="What signed type is the same size as $sizetype?"
19067         . ./myread
19068         ssizetype="$ans"
19069 fi
19070 $rm -f try try.*
19071
19072 : see what type of char stdio uses.
19073 echo " "
19074 echo '#include <stdio.h>' | $cppstdin $cppminus > stdioh
19075 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19076         echo "Your stdio uses unsigned chars." >&4
19077         stdchar="unsigned char"
19078 else
19079         echo "Your stdio uses signed chars." >&4
19080         stdchar="char"
19081 fi
19082 $rm -f stdioh
19083
19084
19085
19086 : see what type uids are declared as in the kernel
19087 echo " "
19088 echo "Looking for the type for user ids returned by getuid()."
19089 set uid_t uidtype xxx stdio.h sys/types.h
19090 eval $typedef
19091 case "$uidtype" in
19092 xxx)
19093         xxx=`./findhdr sys/user.h`
19094         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19095         case $1 in
19096         unsigned) dflt="$1 $2" ;;
19097         *) dflt="$1" ;;
19098         esac
19099         ;;
19100 *) dflt="$uidtype";;
19101 esac
19102 case "$uidtype" in
19103 uid_t)  echo "uid_t found." ;;
19104 *)      rp="What is the type for user ids returned by getuid()?"
19105         . ./myread
19106         uidtype="$ans"
19107         ;;
19108 esac
19109
19110 echo " "
19111 case "$uidtype" in
19112 *_t) zzz="$uidtype"     ;;
19113 *)   zzz="uid"          ;;
19114 esac
19115 echo "Checking the size of $zzz..." >&4 
19116 cat > try.c <<EOCP
19117 #include <sys/types.h>
19118 #include <stdio.h>
19119 #$i_stdlib I_STDLIB
19120 #ifdef I_STDLIB
19121 #include <stdlib.h>
19122 #endif
19123 int main() {
19124     printf("%d\n", (int)sizeof($uidtype));
19125     exit(0);
19126 }
19127 EOCP
19128 set try
19129 if eval $compile_ok; then
19130         yyy=`$run ./try`
19131         case "$yyy" in
19132         '')     uidsize=4
19133                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19134                 ;;
19135         *)      uidsize=$yyy
19136                 echo "Your $zzz is $uidsize bytes long."
19137                 ;;
19138         esac
19139 else
19140         uidsize=4
19141         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19142 fi
19143
19144 echo " "
19145 case "$uidtype" in
19146 *_t) zzz="$uidtype"     ;;
19147 *)   zzz="uid"          ;;
19148 esac
19149 echo "Checking the sign of $zzz..." >&4
19150 cat > try.c <<EOCP
19151 #include <sys/types.h>
19152 #include <stdio.h>
19153 int main() {
19154         $uidtype foo = -1;
19155         if (foo < 0)
19156                 printf("-1\n");
19157         else
19158                 printf("1\n");
19159 }
19160 EOCP
19161 set try
19162 if eval $compile; then
19163         yyy=`$run ./try`
19164         case "$yyy" in
19165         '')     uidsign=1
19166                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19167                 ;;
19168         *)      uidsign=$yyy
19169                 case "$uidsign" in
19170                  1) echo "Your $zzz is unsigned." ;;
19171                 -1) echo "Your $zzz is signed."   ;;
19172                 esac
19173                 ;;
19174         esac
19175 else
19176         uidsign=1
19177         echo "(I can't compile the test program--guessing unsigned.)" >&4
19178 fi
19179
19180
19181
19182 echo " "
19183 $echo "Checking the format string to be used for uids..." >&4
19184
19185 case "$uidsign" in
19186 -1)     if $test X"$uidsize" = X"$ivsize"; then
19187                 uidformat="$ivdformat"
19188         else
19189                 if $test X"$uidsize" = X"$longsize"; then
19190                         uidformat='"ld"'
19191                 else
19192                         if $test X"$uidsize" = X"$intsize"; then
19193                                 uidformat='"d"'
19194                         else
19195                                 if $test X"$uidsize" = X"$shortsize"; then
19196                                         uidformat='"hd"'
19197                                 fi
19198                         fi
19199                 fi
19200         fi
19201         ;;
19202 *)      if $test X"$uidsize" = X"$uvsize"; then
19203                 uidformat="$uvuformat"
19204         else
19205                 if $test X"$uidsize" = X"$longsize"; then
19206                         uidformat='"lu"'
19207                 else
19208                         if $test X"$uidsize" = X"$intsize"; then
19209                                 uidformat='"u"'
19210                         else
19211                                 if $test X"$uidsize" = X"$shortsize"; then
19212                                         uidformat='"hu"'
19213                                 fi
19214                         fi
19215                 fi
19216         fi
19217         ;;
19218 esac
19219
19220 : determine compiler compiler
19221 case "$yacc" in
19222 '')
19223         dflt=yacc;;
19224 *)
19225         dflt="$yacc";;
19226 esac
19227 echo " "
19228 comp='yacc'
19229 if $test -f "$byacc$_exe"; then
19230         dflt="$byacc"
19231         comp="byacc or $comp"
19232 fi
19233 if $test -f "$bison$_exe"; then
19234         comp="$comp or bison -y"
19235 fi
19236 rp="Which compiler compiler ($comp) shall I use?"
19237 . ./myread
19238 yacc="$ans"
19239 case "$yacc" in
19240 *bis*)
19241         case "$yacc" in
19242         *-y*) ;;
19243         *)
19244                 yacc="$yacc -y"
19245                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
19246                 ;;
19247         esac
19248         ;;
19249 esac
19250
19251 : see if this is a fp.h system
19252 set fp.h i_fp
19253 eval $inhdr
19254
19255 : see if this is a fp_class.h system
19256 set fp_class.h i_fp_class
19257 eval $inhdr
19258
19259 : see if this is a ieeefp.h system
19260 case "$i_ieeefp" in
19261 '' ) set ieeefp.h i_ieeefp
19262      eval $inhdr
19263      ;;
19264 esac
19265
19266 : see if this is a libutil.h system
19267 set libutil.h i_libutil
19268 eval $inhdr
19269
19270 : see if mach cthreads are available
19271 if test "X$usethreads" = "X$define"; then
19272         set mach/cthreads.h i_machcthr
19273         eval $inhdr
19274 else
19275         i_machcthr="$undef"
19276 fi
19277
19278
19279
19280 : see if this is a math.h system
19281 set math.h i_math
19282 eval $inhdr
19283
19284 : see if this is a mntent.h system
19285 set mntent.h i_mntent
19286 eval $inhdr
19287
19288 : see if ndbm.h is available
19289 set ndbm.h t_ndbm
19290 eval $inhdr
19291
19292 case "$t_ndbm" in
19293 $undef)
19294     # Some Linux distributions such as RedHat 7.1 put the
19295     # ndbm.h header in /usr/include/gdbm/ndbm.h.
19296     if $test -f /usr/include/gdbm/ndbm.h; then
19297         echo '<gdbm/ndbm.h> found.'
19298         ccflags="$ccflags -I/usr/include/gdbm"
19299         cppflags="$cppflags -I/usr/include/gdbm"
19300         t_ndbm=$define
19301     fi
19302     ;;
19303 esac
19304
19305 case "$t_ndbm" in
19306 $define)
19307         : see if dbm_open exists
19308         set dbm_open d_dbm_open
19309         eval $inlibc
19310         case "$d_dbm_open" in
19311         $undef)
19312                 t_ndbm="$undef"
19313                 echo "We won't be including <ndbm.h>"
19314                 ;;
19315         esac
19316         ;;
19317 esac
19318 val="$t_ndbm"
19319 set i_ndbm
19320 eval $setvar
19321
19322 : see if net/errno.h is available
19323 val=''
19324 set net/errno.h val
19325 eval $inhdr
19326
19327 : Unfortunately, it causes problems on some systems.  Arrgh.
19328 case "$val" in
19329 $define)
19330         cat > try.c <<'EOM'
19331 #include <stdio.h>
19332 #include <errno.h>
19333 #include <net/errno.h>
19334 int func()
19335 {
19336         return ENOTSOCK;
19337 }
19338 EOM
19339         if $cc $ccflags -c try.c >/dev/null 2>&1; then
19340                 echo "We'll be including <net/errno.h>." >&4
19341         else
19342                 echo "We won't be including <net/errno.h>." >&4
19343                 val="$undef"
19344         fi
19345         $rm -f try.* try
19346         ;;
19347 esac
19348 set i_neterrno
19349 eval $setvar
19350
19351 : see if netinet/tcp.h is available
19352 set netinet/tcp.h i_netinettcp
19353 eval $inhdr
19354
19355 : see if this is a poll.h system
19356 set poll.h i_poll
19357 eval $inhdr
19358
19359 : see if this is a prot.h system
19360 set prot.h i_prot
19361 eval $inhdr
19362
19363 echo " "
19364 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4 
19365 $cat <<'EOSH' > Cppsym.know
19366 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
19367 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
19368 alliant alpha am29000 AM29000 AMD64 amiga AMIGAOS AMIX
19369 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
19370 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
19371 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
19372 bull c cadmus clipper CMU COFF COMPILER_VERSION
19373 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
19374 CYGWIN DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
19375 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
19376 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
19377 GLIBC GLIBC_MINOR
19378 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
19379 H3050R H3050RX hbullx20 hcx host_mips
19380 hp200 hp300 hp700 HP700 hp800 hp9000
19381 hp9000s200 hp9000s300 hp9000s400 hp9000s500
19382 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
19383 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
19384 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
19385 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
19386 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
19387 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
19388 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
19389 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
19390 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
19391 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
19392 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
19393 MATH_HAS_NO_SIDE_EFFECTS
19394 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
19395 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
19396 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
19397 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
19398 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
19399 NetBSD news1500 news1700 news1800 news1900 news3700
19400 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
19401 ns32016 ns32332 ns32k nsc32000
19402 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
19403 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
19404 pc532 pdp11 PGC PIC plexus PORTAR posix
19405 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
19406 POSIX_C_SOURCE POSIX_SOURCE POWER
19407 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
19408 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
19409 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
19410 sony sony_news sonyrisc sparc sparclite spectrum
19411 stardent stdc STDC_EXT stratos sun sun3 sun386
19412 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
19413 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
19414 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
19415 sysV68 sysV88 Tek4132 Tek4300 titan
19416 TM3200 TM5400 TM5600
19417 tower tower32 tower32_200 tower32_600 tower32_700
19418 tower32_800 tower32_850 tss
19419 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
19420 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
19421 unix UNIX95 UNIX99 unixpc unos
19422 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
19423 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
19424 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
19425 USGr4 USGr4_2
19426 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms xenix Xenix286
19427 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
19428 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
19429 z8000
19430 EOSH
19431 # Maybe put other stuff here too.
19432 cat <<EOSH >>Cppsym.know
19433 $osname
19434 EOSH
19435 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
19436 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
19437 $cat Cppsym.know > Cppsym.c
19438 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
19439 $rm -f Cppsym.a Cppsym.b Cppsym.c
19440 cat <<EOSH > Cppsym
19441 $startsh
19442 if $test \$# -gt 0; then
19443     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
19444     if $test -s Cppsym.got; then
19445         $rm -f Cppsym.got
19446         exit 0
19447     fi
19448     $rm -f Cppsym.got
19449     exit 1
19450 else
19451     $tr " " "$trnl" | ./Cppsym.try
19452     exit 0
19453 fi
19454 EOSH
19455 chmod +x Cppsym
19456 $eunicefix Cppsym
19457 cat <<EOSH > Cppsym.try
19458 $startsh
19459 cat <<'EOCP' > try.c
19460 #include <stdio.h>
19461 int main() {
19462 EOCP
19463 $awk \\
19464 EOSH
19465 cat <<'EOSH' >> Cppsym.try
19466 'length($1) > 0 {
19467     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
19468     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
19469     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
19470     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
19471 }'       >> try.c
19472 echo 'return 0;}' >> try.c
19473 EOSH
19474 cat <<EOSH >> Cppsym.try
19475 ccflags="$ccflags"
19476 case "$osname-$gccversion" in
19477 irix-) ccflags="\$ccflags -woff 1178" ;;
19478 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
19479 esac
19480 $cc -o try $optimize \$ccflags $ldflags try.c $libs && $run ./try
19481 EOSH
19482 chmod +x Cppsym.try
19483 $eunicefix Cppsym.try
19484 ./Cppsym < Cppsym.know > Cppsym.true
19485 : now check the C compiler for additional symbols
19486 postprocess_cc_v=''
19487 case "$osname" in
19488 aix) postprocess_cc_v="|$tr , ' '" ;;
19489 esac
19490 $cat >ccsym <<EOS
19491 $startsh
19492 $cat >tmp.c <<EOF
19493 extern int foo;
19494 EOF
19495 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
19496 do
19497         case "\$i" in
19498         -D*) echo "\$i" | $sed 's/^-D//';;
19499         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
19500         esac
19501 done
19502 $rm -f try.c
19503 EOS
19504 postprocess_cc_v=''
19505 chmod +x ccsym
19506 $eunicefix ccsym
19507 ./ccsym > ccsym1.raw
19508 if $test -s ccsym1.raw; then
19509        $sort ccsym1.raw | $uniq >ccsym.raw
19510 else
19511        mv ccsym1.raw ccsym.raw
19512 fi
19513
19514 $awk '/\=/ { print $0; next }
19515         { print $0"=1" }' ccsym.raw >ccsym.list
19516 $awk '/\=/ { print $0; next }
19517         { print $0"=1" }' Cppsym.true >ccsym.true
19518 $comm -13 ccsym.true ccsym.list >ccsym.own
19519 $comm -12 ccsym.true ccsym.list >ccsym.com
19520 $comm -23 ccsym.true ccsym.list >ccsym.cpp
19521 also=''
19522 if $test -z ccsym.raw; then
19523         echo "Your C compiler doesn't seem to define any symbols!" >&4
19524         echo " "
19525         echo "However, your C preprocessor defines the following symbols:"
19526         $cat Cppsym.true
19527         ccsymbols=''
19528         cppsymbols=`$cat Cppsym.true`
19529         cppsymbols=`echo $cppsymbols`
19530         cppccsymbols="$cppsymbols"
19531 else
19532         if $test -s ccsym.com; then
19533                 echo "Your C compiler and pre-processor define these symbols:"
19534                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
19535                 also='also '
19536                 symbols='ones'
19537                 cppccsymbols=`$cat ccsym.com`
19538                 cppccsymbols=`echo $cppccsymbols`
19539                 $test "$silent" || sleep 1
19540         fi
19541         if $test -s ccsym.cpp; then
19542                 $test "$also" && echo " "
19543                 echo "Your C pre-processor ${also}defines the following symbols:"
19544                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
19545                 also='further '
19546                 cppsymbols=`$cat ccsym.cpp`
19547                 cppsymbols=`echo $cppsymbols`
19548                 $test "$silent" || sleep 1
19549         fi
19550         if $test -s ccsym.own; then
19551                 $test "$also" && echo " "
19552                 echo "Your C compiler ${also}defines the following cpp symbols:"
19553                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
19554                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
19555                 ccsymbols=`$cat ccsym.own`
19556                 ccsymbols=`echo $ccsymbols`
19557                 $test "$silent" || sleep 1
19558         fi
19559 fi
19560
19561 : see if this is a termio system
19562 val="$undef"
19563 val2="$undef"
19564 val3="$undef"
19565 if $test `./findhdr termios.h`; then
19566         set tcsetattr i_termios
19567         eval $inlibc
19568         val3="$i_termios"
19569 fi
19570 echo " "
19571 case "$val3" in
19572 "$define") echo "You have POSIX termios.h... good!" >&4;;
19573 *) if ./Cppsym pyr; then
19574                 case "`/bin/universe`" in
19575                 ucb) if $test `./findhdr sgtty.h`; then
19576                                 val2="$define"
19577                                 echo "<sgtty.h> found." >&4
19578                         else
19579                                 echo "System is pyramid with BSD universe."
19580                                 echo "<sgtty.h> not found--you could have problems." >&4
19581                         fi;;
19582                 *) if $test `./findhdr termio.h`; then
19583                                 val="$define"
19584                                 echo "<termio.h> found." >&4
19585                         else
19586                                 echo "System is pyramid with USG universe."
19587                                 echo "<termio.h> not found--you could have problems." >&4
19588                         fi;;
19589                 esac
19590         elif ./usg; then
19591                 if $test `./findhdr termio.h`; then
19592                         echo "<termio.h> found." >&4
19593                         val="$define"
19594                 elif $test `./findhdr sgtty.h`; then
19595                         echo "<sgtty.h> found." >&4
19596                         val2="$define"
19597                 else
19598 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
19599                 fi
19600         else
19601                 if $test `./findhdr sgtty.h`; then
19602                         echo "<sgtty.h> found." >&4
19603                         val2="$define"
19604                 elif $test `./findhdr termio.h`; then
19605                         echo "<termio.h> found." >&4
19606                         val="$define"
19607                 else
19608 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
19609                 fi
19610         fi;;
19611 esac
19612 set i_termio; eval $setvar
19613 val=$val2; set i_sgtty; eval $setvar
19614 val=$val3; set i_termios; eval $setvar
19615
19616 : see if stddef is available
19617 set stddef.h i_stddef
19618 eval $inhdr
19619
19620 : see if this is a sunmath.h system
19621 set sunmath.h i_sunmath
19622 eval $inhdr
19623
19624 : see if sys/access.h is available
19625 set sys/access.h i_sysaccess
19626 eval $inhdr
19627
19628 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
19629 set sys/filio.h i_sysfilio
19630 eval $inhdr
19631 echo " "
19632 if $test `./findhdr sys/ioctl.h`; then
19633         val="$define"
19634         echo '<sys/ioctl.h> found.' >&4
19635 else
19636         val="$undef"
19637         if $test $i_sysfilio = "$define"; then
19638             echo '<sys/ioctl.h> NOT found.' >&4
19639         else
19640                 $test $i_sgtty = "$define" && xxx="sgtty.h"
19641                 $test $i_termio = "$define" && xxx="termio.h"
19642                 $test $i_termios = "$define" && xxx="termios.h"
19643 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
19644         fi
19645 fi
19646 set i_sysioctl
19647 eval $setvar
19648
19649 : see if socket ioctl defs are in sys/sockio.h
19650 echo " "
19651 xxx=`./findhdr sys/sockio.h`
19652 if $test "$xxx"; then
19653         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
19654                 val="$define"
19655                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
19656         else
19657                 val="$undef"
19658                 echo "No socket ioctls found in <sys/sockio.h>." >&4
19659         fi
19660 else
19661         val="$undef"
19662         $cat <<EOM
19663 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
19664 EOM
19665 fi
19666 set i_syssockio
19667 eval $setvar
19668
19669
19670 : see if this is a syslog.h system
19671 set syslog.h i_syslog
19672 eval $inhdr
19673
19674
19675 : see if this is a sys/mode.h system
19676 set sys/mode.h i_sysmode
19677 eval $inhdr
19678
19679 : see if sys/resource.h has to be included
19680 set sys/resource.h i_sysresrc
19681 eval $inhdr
19682
19683 : see if sys/security.h is available
19684 set sys/security.h i_syssecrt
19685 eval $inhdr
19686
19687 : see if this is a sys/statvfs.h system
19688 set sys/statvfs.h i_sysstatvfs
19689 eval $inhdr
19690
19691 : see if this is a sys/un.h system
19692 set sys/un.h i_sysun
19693 eval $inhdr
19694
19695
19696 : see if this is a sys/utsname.h system
19697 set sys/utsname.h i_sysutsname
19698 eval $inhdr
19699
19700 : see if this is a syswait system
19701 set sys/wait.h i_syswait
19702 eval $inhdr
19703
19704 : see if this is a ustat.h system
19705 set ustat.h i_ustat
19706 eval $inhdr
19707
19708 : see if this is an utime system
19709 set utime.h i_utime
19710 eval $inhdr
19711
19712 : see if this is a values.h system
19713 set values.h i_values
19714 eval $inhdr
19715
19716 : see if this is a vfork system
19717 case "$d_vfork" in
19718 "$define")
19719         set vfork.h i_vfork
19720         eval $inhdr
19721         ;;
19722 *)
19723         i_vfork="$undef"
19724         ;;
19725 esac
19726
19727 : see if gdbm.h is available
19728 set gdbm.h t_gdbm
19729 eval $inhdr
19730 case "$t_gdbm" in
19731 $define)
19732         : see if gdbm_open exists
19733         set gdbm_open d_gdbm_open
19734         eval $inlibc
19735         case "$d_gdbm_open" in
19736         $undef)
19737                 t_gdbm="$undef"
19738                 echo "We won't be including <gdbm.h>"
19739                 ;;
19740         esac
19741         ;;
19742 esac
19743 val="$t_gdbm"
19744 set i_gdbm
19745 eval $setvar
19746
19747 echo " "
19748 echo "Looking for extensions..." >&4
19749 : If we are using the old config.sh, known_extensions may contain
19750 : old or inaccurate or duplicate values.
19751 known_extensions=''
19752 nonxs_extensions=''
19753 : We do not use find because it might not be available.
19754 : We do not just use MANIFEST because the user may have dropped
19755 : some additional extensions into the source tree and expect them
19756 : to be built.
19757
19758 : Function to recursively find available extensions, ignoring DynaLoader
19759 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
19760 find_extensions='
19761     for xxx in *; do
19762        case "$xxx" in
19763            DynaLoader|dynaload) ;;
19764            *)
19765            if $test -f $xxx/$xxx.xs; then
19766                known_extensions="$known_extensions $1$xxx";
19767            elif $test -f $xxx/Makefile.PL; then
19768                nonxs_extensions="$nonxs_extensions $1$xxx";
19769            else
19770                if $test -d $xxx -a $# -lt 10; then
19771                    set $1$xxx/ $*;
19772                    cd "$xxx";
19773                    eval $find_extensions;
19774                    cd ..;
19775                    shift;
19776                fi;
19777            fi
19778            ;;
19779        esac;
19780     done'
19781 tdir=`pwd`
19782 cd "$rsrc/ext"
19783 set X
19784 shift
19785 eval $find_extensions
19786 # Special case:  Add in threads/shared since it is not picked up by the
19787 # recursive find above (and adding in general recursive finding breaks
19788 # SDBM_File/sdbm).  A.D.  10/25/2001.
19789 known_extensions="$known_extensions threads/shared"
19790 set X $nonxs_extensions
19791 shift
19792 nonxs_extensions="$*"
19793 set X $known_extensions
19794 shift
19795 known_extensions="$*"
19796 cd "$tdir"
19797
19798 : Now see which are supported on this system.
19799 avail_ext=''
19800 for xxx in $known_extensions ; do
19801         case "$xxx" in
19802         DB_File|db_file)
19803                 case "$i_db" in
19804                 $define) avail_ext="$avail_ext $xxx" ;;
19805                 esac
19806                 ;;
19807         GDBM_File|gdbm_fil)
19808                 case "$i_gdbm" in 
19809                 $define) avail_ext="$avail_ext $xxx" ;;
19810                 esac
19811                 ;;
19812         I18N/Langinfo|i18n_lan)
19813                 case "$i_langinfo$d_nl_langinfo" in 
19814                 $define$define) avail_ext="$avail_ext $xxx" ;;
19815                 esac
19816                 ;;
19817         NDBM_File|ndbm_fil)
19818                 case "$i_ndbm" in
19819                 $define)
19820                     case "$osname-$use64bitint" in
19821                     hpux-define)
19822                         case "$libs" in
19823                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
19824                         esac
19825                         ;;
19826                     *) avail_ext="$avail_ext $xxx" ;;
19827                     esac
19828                     ;;
19829                 esac
19830                 ;;
19831         ODBM_File|odbm_fil) 
19832                 case "${i_dbm}${i_rpcsvcdbm}" in
19833                 *"${define}"*)
19834                     case "$osname-$use64bitint" in
19835                     hpux-define)
19836                         case "$libs" in
19837                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
19838                         esac
19839                         ;;
19840                     *) avail_ext="$avail_ext $xxx" ;;
19841                     esac
19842                     ;;
19843                 esac
19844                 ;;
19845         POSIX|posix)
19846                 case "$useposix" in
19847                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19848                 esac
19849                 ;;
19850         Opcode|opcode)
19851                 case "$useopcode" in
19852                 true|define|y) avail_ext="$avail_ext $xxx" ;;
19853                 esac
19854                 ;;
19855         Socket|socket)
19856                 case "$d_socket" in 
19857                 true|$define|y)
19858                     case "$osname" in
19859                     beos) ;; # not unless BONE
19860                     *) avail_ext="$avail_ext $xxx" ;;
19861                     esac
19862                     ;;
19863                 esac
19864                 ;;
19865         Sys/Syslog|sys/syslog)
19866                 : XXX syslog requires socket
19867                 case "$d_socket" in 
19868                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
19869                 esac
19870                 ;;
19871         Thread|thread)
19872                 case "$usethreads" in
19873                 true|$define|y)
19874                         case "$useithreads" in
19875                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
19876                         esac
19877                 esac
19878                 ;;
19879         XS/APItest|xs/apitest)
19880                 # This is just for testing.  Skip it unless we have dynamic loading.
19881
19882                 case "$usedl" in
19883                 $define) avail_ext="$avail_ext $xxx" ;;
19884                 esac
19885                 ;;
19886         XS/Typemap|xs/typemap)
19887                 # This is just for testing.  Skip it unless we have dynamic loading.
19888                 case "$usedl" in
19889                 $define) avail_ext="$avail_ext $xxx" ;;
19890                 esac
19891                 ;;
19892         threads|threads/shared)
19893                 # threads and threads::shared are special cases.
19894                 # To stop people from asking "Perl 5.8.0 was supposed
19895                 # to have this new fancy threads implementation but my
19896                 # perl doesn't have it" and from people trying to
19897                 # (re)install the threads module using CPAN.pm and
19898                 # CPAN.pm then offering to reinstall Perl 5.8.0,
19899                 # the threads.pm and threads/shared.pm will always be
19900                 # there, croaking informatively ("you need to rebuild
19901                 # all of Perl with threads, sorry") when threads haven't
19902                 # been compiled in.
19903                 # --jhi
19904                 avail_ext="$avail_ext $xxx"
19905                 ;;
19906         IPC/SysV|ipc/sysv)
19907                 : XXX Do we need a useipcsysv variable here
19908                 case "${d_msg}${d_sem}${d_shm}" in 
19909                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
19910                 esac
19911                 ;;
19912         *)      avail_ext="$avail_ext $xxx"
19913                 ;;
19914         esac
19915 done
19916
19917 set X $avail_ext
19918 shift
19919 avail_ext="$*"
19920
19921 : Now see which nonxs extensions are supported on this system.
19922 : For now assume all are.
19923 nonxs_ext=''
19924 for xxx in $nonxs_extensions ; do
19925         case "$xxx" in
19926         *)      nonxs_ext="$nonxs_ext $xxx"
19927                 ;;
19928         esac
19929 done
19930
19931 set X $nonxs_ext
19932 shift
19933 nonxs_ext="$*"
19934
19935 case $usedl in
19936 $define)
19937         $cat <<EOM
19938 A number of extensions are supplied with $package.  You may choose to
19939 compile these extensions for dynamic loading (the default), compile
19940 them into the $package executable (static loading), or not include
19941 them at all.  Answer "none" to include no extensions.
19942 Note that DynaLoader is always built and need not be mentioned here.
19943
19944 EOM
19945         case "$dynamic_ext" in
19946         '')
19947                 : Exclude those listed in static_ext
19948                 dflt=''
19949                 for xxx in $avail_ext; do
19950                         case " $static_ext " in
19951                         *" $xxx "*) ;;
19952                         *) dflt="$dflt $xxx" ;;
19953                         esac
19954                 done
19955                 set X $dflt
19956                 shift
19957                 dflt="$*"
19958                 ;;
19959         *)      dflt="$dynamic_ext"
19960                 # Perhaps we are reusing an old out-of-date config.sh.
19961                 case "$hint" in
19962                 previous)
19963                         if test X"$dynamic_ext" != X"$avail_ext"; then
19964                                 $cat <<EOM
19965 NOTICE:  Your previous config.sh list may be incorrect. 
19966 The extensions now available to you are 
19967         ${avail_ext}
19968 but the default list from your previous config.sh is
19969         ${dynamic_ext} 
19970
19971 EOM
19972                         fi
19973                         ;;
19974                 esac
19975                 ;;
19976         esac
19977         case "$dflt" in
19978         '')     dflt=none;;
19979         esac
19980         rp="What extensions do you wish to load dynamically?"
19981         . ./myread
19982         case "$ans" in
19983         none) dynamic_ext=' ' ;;
19984         *) dynamic_ext="$ans" ;;
19985         esac
19986
19987         case "$static_ext" in
19988         '')
19989                 : Exclude those already listed in dynamic linking
19990                 dflt=''
19991                 for xxx in $avail_ext; do
19992                         case " $dynamic_ext " in
19993                         *" $xxx "*) ;;
19994                         *) dflt="$dflt $xxx" ;;
19995                         esac
19996                 done
19997                 set X $dflt
19998                 shift
19999                 dflt="$*"
20000                 ;;
20001         *)  dflt="$static_ext" 
20002                 ;;
20003         esac
20004
20005         case "$dflt" in
20006         '')     dflt=none;;
20007         esac
20008         rp="What extensions do you wish to load statically?"
20009         . ./myread
20010         case "$ans" in
20011         none) static_ext=' ' ;;
20012         *) static_ext="$ans" ;;
20013         esac
20014         ;;
20015 *)
20016         $cat <<EOM
20017 A number of extensions are supplied with $package.  Answer "none" 
20018 to include no extensions. 
20019 Note that DynaLoader is always built and need not be mentioned here.
20020
20021 EOM
20022         case "$static_ext" in
20023         '') dflt="$avail_ext" ;;
20024         *)      dflt="$static_ext"
20025                 # Perhaps we are reusing an old out-of-date config.sh.
20026                 case "$hint" in
20027                 previous)
20028                         if test X"$static_ext" != X"$avail_ext"; then
20029                                 $cat <<EOM
20030 NOTICE:  Your previous config.sh list may be incorrect. 
20031 The extensions now available to you are 
20032         ${avail_ext}
20033 but the default list from your previous config.sh is
20034         ${static_ext} 
20035
20036 EOM
20037                         fi
20038                         ;;
20039                 esac
20040                 ;;
20041         esac
20042         : Exclude those that are not xs extensions
20043         case "$dflt" in
20044         '')     dflt=none;;
20045         esac
20046         rp="What extensions do you wish to include?"
20047         . ./myread
20048         case "$ans" in
20049         none) static_ext=' ' ;;
20050         *) static_ext="$ans" ;;
20051         esac
20052         ;;
20053 esac
20054 #        
20055 # Encode is a special case.  If we are building Encode as a static
20056 # extension, we need to explicitly list its subextensions as well.
20057 # For other nested extensions, this is handled automatically by
20058 # the appropriate Makefile.PL.
20059 case " $static_ext " in
20060         *" Encode "*) # Add the subextensions of Encode
20061         cd "$rsrc/ext"
20062         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20063                 static_ext="$static_ext Encode/$xxx"
20064         done
20065         cd "$tdir"
20066         ;;
20067 esac
20068
20069 set X $dynamic_ext $static_ext $nonxs_ext
20070 shift
20071 extensions="$*"
20072
20073 : Remove libraries needed only for extensions
20074 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20075 : The exception is SunOS 4.x, which needs them.
20076 case "${osname}X${osvers}" in
20077 sunos*X4*)
20078     perllibs="$libs"
20079     ;;
20080 *) case "$usedl" in
20081     $define|true|[yY]*)
20082             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20083             shift
20084             perllibs="$*"
20085             ;;
20086     *)  perllibs="$libs"
20087             ;;
20088     esac
20089     ;;
20090 esac
20091
20092 : Remove build directory name from cppstdin so it can be used from
20093 : either the present location or the final installed location.
20094 echo " "
20095 : Get out of the UU directory to get correct path name.
20096 cd ..
20097 case "$cppstdin" in
20098 `pwd`/cppstdin)
20099         echo "Stripping down cppstdin path name"
20100         cppstdin=cppstdin
20101         ;;
20102 esac
20103 cd UU
20104
20105 : end of configuration questions
20106 echo " "
20107 echo "End of configuration questions."
20108 echo " "
20109
20110 : back to where it started
20111 if test -d ../UU; then
20112         cd ..
20113 fi
20114
20115 : configuration may be patched via a 'config.arch' file
20116 if $test -f config.arch; then
20117         echo "I see a config.arch file, loading it."
20118         . ./config.arch
20119 fi
20120
20121 : configuration may be patched via a 'config.over' file
20122 if $test -f config.over; then
20123         echo " "
20124         dflt=y
20125         rp='I see a config.over file.  Do you wish to load it?'
20126         . UU/myread
20127         case "$ans" in
20128         n*) echo "OK, I'll ignore it.";;
20129         *)      . ./config.over
20130                 echo "Configuration override changes have been loaded."
20131                 ;;
20132         esac
20133 fi
20134
20135 : in case they want portability, strip down executable paths
20136 case "$d_portable" in
20137 "$define")
20138         echo " "
20139         echo "Stripping down executable paths..." >&4
20140         for file in $loclist $trylist; do
20141                 eval temp=\$$file
20142                 eval $file=`basename $temp`
20143         done
20144         ;;
20145 esac
20146
20147 : create config.sh file
20148 echo " "
20149 echo "Creating config.sh..." >&4
20150 $spitshell <<EOT >config.sh
20151 $startsh
20152 #
20153 # This file was produced by running the Configure script. It holds all the
20154 # definitions figured out by Configure. Should you modify one of these values,
20155 # do not forget to propagate your changes by running "Configure -der". You may
20156 # instead choose to run each of the .SH files by yourself, or "Configure -S".
20157 #
20158
20159 # Package name      : $package
20160 # Source directory  : $src
20161 # Configuration time: $cf_time
20162 # Configured by     : $cf_by
20163 # Target system     : $myuname
20164
20165 Author='$Author'
20166 Date='$Date'
20167 Header='$Header'
20168 Id='$Id'
20169 Locker='$Locker'
20170 Log='$Log'
20171 Mcc='$Mcc'
20172 RCSfile='$RCSfile'
20173 Revision='$Revision'
20174 Source='$Source'
20175 State='$State'
20176 _a='$_a'
20177 _exe='$_exe'
20178 _o='$_o'
20179 afs='$afs'
20180 afsroot='$afsroot'
20181 alignbytes='$alignbytes'
20182 ansi2knr='$ansi2knr'
20183 aphostname='$aphostname'
20184 api_revision='$api_revision'
20185 api_subversion='$api_subversion'
20186 api_version='$api_version'
20187 api_versionstring='$api_versionstring'
20188 ar='$ar'
20189 archlib='$archlib'
20190 archlibexp='$archlibexp'
20191 archname64='$archname64'
20192 archname='$archname'
20193 archobjs='$archobjs'
20194 asctime_r_proto='$asctime_r_proto'
20195 awk='$awk'
20196 baserev='$baserev'
20197 bash='$bash'
20198 bin='$bin'
20199 binexp='$binexp'
20200 bison='$bison'
20201 byacc='$byacc'
20202 byteorder='$byteorder'
20203 c='$c'
20204 castflags='$castflags'
20205 cat='$cat'
20206 cc='$cc'
20207 cccdlflags='$cccdlflags'
20208 ccdlflags='$ccdlflags'
20209 ccflags='$ccflags'
20210 ccflags_uselargefiles='$ccflags_uselargefiles'
20211 ccname='$ccname'
20212 ccsymbols='$ccsymbols'
20213 ccversion='$ccversion'
20214 cf_by='$cf_by'
20215 cf_email='$cf_email'
20216 cf_time='$cf_time'
20217 charsize='$charsize'
20218 chgrp='$chgrp'
20219 chmod='$chmod'
20220 chown='$chown'
20221 clocktype='$clocktype'
20222 comm='$comm'
20223 compress='$compress'
20224 contains='$contains'
20225 cp='$cp'
20226 cpio='$cpio'
20227 cpp='$cpp'
20228 cpp_stuff='$cpp_stuff'
20229 cppccsymbols='$cppccsymbols'
20230 cppflags='$cppflags'
20231 cpplast='$cpplast'
20232 cppminus='$cppminus'
20233 cpprun='$cpprun'
20234 cppstdin='$cppstdin'
20235 cppsymbols='$cppsymbols'
20236 crypt_r_proto='$crypt_r_proto'
20237 cryptlib='$cryptlib'
20238 csh='$csh'
20239 ctermid_r_proto='$ctermid_r_proto'
20240 ctime_r_proto='$ctime_r_proto'
20241 d_Gconvert='$d_Gconvert'
20242 d_PRIEUldbl='$d_PRIEUldbl'
20243 d_PRIFUldbl='$d_PRIFUldbl'
20244 d_PRIGUldbl='$d_PRIGUldbl'
20245 d_PRIXU64='$d_PRIXU64'
20246 d_PRId64='$d_PRId64'
20247 d_PRIeldbl='$d_PRIeldbl'
20248 d_PRIfldbl='$d_PRIfldbl'
20249 d_PRIgldbl='$d_PRIgldbl'
20250 d_PRIi64='$d_PRIi64'
20251 d_PRIo64='$d_PRIo64'
20252 d_PRIu64='$d_PRIu64'
20253 d_PRIx64='$d_PRIx64'
20254 d_SCNfldbl='$d_SCNfldbl'
20255 d__fwalk='$d__fwalk'
20256 d_access='$d_access'
20257 d_accessx='$d_accessx'
20258 d_alarm='$d_alarm'
20259 d_archlib='$d_archlib'
20260 d_asctime_r='$d_asctime_r'
20261 d_atolf='$d_atolf'
20262 d_atoll='$d_atoll'
20263 d_attribut='$d_attribut'
20264 d_bcmp='$d_bcmp'
20265 d_bcopy='$d_bcopy'
20266 d_bsd='$d_bsd'
20267 d_bsdgetpgrp='$d_bsdgetpgrp'
20268 d_bsdsetpgrp='$d_bsdsetpgrp'
20269 d_bzero='$d_bzero'
20270 d_casti32='$d_casti32'
20271 d_castneg='$d_castneg'
20272 d_charvspr='$d_charvspr'
20273 d_chown='$d_chown'
20274 d_chroot='$d_chroot'
20275 d_chsize='$d_chsize'
20276 d_class='$d_class'
20277 d_closedir='$d_closedir'
20278 d_cmsghdr_s='$d_cmsghdr_s'
20279 d_const='$d_const'
20280 d_crypt='$d_crypt'
20281 d_crypt_r='$d_crypt_r'
20282 d_csh='$d_csh'
20283 d_ctermid_r='$d_ctermid_r'
20284 d_ctime_r='$d_ctime_r'
20285 d_cuserid='$d_cuserid'
20286 d_dbl_dig='$d_dbl_dig'
20287 d_dbminitproto='$d_dbminitproto'
20288 d_difftime='$d_difftime'
20289 d_dirfd='$d_dirfd'
20290 d_dirnamlen='$d_dirnamlen'
20291 d_dlerror='$d_dlerror'
20292 d_dlopen='$d_dlopen'
20293 d_dlsymun='$d_dlsymun'
20294 d_dosuid='$d_dosuid'
20295 d_drand48_r='$d_drand48_r'
20296 d_drand48proto='$d_drand48proto'
20297 d_dup2='$d_dup2'
20298 d_eaccess='$d_eaccess'
20299 d_endgrent='$d_endgrent'
20300 d_endgrent_r='$d_endgrent_r'
20301 d_endhent='$d_endhent'
20302 d_endhostent_r='$d_endhostent_r'
20303 d_endnent='$d_endnent'
20304 d_endnetent_r='$d_endnetent_r'
20305 d_endpent='$d_endpent'
20306 d_endprotoent_r='$d_endprotoent_r'
20307 d_endpwent='$d_endpwent'
20308 d_endpwent_r='$d_endpwent_r'
20309 d_endsent='$d_endsent'
20310 d_endservent_r='$d_endservent_r'
20311 d_eofnblk='$d_eofnblk'
20312 d_eunice='$d_eunice'
20313 d_fchdir='$d_fchdir'
20314 d_fchmod='$d_fchmod'
20315 d_fchown='$d_fchown'
20316 d_fcntl='$d_fcntl'
20317 d_fcntl_can_lock='$d_fcntl_can_lock'
20318 d_fd_macros='$d_fd_macros'
20319 d_fd_set='$d_fd_set'
20320 d_fds_bits='$d_fds_bits'
20321 d_fgetpos='$d_fgetpos'
20322 d_finite='$d_finite'
20323 d_finitel='$d_finitel'
20324 d_flexfnam='$d_flexfnam'
20325 d_flock='$d_flock'
20326 d_flockproto='$d_flockproto'
20327 d_fork='$d_fork'
20328 d_fp_class='$d_fp_class'
20329 d_fpathconf='$d_fpathconf'
20330 d_fpclass='$d_fpclass'
20331 d_fpclassify='$d_fpclassify'
20332 d_fpclassl='$d_fpclassl'
20333 d_fpos64_t='$d_fpos64_t'
20334 d_frexpl='$d_frexpl'
20335 d_fs_data_s='$d_fs_data_s'
20336 d_fseeko='$d_fseeko'
20337 d_fsetpos='$d_fsetpos'
20338 d_fstatfs='$d_fstatfs'
20339 d_fstatvfs='$d_fstatvfs'
20340 d_fsync='$d_fsync'
20341 d_ftello='$d_ftello'
20342 d_ftime='$d_ftime'
20343 d_getcwd='$d_getcwd'
20344 d_getespwnam='$d_getespwnam'
20345 d_getfsstat='$d_getfsstat'
20346 d_getgrent='$d_getgrent'
20347 d_getgrent_r='$d_getgrent_r'
20348 d_getgrgid_r='$d_getgrgid_r'
20349 d_getgrnam_r='$d_getgrnam_r'
20350 d_getgrps='$d_getgrps'
20351 d_gethbyaddr='$d_gethbyaddr'
20352 d_gethbyname='$d_gethbyname'
20353 d_gethent='$d_gethent'
20354 d_gethname='$d_gethname'
20355 d_gethostbyaddr_r='$d_gethostbyaddr_r'
20356 d_gethostbyname_r='$d_gethostbyname_r'
20357 d_gethostent_r='$d_gethostent_r'
20358 d_gethostprotos='$d_gethostprotos'
20359 d_getitimer='$d_getitimer'
20360 d_getlogin='$d_getlogin'
20361 d_getlogin_r='$d_getlogin_r'
20362 d_getmnt='$d_getmnt'
20363 d_getmntent='$d_getmntent'
20364 d_getnbyaddr='$d_getnbyaddr'
20365 d_getnbyname='$d_getnbyname'
20366 d_getnent='$d_getnent'
20367 d_getnetbyaddr_r='$d_getnetbyaddr_r'
20368 d_getnetbyname_r='$d_getnetbyname_r'
20369 d_getnetent_r='$d_getnetent_r'
20370 d_getnetprotos='$d_getnetprotos'
20371 d_getpagsz='$d_getpagsz'
20372 d_getpbyname='$d_getpbyname'
20373 d_getpbynumber='$d_getpbynumber'
20374 d_getpent='$d_getpent'
20375 d_getpgid='$d_getpgid'
20376 d_getpgrp2='$d_getpgrp2'
20377 d_getpgrp='$d_getpgrp'
20378 d_getppid='$d_getppid'
20379 d_getprior='$d_getprior'
20380 d_getprotobyname_r='$d_getprotobyname_r'
20381 d_getprotobynumber_r='$d_getprotobynumber_r'
20382 d_getprotoent_r='$d_getprotoent_r'
20383 d_getprotoprotos='$d_getprotoprotos'
20384 d_getprpwnam='$d_getprpwnam'
20385 d_getpwent='$d_getpwent'
20386 d_getpwent_r='$d_getpwent_r'
20387 d_getpwnam_r='$d_getpwnam_r'
20388 d_getpwuid_r='$d_getpwuid_r'
20389 d_getsbyname='$d_getsbyname'
20390 d_getsbyport='$d_getsbyport'
20391 d_getsent='$d_getsent'
20392 d_getservbyname_r='$d_getservbyname_r'
20393 d_getservbyport_r='$d_getservbyport_r'
20394 d_getservent_r='$d_getservent_r'
20395 d_getservprotos='$d_getservprotos'
20396 d_getspnam='$d_getspnam'
20397 d_getspnam_r='$d_getspnam_r'
20398 d_gettimeod='$d_gettimeod'
20399 d_gmtime_r='$d_gmtime_r'
20400 d_gnulibc='$d_gnulibc'
20401 d_grpasswd='$d_grpasswd'
20402 d_hasmntopt='$d_hasmntopt'
20403 d_htonl='$d_htonl'
20404 d_index='$d_index'
20405 d_inetaton='$d_inetaton'
20406 d_int64_t='$d_int64_t'
20407 d_isascii='$d_isascii'
20408 d_isfinite='$d_isfinite'
20409 d_isinf='$d_isinf'
20410 d_isnan='$d_isnan'
20411 d_isnanl='$d_isnanl'
20412 d_killpg='$d_killpg'
20413 d_lchown='$d_lchown'
20414 d_ldbl_dig='$d_ldbl_dig'
20415 d_link='$d_link'
20416 d_localtime_r='$d_localtime_r'
20417 d_locconv='$d_locconv'
20418 d_lockf='$d_lockf'
20419 d_longdbl='$d_longdbl'
20420 d_longlong='$d_longlong'
20421 d_lseekproto='$d_lseekproto'
20422 d_lstat='$d_lstat'
20423 d_madvise='$d_madvise'
20424 d_mblen='$d_mblen'
20425 d_mbstowcs='$d_mbstowcs'
20426 d_mbtowc='$d_mbtowc'
20427 d_memchr='$d_memchr'
20428 d_memcmp='$d_memcmp'
20429 d_memcpy='$d_memcpy'
20430 d_memmove='$d_memmove'
20431 d_memset='$d_memset'
20432 d_mkdir='$d_mkdir'
20433 d_mkdtemp='$d_mkdtemp'
20434 d_mkfifo='$d_mkfifo'
20435 d_mkstemp='$d_mkstemp'
20436 d_mkstemps='$d_mkstemps'
20437 d_mktime='$d_mktime'
20438 d_mmap='$d_mmap'
20439 d_modfl='$d_modfl'
20440 d_modfl_pow32_bug='$d_modfl_pow32_bug'
20441 d_modflproto='$d_modflproto'
20442 d_mprotect='$d_mprotect'
20443 d_msg='$d_msg'
20444 d_msg_ctrunc='$d_msg_ctrunc'
20445 d_msg_dontroute='$d_msg_dontroute'
20446 d_msg_oob='$d_msg_oob'
20447 d_msg_peek='$d_msg_peek'
20448 d_msg_proxy='$d_msg_proxy'
20449 d_msgctl='$d_msgctl'
20450 d_msgget='$d_msgget'
20451 d_msghdr_s='$d_msghdr_s'
20452 d_msgrcv='$d_msgrcv'
20453 d_msgsnd='$d_msgsnd'
20454 d_msync='$d_msync'
20455 d_munmap='$d_munmap'
20456 d_mymalloc='$d_mymalloc'
20457 d_nanosleep='$d_nanosleep'
20458 d_nice='$d_nice'
20459 d_nl_langinfo='$d_nl_langinfo'
20460 d_nv_preserves_uv='$d_nv_preserves_uv'
20461 d_off64_t='$d_off64_t'
20462 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
20463 d_oldpthreads='$d_oldpthreads'
20464 d_oldsock='$d_oldsock'
20465 d_open3='$d_open3'
20466 d_pathconf='$d_pathconf'
20467 d_pause='$d_pause'
20468 d_perl_otherlibdirs='$d_perl_otherlibdirs'
20469 d_phostname='$d_phostname'
20470 d_pipe='$d_pipe'
20471 d_poll='$d_poll'
20472 d_portable='$d_portable'
20473 d_procselfexe='$d_procselfexe'
20474 d_pthread_atfork='$d_pthread_atfork'
20475 d_pthread_yield='$d_pthread_yield'
20476 d_pwage='$d_pwage'
20477 d_pwchange='$d_pwchange'
20478 d_pwclass='$d_pwclass'
20479 d_pwcomment='$d_pwcomment'
20480 d_pwexpire='$d_pwexpire'
20481 d_pwgecos='$d_pwgecos'
20482 d_pwpasswd='$d_pwpasswd'
20483 d_pwquota='$d_pwquota'
20484 d_qgcvt='$d_qgcvt'
20485 d_quad='$d_quad'
20486 d_random_r='$d_random_r'
20487 d_readdir64_r='$d_readdir64_r'
20488 d_readdir='$d_readdir'
20489 d_readdir_r='$d_readdir_r'
20490 d_readlink='$d_readlink'
20491 d_readv='$d_readv'
20492 d_recvmsg='$d_recvmsg'
20493 d_rename='$d_rename'
20494 d_rewinddir='$d_rewinddir'
20495 d_rmdir='$d_rmdir'
20496 d_safebcpy='$d_safebcpy'
20497 d_safemcpy='$d_safemcpy'
20498 d_sanemcmp='$d_sanemcmp'
20499 d_sbrkproto='$d_sbrkproto'
20500 d_sched_yield='$d_sched_yield'
20501 d_scm_rights='$d_scm_rights'
20502 d_seekdir='$d_seekdir'
20503 d_select='$d_select'
20504 d_sem='$d_sem'
20505 d_semctl='$d_semctl'
20506 d_semctl_semid_ds='$d_semctl_semid_ds'
20507 d_semctl_semun='$d_semctl_semun'
20508 d_semget='$d_semget'
20509 d_semop='$d_semop'
20510 d_sendmsg='$d_sendmsg'
20511 d_setegid='$d_setegid'
20512 d_seteuid='$d_seteuid'
20513 d_setgrent='$d_setgrent'
20514 d_setgrent_r='$d_setgrent_r'
20515 d_setgrps='$d_setgrps'
20516 d_sethent='$d_sethent'
20517 d_sethostent_r='$d_sethostent_r'
20518 d_setitimer='$d_setitimer'
20519 d_setlinebuf='$d_setlinebuf'
20520 d_setlocale='$d_setlocale'
20521 d_setlocale_r='$d_setlocale_r'
20522 d_setnent='$d_setnent'
20523 d_setnetent_r='$d_setnetent_r'
20524 d_setpent='$d_setpent'
20525 d_setpgid='$d_setpgid'
20526 d_setpgrp2='$d_setpgrp2'
20527 d_setpgrp='$d_setpgrp'
20528 d_setprior='$d_setprior'
20529 d_setproctitle='$d_setproctitle'
20530 d_setprotoent_r='$d_setprotoent_r'
20531 d_setpwent='$d_setpwent'
20532 d_setpwent_r='$d_setpwent_r'
20533 d_setregid='$d_setregid'
20534 d_setresgid='$d_setresgid'
20535 d_setresuid='$d_setresuid'
20536 d_setreuid='$d_setreuid'
20537 d_setrgid='$d_setrgid'
20538 d_setruid='$d_setruid'
20539 d_setsent='$d_setsent'
20540 d_setservent_r='$d_setservent_r'
20541 d_setsid='$d_setsid'
20542 d_setvbuf='$d_setvbuf'
20543 d_sfio='$d_sfio'
20544 d_shm='$d_shm'
20545 d_shmat='$d_shmat'
20546 d_shmatprototype='$d_shmatprototype'
20547 d_shmctl='$d_shmctl'
20548 d_shmdt='$d_shmdt'
20549 d_shmget='$d_shmget'
20550 d_sigaction='$d_sigaction'
20551 d_sigprocmask='$d_sigprocmask'
20552 d_sigsetjmp='$d_sigsetjmp'
20553 d_sockatmark='$d_sockatmark'
20554 d_sockatmarkproto='$d_sockatmarkproto'
20555 d_socket='$d_socket'
20556 d_socklen_t='$d_socklen_t'
20557 d_sockpair='$d_sockpair'
20558 d_socks5_init='$d_socks5_init'
20559 d_sqrtl='$d_sqrtl'
20560 d_srand48_r='$d_srand48_r'
20561 d_srandom_r='$d_srandom_r'
20562 d_sresgproto='$d_sresgproto'
20563 d_sresuproto='$d_sresuproto'
20564 d_statblks='$d_statblks'
20565 d_statfs_f_flags='$d_statfs_f_flags'
20566 d_statfs_s='$d_statfs_s'
20567 d_statvfs='$d_statvfs'
20568 d_stdio_cnt_lval='$d_stdio_cnt_lval'
20569 d_stdio_ptr_lval='$d_stdio_ptr_lval'
20570 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
20571 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
20572 d_stdio_stream_array='$d_stdio_stream_array'
20573 d_stdiobase='$d_stdiobase'
20574 d_stdstdio='$d_stdstdio'
20575 d_strchr='$d_strchr'
20576 d_strcoll='$d_strcoll'
20577 d_strctcpy='$d_strctcpy'
20578 d_strerrm='$d_strerrm'
20579 d_strerror='$d_strerror'
20580 d_strerror_r='$d_strerror_r'
20581 d_strftime='$d_strftime'
20582 d_strtod='$d_strtod'
20583 d_strtol='$d_strtol'
20584 d_strtold='$d_strtold'
20585 d_strtoll='$d_strtoll'
20586 d_strtoq='$d_strtoq'
20587 d_strtoul='$d_strtoul'
20588 d_strtoull='$d_strtoull'
20589 d_strtouq='$d_strtouq'
20590 d_strxfrm='$d_strxfrm'
20591 d_suidsafe='$d_suidsafe'
20592 d_symlink='$d_symlink'
20593 d_syscall='$d_syscall'
20594 d_syscallproto='$d_syscallproto'
20595 d_sysconf='$d_sysconf'
20596 d_sysernlst='$d_sysernlst'
20597 d_syserrlst='$d_syserrlst'
20598 d_system='$d_system'
20599 d_tcgetpgrp='$d_tcgetpgrp'
20600 d_tcsetpgrp='$d_tcsetpgrp'
20601 d_telldir='$d_telldir'
20602 d_telldirproto='$d_telldirproto'
20603 d_time='$d_time'
20604 d_times='$d_times'
20605 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
20606 d_tm_tm_zone='$d_tm_tm_zone'
20607 d_tmpnam_r='$d_tmpnam_r'
20608 d_truncate='$d_truncate'
20609 d_ttyname_r='$d_ttyname_r'
20610 d_tzname='$d_tzname'
20611 d_u32align='$d_u32align'
20612 d_ualarm='$d_ualarm'
20613 d_umask='$d_umask'
20614 d_uname='$d_uname'
20615 d_union_semun='$d_union_semun'
20616 d_unordered='$d_unordered'
20617 d_usleep='$d_usleep'
20618 d_usleepproto='$d_usleepproto'
20619 d_ustat='$d_ustat'
20620 d_vendorarch='$d_vendorarch'
20621 d_vendorbin='$d_vendorbin'
20622 d_vendorlib='$d_vendorlib'
20623 d_vendorscript='$d_vendorscript'
20624 d_vfork='$d_vfork'
20625 d_void_closedir='$d_void_closedir'
20626 d_voidsig='$d_voidsig'
20627 d_voidtty='$d_voidtty'
20628 d_volatile='$d_volatile'
20629 d_vprintf='$d_vprintf'
20630 d_wait4='$d_wait4'
20631 d_waitpid='$d_waitpid'
20632 d_wcstombs='$d_wcstombs'
20633 d_wctomb='$d_wctomb'
20634 d_writev='$d_writev'
20635 d_xenix='$d_xenix'
20636 date='$date'
20637 db_hashtype='$db_hashtype'
20638 db_prefixtype='$db_prefixtype'
20639 db_version_major='$db_version_major'
20640 db_version_minor='$db_version_minor'
20641 db_version_patch='$db_version_patch'
20642 defvoidused='$defvoidused'
20643 direntrytype='$direntrytype'
20644 dlext='$dlext'
20645 dlsrc='$dlsrc'
20646 doublesize='$doublesize'
20647 drand01='$drand01'
20648 drand48_r_proto='$drand48_r_proto'
20649 dynamic_ext='$dynamic_ext'
20650 eagain='$eagain'
20651 ebcdic='$ebcdic'
20652 echo='$echo'
20653 egrep='$egrep'
20654 emacs='$emacs'
20655 endgrent_r_proto='$endgrent_r_proto'
20656 endhostent_r_proto='$endhostent_r_proto'
20657 endnetent_r_proto='$endnetent_r_proto'
20658 endprotoent_r_proto='$endprotoent_r_proto'
20659 endpwent_r_proto='$endpwent_r_proto'
20660 endservent_r_proto='$endservent_r_proto'
20661 eunicefix='$eunicefix'
20662 exe_ext='$exe_ext'
20663 expr='$expr'
20664 extensions='$extensions'
20665 extras='$extras'
20666 fflushNULL='$fflushNULL'
20667 fflushall='$fflushall'
20668 find='$find'
20669 firstmakefile='$firstmakefile'
20670 flex='$flex'
20671 fpossize='$fpossize'
20672 fpostype='$fpostype'
20673 freetype='$freetype'
20674 from='$from'
20675 full_ar='$full_ar'
20676 full_csh='$full_csh'
20677 full_sed='$full_sed'
20678 gccansipedantic='$gccansipedantic'
20679 gccosandvers='$gccosandvers'
20680 gccversion='$gccversion'
20681 getgrent_r_proto='$getgrent_r_proto'
20682 getgrgid_r_proto='$getgrgid_r_proto'
20683 getgrnam_r_proto='$getgrnam_r_proto'
20684 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
20685 gethostbyname_r_proto='$gethostbyname_r_proto'
20686 gethostent_r_proto='$gethostent_r_proto'
20687 getlogin_r_proto='$getlogin_r_proto'
20688 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
20689 getnetbyname_r_proto='$getnetbyname_r_proto'
20690 getnetent_r_proto='$getnetent_r_proto'
20691 getprotobyname_r_proto='$getprotobyname_r_proto'
20692 getprotobynumber_r_proto='$getprotobynumber_r_proto'
20693 getprotoent_r_proto='$getprotoent_r_proto'
20694 getpwent_r_proto='$getpwent_r_proto'
20695 getpwnam_r_proto='$getpwnam_r_proto'
20696 getpwuid_r_proto='$getpwuid_r_proto'
20697 getservbyname_r_proto='$getservbyname_r_proto'
20698 getservbyport_r_proto='$getservbyport_r_proto'
20699 getservent_r_proto='$getservent_r_proto'
20700 getspnam_r_proto='$getspnam_r_proto'
20701 gidformat='$gidformat'
20702 gidsign='$gidsign'
20703 gidsize='$gidsize'
20704 gidtype='$gidtype'
20705 glibpth='$glibpth'
20706 gmake='$gmake'
20707 gmtime_r_proto='$gmtime_r_proto'
20708 gnulibc_version='$gnulibc_version'
20709 grep='$grep'
20710 groupcat='$groupcat'
20711 groupstype='$groupstype'
20712 gzip='$gzip'
20713 h_fcntl='$h_fcntl'
20714 h_sysfile='$h_sysfile'
20715 hint='$hint'
20716 hostcat='$hostcat'
20717 html1dir='$html1dir'
20718 html1direxp='$html1direxp'
20719 html3dir='$html3dir'
20720 html3direxp='$html3direxp'
20721 i16size='$i16size'
20722 i16type='$i16type'
20723 i32size='$i32size'
20724 i32type='$i32type'
20725 i64size='$i64size'
20726 i64type='$i64type'
20727 i8size='$i8size'
20728 i8type='$i8type'
20729 i_arpainet='$i_arpainet'
20730 i_bsdioctl='$i_bsdioctl'
20731 i_crypt='$i_crypt'
20732 i_db='$i_db'
20733 i_dbm='$i_dbm'
20734 i_dirent='$i_dirent'
20735 i_dld='$i_dld'
20736 i_dlfcn='$i_dlfcn'
20737 i_fcntl='$i_fcntl'
20738 i_float='$i_float'
20739 i_fp='$i_fp'
20740 i_fp_class='$i_fp_class'
20741 i_gdbm='$i_gdbm'
20742 i_grp='$i_grp'
20743 i_ieeefp='$i_ieeefp'
20744 i_inttypes='$i_inttypes'
20745 i_langinfo='$i_langinfo'
20746 i_libutil='$i_libutil'
20747 i_limits='$i_limits'
20748 i_locale='$i_locale'
20749 i_machcthr='$i_machcthr'
20750 i_malloc='$i_malloc'
20751 i_math='$i_math'
20752 i_memory='$i_memory'
20753 i_mntent='$i_mntent'
20754 i_ndbm='$i_ndbm'
20755 i_netdb='$i_netdb'
20756 i_neterrno='$i_neterrno'
20757 i_netinettcp='$i_netinettcp'
20758 i_niin='$i_niin'
20759 i_poll='$i_poll'
20760 i_prot='$i_prot'
20761 i_pthread='$i_pthread'
20762 i_pwd='$i_pwd'
20763 i_rpcsvcdbm='$i_rpcsvcdbm'
20764 i_sfio='$i_sfio'
20765 i_sgtty='$i_sgtty'
20766 i_shadow='$i_shadow'
20767 i_socks='$i_socks'
20768 i_stdarg='$i_stdarg'
20769 i_stddef='$i_stddef'
20770 i_stdlib='$i_stdlib'
20771 i_string='$i_string'
20772 i_sunmath='$i_sunmath'
20773 i_sysaccess='$i_sysaccess'
20774 i_sysdir='$i_sysdir'
20775 i_sysfile='$i_sysfile'
20776 i_sysfilio='$i_sysfilio'
20777 i_sysin='$i_sysin'
20778 i_sysioctl='$i_sysioctl'
20779 i_syslog='$i_syslog'
20780 i_sysmman='$i_sysmman'
20781 i_sysmode='$i_sysmode'
20782 i_sysmount='$i_sysmount'
20783 i_sysndir='$i_sysndir'
20784 i_sysparam='$i_sysparam'
20785 i_sysresrc='$i_sysresrc'
20786 i_syssecrt='$i_syssecrt'
20787 i_sysselct='$i_sysselct'
20788 i_syssockio='$i_syssockio'
20789 i_sysstat='$i_sysstat'
20790 i_sysstatfs='$i_sysstatfs'
20791 i_sysstatvfs='$i_sysstatvfs'
20792 i_systime='$i_systime'
20793 i_systimek='$i_systimek'
20794 i_systimes='$i_systimes'
20795 i_systypes='$i_systypes'
20796 i_sysuio='$i_sysuio'
20797 i_sysun='$i_sysun'
20798 i_sysutsname='$i_sysutsname'
20799 i_sysvfs='$i_sysvfs'
20800 i_syswait='$i_syswait'
20801 i_termio='$i_termio'
20802 i_termios='$i_termios'
20803 i_time='$i_time'
20804 i_unistd='$i_unistd'
20805 i_ustat='$i_ustat'
20806 i_utime='$i_utime'
20807 i_values='$i_values'
20808 i_varargs='$i_varargs'
20809 i_varhdr='$i_varhdr'
20810 i_vfork='$i_vfork'
20811 ignore_versioned_solibs='$ignore_versioned_solibs'
20812 inc_version_list='$inc_version_list'
20813 inc_version_list_init='$inc_version_list_init'
20814 incpath='$incpath'
20815 inews='$inews'
20816 installarchlib='$installarchlib'
20817 installbin='$installbin'
20818 installhtml1dir='$installhtml1dir'
20819 installhtml3dir='$installhtml3dir'
20820 installman1dir='$installman1dir'
20821 installman3dir='$installman3dir'
20822 installprefix='$installprefix'
20823 installprefixexp='$installprefixexp'
20824 installprivlib='$installprivlib'
20825 installscript='$installscript'
20826 installsitearch='$installsitearch'
20827 installsitebin='$installsitebin'
20828 installsitehtml1='$installsitehtml1'
20829 installsitehtml3='$installsitehtml3'
20830 installsitelib='$installsitelib'
20831 installsiteman1='$installsiteman1'
20832 installsiteman3='$installsiteman3'
20833 installsitescript='$installsitescript'
20834 installstyle='$installstyle'
20835 installusrbinperl='$installusrbinperl'
20836 installvendorarch='$installvendorarch'
20837 installvendorbin='$installvendorbin'
20838 installvendorhtml1='$installvendorhtml1'
20839 installvendorhtml3='$installvendorhtml3'
20840 installvendorlib='$installvendorlib'
20841 installvendorman1='$installvendorman1'
20842 installvendorman3='$installvendorman3'
20843 installvendorscript='$installvendorscript'
20844 intsize='$intsize'
20845 issymlink='$issymlink'
20846 ivdformat='$ivdformat'
20847 ivsize='$ivsize'
20848 ivtype='$ivtype'
20849 known_extensions='$known_extensions'
20850 ksh='$ksh'
20851 ld='$ld'
20852 lddlflags='$lddlflags'
20853 ldflags='$ldflags'
20854 ldflags_uselargefiles='$ldflags_uselargefiles'
20855 ldlibpthname='$ldlibpthname'
20856 less='$less'
20857 lib_ext='$lib_ext'
20858 libc='$libc'
20859 libperl='$libperl'
20860 libpth='$libpth'
20861 libs='$libs'
20862 libsdirs='$libsdirs'
20863 libsfiles='$libsfiles'
20864 libsfound='$libsfound'
20865 libspath='$libspath'
20866 libswanted='$libswanted'
20867 libswanted_uselargefiles='$libswanted_uselargefiles'
20868 line='$line'
20869 lint='$lint'
20870 lkflags='$lkflags'
20871 ln='$ln'
20872 lns='$lns'
20873 localtime_r_proto='$localtime_r_proto'
20874 locincpth='$locincpth'
20875 loclibpth='$loclibpth'
20876 longdblsize='$longdblsize'
20877 longlongsize='$longlongsize'
20878 longsize='$longsize'
20879 lp='$lp'
20880 lpr='$lpr'
20881 ls='$ls'
20882 lseeksize='$lseeksize'
20883 lseektype='$lseektype'
20884 mail='$mail'
20885 mailx='$mailx'
20886 make='$make'
20887 make_set_make='$make_set_make'
20888 mallocobj='$mallocobj'
20889 mallocsrc='$mallocsrc'
20890 malloctype='$malloctype'
20891 man1dir='$man1dir'
20892 man1direxp='$man1direxp'
20893 man1ext='$man1ext'
20894 man3dir='$man3dir'
20895 man3direxp='$man3direxp'
20896 man3ext='$man3ext'
20897 mips_type='$mips_type'
20898 mkdir='$mkdir'
20899 mmaptype='$mmaptype'
20900 modetype='$modetype'
20901 more='$more'
20902 multiarch='$multiarch'
20903 mv='$mv'
20904 myarchname='$myarchname'
20905 mydomain='$mydomain'
20906 myhostname='$myhostname'
20907 myuname='$myuname'
20908 n='$n'
20909 need_va_copy='$need_va_copy'
20910 netdb_hlen_type='$netdb_hlen_type'
20911 netdb_host_type='$netdb_host_type'
20912 netdb_name_type='$netdb_name_type'
20913 netdb_net_type='$netdb_net_type'
20914 nm='$nm'
20915 nm_opt='$nm_opt'
20916 nm_so_opt='$nm_so_opt'
20917 nonxs_ext='$nonxs_ext'
20918 nroff='$nroff'
20919 nvEUformat='$nvEUformat'
20920 nvFUformat='$nvFUformat'
20921 nvGUformat='$nvGUformat'
20922 nv_preserves_uv_bits='$nv_preserves_uv_bits'
20923 nveformat='$nveformat'
20924 nvfformat='$nvfformat'
20925 nvgformat='$nvgformat'
20926 nvsize='$nvsize'
20927 nvtype='$nvtype'
20928 o_nonblock='$o_nonblock'
20929 obj_ext='$obj_ext'
20930 old_pthread_create_joinable='$old_pthread_create_joinable'
20931 optimize='$optimize'
20932 orderlib='$orderlib'
20933 osname='$osname'
20934 osvers='$osvers'
20935 otherlibdirs='$otherlibdirs'
20936 package='$package'
20937 pager='$pager'
20938 passcat='$passcat'
20939 patchlevel='$patchlevel'
20940 path_sep='$path_sep'
20941 perl5='$perl5'
20942 perl='$perl'
20943 perl_patchlevel='$perl_patchlevel'
20944 perladmin='$perladmin'
20945 perllibs='$perllibs'
20946 perlpath='$perlpath'
20947 pg='$pg'
20948 phostname='$phostname'
20949 pidtype='$pidtype'
20950 plibpth='$plibpth'
20951 pm_apiversion='$pm_apiversion'
20952 pmake='$pmake'
20953 pr='$pr'
20954 prefix='$prefix'
20955 prefixexp='$prefixexp'
20956 privlib='$privlib'
20957 privlibexp='$privlibexp'
20958 procselfexe='$procselfexe'
20959 prototype='$prototype'
20960 ptrsize='$ptrsize'
20961 quadkind='$quadkind'
20962 quadtype='$quadtype'
20963 randbits='$randbits'
20964 randfunc='$randfunc'
20965 random_r_proto='$random_r_proto'
20966 randseedtype='$randseedtype'
20967 ranlib='$ranlib'
20968 rd_nodata='$rd_nodata'
20969 readdir64_r_proto='$readdir64_r_proto'
20970 readdir_r_proto='$readdir_r_proto'
20971 revision='$revision'
20972 rm='$rm'
20973 rmail='$rmail'
20974 run='$run'
20975 runnm='$runnm'
20976 sPRIEUldbl='$sPRIEUldbl'
20977 sPRIFUldbl='$sPRIFUldbl'
20978 sPRIGUldbl='$sPRIGUldbl'
20979 sPRIXU64='$sPRIXU64'
20980 sPRId64='$sPRId64'
20981 sPRIeldbl='$sPRIeldbl'
20982 sPRIfldbl='$sPRIfldbl'
20983 sPRIgldbl='$sPRIgldbl'
20984 sPRIi64='$sPRIi64'
20985 sPRIo64='$sPRIo64'
20986 sPRIu64='$sPRIu64'
20987 sPRIx64='$sPRIx64'
20988 sSCNfldbl='$sSCNfldbl'
20989 sched_yield='$sched_yield'
20990 scriptdir='$scriptdir'
20991 scriptdirexp='$scriptdirexp'
20992 sed='$sed'
20993 seedfunc='$seedfunc'
20994 selectminbits='$selectminbits'
20995 selecttype='$selecttype'
20996 sendmail='$sendmail'
20997 setgrent_r_proto='$setgrent_r_proto'
20998 sethostent_r_proto='$sethostent_r_proto'
20999 setlocale_r_proto='$setlocale_r_proto'
21000 setnetent_r_proto='$setnetent_r_proto'
21001 setprotoent_r_proto='$setprotoent_r_proto'
21002 setpwent_r_proto='$setpwent_r_proto'
21003 setservent_r_proto='$setservent_r_proto'
21004 sh='$sh'
21005 shar='$shar'
21006 sharpbang='$sharpbang'
21007 shmattype='$shmattype'
21008 shortsize='$shortsize'
21009 shrpenv='$shrpenv'
21010 shsharp='$shsharp'
21011 sig_count='$sig_count'
21012 sig_name='$sig_name'
21013 sig_name_init='$sig_name_init'
21014 sig_num='$sig_num'
21015 sig_num_init='$sig_num_init'
21016 sig_size='$sig_size'
21017 signal_t='$signal_t'
21018 sitearch='$sitearch'
21019 sitearchexp='$sitearchexp'
21020 sitebin='$sitebin'
21021 sitebinexp='$sitebinexp'
21022 sitehtml1='$sitehtml1'
21023 sitehtml1exp='$sitehtml1exp'
21024 sitehtml3='$sitehtml3'
21025 sitehtml3exp='$sitehtml3exp'
21026 sitelib='$sitelib'
21027 sitelib_stem='$sitelib_stem'
21028 sitelibexp='$sitelibexp'
21029 siteman1='$siteman1'
21030 siteman1exp='$siteman1exp'
21031 siteman3='$siteman3'
21032 siteman3exp='$siteman3exp'
21033 siteprefix='$siteprefix'
21034 siteprefixexp='$siteprefixexp'
21035 sitescript='$sitescript'
21036 sitescriptexp='$sitescriptexp'
21037 sizesize='$sizesize'
21038 sizetype='$sizetype'
21039 sleep='$sleep'
21040 smail='$smail'
21041 so='$so'
21042 sockethdr='$sockethdr'
21043 socketlib='$socketlib'
21044 socksizetype='$socksizetype'
21045 sort='$sort'
21046 spackage='$spackage'
21047 spitshell='$spitshell'
21048 srand48_r_proto='$srand48_r_proto'
21049 srandom_r_proto='$srandom_r_proto'
21050 src='$src'
21051 ssizetype='$ssizetype'
21052 startperl='$startperl'
21053 startsh='$startsh'
21054 static_ext='$static_ext'
21055 stdchar='$stdchar'
21056 stdio_base='$stdio_base'
21057 stdio_bufsiz='$stdio_bufsiz'
21058 stdio_cnt='$stdio_cnt'
21059 stdio_filbuf='$stdio_filbuf'
21060 stdio_ptr='$stdio_ptr'
21061 stdio_stream_array='$stdio_stream_array'
21062 strerror_r_proto='$strerror_r_proto'
21063 strings='$strings'
21064 submit='$submit'
21065 subversion='$subversion'
21066 sysman='$sysman'
21067 tail='$tail'
21068 tar='$tar'
21069 targetarch='$targetarch'
21070 tbl='$tbl'
21071 tee='$tee'
21072 test='$test'
21073 timeincl='$timeincl'
21074 timetype='$timetype'
21075 tmpnam_r_proto='$tmpnam_r_proto'
21076 to='$to'
21077 touch='$touch'
21078 tr='$tr'
21079 trnl='$trnl'
21080 troff='$troff'
21081 ttyname_r_proto='$ttyname_r_proto'
21082 u16size='$u16size'
21083 u16type='$u16type'
21084 u32size='$u32size'
21085 u32type='$u32type'
21086 u64size='$u64size'
21087 u64type='$u64type'
21088 u8size='$u8size'
21089 u8type='$u8type'
21090 uidformat='$uidformat'
21091 uidsign='$uidsign'
21092 uidsize='$uidsize'
21093 uidtype='$uidtype'
21094 uname='$uname'
21095 uniq='$uniq'
21096 uquadtype='$uquadtype'
21097 use5005threads='$use5005threads'
21098 use64bitall='$use64bitall'
21099 use64bitint='$use64bitint'
21100 usecrosscompile='$usecrosscompile'
21101 usedl='$usedl'
21102 useithreads='$useithreads'
21103 uselargefiles='$uselargefiles'
21104 uselongdouble='$uselongdouble'
21105 usemorebits='$usemorebits'
21106 usemultiplicity='$usemultiplicity'
21107 usemymalloc='$usemymalloc'
21108 usenm='$usenm'
21109 useopcode='$useopcode'
21110 useperlio='$useperlio'
21111 useposix='$useposix'
21112 usereentrant='$usereentrant'
21113 usesfio='$usesfio'
21114 useshrplib='$useshrplib'
21115 usesocks='$usesocks'
21116 usethreads='$usethreads'
21117 usevendorprefix='$usevendorprefix'
21118 usevfork='$usevfork'
21119 usrinc='$usrinc'
21120 uuname='$uuname'
21121 uvXUformat='$uvXUformat'
21122 uvoformat='$uvoformat'
21123 uvsize='$uvsize'
21124 uvtype='$uvtype'
21125 uvuformat='$uvuformat'
21126 uvxformat='$uvxformat'
21127 vendorarch='$vendorarch'
21128 vendorarchexp='$vendorarchexp'
21129 vendorbin='$vendorbin'
21130 vendorbinexp='$vendorbinexp'
21131 vendorhtml1='$vendorhtml1'
21132 vendorhtml1exp='$vendorhtml1exp'
21133 vendorhtml3='$vendorhtml3'
21134 vendorhtml3exp='$vendorhtml3exp'
21135 vendorlib='$vendorlib'
21136 vendorlib_stem='$vendorlib_stem'
21137 vendorlibexp='$vendorlibexp'
21138 vendorman1='$vendorman1'
21139 vendorman1exp='$vendorman1exp'
21140 vendorman3='$vendorman3'
21141 vendorman3exp='$vendorman3exp'
21142 vendorprefix='$vendorprefix'
21143 vendorprefixexp='$vendorprefixexp'
21144 vendorscript='$vendorscript'
21145 vendorscriptexp='$vendorscriptexp'
21146 version='$version'
21147 version_patchlevel_string='$version_patchlevel_string'
21148 versiononly='$versiononly'
21149 vi='$vi'
21150 voidflags='$voidflags'
21151 xlibpth='$xlibpth'
21152 xs_apiversion='$xs_apiversion'
21153 yacc='$yacc'
21154 yaccflags='$yaccflags'
21155 zcat='$zcat'
21156 zip='$zip'
21157 EOT
21158
21159 : Add in command line options if available
21160 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
21161
21162 : add special variables
21163 $test -f $src/patchlevel.h && \
21164 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
21165 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
21166 echo "PERL_CONFIG_SH=true" >>config.sh
21167
21168 : propagate old symbols
21169 if $test -f UU/config.sh; then
21170         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
21171         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
21172         $sort | $uniq -u >UU/oldsyms
21173         set X `cat UU/oldsyms`
21174         shift
21175         case $# in
21176         0) ;;
21177         *)
21178                 cat <<EOM
21179 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
21180 EOM
21181                 echo "# Variables propagated from previous config.sh file." >>config.sh
21182                 for sym in `cat UU/oldsyms`; do
21183                         echo "    Propagating $hint variable "'$'"$sym..."
21184                         eval 'tmp="$'"${sym}"'"'
21185                         echo "$tmp" | \
21186                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
21187                 done
21188                 ;;
21189         esac
21190 fi
21191
21192 : Finish up by extracting the .SH files
21193 case "$alldone" in
21194 exit)
21195         $rm -rf UU
21196         echo "Extraction done."
21197         exit 0
21198         ;;
21199 cont)
21200         ;;
21201 '')
21202         dflt=''
21203         nostick=true
21204         $cat <<EOM
21205
21206 If you'd like to make any changes to the config.sh file before I begin
21207 to configure things, do it as a shell escape now (e.g. !vi config.sh).
21208
21209 EOM
21210         rp="Press return or use a shell escape to edit config.sh:"
21211         . UU/myread
21212         nostick=''
21213         case "$ans" in
21214         '') ;;
21215         *) : in case they cannot read
21216                 sh 1>&4 -c "$ans";;
21217         esac
21218         ;;
21219 esac
21220
21221 : if this fails, just run all the .SH files by hand
21222 . ./config.sh
21223
21224 echo " "
21225 exec 1>&4
21226 pwd=`pwd`
21227 . ./UU/extract
21228 cd "$pwd"
21229
21230 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
21231         dflt=y
21232         case "$silent" in
21233         true) ;;
21234         *)
21235                 $cat <<EOM
21236
21237 Now you need to generate make dependencies by running "$make depend".
21238 You might prefer to run it in background: "$make depend > makedepend.out &"
21239 It can take a while, so you might not want to run it right now.
21240
21241 EOM
21242                 ;;
21243         esac
21244         rp="Run $make depend now?"
21245         . UU/myread
21246         case "$ans" in
21247         y*)
21248                 $make depend && echo "Now you must run '$make'."
21249                 ;;
21250         *)
21251                 echo "You must run '$make depend' then '$make'."
21252                 ;;
21253         esac
21254 elif test -f [Mm]akefile; then
21255         echo " "
21256         echo "Now you must run a $make."
21257 else
21258         echo "Configure done."
21259 fi
21260
21261 if $test -f Policy.sh; then
21262     $cat <<EOM
21263
21264 If you compile $package on a different machine or from a different object
21265 directory, copy the Policy.sh file from this object directory to the
21266 new one before you run Configure -- this will help you with most of
21267 the policy defaults.
21268
21269 EOM
21270 fi
21271 if $test -f config.msg; then
21272     echo "Hmm.  I also noted the following information while running:"
21273     echo " "
21274     $cat config.msg >&4
21275     $rm -f config.msg
21276 fi
21277 $rm -f kit*isdone ark*isdone
21278 $rm -rf UU
21279
21280 : End of Configure
21281