Split break out the installprefix code from setprefixvar, which allows
[p5sagit/p5-mst-13.2.git] / Configure
1 #! /bin/sh
2 #
3 # If these # comments don't work, trim them. Don't worry about any other
4 # shell scripts, Configure will trim # comments from them for you.
5 #
6 # (If you are trying to port this package to a machine without sh,
7 # I would suggest you have a look at the prototypical config_h.SH file
8 # and edit it to reflect your system. Some packages may include samples
9 # of config.h for certain machines, so you might look for one of those.)
10 #
11 # Yes, you may rip this off to use in other distribution packages. This
12 # script belongs to the public domain and cannot be copyrighted.
13 #
14 # (Note: this Configure script was generated automatically. Rather than
15 # working with this copy of Configure, you may wish to get metaconfig.
16 # The dist-3.0 package (which contains metaconfig) was posted in
17 # comp.sources.misc and is available on CPAN under authors/id/RAM so
18 # you may fetch it yourself from your nearest archive site.)
19 #
20 #
21 # Though this script was generated by metaconfig, it is OK to send
22 # patches against it. It's up to the Configure pumpkin to backport
23 # the patch to the metaunits if it is accepted.
24 # See Porting/pumpkin.pod for more information on metaconfig.
25 #
26
27 # $Id: Head.U,v 3.0.1.9 1997/02/28 15:02:09 ram Exp $
28 #
29 # Generated on Wed Mar  8 09:08:03 CET 2006 [metaconfig 3.0 PL70]
30 # (with additional metaconfig patches by perlbug@perl.org)
31
32 cat >c1$$ <<EOF
33 ARGGGHHHH!!!!!
34
35 SCO csh still thinks true is false.  Write to SCO today and tell them that next
36 year Configure ought to "rm /bin/csh" unless they fix their blasted shell. :-)
37
38 (Actually, Configure ought to just patch csh in place.  Hmm.  Hmmmmm.  All
39 we'd have to do is go in and swap the && and || tokens, wherever they are.)
40
41 [End of diatribe. We now return you to your regularly scheduled programming...]
42 EOF
43 cat >c2$$ <<EOF
44
45 OOPS!  You naughty creature!  You didn't run Configure with sh!
46 I will attempt to remedy the situation by running sh for you...
47 EOF
48
49 true || cat c1$$ c2$$
50 true || exec sh $0 $argv:q
51
52 (exit $?0) || cat c2$$
53 (exit $?0) || exec sh $0 $argv:q
54 rm -f c1$$ c2$$
55
56 if test -f /dev/cputype -a -f /dev/drivers -a -f /dev/osversion; then
57         cat >&4 <<EOF
58 ***
59 *** I'm sorry but this system looks like Plan 9 and Plan 9 doesn't do
60 *** Configure that well.  (Plan 9 is close to UNIX but not close enough.)
61 *** Please read the README.plan9 for further instructions.
62 *** Cannot continue, aborting.
63 ***
64 EOF
65         exit 1
66 fi
67
68 : compute my invocation name
69 me=$0
70 case "$0" in
71 */*)
72         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
73         test "$me" || me=$0
74         ;;
75 esac
76
77 : Proper separator for the PATH environment variable
78 p_=:
79 : On OS/2 this directory should exist if this is not floppy only system :-]
80 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
81     if test -n "$OS2_SHELL"; then
82                 p_=\;
83                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
84                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
85                 is_os2=yes
86         elif test -n "$DJGPP"; then
87                 case "X${MACHTYPE:-nonesuchmach}" in
88                 *cygwin) ;;
89                 *) p_=\; ;;
90                 esac
91         fi
92 fi
93
94 : Proper PATH setting
95 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
96 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
97 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
98 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
99 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
100 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
101 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
102 paths="$paths /sbin /usr/sbin /usr/libexec"
103 paths="$paths /system/gnu_library/bin"
104
105 for p in $paths
106 do
107         case "$p_$PATH$p_" in
108         *$p_$p$p_*) ;;
109         *) test -d $p && PATH=$PATH$p_$p ;;
110         esac
111 done
112
113 PATH=.$p_$PATH
114 export PATH
115
116 : shall we be using ksh?
117 inksh=''
118 needksh=''
119 avoidksh=''
120 newsh=/bin/ksh
121 changesh=''
122 if (PATH=.; alias -x) >/dev/null 2>&1; then
123                 inksh=true
124 fi
125 if test -f /hp-ux -a -f /bin/ksh; then
126         needksh='to avoid sh bug in "here document" expansion'
127 fi
128 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
129         if test X`/usr/bin/uname -v` = X4; then
130                 avoidksh="to avoid AIX 4's /bin/sh"
131                 newsh=/usr/bin/bsh
132         fi
133 fi
134 if test -f /osf_boot -a -f /usr/sbin/setld; then
135         if test X`/usr/bin/uname -s` = XOSF1; then
136                 avoidksh="to avoid Digital UNIX' ksh"
137                 newsh=/bin/sh
138                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
139         fi
140 fi
141 case "$inksh/$needksh" in
142 /[a-z]*)
143                 ENV=''
144                 changesh=true
145                 reason="$needksh"
146         ;;
147 esac
148 case "$inksh/$avoidksh" in
149 true/[a-z]*)
150         changesh=true
151         reason="$avoidksh"
152         ;;
153 esac
154 case "$inksh/$needksh-$avoidksh-" in
155 true/--)
156                 cat <<EOM
157 (I see you are using the Korn shell.  Some ksh's blow up on $me,
158 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
159 EOM
160         ;;
161 esac
162 case "$changesh" in
163 true)
164         export newsh
165         echo "(Feeding myself to $newsh $reason.)"
166         case "$0" in
167         Configure|*/Configure) exec $newsh $0 "$@";;
168         *) exec $newsh Configure "$@";;
169         esac
170         ;;
171 esac
172
173 : if needed set CDPATH to a harmless value that is not chatty
174 : avoid bash 2.02 problems with empty CDPATH.
175 case "$CDPATH" in
176 '')     ;;
177 *)      case "$SHELL" in
178         *bash*) CDPATH='.' ;;
179         *)              CDPATH='' ;;
180         esac
181         ;;
182 esac
183 : Configure runs within the UU subdirectory
184 test -d UU || mkdir UU
185 cd UU && rm -f ./*
186
187 ccname=''
188 ccversion=''
189 ccsymbols=''
190 cppccsymbols=''
191 cppsymbols=''
192 from=''
193 run=''
194 targetarch=''
195 to=''
196 usecrosscompile=''
197 mistrustnm=''
198 perllibs=''
199 dynamic_ext=''
200 extensions=''
201 known_extensions=''
202 nonxs_ext=''
203 static_ext=''
204 useopcode=''
205 useposix=''
206 extras=''
207 d_bsd=''
208 d_eunice=''
209 d_xenix=''
210 eunicefix=''
211 Mcc=''
212 ar=''
213 awk=''
214 bash=''
215 bison=''
216 byacc=''
217 cat=''
218 chgrp=''
219 chmod=''
220 chown=''
221 comm=''
222 compress=''
223 cp=''
224 cpio=''
225 cpp=''
226 csh=''
227 date=''
228 echo=''
229 egrep=''
230 emacs=''
231 expr=''
232 find=''
233 flex=''
234 gmake=''
235 grep=''
236 gzip=''
237 inews=''
238 ksh=''
239 less=''
240 line=''
241 lint=''
242 ln=''
243 lp=''
244 lpr=''
245 ls=''
246 mail=''
247 mailx=''
248 make=''
249 mkdir=''
250 more=''
251 mv=''
252 nm=''
253 nroff=''
254 perl=''
255 pg=''
256 pmake=''
257 pr=''
258 rm=''
259 rmail=''
260 sed=''
261 sendmail=''
262 shar=''
263 sleep=''
264 smail=''
265 sort=''
266 submit=''
267 tail=''
268 tar=''
269 tbl=''
270 tee=''
271 test=''
272 touch=''
273 tr=''
274 troff=''
275 uname=''
276 uniq=''
277 uuname=''
278 vi=''
279 zcat=''
280 zip=''
281 full_ar=''
282 full_sed=''
283 libswanted=''
284 hint=''
285 myuname=''
286 osname=''
287 osvers=''
288 Author=''
289 Date=''
290 Header=''
291 Id=''
292 Locker=''
293 Log=''
294 RCSfile=''
295 Revision=''
296 Source=''
297 State=''
298 _a=''
299 _exe=''
300 _o=''
301 archobjs=''
302 exe_ext=''
303 firstmakefile=''
304 lib_ext=''
305 obj_ext=''
306 path_sep=''
307 afs=''
308 afsroot=''
309 alignbytes=''
310 ansi2knr=''
311 archlib=''
312 archlibexp=''
313 d_archlib=''
314 installarchlib=''
315 archname=''
316 myarchname=''
317 d_atolf=''
318 d_atoll=''
319 baserev=''
320 bin=''
321 binexp=''
322 installbin=''
323 byteorder=''
324 cc=''
325 ccflags=''
326 cppflags=''
327 ldflags=''
328 lkflags=''
329 locincpth=''
330 optimize=''
331 cf_email=''
332 cf_by=''
333 cf_time=''
334 charsize=''
335 contains=''
336 cpp_stuff=''
337 cpplast=''
338 cppminus=''
339 cpprun=''
340 cppstdin=''
341 d__fwalk=''
342 d_access=''
343 d_accessx=''
344 d_aintl=''
345 d_alarm=''
346 asctime_r_proto=''
347 d_asctime_r=''
348 d_attribute_format=''
349 d_attribute_malloc=''
350 d_attribute_nonnull=''
351 d_attribute_noreturn=''
352 d_attribute_pure=''
353 d_attribute_unused=''
354 d_attribute_warn_unused_result=''
355 d_bcmp=''
356 d_bcopy=''
357 d_builtin_choose_expr=''
358 d_builtin_expect=''
359 d_bzero=''
360 d_casti32=''
361 castflags=''
362 d_castneg=''
363 d_chown=''
364 d_chroot=''
365 d_chsize=''
366 d_class=''
367 d_clearenv=''
368 d_closedir=''
369 d_void_closedir=''
370 d_cmsghdr_s=''
371 d_const=''
372 d_copysignl=''
373 cryptlib=''
374 d_crypt=''
375 crypt_r_proto=''
376 d_crypt_r=''
377 d_csh=''
378 full_csh=''
379 ctermid_r_proto=''
380 d_ctermid_r=''
381 ctime_r_proto=''
382 d_ctime_r=''
383 d_cuserid=''
384 d_dbl_dig=''
385 d_dbminitproto=''
386 d_difftime=''
387 d_dirfd=''
388 d_dlerror=''
389 d_dlopen=''
390 d_dlsymun=''
391 d_dosuid=''
392 d_suidsafe=''
393 d_drand48_r=''
394 drand48_r_proto=''
395 d_drand48proto=''
396 d_dup2=''
397 d_eaccess=''
398 d_endgrent=''
399 d_endgrent_r=''
400 endgrent_r_proto=''
401 d_endhent=''
402 d_endhostent_r=''
403 endhostent_r_proto=''
404 d_endnent=''
405 d_endnetent_r=''
406 endnetent_r_proto=''
407 d_endpent=''
408 d_endprotoent_r=''
409 endprotoent_r_proto=''
410 d_endpwent=''
411 d_endpwent_r=''
412 endpwent_r_proto=''
413 d_endsent=''
414 d_endservent_r=''
415 endservent_r_proto=''
416 d_faststdio=''
417 d_fchdir=''
418 d_fchmod=''
419 d_fchown=''
420 d_fcntl=''
421 d_fcntl_can_lock=''
422 d_fd_macros=''
423 d_fd_set=''
424 d_fds_bits=''
425 d_fgetpos=''
426 d_finite=''
427 d_finitel=''
428 d_flexfnam=''
429 d_flock=''
430 d_flockproto=''
431 d_fork=''
432 d_fp_class=''
433 d_fpclass=''
434 d_fpclassify=''
435 d_fpclassl=''
436 d_fpos64_t=''
437 d_frexpl=''
438 d_fs_data_s=''
439 d_fseeko=''
440 d_fsetpos=''
441 d_fstatfs=''
442 d_fsync=''
443 d_ftello=''
444 d_ftime=''
445 d_gettimeod=''
446 d_futimes=''
447 d_Gconvert=''
448 d_getcwd=''
449 d_getespwnam=''
450 d_getfsstat=''
451 d_getgrent=''
452 d_getgrent_r=''
453 getgrent_r_proto=''
454 d_getgrgid_r=''
455 getgrgid_r_proto=''
456 d_getgrnam_r=''
457 getgrnam_r_proto=''
458 d_getgrps=''
459 d_gethbyaddr=''
460 d_gethbyname=''
461 d_gethent=''
462 aphostname=''
463 d_gethname=''
464 d_phostname=''
465 d_uname=''
466 d_gethostbyaddr_r=''
467 gethostbyaddr_r_proto=''
468 d_gethostbyname_r=''
469 gethostbyname_r_proto=''
470 d_gethostent_r=''
471 gethostent_r_proto=''
472 d_gethostprotos=''
473 d_getitimer=''
474 d_getlogin=''
475 d_getlogin_r=''
476 getlogin_r_proto=''
477 d_getmnt=''
478 d_getmntent=''
479 d_getnbyaddr=''
480 d_getnbyname=''
481 d_getnent=''
482 d_getnetbyaddr_r=''
483 getnetbyaddr_r_proto=''
484 d_getnetbyname_r=''
485 getnetbyname_r_proto=''
486 d_getnetent_r=''
487 getnetent_r_proto=''
488 d_getnetprotos=''
489 d_getpagsz=''
490 d_getpent=''
491 d_getpgid=''
492 d_getpgrp2=''
493 d_bsdgetpgrp=''
494 d_getpgrp=''
495 d_getppid=''
496 d_getprior=''
497 d_getpbyname=''
498 d_getpbynumber=''
499 d_getprotobyname_r=''
500 getprotobyname_r_proto=''
501 d_getprotobynumber_r=''
502 getprotobynumber_r_proto=''
503 d_getprotoent_r=''
504 getprotoent_r_proto=''
505 d_getprotoprotos=''
506 d_getprpwnam=''
507 d_getpwent=''
508 d_getpwent_r=''
509 getpwent_r_proto=''
510 d_getpwnam_r=''
511 getpwnam_r_proto=''
512 d_getpwuid_r=''
513 getpwuid_r_proto=''
514 d_getsent=''
515 d_getservbyname_r=''
516 getservbyname_r_proto=''
517 d_getservbyport_r=''
518 getservbyport_r_proto=''
519 d_getservent_r=''
520 getservent_r_proto=''
521 d_getservprotos=''
522 d_getspnam=''
523 d_getspnam_r=''
524 getspnam_r_proto=''
525 d_getsbyname=''
526 d_getsbyport=''
527 d_gmtime_r=''
528 gmtime_r_proto=''
529 d_gnulibc=''
530 gnulibc_version=''
531 d_hasmntopt=''
532 d_htonl=''
533 d_ilogbl=''
534 d_inetaton=''
535 d_int64_t=''
536 d_isascii=''
537 d_isfinite=''
538 d_isinf=''
539 d_isnan=''
540 d_isnanl=''
541 d_killpg=''
542 d_lchown=''
543 d_ldbl_dig=''
544 d_libm_lib_version=''
545 d_link=''
546 d_localtime_r=''
547 localtime_r_proto=''
548 d_locconv=''
549 d_lockf=''
550 d_longdbl=''
551 longdblsize=''
552 d_longlong=''
553 longlongsize=''
554 d_lseekproto=''
555 d_lstat=''
556 d_madvise=''
557 d_malloc_good_size=''
558 d_malloc_size=''
559 d_mblen=''
560 d_mbstowcs=''
561 d_mbtowc=''
562 d_memchr=''
563 d_memcmp=''
564 d_memcpy=''
565 d_memmove=''
566 d_memset=''
567 d_mkdir=''
568 d_mkdtemp=''
569 d_mkfifo=''
570 d_mkstemp=''
571 d_mkstemps=''
572 d_mktime=''
573 d_mmap=''
574 mmaptype=''
575 d_modfl=''
576 d_modfl_pow32_bug=''
577 d_modflproto=''
578 d_mprotect=''
579 d_msg=''
580 d_msgctl=''
581 d_msgget=''
582 d_msghdr_s=''
583 d_msgrcv=''
584 d_msgsnd=''
585 d_msync=''
586 d_munmap=''
587 d_nice=''
588 d_nl_langinfo=''
589 d_off64_t=''
590 d_open3=''
591 d_fpathconf=''
592 d_pathconf=''
593 d_pause=''
594 d_pipe=''
595 d_poll=''
596 d_portable=''
597 d_procselfexe=''
598 procselfexe=''
599 d_old_pthread_create_joinable=''
600 old_pthread_create_joinable=''
601 d_pthread_atfork=''
602 d_pthread_attr_setscope=''
603 d_pthread_yield=''
604 d_sched_yield=''
605 sched_yield=''
606 d_qgcvt=''
607 d_random_r=''
608 random_r_proto=''
609 d_readdir64_r=''
610 readdir64_r_proto=''
611 d_readdir=''
612 d_rewinddir=''
613 d_seekdir=''
614 d_telldir=''
615 d_readdir_r=''
616 readdir_r_proto=''
617 d_readlink=''
618 d_readv=''
619 d_recvmsg=''
620 d_rename=''
621 d_rmdir=''
622 d_safebcpy=''
623 d_safemcpy=''
624 d_sanemcmp=''
625 d_sbrkproto=''
626 d_scalbnl=''
627 d_select=''
628 d_sem=''
629 d_semctl=''
630 d_semget=''
631 d_semop=''
632 d_sendmsg=''
633 d_setegid=''
634 d_seteuid=''
635 d_setgrent=''
636 d_setgrent_r=''
637 setgrent_r_proto=''
638 d_setgrps=''
639 d_sethent=''
640 d_sethostent_r=''
641 sethostent_r_proto=''
642 d_setitimer=''
643 d_setlinebuf=''
644 d_setlocale=''
645 d_setlocale_r=''
646 setlocale_r_proto=''
647 d_setnent=''
648 d_setnetent_r=''
649 setnetent_r_proto=''
650 d_setpent=''
651 d_setpgid=''
652 d_setpgrp2=''
653 d_bsdsetpgrp=''
654 d_setpgrp=''
655 d_setprior=''
656 d_setproctitle=''
657 d_setprotoent_r=''
658 setprotoent_r_proto=''
659 d_setpwent=''
660 d_setpwent_r=''
661 setpwent_r_proto=''
662 d_setregid=''
663 d_setresgid=''
664 d_setresuid=''
665 d_setreuid=''
666 d_setrgid=''
667 d_setruid=''
668 d_setsent=''
669 d_setservent_r=''
670 setservent_r_proto=''
671 d_setsid=''
672 d_setvbuf=''
673 d_sfio=''
674 usesfio=''
675 d_shm=''
676 d_shmat=''
677 d_shmatprototype=''
678 shmattype=''
679 d_shmctl=''
680 d_shmdt=''
681 d_shmget=''
682 d_sigaction=''
683 d_sigprocmask=''
684 d_sigsetjmp=''
685 usesitecustomize=''
686 d_snprintf=''
687 d_vsnprintf=''
688 d_sockatmark=''
689 d_sockatmarkproto=''
690 d_msg_ctrunc=''
691 d_msg_dontroute=''
692 d_msg_oob=''
693 d_msg_peek=''
694 d_msg_proxy=''
695 d_oldsock=''
696 d_scm_rights=''
697 d_socket=''
698 d_sockpair=''
699 sockethdr=''
700 socketlib=''
701 d_socklen_t=''
702 d_socks5_init=''
703 d_sprintf_returns_strlen=''
704 d_sqrtl=''
705 d_srand48_r=''
706 srand48_r_proto=''
707 d_srandom_r=''
708 srandom_r_proto=''
709 d_sresgproto=''
710 d_sresuproto=''
711 d_statblks=''
712 d_statfs_f_flags=''
713 d_statfs_s=''
714 d_fstatvfs=''
715 d_statvfs=''
716 d_stdio_cnt_lval=''
717 d_stdio_ptr_lval=''
718 d_stdio_ptr_lval_nochange_cnt=''
719 d_stdio_ptr_lval_sets_cnt=''
720 d_stdiobase=''
721 d_stdstdio=''
722 stdio_base=''
723 stdio_bufsiz=''
724 stdio_cnt=''
725 stdio_filbuf=''
726 stdio_ptr=''
727 d_index=''
728 d_strchr=''
729 d_strcoll=''
730 d_strctcpy=''
731 d_strerrm=''
732 d_strerror=''
733 d_sysernlst=''
734 d_syserrlst=''
735 d_strerror_r=''
736 strerror_r_proto=''
737 d_strftime=''
738 d_strlcat=''
739 d_strlcpy=''
740 d_strtod=''
741 d_strtol=''
742 d_strtold=''
743 d_strtoll=''
744 d_strtoq=''
745 d_strtoul=''
746 d_strtoull=''
747 d_strtouq=''
748 d_strxfrm=''
749 d_symlink=''
750 d_syscall=''
751 d_syscallproto=''
752 d_sysconf=''
753 d_system=''
754 d_tcgetpgrp=''
755 d_tcsetpgrp=''
756 d_telldirproto=''
757 d_time=''
758 timetype=''
759 clocktype=''
760 d_times=''
761 d_tmpnam_r=''
762 tmpnam_r_proto=''
763 d_truncate=''
764 d_ttyname_r=''
765 ttyname_r_proto=''
766 d_tzname=''
767 d_u32align=''
768 d_ualarm=''
769 d_umask=''
770 d_semctl_semid_ds=''
771 d_semctl_semun=''
772 d_union_semun=''
773 d_unordered=''
774 d_unsetenv=''
775 d_usleep=''
776 d_usleepproto=''
777 d_ustat=''
778 d_vfork=''
779 usevfork=''
780 d_voidsig=''
781 signal_t=''
782 d_volatile=''
783 d_charvspr=''
784 d_vprintf=''
785 d_wait4=''
786 d_waitpid=''
787 d_wcstombs=''
788 d_wctomb=''
789 d_writev=''
790 dlext=''
791 cccdlflags=''
792 ccdlflags=''
793 dlsrc=''
794 ld=''
795 lddlflags=''
796 usedl=''
797 doublesize=''
798 ebcdic=''
799 fflushNULL=''
800 fflushall=''
801 fpossize=''
802 fpostype=''
803 gccansipedantic=''
804 gccosandvers=''
805 gccversion=''
806 gidformat=''
807 gidsign=''
808 gidsize=''
809 gidtype=''
810 groupstype=''
811 h_fcntl=''
812 h_sysfile=''
813 html1dir=''
814 html1direxp=''
815 installhtml1dir=''
816 html3dir=''
817 html3direxp=''
818 installhtml3dir=''
819 i_arpainet=''
820 i_crypt=''
821 db_hashtype=''
822 db_prefixtype=''
823 db_version_major=''
824 db_version_minor=''
825 db_version_patch=''
826 i_db=''
827 i_dbm=''
828 i_rpcsvcdbm=''
829 d_dirnamlen=''
830 direntrytype=''
831 i_dirent=''
832 i_dld=''
833 i_dlfcn=''
834 i_fcntl=''
835 i_float=''
836 i_fp=''
837 i_fp_class=''
838 i_gdbm=''
839 d_grpasswd=''
840 i_grp=''
841 i_ieeefp=''
842 i_inttypes=''
843 i_langinfo=''
844 i_libutil=''
845 i_limits=''
846 i_locale=''
847 i_machcthr=''
848 i_malloc=''
849 i_math=''
850 i_memory=''
851 i_mntent=''
852 i_ndbm=''
853 i_netdb=''
854 i_neterrno=''
855 i_netinettcp=''
856 i_niin=''
857 i_sysin=''
858 i_poll=''
859 i_prot=''
860 i_pthread=''
861 d_pwage=''
862 d_pwchange=''
863 d_pwclass=''
864 d_pwcomment=''
865 d_pwexpire=''
866 d_pwgecos=''
867 d_pwpasswd=''
868 d_pwquota=''
869 i_pwd=''
870 i_sfio=''
871 i_shadow=''
872 i_socks=''
873 i_stddef=''
874 i_stdlib=''
875 i_string=''
876 strings=''
877 i_sunmath=''
878 i_sysaccess=''
879 i_sysdir=''
880 i_sysfile=''
881 d_voidtty=''
882 i_bsdioctl=''
883 i_sysfilio=''
884 i_sysioctl=''
885 i_syssockio=''
886 i_syslog=''
887 i_sysmman=''
888 i_sysmode=''
889 i_sysmount=''
890 i_sysndir=''
891 i_sysparam=''
892 i_sysresrc=''
893 i_syssecrt=''
894 i_sysselct=''
895 i_sysstat=''
896 i_sysstatfs=''
897 i_sysstatvfs=''
898 i_systimes=''
899 i_systypes=''
900 i_sysuio=''
901 i_sysun=''
902 i_sysutsname=''
903 i_sysvfs=''
904 i_syswait=''
905 i_sgtty=''
906 i_termio=''
907 i_termios=''
908 d_tm_tm_gmtoff=''
909 d_tm_tm_zone=''
910 i_systime=''
911 i_systimek=''
912 i_time=''
913 timeincl=''
914 i_unistd=''
915 i_ustat=''
916 i_utime=''
917 i_values=''
918 i_stdarg=''
919 i_varargs=''
920 i_varhdr=''
921 i_vfork=''
922 inc_version_list=''
923 inc_version_list_init=''
924 installprefix=''
925 installprefixexp=''
926 installstyle=''
927 installusrbinperl=''
928 intsize=''
929 longsize=''
930 shortsize=''
931 issymlink=''
932 libc=''
933 ldlibpthname=''
934 libperl=''
935 shrpenv=''
936 useshrplib=''
937 glibpth=''
938 libpth=''
939 loclibpth=''
940 plibpth=''
941 xlibpth=''
942 ignore_versioned_solibs=''
943 libs=''
944 libsdirs=''
945 libsfiles=''
946 libsfound=''
947 libspath=''
948 lns=''
949 d_PRIEUldbl=''
950 d_PRIFUldbl=''
951 d_PRIGUldbl=''
952 d_PRIeldbl=''
953 d_PRIfldbl=''
954 d_PRIgldbl=''
955 d_SCNfldbl=''
956 sPRIEUldbl=''
957 sPRIFUldbl=''
958 sPRIGUldbl=''
959 sPRIeldbl=''
960 sPRIfldbl=''
961 sPRIgldbl=''
962 sSCNfldbl=''
963 lseeksize=''
964 lseektype=''
965 mad=''
966 make_set_make=''
967 d_mymalloc=''
968 freetype=''
969 madlyh=''
970 madlyobj=''
971 madlysrc=''
972 mallocobj=''
973 mallocsrc=''
974 malloctype=''
975 usemallocwrap=''
976 usemymalloc=''
977 installman1dir=''
978 man1dir=''
979 man1direxp=''
980 man1ext=''
981 installman3dir=''
982 man3dir=''
983 man3direxp=''
984 man3ext=''
985 modetype=''
986 multiarch=''
987 mydomain=''
988 myhostname=''
989 phostname=''
990 c=''
991 n=''
992 d_eofnblk=''
993 eagain=''
994 o_nonblock=''
995 rd_nodata=''
996 need_va_copy=''
997 netdb_hlen_type=''
998 netdb_host_type=''
999 netdb_name_type=''
1000 netdb_net_type=''
1001 groupcat=''
1002 hostcat=''
1003 passcat=''
1004 orderlib=''
1005 ranlib=''
1006 d_perl_otherlibdirs=''
1007 otherlibdirs=''
1008 package=''
1009 spackage=''
1010 pager=''
1011 api_revision=''
1012 api_subversion=''
1013 api_version=''
1014 api_versionstring=''
1015 patchlevel=''
1016 perl_patchlevel=''
1017 revision=''
1018 subversion=''
1019 version=''
1020 version_patchlevel_string=''
1021 perl5=''
1022 perladmin=''
1023 perlpath=''
1024 d_nv_preserves_uv=''
1025 d_nv_zero_is_allbits_zero=''
1026 i16size=''
1027 i16type=''
1028 i32size=''
1029 i32type=''
1030 i64size=''
1031 i64type=''
1032 i8size=''
1033 i8type=''
1034 ivsize=''
1035 ivtype=''
1036 nv_preserves_uv_bits=''
1037 nvsize=''
1038 nvtype=''
1039 u16size=''
1040 u16type=''
1041 u32size=''
1042 u32type=''
1043 u64size=''
1044 u64type=''
1045 u8size=''
1046 u8type=''
1047 uvsize=''
1048 uvtype=''
1049 ivdformat=''
1050 nvEUformat=''
1051 nvFUformat=''
1052 nvGUformat=''
1053 nveformat=''
1054 nvfformat=''
1055 nvgformat=''
1056 uvXUformat=''
1057 uvoformat=''
1058 uvuformat=''
1059 uvxformat=''
1060 pidtype=''
1061 prefix=''
1062 prefixexp=''
1063 installprivlib=''
1064 privlib=''
1065 privlibexp=''
1066 prototype=''
1067 ptrsize=''
1068 d_PRIXU64=''
1069 d_PRId64=''
1070 d_PRIi64=''
1071 d_PRIo64=''
1072 d_PRIu64=''
1073 d_PRIx64=''
1074 sPRIXU64=''
1075 sPRId64=''
1076 sPRIi64=''
1077 sPRIo64=''
1078 sPRIu64=''
1079 sPRIx64=''
1080 d_quad=''
1081 quadkind=''
1082 quadtype=''
1083 uquadtype=''
1084 drand01=''
1085 randbits=''
1086 randfunc=''
1087 randseedtype=''
1088 seedfunc=''
1089 installscript=''
1090 scriptdir=''
1091 scriptdirexp=''
1092 selectminbits=''
1093 selecttype=''
1094 sh=''
1095 sig_count=''
1096 sig_name=''
1097 sig_name_init=''
1098 sig_num=''
1099 sig_num_init=''
1100 sig_size=''
1101 installsitearch=''
1102 sitearch=''
1103 sitearchexp=''
1104 installsitebin=''
1105 sitebin=''
1106 sitebinexp=''
1107 installsitehtml1dir=''
1108 sitehtml1dir=''
1109 sitehtml1direxp=''
1110 installsitehtml3dir=''
1111 sitehtml3dir=''
1112 sitehtml3direxp=''
1113 installsitelib=''
1114 sitelib=''
1115 sitelib_stem=''
1116 sitelibexp=''
1117 installsiteman1dir=''
1118 siteman1dir=''
1119 siteman1direxp=''
1120 installsiteman3dir=''
1121 siteman3dir=''
1122 siteman3direxp=''
1123 siteprefix=''
1124 siteprefixexp=''
1125 installsitescript=''
1126 sitescript=''
1127 sitescriptexp=''
1128 sizesize=''
1129 sizetype=''
1130 so=''
1131 socksizetype=''
1132 sharpbang=''
1133 shsharp=''
1134 spitshell=''
1135 src=''
1136 ssizetype=''
1137 startperl=''
1138 startsh=''
1139 stdchar=''
1140 d_stdio_stream_array=''
1141 stdio_stream_array=''
1142 sysman=''
1143 trnl=''
1144 uidformat=''
1145 uidsign=''
1146 uidsize=''
1147 uidtype=''
1148 archname64=''
1149 use64bitall=''
1150 use64bitint=''
1151 usefaststdio=''
1152 ccflags_uselargefiles=''
1153 ldflags_uselargefiles=''
1154 libswanted_uselargefiles=''
1155 uselargefiles=''
1156 uselongdouble=''
1157 usemorebits=''
1158 usemultiplicity=''
1159 nm_opt=''
1160 nm_so_opt=''
1161 runnm=''
1162 usenm=''
1163 useperlio=''
1164 userelocatableinc=''
1165 usesocks=''
1166 d_oldpthreads=''
1167 use5005threads=''
1168 useithreads=''
1169 usereentrant=''
1170 usethreads=''
1171 incpath=''
1172 mips_type=''
1173 usrinc=''
1174 d_vendorarch=''
1175 installvendorarch=''
1176 vendorarch=''
1177 vendorarchexp=''
1178 d_vendorbin=''
1179 installvendorbin=''
1180 vendorbin=''
1181 vendorbinexp=''
1182 installvendorhtml1dir=''
1183 vendorhtml1dir=''
1184 vendorhtml1direxp=''
1185 installvendorhtml3dir=''
1186 vendorhtml3dir=''
1187 vendorhtml3direxp=''
1188 d_vendorlib=''
1189 installvendorlib=''
1190 vendorlib=''
1191 vendorlib_stem=''
1192 vendorlibexp=''
1193 installvendorman1dir=''
1194 vendorman1dir=''
1195 vendorman1direxp=''
1196 installvendorman3dir=''
1197 vendorman3dir=''
1198 vendorman3direxp=''
1199 usevendorprefix=''
1200 vendorprefix=''
1201 vendorprefixexp=''
1202 d_vendorscript=''
1203 installvendorscript=''
1204 vendorscript=''
1205 vendorscriptexp=''
1206 versiononly=''
1207 defvoidused=''
1208 voidflags=''
1209 yacc=''
1210 yaccflags=''
1211 CONFIG=''
1212
1213 define='define'
1214 undef='undef'
1215 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1216 rmlist=''
1217
1218 : We must find out about Eunice early
1219 eunicefix=':'
1220 if test -f /etc/unixtovms; then
1221         eunicefix=/etc/unixtovms
1222 fi
1223 if test -f /etc/unixtovms.exe; then
1224         eunicefix=/etc/unixtovms.exe
1225 fi
1226
1227 : Set executable suffix now -- needed before hints available
1228 if test -f "/libs/version.library"; then
1229 : Amiga OS
1230     _exe=""
1231 elif test -f "/system/gnu_library/bin/ar.pm"; then
1232 : Stratus VOS
1233     _exe=".pm"
1234 elif test -n "$DJGPP"; then
1235 : DOS DJGPP
1236     _exe=".exe"
1237 elif test -d c:/. -o -n "$is_os2" ; then
1238 : OS/2 or cygwin
1239     _exe=".exe"
1240 fi
1241
1242 i_whoami=''
1243 ccname=''
1244 ccversion=''
1245 perllibs=''
1246 : set useposix=false in your hint file to disable the POSIX extension.
1247 useposix=true
1248 : set useopcode=false in your hint file to disable the Opcode extension.
1249 useopcode=true
1250 : Trailing extension.  Override this in a hint file, if needed.
1251 : Extra object files, if any, needed on this platform.
1252 archobjs=''
1253 archname=''
1254 : Possible local include directories to search.
1255 : Set locincpth to "" in a hint file to defeat local include searches.
1256 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1257 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1258 :
1259 : no include file wanted by default
1260 inclwanted=''
1261
1262 groupstype=''
1263 libnames=''
1264 : change the next line if compiling for Xenix/286 on Xenix/386
1265 xlibpth='/usr/lib/386 /lib/386'
1266 : Possible local library directories to search.
1267 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1268 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1269
1270 : general looking path for locating libraries
1271 glibpth="/lib /usr/lib $xlibpth"
1272 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1273 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1274 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1275
1276 : Private path used by Configure to find libraries.  Its value
1277 : is prepended to libpth. This variable takes care of special
1278 : machines, like the mips.  Usually, it should be empty.
1279 plibpth=''
1280
1281 : default library list
1282 libswanted=''
1283 : some systems want to use only the non-versioned libso:s
1284 ignore_versioned_solibs=''
1285 siteman1dir=''
1286 siteman3dir=''
1287 sitescript=''
1288 archname64=''
1289 ccflags_uselargefiles=''
1290 ldflags_uselargefiles=''
1291 libswanted_uselargefiles=''
1292 : set usemultiplicity on the Configure command line to enable multiplicity.
1293 : set usesocks on the Configure command line to enable socks.
1294 : set usethreads on the Configure command line to enable threads.
1295 usereentrant='undef'
1296 : full support for void wanted by default
1297 defvoidused=15
1298
1299 : List of libraries we want.
1300 : If anyone needs extra -lxxx, put those in a hint file.
1301 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1302 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1303 : We probably want to search /usr/shlib before most other libraries.
1304 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1305 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1306 glibpth="/usr/shlib $glibpth"
1307 : Do not use vfork unless overridden by a hint file.
1308 usevfork=false
1309
1310 : Find the basic shell for Bourne shell scripts
1311 case "$sh" in
1312 '')
1313         case "$SYSTYPE" in
1314         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1315         *) xxx='/bin/sh';;
1316         esac
1317         if test -f "$xxx"; then
1318                 sh="$xxx"
1319         else
1320                 : Build up a list and do a single loop so we can 'break' out.
1321                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1322                 for xxx in sh bash ksh pdksh ash; do
1323                         for p in $pth; do
1324                                 try="$try ${p}/${xxx}"
1325                         done
1326                 done
1327                 for xxx in $try; do
1328                         if test -f "$xxx"; then
1329                                 sh="$xxx";
1330                                 break
1331                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1332                                 sh="$xxx";
1333                                 break
1334                         elif test -f "$xxx.exe"; then
1335                                 sh="$xxx";
1336                                 break
1337                         fi
1338                 done
1339         fi
1340         ;;
1341 esac
1342
1343 case "$sh" in
1344 '')     cat >&2 <<EOM
1345 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1346
1347 Usually it's in /bin/sh.  How did you even get this far?
1348 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1349 we'll try to straighten this all out.
1350 EOM
1351         exit 1
1352         ;;
1353 esac
1354
1355 : see if sh knows # comments
1356 if `$sh -c '#' >/dev/null 2>&1`; then
1357         shsharp=true
1358         spitshell=cat
1359         xcat=/bin/cat
1360         test -f $xcat$_exe || xcat=/usr/bin/cat
1361         if test ! -f $xcat$_exe; then
1362                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1363                         if test -f $p/cat$_exe; then
1364                                 xcat=$p/cat
1365                                 break
1366                         fi
1367                 done
1368                 if test ! -f $xcat$_exe; then
1369                         echo "Can't find cat anywhere!"
1370                         exit 1
1371                 fi
1372         fi
1373         echo "#!$xcat" >sharp
1374         $eunicefix sharp
1375         chmod +x sharp
1376         ./sharp > today
1377         if test -s today; then
1378                 sharpbang='#!'
1379         else
1380                 echo "#! $xcat" > sharp
1381                 $eunicefix sharp
1382                 chmod +x sharp
1383                 ./sharp > today
1384                 if test -s today; then
1385                         sharpbang='#! '
1386                 else
1387                         sharpbang=': use '
1388                 fi
1389         fi
1390 else
1391         echo " "
1392         echo "Your $sh doesn't grok # comments--I will strip them later on."
1393         shsharp=false
1394         cd ..
1395         echo "exec grep -v '^[  ]*#'" >spitshell
1396         chmod +x spitshell
1397         $eunicefix spitshell
1398         spitshell=`pwd`/spitshell
1399         cd UU
1400         echo "I presume that if # doesn't work, #! won't work either!"
1401         sharpbang=': use '
1402 fi
1403 rm -f sharp today
1404
1405 : figure out how to guarantee sh startup
1406 case "$startsh" in
1407 '') startsh=${sharpbang}${sh} ;;
1408 *)
1409 esac
1410 cat >sharp <<EOSS
1411 $startsh
1412 set abc
1413 test "$?abc" != 1
1414 EOSS
1415
1416 chmod +x sharp
1417 $eunicefix sharp
1418 if ./sharp; then
1419         : echo "Yup, it does."
1420 else
1421         echo "Hmm... '$startsh' does not guarantee sh startup..."
1422         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1423 fi
1424 rm -f sharp
1425
1426
1427 : Save command line options in file UU/cmdline.opt for later use in
1428 : generating config.sh.
1429 cat > cmdline.opt <<EOSH
1430 # Configure command line arguments.
1431 config_arg0='$0'
1432 config_args='$*'
1433 config_argc=$#
1434 EOSH
1435 argn=1
1436 args_exp=''
1437 args_sep=''
1438 for arg in "$@"; do
1439         cat >>cmdline.opt <<EOSH
1440 config_arg$argn='$arg'
1441 EOSH
1442         # Extreme backslashitis: replace each ' by '"'"'
1443         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1444 $arg
1445 EOC
1446         arg_exp=`cat cmdl.opt`
1447         args_exp="$args_exp$args_sep'$arg_exp'"
1448         argn=`expr $argn + 1`
1449         args_sep=' '
1450 done
1451 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1452 # used by ./hints/os2.sh
1453 rm -f cmdl.opt
1454
1455 : produce awk script to parse command line options
1456 cat >options.awk <<'EOF'
1457 BEGIN {
1458         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1459
1460         len = length(optstr);
1461         for (i = 1; i <= len; i++) {
1462                 c = substr(optstr, i, 1);
1463                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1464                 if (a == ":") {
1465                         arg[c] = 1;
1466                         i++;
1467                 }
1468                 opt[c] = 1;
1469         }
1470 }
1471 {
1472         expect = 0;
1473         str = $0;
1474         if (substr(str, 1, 1) != "-") {
1475                 printf("'%s'\n", str);
1476                 next;
1477         }
1478         len = length($0);
1479         for (i = 2; i <= len; i++) {
1480                 c = substr(str, i, 1);
1481                 if (!opt[c]) {
1482                         printf("-%s\n", substr(str, i));
1483                         next;
1484                 }
1485                 printf("-%s\n", c);
1486                 if (arg[c]) {
1487                         if (i < len)
1488                                 printf("'%s'\n", substr(str, i + 1));
1489                         else
1490                                 expect = 1;
1491                         next;
1492                 }
1493         }
1494 }
1495 END {
1496         if (expect)
1497                 print "?";
1498 }
1499 EOF
1500
1501 : process the command line options
1502 set X `for arg in "$@"; do echo "X$arg"; done |
1503         sed -e s/X// | awk -f options.awk`
1504 eval "set $*"
1505 shift
1506 rm -f options.awk
1507
1508 : set up default values
1509 fastread=''
1510 reuseval=false
1511 config_sh=''
1512 alldone=''
1513 error=''
1514 silent=''
1515 extractsh=''
1516 override=''
1517 knowitall=''
1518 rm -f optdef.sh posthint.sh
1519 cat >optdef.sh <<EOS
1520 $startsh
1521 EOS
1522
1523
1524 : option parsing
1525 while test $# -gt 0; do
1526         case "$1" in
1527         -d) shift; fastread=yes;;
1528         -e) shift; alldone=cont;;
1529         -f)
1530                 shift
1531                 cd ..
1532                 if test -r "$1"; then
1533                         config_sh="$1"
1534                 else
1535                         echo "$me: cannot read config file $1." >&2
1536                         error=true
1537                 fi
1538                 cd UU
1539                 shift;;
1540         -h) shift; error=true;;
1541         -r) shift; reuseval=true;;
1542         -s) shift; silent=true; realsilent=true;;
1543         -E) shift; alldone=exit;;
1544         -K) shift; knowitall=true;;
1545         -O) shift; override=true;;
1546         -S) shift; silent=true; extractsh=true;;
1547         -D)
1548                 shift
1549                 case "$1" in
1550                 *=)
1551                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1552                         echo "$me: ignoring -D $1" >&2
1553                         ;;
1554                 *=*) echo "$1" | \
1555                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1556                 *) echo "$1='define'" >> optdef.sh;;
1557                 esac
1558                 shift
1559                 ;;
1560         -U)
1561                 shift
1562                 case "$1" in
1563                 *=) echo "$1" >> optdef.sh;;
1564                 *=*)
1565                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1566                         echo "$me: ignoring -U $1" >&2
1567                         ;;
1568                 *) echo "$1='undef'" >> optdef.sh;;
1569                 esac
1570                 shift
1571                 ;;
1572         -A)
1573             shift
1574             xxx=''
1575             yyy="$1"
1576             zzz=''
1577             uuu=undef
1578             case "$yyy" in
1579             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1580                  case "$zzz" in
1581                  *:*) zzz='' ;;
1582                  *)   xxx=append
1583                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1584                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1585                  esac
1586                  ;;
1587             esac
1588             case "$xxx" in
1589             '')  case "$yyy" in
1590                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1591                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1592                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1593                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1594                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1595                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1596                  esac
1597                  ;;       
1598             esac
1599             case "$xxx" in
1600             append)
1601                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1602             clear)
1603                 echo "$yyy=''"                  >> posthint.sh ;;
1604             define)
1605                 case "$zzz" in
1606                 '') zzz=define ;;
1607                 esac
1608                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1609             eval)
1610                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1611             prepend)
1612                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1613             undef)
1614                 case "$zzz" in
1615                 '') zzz="$uuu" ;;
1616                 esac
1617                 echo "$yyy=$zzz"                >> posthint.sh ;;
1618             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1619             esac
1620             shift
1621             ;;
1622         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1623             exit 0;;
1624         --) break;;
1625         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1626         *) break;;
1627         esac
1628 done
1629
1630 case "$error" in
1631 true)
1632         cat >&2 <<EOM
1633 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1634                  [-U symbol] [-U symbol=] [-A command:symbol...]
1635   -d : use defaults for all answers.
1636   -e : go on without questioning past the production of config.sh.
1637   -f : specify an alternate default configuration file.
1638   -h : print this help message and exit (with an error status).
1639   -r : reuse C symbols value if possible (skips costly nm extraction).
1640   -s : silent mode, only echoes questions and essential information.
1641   -D : define symbol to have some value:
1642          -D symbol         symbol gets the value 'define'
1643          -D symbol=value   symbol gets the value 'value'
1644   -E : stop at the end of questions, after having produced config.sh.
1645   -K : do not use unless you know what you are doing.
1646   -O : let -D and -U override definitions from loaded configuration file.
1647   -S : perform variable substitutions on all .SH files (can mix with -f)
1648   -U : undefine symbol:
1649          -U symbol    symbol gets the value 'undef'
1650          -U symbol=   symbol gets completely empty
1651   -A : manipulate symbol after the platform specific hints have been applied:
1652          -A symbol=value                append " "value to symbol
1653          -A append:symbol=value         append value to symbol
1654          -A define:symbol=value         define symbol to have value
1655          -A clear:symbol                define symbol to be ''
1656          -A define:symbol               define symbol to be 'define'
1657          -A eval:symbol=value           define symbol to be eval of value
1658          -A prepend:symbol=value        prepend value to symbol
1659          -A undef:symbol                define symbol to be 'undef'
1660          -A undef:symbol=               define symbol to be ''
1661   -V : print version number and exit (with a zero status).
1662 EOM
1663         exit 1
1664         ;;
1665 esac
1666
1667 : Sanity checks
1668 case "$fastread$alldone" in
1669 yescont|yesexit) ;;
1670 *)
1671         case "$extractsh" in
1672         true) ;;
1673         *)
1674                 if test ! -t 0; then
1675                         echo "Say 'sh Configure', not 'sh <Configure'"
1676                         exit 1
1677                 fi
1678                 ;;
1679         esac
1680         ;;
1681 esac
1682
1683 exec 4>&1
1684 case "$silent" in
1685 true) exec 1>/dev/null;;
1686 esac
1687
1688 : run the defines and the undefines, if any, but leave the file out there...
1689 touch optdef.sh
1690 . ./optdef.sh
1691 : create the posthint manipulation script and leave the file out there...
1692 touch posthint.sh
1693
1694 : set package name
1695 package=perl5
1696 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1697 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1698 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1699 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1700 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1701 esac
1702
1703 : Some greps do not return status, grrr.
1704 echo "grimblepritz" >grimble
1705 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1706         contains=contains
1707 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1708         contains=grep
1709 else
1710         contains=contains
1711 fi
1712 rm -f grimble
1713 : the following should work in any shell
1714 case "$contains" in
1715 contains*)
1716         echo " "
1717         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1718         cat >contains <<'EOSS'
1719 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1720 EOSS
1721 chmod +x contains
1722 esac
1723
1724 : Find the path to the source tree
1725 case "$src" in
1726 '') case "$0" in
1727     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1728          case "$src" in
1729          /*)    ;;
1730          .)     ;;
1731          *)     src=`cd ../$src && pwd` ;;
1732          esac
1733          ;;
1734     *)   src='.';;
1735     esac;;
1736 esac
1737 case "$src" in
1738 '')     src=/
1739         rsrc=/
1740         ;;
1741 /*) rsrc="$src";;
1742 *) rsrc="../$src";;
1743 esac
1744 if test -f $rsrc/Configure && \
1745         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1746 then
1747    : found it, so we are ok.
1748 else
1749         rsrc=''
1750         for src in . .. ../.. ../../.. ../../../..; do
1751                 if test -f ../$src/Configure && \
1752                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1753                 then
1754                         rsrc=../$src
1755                         break
1756                 fi
1757         done
1758 fi
1759 case "$rsrc" in
1760 '')
1761         cat <<EOM >&4
1762
1763 Sorry, I can't seem to locate the source dir for $package.  Please start
1764 Configure with an explicit path -- i.e. /some/path/Configure.
1765
1766 EOM
1767         exit 1
1768         ;;
1769 ../.)   rsrc='..';;
1770 *)
1771         echo " "
1772         echo "Sources for $package found in \"$src\"." >&4
1773         ;;
1774 esac
1775
1776 : script used to extract .SH files with variable substitutions
1777 cat >extract <<'EOS'
1778 PERL_CONFIG_SH=true
1779 echo "Doing variable substitutions on .SH files..."
1780 if test -f MANIFEST; then
1781         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1782 else
1783         echo "(Looking for .SH files under the source directory.)"
1784         set x `(cd "$src"; find . -name "*.SH" -print)`
1785 fi
1786 shift
1787 case $# in
1788 0) set x `(cd "$src"; echo *.SH)`; shift;;
1789 esac
1790 if test ! -f "$src/$1"; then
1791         shift
1792 fi
1793 mkdir_p='
1794 name=$1;
1795 create="";
1796 while test $name; do
1797         if test ! -d "$name"; then
1798                 create="$name $create";
1799                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1800                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1801         else
1802                 name="";
1803         fi;
1804 done;
1805 for file in $create; do
1806         mkdir $file;
1807 done
1808 '
1809 for file in $*; do
1810         case "$src" in
1811         ".")
1812                 case "$file" in
1813                 */*)
1814                         dir=`expr X$file : 'X\(.*\)/'`
1815                         file=`expr X$file : 'X.*/\(.*\)'`
1816                         (cd "$dir" && . ./$file)
1817                         ;;
1818                 *)
1819                         . ./$file
1820                         ;;
1821                 esac
1822                 ;;
1823         *)
1824                 case "$file" in
1825                 */*)
1826                         dir=`expr X$file : 'X\(.*\)/'`
1827                         file=`expr X$file : 'X.*/\(.*\)'`
1828                         (set x $dir; shift; eval $mkdir_p)
1829                         sh <"$src/$dir/$file"
1830                         ;;
1831                 *)
1832                         sh <"$src/$file"
1833                         ;;
1834                 esac
1835                 ;;
1836         esac
1837 done
1838 if test -f "$src/config_h.SH"; then
1839         if test ! -f config.h; then
1840         : oops, they left it out of MANIFEST, probably, so do it anyway.
1841         . "$src/config_h.SH"
1842         fi
1843 fi
1844 EOS
1845
1846 : extract files and exit if asked to do so
1847 case "$extractsh" in
1848 true)
1849         case "$realsilent" in
1850         true) ;;
1851         *) exec 1>&4;;
1852         esac
1853         case "$config_sh" in
1854         '') config_sh='config.sh';;
1855         esac
1856         echo " "
1857         echo "Fetching answers from $config_sh..."
1858         cd ..
1859         . $config_sh
1860         test "$override" && . ./optdef.sh
1861         echo " "
1862         . UU/extract
1863         rm -rf UU
1864         echo "Extraction done."
1865         exit 0
1866         ;;
1867 esac
1868
1869 : Eunice requires " " instead of "", can you believe it
1870 echo " "
1871 : Here we go...
1872 echo "Beginning of configuration questions for $package."
1873
1874 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1875
1876 : first determine how to suppress newline on echo command
1877 echo " "
1878 echo "Checking echo to see how to suppress newlines..."
1879 (echo "hi there\c" ; echo " ") >.echotmp
1880 if $contains c .echotmp >/dev/null 2>&1 ; then
1881         echo "...using -n."
1882         n='-n'
1883         c=''
1884 else
1885         cat <<'EOM'
1886 ...using \c
1887 EOM
1888         n=''
1889         c='\c'
1890 fi
1891 echo $n "The star should be here-->$c"
1892 echo '*'
1893 rm -f .echotmp
1894
1895 : Now test for existence of everything in MANIFEST
1896 echo " "
1897 if test -f "$rsrc/MANIFEST"; then
1898         echo "First let's make sure your kit is complete.  Checking..." >&4
1899         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1900         rm -f missing
1901         tmppwd=`pwd`
1902         for filelist in x??; do
1903                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1904         done
1905         if test -s missing; then
1906                 cat missing >&4
1907                 cat >&4 <<'EOM'
1908
1909 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1910
1911 You have the option of continuing the configuration process, despite the
1912 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1913 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1914 and contact the author (perlbug@perl.org).
1915
1916 EOM
1917                 echo $n "Continue? [n] $c" >&4
1918                 read ans
1919                 case "$ans" in
1920                 y*)
1921                         echo "Continuing..." >&4
1922                         rm -f missing
1923                         ;;
1924                 *)
1925                         echo "ABORTING..." >&4
1926                         kill $$
1927                         ;;
1928                 esac
1929         else
1930                 echo "Looks good..."
1931         fi
1932 else
1933         echo "There is no MANIFEST file.  I hope your kit is complete !"
1934 fi
1935 rm -f missing x??
1936
1937 echo " "
1938 : Find the appropriate value for a newline for tr
1939 if test -n "$DJGPP"; then
1940        trnl='\012'
1941 fi
1942 if test X"$trnl" = X; then
1943         case "`echo foo|tr '\n' x 2>/dev/null`" in
1944         foox) trnl='\n' ;;
1945         esac
1946 fi
1947 if test X"$trnl" = X; then
1948         case "`echo foo|tr '\012' x 2>/dev/null`" in
1949         foox) trnl='\012' ;;
1950         esac
1951 fi
1952 if test X"$trnl" = X; then
1953        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1954        fooxy) trnl='\n\r' ;;
1955        esac
1956 fi
1957 if test X"$trnl" = X; then
1958         cat <<EOM >&2
1959
1960 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1961
1962 EOM
1963         exit 1
1964 fi
1965
1966 : compute the number of columns on the terminal for proper question formatting
1967 case "$COLUMNS" in
1968 '') COLUMNS='80';;
1969 esac
1970
1971 : set up the echo used in my read
1972 myecho="case \"\$xxxm\" in
1973 '') echo $n \"\$rp $c\" >&4;;
1974 *) case \"\$rp\" in
1975         '') echo $n \"[\$xxxm] $c\";;
1976         *)
1977                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1978                         echo \"\$rp\" >&4
1979                         echo $n \"[\$xxxm] $c\" >&4
1980                 else
1981                         echo $n \"\$rp [\$xxxm] $c\" >&4
1982                 fi
1983                 ;;
1984         esac;;
1985 esac"
1986
1987 : now set up to do reads with possible shell escape and default assignment
1988 cat <<EOSC >myread
1989 $startsh
1990 xxxm=\$dflt
1991 $myecho
1992 ans='!'
1993 case "\$fastread" in
1994 yes) case "\$dflt" in
1995         '') ;;
1996         *) ans='';
1997                 case "\$silent-\$rp" in
1998                 true-) ;;
1999                 *) echo " " >&4;;
2000                 esac;;
2001         esac;;
2002 *) case "\$silent" in
2003         true) case "\$rp" in
2004                 '') ans='';;
2005                 esac;;
2006         esac;;
2007 esac
2008 while expr "X\$ans" : "X!" >/dev/null; do
2009         read answ
2010         set x \$xxxm
2011         shift
2012         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2013         case  "\$answ" in
2014         "!")
2015                 sh 1>&4
2016                 echo " "
2017                 $myecho
2018                 ;;
2019         !*)
2020                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2021                 shift
2022                 sh 1>&4 -c "\$*"
2023                 echo " "
2024                 $myecho
2025                 ;;
2026         "\$ans")
2027                 case "\$ans" in
2028                 \\&*)
2029                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2030                         shift
2031                         case "\$1" in
2032                         -d)
2033                                 fastread=yes
2034                                 echo "(OK, I'll run with -d after this question.)" >&4
2035                                 ;;
2036                         -*)
2037                                 echo "*** Sorry, \$1 not supported yet." >&4
2038                                 ;;
2039                         esac
2040                         $myecho
2041                         ans=!
2042                         ;;
2043                 esac;;
2044         *)
2045                 case "\$aok" in
2046                 y)
2047                         echo "*** Substitution done -- please confirm."
2048                         xxxm="\$ans"
2049                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2050                         xxxm="\$ans"
2051                         ans=!
2052                         ;;
2053                 *)
2054                         echo "*** Error -- try again."
2055                         ans=!
2056                         ;;
2057                 esac
2058                 $myecho
2059                 ;;
2060         esac
2061         case "\$ans\$xxxm\$nostick" in
2062         '')
2063                 ans=!
2064                 $myecho
2065                 ;;
2066         esac
2067 done
2068 case "\$ans" in
2069 '') ans="\$xxxm";;
2070 esac
2071 EOSC
2072
2073 : create .config dir to save info across Configure sessions
2074 test -d ../.config || mkdir ../.config
2075 cat >../.config/README <<EOF
2076 This directory created by Configure to save information that should
2077 persist across sessions for $package.
2078
2079 You may safely delete it if you wish.
2080 EOF
2081
2082 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2083 case "$usedevel" in
2084 $define|true|[yY]*) ;;
2085 *) case "$xversion" in
2086    *[13579])
2087         cat >&4 <<EOH
2088 *** WHOA THERE!!! ***
2089
2090     This is an UNSTABLE DEVELOPMENT release.
2091     The version of this $package distribution is $xversion, that is, odd,
2092     (as opposed to even) and that signifies a development release.
2093     If you want a maintenance release, you want an even-numbered version.
2094
2095     Do ***NOT*** install this into production use.
2096     Data corruption and crashes are possible.
2097
2098     It is most seriously suggested that you do not continue any further
2099     unless you want to help in developing and debugging Perl.
2100
2101     If you *still* want to build perl, you can answer 'y' now,
2102     or pass -Dusedevel to Configure.
2103
2104 EOH
2105         rp='Do you really want to continue?'
2106         dflt='n'
2107         . ./myread
2108         case "$ans" in
2109         [yY]) echo >&4 "Okay, continuing."
2110               usedevel="$define" ;;
2111         *) echo >&4 "Okay, bye."
2112            exit 1
2113            ;;
2114         esac
2115         ;;
2116     esac
2117     ;;
2118 esac
2119 case "$usedevel" in
2120 $define|true|[yY]*)
2121         case "$versiononly" in
2122         '') versiononly="$define" ;;
2123         esac
2124         case "$installusrbinperl" in
2125         '') installusrbinperl="$undef" ;;
2126         esac
2127         ;;
2128 esac
2129
2130 : general instructions
2131 needman=true
2132 firsttime=true
2133 user=`(logname) 2>/dev/null`
2134 case "$user" in
2135 '') user=`whoami 2>&1`;;
2136 esac
2137 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2138         firsttime=false
2139         echo " "
2140         rp='Would you like to see the instructions?'
2141         dflt=n
2142         . ./myread
2143         case "$ans" in
2144         [yY]*) ;;
2145         *) needman=false;;
2146         esac
2147 fi
2148 if $needman; then
2149         cat <<EOH
2150
2151 This installation shell script will examine your system and ask you questions
2152 to determine how the perl5 package should be installed. If you get
2153 stuck on a question, you may use a ! shell escape to start a subshell or
2154 execute a command.  Many of the questions will have default answers in square
2155 brackets; typing carriage return will give you the default.
2156
2157 On some of the questions which ask for file or directory names you are allowed
2158 to use the ~name construct to specify the login directory belonging to "name",
2159 even if you don't have a shell which knows about that.  Questions where this is
2160 allowed will be marked "(~name ok)".
2161
2162 EOH
2163         rp=''
2164         dflt='Type carriage return to continue'
2165         . ./myread
2166         cat <<'EOH'
2167
2168 The prompter used in this script allows you to use shell variables and
2169 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2170 in the default answer, as if the default line was a set of arguments given to a
2171 script shell.  This means you may also use $* to repeat the whole default line,
2172 so you do not have to re-type everything to add something to the default.
2173
2174 Everytime there is a substitution, you will have to confirm.  If there is an
2175 error (e.g. an unmatched backtick), the default answer will remain unchanged
2176 and you will be prompted again.
2177
2178 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2179 the questions and use the computed defaults (or the previous answers if there
2180 was already a config.sh file). Type 'Configure -h' for a list of options.
2181 You may also start interactively and then answer '& -d' at any prompt to turn
2182 on the non-interactive behaviour for the remainder of the execution.
2183
2184 EOH
2185         . ./myread
2186         cat <<EOH
2187
2188 Much effort has been expended to ensure that this shell script will run on any
2189 Unix system.  If despite that it blows up on yours, your best bet is to edit
2190 Configure and run it again.  If you can't run Configure for some reason,
2191 you'll have to generate a config.sh file by hand.  Whatever problems you
2192 have, let me (perlbug@perl.org) know how I blew it.
2193
2194 This installation script affects things in two ways:
2195
2196 1) it may do direct variable substitutions on some of the files included
2197    in this kit.
2198 2) it builds a config.h file for inclusion in C programs.  You may edit
2199    any of these files as the need arises after running this script.
2200
2201 If you make a mistake on a question, there is no easy way to back up to it
2202 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2203 files.  Configure will offer to let you do this before it runs the SH files.
2204
2205 EOH
2206         dflt='Type carriage return to continue'
2207         . ./myread
2208         case "$firsttime" in
2209         true) echo $user >>../.config/instruct;;
2210         esac
2211 fi
2212
2213 : find out where common programs are
2214 echo " "
2215 echo "Locating common programs..." >&4
2216 cat <<EOSC >loc
2217 $startsh
2218 case \$# in
2219 0) exit 1;;
2220 esac
2221 thing=\$1
2222 shift
2223 dflt=\$1
2224 shift
2225 for dir in \$*; do
2226         case "\$thing" in
2227         .)
2228         if test -d \$dir/\$thing; then
2229                 echo \$dir
2230                 exit 0
2231         fi
2232         ;;
2233         *)
2234         for thisthing in \$dir/\$thing; do
2235                 : just loop through to pick last item
2236         done
2237         if test -f \$thisthing; then
2238                 echo \$thisthing
2239                 exit 0
2240         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2241                 echo \$thisthing
2242                 exit 0
2243         elif test -f \$dir/\$thing.exe; then
2244                 if test -n "$DJGPP"; then
2245                         echo \$dir/\$thing.exe
2246                 elif test "$eunicefix" != ":"; then
2247                         : on Eunice apparently
2248                         echo \$dir/\$thing
2249                         exit 0
2250                 fi
2251                 exit 0
2252         fi
2253         ;;
2254         esac
2255 done
2256 echo \$dflt
2257 exit 1
2258 EOSC
2259 chmod +x loc
2260 $eunicefix loc
2261 loclist="
2262 awk
2263 cat
2264 chmod
2265 comm
2266 cp
2267 echo
2268 expr
2269 grep
2270 ls
2271 mkdir
2272 rm
2273 sed
2274 sort
2275 touch
2276 tr
2277 uniq
2278 "
2279 trylist="
2280 Mcc
2281 ar
2282 bison
2283 byacc
2284 cpp
2285 csh
2286 date
2287 egrep
2288 gmake
2289 gzip
2290 less
2291 ln
2292 make
2293 more
2294 nm
2295 nroff
2296 pg
2297 test
2298 uname
2299 zip
2300 "
2301 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2302 pth="$pth /lib /usr/lib"
2303 for file in $loclist; do
2304         eval xxx=\$$file
2305         case "$xxx" in
2306         /*|?:[\\/]*)
2307                 if test -f "$xxx"; then
2308                         : ok
2309                 else
2310                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2311                         xxx=`./loc $file $file $pth`
2312                 fi
2313                 ;;
2314         '') xxx=`./loc $file $file $pth`;;
2315         *) xxx=`./loc $xxx $xxx $pth`;;
2316         esac
2317         eval $file=$xxx$_exe
2318         eval _$file=$xxx
2319         case "$xxx" in
2320         /*)
2321                 echo $file is in $xxx.
2322                 ;;
2323         ?:[\\/]*)
2324                 echo $file is in $xxx.
2325                 ;;
2326         *)
2327                 echo "I don't know where '$file' is, and my life depends on it." >&4
2328                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2329                 exit 1
2330                 ;;
2331         esac
2332 done
2333 echo " "
2334 echo "Don't worry if any of the following aren't found..."
2335 say=offhand
2336 for file in $trylist; do
2337         eval xxx=\$$file
2338         case "$xxx" in
2339         /*|?:[\\/]*)
2340                 if test -f "$xxx"; then
2341                         : ok
2342                 else
2343                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2344                         xxx=`./loc $file $file $pth`
2345                 fi
2346                 ;;
2347         '') xxx=`./loc $file $file $pth`;;
2348         *) xxx=`./loc $xxx $xxx $pth`;;
2349         esac
2350         eval $file=$xxx$_exe
2351         eval _$file=$xxx
2352         case "$xxx" in
2353         /*)
2354                 echo $file is in $xxx.
2355                 ;;
2356         ?:[\\/]*)
2357                 echo $file is in $xxx.
2358                 ;;
2359         *)
2360                 echo "I don't see $file out there, $say."
2361                 say=either
2362                 ;;
2363         esac
2364 done
2365 case "$egrep" in
2366 egrep)
2367         echo "Substituting grep for egrep."
2368         egrep=$grep
2369         _egrep=$grep
2370         ;;
2371 esac
2372 case "$ln" in
2373 ln)
2374         echo "Substituting cp for ln."
2375         ln=$cp
2376         _ln=$cp
2377         ;;
2378 esac
2379 case "$make" in
2380 make)   
2381         case "$gmake" in
2382         gmake)
2383         echo "I can't find make or gmake, and my life depends on it." >&4
2384         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2385         exit 1
2386         ;;
2387         esac
2388         ;;
2389 esac    
2390 case "$gmake" in
2391 gmake)  ;;
2392 *)      # We can't have osname yet.
2393         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2394                 # Assume that gmake, if found, is definitely GNU make
2395                 # and prefer it over the system make.
2396                 echo "Substituting gmake for make."
2397                 make=$gmake
2398                 _make=$gmake
2399         fi
2400         ;;
2401 esac
2402 case "$test" in
2403 test)
2404         echo "Hopefully test is built into your sh."
2405         ;;
2406 *)
2407         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2408                 echo "Using the test built into your sh."
2409                 test=test
2410                 _test=test
2411         fi
2412         ;;
2413 esac
2414 case "$echo" in
2415 echo)
2416         echo "Hopefully echo is built into your sh."
2417         ;;
2418 '') ;;
2419 *)
2420         echo " "
2421 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2422         $echo $n "hi there$c" >foo1
2423         echo $n "hi there$c" >foo2
2424         if cmp foo1 foo2 >/dev/null 2>&1; then
2425                 echo "They are compatible.  In fact, they may be identical."
2426         else
2427                 case "$n" in
2428                 '-n') n='' c='\c';;
2429                 *) n='-n' c='';;
2430                 esac
2431                 cat <<FOO
2432 They are not compatible!  You are probably running ksh on a non-USG system.
2433 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2434 have echo built in and we may have to run some Bourne shell scripts.  That
2435 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2436
2437 FOO
2438                 $echo $n "The star should be here-->$c"
2439                 $echo "*"
2440         fi
2441         $rm -f foo1 foo2
2442         ;;
2443 esac
2444
2445 cat <<EOS >trygcc
2446 $startsh
2447 EOS
2448 cat <<'EOSC' >>trygcc
2449 case "$cc" in
2450 '') ;;
2451 *)  $rm -f try try.*
2452     $cat >try.c <<EOM
2453 int main(int argc, char *argv[]) {
2454   return 0;
2455 }
2456 EOM
2457     if $cc -o try $ccflags $ldflags try.c; then
2458        :
2459     else
2460         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2461         despair=yes
2462         trygcc=yes
2463         case "$cc" in
2464         *gcc*) trygcc=no ;;
2465         esac
2466         case "`$cc -v -c try.c 2>&1`" in
2467         *gcc*) trygcc=no ;;
2468         esac
2469         if $test X"$trygcc" = Xyes; then
2470             if gcc -o try -c try.c; then
2471                 echo " "
2472                 echo "You seem to have a working gcc, though." >&4
2473                 rp="Would you like to use it?"
2474                 dflt=y
2475                 if $test -f myread; then
2476                     . ./myread
2477                 else
2478                     if $test -f UU/myread; then
2479                         . ./UU/myread
2480                     else
2481                         echo "Cannot find myread, sorry.  Aborting." >&2
2482                         exit 1
2483                     fi
2484                 fi  
2485                 case "$ans" in
2486                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2487                        if $test -f usethreads.cbu; then
2488                            $cat >&4 <<EOM 
2489
2490 *** However, any setting of the C compiler flags (e.g. for thread support)
2491 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2492 *** (together with e.g. -Dusethreads).
2493
2494 EOM
2495                        fi;;
2496                 esac
2497             fi
2498         fi
2499     fi
2500     $rm -f try try.*
2501     ;;
2502 esac
2503 EOSC
2504
2505 cat <<EOS >checkcc
2506 $startsh
2507 EOS
2508 cat <<'EOSC' >>checkcc
2509 case "$cc" in        
2510 '') ;;
2511 *)  $rm -f try try.*              
2512     $cat >try.c <<EOM
2513 int main(int argc, char *argv[]) {
2514   return 0;
2515 }
2516 EOM
2517     if $cc -o try $ccflags $ldflags try.c; then
2518        :
2519     else
2520         if $test X"$despair" = Xyes; then
2521            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2522         fi
2523         $cat >&4 <<EOM         
2524 You need to find a working C compiler.
2525 Either (purchase and) install the C compiler supplied by your OS vendor,
2526 or for a free C compiler try http://gcc.gnu.org/
2527 I cannot continue any further, aborting.
2528 EOM
2529         exit 1
2530     fi
2531     $rm -f try try.*
2532     ;;
2533 esac
2534 EOSC
2535
2536 : determine whether symbolic links are supported
2537 echo " "
2538 $touch blurfl
2539 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2540         echo "Symbolic links are supported." >&4
2541         lns="$ln -s"
2542 else
2543         echo "Symbolic links are NOT supported." >&4
2544         lns="$ln"
2545 fi
2546 $rm -f blurfl sym
2547
2548 : determine whether symbolic links are supported
2549 echo " "
2550 case "$lns" in
2551 *"ln"*" -s")
2552         echo "Checking how to test for symbolic links..." >&4
2553         $lns blurfl sym
2554         if $test "X$issymlink" = X; then
2555                 case "$newsh" in
2556                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2557                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2558                 esac
2559                 if test $? = 0; then
2560                         issymlink="test -h"
2561                 else
2562                         echo "Your builtin 'test -h' may be broken." >&4
2563                         case "$test" in
2564                         /*)     ;;
2565                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2566                                 for p in $pth
2567                                 do
2568                                         if test -f "$p/$test"; then
2569                                                 test="$p/$test"
2570                                                 break
2571                                         fi
2572                                 done
2573                                 ;;
2574                         esac
2575                         case "$test" in
2576                         /*)
2577                                 echo "Trying external '$test -h'." >&4
2578                                 issymlink="$test -h"
2579                                 if $test ! -h sym >/dev/null 2>&1; then
2580                                         echo "External '$test -h' is broken, too." >&4
2581                                         issymlink=''
2582                                 fi
2583                                 ;;
2584                         *)      issymlink='' ;;
2585                         esac
2586                 fi              
2587         fi
2588         if $test "X$issymlink" = X; then
2589                 if $test -L sym 2>/dev/null; then
2590                         issymlink="$test -L"
2591                         echo "The builtin '$test -L' worked." >&4
2592                 fi
2593         fi
2594         if $test "X$issymlink" != X; then
2595                 echo "You can test for symbolic links with '$issymlink'." >&4
2596         else
2597                 echo "I do not know how you can test for symbolic links." >&4
2598         fi
2599         $rm -f blurfl sym
2600         ;;
2601 *)      echo "No symbolic links, so not testing for their testing..." >&4
2602         ;;
2603 esac
2604 echo " "
2605
2606
2607 case "$mksymlinks" in
2608 $define|true|[yY]*)
2609         case "$src" in
2610         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2611                 exit 1
2612                 ;;
2613         *)      case "$lns:$issymlink" in
2614                 *"ln"*" -s:"*"test -"?)
2615                         echo "Creating the symbolic links..." >&4
2616                         echo "(First creating the subdirectories...)" >&4
2617                         cd ..
2618                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2619                                 read directory
2620                                 test -z "$directory" && break
2621                                 mkdir -p $directory
2622                         done
2623                         # Sanity check 1.
2624                         if test ! -d t/base; then
2625                                 echo "Failed to create the subdirectories.  Aborting." >&4
2626                                 exit 1
2627                         fi
2628                         echo "(Then creating the symlinks...)" >&4
2629                         awk '{print $1}' $src/MANIFEST | while true; do
2630                                 read filename
2631                                 test -z "$filename" && break
2632                                 if test -f $filename; then
2633                                         if $issymlink $filename; then
2634                                                 rm -f $filename
2635                                         fi
2636                                 fi
2637                                 if test -f $filename; then
2638                                         echo "$filename already exists, not symlinking."
2639                                 else
2640                                         ln -s $src/$filename $filename
2641                                 fi
2642                         done
2643                         # Sanity check 2.
2644                         if test ! -f t/base/lex.t; then
2645                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2646                                 exit 1
2647                         fi
2648                         cd UU
2649                         ;;
2650                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2651                         ;;
2652                 esac
2653                 ;;
2654         esac
2655         ;;
2656 esac
2657
2658
2659 case "$usecrosscompile" in
2660 $define|true|[yY]*)
2661         $echo "Cross-compiling..."
2662         croak=''
2663         case "$cc" in
2664         *-*-gcc) # A cross-compiling gcc, probably.
2665             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2666             ar=$targetarch-ar
2667             # leave out ld, choosing it is more complex
2668             nm=$targetarch-nm
2669             ranlib=$targetarch-ranlib
2670             $echo 'extern int foo;' > try.c
2671             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2672             shift
2673             if $test $# -gt 0; then
2674                 incpth="$incpth $*"
2675                 incpth="`$echo $incpth|$sed 's/^ //'`"
2676                 echo "Guessing incpth '$incpth'." >&4
2677                 for i in $*; do
2678                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2679                     if $test -d $j; then
2680                         libpth="$libpth $j"
2681                     fi
2682                 done   
2683                 libpth="`$echo $libpth|$sed 's/^ //'`"
2684                 echo "Guessing libpth '$libpth'." >&4
2685             fi
2686             $rm -f try.c
2687             ;;
2688         esac
2689         case "$targetarch" in
2690         '') echo "Targetarch not defined." >&4; croak=y ;;
2691         *)  echo "Using targetarch $targetarch." >&4 ;;
2692         esac
2693         case "$incpth" in
2694         '') echo "Incpth not defined." >&4; croak=y ;;
2695         *)  echo "Using incpth '$incpth'." >&4 ;;
2696         esac
2697         case "$libpth" in
2698         '') echo "Libpth not defined." >&4; croak=y ;;
2699         *)  echo "Using libpth '$libpth'." >&4 ;;
2700         esac
2701         case "$usrinc" in
2702         '') for i in $incpth; do
2703                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2704                     usrinc=$i
2705                     echo "Guessing usrinc $usrinc." >&4
2706                     break
2707                 fi
2708             done
2709             case "$usrinc" in
2710             '') echo "Usrinc not defined." >&4; croak=y ;;
2711             esac
2712             ;;
2713         *)  echo "Using usrinc $usrinc." >&4 ;;
2714         esac
2715         case "$targethost" in
2716         '') echo "Targethost not defined." >&4; croak=y ;;
2717         *)  echo "Using targethost $targethost." >&4
2718         esac
2719         locincpth=' '
2720         loclibpth=' '
2721         case "$croak" in
2722         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2723         esac
2724         case "$src" in
2725         /*) run=$src/Cross/run
2726             targetmkdir=$src/Cross/mkdir
2727             to=$src/Cross/to
2728             from=$src/Cross/from
2729             ;;
2730         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2731             run=$pwd/Cross/run
2732             targetmkdir=$pwd/Cross/mkdir
2733             to=$pwd/Cross/to
2734             from=$pwd/Cross/from
2735             ;;
2736         esac
2737         case "$targetrun" in
2738         '') targetrun=ssh ;;
2739         esac
2740         case "$targetto" in
2741         '') targetto=scp ;;
2742         esac
2743         case "$targetfrom" in
2744         '') targetfrom=scp ;;
2745         esac
2746         run=$run-$targetrun
2747         to=$to-$targetto
2748         from=$from-$targetfrom
2749         case "$targetdir" in
2750         '')  targetdir=/tmp
2751              echo "Guessing targetdir $targetdir." >&4
2752              ;;
2753         esac
2754         case "$targetuser" in
2755         '')  targetuser=root
2756              echo "Guessing targetuser $targetuser." >&4
2757              ;;
2758         esac
2759         case "$targetfrom" in
2760         scp)    q=-q ;;
2761         *)      q='' ;;
2762         esac
2763         case "$targetrun" in
2764         ssh|rsh)
2765             cat >$run <<EOF
2766 #!/bin/sh
2767 case "\$1" in
2768 -cwd)
2769   shift
2770   cwd=\$1
2771   shift
2772   ;;
2773 esac
2774 case "\$cwd" in
2775 '') cwd=$targetdir ;;
2776 esac
2777 exe=\$1
2778 shift
2779 if $test ! -f \$exe.xok; then
2780   $to \$exe
2781   $touch \$exe.xok
2782 fi
2783 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2784 EOF
2785             ;;
2786         *)  echo "Unknown targetrun '$targetrun'" >&4
2787             exit 1
2788             ;;
2789         esac
2790         case "$targetmkdir" in
2791         */Cross/mkdir)
2792             cat >$targetmkdir <<EOF
2793 #!/bin/sh
2794 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2795 EOF
2796             $chmod a+rx $targetmkdir
2797             ;;
2798         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2799             exit 1
2800             ;;
2801         esac
2802         case "$targetto" in
2803         scp|rcp)
2804             cat >$to <<EOF
2805 #!/bin/sh
2806 for f in \$@
2807 do
2808   case "\$f" in
2809   /*)
2810     $targetmkdir \`dirname \$f\`
2811     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2812     ;;
2813   *)
2814     $targetmkdir $targetdir/\`dirname \$f\`
2815     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2816     ;;
2817   esac
2818 done
2819 exit 0
2820 EOF
2821             ;;
2822         cp) cat >$to <<EOF
2823 #!/bin/sh
2824 for f in \$@
2825 do
2826   case "\$f" in
2827   /*)
2828     $mkdir -p $targetdir/\`dirname \$f\`
2829     $cp \$f $targetdir/\$f || exit 1
2830     ;;
2831   *)
2832     $targetmkdir $targetdir/\`dirname \$f\`
2833     $cp \$f $targetdir/\$f || exit 1
2834     ;;
2835   esac
2836 done
2837 exit 0
2838 EOF
2839             ;;
2840         *)  echo "Unknown targetto '$targetto'" >&4
2841             exit 1
2842             ;;
2843         esac
2844         case "$targetfrom" in
2845         scp|rcp)
2846           cat >$from <<EOF
2847 #!/bin/sh
2848 for f in \$@
2849 do
2850   $rm -f \$f
2851   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2852 done
2853 exit 0
2854 EOF
2855             ;;
2856         cp) cat >$from <<EOF
2857 #!/bin/sh
2858 for f in \$@
2859 do
2860   $rm -f \$f
2861   cp $targetdir/\$f . || exit 1
2862 done
2863 exit 0
2864 EOF
2865             ;;
2866         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2867             exit 1
2868             ;;
2869         esac
2870         if $test ! -f $run; then
2871             echo "Target 'run' script '$run' not found." >&4
2872         else
2873             $chmod a+rx $run
2874         fi
2875         if $test ! -f $to; then
2876             echo "Target 'to' script '$to' not found." >&4
2877         else
2878             $chmod a+rx $to
2879         fi
2880         if $test ! -f $from; then
2881             echo "Target 'from' script '$from' not found." >&4
2882         else
2883             $chmod a+rx $from
2884         fi
2885         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2886             exit 1
2887         fi
2888         cat >&4 <<EOF
2889 Using '$run' for remote execution,
2890 and '$from' and '$to'
2891 for remote file transfer.
2892 EOF
2893         ;;
2894 *)      run=''
2895         to=:
2896         from=:
2897         usecrosscompile='undef'
2898         targetarch=''
2899         ;;
2900 esac
2901
2902 : see whether [:lower:] and [:upper:] are supported character classes
2903 echo " "
2904 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2905 ABYZ)
2906         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2907         up='[:upper:]'
2908         low='[:lower:]'
2909         ;;
2910 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2911         # (0xd9 and 0xe2), therefore that is a nice testing point.
2912         if test "X$up" = X -o "X$low" = X; then
2913             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2914             rs) up='[A-Z]'
2915                 low='[a-z]'
2916                 ;;
2917             esac
2918         fi
2919         if test "X$up" = X -o "X$low" = X; then
2920             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2921             rs) up='A-Z'
2922                 low='a-z'
2923                 ;;
2924             esac
2925         fi
2926         if test "X$up" = X -o "X$low" = X; then
2927             case "`echo RS | od -x 2>/dev/null`" in
2928             *D9E2*|*d9e2*)
2929                 echo "Hey, this might be EBCDIC." >&4
2930                 if test "X$up" = X -o "X$low" = X; then
2931                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2932                     rs) up='[A-IJ-RS-Z]'
2933                         low='[a-ij-rs-z]'
2934                         ;;
2935                     esac
2936                 fi
2937                 if test "X$up" = X -o "X$low" = X; then
2938                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2939                     rs) up='A-IJ-RS-Z'
2940                         low='a-ij-rs-z'
2941                         ;;
2942                     esac
2943                 fi
2944                 ;;
2945             esac
2946         fi
2947 esac
2948 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2949 rs)
2950     echo "Using $up and $low to convert case." >&4
2951     ;;
2952 *)
2953     echo "I don't know how to translate letters from upper to lower case." >&4
2954     echo "Your tr is not acting any way I know of." >&4
2955     exit 1
2956     ;;
2957 esac
2958 : set up the translation script tr, must be called with ./tr of course
2959 cat >tr <<EOSC
2960 $startsh
2961 case "\$1\$2" in
2962 '[A-Z][a-z]') exec $tr '$up' '$low';;
2963 '[a-z][A-Z]') exec $tr '$low' '$up';;
2964 esac
2965 exec $tr "\$@"
2966 EOSC
2967 chmod +x tr
2968 $eunicefix tr
2969
2970 : Try to determine whether config.sh was made on this system
2971 case "$config_sh" in
2972 '')
2973 myuname=`$uname -a 2>/dev/null`
2974 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2975 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2976 # because the A-Z/a-z are not consecutive.
2977 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2978         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2979 newmyuname="$myuname"
2980 dflt=n
2981 case "$knowitall" in
2982 '')
2983         if test -f ../config.sh; then
2984                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2985                         eval "`grep myuname= ../config.sh`"
2986                 fi
2987                 if test "X$myuname" = "X$newmyuname"; then
2988                         dflt=y
2989                 fi
2990         fi
2991         ;;
2992 *) dflt=y;;
2993 esac
2994
2995 : Get old answers from old config file if Configure was run on the
2996 : same system, otherwise use the hints.
2997 hint=default
2998 cd ..
2999 if test -f config.sh; then
3000         echo " "
3001         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3002         . UU/myread
3003         case "$ans" in
3004         n*|N*) echo "OK, I'll ignore it."
3005                 mv config.sh config.sh.old
3006                 myuname="$newmyuname"
3007                 ;;
3008         *)  echo "Fetching default answers from your old config.sh file..." >&4
3009                 tmp_n="$n"
3010                 tmp_c="$c"
3011                 tmp_sh="$sh"
3012                 . ./config.sh
3013                 cp config.sh UU
3014                 n="$tmp_n"
3015                 c="$tmp_c"
3016                 : Older versions did not always set $sh.  Catch re-use of such
3017                 : an old config.sh.
3018                 case "$sh" in
3019                 '') sh="$tmp_sh" ;;
3020                 esac
3021                 hint=previous
3022                 ;;
3023         esac
3024 fi
3025 . ./UU/checkcc
3026 if test ! -f config.sh; then
3027         $cat <<EOM
3028
3029 First time through, eh?  I have some defaults handy for some systems
3030 that need some extra help getting the Configure answers right:
3031
3032 EOM
3033         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3034         dflt=''
3035         : Half the following guesses are probably wrong... If you have better
3036         : tests or hints, please send them to perlbug@perl.org
3037         : The metaconfig authors would also appreciate a copy...
3038         $test -f /irix && osname=irix
3039         $test -f /xenix && osname=sco_xenix
3040         $test -f /dynix && osname=dynix
3041         $test -f /dnix && osname=dnix
3042         $test -f /lynx.os && osname=lynxos
3043         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3044         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3045         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3046         $test -f /bin/mips && /bin/mips && osname=mips
3047         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3048                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3049         $test -d /usr/apollo/bin && osname=apollo
3050         $test -f /etc/saf/_sactab && osname=svr4
3051         $test -d /usr/include/minix && osname=minix
3052         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3053         if $test -d /MachTen -o -d /MachTen_Folder; then
3054                 osname=machten
3055                 if $test -x /sbin/version; then
3056                         osvers=`/sbin/version | $awk '{print $2}' |
3057                         $sed -e 's/[A-Za-z]$//'`
3058                 elif $test -x /usr/etc/version; then
3059                         osvers=`/usr/etc/version | $awk '{print $2}' |
3060                         $sed -e 's/[A-Za-z]$//'`
3061                 else
3062                         osvers="$2.$3"
3063                 fi
3064         fi
3065
3066         $test -f /sys/posix.dll &&
3067                 $test -f /usr/bin/what &&
3068                 set X `/usr/bin/what /sys/posix.dll` &&
3069                 $test "$3" = UWIN &&
3070                 osname=uwin &&
3071                 osvers="$5"
3072
3073         if $test -f $uname; then
3074                 set X $myuname
3075                 shift
3076
3077                 case "$5" in
3078                 fps*) osname=fps ;;
3079                 mips*)
3080                         case "$4" in
3081                         umips) osname=umips ;;
3082                         *) osname=mips ;;
3083                         esac;;
3084                 [23]100) osname=mips ;;
3085                 next*) osname=next ;;
3086                 i386*)
3087                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3088                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3089                                 osname='sco'
3090                                 osvers=$tmp
3091                         elif $test -f /etc/kconfig; then
3092                                 osname=isc
3093                                 if test "$lns" = "$ln -s"; then
3094                                         osvers=4
3095                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3096                                         osvers=3
3097                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3098                                         osvers=2
3099                                 fi
3100                         fi
3101                         tmp=''
3102                         ;;
3103                 pc*)
3104                         if test -n "$DJGPP"; then
3105                                 osname=dos
3106                                 osvers=djgpp
3107                         fi
3108                         ;;
3109                 esac
3110
3111                 case "$1" in
3112                 aix) osname=aix
3113                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3114                         case "$tmp" in
3115                         # oslevel can fail with:
3116                         # oslevel: Unable to acquire lock.
3117                         *not\ found) osvers="$4"."$3" ;;
3118                         '<3240'|'<>3240') osvers=3.2.0 ;;
3119                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3120                         '=3250'|'>3250') osvers=3.2.5 ;;
3121                         *) osvers=$tmp;;
3122                         esac
3123                         ;;
3124                 bsd386) osname=bsd386
3125                         osvers=`$uname -r`
3126                         ;;
3127                 cygwin*) osname=cygwin
3128                         osvers="$3"
3129                         ;;
3130                 *dc.osx) osname=dcosx
3131                         osvers="$3"
3132                         ;;
3133                 dnix) osname=dnix
3134                         osvers="$3"
3135                         ;;
3136                 domainos) osname=apollo
3137                         osvers="$3"
3138                         ;;
3139                 dgux)   osname=dgux
3140                         osvers="$3"
3141                         ;;
3142                 dragonfly) osname=dragonfly
3143                         osvers="$3"
3144                         ;;
3145                 dynixptx*) osname=dynixptx
3146                         osvers=`echo "$4"|sed 's/^v//'`
3147                         ;;
3148                 freebsd) osname=freebsd
3149                         osvers="$3" ;;
3150                 genix)  osname=genix ;;
3151                 gnu)    osname=gnu
3152                         osvers="$3" ;;
3153                 hp*)    osname=hpux
3154                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3155                         ;;
3156                 irix*)  osname=irix
3157                         case "$3" in
3158                         4*) osvers=4 ;;
3159                         5*) osvers=5 ;;
3160                         *)      osvers="$3" ;;
3161                         esac
3162                         ;;
3163                 linux)  osname=linux
3164                         case "$3" in
3165                         *)      osvers="$3" ;;
3166                         esac
3167                         ;;
3168                 MiNT)   osname=mint
3169                         ;;
3170                 netbsd*) osname=netbsd
3171                         osvers="$3"
3172                         ;;
3173                 news-os) osvers="$3"
3174                         case "$3" in
3175                         4*) osname=newsos4 ;;
3176                         *) osname=newsos ;;
3177                         esac
3178                         ;;
3179                 next*) osname=next ;;
3180                 nonstop-ux) osname=nonstopux ;;
3181                 openbsd) osname=openbsd
3182                         osvers="$3"
3183                         ;;
3184                 os2)    osname=os2
3185                         osvers="$4"
3186                         ;;
3187                 POSIX-BC | posix-bc ) osname=posix-bc
3188                         osvers="$3"
3189                         ;;
3190                 powerux | power_ux | powermax_os | powermaxos | \
3191                 powerunix | power_unix) osname=powerux
3192                         osvers="$3"
3193                         ;;
3194                 qnx) osname=qnx
3195                         osvers="$4"
3196                         ;;
3197                 solaris) osname=solaris
3198                         case "$3" in
3199                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3200                         *)      osvers="$3" ;;
3201                         esac
3202                         ;;
3203                 sunos) osname=sunos
3204                         case "$3" in
3205                         5*) osname=solaris
3206                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3207                         *)      osvers="$3" ;;
3208                         esac
3209                         ;;
3210                 titanos) osname=titanos
3211                         case "$3" in
3212                         1*) osvers=1 ;;
3213                         2*) osvers=2 ;;
3214                         3*) osvers=3 ;;
3215                         4*) osvers=4 ;;
3216                         *)      osvers="$3" ;;
3217                         esac
3218                         ;;
3219                 ultrix) osname=ultrix
3220                         osvers="$3"
3221                         ;;
3222                 osf1|mls+)      case "$5" in
3223                                 alpha)
3224                                         osname=dec_osf
3225                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3226                                         case "$osvers" in
3227                                         [1-9].[0-9]*) ;;
3228                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3229                                         esac
3230                                         ;;
3231                         hp*)    osname=hp_osf1  ;;
3232                         mips)   osname=mips_osf1 ;;
3233                         esac
3234                         ;;
3235                 # UnixWare 7.1.2 is known as Open UNIX 8
3236                 openunix|unixware) osname=svr5
3237                         osvers="$4"
3238                         ;;
3239                 uts)    osname=uts
3240                         osvers="$3"
3241                         ;;
3242                 vos) osvers="$3"
3243                         ;;
3244                 $2) case "$osname" in
3245                         *isc*) ;;
3246                         *freebsd*) ;;
3247                         svr*)
3248                                 : svr4.x or possibly later
3249                                 case "svr$3" in
3250                                 ${osname}*)
3251                                         osname=svr$3
3252                                         osvers=$4
3253                                         ;;
3254                                 esac
3255                                 case "$osname" in
3256                                 svr4.0)
3257                                         : Check for ESIX
3258                                         if test -f /stand/boot ; then
3259                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3260                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3261                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3262                                                         if test -n "$isesix"; then
3263                                                                 osname=esix4
3264                                                         fi
3265                                                 fi
3266                                         fi
3267                                         ;;
3268                                 esac
3269                                 ;;
3270                         *)      if test -f /etc/systemid; then
3271                                         osname=sco
3272                                         set `echo $3 | $sed 's/\./ /g'` $4
3273                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3274                                                 osvers=$1.$2.$3
3275                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3276                                                 osvers=$1.$2
3277                                         elif $test -f $src/hints/sco_$1.sh; then
3278                                                 osvers=$1
3279                                         fi
3280                                 else
3281                                         case "$osname" in
3282                                         '') : Still unknown.  Probably a generic Sys V.
3283                                                 osname="sysv"
3284                                                 osvers="$3"
3285                                                 ;;
3286                                         esac
3287                                 fi
3288                                 ;;
3289                         esac
3290                         ;;
3291                 *)      case "$osname" in
3292                         '') : Still unknown.  Probably a generic BSD.
3293                                 osname="$1"
3294                                 osvers="$3"
3295                                 ;;
3296                         esac
3297                         ;;
3298                 esac
3299         else
3300                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3301                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3302                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3303                                 osname=news_os
3304                         fi
3305                         $rm -f UU/kernel.what
3306                 elif test -d c:/. -o -n "$is_os2" ; then
3307                         set X $myuname
3308                         osname=os2
3309                         osvers="$5"
3310                 fi
3311         fi
3312
3313         case "$targetarch" in
3314         '') ;;
3315         *)  hostarch=$osname
3316             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3317             osvers=''
3318             ;;
3319         esac
3320
3321         : Now look for a hint file osname_osvers, unless one has been
3322         : specified already.
3323         case "$hintfile" in
3324         ''|' ')
3325                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3326                 : Also try without trailing minor version numbers.
3327                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3328                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3329                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3330                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3331                 case "$file" in
3332                 '') dflt=none ;;
3333                 *)  case "$osvers" in
3334                         '') dflt=$file
3335                                 ;;
3336                         *)  if $test -f $src/hints/$file.sh ; then
3337                                         dflt=$file
3338                                 elif $test -f $src/hints/$xfile.sh ; then
3339                                         dflt=$xfile
3340                                 elif $test -f $src/hints/$xxfile.sh ; then
3341                                         dflt=$xxfile
3342                                 elif $test -f $src/hints/$xxxfile.sh ; then
3343                                         dflt=$xxxfile
3344                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3345                                         dflt=$xxxxfile
3346                                 elif $test -f "$src/hints/${osname}.sh" ; then
3347                                         dflt="${osname}"
3348                                 else
3349                                         dflt=none
3350                                 fi
3351                                 ;;
3352                         esac
3353                         ;;
3354                 esac
3355                 if $test -f Policy.sh ; then
3356                         case "$dflt" in
3357                         *Policy*) ;;
3358                         none) dflt="Policy" ;;
3359                         *) dflt="Policy $dflt" ;;
3360                         esac
3361                 fi
3362                 ;;
3363         *)
3364                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3365                 ;;
3366         esac
3367
3368         if $test -f Policy.sh ; then
3369                 $cat <<EOM
3370
3371 There's also a Policy hint file available, which should make the
3372 site-specific (policy) questions easier to answer.
3373 EOM
3374
3375         fi
3376
3377         $cat <<EOM
3378
3379 You may give one or more space-separated answers, or "none" if appropriate.
3380 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3381 is a good thing.  DO NOT give a wrong version or a wrong OS.
3382
3383 EOM
3384
3385         rp="Which of these apply, if any?"
3386         . UU/myread
3387         tans=$ans
3388         for file in $tans; do
3389                 if $test X$file = XPolicy -a -f Policy.sh; then
3390                         . Policy.sh
3391                         $cat Policy.sh >> UU/config.sh
3392                 elif $test -f $src/hints/$file.sh; then
3393                         . $src/hints/$file.sh
3394                         $cat $src/hints/$file.sh >> UU/config.sh
3395                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3396                         : nothing
3397                 else
3398                         : Give one chance to correct a possible typo.
3399                         echo "$file.sh does not exist"
3400                         dflt=$file
3401                         rp="hint to use instead?"
3402                         . UU/myread
3403                         for file in $ans; do
3404                                 if $test -f "$src/hints/$file.sh"; then
3405                                         . $src/hints/$file.sh
3406                                         $cat $src/hints/$file.sh >> UU/config.sh
3407                                 elif $test X$ans = X -o X$ans = Xnone ; then
3408                                         : nothing
3409                                 else
3410                                         echo "$file.sh does not exist -- ignored."
3411                                 fi
3412                         done
3413                 fi
3414         done
3415
3416         hint=recommended
3417         : Remember our hint file for later.
3418         if $test -f "$src/hints/$file.sh" ; then
3419                 hintfile="$file"
3420         else
3421                 hintfile=''
3422         fi
3423 fi
3424 cd UU
3425 ;;
3426 *)
3427         echo " "
3428         echo "Fetching default answers from $config_sh..." >&4
3429         tmp_n="$n"
3430         tmp_c="$c"
3431         cd ..
3432         cp $config_sh config.sh 2>/dev/null
3433         chmod +w config.sh
3434         . ./config.sh
3435         cd UU
3436         cp ../config.sh .
3437         n="$tmp_n"
3438         c="$tmp_c"
3439         hint=previous
3440         ;;
3441 esac
3442 test "$override" && . ./optdef.sh
3443
3444 : Restore computed paths
3445 for file in $loclist $trylist; do
3446         eval $file="\$_$file"
3447 done
3448
3449 cat << EOM
3450
3451 Configure uses the operating system name and version to set some defaults.
3452 The default value is probably right if the name rings a bell. Otherwise,
3453 since spelling matters for me, either accept the default or answer "none"
3454 to leave it blank.
3455
3456 EOM
3457 case "$osname" in
3458         ''|' ')
3459                 case "$hintfile" in
3460                 ''|' '|none) dflt=none ;;
3461                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3462                 esac
3463                 ;;
3464         *) dflt="$osname" ;;
3465 esac
3466 rp="Operating system name?"
3467 . ./myread
3468 case "$ans" in
3469 none)  osname='' ;;
3470 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3471 esac
3472 echo " "
3473 case "$osvers" in
3474         ''|' ')
3475                 case "$hintfile" in
3476                 ''|' '|none) dflt=none ;;
3477                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3478                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3479                         case "$dflt" in
3480                         ''|' ') dflt=none ;;
3481                         esac
3482                         ;;
3483                 esac
3484                 ;;
3485         *) dflt="$osvers" ;;
3486 esac
3487 rp="Operating system version?"
3488 . ./myread
3489 case "$ans" in
3490 none)  osvers='' ;;
3491 *) osvers="$ans" ;;
3492 esac
3493
3494
3495 . ./posthint.sh
3496
3497 : who configured the system
3498 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3499 case "$cf_by" in
3500 "")
3501         cf_by=`(logname) 2>/dev/null`
3502         case "$cf_by" in
3503         "")
3504                 cf_by=`(whoami) 2>/dev/null`
3505                 case "$cf_by" in
3506                 "") cf_by=unknown ;;
3507                 esac ;;
3508         esac ;;
3509 esac
3510
3511 : set up the script used to warn in case of inconsistency
3512 cat <<EOS >whoa
3513 $startsh
3514 EOS
3515 cat <<'EOSC' >>whoa
3516 dflt=y
3517 echo " "
3518 echo "*** WHOA THERE!!! ***" >&4
3519 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3520 rp="    Keep the $hint value?"
3521 . ./myread
3522 case "$ans" in
3523 y) td=$was; tu=$was;;
3524 esac
3525 EOSC
3526
3527 : function used to set $1 to $val
3528 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3529 case "$val$was" in
3530 $define$undef) . ./whoa; eval "$var=\$td";;
3531 $undef$define) . ./whoa; eval "$var=\$tu";;
3532 *) eval "$var=$val";;
3533 esac'
3534
3535 case "$usesocks" in
3536 $define|true|[yY]*)     dflt='y';;
3537 *) dflt='n';;
3538 esac
3539 cat <<EOM
3540
3541 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3542 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3543 to use the PerlIO abstraction layer, this will be implicitly selected.
3544
3545 If this doesn't make any sense to you, just accept the default '$dflt'.
3546 EOM
3547 rp='Build Perl for SOCKS?'
3548 . ./myread
3549 case "$ans" in
3550 y|Y)    val="$define" ;;     
3551 *)      val="$undef" ;;
3552 esac
3553 set usesocks
3554 eval $setvar
3555
3556 case "$usesocks" in
3557 $define|true|[yY]*) useperlio="$define";;
3558 esac
3559
3560 case "$useperlio" in
3561 $define|true|[yY]*|'')  dflt='y';;
3562 *) dflt='n';;
3563 esac
3564 cat <<EOM
3565
3566 Previous version of $package used the standard IO mechanisms as
3567 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3568 alternate IO mechanisms via the PerlIO abstraction layer, but the
3569 stdio mechanism is still available if needed.  The abstraction layer
3570 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3571 Using PerlIO with sfio may cause problems with some extension modules.
3572
3573 If this doesn't make any sense to you, just accept the default '$dflt'.
3574 EOM
3575 rp='Use the PerlIO abstraction layer?'
3576 . ./myread
3577 case "$ans" in
3578 y|Y) 
3579         val="$define"
3580         ;;
3581 *)      
3582         echo "Ok, doing things the stdio way."
3583         val="$undef"
3584         ;;
3585 esac
3586 set useperlio
3587 eval $setvar 
3588
3589 case "$usesocks" in
3590 $define|true|[yY]*)
3591         case "$useperlio" in
3592         $define|true|[yY]*) ;;
3593         *)      cat >&4 <<EOM
3594
3595 You are using the SOCKS proxy protocol library which means that you
3596 should also use the PerlIO layer.  You may be headed for trouble.
3597
3598 EOM
3599                 ;;
3600         esac
3601         ;;
3602 esac
3603
3604         
3605 case "$usethreads" in
3606 $define|true|[yY]*)     dflt='y';;
3607 *)     # Catch case where user specified ithreads or 5005threads but
3608        # forgot -Dusethreads (A.D. 4/2002)
3609        case "$useithreads$use5005threads" in
3610        *$define*)      
3611                 case "$useperlio" in
3612                 "$define")      dflt='y' ;;
3613                 *)              dflt='n' ;;
3614                 esac
3615                 ;;
3616        *)       dflt='n';;
3617        esac
3618        ;;
3619 esac
3620 cat <<EOM
3621
3622 Perl can be built to take advantage of threads on some systems.
3623 To do so, Configure can be run with -Dusethreads.
3624
3625 Note that Perl built with threading support runs slightly slower
3626 and uses more memory than plain Perl. The current implementation
3627 is believed to be stable, but it is fairly new, and so should be
3628 treated with caution.
3629
3630 If this doesn't make any sense to you, just accept the default '$dflt'.
3631 EOM
3632 rp='Build a threading Perl?'
3633 . ./myread
3634 case "$ans" in
3635 y|Y)    val="$define" ;;
3636 *)      val="$undef" ;;
3637 esac
3638 set usethreads
3639 eval $setvar
3640
3641 case "$usethreads" in
3642 $define)
3643         $cat <<EOM
3644
3645 Since release 5.6, Perl has had two different threading implementations,
3646 the newer interpreter-based version (ithreads) with one interpreter per
3647 thread, and the older 5.005 version (5005threads).
3648 The 5005threads version is effectively unmaintained and will probably be
3649 removed in Perl 5.10, so there should be no need to build a Perl using it
3650 unless needed for backwards compatibility with some existing 5.005threads
3651 code.
3652
3653 EOM
3654         : Default to ithreads unless overridden on command line or with
3655         : old config.sh
3656         dflt='y'
3657         case "$use5005threads" in
3658                 $define|true|[yY]*) dflt='n';;
3659         esac
3660         case "$useithreads" in
3661                 $undef|false|[nN]*) dflt='n';;
3662         esac
3663         rp='Use the newer interpreter-based ithreads?'
3664         . ./myread
3665         case "$ans" in
3666         y|Y)    val="$define" ;;
3667         *)      val="$undef" ;;
3668         esac
3669         set useithreads
3670         eval $setvar
3671         : Now set use5005threads to the opposite value.
3672         case "$useithreads" in
3673         $define) val="$undef" ;;
3674         *) val="$define" ;;
3675         esac
3676         set use5005threads
3677         eval $setvar
3678         ;;
3679 *)
3680         useithreads="$undef"
3681         use5005threads="$undef"
3682         ;;
3683 esac
3684
3685 case "$useithreads$use5005threads" in
3686 "$define$define")
3687         $cat >&4 <<EOM
3688
3689 You cannot have both the ithreads and the 5.005 threads enabled
3690 at the same time.  Disabling the 5.005 threads since they are
3691 much less stable than the ithreads.
3692
3693 EOM
3694         use5005threads="$undef"
3695         ;;
3696 esac
3697
3698 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3699         cat >&4 <<EOF
3700 ***
3701 *** To build with ithreads you must also use the PerlIO layer.
3702 *** Cannot continue, aborting.
3703 ***
3704 EOF
3705         exit 1
3706 fi
3707
3708 case "$d_oldpthreads" in
3709 '')     : Configure tests would be welcome here.  For now, assume undef.
3710         val="$undef" ;;
3711 *)      val="$d_oldpthreads" ;;
3712 esac
3713 set d_oldpthreads
3714 eval $setvar
3715
3716
3717 : Look for a hint-file generated 'call-back-unit'.  If the
3718 : user has specified that a threading perl is to be built,
3719 : we may need to set or change some other defaults.
3720 if $test -f usethreads.cbu; then
3721     echo "Your platform has some specific hints regarding threaded builds, using them..."
3722     . ./usethreads.cbu
3723 else
3724     case "$usethreads" in
3725         "$define"|true|[yY]*)
3726                 $cat <<EOM
3727 (Your platform does not have any specific hints for threaded builds.
3728  Assuming POSIX threads, then.)
3729 EOM
3730         ;;
3731     esac
3732 fi
3733
3734 cat <<EOM
3735
3736 Perl can be built so that multiple Perl interpreters can coexist
3737 within the same Perl executable.
3738 EOM
3739
3740 case "$useithreads" in
3741 $define)
3742         cat <<EOM
3743 This multiple interpreter support is required for interpreter-based threads.
3744 EOM
3745         val="$define"
3746         ;;
3747 *)      case "$usemultiplicity" in
3748         $define|true|[yY]*)     dflt='y';;
3749         *) dflt='n';;
3750         esac
3751         echo " "
3752         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3753         rp='Build Perl for multiplicity?'
3754         . ./myread
3755         case "$ans" in
3756         y|Y)    val="$define" ;;
3757         *)      val="$undef" ;;
3758         esac
3759         ;;
3760 esac
3761 set usemultiplicity
3762 eval $setvar
3763
3764
3765 case "$usemorebits" in
3766 "$define"|true|[yY]*)
3767         use64bitint="$define"
3768         uselongdouble="$define"
3769         usemorebits="$define"
3770         ;;
3771 *)      usemorebits="$undef"
3772         ;;
3773 esac
3774
3775 : make some quick guesses about what we are up against
3776 echo " "
3777 $echo $n "Hmm...  $c"
3778 echo exit 1 >bsd
3779 echo exit 1 >usg
3780 echo exit 1 >v7
3781 echo exit 1 >osf1
3782 echo exit 1 >eunice
3783 echo exit 1 >xenix
3784 echo exit 1 >venix
3785 echo exit 1 >os2
3786 d_bsd="$undef"
3787 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3788 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3789 then
3790         echo "Looks kind of like an OSF/1 system, but we'll see..."
3791         echo exit 0 >osf1
3792 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3793         xxx=`./loc addbib blurfl $pth`
3794         if $test -f $xxx; then
3795         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3796                 echo exit 0 >bsd
3797                 echo exit 0 >usg
3798         else
3799                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3800                         echo "Looks kind of like an extended USG system, but we'll see..."
3801                 else
3802                         echo "Looks kind of like a USG system, but we'll see..."
3803                 fi
3804                 echo exit 0 >usg
3805         fi
3806 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3807         echo "Looks kind of like a BSD system, but we'll see..."
3808         d_bsd="$define"
3809         echo exit 0 >bsd
3810 else
3811         echo "Looks kind of like a Version 7 system, but we'll see..."
3812         echo exit 0 >v7
3813 fi
3814 case "$eunicefix" in
3815 *unixtovms*)
3816         $cat <<'EOI'
3817 There is, however, a strange, musty smell in the air that reminds me of
3818 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3819 EOI
3820         echo exit 0 >eunice
3821         d_eunice="$define"
3822 : it so happens the Eunice I know will not run shell scripts in Unix format
3823         ;;
3824 *)
3825         echo " "
3826         echo "Congratulations.  You aren't running Eunice."
3827         d_eunice="$undef"
3828         ;;
3829 esac
3830 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3831 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3832 : semicolon as a patch separator
3833 case "$p_" in
3834 :) ;;
3835 *)
3836         $cat <<'EOI'
3837 I have the feeling something is not exactly right, however...don't tell me...
3838 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3839 (Or you may be running DOS with DJGPP.)
3840 EOI
3841         echo exit 0 >os2
3842         ;;
3843 esac
3844 if test -f /xenix; then
3845         echo "Actually, this looks more like a XENIX system..."
3846         echo exit 0 >xenix
3847         d_xenix="$define"
3848 else
3849         echo " "
3850         echo "It's not Xenix..."
3851         d_xenix="$undef"
3852 fi
3853 chmod +x xenix
3854 $eunicefix xenix
3855 if test -f /venix; then
3856         echo "Actually, this looks more like a VENIX system..."
3857         echo exit 0 >venix
3858 else
3859         echo " "
3860         if ./xenix; then
3861                 : null
3862         else
3863                 echo "Nor is it Venix..."
3864         fi
3865 fi
3866 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3867 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3868 $rm -f foo
3869
3870 case "$cc" in
3871 '') dflt=cc;;
3872 *) dflt="$cc";;
3873 esac
3874 rp="Use which C compiler?"
3875 . ./myread
3876 cc="$ans"
3877
3878 : See if they have not cc but they do have gcc
3879 . ./trygcc
3880 : Look for a hint-file generated 'call-back-unit'.  Now that the
3881 : user has specified the compiler, we may need to set or change some
3882 : other defaults.
3883 if $test -f cc.cbu; then
3884     . ./cc.cbu
3885 fi
3886 . ./checkcc
3887
3888 echo " "
3889 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3890 $cat >try.c <<EOM
3891 #include <stdio.h>
3892 int main() {
3893 #ifdef __GNUC__
3894 #ifdef __VERSION__
3895         printf("%s\n", __VERSION__);
3896 #else
3897         printf("%s\n", "1");
3898 #endif
3899 #endif
3900         return(0);
3901 }
3902 EOM
3903 if $cc -o try $ccflags $ldflags try.c; then
3904         gccversion=`$run ./try`
3905         case "$gccversion" in
3906         '') echo "You are not using GNU cc." ;;
3907         *)  echo "You are using GNU cc $gccversion."
3908             ccname=gcc
3909             ;;
3910         esac
3911 else
3912         echo " "
3913         echo "*** WHOA THERE!!! ***" >&4
3914         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3915         case "$knowitall" in
3916         '')
3917         echo "    You'd better start hunting for one and let me know about it." >&4
3918                 exit 1
3919                 ;;
3920         esac
3921 fi
3922 $rm -f try try.*
3923 case "$gccversion" in
3924 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3925 esac
3926 case "$gccversion" in
3927 '') gccosandvers='' ;;
3928 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3929    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3930    gccshortvers=''
3931    case "$gccosandvers" in
3932    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3933    $osname$osvers) ;; # looking good
3934    $osname*) cat <<EOM >&4
3935
3936 *** WHOA THERE!!! ***
3937
3938     Your gcc has not been compiled for the exact release of
3939     your operating system ($gccosandvers versus $osname$osvers).
3940
3941     In general it is a good idea to keep gcc synchronized with
3942     the operating system because otherwise serious problems
3943     may ensue when trying to compile software, like Perl.
3944
3945     I'm trying to be optimistic here, though, and will continue.
3946     If later during the configuration and build icky compilation
3947     problems appear (headerfile conflicts being the most common
3948     manifestation), I suggest reinstalling the gcc to match
3949     your operating system release.
3950
3951 EOM
3952       ;;
3953    *) gccosandvers='' ;; # failed to parse, better be silent
3954    esac
3955    ;;
3956 esac
3957 case "$ccname" in
3958 '') ccname="$cc" ;;
3959 esac
3960
3961 # gcc 3.* complain about adding -Idirectories that they already know about,
3962 # so we will take those off from locincpth.
3963 case "$gccversion" in
3964 3*)
3965     echo "main(){}">try.c
3966     for incdir in $locincpth; do
3967        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3968              grep '^c[cp]p*[01]: warning: changing search order '`
3969        if test "X$warn" != X; then
3970            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3971        fi
3972     done
3973     $rm -f try try.*
3974 esac
3975
3976 : decide how portable to be.  Allow command line overrides.
3977 case "$d_portable" in
3978 "$undef") ;;
3979 *)      d_portable="$define" ;;
3980 esac
3981
3982 : set up shell script to do ~ expansion
3983 cat >filexp <<EOSS
3984 $startsh
3985 : expand filename
3986 case "\$1" in
3987  ~/*|~)
3988         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3989         ;;
3990  ~*)
3991         if $test -f /bin/csh; then
3992                 /bin/csh -f -c "glob \$1"
3993                 failed=\$?
3994                 echo ""
3995                 exit \$failed
3996         else
3997                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3998                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3999                 if $test ! -d "\$dir"; then
4000                         me=\`basename \$0\`
4001                         echo "\$me: can't locate home directory for: \$name" >&2
4002                         exit 1
4003                 fi
4004                 case "\$1" in
4005                 */*)
4006                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4007                         ;;
4008                 *)
4009                         echo \$dir
4010                         ;;
4011                 esac
4012         fi
4013         ;;
4014 *)
4015         echo \$1
4016         ;;
4017 esac
4018 EOSS
4019 chmod +x filexp
4020 $eunicefix filexp
4021
4022 : now set up to get a file name
4023 cat <<EOS >getfile
4024 $startsh
4025 EOS
4026 cat <<'EOSC' >>getfile
4027 tilde=''
4028 fullpath=''
4029 already=''
4030 skip=''
4031 none_ok=''
4032 exp_file=''
4033 nopath_ok=''
4034 orig_rp="$rp"
4035 orig_dflt="$dflt"
4036 case "$gfpth" in
4037 '') gfpth='.' ;;
4038 esac
4039
4040 case "$fn" in
4041 *\(*)
4042         : getfile will accept an answer from the comma-separated list
4043         : enclosed in parentheses even if it does not meet other criteria.
4044         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4045         fn=`echo $fn | sed 's/(.*)//'`
4046         ;;
4047 esac
4048
4049 case "$fn" in
4050 *:*)
4051         loc_file=`expr $fn : '.*:\(.*\)'`
4052         fn=`expr $fn : '\(.*\):.*'`
4053         ;;
4054 esac
4055
4056 case "$fn" in
4057 *~*) tilde=true;;
4058 esac
4059 case "$fn" in
4060 */*) fullpath=true;;
4061 esac
4062 case "$fn" in
4063 *+*) skip=true;;
4064 esac
4065 case "$fn" in
4066 *n*) none_ok=true;;
4067 esac
4068 case "$fn" in
4069 *e*) exp_file=true;;
4070 esac
4071 case "$fn" in
4072 *p*) nopath_ok=true;;
4073 esac
4074
4075 case "$fn" in
4076 *f*) type='File';;
4077 *d*) type='Directory';;
4078 *l*) type='Locate';;
4079 esac
4080
4081 what="$type"
4082 case "$what" in
4083 Locate) what='File';;
4084 esac
4085
4086 case "$exp_file" in
4087 '')
4088         case "$d_portable" in
4089         "$define") ;;
4090         *) exp_file=true;;
4091         esac
4092         ;;
4093 esac
4094
4095 cd ..
4096 while test "$type"; do
4097         redo=''
4098         rp="$orig_rp"
4099         dflt="$orig_dflt"
4100         case "$tilde" in
4101         true) rp="$rp (~name ok)";;
4102         esac
4103         . UU/myread
4104         if test -f UU/getfile.ok && \
4105                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4106         then
4107                 value="$ans"
4108                 ansexp="$ans"
4109                 break
4110         fi
4111         case "$ans" in
4112         none)
4113                 value=''
4114                 ansexp=''
4115                 case "$none_ok" in
4116                 true) type='';;
4117                 esac
4118                 ;;
4119         *)
4120                 case "$tilde" in
4121                 '') value="$ans"
4122                         ansexp="$ans";;
4123                 *)
4124                         value=`UU/filexp $ans`
4125                         case $? in
4126                         0)
4127                                 if test "$ans" != "$value"; then
4128                                         echo "(That expands to $value on this system.)"
4129                                 fi
4130                                 ;;
4131                         *) value="$ans";;
4132                         esac
4133                         ansexp="$value"
4134                         case "$exp_file" in
4135                         '') value="$ans";;
4136                         esac
4137                         ;;
4138                 esac
4139                 case "$fullpath" in
4140                 true)
4141                         case "$ansexp" in
4142                         /*) value="$ansexp" ;;
4143                         [a-zA-Z]:/*) value="$ansexp" ;;
4144                         *)
4145                                 redo=true
4146                                 case "$already" in
4147                                 true)
4148                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4149                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4150                                         ;;
4151                                 *)
4152                                 echo "Please give a full path name, starting with slash." >&4
4153                                         case "$tilde" in
4154                                         true)
4155                                 echo "Note that using ~name is ok provided it expands well." >&4
4156                                                 already=true
4157                                                 ;;
4158                                         esac
4159                                 esac
4160                                 ;;
4161                         esac
4162                         ;;
4163                 esac
4164                 case "$redo" in
4165                 '')
4166                         case "$type" in
4167                         File)
4168                                 for fp in $gfpth; do
4169                                         if test "X$fp" = X.; then
4170                                             pf="$ansexp"
4171                                         else    
4172                                             pf="$fp/$ansexp"
4173                                         fi
4174                                         if test -f "$pf"; then
4175                                                 type=''
4176                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4177                                         then
4178                                                 echo "($value is not a plain file, but that's ok.)"
4179                                                 type=''
4180                                         fi
4181                                         if test X"$type" = X; then
4182                                             value="$pf"
4183                                             break
4184                                         fi
4185                                 done
4186                                 ;;
4187                         Directory)
4188                                 for fp in $gfpth; do
4189                                         if test "X$fp" = X.; then
4190                                             dir="$ans"
4191                                             direxp="$ansexp"
4192                                         else    
4193                                             dir="$fp/$ansexp"
4194                                             direxp="$fp/$ansexp"
4195                                         fi
4196                                         if test -d "$direxp"; then
4197                                                 type=''
4198                                                 value="$dir"
4199                                                 break
4200                                         fi
4201                                 done
4202                                 ;;
4203                         Locate)
4204                                 if test -d "$ansexp"; then
4205                                         echo "(Looking for $loc_file in directory $value.)"
4206                                         value="$value/$loc_file"
4207                                         ansexp="$ansexp/$loc_file"
4208                                 fi
4209                                 if test -f "$ansexp"; then
4210                                         type=''
4211                                 fi
4212                                 case "$nopath_ok" in
4213                                 true)   case "$value" in
4214                                         */*) ;;
4215                                         *)      echo "Assuming $value will be in people's path."
4216                                                 type=''
4217                                                 ;;
4218                                         esac
4219                                         ;;
4220                                 esac
4221                                 ;;
4222                         esac
4223
4224                         case "$skip" in
4225                         true) type='';
4226                         esac
4227
4228                         case "$type" in
4229                         '') ;;
4230                         *)
4231                                 if test "$fastread" = yes; then
4232                                         dflt=y
4233                                 else
4234                                         dflt=n
4235                                 fi
4236                                 rp="$what $value doesn't exist.  Use that name anyway?"
4237                                 . UU/myread
4238                                 dflt=''
4239                                 case "$ans" in
4240                                 y*) type='';;
4241                                 *) echo " ";;
4242                                 esac
4243                                 ;;
4244                         esac
4245                         ;;
4246                 esac
4247                 ;;
4248         esac
4249 done
4250 cd UU
4251 ans="$value"
4252 rp="$orig_rp"
4253 dflt="$orig_dflt"
4254 rm -f getfile.ok
4255 test "X$gfpthkeep" != Xy && gfpth=""
4256 EOSC
4257
4258 : What should the include directory be ?
4259 echo " "
4260 $echo $n "Hmm...  $c"
4261 dflt='/usr/include'
4262 incpath=''
4263 mips_type=''
4264 if $test -f /bin/mips && /bin/mips; then
4265         echo "Looks like a MIPS system..."
4266         $cat >usr.c <<'EOCP'
4267 #ifdef SYSTYPE_BSD43
4268 /bsd43
4269 #endif
4270 EOCP
4271         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4272                 dflt='/bsd43/usr/include'
4273                 incpath='/bsd43'
4274                 mips_type='BSD 4.3'
4275         else
4276                 mips_type='System V'
4277         fi
4278         $rm -f usr.c usr.out
4279         echo "and you're compiling with the $mips_type compiler and libraries."
4280         xxx_prompt=y
4281         echo "exit 0" >mips
4282 else
4283         echo "Doesn't look like a MIPS system."
4284         xxx_prompt=n
4285         echo "exit 1" >mips
4286 fi
4287 chmod +x mips
4288 $eunicefix mips
4289 case "$usrinc" in
4290 '') ;;
4291 *) dflt="$usrinc";;
4292 esac
4293 case "$xxx_prompt" in
4294 y)      fn=d/
4295         echo " "
4296         rp='Where are the include files you want to use?'
4297         . ./getfile
4298         usrinc="$ans"
4299         ;;
4300 *)      usrinc="$dflt"
4301         ;;
4302 esac
4303
4304 : see how we invoke the C preprocessor
4305 echo " "
4306 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4307 cat <<'EOT' >testcpp.c
4308 #define ABC abc
4309 #define XYZ xyz
4310 ABC.XYZ
4311 EOT
4312 cd ..
4313 if test ! -f cppstdin; then
4314         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4315                 # AIX cc -E doesn't show the absolute headerfile
4316                 # locations but we'll cheat by using the -M flag.
4317                 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
4318         else
4319                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4320         fi
4321 else
4322         echo "Keeping your $hint cppstdin wrapper."
4323 fi
4324 chmod 755 cppstdin
4325 wrapper=`pwd`/cppstdin
4326 ok='false'
4327 cd UU
4328
4329 if $test "X$cppstdin" != "X" && \
4330         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4331         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4332 then
4333         echo "You used to use $cppstdin $cppminus so we'll use that again."
4334         case "$cpprun" in
4335         '') echo "But let's see if we can live without a wrapper..." ;;
4336         *)
4337                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4338                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4339                 then
4340                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4341                         ok='true'
4342                 else
4343                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4344                 fi
4345                 ;;
4346         esac
4347 else
4348         case "$cppstdin" in
4349         '') ;;
4350         *)
4351                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4352                 ;;
4353         esac
4354 fi
4355
4356 if $ok; then
4357         : nothing
4358 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4359         $cc -E <testcpp.c >testcpp.out 2>&1; \
4360         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4361         echo "Yup, it does."
4362         x_cpp="$cc -E"
4363         x_minus='';
4364 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4365         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4366         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4367         echo "Yup, it does."
4368         x_cpp="$cc -E"
4369         x_minus='-';
4370 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4371         $cc -P <testcpp.c >testcpp.out 2>&1; \
4372         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4373         echo "Yipee, that works!"
4374         x_cpp="$cc -P"
4375         x_minus='';
4376 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4377         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4378         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4379         echo "At long last!"
4380         x_cpp="$cc -P"
4381         x_minus='-';
4382 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4383         $cpp <testcpp.c >testcpp.out 2>&1; \
4384         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4385         echo "It works!"
4386         x_cpp="$cpp"
4387         x_minus='';
4388 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4389         $cpp - <testcpp.c >testcpp.out 2>&1; \
4390         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4391         echo "Hooray, it works!  I was beginning to wonder."
4392         x_cpp="$cpp"
4393         x_minus='-';
4394 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4395         $wrapper <testcpp.c >testcpp.out 2>&1; \
4396         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4397         x_cpp="$wrapper"
4398         x_minus=''
4399         echo "Eureka!"
4400 else
4401         dflt=''
4402         rp="No dice.  I can't find a C preprocessor.  Name one:"
4403         . ./myread
4404         x_cpp="$ans"
4405         x_minus=''
4406         $x_cpp <testcpp.c >testcpp.out 2>&1
4407         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4408                 echo "OK, that will do." >&4
4409         else
4410 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4411                 exit 1
4412         fi
4413 fi
4414
4415 case "$ok" in
4416 false)
4417         cppstdin="$x_cpp"
4418         cppminus="$x_minus"
4419         cpprun="$x_cpp"
4420         cpplast="$x_minus"
4421         set X $x_cpp
4422         shift
4423         case "$1" in
4424         "$cpp")
4425                 echo "Perhaps can we force $cc -E using a wrapper..."
4426                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4427                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4428                 then
4429                         echo "Yup, we can."
4430                         cppstdin="$wrapper"
4431                         cppminus='';
4432                 else
4433                         echo "Nope, we'll have to live without it..."
4434                 fi
4435                 ;;
4436         esac
4437         case "$cpprun" in
4438         "$wrapper")
4439                 cpprun=''
4440                 cpplast=''
4441                 ;;
4442         esac
4443         ;;
4444 esac
4445
4446 case "$cppstdin" in
4447 "$wrapper"|'cppstdin') ;;
4448 *) $rm -f $wrapper;;
4449 esac
4450 $rm -f testcpp.c testcpp.out
4451
4452 : Set private lib path
4453 case "$plibpth" in
4454 '') if ./mips; then
4455                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4456         fi;;
4457 esac
4458 case "$libpth" in
4459 ' ') dlist='';;
4460 '') dlist="$loclibpth $plibpth $glibpth";;
4461 *) dlist="$libpth";;
4462 esac
4463
4464 : Now check and see which directories actually exist, avoiding duplicates
4465 libpth=''
4466 for xxx in $dlist
4467 do
4468     if $test -d $xxx; then
4469                 case " $libpth " in
4470                 *" $xxx "*) ;;
4471                 *) libpth="$libpth $xxx";;
4472                 esac
4473     fi
4474 done
4475 $cat <<'EOM'
4476
4477 Some systems have incompatible or broken versions of libraries.  Among
4478 the directories listed in the question below, please remove any you
4479 know not to be holding relevant libraries, and add any that are needed.
4480 Say "none" for none.
4481
4482 EOM
4483 case "$libpth" in
4484 '') dflt='none';;
4485 *)
4486         set X $libpth
4487         shift
4488         dflt=${1+"$@"}
4489         ;;
4490 esac
4491 rp="Directories to use for library searches?"
4492 . ./myread
4493 case "$ans" in
4494 none) libpth=' ';;
4495 *) libpth="$ans";;
4496 esac
4497
4498 : compute shared library extension
4499 case "$so" in
4500 '')
4501         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4502                 dflt='sl'
4503         else
4504                 dflt='so'
4505         fi
4506         ;;
4507 *) dflt="$so";;
4508 esac
4509 $cat <<EOM
4510
4511 On some systems, shared libraries may be available.  Answer 'none' if
4512 you want to suppress searching of shared libraries for the remainder
4513 of this configuration.
4514
4515 EOM
4516 rp='What is the file extension used for shared libraries?'
4517 . ./myread
4518 so="$ans"
4519
4520 : Define several unixisms.
4521 : Hints files or command line option can be used to override them.
4522 : The convoluted testing is in case hints files set either the old
4523 : or the new name.
4524 case "$_exe" in
4525 '')     case "$exe_ext" in
4526         '')     ;;
4527         *)      _exe="$exe_ext" ;;
4528         esac
4529         ;;
4530 esac
4531 case "$_a" in
4532 '')     case "$lib_ext" in
4533     '') _a='.a';;
4534         *)      _a="$lib_ext" ;;
4535         esac
4536         ;;
4537 esac
4538 case "$_o" in
4539 '') case "$obj_ext" in
4540         '')     _o='.o';;
4541         *)      _o="$obj_ext";;
4542         esac
4543         ;;
4544 esac
4545 case "$p_" in
4546 '') case "$path_sep" in
4547         '')     p_=':';;
4548         *)      p_="$path_sep";;
4549         esac
4550         ;;
4551 esac
4552 exe_ext=$_exe
4553 lib_ext=$_a
4554 obj_ext=$_o
4555 path_sep=$p_
4556
4557 : Which makefile gets called first.  This is used by make depend.
4558 case "$firstmakefile" in
4559 '') firstmakefile='makefile';;
4560 esac
4561
4562 case "$ccflags" in
4563 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4564 esac
4565
4566 case "$uselongdouble" in
4567 $define|true|[yY]*)     dflt='y';;
4568 *) dflt='n';;
4569 esac
4570 cat <<EOM
4571
4572 Perl can be built to take advantage of long doubles which
4573 (if available) may give more accuracy and range for floating point numbers.
4574
4575 If this doesn't make any sense to you, just accept the default '$dflt'.
4576 EOM
4577 rp='Try to use long doubles if available?'
4578 . ./myread
4579 case "$ans" in
4580 y|Y)    val="$define"   ;;
4581 *)      val="$undef"    ;;
4582 esac
4583 set uselongdouble
4584 eval $setvar
4585
4586 case "$uselongdouble" in
4587 true|[yY]*) uselongdouble="$define" ;;
4588 esac
4589
4590 : Look for a hint-file generated 'call-back-unit'.  If the
4591 : user has specified that long doubles should be used,
4592 : we may need to set or change some other defaults.
4593 if $test -f uselongdouble.cbu; then
4594     echo "Your platform has some specific hints regarding long doubles, using them..."
4595     . ./uselongdouble.cbu
4596 else
4597     case "$uselongdouble" in
4598         $define)
4599                 $cat <<EOM
4600 (Your platform does not have any specific hints for long doubles.)
4601 EOM
4602         ;;
4603     esac
4604 fi
4605
4606 : Looking for optional libraries
4607 echo " "
4608 echo "Checking for optional libraries..." >&4
4609 case "$libs" in
4610 ' '|'') dflt='';;
4611 *) dflt="$libs";;
4612 esac
4613 case "$libswanted" in
4614 '') libswanted='c_s';;
4615 esac
4616 case "$usesocks" in
4617 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4618 esac
4619 libsfound=''
4620 libsfiles=''
4621 libsdirs=''
4622 libspath=''
4623 for thisdir in $libpth $xlibpth; do
4624   test -d $thisdir && libspath="$libspath $thisdir"
4625 done
4626 for thislib in $libswanted; do
4627         for thisdir in $libspath; do
4628             xxx=''
4629             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4630                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4631                 $test -f "$xxx" && eval $libscheck
4632                 $test -f "$xxx" && libstyle=shared
4633             fi
4634             if test ! -f "$xxx"; then
4635                 xxx=$thisdir/lib$thislib.$so
4636                 $test -f "$xxx" && eval $libscheck
4637                 $test -f "$xxx" && libstyle=shared
4638             fi  
4639             if test ! -f "$xxx"; then
4640                 xxx=$thisdir/lib$thislib$_a
4641                 $test -f "$xxx" && eval $libscheck
4642                 $test -f "$xxx" && libstyle=static
4643             fi
4644             if test ! -f "$xxx"; then
4645                 xxx=$thisdir/$thislib$_a
4646                 $test -f "$xxx" && eval $libscheck
4647                 $test -f "$xxx" && libstyle=static
4648             fi
4649             if test ! -f "$xxx"; then
4650                 xxx=$thisdir/lib${thislib}_s$_a
4651                 $test -f "$xxx" && eval $libscheck
4652                 $test -f "$xxx" && libstyle=static
4653                 $test -f "$xxx" && thislib=${thislib}_s
4654             fi
4655             if test ! -f "$xxx"; then
4656                 xxx=$thisdir/Slib$thislib$_a
4657                 $test -f "$xxx" && eval $libscheck
4658                 $test -f "$xxx" && libstyle=static
4659             fi
4660             if $test -f "$xxx"; then
4661                 case "$libstyle" in
4662                 shared) echo "Found -l$thislib (shared)." ;;
4663                 static) echo "Found -l$thislib." ;;
4664                 *)      echo "Found -l$thislib ($libstyle)." ;;
4665                 esac
4666                 case " $dflt " in
4667                 *"-l$thislib "*);;
4668                 *) dflt="$dflt -l$thislib"
4669                    libsfound="$libsfound $xxx"
4670                    yyy=`basename $xxx`
4671                    libsfiles="$libsfiles $yyy"
4672                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4673                    case " $libsdirs " in
4674                    *" $yyy "*) ;;
4675                    *) libsdirs="$libsdirs $yyy" ;;
4676                    esac
4677                    ;;
4678                 esac
4679                 break
4680             fi  
4681         done
4682         if $test ! -f "$xxx"; then
4683             echo "No -l$thislib."
4684         fi
4685 done
4686 set X $dflt
4687 shift
4688 dflt="$*"
4689 case "$libs" in
4690 '') dflt="$dflt";;
4691 *) dflt="$libs";;
4692 esac
4693 case "$dflt" in
4694 ' '|'') dflt='none';;
4695 esac
4696
4697 $cat <<EOM
4698
4699 In order to compile $package on your machine, a number of libraries
4700 are usually needed.  Include any other special libraries here as well.
4701 Say "none" for none.  The default list is almost always right.
4702 EOM
4703
4704 echo " "
4705 rp="What libraries to use?"
4706 . ./myread
4707 case "$ans" in
4708 none) libs=' ';;
4709 *) libs="$ans";;
4710 esac
4711
4712 : determine optimization, if desired, or use for debug flag also
4713 case "$optimize" in
4714 ' '|$undef) dflt='none';;
4715 '') dflt='-O';;
4716 *) dflt="$optimize";;
4717 esac
4718 $cat <<EOH
4719
4720 By default, $package compiles with the -O flag to use the optimizer.
4721 Alternately, you might want to use the symbolic debugger, which uses
4722 the -g flag (on traditional Unix systems).  Either flag can be
4723 specified here.  To use neither flag, specify the word "none".
4724
4725 EOH
4726 rp="What optimizer/debugger flag should be used?"
4727 . ./myread
4728 optimize="$ans"
4729 case "$optimize" in
4730 'none') optimize=" ";;
4731 esac
4732
4733 dflt=''
4734 : We will not override a previous value, but we might want to
4735 : augment a hint file
4736 case "$hint" in
4737 default|recommended)
4738         case "$gccversion" in
4739         1*) dflt='-fpcc-struct-return' ;;
4740         esac
4741         case "$optimize" in
4742         *-g*) dflt="$dflt -DDEBUGGING";;
4743         esac
4744         case "$gccversion" in
4745         2*) if test -d /etc/conf/kconfig.d &&
4746                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4747                 then
4748                         # Interactive Systems (ISC) POSIX mode.
4749                         dflt="$dflt -posix"
4750                 fi
4751                 ;;
4752         esac
4753         case "$gccversion" in
4754         1*) ;;
4755         2.[0-8]*) ;;
4756         ?*)     echo " "
4757                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4758                 echo 'int main(void) { return 0; }' > gcctest.c
4759                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4760                         echo "Yes, it does." 2>&1
4761                         case "$ccflags" in
4762                         *strict-aliasing*)
4763                                 echo "Leaving current flags $ccflags alone." 2>&1
4764                                 ;;
4765                         *) dflt="$dflt -fno-strict-aliasing" ;;
4766                         esac
4767                 else
4768                         echo "Nope, it doesn't, but that's ok." 2>&1
4769                 fi
4770                 ;;
4771         esac
4772         # For gcc, adding -pipe speeds up compilations for some, but apparently
4773         # some assemblers can't read from stdin.  (It also slows down compilations
4774         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4775         case "$gccversion" in
4776         ?*)     echo " "
4777                 echo "Checking if your compiler accepts -pipe" 2>&1
4778                 echo 'int main(void) { return 0; }' > gcctest.c
4779                 if $cc -pipe -o gcctest gcctest.c; then
4780                         echo "Yes, it does." 2>&1
4781                         case "$ccflags" in
4782                         *-pipe*)
4783                                 echo "Leaving current flags $ccflags alone." 2>&1
4784                                 ;;
4785                         *) dflt="$dflt -pipe" ;;
4786                         esac
4787                 else
4788                         echo "Nope, it doesn't, but that's ok." 2>&1
4789                 fi
4790
4791                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4792                 echo 'int main(void) { return 0; }' > gcctest.c
4793                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4794                         echo "Yes, it does." 2>&1
4795                         case "$ccflags" in
4796                         *-Wdeclaration-after-statement*)
4797                                 echo "Leaving current flags $ccflags alone." 2>&1
4798                                 ;;
4799                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4800                         esac
4801                 else
4802                         echo "Nope, it doesn't, but that's ok." 2>&1
4803                 fi
4804                 ;;
4805         esac
4806         ;;
4807 esac
4808
4809 case "$mips_type" in
4810 *BSD*|'') inclwanted="$locincpth $usrinc";;
4811 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4812 esac
4813 for thisincl in $inclwanted; do
4814         if $test -d $thisincl; then
4815                 if $test x$thisincl != x$usrinc; then
4816                         case "$dflt" in
4817                         *" -I$thisincl "*);;
4818                         *) dflt="$dflt -I$thisincl ";;
4819                         esac
4820                 fi
4821         fi
4822 done
4823
4824 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4825         xxx=true;
4826 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4827         xxx=true;
4828 else
4829         xxx=false;
4830 fi;
4831 if $xxx; then
4832         case "$dflt" in
4833         *$2*);;
4834         *) dflt="$dflt -D$2";;
4835         esac;
4836 fi'
4837
4838 set signal.h LANGUAGE_C; eval $inctest
4839
4840 case "$usesocks" in
4841 $define)
4842         ccflags="$ccflags -DSOCKS"
4843         ;;
4844 esac
4845
4846 case "$hint" in
4847 default|recommended) dflt="$ccflags $dflt" ;;
4848 *) dflt="$ccflags";;
4849 esac
4850
4851 case "$dflt" in
4852 ''|' ') dflt=none;;
4853 esac
4854
4855 $cat <<EOH
4856
4857 Your C compiler may want other flags.  For this question you should include
4858 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4859 but you should NOT include libraries or ld flags like -lwhatever.  If you
4860 want $package to honor its debug switch, you should include -DDEBUGGING here.
4861 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4862
4863 To use no flags, specify the word "none".
4864
4865 EOH
4866 set X $dflt
4867 shift
4868 dflt=${1+"$@"}
4869 rp="Any additional cc flags?"
4870 . ./myread
4871 case "$ans" in
4872 none) ccflags='';;
4873 *) ccflags="$ans";;
4874 esac
4875
4876 : the following weeds options from ccflags that are of no interest to cpp
4877 case "$cppflags" in
4878 '') cppflags="$ccflags" ;;
4879 *)  cppflags="$cppflags $ccflags" ;;
4880 esac
4881 case "$gccversion" in
4882 1*) cppflags="$cppflags -D__GNUC__"
4883 esac
4884 case "$mips_type" in
4885 '');;
4886 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4887 esac
4888 case "$cppflags" in
4889 '');;
4890 *)
4891         echo " "
4892         echo "Let me guess what the preprocessor flags are..." >&4
4893         set X $cppflags
4894         shift
4895         cppflags=''
4896         $cat >cpp.c <<'EOM'
4897 #define BLURFL foo
4898
4899 BLURFL xx LFRULB
4900 EOM
4901         previous=''
4902         for flag in $*
4903         do
4904                 case "$flag" in
4905                 -*) ftry="$flag";;
4906                 *) ftry="$previous $flag";;
4907                 esac
4908                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4909                         >cpp1.out 2>/dev/null && \
4910                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4911                         >cpp2.out 2>/dev/null && \
4912                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4913                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4914                 then
4915                         cppflags="$cppflags $ftry"
4916                         previous=''
4917                 else
4918                         previous="$flag"
4919                 fi
4920         done
4921         set X $cppflags
4922         shift
4923         cppflags=${1+"$@"}
4924         case "$cppflags" in
4925         *-*)  echo "They appear to be: $cppflags";;
4926         esac
4927         $rm -f cpp.c cpp?.out
4928         ;;
4929 esac
4930
4931 : flags used in final linking phase
4932 case "$ldflags" in
4933 '') if ./venix; then
4934                 dflt='-i -z'
4935         else
4936                 dflt=''
4937         fi
4938         case "$ccflags" in
4939         *-posix*) dflt="$dflt -posix" ;;
4940         esac
4941         ;;
4942 *) dflt="$ldflags";;
4943 esac
4944
4945 : Try to guess additional flags to pick up local libraries.
4946 for thislibdir in $libpth; do
4947         case " $loclibpth " in
4948         *" $thislibdir "*)
4949                 case "$dflt " in
4950                 *"-L$thislibdir "*) ;;
4951                 *)  dflt="$dflt -L$thislibdir" ;;
4952                 esac
4953                 ;;
4954         esac
4955 done
4956
4957 case "$dflt" in
4958 '') dflt='none' ;;
4959 esac
4960
4961 $cat <<EOH
4962
4963 Your C linker may need flags.  For this question you should
4964 include -L/whatever and any other flags used by the C linker, but you
4965 should NOT include libraries like -lwhatever.
4966
4967 Make sure you include the appropriate -L/path flags if your C linker
4968 does not normally search all of the directories you specified above,
4969 namely
4970         $libpth
4971 To use no flags, specify the word "none".
4972
4973 EOH
4974
4975 rp="Any additional ld flags (NOT including libraries)?"
4976 . ./myread
4977 case "$ans" in
4978 none) ldflags='';;
4979 *) ldflags="$ans";;
4980 esac
4981 rmlist="$rmlist pdp11"
4982
4983 : coherency check
4984 echo " "
4985 echo "Checking your choice of C compiler and flags for coherency..." >&4
4986 $cat > try.c <<'EOF'
4987 #include <stdio.h>
4988 int main() { printf("Ok\n"); return(0); }
4989 EOF
4990 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4991 shift
4992 $cat >try.msg <<'EOM'
4993 I've tried to compile and run the following simple program:
4994
4995 EOM
4996 $cat try.c >> try.msg
4997
4998 $cat >> try.msg <<EOM
4999
5000 I used the command:
5001
5002         $*
5003         $run ./try
5004
5005 and I got the following output:
5006
5007 EOM
5008 dflt=y
5009 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5010         if $sh -c "$run ./try" >>try.msg 2>&1; then
5011                 xxx=`$run ./try`
5012                 case "$xxx" in
5013                 "Ok") dflt=n ;;
5014                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5015                         case " $libs " in
5016                         *" -lsfio "*)
5017                                 cat >> try.msg <<'EOQS'
5018 If $libs contains -lsfio, and sfio is mis-configured, then it
5019 sometimes (apparently) runs and exits with a 0 status, but with no
5020 output!  It may have to do with sfio's use of _exit vs. exit.
5021
5022 EOQS
5023                                 rp="You have a big problem.  Shall I abort Configure"
5024                                 dflt=y
5025                                 ;;
5026                         esac
5027                         ;;
5028                 esac
5029         else
5030                 echo "The program compiled OK, but exited with status $?." >>try.msg
5031                 rp="You have a problem.  Shall I abort Configure"
5032                 dflt=y
5033         fi
5034 else
5035         echo "I can't compile the test program." >>try.msg
5036         rp="You have a BIG problem.  Shall I abort Configure"
5037         dflt=y
5038 fi
5039 case "$dflt" in
5040 y)
5041         $cat try.msg >&4
5042         case "$knowitall" in
5043         '')
5044                 echo "(The supplied flags or libraries might be incorrect.)"
5045                 ;;
5046         *) dflt=n;;
5047         esac
5048         echo " "
5049         . ./myread
5050         case "$ans" in
5051         n*|N*) ;;
5052         *)      echo "Ok.  Stopping Configure." >&4
5053                 exit 1
5054                 ;;
5055         esac
5056         ;;
5057 n) echo "OK, that should do.";;
5058 esac
5059 $rm -f try try.* core
5060
5061 : define a shorthand compile call
5062 compile='
5063 mc_file=$1;
5064 shift;
5065 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5066 : define a shorthand compile call for compilations that should be ok.
5067 compile_ok='
5068 mc_file=$1;
5069 shift;
5070 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5071
5072 : determine filename position in cpp output
5073 echo " "
5074 echo "Computing filename position in cpp output for #include directives..." >&4
5075 case "$osname" in
5076 vos) testaccess=-e ;;
5077 *)   testaccess=-r ;;
5078 esac
5079 echo '#include <stdio.h>' > foo.c
5080 $cat >fieldn <<EOF
5081 $startsh
5082 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5083 $grep '^[       ]*#.*stdio\.h' | \
5084 while read cline; do
5085         pos=1
5086         set \$cline
5087         while $test \$# -gt 0; do
5088                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5089                         echo "\$pos"
5090                         exit 0
5091                 fi
5092                 shift
5093                 pos=\`expr \$pos + 1\`
5094         done
5095 done
5096 EOF
5097 chmod +x fieldn
5098 fieldn=`./fieldn`
5099 $rm -f foo.c fieldn
5100 case $fieldn in
5101 '') pos='???';;
5102 1) pos=first;;
5103 2) pos=second;;
5104 3) pos=third;;
5105 *) pos="${fieldn}th";;
5106 esac
5107 echo "Your cpp writes the filename in the $pos field of the line."
5108
5109 case "$osname" in
5110 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5111 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5112 *)   cppfilter='' ;;
5113 esac
5114 : locate header file
5115 $cat >findhdr <<EOF
5116 $startsh
5117 wanted=\$1
5118 name=''
5119 for usrincdir in $usrinc
5120 do
5121         if test -f \$usrincdir/\$wanted; then
5122                 echo "\$usrincdir/\$wanted"
5123                 exit 0
5124         fi
5125 done
5126 awkprg='{ print \$$fieldn }'
5127 echo "#include <\$wanted>" > foo\$\$.c
5128 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5129 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5130 while read cline; do
5131         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5132         case "\$name" in
5133         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5134         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5135         *) exit 2;;
5136         esac;
5137 done;
5138 #
5139 # status = 0: grep returned 0 lines, case statement not executed
5140 # status = 1: headerfile found
5141 # status = 2: while loop executed, no headerfile found
5142 #
5143 status=\$?
5144 $rm -f foo\$\$.c;
5145 if test \$status -eq 1; then
5146         exit 0;
5147 fi
5148 exit 1
5149 EOF
5150 chmod +x findhdr
5151
5152 : define an alternate in-header-list? function
5153 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5154 cont=true; xxf="echo \"<\$1> found.\" >&4";
5155 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5156 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5157 esac;
5158 case $# in 4) instead=instead;; *) instead="at last";; esac;
5159 while $test "$cont"; do
5160         xxx=`./findhdr $1`
5161         var=$2; eval "was=\$$2";
5162         if $test "$xxx" && $test -r "$xxx";
5163         then eval $xxf;
5164         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5165                 cont="";
5166         else eval $xxnf;
5167         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5168         set $yyy; shift; shift; yyy=$@;
5169         case $# in 0) cont="";;
5170         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5171                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5172         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5173                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5174         esac;
5175 done;
5176 while $test "$yyy";
5177 do set $yyy; var=$2; eval "was=\$$2";
5178         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5179         set $yyy; shift; shift; yyy=$@;
5180 done'
5181
5182 : see if stdlib is available
5183 set stdlib.h i_stdlib
5184 eval $inhdr
5185
5186 : check for lengths of integral types
5187 echo " "
5188 case "$intsize" in
5189 '')
5190         echo "Checking to see how big your integers are..." >&4
5191         $cat >try.c <<EOCP
5192 #include <stdio.h>
5193 #$i_stdlib I_STDLIB
5194 #ifdef I_STDLIB
5195 #include <stdlib.h>
5196 #endif
5197 int main()
5198 {
5199         printf("intsize=%d;\n", (int)sizeof(int));
5200         printf("longsize=%d;\n", (int)sizeof(long));
5201         printf("shortsize=%d;\n", (int)sizeof(short));
5202         exit(0);
5203 }
5204 EOCP
5205         set try
5206         if eval $compile_ok && $run ./try > /dev/null; then
5207                 eval `$run ./try`
5208                 echo "Your integers are $intsize bytes long."
5209                 echo "Your long integers are $longsize bytes long."
5210                 echo "Your short integers are $shortsize bytes long."
5211         else
5212                 $cat >&4 <<EOM
5213 !
5214 Help! I can't compile and run the intsize test program: please enlighten me!
5215 (This is probably a misconfiguration in your system or libraries, and
5216 you really ought to fix it.  Still, I'll try anyway.)
5217 !
5218 EOM
5219                 dflt=4
5220                 rp="What is the size of an integer (in bytes)?"
5221                 . ./myread
5222                 intsize="$ans"
5223                 dflt=$intsize
5224                 rp="What is the size of a long integer (in bytes)?"
5225                 . ./myread
5226                 longsize="$ans"
5227                 dflt=2
5228                 rp="What is the size of a short integer (in bytes)?"
5229                 . ./myread
5230                 shortsize="$ans"
5231         fi
5232         ;;
5233 esac
5234 $rm -f try try.*
5235
5236 : check for long long
5237 echo " "
5238 echo "Checking to see if you have long long..." >&4
5239 echo 'int main() { long long x = 7; return 0; }' > try.c
5240 set try
5241 if eval $compile; then
5242         val="$define"
5243         echo "You have long long."
5244 else
5245         val="$undef"
5246         echo "You do not have long long."
5247 fi
5248 $rm try.*
5249 set d_longlong
5250 eval $setvar
5251
5252 : check for length of long long
5253 case "${d_longlong}${longlongsize}" in
5254 $define)
5255         echo " "
5256         echo "Checking to see how big your long longs are..." >&4
5257         $cat >try.c <<'EOCP'
5258 #include <stdio.h>
5259 int main()
5260 {
5261     printf("%d\n", (int)sizeof(long long));
5262     return(0);
5263 }
5264 EOCP
5265         set try
5266         if eval $compile_ok; then
5267                 longlongsize=`$run ./try`
5268                 echo "Your long longs are $longlongsize bytes long."
5269         else
5270                 dflt='8'
5271                 echo " "
5272                 echo "(I can't seem to compile the test program.  Guessing...)"
5273                 rp="What is the size of a long long (in bytes)?"
5274                 . ./myread
5275                 longlongsize="$ans"
5276         fi
5277         if $test "X$longsize" = "X$longlongsize"; then
5278                 echo "(That isn't any different from an ordinary long.)"
5279         fi      
5280         ;;
5281 esac
5282 $rm -f try.* try
5283
5284 : see if inttypes.h is available
5285 : we want a real compile instead of Inhdr because some systems
5286 : have an inttypes.h which includes non-existent headers
5287 echo " "
5288 $cat >try.c <<EOCP
5289 #include <inttypes.h>
5290 int main() {
5291         static int32_t foo32 = 0x12345678;
5292 }
5293 EOCP
5294 set try
5295 if eval $compile; then
5296         echo "<inttypes.h> found." >&4
5297         val="$define"
5298 else
5299         echo "<inttypes.h> NOT found." >&4
5300         val="$undef"
5301 fi
5302 $rm -f try.c try
5303 set i_inttypes
5304 eval $setvar
5305
5306 : check for int64_t
5307 echo " "
5308 echo "Checking to see if you have int64_t..." >&4
5309 $cat >try.c <<EOCP
5310 #include <sys/types.h>
5311 #$i_inttypes I_INTTYPES
5312 #ifdef I_INTTYPES
5313 #include <inttypes.h>
5314 #endif
5315 int main() { int64_t x = 7; }
5316 EOCP
5317 set try
5318 if eval $compile; then
5319         val="$define"
5320         echo "You have int64_t."
5321 else
5322         val="$undef"
5323         echo "You do not have int64_t."
5324 fi
5325 $rm -f try try.*
5326 set d_int64_t
5327 eval $setvar
5328
5329
5330 echo " "
5331 echo "Checking which 64-bit integer type we could use..." >&4
5332
5333 case "$intsize" in
5334 8) val=int
5335    set quadtype
5336    eval $setvar
5337    val='"unsigned int"'
5338    set uquadtype
5339    eval $setvar
5340    quadkind=1
5341    ;;
5342 *) case "$longsize" in
5343    8) val=long
5344       set quadtype
5345       eval $setvar
5346       val='"unsigned long"'
5347       set uquadtype
5348       eval $setvar
5349       quadkind=2
5350       ;;
5351    *) case "$d_longlong:$longlongsize" in
5352       define:8)
5353         val='"long long"'
5354         set quadtype
5355         eval $setvar
5356         val='"unsigned long long"'
5357         set uquadtype
5358         eval $setvar
5359         quadkind=3
5360         ;;
5361       *) case "$d_int64_t" in
5362          define)
5363            val=int64_t
5364            set quadtype
5365            eval $setvar
5366            val=uint64_t
5367            set uquadtype
5368            eval $setvar
5369            quadkind=4
5370            ;;
5371          esac
5372          ;;
5373       esac
5374       ;;
5375    esac
5376    ;;
5377 esac
5378
5379 case "$quadtype" in
5380 '')     echo "Alas, no 64-bit integer types in sight." >&4
5381         d_quad="$undef"
5382         ;;
5383 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5384         d_quad="$define"
5385         ;;
5386 esac
5387
5388
5389 case "$uselonglong" in
5390 "$define"|true|[yY]*)
5391         cat <<EOM >&4
5392
5393 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5394 EOM
5395         use64bitint="$define"
5396         ;;
5397 esac                          
5398 case "$use64bits" in
5399 "$define"|true|[yY]*)
5400         cat <<EOM >&4
5401
5402 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5403 EOM
5404         use64bitint="$define"
5405         ;;
5406 esac                          
5407 case "$use64bitints" in
5408 "$define"|true|[yY]*)
5409         cat <<EOM >&4
5410
5411 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5412 EOM
5413         use64bitint="$define"
5414         ;;
5415 esac                          
5416 case "$use64bitsint" in
5417 "$define"|true|[yY]*)
5418         cat <<EOM >&4
5419
5420 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5421 EOM
5422         use64bitint="$define"
5423         ;;
5424 esac                          
5425 case "$uselonglongs" in
5426 "$define"|true|[yY]*)
5427         cat <<EOM >&4
5428
5429 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5430 EOM
5431         use64bitint="$define"
5432         ;;
5433 esac                          
5434 case "$use64bitsall" in
5435 "$define"|true|[yY]*)
5436         cat <<EOM >&4
5437
5438 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5439 EOM
5440         use64bitall="$define"
5441         ;;
5442 esac                          
5443
5444 case "$ccflags" in
5445 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5446 esac
5447 case "$use64bitall" in
5448 "$define"|true|[yY]*) use64bitint="$define" ;;
5449 esac
5450
5451 case "$longsize" in
5452 8) cat <<EOM
5453
5454 You have natively 64-bit long integers.
5455 EOM
5456    val="$define"
5457    ;;
5458 *) case "$use64bitint" in
5459    "$define"|true|[yY]*) dflt='y';;
5460    *) dflt='n';;
5461    esac
5462    case "$d_quad" in
5463    "$define") ;;
5464    *) dflt='n' ;;
5465    esac
5466    cat <<EOM
5467
5468 Perl can be built to take advantage of 64-bit integer types
5469 on some systems.  To do so, Configure can be run with -Duse64bitint.
5470 Choosing this option will most probably introduce binary incompatibilities.
5471
5472 If this doesn't make any sense to you, just accept the default '$dflt'.
5473 (The default has been chosen based on your configuration.)
5474 EOM
5475    rp='Try to use 64-bit integers, if available?'
5476    . ./myread
5477    case "$ans" in
5478    [yY]*) val="$define" ;;
5479    *)     val="$undef"  ;;
5480    esac
5481    ;;
5482 esac
5483 set use64bitint
5484 eval $setvar
5485
5486 case "$use64bitall" in
5487 "$define"|true|[yY]*) dflt='y' ;;
5488 *) case "$longsize" in
5489    8) dflt='y' ;;
5490    *) dflt='n' ;;
5491    esac
5492    ;;
5493 esac    
5494 cat <<EOM
5495
5496 You may also choose to try maximal 64-bitness.  It means using as much
5497 64-bitness as possible on the platform.  This in turn means even more
5498 binary incompatibilities.  On the other hand, your platform may not
5499 have any more 64-bitness available than what you already have chosen.
5500
5501 If this doesn't make any sense to you, just accept the default '$dflt'.
5502 (The default has been chosen based on your configuration.)
5503 EOM
5504 rp='Try to use maximal 64-bit support, if available?'
5505 . ./myread
5506 case "$ans" in
5507 [yY]*) val="$define" ;;
5508 *)     val="$undef"  ;;
5509 esac
5510 set use64bitall
5511 eval $setvar
5512 case "$use64bitall" in
5513 "$define")
5514         case "$use64bitint" in
5515         "$undef")
5516                 cat <<EOM
5517
5518 Since you have chosen a maximally 64-bit build, I'm also turning on
5519 the use of 64-bit integers.
5520 EOM
5521                 use64bitint="$define" ;;
5522         esac
5523         ;;
5524 esac
5525
5526 : Look for a hint-file generated 'call-back-unit'.  If the
5527 : user has specified that a 64-bit perl is to be built,
5528 : we may need to set or change some other defaults.
5529 if $test -f use64bitint.cbu; then
5530         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5531         . ./use64bitint.cbu
5532 fi
5533 case "$use64bitint" in
5534 "$define"|true|[yY]*)
5535         case "$longsize" in
5536         4) case "$archname64" in
5537            '') archname64=64int ;;
5538            esac
5539            ;;
5540         esac
5541         ;;
5542 esac
5543
5544 : Look for a hint-file generated 'call-back-unit'.  If the
5545 : user has specified that a maximally 64-bit perl is to be built,
5546 : we may need to set or change some other defaults.
5547 if $test -f use64bitall.cbu; then
5548         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5549         . ./use64bitall.cbu
5550 fi
5551 case "$use64bitall" in
5552 "$define"|true|[yY]*)
5553         case "$longsize" in
5554         4) case "$archname64" in
5555            ''|64int) archname64=64all ;;
5556            esac
5557            ;;
5558         esac
5559         ;;
5560 esac
5561
5562 case "$d_quad:$use64bitint" in
5563 $undef:$define)
5564         cat >&4 <<EOF
5565
5566 *** You have chosen to use 64-bit integers,
5567 *** but none can be found.
5568 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5569 *** Cannot continue, aborting.
5570
5571 EOF
5572         exit 1
5573         ;;
5574 esac
5575
5576 : check for length of double
5577 echo " "
5578 case "$doublesize" in
5579 '')
5580         echo "Checking to see how big your double precision numbers are..." >&4
5581         $cat >try.c <<EOCP
5582 #include <stdio.h>
5583 #$i_stdlib I_STDLIB
5584 #ifdef I_STDLIB
5585 #include <stdlib.h>
5586 #endif
5587 int main()
5588 {
5589     printf("%d\n", (int)sizeof(double));
5590     exit(0);
5591 }
5592 EOCP
5593         set try
5594         if eval $compile_ok; then
5595                 doublesize=`$run ./try`
5596                 echo "Your double is $doublesize bytes long."
5597         else
5598                 dflt='8'
5599                 echo "(I can't seem to compile the test program.  Guessing...)"
5600                 rp="What is the size of a double precision number (in bytes)?"
5601                 . ./myread
5602                 doublesize="$ans"
5603         fi
5604         ;;
5605 esac
5606 $rm -f try.c try
5607
5608 : check for long doubles
5609 echo " "
5610 echo "Checking to see if you have long double..." >&4
5611 echo 'int main() { long double x = 7.0; }' > try.c
5612 set try
5613 if eval $compile; then
5614         val="$define"
5615         echo "You have long double."
5616 else
5617         val="$undef"
5618         echo "You do not have long double."
5619 fi
5620 $rm try.*
5621 set d_longdbl
5622 eval $setvar
5623
5624 : check for length of long double
5625 case "${d_longdbl}${longdblsize}" in
5626 $define)
5627         echo " "
5628         echo "Checking to see how big your long doubles are..." >&4
5629         $cat >try.c <<'EOCP'
5630 #include <stdio.h>
5631 int main()
5632 {
5633         printf("%d\n", sizeof(long double));
5634 }
5635 EOCP
5636         set try
5637         set try
5638         if eval $compile; then
5639                 longdblsize=`$run ./try`
5640                 echo "Your long doubles are $longdblsize bytes long."
5641         else
5642                 dflt='8'
5643                 echo " "
5644                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5645                 rp="What is the size of a long double (in bytes)?"
5646                 . ./myread
5647                 longdblsize="$ans"
5648         fi
5649         if $test "X$doublesize" = "X$longdblsize"; then
5650                 echo "That isn't any different from an ordinary double."
5651                 echo "I'll keep your setting anyway, but you may see some"
5652                 echo "harmless compilation warnings."
5653         fi      
5654         ;;
5655 esac
5656 $rm -f try.* try
5657
5658 : determine the architecture name
5659 echo " "
5660 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5661         tarch=`arch`"-$osname"
5662 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5663         if uname -m > tmparch 2>&1 ; then
5664                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5665                         -e 's/$/'"-$osname/" tmparch`
5666         else
5667                 tarch="$osname"
5668         fi
5669         $rm -f tmparch
5670 else
5671         tarch="$osname"
5672 fi
5673 case "$myarchname" in
5674 ''|"$tarch") ;;
5675 *)
5676         echo "(Your architecture name used to be $myarchname.)"
5677         archname=''
5678         ;;
5679 esac
5680 case "$targetarch" in
5681 '') ;;
5682 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5683 esac
5684 myarchname="$tarch"
5685 case "$archname" in
5686 '') dflt="$tarch";;
5687 *) dflt="$archname";;
5688 esac
5689 rp='What is your architecture name'
5690 . ./myread
5691 archname="$ans"
5692 case "$usethreads" in
5693 $define)
5694         echo "Threads selected." >&4
5695         case "$archname" in
5696         *-thread*) echo "...and architecture name already has -thread." >&4
5697                 ;;
5698         *)      archname="$archname-thread"
5699                 echo "...setting architecture name to $archname." >&4
5700                 ;;
5701         esac
5702         ;;
5703 esac
5704 case "$usemultiplicity" in
5705 $define)
5706         echo "Multiplicity selected." >&4
5707         case "$archname" in
5708         *-multi*) echo "...and architecture name already has -multi." >&4
5709                 ;;
5710         *)      archname="$archname-multi"
5711                 echo "...setting architecture name to $archname." >&4
5712                 ;;
5713         esac
5714         ;;
5715 esac
5716 case "$use64bitint$use64bitall" in
5717 *"$define"*)
5718         case "$archname64" in
5719         '')
5720                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5721                 ;;
5722         *)
5723                 case "$use64bitint" in
5724                 "$define") echo "64 bit integers selected." >&4 ;;
5725                 esac
5726                 case "$use64bitall" in
5727                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5728                 esac
5729                 case "$archname" in
5730                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5731                         ;;
5732                 *)      archname="$archname-$archname64"
5733                         echo "...setting architecture name to $archname." >&4
5734                         ;;
5735                 esac
5736                 ;;
5737         esac
5738 esac
5739 case "$uselongdouble" in
5740 $define)
5741         echo "Long doubles selected." >&4
5742         case "$longdblsize" in
5743         $doublesize)
5744                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5745                 ;;
5746         *)
5747                 case "$archname" in
5748                 *-ld*) echo "...and architecture name already has -ld." >&4
5749                         ;;
5750                 *)      archname="$archname-ld"
5751                         echo "...setting architecture name to $archname." >&4
5752                         ;;
5753                 esac
5754                 ;;
5755         esac
5756         ;;
5757 esac
5758 case "$useperlio" in
5759 $define)
5760         echo "Perlio selected." >&4
5761         ;;
5762 *)
5763         echo "Perlio not selected, using stdio." >&4
5764         case "$archname" in
5765         *-stdio*) echo "...and architecture name already has -stdio." >&4
5766                 ;;
5767         *)      archname="$archname-stdio"
5768                 echo "...setting architecture name to $archname." >&4
5769                 ;;
5770         esac
5771         ;;
5772 esac
5773 if $test -f archname.cbu; then
5774         echo "Your platform has some specific hints for architecture name, using them..."
5775         . ./archname.cbu
5776 fi
5777
5778 : determine root of directory hierarchy where package will be installed.
5779 case "$prefix" in
5780 '')
5781         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5782         ;;
5783 *?/)
5784         dflt=`echo "$prefix" | sed 's/.$//'`
5785         ;;
5786 *)
5787         dflt="$prefix"
5788         ;;
5789 esac
5790 $cat <<EOM
5791
5792 By default, $package will be installed in $dflt/bin, manual pages
5793 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5794 installation directories. Typically this is something like /usr/local.
5795 If you wish to have binaries under /usr/bin but other parts of the
5796 installation under /usr/local, that's ok: you will be prompted
5797 separately for each of the installation directories, the prefix being
5798 only used to set the defaults.
5799
5800 EOM
5801 fn=d~
5802 rp='Installation prefix to use?'
5803 . ./getfile
5804 oldprefix=''
5805 case "$prefix" in
5806 '') ;;
5807 *)
5808         case "$ans" in
5809         "$prefix") ;;
5810         *) oldprefix="$prefix";;
5811         esac
5812         ;;
5813 esac
5814 prefix="$ans"
5815 prefixexp="$ansexp"
5816
5817 case "$afsroot" in
5818 '')     afsroot=/afs ;;
5819 *)      afsroot=$afsroot ;;
5820 esac
5821
5822 : is AFS running?
5823 echo " "
5824 case "$afs" in
5825 $define|true)   afs=true ;;
5826 $undef|false)   afs=false ;;
5827 *)      if test -d $afsroot; then
5828                 afs=true
5829         else
5830                 afs=false
5831         fi
5832         ;;
5833 esac
5834 if $afs; then
5835         echo "AFS may be running... I'll be extra cautious then..." >&4
5836 else
5837         echo "AFS does not seem to be running..." >&4
5838 fi
5839
5840 : determine installation prefix for where package is to be installed.
5841 if $afs; then 
5842 $cat <<EOM
5843
5844 Since you are running AFS, I need to distinguish the directory in which
5845 files will reside from the directory in which they are installed (and from
5846 which they are presumably copied to the former directory by occult means).
5847
5848 EOM
5849         case "$installprefix" in
5850         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5851         *) dflt="$installprefix";;
5852         esac
5853 else
5854 $cat <<EOM
5855
5856 In some special cases, particularly when building $package for distribution,
5857 it is convenient to distinguish the directory in which files should be
5858 installed from the directory ($prefix) in which they will
5859 eventually reside.  For most users, these two directories are the same.
5860
5861 EOM
5862         case "$installprefix" in
5863         '') dflt=$prefix ;;
5864         *) dflt=$installprefix;;
5865         esac
5866 fi
5867 fn=d~
5868 rp='What installation prefix should I use for installing files?'
5869 . ./getfile
5870 installprefix="$ans"
5871 installprefixexp="$ansexp"
5872
5873 : set the prefixit variable, to compute a suitable default value
5874 prefixit='case "$3" in
5875 ""|none)
5876         case "$oldprefix" in
5877         "") eval "$1=\"\$$2\"";;
5878         *)
5879                 case "$3" in
5880                 "") eval "$1=";;
5881                 none)
5882                         eval "tp=\"\$$2\"";
5883                         case "$tp" in
5884                         ""|" ") eval "$1=\"\$$2\"";;
5885                         *) eval "$1=";;
5886                         esac;;
5887                 esac;;
5888         esac;;
5889 *)
5890         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5891         case "$tp" in
5892         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5893         /*-$oldprefix/*|\~*-$oldprefix/*)
5894                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5895         *) eval "$1=\"\$$2\"";;
5896         esac;;
5897 esac'
5898
5899 : get the patchlevel
5900 echo " "
5901 echo "Getting the current patchlevel..." >&4
5902 if $test -r $rsrc/patchlevel.h;then
5903         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5904         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5905         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5906         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5907         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5908         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5909         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5910 else
5911         revision=0
5912         patchlevel=0
5913         subversion=0
5914         api_revision=0
5915         api_version=0
5916         api_subversion=0
5917         perl_patchlevel=0
5918         $echo "(You do not have patchlevel.h.  Eek.)"
5919 fi
5920 if $test -r $rsrc/.patch ; then
5921         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5922                 perl_patchlevel=`cat $rsrc/.patch`
5923         fi
5924 fi
5925 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5926 version_patchlevel_string="version $patchlevel subversion $subversion"
5927 case "$perl_patchlevel" in
5928 0|'') ;;
5929 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5930 esac
5931
5932 $echo "(You have $package $version_patchlevel_string.)"
5933
5934 case "$osname" in
5935 dos|vms)
5936         : XXX Should be a Configure test for double-dots in filenames.
5937         version=`echo $revision $patchlevel $subversion | \
5938                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5939         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5940                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5941         ;;
5942 *)
5943         version=`echo $revision $patchlevel $subversion | \
5944                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5945         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5946                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5947         ;;
5948 esac
5949 : Special case the 5.005_xx maintenance series, which used 5.005
5950 : without any subversion label as a subdirectory in $sitelib
5951 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5952         api_versionstring='5.005'
5953 fi
5954
5955 : determine installation style
5956 : For now, try to deduce it from prefix unless it is already set.
5957 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5958 case "$installstyle" in
5959 '')     case "$prefix" in
5960                 *perl*) dflt='lib';;
5961                 *) dflt='lib/perl5' ;;
5962         esac
5963         ;;
5964 *)      dflt="$installstyle" ;;
5965 esac
5966 : Probably not worth prompting for this since we prompt for all
5967 : the directories individually, and the prompt would be too long and
5968 : confusing anyway.
5969 installstyle=$dflt
5970
5971
5972 : Perform the prefixexp/installprefixexp correction if necessary
5973 cat <<EOS >installprefix
5974 $startsh
5975 EOS
5976 cat <<'EOSC' >>installprefix
5977 : Change installation prefix, if necessary.
5978 if $test X"$prefix" != X"$installprefix"; then
5979         eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
5980 else
5981         eval "install${prefixvar}=\"\$${prefixvar}exp\""
5982 fi
5983 EOSC
5984
5985 : Set variables such as privlib and privlibexp from the output of ./getfile
5986 : performing the prefixexp/installprefixexp correction if necessary.
5987 cat <<EOS >setprefixvar
5988 $startsh
5989 EOS
5990 cat <<'EOSC' >>setprefixvar
5991 eval "${prefixvar}=\"\$ans\""
5992 eval "${prefixvar}exp=\"\$ansexp\""
5993 . ./installprefix
5994 EOSC
5995
5996 : determine where private library files go
5997 : Usual default is /usr/local/lib/perl5/$version.
5998 : Also allow things like /opt/perl/lib/$version, since 
5999 : /opt/perl/lib/perl5... would be redundant.
6000 : The default "style" setting is made in installstyle.U
6001 case "$installstyle" in
6002 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6003 *)       set dflt privlib lib/$version ;;
6004 esac
6005 eval $prefixit
6006 $cat <<EOM
6007
6008 There are some auxiliary files for $package that need to be put into a
6009 private library directory that is accessible by everyone.
6010
6011 EOM
6012 fn=d~+
6013 rp='Pathname where the private library files will reside?'
6014 . ./getfile
6015 prefixvar=privlib
6016 . ./setprefixvar
6017
6018 : set the prefixup variable, to restore leading tilda escape
6019 prefixup='case "$prefixexp" in
6020 "$prefix") ;;
6021 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6022 esac'
6023
6024 : determine where public architecture dependent libraries go
6025 set archlib archlib
6026 eval $prefixit
6027 : privlib default is /usr/local/lib/$package/$version
6028 : archlib default is /usr/local/lib/$package/$version/$archname
6029 : privlib may have an optional trailing /share.
6030 tdflt=`echo $privlib | $sed 's,/share$,,'`
6031 tdflt=$tdflt/$archname
6032 case "$archlib" in
6033 '')     dflt=$tdflt
6034         ;;
6035 *)      dflt="$archlib"
6036     ;;
6037 esac
6038 $cat <<EOM
6039
6040 $spackage contains architecture-dependent library files.  If you are
6041 sharing libraries in a heterogeneous environment, you might store
6042 these files in a separate location.  Otherwise, you can just include
6043 them with the rest of the public library files.
6044
6045 EOM
6046 fn=d+~
6047 rp='Where do you want to put the public architecture-dependent libraries?'
6048 . ./getfile
6049 prefixvar=archlib
6050 . ./setprefixvar
6051 if $test X"$archlib" = X"$privlib"; then
6052         d_archlib="$undef"
6053 else
6054         d_archlib="$define"
6055 fi
6056
6057 : see if setuid scripts can be secure
6058 $cat <<EOM
6059
6060 Some kernels have a bug that prevents setuid #! scripts from being
6061 secure.  Some sites have disabled setuid #! scripts because of this.
6062
6063 First let's decide if your kernel supports secure setuid #! scripts.
6064 (If setuid #! scripts would be secure but have been disabled anyway,
6065 don't say that they are secure if asked.)
6066
6067 EOM
6068
6069 val="$undef"
6070 if $test -d /dev/fd; then
6071         echo "#!$ls" >reflect
6072         chmod +x,u+s reflect
6073         ./reflect >flect 2>&1
6074         if $contains "/dev/fd" flect >/dev/null; then
6075                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6076                 val="$define"
6077         else
6078                 $cat <<EOM
6079 If you are not sure if they are secure, I can check but I'll need a
6080 username and password different from the one you are using right now.
6081 If you don't have such a username or don't want me to test, simply
6082 enter 'none'.
6083
6084 EOM
6085                 rp='Other username to test security of setuid scripts with?'
6086                 dflt='none'
6087                 . ./myread
6088                 case "$ans" in
6089                 n|none)
6090                         case "$d_suidsafe" in
6091                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6092                                 dflt=n;;
6093                         "$undef")
6094                                 echo "Well, the $hint value is *not* secure." >&4
6095                                 dflt=n;;
6096                         *)      echo "Well, the $hint value *is* secure." >&4
6097                                 dflt=y;;
6098                         esac
6099                         ;;
6100                 *)
6101                         $rm -f reflect flect
6102                         echo "#!$ls" >reflect
6103                         chmod +x,u+s reflect
6104                         echo >flect
6105                         chmod a+w flect
6106                         echo '"su" will (probably) prompt you for '"$ans's password."
6107                         su $ans -c './reflect >flect'
6108                         if $contains "/dev/fd" flect >/dev/null; then
6109                                 echo "Okay, it looks like setuid scripts are secure." >&4
6110                                 dflt=y
6111                         else
6112                                 echo "I don't think setuid scripts are secure." >&4
6113                                 dflt=n
6114                         fi
6115                         ;;
6116                 esac
6117                 rp='Does your kernel have *secure* setuid scripts?'
6118                 . ./myread
6119                 case "$ans" in
6120                 [yY]*)  val="$define";;
6121                 *)      val="$undef";;
6122                 esac
6123         fi
6124 else
6125         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6126         echo "(That's for file descriptors, not floppy disks.)"
6127         val="$undef"
6128 fi
6129 set d_suidsafe
6130 eval $setvar
6131
6132 $rm -f reflect flect
6133
6134 : now see if they want to do setuid emulation
6135 echo " "
6136 val="$undef"
6137 case "$d_suidsafe" in
6138 "$define")
6139         val="$undef"
6140         echo "No need to emulate SUID scripts since they are secure here." >&4
6141         ;;
6142 *)
6143         $cat <<EOM
6144 Some systems have disabled setuid scripts, especially systems where
6145 setuid scripts cannot be secure.  On systems where setuid scripts have
6146 been disabled, the setuid/setgid bits on scripts are currently
6147 useless.  It is possible for $package to detect those bits and emulate
6148 setuid/setgid in a secure fashion.  This emulation will only work if
6149 setuid scripts have been disabled in your kernel.
6150
6151 EOM
6152         case "$d_dosuid" in
6153         "$define") dflt=y ;;
6154         *) dflt=n ;;
6155         esac
6156         rp="Do you want to do setuid/setgid emulation?"
6157         . ./myread
6158         case "$ans" in
6159         [yY]*)  val="$define";;
6160         *)      val="$undef";;
6161         esac
6162         ;;
6163 esac
6164 set d_dosuid
6165 eval $setvar
6166
6167 : see if this is a malloc.h system
6168 : we want a real compile instead of Inhdr because some systems have a
6169 : malloc.h that just gives a compile error saying to use stdlib.h instead
6170 echo " "
6171 $cat >try.c <<EOCP
6172 #include <stdlib.h>
6173 #include <malloc.h>
6174 int main () { return 0; }
6175 EOCP
6176 set try
6177 if eval $compile; then
6178     echo "<malloc.h> found." >&4
6179     val="$define"
6180 else
6181     echo "<malloc.h> NOT found." >&4
6182     val="$undef"
6183 fi
6184 $rm -f try.c try
6185 set i_malloc
6186 eval $setvar
6187
6188 : check for void type
6189 echo " "
6190 echo "Checking to see how well your C compiler groks the void type..." >&4
6191 case "$voidflags" in
6192 '')
6193         $cat >try.c <<EOCP
6194 #$i_stdlib I_STDLIB
6195 #ifdef I_STDLIB
6196 #include <stdlib.h>
6197 #endif
6198 #if TRY & 1
6199 void sub() {
6200 #else
6201 sub() {
6202 #endif
6203         extern void moo();      /* function returning void */
6204         void (*goo)();          /* ptr to func returning void */
6205 #if TRY & 8
6206         void *hue;              /* generic ptr */
6207 #endif
6208 #if TRY & 2
6209         void (*foo[10])();
6210 #endif
6211
6212 #if TRY & 4
6213         if(goo == moo) {
6214                 exit(0);
6215         }
6216 #endif
6217         exit(0);
6218 }
6219 int main() { sub(); }
6220 EOCP
6221         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6222                 voidflags=$defvoidused
6223         echo "Good.  It appears to support void to the level $package wants.">&4
6224                 if $contains warning .out >/dev/null 2>&1; then
6225                         echo "However, you might get some warnings that look like this:"
6226                         $cat .out
6227                 fi
6228         else
6229 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6230                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6231                         echo "It supports 1..."
6232                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6233                                 echo "It also supports 2..."
6234                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6235                                         voidflags=7
6236                                         echo "And it supports 4 but not 8 definitely."
6237                                 else
6238                                         echo "It doesn't support 4..."
6239                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6240                                                 voidflags=11
6241                                                 echo "But it supports 8."
6242                                         else
6243                                                 voidflags=3
6244                                                 echo "Neither does it support 8."
6245                                         fi
6246                                 fi
6247                         else
6248                                 echo "It does not support 2..."
6249                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6250                                         voidflags=13
6251                                         echo "But it supports 4 and 8."
6252                                 else
6253                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6254                                                 voidflags=5
6255                                                 echo "And it supports 4 but has not heard about 8."
6256                                         else
6257                                                 echo "However it supports 8 but not 4."
6258                                         fi
6259                                 fi
6260                         fi
6261                 else
6262                         echo "There is no support at all for void."
6263                         voidflags=0
6264                 fi
6265         fi
6266 esac
6267 case "$voidflags" in
6268 "$defvoidused") ;;
6269 *)      $cat >&4 <<'EOM'
6270   Support flag bits are:
6271     1: basic void declarations.
6272     2: arrays of pointers to functions returning void.
6273     4: operations between pointers to and addresses of void functions.
6274     8: generic void pointers.
6275 EOM
6276         dflt="$voidflags";
6277         rp="Your void support flags add up to what?"
6278         . ./myread
6279         voidflags="$ans"
6280         ;;
6281 esac
6282 $rm -f try.* .out
6283
6284 : check for length of pointer
6285 echo " "
6286 case "$ptrsize" in
6287 '')
6288         echo "Checking to see how big your pointers are..." >&4
6289         if test "$voidflags" -gt 7; then
6290                 echo '#define VOID_PTR char *' > try.c
6291         else
6292                 echo '#define VOID_PTR void *' > try.c
6293         fi
6294         $cat >>try.c <<EOCP
6295 #include <stdio.h>
6296 #$i_stdlib I_STDLIB
6297 #ifdef I_STDLIB
6298 #include <stdlib.h>
6299 #endif
6300 int main()
6301 {
6302     printf("%d\n", (int)sizeof(VOID_PTR));
6303     exit(0);
6304 }
6305 EOCP
6306         set try
6307         if eval $compile_ok; then
6308                 ptrsize=`$run ./try`
6309                 echo "Your pointers are $ptrsize bytes long."
6310         else
6311                 dflt='4'
6312                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6313                 rp="What is the size of a pointer (in bytes)?"
6314                 . ./myread
6315                 ptrsize="$ans"
6316         fi
6317         ;;
6318 esac
6319 $rm -f try.c try
6320 case "$use64bitall" in
6321 "$define"|true|[yY]*)
6322         case "$ptrsize" in
6323         4)      cat <<EOM >&4
6324
6325 *** You have chosen a maximally 64-bit build,
6326 *** but your pointers are only 4 bytes wide.
6327 *** Please rerun Configure without -Duse64bitall.
6328 EOM
6329                 case "$d_quad" in
6330                 define)
6331                         cat <<EOM >&4
6332 *** Since you have quads, you could possibly try with -Duse64bitint.
6333 EOM
6334                         ;;
6335                 esac
6336                 cat <<EOM >&4
6337 *** Cannot continue, aborting.
6338
6339 EOM
6340
6341                 exit 1
6342                 ;;
6343         esac
6344         ;;
6345 esac
6346
6347
6348 : determine whether to use malloc wrapping
6349 echo " "
6350 case "$usemallocwrap" in
6351 [yY]*|true|$define)     dflt='y' ;;
6352 [nN]*|false|$undef)     dflt='n' ;;
6353 *)      case "$usedevel" in
6354         [yY]*|true|$define)     dflt='y' ;;
6355         *) dflt='n' ;;
6356         esac
6357         ;;
6358 esac
6359 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6360 . ./myread
6361 usemallocwrap="$ans"
6362 case "$ans" in
6363 y*|true)
6364         usemallocwrap="$define" ;;
6365 *)
6366         usemallocwrap="$undef" ;;
6367 esac
6368
6369 : determine which malloc to compile in
6370 echo " "
6371 case "$usemymalloc" in
6372 [yY]*|true|$define)     dflt='y' ;;
6373 [nN]*|false|$undef)     dflt='n' ;;
6374 *)      case "$ptrsize" in
6375         4) dflt='y' ;;
6376         *) dflt='n' ;;
6377         esac
6378         ;;
6379 esac
6380 rp="Do you wish to attempt to use the malloc that comes with $package?"
6381 . ./myread
6382 usemymalloc="$ans"
6383 case "$ans" in
6384 y*|true)
6385         usemymalloc='y'
6386         mallocsrc='malloc.c'
6387         mallocobj="malloc$_o"
6388         d_mymalloc="$define"
6389         case "$libs" in
6390         *-lmalloc*)
6391                 : Remove malloc from list of libraries to use
6392                 echo "Removing unneeded -lmalloc from library list" >&4
6393                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6394                 shift
6395                 libs="$*"
6396                 echo "libs = $libs" >&4
6397                 ;;
6398         esac
6399         ;;
6400 *)
6401         usemymalloc='n'
6402         mallocsrc=''
6403         mallocobj=''
6404         d_mymalloc="$undef"
6405         ;;
6406 esac
6407
6408 : compute the return types of malloc and free
6409 echo " "
6410 $cat >malloc.c <<END
6411 #$i_malloc I_MALLOC
6412 #$i_stdlib I_STDLIB
6413 #include <stdio.h>
6414 #include <sys/types.h>
6415 #ifdef I_MALLOC
6416 #include <malloc.h>
6417 #endif
6418 #ifdef I_STDLIB
6419 #include <stdlib.h>
6420 #endif
6421 #ifdef TRY_MALLOC
6422 void *malloc();
6423 #endif
6424 #ifdef TRY_FREE
6425 void free();
6426 #endif
6427 END
6428 case "$malloctype" in
6429 '')
6430         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6431                 malloctype='void *'
6432         else
6433                 malloctype='char *'
6434         fi
6435         ;;
6436 esac
6437 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6438
6439 case "$freetype" in
6440 '')
6441         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6442                 freetype='void'
6443         else
6444                 freetype='int'
6445         fi
6446         ;;
6447 esac
6448 echo "Your system uses $freetype free(), it would seem." >&4
6449 $rm -f malloc.[co]
6450 $cat <<EOM
6451
6452 After $package is installed, you may wish to install various
6453 add-on modules and utilities.  Typically, these add-ons will
6454 be installed under $prefix with the rest
6455 of this package.  However, you may wish to install such add-ons
6456 elsewhere under a different prefix.
6457
6458 If you do not wish to put everything under a single prefix, that's
6459 ok.  You will be prompted for the individual locations; this siteprefix
6460 is only used to suggest the defaults.
6461
6462 The default should be fine for most people.
6463
6464 EOM
6465 fn=d~+
6466 rp='Installation prefix to use for add-on modules and utilities?'
6467 : XXX Here might be another good place for an installstyle setting.
6468 case "$siteprefix" in
6469 '') dflt=$prefix ;;
6470 *)  dflt=$siteprefix ;;
6471 esac
6472 . ./getfile
6473 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6474 oldsiteprefix=''
6475 case "$siteprefix" in
6476 '') ;;
6477 *)      case "$ans" in
6478         "$prefix") ;;
6479         *) oldsiteprefix="$prefix";;
6480         esac
6481         ;;
6482 esac
6483 siteprefix="$ans"
6484 siteprefixexp="$ansexp"
6485
6486 : determine where site specific libraries go.
6487 : Usual default is /usr/local/lib/perl5/site_perl/$version
6488 : The default "style" setting is made in installstyle.U
6489 : XXX No longer works with Prefixit stuff.
6490 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6491 case "$sitelib" in
6492 '') case "$installstyle" in
6493         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6494         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6495         esac
6496         ;;
6497 *)      dflt="$sitelib"
6498         ;;
6499 esac
6500 $cat <<EOM
6501
6502 The installation process will create a directory for
6503 site-specific extensions and modules.  Most users find it convenient
6504 to place all site-specific files in this directory rather than in the
6505 main distribution directory.
6506
6507 EOM
6508 fn=d~+
6509 rp='Pathname for the site-specific library files?'
6510 . ./getfile
6511 prefixvar=sitelib
6512 . ./setprefixvar
6513 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6514
6515 : determine where site specific architecture-dependent libraries go.
6516 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6517 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6518 : sitelib may have an optional trailing /share.
6519 case "$sitearch" in
6520 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6521         dflt="$dflt/$archname"
6522         ;;
6523 *)      dflt="$sitearch"
6524         ;;
6525 esac
6526 set sitearch sitearch none
6527 eval $prefixit
6528 $cat <<EOM
6529
6530 The installation process will also create a directory for
6531 architecture-dependent site-specific extensions and modules.
6532
6533 EOM
6534 fn=d~+
6535 rp='Pathname for the site-specific architecture-dependent library files?'
6536 . ./getfile
6537 prefixvar=sitearch
6538 . ./setprefixvar
6539
6540 $cat <<EOM
6541
6542 The installation process will also create a directory for
6543 vendor-supplied add-ons.  Vendors who supply perl with their system
6544 may find it convenient to place all vendor-supplied files in this
6545 directory rather than in the main distribution directory.  This will
6546 ease upgrades between binary-compatible maintenance versions of perl.
6547
6548 Of course you may also use these directories in whatever way you see
6549 fit.  For example, you might use them to access modules shared over a
6550 company-wide network.
6551
6552 The default answer should be fine for most people.
6553 This causes further questions about vendor add-ons to be skipped
6554 and no vendor-specific directories will be configured for perl.
6555
6556 EOM
6557 rp='Do you want to configure vendor-specific add-on directories?'
6558 case "$usevendorprefix" in
6559 define|true|[yY]*) dflt=y ;;
6560 *)      : User may have set vendorprefix directly on Configure command line.
6561         case "$vendorprefix" in
6562         ''|' ') dflt=n ;;
6563         *)      dflt=y ;;
6564         esac
6565         ;;
6566 esac
6567 . ./myread
6568 case "$ans" in
6569 [yY]*)  fn=d~+
6570         rp='Installation prefix to use for vendor-supplied add-ons?'
6571         case "$vendorprefix" in
6572         '') dflt='' ;;
6573         *)  dflt=$vendorprefix ;;
6574         esac
6575         . ./getfile
6576         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6577         oldvendorprefix=''
6578         case "$vendorprefix" in
6579         '') ;;
6580         *)      case "$ans" in
6581                 "$prefix") ;;
6582                 *) oldvendorprefix="$prefix";;
6583                 esac
6584                 ;;
6585         esac
6586         usevendorprefix="$define"
6587         vendorprefix="$ans"
6588         vendorprefixexp="$ansexp"
6589         ;;
6590 *)      usevendorprefix="$undef"
6591         vendorprefix=''
6592         vendorprefixexp=''
6593         ;;
6594 esac
6595
6596 case "$vendorprefix" in
6597 '')     d_vendorlib="$undef"
6598         vendorlib=''
6599         vendorlibexp=''
6600         ;;
6601 *)      d_vendorlib="$define"
6602         : determine where vendor-supplied modules go.
6603         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6604         case "$vendorlib" in
6605         '')
6606                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6607                 case "$installstyle" in
6608                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6609                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6610                 esac
6611                 ;;
6612         *)      dflt="$vendorlib"
6613                 ;;
6614         esac
6615         fn=d~+
6616         rp='Pathname for the vendor-supplied library files?'
6617         . ./getfile
6618         vendorlib="$ans"
6619         vendorlibexp="$ansexp"
6620         ;;
6621 esac
6622 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6623 prefixvar=vendorlib
6624 . ./installprefix
6625
6626 case "$vendorprefix" in
6627 '')     d_vendorarch="$undef"
6628         vendorarch=''
6629         vendorarchexp=''
6630         ;;
6631 *)      d_vendorarch="$define"
6632         : determine where vendor-supplied architecture-dependent libraries go.
6633         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6634         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6635         : vendorlib may have an optional trailing /share.
6636         case "$vendorarch" in
6637         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6638                 dflt="$dflt/$archname"
6639                 ;;
6640         *)      dflt="$vendorarch" ;;
6641         esac
6642         fn=d~+
6643         rp='Pathname for vendor-supplied architecture-dependent files?'
6644         . ./getfile
6645         vendorarch="$ans"
6646         vendorarchexp="$ansexp"
6647         ;;
6648 esac
6649 prefixvar=vendorarch
6650 . ./installprefix
6651
6652 : Final catch-all directories to search
6653 $cat <<EOM
6654
6655 Lastly, you can have perl look in other directories for extensions and
6656 modules in addition to those already specified.
6657 These directories will be searched after 
6658         $sitearch 
6659         $sitelib 
6660 EOM
6661 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6662 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6663 echo ' '
6664 case "$otherlibdirs" in
6665 ''|' ') dflt='none' ;;
6666 *)      dflt="$otherlibdirs" ;;
6667 esac
6668 $cat <<EOM
6669 Enter a colon-separated set of extra paths to include in perl's @INC
6670 search path, or enter 'none' for no extra paths.
6671
6672 EOM
6673
6674 rp='Colon-separated list of additional directories for perl to search?'
6675 . ./myread
6676 case "$ans" in
6677 ' '|''|none)    otherlibdirs=' ' ;;     
6678 *)      otherlibdirs="$ans" ;;
6679 esac
6680 case "$otherlibdirs" in
6681 ' ') val=$undef ;;
6682 *)      val=$define ;;
6683 esac
6684 set d_perl_otherlibdirs
6685 eval $setvar
6686
6687 : Cruising for prototypes
6688 echo " "
6689 echo "Checking out function prototypes..." >&4
6690 $cat >prototype.c <<EOCP
6691 #$i_stdlib I_STDLIB
6692 #ifdef I_STDLIB
6693 #include <stdlib.h>
6694 #endif
6695 int main(int argc, char *argv[]) {
6696         exit(0);}
6697 EOCP
6698 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6699         echo "Your C compiler appears to support function prototypes."
6700         val="$define"
6701 else
6702         echo "Your C compiler doesn't seem to understand function prototypes."
6703         val="$undef"
6704 fi
6705 set prototype
6706 eval $setvar
6707 $rm -f prototype*
6708
6709 case "$prototype" in
6710 "$define") ;;
6711 *)      ansi2knr='ansi2knr'
6712         echo " "
6713         cat <<EOM >&4
6714
6715 $me:  FATAL ERROR:
6716 This version of $package can only be compiled by a compiler that 
6717 understands function prototypes.  Unfortunately, your C compiler 
6718         $cc $ccflags
6719 doesn't seem to understand them.  Sorry about that.
6720
6721 If GNU cc is available for your system, perhaps you could try that instead.  
6722
6723 Eventually, we hope to support building Perl with pre-ANSI compilers.
6724 If you would like to help in that effort, please contact <perlbug@perl.org>.
6725
6726 Aborting Configure now.
6727 EOM
6728         exit 2
6729         ;;
6730 esac
6731
6732 : determine where public executables go
6733 echo " "
6734 set dflt bin bin
6735 eval $prefixit
6736 fn=d~
6737 rp='Pathname where the public executables will reside?'
6738 . ./getfile
6739 if $test "X$ansexp" != "X$binexp"; then
6740         installbin=''
6741 fi
6742 prefixvar=bin
6743 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6744 . ./setprefixvar
6745
6746 echo " "
6747 case "$extras" in
6748 '') dflt='n';;
6749 *) dflt='y';;
6750 esac
6751 cat <<EOM
6752 Perl can be built with extra modules or bundles of modules which
6753 will be fetched from the CPAN and installed alongside Perl.
6754
6755 Notice that you will need access to the CPAN; either via the Internet,
6756 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6757 be asked later to configure the CPAN.pm module which will in turn do
6758 the installation of the rest of the extra modules or bundles.)
6759
6760 Notice also that if the modules require any external software such as
6761 libraries and headers (the libz library and the zlib.h header for the
6762 Compress::Zlib module, for example) you MUST have any such software
6763 already installed, this configuration process will NOT install such
6764 things for you.
6765
6766 If this doesn't make any sense to you, just accept the default '$dflt'.
6767 EOM
6768 rp='Install any extra modules (y or n)?'
6769 . ./myread
6770 case "$ans" in
6771 y|Y)
6772         cat <<EOM
6773
6774 Please list any extra modules or bundles to be installed from CPAN,
6775 with spaces between the names.  The names can be in any format the
6776 'install' command of CPAN.pm will understand.  (Answer 'none',
6777 without the quotes, to install no extra modules or bundles.)
6778 EOM
6779         rp='Extras?'
6780         dflt="$extras"
6781         . ./myread
6782         extras="$ans"
6783 esac
6784 case "$extras" in
6785 ''|'none')
6786         val=''
6787         $rm -f ../extras.lst
6788         ;;
6789 *)      echo "(Saving the list of extras for later...)"
6790         echo "$extras" > ../extras.lst
6791         val="'$extras'"
6792         ;;
6793 esac
6794 set extras
6795 eval $setvar
6796 echo " "
6797
6798 : determine where html pages for programs go
6799 set html1dir html1dir none
6800 eval $prefixit
6801 $cat <<EOM
6802
6803 If you wish to install html files for programs in $spackage, indicate 
6804 the appropriate directory here.  To skip installing html files,
6805 answer "none".
6806 EOM
6807 case "$html1dir" in
6808 ''|none|$undef|' ') dflt=none ;;
6809 *) dflt=$html1dir ;;
6810 esac
6811 fn=dn+~
6812 rp="Directory for the main $spackage html pages?"
6813 . ./getfile
6814 prefixvar=html1dir
6815 . ./setprefixvar
6816 : Use ' ' for none so value is preserved next time through Configure
6817 $test X"$html1dir" = "X" && html1dir=' '
6818
6819 : determine where html pages for libraries and modules go
6820 set html3dir html3dir none
6821 eval $prefixit
6822 $cat <<EOM
6823
6824 If you wish to install html files for modules associated with $spackage,
6825 indicate the appropriate directory here.  To skip installing html files,
6826 answer "none".
6827 EOM
6828 : There is no obvious default.  If they have specified html1dir, then
6829 : try to key off that, possibly changing .../html1 into .../html3.
6830 case "$html3dir" in
6831 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6832 *) dflt=$html3dir ;;
6833 esac
6834 fn=dn+~
6835 rp="Directory for the $spackage module html pages?"
6836 . ./getfile
6837 prefixvar=html3dir
6838 . ./setprefixvar
6839 : Use ' ' for none so value is preserved next time through Configure
6840 $test X"$html3dir" = "X" && html3dir=' '
6841
6842 : Find perl5.005 or later.
6843 echo "Looking for a previously installed perl5.005 or later... "
6844 case "$perl5" in
6845 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6846                 : Check if this perl is recent and can load a simple module
6847                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6848                         perl5=$tdir/perl
6849                         break;
6850                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6851                         perl5=$tdir/perl5
6852                         break;
6853                 fi
6854         done
6855         ;;
6856 *)      perl5="$perl5"
6857         ;;
6858 esac
6859 case "$perl5" in
6860 '')     echo "None found.  That's ok.";;
6861 *)      echo "Using $perl5." ;;
6862 esac
6863
6864 : Determine list of previous versions to include in @INC
6865 $cat > getverlist <<EOPL
6866 #!$perl5 -w
6867 use File::Basename;
6868 \$api_versionstring = "$api_versionstring";
6869 \$version = "$version";
6870 \$stem = "$sitelib_stem";
6871 \$archname = "$archname";
6872 EOPL
6873         $cat >> getverlist <<'EOPL'
6874 # Can't have leading @ because metaconfig interprets it as a command!
6875 ;@inc_version_list=();
6876 # XXX Redo to do opendir/readdir? 
6877 if (-d $stem) {
6878     chdir($stem);
6879     ;@candidates = glob("5.*");
6880 }
6881 else {
6882     ;@candidates = ();
6883 }
6884
6885 # XXX ToDo:  These comparisons must be reworked when two-digit
6886 # subversions come along, so that 5.7.10 compares as greater than
6887 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6888 # widespread that we can use the built-in version vectors rather
6889 # than reinventing them here.  For 5.6.0, however, we must
6890 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6891 foreach $d (@candidates) {
6892     if ($d lt $version) {
6893         if ($d ge $api_versionstring) {
6894             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6895         }
6896         elsif ($d ge "5.005") {
6897             unshift(@inc_version_list, grep { -d } $d);
6898         }
6899     }
6900     else {
6901         # Skip newer version.  I.e. don't look in
6902         # 5.7.0 if we're installing 5.6.1.
6903     }
6904 }
6905
6906 if (@inc_version_list) {
6907     print join(' ', @inc_version_list);
6908 }
6909 else {
6910     # Blank space to preserve value for next Configure run.
6911     print " ";
6912 }
6913 EOPL
6914 chmod +x getverlist
6915 case "$inc_version_list" in
6916 '')     if test -x "$perl5$exe_ext"; then
6917                 dflt=`$perl5 getverlist`
6918         else
6919                 dflt='none'
6920         fi
6921         ;;
6922 $undef) dflt='none' ;;
6923 *)  eval dflt=\"$inc_version_list\" ;;
6924 esac
6925 case "$dflt" in
6926 ''|' ') dflt=none ;;
6927 esac
6928 case "$dflt" in
6929 5.005) dflt=none ;;
6930 esac
6931 $cat <<EOM
6932
6933 In order to ease the process of upgrading, this version of perl 
6934 can be configured to use modules built and installed with earlier 
6935 versions of perl that were installed under $prefix.  Specify here
6936 the list of earlier versions that this version of perl should check.
6937 If Configure detected no earlier versions of perl installed under
6938 $prefix, then the list will be empty.  Answer 'none' to tell perl
6939 to not search earlier versions.
6940
6941 The default should almost always be sensible, so if you're not sure,
6942 just accept the default.
6943 EOM
6944
6945 rp='List of earlier versions to include in @INC?'
6946 . ./myread
6947 case "$ans" in
6948 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6949 *) inc_version_list="$ans" ;;
6950 esac
6951 case "$inc_version_list" in
6952 ''|' ') 
6953         inc_version_list_init='0';;
6954 *)      inc_version_list_init=`echo $inc_version_list |
6955                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6956         ;;
6957 esac
6958 $rm -f getverlist
6959
6960 : determine whether to install perl also as /usr/bin/perl
6961
6962 echo " "
6963 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6964         $cat <<EOM
6965 Many scripts expect perl to be installed as /usr/bin/perl.
6966
6967 If you want to, I can install the perl you are about to compile
6968 as /usr/bin/perl (in addition to $bin/perl).
6969 EOM
6970         if test -f /usr/bin/perl; then
6971             $cat <<EOM
6972
6973 However, please note that because you already have a /usr/bin/perl,
6974 overwriting that with a new Perl would very probably cause problems.
6975 Therefore I'm assuming you don't want to do that (unless you insist).
6976
6977 EOM
6978             case "$installusrbinperl" in
6979             "$define"|[yY]*)    dflt='y';;
6980             *)                  dflt='n';;
6981             esac
6982         else
6983             $cat <<EOM
6984
6985 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
6986
6987 EOM
6988             case "$installusrbinperl" in
6989             "$undef"|[nN]*)     dflt='n';;
6990             *)                  dflt='y';;
6991             esac
6992         fi
6993         rp="Do you want to install perl as /usr/bin/perl?"
6994         . ./myread
6995         case "$ans" in
6996         [yY]*)  val="$define";;
6997         *)      val="$undef" ;;
6998         esac
6999 else
7000         val="$undef"
7001 fi
7002 set installusrbinperl
7003 eval $setvar
7004
7005 echo " "
7006 echo "Checking for GNU C Library..." >&4
7007 cat >try.c <<'EOCP'
7008 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7009    alone are insufficient to distinguish different versions, such as
7010    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7011    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7012 */
7013 #include <stdio.h>
7014 int main(void)
7015 {
7016 #ifdef __GLIBC__
7017 #   ifdef __GLIBC_MINOR__
7018 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7019 #           include <gnu/libc-version.h>
7020             printf("%s\n",  gnu_get_libc_version());
7021 #       else
7022             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7023 #       endif
7024 #   else
7025         printf("%d\n",  __GLIBC__);
7026 #   endif
7027     return 0;
7028 #else
7029     return 1;
7030 #endif
7031 }
7032 EOCP
7033 set try
7034 if eval $compile_ok && $run ./try > glibc.ver; then
7035         val="$define"
7036         gnulibc_version=`$cat glibc.ver`
7037         echo "You are using the GNU C Library version $gnulibc_version"
7038 else
7039         val="$undef"
7040         gnulibc_version=''
7041         echo "You are not using the GNU C Library"
7042 fi
7043 $rm -f try try.* glibc.ver
7044 set d_gnulibc
7045 eval $setvar
7046
7047 : see if nm is to be used to determine whether a symbol is defined or not
7048 case "$usenm" in
7049 '')
7050         dflt=''
7051         case "$d_gnulibc" in
7052         "$define")
7053                 echo " "
7054                 echo "nm probably won't work on the GNU C Library." >&4
7055                 dflt=n
7056                 ;;
7057         esac
7058         case "$dflt" in
7059         '') 
7060                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7061                         echo " "
7062                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7063                         echo "'nm' won't be sufficient on this sytem." >&4
7064                         dflt=n
7065                 fi
7066                 ;;
7067         esac
7068         case "$dflt" in
7069         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7070                 if $test $dflt -gt 20; then
7071                         dflt=y
7072                 else
7073                         dflt=n
7074                 fi
7075                 ;;
7076         esac
7077         ;;
7078 *)
7079         case "$usenm" in
7080         true|$define) dflt=y;;
7081         *) dflt=n;;
7082         esac
7083         ;;
7084 esac
7085 $cat <<EOM
7086
7087 I can use $nm to extract the symbols from your C libraries. This
7088 is a time consuming task which may generate huge output on the disk (up
7089 to 3 megabytes) but that should make the symbols extraction faster. The
7090 alternative is to skip the 'nm' extraction part and to compile a small
7091 test program instead to determine whether each symbol is present. If
7092 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7093 this may be the best solution.
7094
7095 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7096
7097 EOM
7098 rp="Shall I use $nm to extract C symbols from the libraries?"
7099 . ./myread
7100 case "$ans" in
7101 [Nn]*) usenm=false;;
7102 *) usenm=true;;
7103 esac
7104
7105 runnm=$usenm
7106 case "$reuseval" in
7107 true) runnm=false;;
7108 esac
7109
7110 : nm options which may be necessary
7111 case "$nm_opt" in
7112 '') if $test -f /mach_boot; then
7113                 nm_opt=''       # Mach
7114         elif $test -d /usr/ccs/lib; then
7115                 nm_opt='-p'     # Solaris (and SunOS?)
7116         elif $test -f /dgux; then
7117                 nm_opt='-p'     # DG-UX
7118         elif $test -f /lib64/rld; then
7119                 nm_opt='-p'     # 64-bit Irix
7120         else
7121                 nm_opt=''
7122         fi;;
7123 esac
7124
7125 : nm options which may be necessary for shared libraries but illegal
7126 : for archive libraries.  Thank you, Linux.
7127 case "$nm_so_opt" in
7128 '')     case "$myuname" in
7129         *linux*|gnu*)
7130                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7131                         nm_so_opt='--dynamic'
7132                 fi
7133                 ;;
7134         esac
7135         ;;
7136 esac
7137
7138 case "$runnm" in
7139 true)
7140 : get list of predefined functions in a handy place
7141 echo " "
7142 case "$libc" in
7143 '') libc=unknown
7144         case "$libs" in
7145         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7146         esac
7147         ;;
7148 esac
7149 case "$libs" in
7150 '') ;;
7151 *)  for thislib in $libs; do
7152         case "$thislib" in
7153         -lc|-lc_s)
7154                 : Handle C library specially below.
7155                 ;;
7156         -l*)
7157                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7158                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7159                         :
7160                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7161                         :
7162                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7163                         :
7164                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7165                         :
7166                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7167                         :
7168                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7169                         :
7170                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7171                         :
7172                 else
7173                         try=''
7174                 fi
7175                 libnames="$libnames $try"
7176                 ;;
7177         *) libnames="$libnames $thislib" ;;
7178         esac
7179         done
7180         ;;
7181 esac
7182 xxx=normal
7183 case "$libc" in
7184 unknown)
7185         set /lib/libc.$so
7186         for xxx in $libpth; do
7187                 $test -r $1 || set $xxx/libc.$so
7188                 : The messy sed command sorts on library version numbers.
7189                 $test -r $1 || \
7190                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7191                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7192                                 h
7193                                 s/[0-9][0-9]*/0000&/g
7194                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7195                                 G
7196                                 s/\n/ /' | \
7197                          $sort | $sed -e 's/^.* //'`
7198                 eval set \$$#
7199         done
7200         $test -r $1 || set /usr/ccs/lib/libc.$so
7201         $test -r $1 || set /lib/libsys_s$_a
7202         ;;
7203 *)
7204         set blurfl
7205         ;;
7206 esac
7207 if $test -r "$1"; then
7208         echo "Your (shared) C library seems to be in $1."
7209         libc="$1"
7210 elif $test -r /lib/libc && $test -r /lib/clib; then
7211         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7212         xxx=apollo
7213         libc='/lib/clib /lib/libc'
7214         if $test -r /lib/syslib; then
7215                 echo "(Your math library is in /lib/syslib.)"
7216                 libc="$libc /lib/syslib"
7217         fi
7218 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7219         echo "Your C library seems to be in $libc, as you said before."
7220 elif $test -r $incpath/usr/lib/libc$_a; then
7221         libc=$incpath/usr/lib/libc$_a;
7222         echo "Your C library seems to be in $libc.  That's fine."
7223 elif $test -r /lib/libc$_a; then
7224         libc=/lib/libc$_a;
7225         echo "Your C library seems to be in $libc.  You're normal."
7226 else
7227         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7228                 :
7229         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7230                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7231         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7232                 :
7233         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7234                 :
7235         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7236                 :
7237         else
7238                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7239         fi
7240         if $test -r "$tans"; then
7241                 echo "Your C library seems to be in $tans, of all places."
7242                 libc=$tans
7243         else
7244                 libc='blurfl'
7245         fi
7246 fi
7247 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7248         dflt="$libc"
7249         cat <<EOM
7250
7251 If the guess above is wrong (which it might be if you're using a strange
7252 compiler, or your machine supports multiple models), you can override it here.
7253
7254 EOM
7255 else
7256         dflt=''
7257         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7258         cat >&4 <<EOM
7259 I can't seem to find your C library.  I've looked in the following places:
7260
7261 EOM
7262         $sed 's/^/      /' libpath
7263         cat <<EOM
7264
7265 None of these seems to contain your C library. I need to get its name...
7266
7267 EOM
7268 fi
7269 fn=f
7270 rp='Where is your C library?'
7271 . ./getfile
7272 libc="$ans"
7273
7274 echo " "
7275 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7276 set X `cat libnames`
7277 shift
7278 xxx=files
7279 case $# in 1) xxx=file; esac
7280 echo "Extracting names from the following $xxx for later perusal:" >&4
7281 echo " "
7282 $sed 's/^/      /' libnames >&4
7283 echo " "
7284 $echo $n "This may take a while...$c" >&4
7285
7286 for file in $*; do
7287         case $file in
7288         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7289         *) $nm $nm_opt $file 2>/dev/null;;
7290         esac
7291 done >libc.tmp
7292
7293 $echo $n ".$c"
7294 $grep fprintf libc.tmp > libc.ptf
7295 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7296 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7297 xxx='[ADTSIW]'
7298 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7299         eval $xscan;\
7300         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7301                 eval $xrun
7302 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7303         eval $xscan;\
7304         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7305                 eval $xrun
7306 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7307         eval $xscan;\
7308         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7309                 eval $xrun
7310 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7311         eval $xscan;\
7312         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7313                 eval $xrun
7314 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7315         eval $xscan;\
7316         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7317                 eval $xrun
7318 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7319         eval $xscan;\
7320         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7321                 eval $xrun
7322 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7323                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7324         eval $xscan;\
7325         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7326                 eval $xrun
7327 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7328         eval $xscan;\
7329         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7330                 eval $xrun
7331 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7332         eval $xscan;\
7333         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7334                 eval $xrun
7335 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7336         eval $xscan;\
7337         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7338                 eval $xrun
7339 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7340         eval $xscan;\
7341         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7342                 eval $xrun
7343 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7344         eval $xscan;\
7345         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7346                 eval $xrun
7347 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7348         eval $xscan;\
7349         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7350                 eval $xrun
7351 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7352         eval $xscan;\
7353         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7354                 eval $xrun
7355 else
7356         $nm -p $* 2>/dev/null >libc.tmp
7357         $grep fprintf libc.tmp > libc.ptf
7358         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7359                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7360         then
7361                 nm_opt='-p'
7362                 eval $xrun
7363         else
7364                 echo " "
7365                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7366                 com=''
7367                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7368                         for thisname in $libnames $libc; do
7369                                 $ar t $thisname >>libc.tmp
7370                         done
7371                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7372                         echo "Ok." >&4
7373                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7374                         # Repeat libc to extract forwarders to DLL entries too
7375                         for thisname in $libnames $libc; do
7376                                 $ar tv $thisname >>libc.tmp
7377                                 # Revision 50 of EMX has bug in $ar.
7378                                 # it will not extract forwarders to DLL entries
7379                                 # Use emximp which will extract exactly them.
7380                                 emximp -o tmp.imp $thisname \
7381                                     2>/dev/null && \
7382                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7383                                     < tmp.imp >>libc.tmp
7384                                 $rm tmp.imp
7385                         done
7386                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7387                         echo "Ok." >&4
7388                 else
7389                         echo "$ar didn't seem to work right." >&4
7390                         echo "Maybe this is a Cray...trying bld instead..." >&4
7391                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7392                         then
7393                                 for thisname in $libnames; do
7394                                         bld t $libnames | \
7395                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7396                                         $ar t $thisname >>libc.tmp
7397                                 done
7398                                 echo "Ok." >&4
7399                         else
7400                                 echo "That didn't work either.  Giving up." >&4
7401                                 exit 1
7402                         fi
7403                 fi
7404         fi
7405 fi
7406 nm_extract="$com"
7407 case "$PASE" in
7408 define)
7409     echo " "
7410     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7411     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7412     ;;
7413 *)  if $test -f /lib/syscalls.exp; then
7414         echo " "
7415         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7416         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7417     fi
7418     ;;
7419 esac
7420 ;;
7421 esac
7422 $rm -f libnames libpath
7423
7424 : see if dld is available
7425 set dld.h i_dld
7426 eval $inhdr
7427
7428 : is a C symbol defined?
7429 csym='tlook=$1;
7430 case "$3" in
7431 -v) tf=libc.tmp; tdc="";;
7432 -a) tf=libc.tmp; tdc="[]";;
7433 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7434 esac;
7435 tx=yes;
7436 case "$reuseval-$4" in
7437 true-) ;;
7438 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7439 esac;
7440 case "$tx" in
7441 yes)
7442         tval=false;
7443         if $test "$runnm" = true; then
7444                 if $contains $tlook $tf >/dev/null 2>&1; then
7445                         tval=true;
7446                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7447                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7448                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7449                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7450                         $rm -f try$_exe try.c core core.* try.core;
7451                 fi;
7452         else
7453                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7454                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7455                 $rm -f try$_exe try.c;
7456         fi;
7457         ;;
7458 *)
7459         case "$tval" in
7460         $define) tval=true;;
7461         *) tval=false;;
7462         esac;
7463         ;;
7464 esac;
7465 eval "$2=$tval"'
7466
7467 : define an is-in-libc? function
7468 inlibc='echo " "; td=$define; tu=$undef;
7469 sym=$1; var=$2; eval "was=\$$2";
7470 tx=yes;
7471 case "$reuseval$was" in
7472 true) ;;
7473 true*) tx=no;;
7474 esac;
7475 case "$tx" in
7476 yes)
7477         set $sym tres -f;
7478         eval $csym;
7479         case "$tres" in
7480         true)
7481                 echo "$sym() found." >&4;
7482                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7483         *)
7484                 echo "$sym() NOT found." >&4;
7485                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7486         esac;;
7487 *)
7488         case "$was" in
7489         $define) echo "$sym() found." >&4;;
7490         *) echo "$sym() NOT found." >&4;;
7491         esac;;
7492 esac'
7493
7494 : see if dlopen exists
7495 xxx_runnm="$runnm"
7496 runnm=false
7497 set dlopen d_dlopen
7498 eval $inlibc
7499 runnm="$xxx_runnm"
7500
7501 : determine which dynamic loading, if any, to compile in
7502 echo " "
7503 dldir="ext/DynaLoader"
7504 case "$usedl" in
7505 $define|y|true)
7506         dflt='y'
7507         usedl="$define"
7508         ;;
7509 $undef|n|false)
7510         dflt='n'
7511         usedl="$undef"
7512         ;;
7513 *) 
7514         dflt='n'
7515         case "$d_dlopen" in
7516             $define) dflt='y' ;;
7517         esac
7518         case "$i_dld" in
7519             $define) dflt='y' ;;
7520         esac
7521         : Does a dl_xxx.xs file exist for this operating system
7522         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7523         ;;
7524 esac
7525 rp="Do you wish to use dynamic loading?"
7526 . ./myread
7527 usedl="$ans"
7528 case "$ans" in
7529 y*) usedl="$define"
7530         case "$dlsrc" in
7531         '')
7532                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7533                         dflt="$dldir/dl_${osname}.xs"
7534                 elif $test "$d_dlopen" = "$define" ; then
7535                         dflt="$dldir/dl_dlopen.xs"
7536                 elif $test "$i_dld" = "$define" ; then
7537                         dflt="$dldir/dl_dld.xs"
7538                 else
7539                         dflt=''
7540                 fi
7541                 ;;
7542         *)      dflt="$dldir/$dlsrc"
7543                 ;;
7544         esac
7545     echo "The following dynamic loading files are available:"
7546         : Can not go over to $dldir because getfile has path hard-coded in.
7547         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7548         rp="Source file to use for dynamic loading"
7549         fn="fne"
7550         gfpth="$src"
7551         . ./getfile
7552         usedl="$define"
7553         : emulate basename
7554         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7555
7556         $cat << EOM
7557
7558 Some systems may require passing special flags to $cc -c to
7559 compile modules that will be used to create a shared library.
7560 To use no flags, say "none".
7561
7562 EOM
7563     case "$cccdlflags" in
7564     '') case "$gccversion" in
7565                 '') case "$osname" in
7566                         hpux)   dflt='+z' ;;
7567                         next)   dflt='none' ;;
7568                         irix*)  dflt='-KPIC' ;;
7569                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7570                         sunos)  dflt='-pic' ;;
7571                         *)      dflt='none' ;;
7572                     esac
7573                         ;;
7574                 *)  case "$osname" in
7575                         darwin) dflt='none' ;;
7576                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7577                         *)      dflt='-fpic' ;;
7578                     esac ;;
7579             esac ;;
7580         ' ') dflt='none' ;;
7581     *)  dflt="$cccdlflags" ;;
7582     esac
7583     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7584     . ./myread
7585     case "$ans" in
7586     none) cccdlflags=' ' ;;
7587     *) cccdlflags="$ans" ;;
7588     esac
7589
7590     cat << EOM
7591
7592 Some systems use ld to create libraries that can be dynamically loaded,
7593 while other systems (such as those using ELF) use $cc.
7594
7595 EOM
7596         case "$ld" in
7597         '')     $cat >try.c <<EOM
7598 /* Test for whether ELF binaries are produced */
7599 #include <fcntl.h>
7600 #$i_stdlib I_STDLIB
7601 #ifdef I_STDLIB
7602 #include <stdlib.h>
7603 #endif
7604 int main() {
7605         char b[4];
7606         int i = open("a.out",O_RDONLY);
7607         if(i == -1) 
7608                 exit(1); /* fail */
7609         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7610                 exit(0); /* succeed (yes, it's ELF) */
7611         else
7612                 exit(1); /* fail */
7613 }
7614 EOM
7615                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7616                         cat <<EOM
7617 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7618 EOM
7619                         dflt="$cc"
7620                 else
7621                         echo "I'll use ld to build dynamic libraries."
7622                         dflt='ld'
7623                 fi
7624                 rm -f try.c a.out
7625                 ;;
7626         *)      dflt="$ld"
7627                 ;;
7628         esac
7629
7630     rp="What command should be used to create dynamic libraries?"
7631     . ./myread
7632         ld="$ans"
7633
7634     cat << EOM
7635
7636 Some systems may require passing special flags to $ld to create a
7637 library that can be dynamically loaded.  If your ld flags include
7638 -L/other/path options to locate libraries outside your loader's normal
7639 search path, you may need to specify those -L options here as well.  To
7640 use no flags, say "none".
7641
7642 EOM
7643     case "$lddlflags" in
7644     '') case "$osname" in
7645                         beos) dflt='-nostart' ;;
7646                         hpux) dflt='-b';
7647                               case "$gccversion" in
7648                               '') dflt="$dflt +vnocompatwarnings" ;;
7649                               esac
7650                               ;;        
7651                         linux|irix*|gnu*)       dflt='-shared' ;;
7652                         next)  dflt='none' ;;
7653                         solaris) dflt='-G' ;;
7654                         sunos) dflt='-assert nodefinitions' ;;
7655                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7656                 *)     dflt='none' ;;
7657                         esac
7658                         ;;
7659     *) dflt="$lddlflags" ;;
7660     esac
7661
7662         : Try to guess additional flags to pick up local libraries.
7663         : Be careful not to append to a plain 'none'
7664         case "$dflt" in
7665         none) dflt='' ;;
7666         esac
7667         for thisflag in $ldflags; do
7668                 case "$thisflag" in
7669                 -L*|-R*|-Wl,-R*)
7670                         case " $dflt " in
7671                         *" $thisflag "*) ;;
7672                         *) dflt="$dflt $thisflag" ;;
7673                         esac
7674                         ;;
7675                 esac
7676         done
7677
7678         case "$dflt" in
7679         ''|' ') dflt='none' ;;
7680         esac
7681
7682     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7683     . ./myread
7684     case "$ans" in
7685     none) lddlflags=' ' ;;
7686     *) lddlflags="$ans" ;;
7687     esac
7688
7689         cat <<EOM
7690
7691 Some systems may require passing special flags to $cc to indicate that
7692 the resulting executable will use dynamic linking.  To use no flags,
7693 say "none".
7694
7695 EOM
7696     case "$ccdlflags" in
7697     '') case "$osname" in
7698             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7699             next|sunos) dflt='none' ;;
7700             *)          dflt='none' ;;
7701             esac ;;
7702     ' ')  dflt='none' ;;
7703     *)  dflt="$ccdlflags" ;;
7704     esac
7705     rp="Any special flags to pass to $cc to use dynamic linking?"
7706     . ./myread
7707     case "$ans" in
7708     none) ccdlflags=' ' ;;
7709     *) ccdlflags="$ans" ;;
7710     esac
7711     ;;
7712 *)  usedl="$undef"
7713         ld='ld'
7714     dlsrc='dl_none.xs'
7715     lddlflags=''
7716     ccdlflags=''
7717     ;;
7718 esac
7719
7720 also=''
7721 case "$usedl" in
7722 $undef)
7723         # No dynamic loading being used, so don't bother even to prompt.
7724         useshrplib='false'
7725         ;;
7726 *)      case "$useshrplib" in
7727         '')     case "$osname" in
7728                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7729                         dflt=y
7730                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7731                         ;;
7732                 next*)
7733                         case "$osvers" in
7734                         4*)     dflt=y
7735                                 also='Building a shared libperl is needed for MAB support.'
7736                                 ;;
7737                         *)      dflt=n
7738                                 ;;
7739                         esac
7740                         ;;
7741                 *)      dflt=n
7742                         ;;
7743                 esac
7744                 ;;
7745         $define|true|[Yy]*)
7746                 dflt=y
7747                 ;;
7748         *)      dflt=n
7749                 ;;
7750         esac
7751         $cat << EOM
7752
7753 The perl executable is normally obtained by linking perlmain.c with
7754 libperl${_a}, any static extensions (usually just DynaLoader), and
7755 any other libraries needed on this system (such as -lm, etc.).  Since
7756 your system supports dynamic loading, it is probably possible to build
7757 a shared libperl.$so.  If you will have more than one executable linked
7758 to libperl.$so, this will significantly reduce the size of each
7759 executable, but it may have a noticeable effect on performance.  The
7760 default is probably sensible for your system.
7761 $also
7762
7763 EOM
7764         rp="Build a shared libperl.$so (y/n)"
7765         . ./myread
7766         case "$ans" in
7767         true|$define|[Yy]*)
7768                 useshrplib='true'  ;;
7769         *)      useshrplib='false' ;;
7770         esac
7771         ;;
7772 esac
7773
7774 case "$useshrplib" in
7775 true)
7776         case "$libperl" in
7777         '')
7778                 # Figure out a good name for libperl.so.  Since it gets stored in
7779                 # a version-specific architecture-dependent library, the version
7780                 # number isn't really that important, except for making cc/ld happy.
7781                 #
7782                 # A name such as libperl.so.3.1
7783                 majmin="libperl.$so.$patchlevel.$subversion"
7784                 # A name such as libperl.so.301
7785                 majonly=`echo $patchlevel $subversion |
7786                         $awk '{printf "%d%02d", $1, $2}'`
7787                 majonly=libperl.$so.$majonly
7788                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7789                 # rely on figuring it out from the naming of libc.
7790                 case "${osname}${osvers}" in
7791                 next4*)
7792                         dflt=libperl.5.$so
7793                         # XXX How handle the --version stuff for MAB?
7794                         ;;
7795                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7796                         dflt=libperl.$so
7797                         ;;
7798                 cygwin*) # ld links against an importlib
7799                         dflt=libperl$lib_ext
7800                         ;;
7801                 *)      # Try to guess based on whether libc has major.minor.
7802                         case "$libc" in
7803                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7804                         *libc.$so.[0-9]*) dflt=$majonly ;;
7805                         *)      dflt=libperl.$so ;;
7806                         esac
7807                         ;;
7808                 esac
7809                 ;;
7810         *)      dflt=$libperl
7811                 ;;
7812         esac
7813         cat << EOM
7814
7815 I need to select a good name for the shared libperl.  If your system uses
7816 library names with major and minor numbers, then you might want something
7817 like $majmin.  Alternatively, if your system uses a single version
7818 number for shared libraries, then you might want to use $majonly.
7819 Or, your system might be quite happy with a simple libperl.$so.
7820
7821 Since the shared libperl will get installed into a version-specific
7822 architecture-dependent directory, the version number of the shared perl
7823 library probably isn't important, so the default should be o.k.
7824
7825 EOM
7826         rp='What name do you want to give to the shared libperl?'
7827         . ./myread
7828         libperl=$ans
7829         echo "Ok, I'll use $libperl"
7830         ;;
7831 *)
7832         libperl="libperl${_a}"
7833         ;;
7834 esac
7835
7836 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7837 case "$shrpdir" in
7838 '') ;;
7839 *)      $cat >&4 <<EOM
7840 WARNING:  Use of the shrpdir variable for the installation location of
7841 the shared $libperl is not supported.  It was never documented and
7842 will not work in this version.  Let me (perlbug@perl.org)
7843 know of any problems this may cause.
7844
7845 EOM
7846         case "$shrpdir" in
7847         "$archlibexp/CORE")
7848                 $cat >&4 <<EOM
7849 But your current setting of $shrpdir is
7850 the default anyway, so it's harmless.
7851 EOM
7852                 ;;
7853         *)
7854                 $cat >&4 <<EOM
7855 Further, your current attempted setting of $shrpdir
7856 conflicts with the value of $archlibexp/CORE
7857 that installperl will use.
7858 EOM
7859                 ;;
7860         esac
7861         ;;
7862 esac
7863
7864 # How will the perl executable find the installed shared $libperl?
7865 # Add $xxx to ccdlflags.
7866 # If we can't figure out a command-line option, use $shrpenv to
7867 # set env LD_RUN_PATH.  The main perl makefile uses this.
7868 shrpdir=$archlibexp/CORE
7869 xxx=''
7870 tmp_shrpenv=''
7871 if "$useshrplib"; then
7872     case "$osname" in 
7873         aix)
7874                 # We'll set it in Makefile.SH...
7875                 ;;
7876         solaris)
7877                 xxx="-R $shrpdir"
7878                 ;;
7879         freebsd|netbsd|openbsd|interix|dragonfly)
7880                 xxx="-Wl,-R$shrpdir"
7881                 ;;
7882         bsdos|linux|irix*|dec_osf|gnu*)
7883                 xxx="-Wl,-rpath,$shrpdir"
7884                 ;;
7885         next)
7886                 # next doesn't like the default...
7887                 ;;
7888         beos)
7889                 # beos doesn't like the default, either.
7890                 ;;
7891         hpux*)
7892                 # hpux doesn't like the default, either.
7893                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7894                 ;;
7895         *)
7896                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7897                 ;;
7898         esac
7899         case "$xxx" in
7900         '') ;;
7901         *)      
7902                 # Only add $xxx if it isn't already in ccdlflags.
7903                 case " $ccdlflags " in
7904                 *" $xxx "*)     ;;
7905                 *)      ccdlflags="$ccdlflags $xxx"
7906                         cat <<EOM >&4
7907
7908 Adding $xxx to the flags
7909 passed to $ld so that the perl executable will find the 
7910 installed shared $libperl.
7911
7912 EOM
7913                         ;;
7914                 esac
7915                 ;;
7916         esac
7917 fi
7918 # Fix ccdlflags in AIX for building external extensions.
7919 # (For building Perl itself bare -bE:perl.exp is needed,
7920 #  Makefile.SH takes care of this.)
7921 case "$osname" in
7922 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7923 esac
7924 # Respect a hint or command-line value.
7925 case "$shrpenv" in
7926 '') shrpenv="$tmp_shrpenv" ;;
7927 esac
7928 case "$ldlibpthname" in
7929 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7930 none)   ldlibpthname='' ;;
7931 esac
7932
7933 : determine where manual pages are on this system
7934 echo " "
7935 case "$sysman" in
7936 '') 
7937         syspath='/usr/share/man/man1 /usr/man/man1'
7938         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7939         syspath="$syspath /usr/man/u_man/man1"
7940         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7941         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7942         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7943         sysman=`./loc . /usr/man/man1 $syspath`
7944         ;;
7945 esac
7946 if $test -d "$sysman"; then
7947         echo "System manual is in $sysman." >&4
7948 else
7949         echo "Could not find manual pages in source form." >&4
7950 fi
7951
7952 : determine where manual pages go
7953 set man1dir man1dir none
7954 eval $prefixit
7955 $cat <<EOM
7956
7957 $spackage has manual pages available in source form.
7958 EOM
7959 case "$nroff" in
7960 nroff)
7961         echo "However, you don't have nroff, so they're probably useless to you."
7962         case "$man1dir" in
7963         '') man1dir="none";;
7964         esac;;
7965 esac
7966 echo "If you don't want the manual sources installed, answer 'none'."
7967 case "$man1dir" in
7968 ' ') dflt=none
7969         ;;
7970 '')
7971         lookpath="$prefixexp/share/man/man1"
7972         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
7973         lookpath="$lookpath $prefixexp/man/p_man/man1"
7974         lookpath="$lookpath $prefixexp/man/u_man/man1"
7975         lookpath="$lookpath $prefixexp/man/man.1"
7976         case "$sysman" in
7977         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
7978         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
7979         esac
7980         set dflt
7981         eval $prefixup
7982         ;;
7983 *)  dflt="$man1dir"
7984         ;;
7985 esac
7986 echo " "
7987 fn=dn+~
7988 rp="Where do the main $spackage manual pages (source) go?"
7989 . ./getfile
7990 if $test "X$man1direxp" != "X$ansexp"; then
7991         installman1dir=''
7992 fi
7993 prefixvar=man1dir
7994 . ./setprefixvar
7995
7996 case "$man1dir" in
7997 '')     man1dir=' '
7998         installman1dir='';;
7999 esac
8000
8001 : What suffix to use on installed man pages
8002
8003 case "$man1dir" in
8004 ' ')
8005         man1ext='0'
8006         ;;
8007 *)
8008         rp="What suffix should be used for the main $spackage man pages?"
8009         case "$man1ext" in
8010         '')     case "$man1dir" in
8011                 *1)  dflt=1 ;;
8012                 *1p) dflt=1p ;;
8013                 *1pm) dflt=1pm ;;
8014                 *l) dflt=l;;
8015                 *n) dflt=n;;
8016                 *o) dflt=o;;
8017                 *p) dflt=p;;
8018                 *C) dflt=C;;
8019                 *L) dflt=L;;
8020                 *L1) dflt=L1;;
8021                 *) dflt=1;;
8022                 esac
8023                 ;;
8024         *)      dflt="$man1ext";;
8025         esac
8026         . ./myread
8027         man1ext="$ans"
8028         ;;
8029 esac
8030
8031 : see if we can have long filenames
8032 echo " "
8033 first=123456789abcdef
8034 $rm -f $first
8035 if (echo hi >$first) 2>/dev/null; then
8036         if $test -f 123456789abcde; then
8037                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8038                 val="$undef"
8039         else
8040                 echo 'You can have filenames longer than 14 characters.'>&4
8041                 val="$define"
8042         fi
8043 else
8044         $cat <<'EOM'
8045 You can't have filenames longer than 14 chars.
8046 You can't even think about them!
8047 EOM
8048         val="$undef"
8049 fi 
8050 set d_flexfnam
8051 eval $setvar
8052 $rm -rf 123456789abcde*
8053
8054 : determine where library module manual pages go
8055 set man3dir man3dir none
8056 eval $prefixit
8057 $cat <<EOM
8058
8059 $spackage has manual pages for many of the library modules.
8060 EOM
8061
8062 case "$nroff" in
8063 nroff)
8064         $cat <<'EOM'
8065 However, you don't have nroff, so they're probably useless to you.
8066 EOM
8067         case "$man3dir" in
8068         '') man3dir="none";;
8069         esac;;
8070 esac
8071
8072 case "$d_flexfnam" in
8073 undef)
8074         $cat <<'EOM'
8075 However, your system can't handle the long file names like File::Basename.3. 
8076 EOM
8077         case "$man3dir" in
8078         '') man3dir="none";;
8079         esac;;
8080 esac
8081
8082 echo "If you don't want the manual sources installed, answer 'none'."
8083 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8084 case "$man3dir" in
8085 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8086         if $test -d "$privlib/man/man3"; then
8087                 cat <<EOM >&4
8088
8089 WARNING:  Previous versions of perl installed man3 pages into
8090 $privlib/man/man3.  This version will suggest a 
8091 new default of $dflt.  
8092 EOM
8093                 tdflt=$dflt
8094                 dflt='n'
8095                 rp='Do you wish to preserve the old behavior?(y/n)'
8096                 . ./myread
8097                 case "$ans" in
8098                 y*) dflt="$privlib/man/man3" ;;
8099                 *)  dflt=$tdflt ;;
8100                 esac
8101     fi
8102         ;;
8103 *)      dflt="$man3dir" ;;
8104 esac
8105 case "$dflt" in
8106 ' ') dflt=none ;;
8107 esac
8108 echo " "
8109 fn=dn+~
8110 rp="Where do the $package library man pages (source) go?"
8111 . ./getfile
8112 prefixvar=man3dir
8113 . ./setprefixvar
8114
8115 case "$man3dir" in
8116 '')     man3dir=' '
8117         installman3dir='';;
8118 esac
8119
8120 : What suffix to use on installed man pages
8121 case "$man3dir" in
8122 ' ')
8123         man3ext='0'
8124         ;;
8125 *)
8126         rp="What suffix should be used for the $package library man pages?"
8127         case "$man3ext" in
8128         '')     case "$man3dir" in
8129                 *3)  dflt=3 ;;
8130                 *3p) dflt=3p ;;
8131                 *3pm) dflt=3pm ;;
8132                 *l) dflt=l;;
8133                 *n) dflt=n;;
8134                 *o) dflt=o;;
8135                 *p) dflt=p;;
8136                 *C) dflt=C;;
8137                 *L) dflt=L;;
8138                 *L3) dflt=L3;;
8139                 *) dflt=3;;
8140                 esac
8141                 ;;
8142         *)      dflt="$man3ext";;
8143         esac
8144         . ./myread
8145         man3ext="$ans"
8146         ;;
8147 esac
8148
8149 : see if we have to deal with yellow pages, now NIS.
8150 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8151         if $test -f /usr/etc/nibindd; then
8152                 echo " "
8153                 echo "I'm fairly confident you're on a NeXT."
8154                 echo " "
8155                 rp='Do you get the hosts file via NetInfo?'
8156                 dflt=y
8157                 case "$hostcat" in
8158                 nidump*) ;;
8159                 '') ;;
8160                 *) dflt=n;;
8161                 esac
8162                 . ./myread
8163                 case "$ans" in
8164                 y*) hostcat='nidump hosts .';;
8165                 *)      case "$hostcat" in
8166                         nidump*) hostcat='';;
8167                         esac
8168                         ;;
8169                 esac
8170         fi
8171         case "$hostcat" in
8172         nidump*) ;;
8173         *)
8174                 case "$hostcat" in
8175                 *ypcat*) dflt=y;;
8176                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8177                                 dflt=y
8178                         else
8179                                 dflt=n
8180                         fi;;
8181                 *) dflt=n;;
8182                 esac
8183                 echo " "
8184                 rp='Are you getting the hosts file via yellow pages?'
8185                 . ./myread
8186                 case "$ans" in
8187                 y*) hostcat='ypcat hosts';;
8188                 *) hostcat='cat /etc/hosts';;
8189                 esac
8190                 ;;
8191         esac
8192 fi
8193 case "$hostcat" in
8194 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8195 esac
8196 case "$groupcat" in
8197 '') test -f /etc/group && groupcat='cat /etc/group';;
8198 esac
8199 case "$passcat" in
8200 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8201 esac
8202
8203 : now get the host name
8204 echo " "
8205 echo "Figuring out host name..." >&4
8206 case "$myhostname" in
8207 '') cont=true
8208         echo 'Maybe "hostname" will work...'
8209         if tans=`sh -c hostname 2>&1` ; then
8210                 myhostname=$tans
8211                 phostname=hostname
8212                 cont=''
8213         fi
8214         ;;
8215 *) cont='';;
8216 esac
8217 if $test "$cont"; then
8218         if ./xenix; then
8219                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8220                 if tans=`cat /etc/systemid 2>&1` ; then
8221                         myhostname=$tans
8222                         phostname='cat /etc/systemid'
8223                         echo "Whadyaknow.  Xenix always was a bit strange..."
8224                         cont=''
8225                 fi
8226         elif $test -r /etc/systemid; then
8227                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8228         fi
8229 fi
8230 if $test "$cont"; then
8231         echo 'No, maybe "uuname -l" will work...'
8232         if tans=`sh -c 'uuname -l' 2>&1` ; then
8233                 myhostname=$tans
8234                 phostname='uuname -l'
8235         else
8236                 echo 'Strange.  Maybe "uname -n" will work...'
8237                 if tans=`sh -c 'uname -n' 2>&1` ; then
8238                         myhostname=$tans
8239                         phostname='uname -n'
8240                 else
8241                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8242                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8243                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8244                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8245                         else
8246                                 case "$myhostname" in
8247                                 '') echo "Does this machine have an identity crisis or something?"
8248                                         phostname='';;
8249                                 *)
8250                                         echo "Well, you said $myhostname before..."
8251                                         phostname='echo $myhostname';;
8252                                 esac
8253                         fi
8254                 fi
8255         fi
8256 fi
8257 case "$myhostname" in
8258 '') myhostname=noname ;;
8259 esac
8260 : you do not want to know about this
8261 set $myhostname
8262 myhostname=$1
8263
8264 : verify guess
8265 if $test "$myhostname" ; then
8266         dflt=y
8267         rp='Your host name appears to be "'$myhostname'".'" Right?"
8268         . ./myread
8269         case "$ans" in
8270         y*) ;;
8271         *) myhostname='';;
8272         esac
8273 fi
8274
8275 : bad guess or no guess
8276 while $test "X$myhostname" = X ; do
8277         dflt=''
8278         rp="Please type the (one word) name of your host:"
8279         . ./myread
8280         myhostname="$ans"
8281 done
8282
8283 : translate upper to lower if necessary
8284 case "$myhostname" in
8285 *[A-Z]*)
8286         echo "(Normalizing case in your host name)"
8287         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8288         ;;
8289 esac
8290
8291 case "$myhostname" in
8292 *.*)
8293         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8294         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8295         echo "(Trimming domain name from host name--host name is now $myhostname)"
8296         ;;
8297 *) case "$mydomain" in
8298         '')
8299                 {
8300                         test "X$hostcat" = "Xypcat hosts" &&
8301                         ypmatch "$myhostname" hosts 2>/dev/null |\
8302                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8303                         $test -s hosts
8304                 } || {
8305                         test "X$hostcat" != "X" &&
8306                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8307                                         /[       ]$myhostname[  . ]/p" > hosts
8308                 }
8309                 tmp_re="[       . ]"
8310                 if $test -f hosts; then
8311                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8312                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8313                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8314                                 hosts | $sort | $uniq | \
8315                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8316                         case `$echo X$dflt` in
8317                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8318                                 dflt=.
8319                                 ;;
8320                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8321                                 ;;
8322                         esac
8323                 else
8324                         echo "(I cannot locate a hosts database anywhere)"
8325                         dflt=.
8326                 fi
8327                 case "$dflt" in
8328                 .)
8329                         tans=`./loc resolv.conf X /etc /usr/etc`
8330                         if $test -f "$tans"; then
8331                                 echo "(Attempting domain name extraction from $tans)"
8332                                 dflt=.`$sed -n -e 's/   / /g' \
8333                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8334                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8335                                 case "$dflt" in
8336                                 .) dflt=.`$sed -n -e 's/        / /g' \
8337                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8338                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8339                                         ;;
8340                                 esac
8341                         fi
8342                         ;;
8343                 esac
8344                 case "$dflt" in
8345                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8346                         dflt=.`sh -c domainname 2>/dev/null`
8347                         case "$dflt" in
8348                         '') dflt='.';;
8349                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8350                         esac
8351                         ;;
8352                 esac
8353                 case "$dflt$osname" in
8354                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8355                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8356                         ;;
8357                 esac
8358                 case "$dflt" in
8359                 .) echo "(Lost all hope -- silly guess then)"
8360                         dflt='.nonet'
8361                         ;;
8362                 esac
8363                 $rm -f hosts
8364                 ;;
8365         *) dflt="$mydomain";;
8366         esac;;
8367 esac
8368 echo " "
8369 rp="What is your domain name?"
8370 . ./myread
8371 tans="$ans"
8372 case "$ans" in
8373 '') ;;
8374 .*) ;;
8375 *) tans=".$tans";;
8376 esac
8377 mydomain="$tans"
8378
8379 : translate upper to lower if necessary
8380 case "$mydomain" in
8381 *[A-Z]*)
8382         echo "(Normalizing case in your domain name)"
8383         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8384         ;;
8385 esac
8386
8387 : a little sanity check here
8388 case "$phostname" in
8389 '') ;;
8390 *)
8391         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8392         $myhostname$mydomain|$myhostname) ;;
8393         *)
8394                 case "$phostname" in
8395                 sed*)
8396                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8397                         ;;
8398                 *)
8399                         echo "(That doesn't agree with your $phostname command, by the way.)"
8400                         ;;
8401                 esac
8402         ;;
8403         esac
8404         ;;
8405 esac
8406
8407 $cat <<EOM
8408
8409 I need to get your e-mail address in Internet format if possible, i.e.
8410 something like user@host.domain. Please answer accurately since I have
8411 no easy means to double check it. The default value provided below
8412 is most probably close to reality but may not be valid from outside
8413 your organization...
8414
8415 EOM
8416 cont=x
8417 while test "$cont"; do
8418         case "$cf_email" in
8419         '') dflt="$cf_by@$myhostname$mydomain";;
8420         *) dflt="$cf_email";;
8421         esac
8422         rp='What is your e-mail address?'
8423         . ./myread
8424         cf_email="$ans"
8425         case "$cf_email" in
8426         *@*.*) cont='' ;;
8427         *)
8428                 rp='Address does not look like an Internet one.  Use it anyway?'
8429                 case "$fastread" in
8430                 yes) dflt=y ;;
8431                 *) dflt=n ;;
8432                 esac
8433                 . ./myread
8434                 case "$ans" in
8435                 y*) cont='' ;;
8436                 *) echo " " ;;
8437                 esac
8438                 ;;
8439         esac
8440 done
8441
8442 $cat <<EOM
8443
8444 If you or somebody else will be maintaining perl at your site, please
8445 fill in the correct e-mail address here so that they may be contacted
8446 if necessary. Currently, the "perlbug" program included with perl
8447 will send mail to this address in addition to perlbug@perl.org. You may
8448 enter "none" for no administrator.
8449
8450 EOM
8451 case "$perladmin" in
8452 '') dflt="$cf_email";;
8453 *) dflt="$perladmin";;
8454 esac
8455 rp='Perl administrator e-mail address'
8456 . ./myread
8457 perladmin="$ans"
8458
8459 : determine whether to only install version-specific parts.
8460 echo " "
8461 $cat <<EOM
8462 Do you want to install only the version-specific parts of the perl
8463 distribution?  Usually you do *not* want to do this.
8464 EOM
8465 case "$versiononly" in
8466 "$define"|[Yy]*|true) dflt='y' ;;
8467 *) dflt='n';
8468 esac
8469 rp="Do you want to install only the version-specific parts of perl?"
8470 . ./myread
8471 case "$ans" in
8472 [yY]*)  val="$define";;
8473 *)      val="$undef" ;;
8474 esac
8475 set versiononly
8476 eval $setvar
8477
8478 case "$versiononly" in
8479 "$define") inc_version_list=''
8480            inc_version_list_init=0
8481            ;;
8482 esac
8483
8484 : figure out how to guarantee perl startup
8485 case "$startperl" in
8486 '')
8487         case "$sharpbang" in
8488         *!)
8489                 $cat <<EOH
8490
8491 I can use the #! construct to start perl on your system. This will
8492 make startup of perl scripts faster, but may cause problems if you
8493 want to share those scripts and perl is not in a standard place
8494 ($binexp/perl) on all your platforms. The alternative is to force
8495 a shell by starting the script with a single ':' character.
8496
8497 EOH
8498                 case "$versiononly" in
8499                 "$define")      dflt="$binexp/perl$version";;  
8500                 *)              dflt="$binexp/perl";;
8501                 esac
8502                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8503                 . ./myread
8504                 case "$ans" in
8505                 none)   startperl=": # use perl";;
8506                 *)      startperl="#!$ans"
8507                         if $test 30 -lt `echo "$ans" | wc -c`; then
8508                                 $cat >&4 <<EOM
8509
8510 WARNING:  Some systems limit the #! command to 32 characters.
8511 If you experience difficulty running Perl scripts with #!, try
8512 installing Perl in a directory with a shorter pathname.
8513
8514 EOM
8515                         fi ;;
8516                 esac
8517                 ;;
8518         *) startperl=": # use perl"
8519                 ;;
8520         esac
8521         ;;
8522 esac
8523 echo "I'll use $startperl to start perl scripts."
8524
8525 : figure best path for perl in scripts
8526 case "$perlpath" in
8527 '')
8528         case "$versiononly" in
8529         "$define")      perlpath="$binexp/perl$version";;
8530         *)              perlpath="$binexp/perl";;
8531         esac
8532         case "$startperl" in
8533         *!*) ;;
8534         *)
8535                 $cat <<EOH
8536
8537 I will use the "eval 'exec'" idiom to start Perl on your system.
8538 I can use the full path of your Perl binary for this purpose, but
8539 doing so may cause problems if you want to share those scripts and
8540 Perl is not always in a standard place ($binexp/perl).
8541
8542 EOH
8543                 dflt="$binexp/perl"
8544                 rp="What path shall I use in \"eval 'exec'\"?"
8545                 . ./myread
8546                 perlpath="$ans"
8547                 ;;
8548         esac
8549         ;;
8550 esac
8551 case "$startperl" in
8552 *!*)    ;;
8553 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8554 esac
8555
8556 : determine where public executable scripts go
8557 set scriptdir scriptdir
8558 eval $prefixit
8559 case "$scriptdir" in
8560 '')
8561         dflt="$bin"
8562         : guess some guesses
8563         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8564         $test -d /usr/share/bin     && dflt=/usr/share/bin
8565         $test -d /usr/local/script  && dflt=/usr/local/script
8566         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8567         $test -d $prefixexp/script  && dflt=$prefixexp/script
8568         set dflt
8569         eval $prefixup
8570         ;;
8571 *)  dflt="$scriptdir"
8572         ;;
8573 esac
8574 $cat <<EOM
8575  
8576 Some installations have a separate directory just for executable scripts so
8577 that they can mount it across multiple architectures but keep the scripts in
8578 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8579 Or you might just lump your scripts in with all your other executables.
8580  
8581 EOM
8582 fn=d~
8583 rp='Where do you keep publicly executable scripts?'
8584 . ./getfile
8585 if $test "X$ansexp" != "X$scriptdirexp"; then
8586         installscript=''
8587 fi
8588 prefixvar=scriptdir
8589 . ./setprefixvar
8590 : A little fix up for an irregularly named variable.
8591 installscript="$installscriptdir"
8592
8593
8594 : determine where add-on public executables go
8595 case "$sitebin" in
8596 '')     dflt=$siteprefix/bin ;;
8597 *)      dflt=$sitebin ;;
8598 esac
8599 fn=d~
8600 rp='Pathname where the add-on public executables should be installed?'
8601 . ./getfile
8602 prefixvar=sitebin
8603 . ./setprefixvar
8604
8605 : determine where add-on html pages go
8606 : There is no standard location, so try to copy the previously-selected
8607 : directory structure for the core html pages.
8608 case "$sitehtml1dir" in
8609 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8610 *)     dflt=$sitehtml1dir ;;
8611 esac
8612 case "$dflt" in
8613 ''|' ') dflt=none ;;
8614 esac
8615 fn=dn+~
8616 rp='Pathname where the site-specific html pages should be installed?'
8617 . ./getfile
8618 prefixvar=sitehtml1dir
8619 . ./setprefixvar
8620
8621 : determine where add-on library html pages go
8622 : There is no standard location, so try to copy the previously-selected
8623 : directory structure for the core html pages.
8624 case "$sitehtml3dir" in
8625 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8626 *)     dflt=$sitehtml3dir ;;
8627 esac
8628 case "$dflt" in
8629 ''|' ') dflt=none ;;
8630 esac
8631 fn=dn+~
8632 rp='Pathname where the site-specific library html pages should be installed?'
8633 . ./getfile
8634 prefixvar=sitehtml3dir
8635 . ./setprefixvar
8636
8637 : determine where add-on manual pages go
8638 case "$siteman1dir" in
8639 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8640 *)      dflt=$siteman1dir ;;
8641 esac
8642 case "$dflt" in
8643 ''|' ') dflt=none ;;
8644 esac
8645 fn=dn+~
8646 rp='Pathname where the site-specific manual pages should be installed?'
8647 . ./getfile
8648 prefixvar=siteman1dir
8649 . ./setprefixvar
8650
8651 : determine where add-on library man pages go
8652 case "$siteman3dir" in
8653 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8654 *)      dflt=$siteman3dir ;;
8655 esac
8656 case "$dflt" in
8657 ''|' ') dflt=none ;;
8658 esac
8659 fn=dn+~
8660 rp='Pathname where the site-specific library manual pages should be installed?'
8661 . ./getfile
8662 prefixvar=siteman3dir
8663 . ./setprefixvar
8664
8665 : determine where add-on public executable scripts go
8666 case "$sitescript" in
8667 '')     dflt=$siteprefix/script
8668         $test -d $dflt || dflt=$sitebin ;;
8669 *)  dflt="$sitescript" ;;
8670 esac
8671 fn=d~+
8672 rp='Pathname where add-on public executable scripts should be installed?'
8673 . ./getfile
8674 prefixvar=sitescript
8675 . ./setprefixvar
8676
8677 case "$usefaststdio" in
8678 $define|true|[yY]*|'')
8679         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8680         case "$xversion" in
8681         [68])   dflt='y' ;;
8682         *)      dflt='n' ;;
8683         esac
8684         ;;
8685 *) dflt='n';;
8686 esac
8687 cat <<EOM
8688
8689 Perl can be built to use 'fast stdio', which means using the stdio
8690 library but also directly manipulating the stdio buffers to enable
8691 faster I/O.  Using stdio is better for backward compatibility (especially
8692 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8693 interface has been preferred instead of stdio.
8694
8695 If this doesn't make any sense to you, just accept the default '$dflt'.
8696 EOM
8697 rp='Use the "fast stdio" if available?'
8698 . ./myread
8699 case "$ans" in
8700 y|Y)    val="$define" ;;     
8701 *)      val="$undef" ;;
8702 esac
8703 set usefaststdio
8704 eval $setvar
8705
8706
8707 : define an is-a-typedef? function
8708 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8709 case "$inclist" in
8710 "") inclist="sys/types.h";;
8711 esac;
8712 eval "varval=\$$var";
8713 case "$varval" in
8714 "")
8715         $rm -f temp.c;
8716         for inc in $inclist; do
8717                 echo "#include <$inc>" >>temp.c;
8718         done;
8719         echo "#ifdef $type" >> temp.c;
8720         echo "printf(\"We have $type\");" >> temp.c;
8721         echo "#endif" >> temp.c;
8722         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8723         if $contains $type temp.E >/dev/null 2>&1; then
8724                 eval "$var=\$type";
8725         else
8726                 eval "$var=\$def";
8727         fi;
8728         $rm -f temp.?;;
8729 *) eval "$var=\$varval";;
8730 esac'
8731
8732 : define an is-a-typedef? function that prompts if the type is not available.
8733 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8734 case "$inclist" in
8735 "") inclist="sys/types.h";;
8736 esac;
8737 eval "varval=\$$var";
8738 case "$varval" in
8739 "")
8740         $rm -f temp.c;
8741         for inc in $inclist; do
8742                 echo "#include <$inc>" >>temp.c;
8743         done;
8744         echo "#ifdef $type" >> temp.c;
8745         echo "printf(\"We have $type\");" >> temp.c;
8746         echo "#endif" >> temp.c;
8747         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8748         echo " " ;
8749         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8750         if $contains $type temp.E >/dev/null 2>&1; then
8751                 echo "$type found." >&4;
8752                 eval "$var=\$type";
8753         else
8754                 echo "$type NOT found." >&4;
8755                 dflt="$def";
8756                 . ./myread ;
8757                 eval "$var=\$ans";
8758         fi;
8759         $rm -f temp.?;;
8760 *) eval "$var=\$varval";;
8761 esac'
8762
8763 : see what type lseek is declared as in the kernel
8764 rp="What is the type used for lseek's offset on this system?"
8765 set off_t lseektype long stdio.h sys/types.h
8766 eval $typedef_ask
8767
8768 echo " "
8769 echo "Checking to see how big your file offsets are..." >&4
8770 $cat >try.c <<EOCP
8771 #include <sys/types.h>
8772 #include <stdio.h>
8773 int main()
8774 {
8775     printf("%d\n", (int)sizeof($lseektype));
8776     return(0); 
8777 }
8778 EOCP
8779 set try
8780 if eval $compile_ok; then
8781         lseeksize=`$run ./try`
8782         echo "Your file offsets are $lseeksize bytes long."
8783 else
8784         dflt=$longsize
8785         echo " "
8786         echo "(I can't seem to compile the test program.  Guessing...)"
8787         rp="What is the size of your file offsets (in bytes)?"
8788         . ./myread
8789         lseeksize="$ans"
8790 fi
8791 $rm -f try.c try
8792
8793 : see what type file positions are declared as in the library
8794 rp="What is the type for file position used by fsetpos()?"
8795 set fpos_t fpostype long stdio.h sys/types.h
8796 eval $typedef_ask
8797
8798 echo " "
8799 case "$fpostype" in
8800 *_t) zzz="$fpostype"    ;;
8801 *)   zzz="fpos_t"       ;;
8802 esac
8803 echo "Checking the size of $zzz..." >&4 
8804 cat > try.c <<EOCP
8805 #include <sys/types.h>
8806 #include <stdio.h>
8807 #$i_stdlib I_STDLIB
8808 #ifdef I_STDLIB
8809 #include <stdlib.h>
8810 #endif
8811 int main() {
8812     printf("%d\n", (int)sizeof($fpostype));
8813     exit(0);
8814 }
8815 EOCP
8816 set try
8817 if eval $compile_ok; then
8818         yyy=`$run ./try`
8819         case "$yyy" in
8820         '')     fpossize=4
8821                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8822                 ;;
8823         *)      fpossize=$yyy
8824                 echo "Your $zzz is $fpossize bytes long."
8825                 ;;
8826         esac
8827 else
8828         dflt="$longsize"
8829         echo " " >&4
8830         echo "(I can't compile the test program.  Guessing...)" >&4
8831         rp="What is the size of your file positions (in bytes)?"
8832         . ./myread
8833         fpossize="$ans"
8834 fi
8835
8836 # Backward compatibility (uselfs is deprecated).
8837 case "$uselfs" in
8838 "$define"|true|[yY]*)
8839         cat <<EOM >&4
8840
8841 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8842 EOM
8843         uselargefiles="$define"
8844         ;;
8845 esac                          
8846
8847 case "$lseeksize:$fpossize" in
8848 8:8) cat <<EOM
8849
8850 You can have files larger than 2 gigabytes.
8851 EOM
8852    val="$define" ;;
8853 *)    case "$uselargefiles" in
8854    "$undef"|false|[nN]*) dflt='n' ;;
8855    *)   dflt='y' ;;
8856    esac
8857    cat <<EOM
8858
8859 Perl can be built to understand large files (files larger than 2 gigabytes)
8860 on some systems.  To do so, Configure can be run with -Duselargefiles.
8861
8862 If this doesn't make any sense to you, just accept the default '$dflt'.
8863 EOM
8864    rp='Try to understand large files, if available?'
8865    . ./myread
8866    case "$ans" in
8867    y|Y)         val="$define" ;;
8868    *)           val="$undef"  ;;
8869    esac
8870    ;;
8871 esac
8872 set uselargefiles
8873 eval $setvar
8874 : Look for a hint-file generated 'call-back-unit'.  If the
8875 : user has specified that a large files perl is to be built,
8876 : we may need to set or change some other defaults.
8877 if $test -f uselargefiles.cbu; then
8878         echo "Your platform has some specific hints regarding large file builds, using them..."
8879         . ./uselargefiles.cbu
8880 fi
8881 case "$uselargefiles" in
8882 "$define")
8883         if $test -f uselargefiles.cbu; then
8884                 echo " "
8885                 echo "Rechecking to see how big your file offsets are..." >&4
8886                 $cat >try.c <<EOCP
8887 #include <sys/types.h>
8888 #include <stdio.h>
8889 int main()
8890 {
8891     printf("%d\n", (int)sizeof($lseektype));
8892     return(0); 
8893 }
8894 EOCP
8895                 set try
8896                 if eval $compile_ok; then
8897                         lseeksize=`$run ./try`
8898                         $echo "Your file offsets are now $lseeksize bytes long."
8899                 else
8900                         dflt="$lseeksize"
8901                         echo " "
8902                         echo "(I can't seem to compile the test program.  Guessing...)"
8903                         rp="What is the size of your file offsets (in bytes)?"
8904                         . ./myread
8905                         lseeksize="$ans"
8906                 fi
8907                 case "$fpostype" in
8908                 *_t) zzz="$fpostype"    ;;
8909                 *)   zzz="fpos_t"       ;;
8910                 esac
8911                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8912                 $cat > try.c <<EOCP
8913 #include <sys/types.h>
8914 #include <stdio.h>
8915 #$i_stdlib I_STDLIB
8916 #ifdef I_STDLIB
8917 #include <stdlib.h>
8918 #endif
8919 int main() {
8920     printf("%d\n", (int)sizeof($fpostype));
8921     return(0);
8922 }
8923 EOCP
8924                 set try
8925                 if eval $compile_ok; then
8926                         yyy=`$run ./try`
8927                         dflt="$lseeksize"
8928                         case "$yyy" in
8929                         '')     echo " "
8930                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8931                                 ;;
8932                         *)      fpossize=$yyy
8933                                 echo " $fpossize bytes." >&4
8934                                 ;;
8935                         esac
8936                 else
8937                         dflt="$fpossize"
8938                         echo " "
8939                         echo "(I can't compile the test program.  Guessing...)" >&4
8940                         rp="What is the size of your file positions (in bytes)?"
8941                         . ./myread
8942                         fpossize="$ans"
8943                 fi
8944                 $rm -f try.c try
8945         fi
8946         ;;
8947 esac
8948
8949 # probably will refer to
8950 #   $archlib $privlib $sitearch $sitelib $vendorarch $vendorlib
8951 need_relocation=0
8952 userelocatableinc=undef
8953
8954 case "$vendorprefix" in
8955 '')     d_vendorbin="$undef"
8956         vendorbin=''
8957         vendorbinexp=''
8958         ;;
8959 *)      d_vendorbin="$define"
8960         : determine where vendor-supplied executables go.
8961         case "$vendorbin" in
8962         '') dflt=$vendorprefix/bin ;;
8963         *)      dflt="$vendorbin" ;;
8964         esac
8965         fn=d~+
8966         rp='Pathname for the vendor-supplied executables directory?'
8967         . ./getfile
8968         vendorbin="$ans"
8969         vendorbinexp="$ansexp"
8970         ;;
8971 esac
8972 prefixvar=vendorbin
8973 . ./installprefix
8974
8975 case "$vendorprefix" in
8976 '')     vendorhtml1dir=''
8977         vendorhtml1direxp=''
8978         ;;
8979 *)      : determine where vendor-supplied html pages go.
8980         : There is no standard location, so try to copy the previously-selected
8981         : directory structure for the core html pages.
8982         : XXX Better default suggestions would be welcome.
8983         case "$vendorhtml1dir" in
8984         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
8985         *)      dflt=$vendorhtml1dir ;;
8986         esac
8987         case "$dflt" in
8988         ''|' ') dflt=none ;;
8989         esac
8990         fn=dn+~
8991         rp='Pathname for the vendor-supplied html pages?'
8992         . ./getfile
8993         vendorhtml1dir="$ans"
8994         vendorhtml1direxp="$ansexp"
8995         ;;
8996 esac
8997 : Use ' ' for none so value is preserved next time through Configure
8998 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
8999 prefixvar=vendorhtml1dir
9000 . ./installprefix
9001
9002 case "$vendorprefix" in
9003 '')     vendorhtml3dir=''
9004         vendorhtml3direxp=''
9005         ;;
9006 *)      : determine where vendor-supplied module html pages go.
9007         : There is no standard location, so try to copy the previously-selected
9008         : directory structure for the core html pages.
9009         : XXX Better default suggestions would be welcome.
9010         case "$vendorhtml3dir" in
9011         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9012         *)      dflt=$vendorhtml3dir ;;
9013         esac
9014         case "$dflt" in
9015         ''|' ') dflt=none ;;
9016         esac
9017         fn=dn+~
9018         rp='Pathname for the vendor-supplied html pages?'
9019         . ./getfile
9020         vendorhtml3dir="$ans"
9021         vendorhtml3direxp="$ansexp"
9022         ;;
9023 esac
9024 : Use ' ' for none so value is preserved next time through Configure
9025 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9026 prefixvar=vendorhtml3dir
9027 . ./installprefix
9028
9029 case "$vendorprefix" in
9030 '')     vendorman1dir=''
9031         vendorman1direxp=''
9032         ;;
9033 *)      : determine where vendor-supplied manual pages go.
9034         case "$vendorman1dir" in
9035         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9036         *)      dflt=$vendorman1dir ;;
9037         esac
9038         case "$dflt" in
9039         ''|' ') dflt=none ;;
9040         esac
9041         fn=nd~+
9042         rp='Pathname for the vendor-supplied manual section 1 pages?'
9043         . ./getfile
9044         vendorman1dir="$ans"
9045         vendorman1direxp="$ansexp"
9046         ;;
9047 esac
9048 : Use ' ' for none so value is preserved next time through Configure
9049 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9050 prefixvar=vendorman1dir
9051 . ./installprefix
9052
9053 case "$vendorprefix" in
9054 '')     vendorman3dir=''
9055         vendorman3direxp=''
9056         ;;
9057 *)      : determine where vendor-supplied module manual pages go.
9058         case "$vendorman3dir" in
9059         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9060         *)      dflt=$vendorman3dir ;;
9061         esac
9062         case "$dflt" in
9063         ''|' ') dflt=none ;;
9064         esac
9065         fn=nd~+
9066         rp='Pathname for the vendor-supplied manual section 3 pages?'
9067         . ./getfile
9068         vendorman3dir="$ans"
9069         vendorman3direxp="$ansexp"
9070         ;;
9071 esac
9072 : Use ' ' for none so value is preserved next time through Configure
9073 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9074 prefixvar=vendorman3dir
9075 . ./installprefix
9076
9077 case "$vendorprefix" in
9078 '')     d_vendorscript="$undef"
9079         vendorscript=''
9080         vendorscriptexp=''
9081         ;;
9082 *)      d_vendorscript="$define"
9083         : determine where vendor-supplied scripts go.
9084         case "$vendorscript" in
9085         '')     dflt=$vendorprefix/script
9086                 $test -d $dflt || dflt=$vendorbin ;;
9087         *)  dflt="$vendorscript" ;;
9088         esac
9089         $cat <<EOM
9090
9091 The installation process will create a directory for 
9092 vendor-supplied scripts.
9093
9094 EOM
9095         fn=d~+
9096         rp='Pathname for the vendor-supplied scripts directory?'
9097         . ./getfile
9098         vendorscript="$ans"
9099         vendorscriptexp="$ansexp"
9100         ;;
9101 esac
9102 prefixvar=vendorscript
9103 . ./installprefix
9104
9105 : see if qgcvt exists
9106 set qgcvt d_qgcvt
9107 eval $inlibc
9108
9109 echo " "
9110
9111 if $test X"$d_longdbl" = X"$define"; then
9112
9113 echo "Checking how to print long doubles..." >&4
9114
9115 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9116         $cat >try.c <<'EOCP'
9117 #include <sys/types.h>
9118 #include <stdio.h>
9119 int main() {
9120   double d = 123.456;
9121   printf("%.3f\n", d);
9122 }
9123 EOCP
9124         set try
9125         if eval $compile; then
9126                 yyy=`$run ./try`
9127                 case "$yyy" in
9128                 123.456)
9129                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9130                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9131                         echo "We will use %f."
9132                         ;;
9133                 esac
9134         fi
9135 fi
9136
9137 if $test X"$sPRIfldbl" = X; then
9138         $cat >try.c <<'EOCP'
9139 #include <sys/types.h>
9140 #include <stdio.h>
9141 int main() {
9142   long double d = 123.456;
9143   printf("%.3Lf\n", d);
9144 }
9145 EOCP
9146         set try
9147         if eval $compile; then
9148                 yyy=`$run ./try`
9149                 case "$yyy" in
9150                 123.456)
9151                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9152                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9153                         echo "We will use %Lf."
9154                         ;;
9155                 esac
9156         fi
9157 fi
9158
9159 if $test X"$sPRIfldbl" = X; then
9160         $cat >try.c <<'EOCP'
9161 #include <sys/types.h>
9162 #include <stdio.h>
9163 int main() {
9164   long double d = 123.456;
9165   printf("%.3llf\n", d);
9166 }
9167 EOCP
9168         set try
9169         if eval $compile; then
9170                 yyy=`$run ./try`
9171                 case "$yyy" in
9172                 123.456)
9173                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9174                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9175                         echo "We will use %llf."
9176                         ;;
9177                 esac
9178         fi
9179 fi
9180
9181 if $test X"$sPRIfldbl" = X; then
9182         $cat >try.c <<'EOCP'
9183 #include <sys/types.h>
9184 #include <stdio.h>
9185 int main() {
9186   long double d = 123.456;
9187   printf("%.3lf\n", d);
9188 }
9189 EOCP
9190         set try
9191         if eval $compile; then
9192                 yyy=`$run ./try`
9193                 case "$yyy" in
9194                 123.456)
9195                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9196                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9197                         echo "We will use %lf."
9198                         ;;
9199                 esac
9200         fi
9201 fi
9202
9203 if $test X"$sPRIfldbl" = X; then
9204         echo "Cannot figure out how to print long doubles." >&4
9205 else
9206         sSCNfldbl=$sPRIfldbl    # expect consistency
9207 fi
9208
9209 $rm -f try try.*
9210
9211 fi # d_longdbl
9212
9213 case "$sPRIfldbl" in
9214 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9215         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9216         d_SCNfldbl="$undef";
9217         ;;
9218 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9219         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9220         d_SCNfldbl="$define";
9221         ;;
9222 esac
9223
9224 : Check how to convert floats to strings.
9225
9226 if test "X$d_Gconvert" = X; then
9227
9228 echo " "
9229 echo "Checking for an efficient way to convert floats to strings."
9230 echo " " > try.c
9231 case "$uselongdouble" in
9232 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9233 esac
9234 case "$d_longdbl" in
9235 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9236 esac
9237 case "$d_PRIgldbl" in
9238 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9239 esac
9240 $cat >>try.c <<EOP
9241 #ifdef TRY_gconvert
9242 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9243 char *myname = "gconvert";
9244 #endif
9245 #ifdef TRY_gcvt
9246 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9247 char *myname = "gcvt";
9248 #endif
9249 #ifdef TRY_qgcvt
9250 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9251 char *myname = "qgcvt";
9252 #define DOUBLETYPE long double
9253 #endif
9254 #ifdef TRY_sprintf
9255 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9256 #ifdef HAS_PRIgldbl
9257 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9258 #else
9259 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9260 #endif
9261 #else
9262 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9263 #endif
9264 char *myname = "sprintf";
9265 #endif
9266
9267 #ifndef DOUBLETYPE
9268 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9269 #define DOUBLETYPE long double
9270 #else
9271 #define DOUBLETYPE double
9272 #endif
9273 #endif
9274
9275 #include <stdio.h>
9276
9277 #define I_STDLIB $i_stdlib
9278 #ifdef I_STDLIB
9279 #include <stdlib.h>
9280 #endif
9281
9282 int
9283 checkit(expect, got)
9284 char *expect;
9285 char *got;
9286 {
9287     if (strcmp(expect, got)) {
9288                 printf("%s oddity:  Expected %s, got %s\n",
9289                         myname, expect, got);
9290                 exit(1);
9291         }
9292 }
9293
9294 int main()
9295
9296         char buf[64]; 
9297         buf[63] = '\0';
9298
9299         /* This must be 1st test on (which?) platform */
9300         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9301         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9302         checkit("0.1", buf);
9303
9304         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9305         checkit("0.01", buf);
9306
9307         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9308         checkit("0.001", buf);
9309
9310         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9311         checkit("0.0001", buf);
9312
9313         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9314         if (strlen(buf) > 5)
9315             checkit("9e-005", buf); /* for Microsoft ?? */
9316         else
9317             checkit("9e-05", buf);
9318
9319         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9320         checkit("1", buf);
9321
9322         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9323         checkit("1.1", buf);
9324
9325         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9326         checkit("1.01", buf);
9327
9328         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9329         checkit("1.001", buf);
9330
9331         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9332         checkit("1.0001", buf);
9333
9334         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9335         checkit("1.00001", buf);
9336
9337         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9338         checkit("1.000001", buf);
9339
9340         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9341         checkit("0", buf);
9342
9343         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9344         checkit("-1", buf);
9345
9346         /* Some Linux gcvt's give 1.e+5 here. */
9347         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9348         checkit("100000", buf);
9349         
9350         /* Some Linux gcvt's give -1.e+5 here. */
9351         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9352         checkit("-100000", buf);
9353
9354         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9355         checkit("123.456", buf);
9356
9357         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9358         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9359         /* 34 should be enough to scare even long double
9360          * places into using the e notation. */
9361         if (strlen(buf) > 5)
9362             checkit("1e+034", buf); /* for Microsoft */
9363         else
9364             checkit("1e+34", buf);
9365
9366         /* For Perl, if you add additional tests here, also add them to
9367          * t/base/num.t for benefit of platforms not using Configure or
9368          * overriding d_Gconvert */
9369
9370         exit(0);
9371 }
9372 EOP
9373 : first add preferred functions to our list
9374 xxx_list=""
9375 for xxx_convert in $gconvert_preference; do
9376     case $xxx_convert in
9377     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9378     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9379     esac 
9380 done
9381 : then add any others
9382 for xxx_convert in gconvert gcvt sprintf; do
9383     case "$xxx_list" in
9384     *$xxx_convert*) ;;
9385     *) xxx_list="$xxx_list $xxx_convert" ;;
9386     esac 
9387 done
9388
9389 case "$d_longdbl$uselongdouble" in
9390 "$define$define")
9391     : again, add prefered functions to our list first
9392     xxx_ld_list=""
9393     for xxx_convert in $gconvert_ld_preference; do
9394         case $xxx_convert in
9395         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9396         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9397         esac
9398     done
9399     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9400     for xxx_convert in qgcvt sprintf $xxx_list; do
9401         case "$xxx_ld_list" in
9402         $xxx_convert*|*" $xxx_convert"*) ;;
9403         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9404         esac
9405     done
9406     : if sprintf cannot do long doubles, move it to the end
9407     if test "$d_PRIgldbl" != "$define"; then
9408         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9409     fi
9410     : if no qgcvt, remove it
9411     if test "$d_qgcvt" != "$define"; then
9412         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9413     fi
9414     : use the ld_list
9415     xxx_list="$xxx_ld_list"
9416     ;;
9417 esac
9418
9419 for xxx_convert in $xxx_list; do
9420         echo "Trying $xxx_convert..."
9421         $rm -f try try$_o
9422         set try -DTRY_$xxx_convert
9423         if eval $compile; then
9424                 echo "$xxx_convert() found." >&4
9425                 if $run ./try; then
9426                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9427                         break;
9428                 else
9429                         echo "...But $xxx_convert didn't work as I expected."
9430                         xxx_convert=''
9431                 fi
9432         else
9433                 echo "$xxx_convert NOT found." >&4
9434         fi
9435 done
9436
9437 if test X$xxx_convert = X; then
9438     echo "*** WHOA THERE!!! ***" >&4
9439     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9440     xxx_convert=sprintf
9441 fi
9442
9443 case "$xxx_convert" in
9444 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9445 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9446 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9447 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9448    "$define$define$define")
9449       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9450    "$define$define$undef")
9451       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9452    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9453    esac
9454    ;;  
9455 esac
9456
9457 fi
9458
9459 : see if _fwalk exists
9460 set fwalk d__fwalk
9461 eval $inlibc
9462
9463 : Initialize h_fcntl
9464 h_fcntl=false
9465
9466 : Initialize h_sysfile
9467 h_sysfile=false
9468
9469 : access call always available on UNIX
9470 set access d_access
9471 eval $inlibc
9472
9473 : locate the flags for 'access()'
9474 case "$d_access" in
9475 "$define")
9476         echo " "
9477         $cat >access.c <<EOCP
9478 #include <sys/types.h>
9479 #ifdef I_FCNTL
9480 #include <fcntl.h>
9481 #endif
9482 #ifdef I_SYS_FILE
9483 #include <sys/file.h>
9484 #endif
9485 #ifdef I_UNISTD
9486 #include <unistd.h>
9487 #endif
9488 #$i_stdlib I_STDLIB
9489 #ifdef I_STDLIB
9490 #include <stdlib.h>
9491 #endif
9492 int main() {
9493         exit(R_OK);
9494 }
9495 EOCP
9496         : check sys/file.h first, no particular reason here
9497         if $test `./findhdr sys/file.h` && \
9498                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9499                 h_sysfile=true;
9500                 echo "<sys/file.h> defines the *_OK access constants." >&4
9501         elif $test `./findhdr fcntl.h` && \
9502                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9503                 h_fcntl=true;
9504                 echo "<fcntl.h> defines the *_OK access constants." >&4
9505         elif $test `./findhdr unistd.h` && \
9506                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9507                 echo "<unistd.h> defines the *_OK access constants." >&4
9508         else
9509                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9510         fi
9511         ;;
9512 esac
9513 $rm -f access*
9514
9515 : see if accessx exists
9516 set accessx d_accessx
9517 eval $inlibc
9518
9519 : see if aintl exists
9520 set aintl d_aintl
9521 eval $inlibc
9522
9523 : see if alarm exists
9524 set alarm d_alarm
9525 eval $inlibc
9526
9527 : see if POSIX threads are available
9528 set pthread.h i_pthread
9529 eval $inhdr
9530
9531 : define a fucntion to check prototypes
9532 $cat > protochk <<EOSH
9533 $startsh
9534 cc="$cc"
9535 optimize="$optimize"
9536 ccflags="$ccflags"
9537 prototype="$prototype"
9538 define="$define"
9539 rm=$rm
9540 usethreads=$usethreads
9541 i_pthread=$i_pthread
9542 pthread_h_first=$pthread_h_first
9543 EOSH
9544
9545 $cat >> protochk <<'EOSH'
9546
9547 $rm -f try.c
9548 foo="$1"
9549 shift
9550 while test $# -ge 2; do
9551         case "$1" in
9552                 $define) echo "#include <$2>" >> try.c ;;
9553                 literal) echo "$2" >> try.c ;;
9554         esac
9555     # Extra magic for the benefit of systems that need pthread.h
9556     # to be included early to correctly detect threadsafe functions.
9557     # Such functions must guarantee themselves, though, that the usethreads
9558     # and i_pthread have been defined, before calling protochk.
9559     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9560         echo "#include <pthread.h>" >> try.c
9561         pthread_h_done=yes
9562     fi
9563     shift 2
9564 done
9565 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9566 cat >> try.c <<'EOCP'
9567 #ifdef CAN_PROTOTYPE
9568 #define _(args) args
9569 #else
9570 #define _(args) ()
9571 #endif
9572 EOCP
9573 echo "$foo" >> try.c
9574 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9575 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9576 status=$?
9577 $rm -f try.[co]
9578 exit $status
9579 EOSH
9580 chmod +x protochk
9581 $eunicefix protochk
9582
9583 hasproto='varname=$1; func=$2; shift; shift;
9584 while $test $# -ge 2; do
9585         case "$1" in
9586         $define) echo "#include <$2>";;
9587         esac ;
9588     shift 2;
9589 done > try.c;
9590 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9591 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9592         echo "$func() prototype found.";
9593         val="$define";
9594 else
9595         echo "$func() prototype NOT found.";
9596         val="$undef";
9597 fi;
9598 set $varname;
9599 eval $setvar;
9600 $rm -f try.c tryout.c'
9601
9602 : see if sys/types.h has to be included
9603 set sys/types.h i_systypes
9604 eval $inhdr
9605
9606 : see if sys/select.h has to be included
9607 set sys/select.h i_sysselct
9608 eval $inhdr
9609
9610 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9611 while $test $# -ge 2; do
9612         case "$1" in
9613         $define) echo "#include <$2>";;
9614         esac ;
9615     shift 2;
9616 done > try.c;
9617 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9618 set try;
9619 if eval $compile; then
9620         val="$define";
9621 else
9622         val="$undef";
9623 fi;
9624 set $varname;
9625 eval $setvar;
9626 $rm -f try.c try.o'
9627
9628 : see if we should include time.h, sys/time.h, or both
9629 echo " "
9630 if test "X$timeincl" = X; then
9631         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9632         $echo $n "I'm now running the test program...$c"
9633         $cat >try.c <<EOCP
9634 #include <sys/types.h>
9635 #ifdef I_TIME
9636 #include <time.h>
9637 #endif
9638 #ifdef I_SYSTIME
9639 #ifdef SYSTIMEKERNEL
9640 #define KERNEL
9641 #endif
9642 #include <sys/time.h>
9643 #endif
9644 #ifdef I_SYSSELECT
9645 #include <sys/select.h>
9646 #endif
9647 #$i_stdlib I_STDLIB
9648 #ifdef I_STDLIB
9649 #include <stdlib.h>
9650 #endif
9651 int main()
9652 {
9653         struct tm foo;
9654 #ifdef S_TIMEVAL
9655         struct timeval bar;
9656 #endif
9657 #ifdef S_TIMEZONE
9658         struct timezone tzp;
9659 #endif
9660         if (foo.tm_sec == foo.tm_sec)
9661                 exit(0);
9662 #ifdef S_TIMEVAL
9663         if (bar.tv_sec == bar.tv_sec)
9664                 exit(0);
9665 #endif
9666         exit(1);
9667 }
9668 EOCP
9669         flags=''
9670         for s_timezone in '-DS_TIMEZONE' ''; do
9671         sysselect=''
9672         for s_timeval in '-DS_TIMEVAL' ''; do
9673         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9674         for i_time in '' '-DI_TIME'; do
9675         for i_systime in '-DI_SYSTIME' ''; do
9676                 case "$flags" in
9677                 '') $echo $n ".$c"
9678                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9679                         if eval $compile; then
9680                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9681                                 shift
9682                                 flags="$*"
9683                                 echo " "
9684                                 $echo $n "Succeeded with $flags$c"
9685                         fi
9686                         ;;
9687                 esac
9688         done
9689         done
9690         done
9691         done
9692         done
9693         timeincl=''
9694         echo " "
9695         case "$flags" in
9696         *SYSTIMEKERNEL*) i_systimek="$define"
9697                 timeincl=`./findhdr sys/time.h`
9698                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9699         *) i_systimek="$undef";;
9700         esac
9701         case "$flags" in
9702         *I_TIME*) i_time="$define"
9703                 timeincl=`./findhdr time.h`" $timeincl"
9704                 echo "We'll include <time.h>." >&4;;
9705         *) i_time="$undef";;
9706         esac
9707         case "$flags" in
9708         *I_SYSTIME*) i_systime="$define"
9709                 timeincl=`./findhdr sys/time.h`" $timeincl"
9710                 echo "We'll include <sys/time.h>." >&4;;
9711         *) i_systime="$undef";;
9712         esac
9713         $rm -f try.c try
9714 fi
9715 : see if struct tm knows about tm_zone
9716 case "$i_systime$i_time" in
9717 *$define*) 
9718         echo " "
9719         echo "Checking to see if your struct tm has tm_zone field..." >&4
9720         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9721         eval $hasfield
9722         ;;
9723 *)      val="$undef"
9724         set d_tm_tm_zone
9725         eval $setvar
9726         ;;
9727 esac
9728 case "$d_tm_tm_zone" in
9729 "$define")      echo "Yes, it does."   ;;
9730 *)              echo "No, it doesn't." ;;
9731 esac
9732 : see if struct tm knows about tm_gmtoff
9733 case "$i_systime$i_time" in
9734 *$define*) 
9735         echo " "
9736         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9737         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9738         eval $hasfield
9739         ;;
9740 *)      val="$undef"
9741         set d_tm_tm_gmtoff
9742         eval $setvar
9743         ;;
9744 esac
9745 case "$d_tm_tm_gmtoff" in
9746 "$define")      echo "Yes, it does."   ;;
9747 *)              echo "No, it doesn't." ;;
9748 esac
9749
9750 : see if asctime_r exists
9751 set asctime_r d_asctime_r
9752 eval $inlibc
9753 case "$d_asctime_r" in
9754 "$define")
9755         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9756         case "$d_asctime_r_proto:$usethreads" in
9757         ":define")      d_asctime_r_proto=define
9758                 set d_asctime_r_proto asctime_r $hdrs
9759                 eval $hasproto ;;
9760         *)      ;;
9761         esac
9762         case "$d_asctime_r_proto" in
9763         define)
9764         case "$asctime_r_proto" in
9765         ''|0) try='char* asctime_r(const struct tm*, char*);'
9766         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9767         esac
9768         case "$asctime_r_proto" in
9769         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9770         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9771         esac
9772         case "$asctime_r_proto" in
9773         ''|0) try='int asctime_r(const struct tm*, char*);'
9774         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9775         esac
9776         case "$asctime_r_proto" in
9777         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9778         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9779         esac
9780         case "$asctime_r_proto" in
9781         ''|0)   d_asctime_r=undef
9782                 asctime_r_proto=0
9783                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9784         * )     case "$asctime_r_proto" in
9785                 REENTRANT_PROTO*) ;;
9786                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9787                 esac
9788                 echo "Prototype: $try" ;;
9789         esac
9790         ;;
9791         *)      case "$usethreads" in
9792                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9793                 esac
9794                 d_asctime_r=undef
9795                 asctime_r_proto=0
9796                 ;;
9797         esac
9798         ;;
9799 *)      asctime_r_proto=0
9800         ;;
9801 esac
9802
9803 : see if atolf exists
9804 set atolf d_atolf
9805 eval $inlibc
9806
9807 : see if atoll exists
9808 set atoll d_atoll
9809 eval $inlibc
9810
9811 : Look for GCC-style attribute format
9812 case "$d_attribute_format" in
9813 '')
9814 echo " "
9815 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9816 $cat >attrib.c <<'EOCP'
9817 #include <stdio.h>
9818 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9819 EOCP
9820 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9821         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9822                 echo "Your C compiler doesn't support __attribute__((format))."
9823                 val="$undef"
9824         else
9825                 echo "Your C compiler supports __attribute__((format))."
9826                 val="$define"
9827         fi
9828 else
9829         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9830         val="$undef"
9831 fi
9832 ;;
9833 *) val="$d_attribute_format" ;;
9834 esac
9835 set d_attribute_format
9836 eval $setvar
9837 $rm -f attrib*
9838
9839 : Look for GCC-style attribute malloc
9840 case "$d_attribute_malloc" in
9841 '')
9842 echo " "
9843 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9844 $cat >attrib.c <<'EOCP'
9845 #include <stdio.h>
9846 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9847 EOCP
9848 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9849         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9850                 echo "Your C compiler doesn't support __attribute__((malloc))."
9851                 val="$undef"
9852         else
9853                 echo "Your C compiler supports __attribute__((malloc))."
9854                 val="$define"
9855         fi
9856 else
9857         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9858         val="$undef"
9859 fi
9860 ;;
9861 *) val="$d_attribute_malloc" ;;
9862 esac
9863 set d_attribute_malloc
9864 eval $setvar
9865 $rm -f attrib*
9866
9867 : Look for GCC-style attribute nonnull
9868 case "$d_attribute_nonnull" in
9869 '')
9870 echo " "
9871 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9872 $cat >attrib.c <<'EOCP'
9873 #include <stdio.h>
9874 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9875 EOCP
9876 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9877         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9878                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9879                 val="$undef"
9880         else
9881                 echo "Your C compiler supports __attribute__((nonnull))."
9882                 val="$define"
9883         fi
9884 else
9885         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9886         val="$undef"
9887 fi
9888 ;;
9889 *) val="$d_attribute_nonnull" ;;
9890 esac
9891 set d_attribute_nonnull
9892 eval $setvar
9893 $rm -f attrib*
9894
9895 : Look for GCC-style attribute noreturn
9896 case "$d_attribute_noreturn" in
9897 '')
9898 echo " "
9899 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9900 $cat >attrib.c <<'EOCP'
9901 #include <stdio.h>
9902 void fall_over_dead( void ) __attribute__((noreturn));
9903 EOCP
9904 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9905         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9906                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9907                 val="$undef"
9908         else
9909                 echo "Your C compiler supports __attribute__((noreturn))."
9910                 val="$define"
9911         fi
9912 else
9913         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9914         val="$undef"
9915 fi
9916 ;;
9917 *) val="$d_attribute_noreturn" ;;
9918 esac
9919 set d_attribute_noreturn
9920 eval $setvar
9921 $rm -f attrib*
9922
9923 : Look for GCC-style attribute pure
9924 case "$d_attribute_pure" in
9925 '')
9926 echo " "
9927 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
9928 $cat >attrib.c <<'EOCP'
9929 #include <stdio.h>
9930 int square( int n ) __attribute__((pure));
9931 EOCP
9932 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9933         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9934                 echo "Your C compiler doesn't support __attribute__((pure))."
9935                 val="$undef"
9936         else
9937                 echo "Your C compiler supports __attribute__((pure))."
9938                 val="$define"
9939         fi
9940 else
9941         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9942         val="$undef"
9943 fi
9944 ;;
9945 *) val="$d_attribute_pure" ;;
9946 esac
9947 set d_attribute_pure
9948 eval $setvar
9949 $rm -f attrib*
9950
9951 : Look for GCC-style attribute unused
9952 case "$d_attribute_unused" in
9953 '')
9954 echo " "
9955 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
9956 $cat >attrib.c <<'EOCP'
9957 #include <stdio.h>
9958 int do_something( int dummy __attribute__((unused)), int n );
9959 EOCP
9960 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9961         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9962                 echo "Your C compiler doesn't support __attribute__((unused))."
9963                 val="$undef"
9964         else
9965                 echo "Your C compiler supports __attribute__((unused))."
9966                 val="$define"
9967         fi
9968 else
9969         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9970         val="$undef"
9971 fi
9972 ;;
9973 *) val="$d_attribute_unused" ;;
9974 esac
9975 set d_attribute_unused
9976 eval $setvar
9977 $rm -f attrib*
9978
9979 : Look for GCC-style attribute warn_unused_result
9980 case "$d_attribute_warn_unused_result" in
9981 '')
9982 echo " "
9983 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
9984 $cat >attrib.c <<'EOCP'
9985 #include <stdio.h>
9986 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
9987 EOCP
9988 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9989         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9990                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
9991                 val="$undef"
9992         else
9993                 echo "Your C compiler supports __attribute__((warn_unused_result))."
9994                 val="$define"
9995         fi
9996 else
9997         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9998         val="$undef"
9999 fi
10000 ;;
10001 *) val="$d_attribute_warn_unused_result" ;;
10002 esac
10003 set d_attribute_warn_unused_result
10004 eval $setvar
10005 $rm -f attrib*
10006
10007 : see if bcmp exists
10008 set bcmp d_bcmp
10009 eval $inlibc
10010
10011 : see if bcopy exists
10012 set bcopy d_bcopy
10013 eval $inlibc
10014
10015 : see if this is a unistd.h system
10016 set unistd.h i_unistd
10017 eval $inhdr
10018
10019 : see if getpgrp exists
10020 set getpgrp d_getpgrp
10021 eval $inlibc
10022
10023 case "$d_getpgrp" in
10024 "$define")
10025         echo " "
10026         echo "Checking to see which flavor of getpgrp is in use..."
10027         $cat >try.c <<EOP
10028 #$i_unistd I_UNISTD
10029 #include <sys/types.h>
10030 #ifdef I_UNISTD
10031 #  include <unistd.h>
10032 #endif
10033 #$i_stdlib I_STDLIB
10034 #ifdef I_STDLIB
10035 #include <stdlib.h>
10036 #endif
10037 int main()
10038 {
10039         if (getuid() == 0) {
10040                 printf("(I see you are running Configure as super-user...)\n");
10041                 setuid(1);
10042         }
10043 #ifdef TRY_BSD_PGRP
10044         if (getpgrp(1) == 0)
10045                 exit(0);
10046 #else
10047         if (getpgrp() > 0)
10048                 exit(0);
10049 #endif
10050         exit(1);
10051 }
10052 EOP
10053         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10054                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10055                 val="$define"
10056         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10057                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10058                 val="$undef"
10059         else
10060                 echo "I can't seem to compile and run the test program."
10061                 if ./usg; then
10062                         xxx="a USG one, i.e. you use getpgrp()."
10063                 else
10064                         # SVR4 systems can appear rather BSD-ish.
10065                         case "$i_unistd" in
10066                         $undef)
10067                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10068                                 val="$define"
10069                                 ;;
10070                         $define)
10071                                 xxx="probably a USG one, i.e. you use getpgrp()."
10072                                 val="$undef"
10073                                 ;;
10074                         esac
10075                 fi
10076                 echo "Assuming your getpgrp is $xxx" >&4
10077         fi
10078         ;;
10079 *) val="$undef";;
10080 esac
10081 set d_bsdgetpgrp
10082 eval $setvar
10083 $rm -f try try.*
10084
10085 : see if setpgrp exists
10086 set setpgrp d_setpgrp
10087 eval $inlibc
10088
10089 case "$d_setpgrp" in
10090 "$define")
10091         echo " "
10092         echo "Checking to see which flavor of setpgrp is in use..."
10093         $cat >try.c <<EOP
10094 #$i_unistd I_UNISTD
10095 #include <sys/types.h>
10096 #ifdef I_UNISTD
10097 #  include <unistd.h>
10098 #endif
10099 #$i_stdlib I_STDLIB
10100 #ifdef I_STDLIB
10101 #include <stdlib.h>
10102 #endif
10103 int main()
10104 {
10105         if (getuid() == 0) {
10106                 printf("(I see you are running Configure as super-user...)\n");
10107                 setuid(1);
10108         }
10109 #ifdef TRY_BSD_PGRP
10110         if (-1 == setpgrp(1, 1))
10111                 exit(0);
10112 #else
10113         if (setpgrp() != -1)
10114                 exit(0);
10115 #endif
10116         exit(1);
10117 }
10118 EOP
10119         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10120                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10121                 val="$define"
10122         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10123                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10124                 val="$undef"
10125         else
10126                 echo "(I can't seem to compile and run the test program.)"
10127                 if ./usg; then
10128                         xxx="a USG one, i.e. you use setpgrp()."
10129                 else
10130                         # SVR4 systems can appear rather BSD-ish.
10131                         case "$i_unistd" in
10132                         $undef)
10133                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10134                                 val="$define"
10135                                 ;;
10136                         $define)
10137                                 xxx="probably a USG one, i.e. you use setpgrp()."
10138                                 val="$undef"
10139                                 ;;
10140                         esac
10141                 fi
10142                 echo "Assuming your setpgrp is $xxx" >&4
10143         fi
10144         ;;
10145 *) val="$undef";;
10146 esac
10147 set d_bsdsetpgrp
10148 eval $setvar
10149 $rm -f try try.*
10150 : Look for GCC-style __builtin_choose_expr
10151 case "$d_builtin_choose_expr" in
10152 '')
10153     echo " "
10154     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10155     $cat >try.c <<'EOCP'
10156 #include <assert.h>
10157 #include <stdlib.h>
10158 #include <stdio.h>
10159
10160 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10161
10162 int main(void) {
10163     assert( SYRINX(1) == 2112 );
10164     assert( SYRINX(1) != 5150 );
10165     assert( SYRINX(0) == 5150 );
10166     assert( SYRINX(0) != 2112 );
10167     puts( "All good!" );
10168     exit(0);
10169 }
10170
10171 EOCP
10172     set try
10173     if eval $compile; then
10174         echo "Your C compiler supports __builtin_choose_expr."
10175         val="$define"
10176     else
10177         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10178         val="$undef"
10179     fi
10180 ;;
10181 *) val="$d_builtin_choose_expr" ;;
10182 esac
10183
10184 set d_builtin_choose_expr
10185 eval $setvar
10186 $rm -f try.* try core core.try.*
10187
10188 : Look for GCC-style __builtin_expect
10189 case "$d_builtin_expect" in
10190 '')
10191     echo " "
10192     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10193     $cat >builtin.c <<'EOCP'
10194 int main(void) {
10195     int n = 50;
10196     if ( __builtin_expect(n, 0) ) n = 1;
10197 }
10198 EOCP
10199     set try
10200     if eval $compile; then
10201         echo "Your C compiler supports __builtin_choose_expr."
10202         val="$define"
10203     else
10204         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10205         val="$undef"
10206     fi
10207     ;;
10208 *) val="$d_builtin_expect" ;;
10209 esac
10210
10211 set d_builtin_expect
10212 eval $setvar
10213 $rm -f try.* try core core.try.*
10214
10215 : see if bzero exists
10216 set bzero d_bzero
10217 eval $inlibc
10218
10219 : see if signal is declared as pointer to function returning int or void
10220 echo " "
10221 xxx=`./findhdr signal.h`
10222 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10223 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10224         echo "You have int (*signal())() instead of void." >&4
10225         val="$undef"
10226 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10227         echo "You have void (*signal())()." >&4
10228         val="$define"
10229 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10230         echo "You have int (*signal())() instead of void." >&4
10231         val="$undef"
10232 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10233         echo "You have void (*signal())()." >&4
10234         val="$define"
10235 else
10236         case "$d_voidsig" in
10237         '')
10238         echo "I can't determine whether signal handler returns void or int..." >&4
10239                 dflt=void
10240                 rp="What type does your signal handler return?"
10241                 . ./myread
10242                 case "$ans" in
10243                 v*) val="$define";;
10244                 *) val="$undef";;
10245                 esac;;
10246         "$define")
10247                 echo "As you already told me, signal handler returns void." >&4
10248                 val="$define"
10249                 ;;
10250         *)      echo "As you already told me, signal handler returns int." >&4
10251                 val="$undef"
10252                 ;;
10253         esac
10254 fi
10255 set d_voidsig
10256 eval $setvar
10257 case "$d_voidsig" in
10258 "$define") signal_t="void";;
10259 *) signal_t="int";;
10260 esac
10261 $rm -f $$.tmp
10262
10263 : check for ability to cast large floats to 32-bit ints.
10264 echo " "
10265 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10266 if $test "$intsize" -ge 4; then
10267         xxx=int
10268 else
10269         xxx=long
10270 fi
10271 $cat >try.c <<EOCP
10272 #include <stdio.h>
10273 #$i_stdlib I_STDLIB
10274 #ifdef I_STDLIB
10275 #include <stdlib.h>
10276 #endif
10277 #include <sys/types.h>
10278 #include <signal.h>
10279 $signal_t blech(s) int s; { exit(3); }
10280 int main()
10281 {
10282         $xxx i32;
10283         double f, g;
10284         int result = 0;
10285         char str[16];
10286         signal(SIGFPE, blech);
10287
10288         /* Don't let compiler optimize the test away.  Store the number 
10289            in a writable string for gcc to pass to sscanf under HP/UX.
10290         */
10291         sprintf(str, "2147483647");
10292         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10293         g = 10 * f;
10294         i32  = ($xxx) g;
10295
10296         /* x86 processors will probably give 0x8000 0000, which is a
10297            sign change.  We don't want that.  We want to mimic SPARC
10298            behavior here, which is to preserve the sign and give
10299            back 0x7fff ffff.
10300         */
10301         if (i32 != ($xxx) f)
10302                 result |= 1;
10303         exit(result);
10304 }
10305 EOCP
10306 set try
10307 if eval $compile_ok; then
10308         $run ./try
10309         yyy=$?
10310 else
10311         echo "(I can't seem to compile the test program--assuming it can't)"
10312         yyy=1
10313 fi
10314 case "$yyy" in
10315 0)      val="$define"
10316         echo "Yup, it can."
10317         ;;
10318 *)      val="$undef"
10319         echo "Nope, it can't."
10320         ;;
10321 esac
10322 set d_casti32
10323 eval $setvar
10324 $rm -f try try.*
10325
10326 : check for ability to cast negative floats to unsigned
10327 echo " "
10328 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10329 $cat >try.c <<EOCP
10330 #include <stdio.h>
10331 #$i_stdlib I_STDLIB
10332 #ifdef I_STDLIB
10333 #include <stdlib.h>
10334 #endif
10335 #include <sys/types.h>
10336 #include <signal.h>
10337 $signal_t blech(s) int s; { exit(7); }
10338 $signal_t blech_in_list(s) int s; { exit(4); }
10339 unsigned long dummy_long(p) unsigned long p; { return p; }
10340 unsigned int dummy_int(p) unsigned int p; { return p; }
10341 unsigned short dummy_short(p) unsigned short p; { return p; }
10342 int main()
10343 {
10344         double f;
10345         unsigned long along;
10346         unsigned int aint;
10347         unsigned short ashort;
10348         int result = 0;
10349         char str[16];
10350         
10351         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10352            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10353            optimized the whole file away
10354         */
10355         /* Store the number in a writable string for gcc to pass to 
10356            sscanf under HP/UX.
10357         */
10358         sprintf(str, "-123");
10359         sscanf(str, "%lf", &f);  /* f = -123.; */
10360
10361         signal(SIGFPE, blech);
10362         along = (unsigned long)f;
10363         aint = (unsigned int)f;
10364         ashort = (unsigned short)f;
10365         if (along != (unsigned long)-123)
10366                 result |= 1;
10367         if (aint != (unsigned int)-123)
10368                 result |= 1;
10369         if (ashort != (unsigned short)-123)
10370                 result |= 1;
10371         sprintf(str, "1073741824.");
10372         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10373         f = f + f;
10374         along = 0;
10375         along = (unsigned long)f;
10376         if (along != 0x80000000)
10377                 result |= 2;
10378         f -= 1.;
10379         along = 0;
10380         along = (unsigned long)f;
10381         if (along != 0x7fffffff)
10382                 result |= 1;
10383         f += 2.;
10384         along = 0;
10385         along = (unsigned long)f;
10386         if (along != 0x80000001)
10387                 result |= 2;
10388         if (result)
10389                 exit(result);
10390         signal(SIGFPE, blech_in_list);
10391         sprintf(str, "123.");
10392         sscanf(str, "%lf", &f);  /* f = 123.; */
10393         along = dummy_long((unsigned long)f);
10394         aint = dummy_int((unsigned int)f);
10395         ashort = dummy_short((unsigned short)f);
10396         if (along != (unsigned long)123)
10397                 result |= 4;
10398         if (aint != (unsigned int)123)
10399                 result |= 4;
10400         if (ashort != (unsigned short)123)
10401                 result |= 4;
10402         exit(result);
10403
10404 }
10405 EOCP
10406 set try
10407 if eval $compile_ok; then
10408         $run ./try
10409         castflags=$?
10410 else
10411         echo "(I can't seem to compile the test program--assuming it can't)"
10412         castflags=7
10413 fi
10414 case "$castflags" in
10415 0)      val="$define"
10416         echo "Yup, it can."
10417         ;;
10418 *)      val="$undef"
10419         echo "Nope, it can't."
10420         ;;
10421 esac
10422 set d_castneg
10423 eval $setvar
10424 $rm -f try.*
10425
10426 : see if vprintf exists
10427 echo " "
10428 if set vprintf val -f d_vprintf; eval $csym; $val; then
10429         echo 'vprintf() found.' >&4
10430         val="$define"
10431         $cat >try.c <<EOF
10432 #include <varargs.h>
10433 #$i_stdlib I_STDLIB
10434 #ifdef I_STDLIB
10435 #include <stdlib.h>
10436 #endif
10437
10438 int main() { xxx("foo"); }
10439
10440 xxx(va_alist)
10441 va_dcl
10442 {
10443         va_list args;
10444         char buf[10];
10445
10446         va_start(args);
10447         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10448 }
10449 EOF
10450         set try
10451         if eval $compile && $run ./try; then
10452                 echo "Your vsprintf() returns (int)." >&4
10453                 val2="$undef"
10454         else
10455                 echo "Your vsprintf() returns (char*)." >&4
10456                 val2="$define"
10457         fi
10458 else
10459         echo 'vprintf() NOT found.' >&4
10460                 val="$undef"
10461                 val2="$undef"
10462 fi
10463 $rm -f try try.*
10464 set d_vprintf
10465 eval $setvar
10466 val=$val2
10467 set d_charvspr
10468 eval $setvar
10469
10470 : see if chown exists
10471 set chown d_chown
10472 eval $inlibc
10473
10474 : see if chroot exists
10475 set chroot d_chroot
10476 eval $inlibc
10477
10478 : see if chsize exists
10479 set chsize d_chsize
10480 eval $inlibc
10481
10482 : see if class exists
10483 set class d_class
10484 eval $inlibc
10485
10486 : see if clearenv exists
10487 set clearenv d_clearenv
10488 eval $inlibc
10489
10490 hasstruct='varname=$1; struct=$2; shift; shift;
10491 while $test $# -ge 2; do
10492         case "$1" in
10493         $define) echo "#include <$2>";;
10494         esac ;
10495     shift 2;
10496 done > try.c;
10497 echo "int main () { struct $struct foo; }" >> try.c;
10498 set try;
10499 if eval $compile; then
10500         val="$define";
10501 else
10502         val="$undef";
10503 fi;
10504 set $varname;
10505 eval $setvar;
10506 $rm -f try.c try.o'
10507
10508 socketlib=''
10509 sockethdr=''
10510 : see whether socket exists
10511 echo " "
10512 $echo $n "Hmm... $c" >&4
10513 if set socket val -f d_socket; eval $csym; $val; then
10514         echo "Looks like you have Berkeley networking support." >&4
10515         d_socket="$define"
10516         if set setsockopt val -f; eval $csym; $val; then
10517                 d_oldsock="$undef"
10518         else
10519                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10520                 d_oldsock="$define"
10521         fi
10522 else
10523         if $contains socklib libc.list >/dev/null 2>&1; then
10524                 echo "Looks like you have Berkeley networking support." >&4
10525                 d_socket="$define"
10526                 : we will have to assume that it supports the 4.2 BSD interface
10527                 d_oldsock="$undef"
10528         else
10529                 echo "You don't have Berkeley networking in libc$_a..." >&4
10530                 if test "X$d_socket" = "X$define"; then
10531                    echo "...but you seem to believe that you have sockets." >&4
10532                 else
10533                         for net in net socket
10534                         do
10535                                 if test -f /usr/lib/lib$net$_a; then
10536                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10537                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10538                                         if $contains socket libc.list >/dev/null 2>&1; then
10539                                                 d_socket="$define"
10540                                                 socketlib="-l$net"
10541                                                 case "$net" in
10542                                                 net)
10543                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10544                                                         sockethdr="-I/usr/netinclude"
10545                                                         ;;
10546                                                 esac
10547                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10548                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10549                                                         d_oldsock="$undef"
10550                                                 else
10551                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10552                                                         d_oldsock="$define"
10553                                                 fi
10554                                                 break
10555                                         fi
10556                                 fi
10557                         done
10558                         if test "X$d_socket" != "X$define"; then
10559                            echo "or anywhere else I see." >&4
10560                            d_socket="$undef"
10561                            d_oldsock="$undef"
10562                         fi
10563                 fi
10564         fi
10565 fi
10566
10567 : see if socketpair exists
10568 set socketpair d_sockpair
10569 eval $inlibc
10570
10571
10572 echo " "
10573 echo "Checking the availability of certain socket constants..." >&4
10574 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10575         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10576         $cat >try.c <<EOF
10577 #include <sys/types.h>
10578 #include <sys/socket.h>
10579 int main() {
10580     int i = $ENUM;
10581 }
10582 EOF
10583         val="$undef"
10584         set try; if eval $compile; then
10585                 val="$define"
10586         fi
10587         set d_${enum}; eval $setvar
10588         $rm -f try.c try
10589 done
10590
10591 : see if this is a sys/uio.h system
10592 set sys/uio.h i_sysuio
10593 eval $inhdr
10594
10595
10596 echo " "
10597 echo "Checking to see if your system supports struct cmsghdr..." >&4
10598 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10599 eval $hasstruct
10600 case "$d_cmsghdr_s" in
10601 "$define")      echo "Yes, it does."   ;;
10602 *)              echo "No, it doesn't." ;;
10603 esac
10604
10605
10606 : check for const keyword
10607 echo " "
10608 echo 'Checking to see if your C compiler knows about "const"...' >&4
10609 $cat >const.c <<'EOCP'
10610 typedef struct spug { int drokk; } spug;
10611 int main()
10612 {
10613         const char *foo;
10614         const spug y;
10615 }
10616 EOCP
10617 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10618         val="$define"
10619         echo "Yup, it does."
10620 else
10621         val="$undef"
10622         echo "Nope, it doesn't."
10623 fi
10624 set d_const
10625 eval $setvar
10626
10627 : see if copysignl exists
10628 set copysignl d_copysignl
10629 eval $inlibc
10630
10631 : see if crypt exists
10632 echo " "
10633 set crypt d_crypt
10634 eval $inlibc
10635 case "$d_crypt" in
10636 $define) cryptlib='' ;;
10637 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10638                 echo 'crypt() found.' >&4
10639                 val="$define"
10640                 cryptlib=''
10641         else
10642                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10643                 if $test -z "$cryptlib"; then
10644                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10645                 else
10646                         cryptlib=-lcrypt
10647                 fi
10648                 if $test -z "$cryptlib"; then
10649                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10650                 else
10651                         cryptlib=-lcrypt
10652                 fi
10653                 if $test -z "$cryptlib"; then
10654                         cryptlib=`./loc libcrypt$_a "" $libpth`
10655                 else
10656                         cryptlib=-lcrypt
10657                 fi
10658                 if $test -z "$cryptlib"; then
10659                         echo 'crypt() NOT found.' >&4
10660                         val="$undef"
10661                 else
10662                         val="$define"
10663                 fi
10664         fi
10665         set d_crypt
10666         eval $setvar
10667         ;;
10668 esac
10669
10670 : see if this is a crypt.h system
10671 set crypt.h i_crypt
10672 eval $inhdr
10673
10674 : see if crypt_r exists
10675 set crypt_r d_crypt_r
10676 eval $inlibc
10677 case "$d_crypt_r" in
10678 "$define")
10679         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10680         case "$d_crypt_r_proto:$usethreads" in
10681         ":define")      d_crypt_r_proto=define
10682                 set d_crypt_r_proto crypt_r $hdrs
10683                 eval $hasproto ;;
10684         *)      ;;
10685         esac
10686         case "$d_crypt_r_proto" in
10687         define)
10688         case "$crypt_r_proto" in
10689         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10690         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10691         esac
10692         case "$crypt_r_proto" in
10693         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10694         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10695         esac
10696         case "$crypt_r_proto" in
10697         ''|0)   d_crypt_r=undef
10698                 crypt_r_proto=0
10699                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10700         * )     case "$crypt_r_proto" in
10701                 REENTRANT_PROTO*) ;;
10702                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10703                 esac
10704                 echo "Prototype: $try" ;;
10705         esac
10706         ;;
10707         *)      case "$usethreads" in
10708                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10709                 esac
10710                 d_crypt_r=undef
10711                 crypt_r_proto=0
10712                 ;;
10713         esac
10714         ;;
10715 *)      crypt_r_proto=0
10716         ;;
10717 esac
10718
10719 : get csh whereabouts
10720 case "$csh" in
10721 'csh') val="$undef" ;;
10722 *) val="$define" ;;
10723 esac
10724 set d_csh
10725 eval $setvar
10726 : Respect a hint or command line value for full_csh.
10727 case "$full_csh" in
10728 '') full_csh=$csh ;;
10729 esac
10730
10731 : see if ctermid_r exists
10732 set ctermid_r d_ctermid_r
10733 eval $inlibc
10734 case "$d_ctermid_r" in
10735 "$define")
10736         hdrs="$i_systypes sys/types.h define stdio.h "
10737         case "$d_ctermid_r_proto:$usethreads" in
10738         ":define")      d_ctermid_r_proto=define
10739                 set d_ctermid_r_proto ctermid_r $hdrs
10740                 eval $hasproto ;;
10741         *)      ;;
10742         esac
10743         case "$d_ctermid_r_proto" in
10744         define)
10745         case "$ctermid_r_proto" in
10746         ''|0) try='char* ctermid_r(char*);'
10747         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10748         esac
10749         case "$ctermid_r_proto" in
10750         ''|0)   d_ctermid_r=undef
10751                 ctermid_r_proto=0
10752                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10753         * )     case "$ctermid_r_proto" in
10754                 REENTRANT_PROTO*) ;;
10755                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10756                 esac
10757                 echo "Prototype: $try" ;;
10758         esac
10759         ;;
10760         *)      case "$usethreads" in
10761                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10762                 esac
10763                 d_ctermid_r=undef
10764                 ctermid_r_proto=0
10765                 ;;
10766         esac
10767         ;;
10768 *)      ctermid_r_proto=0
10769         ;;
10770 esac
10771
10772 : see if ctime_r exists
10773 set ctime_r d_ctime_r
10774 eval $inlibc
10775 case "$d_ctime_r" in
10776 "$define")
10777         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10778         case "$d_ctime_r_proto:$usethreads" in
10779         ":define")      d_ctime_r_proto=define
10780                 set d_ctime_r_proto ctime_r $hdrs
10781                 eval $hasproto ;;
10782         *)      ;;
10783         esac
10784         case "$d_ctime_r_proto" in
10785         define)
10786         case "$ctime_r_proto" in
10787         ''|0) try='char* ctime_r(const time_t*, char*);'
10788         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10789         esac
10790         case "$ctime_r_proto" in
10791         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10792         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10793         esac
10794         case "$ctime_r_proto" in
10795         ''|0) try='int ctime_r(const time_t*, char*);'
10796         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10797         esac
10798         case "$ctime_r_proto" in
10799         ''|0) try='int ctime_r(const time_t*, char*, int);'
10800         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10801         esac
10802         case "$ctime_r_proto" in
10803         ''|0)   d_ctime_r=undef
10804                 ctime_r_proto=0
10805                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10806         * )     case "$ctime_r_proto" in
10807                 REENTRANT_PROTO*) ;;
10808                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10809                 esac
10810                 echo "Prototype: $try" ;;
10811         esac
10812         ;;
10813         *)      case "$usethreads" in
10814                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10815                 esac
10816                 d_ctime_r=undef
10817                 ctime_r_proto=0
10818                 ;;
10819         esac
10820         ;;
10821 *)      ctime_r_proto=0
10822         ;;
10823 esac
10824
10825 : see if cuserid exists
10826 set cuserid d_cuserid
10827 eval $inlibc
10828
10829 : see if this is a limits.h system
10830 set limits.h i_limits
10831 eval $inhdr
10832
10833 : see if this is a float.h system
10834 set float.h i_float
10835 eval $inhdr
10836
10837 : See if number of significant digits in a double precision number is known
10838 echo " "
10839 $cat >dbl_dig.c <<EOM
10840 #$i_limits I_LIMITS
10841 #$i_float I_FLOAT
10842 #ifdef I_LIMITS
10843 #include <limits.h>
10844 #endif
10845 #ifdef I_FLOAT
10846 #include <float.h>
10847 #endif
10848 #ifdef DBL_DIG
10849 printf("Contains DBL_DIG");
10850 #endif
10851 EOM
10852 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10853 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10854         echo "DBL_DIG found." >&4
10855         val="$define"
10856 else
10857         echo "DBL_DIG NOT found." >&4
10858         val="$undef"
10859 fi
10860 $rm -f dbl_dig.?
10861 set d_dbl_dig
10862 eval $setvar
10863
10864 : see if dbm.h is available
10865 : see if dbmclose exists
10866 set dbmclose d_dbmclose
10867 eval $inlibc
10868
10869 case "$d_dbmclose" in
10870 $define)
10871         set dbm.h i_dbm
10872         eval $inhdr
10873         case "$i_dbm" in
10874         $define)
10875                 val="$undef"
10876                 set i_rpcsvcdbm
10877                 eval $setvar
10878                 ;;
10879         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10880                 eval $inhdr
10881                 ;;
10882         esac
10883         ;;
10884 *)      echo "We won't be including <dbm.h>"
10885         val="$undef"
10886         set i_dbm
10887         eval $setvar
10888         val="$undef"
10889         set i_rpcsvcdbm
10890         eval $setvar
10891         ;;
10892 esac
10893
10894 : see if prototype for dbminit is available
10895 echo " "
10896 set d_dbminitproto dbminit $i_dbm dbm.h
10897 eval $hasproto
10898
10899 : see if difftime exists
10900 set difftime d_difftime
10901 eval $inlibc
10902
10903 : see if this is a dirent system
10904 echo " "
10905 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10906         val="$define"
10907         echo "<dirent.h> found." >&4
10908 else
10909         val="$undef"
10910         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10911                 echo "<sys/dir.h> found." >&4
10912                 echo " "
10913         else
10914                 xinc=`./findhdr sys/ndir.h`
10915         fi
10916         echo "<dirent.h> NOT found." >&4
10917 fi
10918 set i_dirent
10919 eval $setvar
10920
10921 : Look for type of directory structure.
10922 echo " "
10923 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10924
10925 case "$direntrytype" in
10926 ''|' ')
10927         case "$i_dirent" in
10928         $define) guess1='struct dirent' ;;
10929         *) guess1='struct direct'  ;;
10930         esac
10931         ;;
10932 *)      guess1="$direntrytype"
10933         ;;
10934 esac
10935
10936 case "$guess1" in
10937 'struct dirent') guess2='struct direct' ;;
10938 *) guess2='struct dirent' ;;
10939 esac
10940                 
10941 if $contains "$guess1" try.c >/dev/null 2>&1; then
10942         direntrytype="$guess1"
10943         echo "Your directory entries are $direntrytype." >&4
10944 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10945         direntrytype="$guess2"
10946         echo "Your directory entries seem to be $direntrytype." >&4
10947 else
10948         echo "I don't recognize your system's directory entries." >&4
10949         rp="What type is used for directory entries on this system?"
10950         dflt="$guess1"
10951         . ./myread
10952         direntrytype="$ans"
10953 fi
10954 $rm -f try.c
10955
10956
10957 : see if the directory entry stores field length
10958 echo " "
10959 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10960 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10961         echo "Good, your directory entry keeps length information in d_namlen." >&4
10962         val="$define"
10963 else
10964         echo "Your directory entry does not know about the d_namlen field." >&4
10965         val="$undef"
10966 fi
10967 set d_dirnamlen
10968 eval $setvar
10969 $rm -f try.c
10970
10971 : see if this is an sysdir system
10972 set sys/dir.h i_sysdir
10973 eval $inhdr
10974
10975 : see if this is an sysndir system
10976 set sys/ndir.h i_sysndir
10977 eval $inhdr
10978
10979 : Look for dirfd
10980 echo " "
10981 $cat >dirfd.c <<EOM
10982 #include <stdio.h>
10983 #$i_stdlib I_STDLIB
10984 #ifdef I_STDLIB
10985 #include <stdlib.h>
10986 #endif
10987 #$i_dirent I_DIRENT             /**/
10988 #$i_sysdir I_SYS_DIR            /**/
10989 #$i_sysndir I_SYS_NDIR          /**/
10990 #$i_systypes I_SYS_TYPES        /**/
10991 #if defined(I_SYS_TYPES)
10992 #include <sys/types.h>
10993 #endif
10994 #if defined(I_DIRENT)
10995 #include <dirent.h>
10996 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
10997 #include <sys/dir.h>
10998 #endif
10999 #else
11000 #ifdef I_SYS_NDIR
11001 #include <sys/ndir.h>
11002 #else
11003 #ifdef I_SYS_DIR
11004 #ifdef hp9000s500
11005 #include <ndir.h>       /* may be wrong in the future */
11006 #else
11007 #include <sys/dir.h>
11008 #endif
11009 #endif
11010 #endif
11011 #endif 
11012 int main() {
11013         DIR *dirp = opendir(".");
11014         if (dirfd(dirp) >= 0)
11015                 exit(0);
11016         else
11017                 exit(1);
11018 }
11019 EOM
11020 val=$undef
11021 set dirfd
11022 if eval $compile; then
11023         val="$define"
11024 fi
11025 case "$val" in
11026 $define)        echo "dirfd() found." >&4       ;;
11027 *)              echo "dirfd() NOT found." >&4   ;;
11028 esac
11029 set d_dirfd
11030 eval $setvar
11031 $rm -f dirfd*
11032
11033 : see if dlerror exists
11034 xxx_runnm="$runnm"
11035 runnm=false
11036 set dlerror d_dlerror
11037 eval $inlibc
11038 runnm="$xxx_runnm"
11039
11040 : see if dlfcn is available
11041 set dlfcn.h i_dlfcn
11042 eval $inhdr
11043
11044 case "$usedl" in
11045 $define|y|true)
11046         $cat << EOM
11047
11048 On a few systems, the dynamically loaded modules that perl generates and uses
11049 will need a different extension than shared libs. The default will probably
11050 be appropriate.
11051
11052 EOM
11053         case "$dlext" in
11054         '')     dflt="$so" ;;
11055         *)      dflt="$dlext" ;;
11056         esac
11057         rp='What is the extension of dynamically loaded modules'
11058         . ./myread
11059         dlext="$ans"
11060         ;;
11061 *)
11062         dlext="none"
11063         ;;
11064 esac
11065
11066 : Check if dlsym need a leading underscore
11067 echo " "
11068 val="$undef"
11069
11070 case "$dlsrc" in
11071 dl_dlopen.xs)
11072         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11073         $cat >dyna.c <<'EOM'
11074 fred () { }
11075 EOM
11076
11077 $cat >fred.c<<EOM
11078
11079 #include <stdio.h>
11080 #$i_stdlib I_STDLIB
11081 #ifdef I_STDLIB
11082 #include <stdlib.h>
11083 #endif
11084 #$i_dlfcn I_DLFCN
11085 #ifdef I_DLFCN
11086 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11087 #else
11088 #include <sys/types.h>
11089 #include <nlist.h>
11090 #include <link.h>
11091 #endif
11092
11093 extern int fred() ;
11094
11095 int main()
11096 {
11097     void * handle ;
11098     void * symbol ;
11099 #ifndef RTLD_LAZY
11100     int mode = 1 ;
11101 #else
11102     int mode = RTLD_LAZY ;
11103 #endif
11104     handle = dlopen("./dyna.$dlext", mode) ;
11105     if (handle == NULL) {
11106         printf ("1\n") ;
11107         fflush (stdout) ;
11108         exit(0);
11109     }
11110     symbol = dlsym(handle, "fred") ;
11111     if (symbol == NULL) {
11112         /* try putting a leading underscore */
11113         symbol = dlsym(handle, "_fred") ;
11114         if (symbol == NULL) {
11115             printf ("2\n") ;
11116             fflush (stdout) ;
11117             exit(0);
11118         }
11119         printf ("3\n") ;
11120     }
11121     else
11122         printf ("4\n") ;
11123     fflush (stdout) ;
11124     exit(0);
11125 }
11126 EOM
11127         : Call the object file tmp-dyna.o in case dlext=o.
11128         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11129                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11130                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11131                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11132                 xxx=`$run ./fred`
11133                 case $xxx in
11134                 1)      echo "Test program failed using dlopen." >&4
11135                         echo "Perhaps you should not use dynamic loading." >&4;;
11136                 2)      echo "Test program failed using dlsym." >&4
11137                         echo "Perhaps you should not use dynamic loading." >&4;;
11138                 3)      echo "dlsym needs a leading underscore" >&4
11139                         val="$define" ;;
11140                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11141                 esac
11142         else
11143                 echo "I can't compile and run the test program." >&4
11144                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11145         fi
11146         ;;
11147 esac
11148                 
11149 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11150
11151 set d_dlsymun
11152 eval $setvar
11153
11154 : see if drand48_r exists
11155 set drand48_r d_drand48_r
11156 eval $inlibc
11157 case "$d_drand48_r" in
11158 "$define")
11159         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11160         case "$d_drand48_r_proto:$usethreads" in
11161         ":define")      d_drand48_r_proto=define
11162                 set d_drand48_r_proto drand48_r $hdrs
11163                 eval $hasproto ;;
11164         *)      ;;
11165         esac
11166         case "$d_drand48_r_proto" in
11167         define)
11168         case "$drand48_r_proto" in
11169         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11170         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11171         esac
11172         case "$drand48_r_proto" in
11173         ''|0)   d_drand48_r=undef
11174                 drand48_r_proto=0
11175                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11176         * )     case "$drand48_r_proto" in
11177                 REENTRANT_PROTO*) ;;
11178                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11179                 esac
11180                 echo "Prototype: $try" ;;
11181         esac
11182         ;;
11183         *)      case "$usethreads" in
11184                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11185                 esac
11186                 d_drand48_r=undef
11187                 drand48_r_proto=0
11188                 ;;
11189         esac
11190         ;;
11191 *)      drand48_r_proto=0
11192         ;;
11193 esac
11194
11195 : see if prototype for drand48 is available
11196 echo " "
11197 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11198 eval $hasproto
11199
11200 : see if dup2 exists
11201 set dup2 d_dup2
11202 eval $inlibc
11203
11204 : see if eaccess exists
11205 set eaccess d_eaccess
11206 eval $inlibc
11207
11208 : see if endgrent exists
11209 set endgrent d_endgrent
11210 eval $inlibc
11211
11212 : see if this is an grp system
11213 set grp.h i_grp
11214 eval $inhdr
11215
11216 case "$i_grp" in
11217 $define)
11218         xxx=`./findhdr grp.h`
11219         $cppstdin $cppflags $cppminus < $xxx >$$.h
11220
11221         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11222                 val="$define"
11223         else
11224                 val="$undef"
11225         fi
11226         set d_grpasswd
11227         eval $setvar
11228
11229         $rm -f $$.h
11230         ;;
11231 *)
11232         val="$undef";
11233         set d_grpasswd; eval $setvar
11234         ;;
11235 esac
11236
11237 : see if endgrent_r exists
11238 set endgrent_r d_endgrent_r
11239 eval $inlibc
11240 case "$d_endgrent_r" in
11241 "$define")
11242         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11243         case "$d_endgrent_r_proto:$usethreads" in
11244         ":define")      d_endgrent_r_proto=define
11245                 set d_endgrent_r_proto endgrent_r $hdrs
11246                 eval $hasproto ;;
11247         *)      ;;
11248         esac
11249         case "$d_endgrent_r_proto" in
11250         define)
11251         case "$endgrent_r_proto" in
11252         ''|0) try='int endgrent_r(FILE**);'
11253         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11254         esac
11255         case "$endgrent_r_proto" in
11256         ''|0) try='void endgrent_r(FILE**);'
11257         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11258         esac
11259         case "$endgrent_r_proto" in
11260         ''|0)   d_endgrent_r=undef
11261                 endgrent_r_proto=0
11262                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11263         * )     case "$endgrent_r_proto" in
11264                 REENTRANT_PROTO*) ;;
11265                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11266                 esac
11267                 echo "Prototype: $try" ;;
11268         esac
11269         ;;
11270         *)      case "$usethreads" in
11271                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11272                 esac
11273                 d_endgrent_r=undef
11274                 endgrent_r_proto=0
11275                 ;;
11276         esac
11277         ;;
11278 *)      endgrent_r_proto=0
11279         ;;
11280 esac
11281
11282 : see if endhostent exists
11283 set endhostent d_endhent
11284 eval $inlibc
11285
11286 : see if this is a netdb.h system
11287 set netdb.h i_netdb
11288 eval $inhdr
11289
11290 : see if endhostent_r exists
11291 set endhostent_r d_endhostent_r
11292 eval $inlibc
11293 case "$d_endhostent_r" in
11294 "$define")
11295         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11296         case "$d_endhostent_r_proto:$usethreads" in
11297         ":define")      d_endhostent_r_proto=define
11298                 set d_endhostent_r_proto endhostent_r $hdrs
11299                 eval $hasproto ;;
11300         *)      ;;
11301         esac
11302         case "$d_endhostent_r_proto" in
11303         define)
11304         case "$endhostent_r_proto" in
11305         ''|0) try='int endhostent_r(struct hostent_data*);'
11306         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11307         esac
11308         case "$endhostent_r_proto" in
11309         ''|0) try='void endhostent_r(struct hostent_data*);'
11310         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11311         esac
11312         case "$endhostent_r_proto" in
11313         ''|0)   d_endhostent_r=undef
11314                 endhostent_r_proto=0
11315                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11316         * )     case "$endhostent_r_proto" in
11317                 REENTRANT_PROTO*) ;;
11318                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11319                 esac
11320                 echo "Prototype: $try" ;;
11321         esac
11322         ;;
11323         *)      case "$usethreads" in
11324                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11325                 esac
11326                 d_endhostent_r=undef
11327                 endhostent_r_proto=0
11328                 ;;
11329         esac
11330         ;;
11331 *)      endhostent_r_proto=0
11332         ;;
11333 esac
11334
11335 : see if endnetent exists
11336 set endnetent d_endnent
11337 eval $inlibc
11338
11339 : see if endnetent_r exists
11340 set endnetent_r d_endnetent_r
11341 eval $inlibc
11342 case "$d_endnetent_r" in
11343 "$define")
11344         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11345         case "$d_endnetent_r_proto:$usethreads" in
11346         ":define")      d_endnetent_r_proto=define
11347                 set d_endnetent_r_proto endnetent_r $hdrs
11348                 eval $hasproto ;;
11349         *)      ;;
11350         esac
11351         case "$d_endnetent_r_proto" in
11352         define)
11353         case "$endnetent_r_proto" in
11354         ''|0) try='int endnetent_r(struct netent_data*);'
11355         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11356         esac
11357         case "$endnetent_r_proto" in
11358         ''|0) try='void endnetent_r(struct netent_data*);'
11359         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11360         esac
11361         case "$endnetent_r_proto" in
11362         ''|0)   d_endnetent_r=undef
11363                 endnetent_r_proto=0
11364                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11365         * )     case "$endnetent_r_proto" in
11366                 REENTRANT_PROTO*) ;;
11367                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11368                 esac
11369                 echo "Prototype: $try" ;;
11370         esac
11371         ;;
11372         *)      case "$usethreads" in
11373                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11374                 esac
11375                 d_endnetent_r=undef
11376                 endnetent_r_proto=0
11377                 ;;
11378         esac
11379         ;;
11380 *)      endnetent_r_proto=0
11381         ;;
11382 esac
11383
11384 : see if endprotoent exists
11385 set endprotoent d_endpent
11386 eval $inlibc
11387
11388 : see if endprotoent_r exists
11389 set endprotoent_r d_endprotoent_r
11390 eval $inlibc
11391 case "$d_endprotoent_r" in
11392 "$define")
11393         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11394         case "$d_endprotoent_r_proto:$usethreads" in
11395         ":define")      d_endprotoent_r_proto=define
11396                 set d_endprotoent_r_proto endprotoent_r $hdrs
11397                 eval $hasproto ;;
11398         *)      ;;
11399         esac
11400         case "$d_endprotoent_r_proto" in
11401         define)
11402         case "$endprotoent_r_proto" in
11403         ''|0) try='int endprotoent_r(struct protoent_data*);'
11404         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11405         esac
11406         case "$endprotoent_r_proto" in
11407         ''|0) try='void endprotoent_r(struct protoent_data*);'
11408         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11409         esac
11410         case "$endprotoent_r_proto" in
11411         ''|0)   d_endprotoent_r=undef
11412                 endprotoent_r_proto=0
11413                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11414         * )     case "$endprotoent_r_proto" in
11415                 REENTRANT_PROTO*) ;;
11416                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11417                 esac
11418                 echo "Prototype: $try" ;;
11419         esac
11420         ;;
11421         *)      case "$usethreads" in
11422                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11423                 esac
11424                 d_endprotoent_r=undef
11425                 endprotoent_r_proto=0
11426                 ;;
11427         esac
11428         ;;
11429 *)      endprotoent_r_proto=0
11430         ;;
11431 esac
11432
11433 : see if endpwent exists
11434 set endpwent d_endpwent
11435 eval $inlibc
11436
11437 : see if this is a pwd.h system
11438 set pwd.h i_pwd
11439 eval $inhdr
11440
11441 case "$i_pwd" in
11442 $define)
11443         xxx=`./findhdr pwd.h`
11444         $cppstdin $cppflags $cppminus < $xxx >$$.h
11445
11446         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11447                 val="$define"
11448         else
11449                 val="$undef"
11450         fi
11451         set d_pwquota
11452         eval $setvar
11453
11454         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11455                 val="$define"
11456         else
11457                 val="$undef"
11458         fi
11459         set d_pwage
11460         eval $setvar
11461
11462         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11463                 val="$define"
11464         else
11465                 val="$undef"
11466         fi
11467         set d_pwchange
11468         eval $setvar
11469
11470         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11471                 val="$define"
11472         else
11473                 val="$undef"
11474         fi
11475         set d_pwclass
11476         eval $setvar
11477
11478         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11479                 val="$define"
11480         else
11481                 val="$undef"
11482         fi
11483         set d_pwexpire
11484         eval $setvar
11485
11486         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11487                 val="$define"
11488         else
11489                 val="$undef"
11490         fi
11491         set d_pwcomment
11492         eval $setvar
11493
11494         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11495                 val="$define"
11496         else
11497                 val="$undef"
11498         fi
11499         set d_pwgecos
11500         eval $setvar
11501
11502         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11503                 val="$define"
11504         else
11505                 val="$undef"
11506         fi
11507         set d_pwpasswd
11508         eval $setvar
11509
11510         $rm -f $$.h
11511         ;;
11512 *)
11513         val="$undef"; 
11514         set d_pwquota; eval $setvar
11515         set d_pwage; eval $setvar
11516         set d_pwchange; eval $setvar
11517         set d_pwclass; eval $setvar
11518         set d_pwexpire; eval $setvar
11519         set d_pwcomment; eval $setvar
11520         set d_pwgecos; eval $setvar
11521         set d_pwpasswd; eval $setvar
11522         ;;
11523 esac
11524
11525 : see if endpwent_r exists
11526 set endpwent_r d_endpwent_r
11527 eval $inlibc
11528 case "$d_endpwent_r" in
11529 "$define")
11530         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11531         case "$d_endpwent_r_proto:$usethreads" in
11532         ":define")      d_endpwent_r_proto=define
11533                 set d_endpwent_r_proto endpwent_r $hdrs
11534                 eval $hasproto ;;
11535         *)      ;;
11536         esac
11537         case "$d_endpwent_r_proto" in
11538         define)
11539         case "$endpwent_r_proto" in
11540         ''|0) try='int endpwent_r(FILE**);'
11541         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11542         esac
11543         case "$endpwent_r_proto" in
11544         ''|0) try='void endpwent_r(FILE**);'
11545         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11546         esac
11547         case "$endpwent_r_proto" in
11548         ''|0)   d_endpwent_r=undef
11549                 endpwent_r_proto=0
11550                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11551         * )     case "$endpwent_r_proto" in
11552                 REENTRANT_PROTO*) ;;
11553                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11554                 esac
11555                 echo "Prototype: $try" ;;
11556         esac
11557         ;;
11558         *)      case "$usethreads" in
11559                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11560                 esac
11561                 d_endpwent_r=undef
11562                 endpwent_r_proto=0
11563                 ;;
11564         esac
11565         ;;
11566 *)      endpwent_r_proto=0
11567         ;;
11568 esac
11569
11570 : see if endservent exists
11571 set endservent d_endsent
11572 eval $inlibc
11573
11574 : see if endservent_r exists
11575 set endservent_r d_endservent_r
11576 eval $inlibc
11577 case "$d_endservent_r" in
11578 "$define")
11579         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11580         case "$d_endservent_r_proto:$usethreads" in
11581         ":define")      d_endservent_r_proto=define
11582                 set d_endservent_r_proto endservent_r $hdrs
11583                 eval $hasproto ;;
11584         *)      ;;
11585         esac
11586         case "$d_endservent_r_proto" in
11587         define)
11588         case "$endservent_r_proto" in
11589         ''|0) try='int endservent_r(struct servent_data*);'
11590         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11591         esac
11592         case "$endservent_r_proto" in
11593         ''|0) try='void endservent_r(struct servent_data*);'
11594         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11595         esac
11596         case "$endservent_r_proto" in
11597         ''|0)   d_endservent_r=undef
11598                 endservent_r_proto=0
11599                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11600         * )     case "$endservent_r_proto" in
11601                 REENTRANT_PROTO*) ;;
11602                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11603                 esac
11604                 echo "Prototype: $try" ;;
11605         esac
11606         ;;
11607         *)      case "$usethreads" in
11608                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11609                 esac
11610                 d_endservent_r=undef
11611                 endservent_r_proto=0
11612                 ;;
11613         esac
11614         ;;
11615 *)      endservent_r_proto=0
11616         ;;
11617 esac
11618
11619 : Locate the flags for 'open()'
11620 echo " "
11621 $cat >try.c <<EOCP
11622 #include <sys/types.h>
11623 #ifdef I_FCNTL
11624 #include <fcntl.h>
11625 #endif
11626 #ifdef I_SYS_FILE
11627 #include <sys/file.h>
11628 #endif
11629 #$i_stdlib I_STDLIB
11630 #ifdef I_STDLIB
11631 #include <stdlib.h>
11632 #endif
11633 int main() {
11634         if(O_RDONLY);
11635 #ifdef O_TRUNC
11636         exit(0);
11637 #else
11638         exit(1);
11639 #endif
11640 }
11641 EOCP
11642 : check sys/file.h first to get FREAD on Sun
11643 if $test `./findhdr sys/file.h` && \
11644                 set try -DI_SYS_FILE && eval $compile; then
11645         h_sysfile=true;
11646         echo "<sys/file.h> defines the O_* constants..." >&4
11647         if $run ./try; then
11648                 echo "and you have the 3 argument form of open()." >&4
11649                 val="$define"
11650         else
11651                 echo "but not the 3 argument form of open().  Oh, well." >&4
11652                 val="$undef"
11653         fi
11654 elif $test `./findhdr fcntl.h` && \
11655                 set try -DI_FCNTL && eval $compile; then
11656         h_fcntl=true;
11657         echo "<fcntl.h> defines the O_* constants..." >&4
11658         if $run ./try; then
11659                 echo "and you have the 3 argument form of open()." >&4
11660                 val="$define"
11661         else
11662                 echo "but not the 3 argument form of open().  Oh, well." >&4
11663                 val="$undef"
11664         fi
11665 else
11666         val="$undef"
11667         echo "I can't find the O_* constant definitions!  You got problems." >&4
11668 fi
11669 set d_open3
11670 eval $setvar
11671 $rm -f try try.*
11672
11673 : see which of string.h or strings.h is needed
11674 echo " "
11675 strings=`./findhdr string.h`
11676 if $test "$strings" && $test -r "$strings"; then
11677         echo "Using <string.h> instead of <strings.h>." >&4
11678         val="$define"
11679 else
11680         val="$undef"
11681         strings=`./findhdr strings.h`
11682         if $test "$strings" && $test -r "$strings"; then
11683                 echo "Using <strings.h> instead of <string.h>." >&4
11684         else
11685                 echo "No string header found -- You'll surely have problems." >&4
11686         fi
11687 fi
11688 set i_string
11689 eval $setvar
11690 case "$i_string" in
11691 "$undef") strings=`./findhdr strings.h`;;
11692 *)        strings=`./findhdr string.h`;;
11693 esac
11694
11695 : see if this is a sys/file.h system
11696 val=''
11697 set sys/file.h val
11698 eval $inhdr
11699
11700 : do we need to include sys/file.h ?
11701 case "$val" in
11702 "$define")
11703         echo " "
11704         if $h_sysfile; then
11705                 val="$define"
11706                 echo "We'll be including <sys/file.h>." >&4
11707         else
11708                 val="$undef"
11709                 echo "We won't be including <sys/file.h>." >&4
11710         fi
11711         ;;
11712 *)
11713         h_sysfile=false
11714         ;;
11715 esac
11716 set i_sysfile
11717 eval $setvar
11718
11719 : see if fcntl.h is there
11720 val=''
11721 set fcntl.h val
11722 eval $inhdr
11723
11724 : see if we can include fcntl.h
11725 case "$val" in
11726 "$define")
11727         echo " "
11728         if $h_fcntl; then
11729                 val="$define"
11730                 echo "We'll be including <fcntl.h>." >&4
11731         else
11732                 val="$undef"
11733                 if $h_sysfile; then
11734         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11735                 else
11736                         echo "We won't be including <fcntl.h>." >&4
11737                 fi
11738         fi
11739         ;;
11740 *)
11741         h_fcntl=false
11742         val="$undef"
11743         ;;
11744 esac
11745 set i_fcntl
11746 eval $setvar
11747
11748 : check for non-blocking I/O stuff
11749 case "$h_sysfile" in
11750 true) echo "#include <sys/file.h>" > head.c;;
11751 *)
11752        case "$h_fcntl" in
11753        true) echo "#include <fcntl.h>" > head.c;;
11754        *) echo "#include <sys/fcntl.h>" > head.c;;
11755        esac
11756        ;;
11757 esac
11758 echo " "
11759 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11760 case "$o_nonblock" in
11761 '')
11762         $cat head.c > try.c
11763         $cat >>try.c <<EOCP
11764 #include <stdio.h>
11765 #$i_stdlib I_STDLIB
11766 #ifdef I_STDLIB
11767 #include <stdlib.h>
11768 #endif
11769 #$i_fcntl I_FCNTL
11770 #ifdef I_FCNTL
11771 #include <fcntl.h>
11772 #endif
11773 int main() {
11774 #ifdef O_NONBLOCK
11775         printf("O_NONBLOCK\n");
11776         exit(0);
11777 #endif
11778 #ifdef O_NDELAY
11779         printf("O_NDELAY\n");
11780         exit(0);
11781 #endif
11782 #ifdef FNDELAY
11783         printf("FNDELAY\n");
11784         exit(0);
11785 #endif
11786         exit(0);
11787 }
11788 EOCP
11789         set try
11790         if eval $compile_ok; then
11791                 o_nonblock=`$run ./try`
11792                 case "$o_nonblock" in
11793                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11794                 *) echo "Seems like we can use $o_nonblock.";;
11795                 esac
11796         else
11797                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11798         fi
11799         ;;
11800 *) echo "Using $hint value $o_nonblock.";;
11801 esac
11802 $rm -f try try.* .out core
11803
11804 echo " "
11805 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11806 case "$eagain" in
11807 '')
11808         $cat head.c > try.c
11809         $cat >>try.c <<EOCP
11810 #include <errno.h>
11811 #include <sys/types.h>
11812 #include <signal.h>
11813 #include <stdio.h> 
11814 #$i_stdlib I_STDLIB
11815 #ifdef I_STDLIB
11816 #include <stdlib.h>
11817 #endif
11818 #$i_fcntl I_FCNTL
11819 #ifdef I_FCNTL
11820 #include <fcntl.h>
11821 #endif
11822 #define MY_O_NONBLOCK $o_nonblock
11823 #ifndef errno  /* XXX need better Configure test */
11824 extern int errno;
11825 #endif
11826 #$i_unistd I_UNISTD
11827 #ifdef I_UNISTD
11828 #include <unistd.h>
11829 #endif
11830 #$i_string I_STRING
11831 #ifdef I_STRING
11832 #include <string.h>
11833 #else
11834 #include <strings.h>
11835 #endif
11836 $signal_t blech(x) int x; { exit(3); }
11837 EOCP
11838         $cat >> try.c <<'EOCP'
11839 int main()
11840 {
11841         int pd[2];
11842         int pu[2];
11843         char buf[1];
11844         char string[100];
11845
11846         pipe(pd);       /* Down: child -> parent */
11847         pipe(pu);       /* Up: parent -> child */
11848         if (0 != fork()) {
11849                 int ret;
11850                 close(pd[1]);   /* Parent reads from pd[0] */
11851                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11852 #ifdef F_SETFL
11853                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11854                         exit(1);
11855 #else
11856                 exit(4);
11857 #endif
11858                 signal(SIGALRM, blech);
11859                 alarm(5);
11860                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11861                         exit(2);
11862                 sprintf(string, "%d\n", ret);
11863                 write(2, string, strlen(string));
11864                 alarm(0);
11865 #ifdef EAGAIN
11866                 if (errno == EAGAIN) {
11867                         printf("EAGAIN\n");
11868                         goto ok;
11869                 }
11870 #endif
11871 #ifdef EWOULDBLOCK
11872                 if (errno == EWOULDBLOCK)
11873                         printf("EWOULDBLOCK\n");
11874 #endif
11875         ok:
11876                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11877                 sleep(2);                               /* Give it time to close our pipe */
11878                 alarm(5);
11879                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11880                 alarm(0);
11881                 sprintf(string, "%d\n", ret);
11882                 write(4, string, strlen(string));
11883                 exit(0);
11884         }
11885
11886         close(pd[0]);                   /* We write to pd[1] */
11887         close(pu[1]);                   /* We read from pu[0] */
11888         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11889         close(pd[1]);                   /* Pipe pd is now fully closed! */
11890         exit(0);                                /* Bye bye, thank you for playing! */
11891 }
11892 EOCP
11893         set try
11894         if eval $compile_ok; then
11895                 echo "$startsh" >mtry
11896                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11897                 chmod +x mtry
11898                 ./mtry >/dev/null 2>&1
11899                 case $? in
11900                 0) eagain=`$cat try.out`;;
11901                 1) echo "Could not perform non-blocking setting!";;
11902                 2) echo "I did a successful read() for something that was not there!";;
11903                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11904                 4) echo "Could not find F_SETFL!";;
11905                 *) echo "Something terribly wrong happened during testing.";;
11906                 esac
11907                 rd_nodata=`$cat try.ret`
11908                 echo "A read() system call with no data present returns $rd_nodata."
11909                 case "$rd_nodata" in
11910                 0|-1) ;;
11911                 *)
11912                         echo "(That's peculiar, fixing that to be -1.)"
11913                         rd_nodata=-1
11914                         ;;
11915                 esac
11916                 case "$eagain" in
11917                 '')
11918                         echo "Forcing errno EAGAIN on read() with no data available."
11919                         eagain=EAGAIN
11920                         ;;
11921                 *)
11922                         echo "Your read() sets errno to $eagain when no data is available."
11923                         ;;
11924                 esac
11925                 status=`$cat try.err`
11926                 case "$status" in
11927                 0) echo "And it correctly returns 0 to signal EOF.";;
11928                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11929                 *) echo "However, your read() returns '$status' on EOF??";;
11930                 esac
11931                 val="$define"
11932                 if test "$status" = "$rd_nodata"; then
11933                         echo "WARNING: you can't distinguish between EOF and no data!"
11934                         val="$undef"
11935                 fi
11936         else
11937                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11938                 eagain=EAGAIN
11939         fi
11940         set d_eofnblk
11941         eval $setvar
11942         ;;
11943 *)
11944         echo "Using $hint value $eagain."
11945         echo "Your read() returns $rd_nodata when no data is present."
11946         case "$d_eofnblk" in
11947         "$define") echo "And you can see EOF because read() returns 0.";;
11948         "$undef") echo "But you can't see EOF status from read() returned value.";;
11949         *)
11950                 echo "(Assuming you can't see EOF status from read anyway.)"
11951                 d_eofnblk=$undef
11952                 ;;
11953         esac
11954         ;;
11955 esac
11956 $rm -f try try.* .out core head.c mtry
11957
11958 : see if _ptr and _cnt from stdio act std
11959 echo " "
11960
11961 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11962         echo "(Looks like you have stdio.h from BSD.)"
11963         case "$stdio_ptr" in
11964         '') stdio_ptr='((fp)->_p)'
11965                 ptr_lval=$define
11966                 ;;
11967         *)      ptr_lval=$d_stdio_ptr_lval;;
11968         esac
11969         case "$stdio_cnt" in
11970         '') stdio_cnt='((fp)->_r)'
11971                 cnt_lval=$define
11972                 ;;
11973         *)      cnt_lval=$d_stdio_cnt_lval;;
11974         esac
11975         case "$stdio_base" in
11976         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
11977         esac
11978         case "$stdio_bufsiz" in
11979         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
11980         esac
11981 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
11982         echo "(Looks like you have stdio.h from Linux.)"
11983         case "$stdio_ptr" in
11984         '') stdio_ptr='((fp)->_IO_read_ptr)'
11985                 ptr_lval=$define
11986                 ;;
11987         *)      ptr_lval=$d_stdio_ptr_lval;;
11988         esac
11989         case "$stdio_cnt" in
11990         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
11991                 cnt_lval=$undef
11992                 ;;
11993         *)      cnt_lval=$d_stdio_cnt_lval;;
11994         esac
11995         case "$stdio_base" in
11996         '') stdio_base='((fp)->_IO_read_base)';;
11997         esac
11998         case "$stdio_bufsiz" in
11999         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12000         esac
12001 else
12002         case "$stdio_ptr" in
12003         '') stdio_ptr='((fp)->_ptr)'
12004                 ptr_lval=$define
12005                 ;;
12006         *)      ptr_lval=$d_stdio_ptr_lval;;
12007         esac
12008         case "$stdio_cnt" in
12009         '') stdio_cnt='((fp)->_cnt)'
12010                 cnt_lval=$define
12011                 ;;
12012         *)      cnt_lval=$d_stdio_cnt_lval;;
12013         esac
12014         case "$stdio_base" in
12015         '') stdio_base='((fp)->_base)';;
12016         esac
12017         case "$stdio_bufsiz" in
12018         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12019         esac
12020 fi
12021
12022 : test whether _ptr and _cnt really work
12023 echo "Checking how std your stdio is..." >&4
12024 $cat >try.c <<EOP
12025 #include <stdio.h>
12026 #$i_stdlib I_STDLIB
12027 #ifdef I_STDLIB
12028 #include <stdlib.h>
12029 #endif
12030 #define FILE_ptr(fp)    $stdio_ptr
12031 #define FILE_cnt(fp)    $stdio_cnt
12032 int main() {
12033         FILE *fp = fopen("try.c", "r");
12034         char c = getc(fp);
12035         if (
12036                 18 <= FILE_cnt(fp) &&
12037                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12038         )
12039                 exit(0);
12040         exit(1);
12041 }
12042 EOP
12043 val="$undef"
12044 set try
12045 if eval $compile && $to try.c; then
12046         if $run ./try; then
12047                 echo "Your stdio acts pretty std."
12048                 val="$define"
12049         else
12050                 echo "Your stdio isn't very std."
12051         fi
12052 else
12053         echo "Your stdio doesn't appear very std."
12054 fi
12055 $rm -f try.c try
12056
12057 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12058 # direct buffer manipulation no longer works.  The Configure tests
12059 # should be changed to correctly detect this, but until then,
12060 # the following check should at least let perl compile and run.
12061 # (This quick fix should be updated before 5.8.1.)
12062 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12063 # A. Dougherty, June 3, 2002.
12064 case "$d_gnulibc" in
12065 $define)
12066         case "$gnulibc_version" in
12067         2.[01]*)  ;;
12068         2.2) ;;
12069         2.2.[0-9]) ;;
12070         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12071                 val="$undef"
12072                 ;;
12073         esac
12074         ;;
12075 esac
12076 set d_stdstdio
12077 eval $setvar
12078
12079 : Can _ptr be used as an lvalue?
12080 case "$d_stdstdio$ptr_lval" in
12081 $define$define) val=$define ;;
12082 *) val=$undef ;;
12083 esac
12084 set d_stdio_ptr_lval
12085 eval $setvar
12086
12087 : Can _cnt be used as an lvalue?
12088 case "$d_stdstdio$cnt_lval" in
12089 $define$define) val=$define ;;
12090 *) val=$undef ;;
12091 esac
12092 set d_stdio_cnt_lval
12093 eval $setvar
12094
12095
12096 : test whether setting _ptr sets _cnt as a side effect
12097 d_stdio_ptr_lval_sets_cnt="$undef"
12098 d_stdio_ptr_lval_nochange_cnt="$undef"
12099 case "$d_stdio_ptr_lval$d_stdstdio" in
12100 $define$define)
12101         echo "Checking to see what happens if we set the stdio ptr..." >&4
12102 $cat >try.c <<EOP
12103 #include <stdio.h>
12104 /* Can we scream? */
12105 /* Eat dust sed :-) */
12106 /* In the buffer space, no one can hear you scream. */
12107 #$i_stdlib I_STDLIB
12108 #ifdef I_STDLIB
12109 #include <stdlib.h>
12110 #endif
12111 #define FILE_ptr(fp)    $stdio_ptr
12112 #define FILE_cnt(fp)    $stdio_cnt
12113 #include <sys/types.h>
12114 int main() {
12115         FILE *fp = fopen("try.c", "r");
12116         int c;
12117         char *ptr;
12118         size_t cnt;
12119         if (!fp) {
12120             puts("Fail even to read");
12121             exit(1);
12122         }
12123         c = getc(fp); /* Read away the first # */
12124         if (c == EOF) {
12125             puts("Fail even to read");
12126             exit(1);
12127         }
12128         if (!(
12129                 18 <= FILE_cnt(fp) &&
12130                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12131         )) {
12132                 puts("Fail even to read");
12133                 exit (1);
12134         }
12135         ptr = (char*) FILE_ptr(fp);
12136         cnt = (size_t)FILE_cnt(fp);
12137
12138         FILE_ptr(fp) += 42;
12139
12140         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12141                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12142                 exit (1);
12143         }
12144         if (FILE_cnt(fp) <= 20) {
12145                 printf ("Fail (<20 chars to test)");
12146                 exit (1);
12147         }
12148         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12149                 puts("Fail compare");
12150                 exit (1);
12151         }
12152         if (cnt == FILE_cnt(fp)) {
12153                 puts("Pass_unchanged");
12154                 exit (0);
12155         }       
12156         if (FILE_cnt(fp) == (cnt - 42)) {
12157                 puts("Pass_changed");
12158                 exit (0);
12159         }
12160         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12161         return 1;
12162
12163 }
12164 EOP
12165         set try
12166         if eval $compile && $to try.c; then
12167                 case `$run ./try` in
12168                 Pass_changed)
12169                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12170                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12171                 Pass_unchanged)
12172                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12173                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12174                 Fail*)
12175                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12176                 *)
12177                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12178         esac
12179         else
12180                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12181         fi
12182         $rm -f try.c try
12183         ;;
12184 esac
12185
12186 : see if _base is also standard
12187 val="$undef"
12188 case "$d_stdstdio" in
12189 $define)
12190         $cat >try.c <<EOP
12191 #include <stdio.h>
12192 #$i_stdlib I_STDLIB
12193 #ifdef I_STDLIB
12194 #include <stdlib.h>
12195 #endif
12196 #define FILE_base(fp)   $stdio_base
12197 #define FILE_bufsiz(fp) $stdio_bufsiz
12198 int main() {
12199         FILE *fp = fopen("try.c", "r");
12200         char c = getc(fp);
12201         if (
12202                 19 <= FILE_bufsiz(fp) &&
12203                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12204         )
12205                 exit(0);
12206         exit(1);
12207 }
12208 EOP
12209         set try
12210         if eval $compile && $to try.c; then
12211                 if $run ./try; then
12212                         echo "And its _base field acts std."
12213                         val="$define"
12214                 else
12215                         echo "But its _base field isn't std."
12216                 fi
12217         else
12218                 echo "However, it seems to be lacking the _base field."
12219         fi
12220         $rm -f try.c try
12221         ;;
12222 esac
12223 set d_stdiobase
12224 eval $setvar
12225
12226 : see if fast_stdio exists
12227 val="$undef"
12228 case "$d_stdstdio:$d_stdio_ptr_lval" in
12229 "$define:$define")
12230         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12231         *$define*)
12232                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12233                 val="$define"
12234                 ;;
12235         esac
12236         ;;
12237 esac
12238 set d_faststdio
12239 eval $setvar
12240
12241
12242
12243 : see if fchdir exists
12244 set fchdir d_fchdir
12245 eval $inlibc
12246
12247 : see if fchmod exists
12248 set fchmod d_fchmod
12249 eval $inlibc
12250
12251 : see if fchown exists
12252 set fchown d_fchown
12253 eval $inlibc
12254
12255 : see if this is an fcntl system
12256 set fcntl d_fcntl
12257 eval $inlibc
12258
12259 echo " "
12260 : See if fcntl-based locking works.
12261 $cat >try.c <<EOCP
12262 #$i_stdlib I_STDLIB
12263 #ifdef I_STDLIB
12264 #include <stdlib.h>
12265 #endif
12266 #include <unistd.h>
12267 #include <fcntl.h>
12268 #include <signal.h>
12269 $signal_t blech(x) int x; { exit(3); }
12270 int main() {
12271 #if defined(F_SETLK) && defined(F_SETLKW)
12272      struct flock flock;
12273      int retval, fd;
12274      fd = open("try.c", O_RDONLY);
12275      flock.l_type = F_RDLCK;
12276      flock.l_whence = SEEK_SET;
12277      flock.l_start = flock.l_len = 0;
12278      signal(SIGALRM, blech);
12279      alarm(10);
12280      retval = fcntl(fd, F_SETLK, &flock);
12281      close(fd);
12282      (retval < 0 ? exit(2) : exit(0));
12283 #else
12284      exit(2);
12285 #endif
12286 }
12287 EOCP
12288 echo "Checking if fcntl-based file locking works... "
12289 case "$d_fcntl" in
12290 "$define")
12291         set try
12292         if eval $compile_ok; then
12293                 if $run ./try; then
12294                         echo "Yes, it seems to work."
12295                         val="$define"
12296                 else
12297                         echo "Nope, it didn't work."
12298                         val="$undef"
12299                         case "$?" in
12300                         3) $cat >&4 <<EOM
12301 ***
12302 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12303 *** This is (almost) impossible.
12304 *** If your NFS lock daemons are not feeling well, something like
12305 *** this may happen, please investigate.  Cannot continue, aborting.
12306 ***
12307 EOM
12308                                 exit 1
12309                                 ;;
12310                         esac
12311                 fi
12312         else
12313                 echo "I'm unable to compile the test program, so I'll assume not."
12314                 val="$undef"
12315         fi
12316         ;;
12317 *) val="$undef";
12318         echo "Nope, since you don't even have fcntl()."
12319         ;;
12320 esac
12321 set d_fcntl_can_lock
12322 eval $setvar
12323 $rm -f try*
12324
12325
12326 : check for fd_set items
12327 $cat <<EOM
12328
12329 Checking to see how well your C compiler handles fd_set and friends ...
12330 EOM
12331 $cat >try.c <<EOCP
12332 #$i_stdlib I_STDLIB
12333 #ifdef I_STDLIB
12334 #include <stdlib.h>
12335 #endif
12336 #$i_systime I_SYS_TIME
12337 #$i_sysselct I_SYS_SELECT
12338 #$d_socket HAS_SOCKET
12339 #include <sys/types.h>
12340 #ifdef HAS_SOCKET
12341 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12342 #endif
12343 #ifdef I_SYS_TIME
12344 #include <sys/time.h>
12345 #endif
12346 #ifdef I_SYS_SELECT
12347 #include <sys/select.h>
12348 #endif
12349 int main() {
12350         fd_set fds;
12351
12352 #ifdef TRYBITS
12353         if(fds.fds_bits);
12354 #endif
12355
12356 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12357         exit(0);
12358 #else
12359         exit(1);
12360 #endif
12361 }
12362 EOCP
12363 set try -DTRYBITS
12364 if eval $compile; then
12365         d_fds_bits="$define"
12366         d_fd_set="$define"
12367         echo "Well, your system knows about the normal fd_set typedef..." >&4
12368         if $run ./try; then
12369                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12370                 d_fd_macros="$define"
12371         else
12372                 $cat >&4 <<'EOM'
12373 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12374 EOM
12375                 d_fd_macros="$undef"
12376         fi
12377 else
12378         $cat <<'EOM'
12379 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12380 EOM
12381         set try
12382         if eval $compile; then
12383                 d_fds_bits="$undef"
12384                 d_fd_set="$define"
12385                 echo "Well, your system has some sort of fd_set available..." >&4
12386                 if $run ./try; then
12387                         echo "and you have the normal fd_set macros." >&4
12388                         d_fd_macros="$define"
12389                 else
12390                         $cat <<'EOM'
12391 but not the normal fd_set macros!  Gross!  More work for me...
12392 EOM
12393                         d_fd_macros="$undef"
12394                 fi
12395         else
12396         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12397                 d_fd_set="$undef"
12398                 d_fds_bits="$undef"
12399                 d_fd_macros="$undef"
12400         fi
12401 fi
12402 $rm -f try try.*
12403
12404 : see if fgetpos exists
12405 set fgetpos d_fgetpos
12406 eval $inlibc
12407
12408 : see if finite exists
12409 set finite d_finite
12410 eval $inlibc
12411
12412 : see if finitel exists
12413 set finitel d_finitel
12414 eval $inlibc
12415
12416 : see if flock exists
12417 set flock d_flock
12418 eval $inlibc
12419
12420 : see if prototype for flock is available
12421 echo " "
12422 set d_flockproto flock $i_sysfile sys/file.h
12423 eval $hasproto
12424
12425 : see if fork exists
12426 set fork d_fork
12427 eval $inlibc
12428
12429 : see if fp_class exists
12430 set fp_class d_fp_class
12431 eval $inlibc
12432
12433 : see if pathconf exists
12434 set pathconf d_pathconf
12435 eval $inlibc
12436
12437 : see if fpathconf exists
12438 set fpathconf d_fpathconf
12439 eval $inlibc
12440
12441 : see if fpclass exists
12442 set fpclass d_fpclass
12443 eval $inlibc
12444
12445 : see if fpclassify exists
12446 set fpclassify d_fpclassify
12447 eval $inlibc
12448
12449 : see if fpclassl exists
12450 set fpclassl d_fpclassl
12451 eval $inlibc
12452
12453
12454 : check for fpos64_t
12455 echo " "
12456 echo "Checking to see if you have fpos64_t..." >&4
12457 $cat >try.c <<EOCP
12458 #include <stdio.h>
12459 int main() { fpos64_t x = 7; }
12460 EOCP
12461 set try
12462 if eval $compile; then
12463         val="$define"
12464         echo "You have fpos64_t."
12465 else
12466         val="$undef"
12467         echo "You do not have fpos64_t."
12468         case "$fpossize" in
12469         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12470         esac
12471 fi
12472 $rm -f try.* try
12473 set d_fpos64_t
12474 eval $setvar
12475
12476 : see if frexpl exists
12477 set frexpl d_frexpl
12478 eval $inlibc
12479
12480 : see if this is a sys/param system
12481 set sys/param.h i_sysparam
12482 eval $inhdr
12483
12484 : see if this is a sys/mount.h system
12485 set sys/mount.h i_sysmount
12486 eval $inhdr
12487
12488
12489 echo " "
12490 echo "Checking to see if your system supports struct fs_data..." >&4
12491 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12492 eval $hasstruct
12493 case "$d_fs_data_s" in
12494 "$define")      echo "Yes, it does."   ;;
12495 *)              echo "No, it doesn't." ;;
12496 esac
12497
12498 : see if fseeko exists
12499 set fseeko d_fseeko
12500 eval $inlibc
12501 case "$longsize" in
12502 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12503 esac
12504
12505 : see if fsetpos exists
12506 set fsetpos d_fsetpos
12507 eval $inlibc
12508
12509
12510 : see if fstatfs exists
12511 set fstatfs d_fstatfs
12512 eval $inlibc
12513
12514
12515 : see if statvfs exists
12516 set statvfs d_statvfs
12517 eval $inlibc
12518
12519 : see if fstatvfs exists
12520 set fstatvfs d_fstatvfs
12521 eval $inlibc
12522
12523
12524 : see if fsync exists
12525 set fsync d_fsync
12526 eval $inlibc
12527
12528 : see if ftello exists
12529 set ftello d_ftello
12530 eval $inlibc
12531 case "$longsize" in
12532 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12533 esac
12534
12535 d_futimes="$undef"
12536 : check for a working futimes
12537 echo " "
12538 echo "Checking for a working futimes()" >&4
12539 $cat >try.c <<EOCP
12540 #include <stdio.h>
12541 #include <sys/time.h>
12542 #include <errno.h>
12543 #include <fcntl.h>
12544
12545 int main ()
12546 {
12547     int fd, rv;
12548     fd = open ("try.c", O_RDWR);
12549     if (-1 == fd) exit (1);
12550     rv = futimes (fd, NULL);
12551     exit (rv == -1 ? errno : 0);
12552 }
12553 EOCP
12554 set try
12555 if eval $compile; then
12556     `$run ./try`
12557     rc=$?
12558     case "$rc" in
12559         0)  echo "Yes, it does" >&4
12560             d_futimes="$define"
12561             ;;
12562         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12563             ;;
12564     esac
12565 else
12566     echo "No, it does not (probably harmless)\n" >&4
12567 fi
12568 $rm -f try.* try core core.try.*
12569
12570 : see if getcwd exists
12571 set getcwd d_getcwd
12572 eval $inlibc
12573
12574 : see if getespwnam exists
12575 set getespwnam d_getespwnam
12576 eval $inlibc
12577
12578
12579 : see if getfsstat exists
12580 set getfsstat d_getfsstat
12581 eval $inlibc
12582
12583 : see if getgrent exists
12584 set getgrent d_getgrent
12585 eval $inlibc
12586
12587 : see if getgrent_r exists
12588 set getgrent_r d_getgrent_r
12589 eval $inlibc
12590 case "$d_getgrent_r" in
12591 "$define")
12592         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12593         case "$d_getgrent_r_proto:$usethreads" in
12594         ":define")      d_getgrent_r_proto=define
12595                 set d_getgrent_r_proto getgrent_r $hdrs
12596                 eval $hasproto ;;
12597         *)      ;;
12598         esac
12599         case "$d_getgrent_r_proto" in
12600         define)
12601         case "$getgrent_r_proto" in
12602         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12603         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12604         esac
12605         case "$getgrent_r_proto" in
12606         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12607         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12608         esac
12609         case "$getgrent_r_proto" in
12610         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12611         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12612         esac
12613         case "$getgrent_r_proto" in
12614         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12615         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12616         esac
12617         case "$getgrent_r_proto" in
12618         ''|0) try='int getgrent_r(struct group*, char*, int);'
12619         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12620         esac
12621         case "$getgrent_r_proto" in
12622         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12623         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12624         esac
12625         case "$getgrent_r_proto" in
12626         ''|0)   d_getgrent_r=undef
12627                 getgrent_r_proto=0
12628                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12629         * )     case "$getgrent_r_proto" in
12630                 REENTRANT_PROTO*) ;;
12631                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12632                 esac
12633                 echo "Prototype: $try" ;;
12634         esac
12635         ;;
12636         *)      case "$usethreads" in
12637                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12638                 esac
12639                 d_getgrent_r=undef
12640                 getgrent_r_proto=0
12641                 ;;
12642         esac
12643         ;;
12644 *)      getgrent_r_proto=0
12645         ;;
12646 esac
12647
12648 : see if getgrgid_r exists
12649 set getgrgid_r d_getgrgid_r
12650 eval $inlibc
12651 case "$d_getgrgid_r" in
12652 "$define")
12653         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12654         case "$d_getgrgid_r_proto:$usethreads" in
12655         ":define")      d_getgrgid_r_proto=define
12656                 set d_getgrgid_r_proto getgrgid_r $hdrs
12657                 eval $hasproto ;;
12658         *)      ;;
12659         esac
12660         case "$d_getgrgid_r_proto" in
12661         define)
12662         case "$getgrgid_r_proto" in
12663         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12664         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12665         esac
12666         case "$getgrgid_r_proto" in
12667         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12668         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12669         esac
12670         case "$getgrgid_r_proto" in
12671         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12672         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12673         esac
12674         case "$getgrgid_r_proto" in
12675         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12676         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12677         esac
12678         case "$getgrgid_r_proto" in
12679         ''|0)   d_getgrgid_r=undef
12680                 getgrgid_r_proto=0
12681                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12682         * )     case "$getgrgid_r_proto" in
12683                 REENTRANT_PROTO*) ;;
12684                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12685                 esac
12686                 echo "Prototype: $try" ;;
12687         esac
12688         ;;
12689         *)      case "$usethreads" in
12690                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12691                 esac
12692                 d_getgrgid_r=undef
12693                 getgrgid_r_proto=0
12694                 ;;
12695         esac
12696         ;;
12697 *)      getgrgid_r_proto=0
12698         ;;
12699 esac
12700
12701 : see if getgrnam_r exists
12702 set getgrnam_r d_getgrnam_r
12703 eval $inlibc
12704 case "$d_getgrnam_r" in
12705 "$define")
12706         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12707         case "$d_getgrnam_r_proto:$usethreads" in
12708         ":define")      d_getgrnam_r_proto=define
12709                 set d_getgrnam_r_proto getgrnam_r $hdrs
12710                 eval $hasproto ;;
12711         *)      ;;
12712         esac
12713         case "$d_getgrnam_r_proto" in
12714         define)
12715         case "$getgrnam_r_proto" in
12716         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12717         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12718         esac
12719         case "$getgrnam_r_proto" in
12720         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12721         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12722         esac
12723         case "$getgrnam_r_proto" in
12724         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12725         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12726         esac
12727         case "$getgrnam_r_proto" in
12728         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12729         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12730         esac
12731         case "$getgrnam_r_proto" in
12732         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12733         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12734         esac
12735         case "$getgrnam_r_proto" in
12736         ''|0)   d_getgrnam_r=undef
12737                 getgrnam_r_proto=0
12738                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12739         * )     case "$getgrnam_r_proto" in
12740                 REENTRANT_PROTO*) ;;
12741                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12742                 esac
12743                 echo "Prototype: $try" ;;
12744         esac
12745         ;;
12746         *)      case "$usethreads" in
12747                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12748                 esac
12749                 d_getgrnam_r=undef
12750                 getgrnam_r_proto=0
12751                 ;;
12752         esac
12753         ;;
12754 *)      getgrnam_r_proto=0
12755         ;;
12756 esac
12757
12758 : see if gethostbyaddr exists
12759 set gethostbyaddr d_gethbyaddr
12760 eval $inlibc
12761
12762 : see if gethostbyname exists
12763 set gethostbyname d_gethbyname
12764 eval $inlibc
12765
12766 : see if gethostent exists
12767 set gethostent d_gethent
12768 eval $inlibc
12769
12770 : see how we will look up host name
12771 echo " "
12772 call=''
12773 if set gethostname val -f d_gethname; eval $csym; $val; then
12774         echo 'gethostname() found.' >&4
12775         d_gethname="$define"
12776         call=gethostname
12777 fi
12778 if set uname val -f d_uname; eval $csym; $val; then
12779         if ./xenix; then
12780                 $cat <<'EOM'
12781 uname() was found, but you're running xenix, and older versions of xenix
12782 have a broken uname(). If you don't really know whether your xenix is old
12783 enough to have a broken system call, use the default answer.
12784
12785 EOM
12786                 dflt=y
12787                 case "$d_uname" in
12788                 "$define") dflt=n;;
12789                 esac
12790                 rp='Is your uname() broken?'
12791                 . ./myread
12792                 case "$ans" in
12793                 n*) d_uname="$define"; call=uname;;
12794                 esac
12795         else
12796                 echo 'uname() found.' >&4
12797                 d_uname="$define"
12798                 case "$call" in
12799                 '') call=uname ;;
12800                 esac
12801         fi
12802 fi
12803 case "$d_gethname" in
12804 '') d_gethname="$undef";;
12805 esac
12806 case "$d_uname" in
12807 '') d_uname="$undef";;
12808 esac
12809 case "$d_uname$d_gethname" in
12810 *define*)
12811         dflt=n
12812         cat <<EOM
12813  
12814 Every now and then someone has a $call() that lies about the hostname
12815 but can't be fixed for political or economic reasons.  If you wish, I can
12816 pretend $call() isn't there and maybe compute hostname at run-time
12817 thanks to the '$phostname' command.
12818
12819 EOM
12820         rp="Shall I ignore $call() from now on?"
12821         . ./myread
12822         case "$ans" in
12823         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12824         esac;;
12825 esac
12826 case "$phostname" in
12827 '') aphostname='';;
12828 *) case "$aphostname" in
12829         /*) ;;
12830         *) set X $phostname
12831                 shift
12832                 file=$1
12833                 shift
12834                 file=`./loc $file $file $pth`
12835                 aphostname=`echo $file $*`
12836                 ;;
12837         esac
12838         ;;
12839 esac
12840 case "$d_uname$d_gethname" in
12841 *define*) ;;
12842 *)
12843         case "$phostname" in
12844         '')
12845                 echo "There will be no way for $package to get your hostname." >&4;;
12846         *)
12847         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12848                 ;;
12849         esac;;
12850 esac
12851 case "$d_phostname" in
12852 '') d_phostname="$undef";;
12853 esac
12854
12855 : see if gethostbyaddr_r exists
12856 set gethostbyaddr_r d_gethostbyaddr_r
12857 eval $inlibc
12858 case "$d_gethostbyaddr_r" in
12859 "$define")
12860         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12861         case "$d_gethostbyaddr_r_proto:$usethreads" in
12862         ":define")      d_gethostbyaddr_r_proto=define
12863                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12864                 eval $hasproto ;;
12865         *)      ;;
12866         esac
12867         case "$d_gethostbyaddr_r_proto" in
12868         define)
12869         case "$gethostbyaddr_r_proto" in
12870         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12871         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12872         esac
12873         case "$gethostbyaddr_r_proto" in
12874         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12875         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12876         esac
12877         case "$gethostbyaddr_r_proto" in
12878         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12879         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12880         esac
12881         case "$gethostbyaddr_r_proto" in
12882         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12883         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12884         esac
12885         case "$gethostbyaddr_r_proto" in
12886         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12887         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12888         esac
12889         case "$gethostbyaddr_r_proto" in
12890         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12891         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12892         esac
12893         case "$gethostbyaddr_r_proto" in
12894         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12895         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12896         esac
12897         case "$gethostbyaddr_r_proto" in
12898         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12899         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12900         esac
12901         case "$gethostbyaddr_r_proto" in
12902         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12903         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12904         esac
12905         case "$gethostbyaddr_r_proto" in
12906         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12907         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12908         esac
12909         case "$gethostbyaddr_r_proto" in
12910         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12911         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12912         esac
12913         case "$gethostbyaddr_r_proto" in
12914         ''|0)   d_gethostbyaddr_r=undef
12915                 gethostbyaddr_r_proto=0
12916                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12917         * )     case "$gethostbyaddr_r_proto" in
12918                 REENTRANT_PROTO*) ;;
12919                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12920                 esac
12921                 echo "Prototype: $try" ;;
12922         esac
12923         ;;
12924         *)      case "$usethreads" in
12925                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12926                 esac
12927                 d_gethostbyaddr_r=undef
12928                 gethostbyaddr_r_proto=0
12929                 ;;
12930         esac
12931         ;;
12932 *)      gethostbyaddr_r_proto=0
12933         ;;
12934 esac
12935
12936 : see if gethostbyname_r exists
12937 set gethostbyname_r d_gethostbyname_r
12938 eval $inlibc
12939 case "$d_gethostbyname_r" in
12940 "$define")
12941         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12942         case "$d_gethostbyname_r_proto:$usethreads" in
12943         ":define")      d_gethostbyname_r_proto=define
12944                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12945                 eval $hasproto ;;
12946         *)      ;;
12947         esac
12948         case "$d_gethostbyname_r_proto" in
12949         define)
12950         case "$gethostbyname_r_proto" in
12951         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12952         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12953         esac
12954         case "$gethostbyname_r_proto" in
12955         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12956         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12957         esac
12958         case "$gethostbyname_r_proto" in
12959         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12960         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12961         esac
12962         case "$gethostbyname_r_proto" in
12963         ''|0)   d_gethostbyname_r=undef
12964                 gethostbyname_r_proto=0
12965                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12966         * )     case "$gethostbyname_r_proto" in
12967                 REENTRANT_PROTO*) ;;
12968                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12969                 esac
12970                 echo "Prototype: $try" ;;
12971         esac
12972         ;;
12973         *)      case "$usethreads" in
12974                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
12975                 esac
12976                 d_gethostbyname_r=undef
12977                 gethostbyname_r_proto=0
12978                 ;;
12979         esac
12980         ;;
12981 *)      gethostbyname_r_proto=0
12982         ;;
12983 esac
12984
12985 : see if gethostent_r exists
12986 set gethostent_r d_gethostent_r
12987 eval $inlibc
12988 case "$d_gethostent_r" in
12989 "$define")
12990         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12991         case "$d_gethostent_r_proto:$usethreads" in
12992         ":define")      d_gethostent_r_proto=define
12993                 set d_gethostent_r_proto gethostent_r $hdrs
12994                 eval $hasproto ;;
12995         *)      ;;
12996         esac
12997         case "$d_gethostent_r_proto" in
12998         define)
12999         case "$gethostent_r_proto" in
13000         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13001         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13002         esac
13003         case "$gethostent_r_proto" in
13004         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13005         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13006         esac
13007         case "$gethostent_r_proto" in
13008         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13009         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13010         esac
13011         case "$gethostent_r_proto" in
13012         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13013         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13014         esac
13015         case "$gethostent_r_proto" in
13016         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13017         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13018         esac
13019         case "$gethostent_r_proto" in
13020         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13021         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13022         esac
13023         case "$gethostent_r_proto" in
13024         ''|0)   d_gethostent_r=undef
13025                 gethostent_r_proto=0
13026                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13027         * )     case "$gethostent_r_proto" in
13028                 REENTRANT_PROTO*) ;;
13029                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13030                 esac
13031                 echo "Prototype: $try" ;;
13032         esac
13033         ;;
13034         *)      case "$usethreads" in
13035                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13036                 esac
13037                 d_gethostent_r=undef
13038                 gethostent_r_proto=0
13039                 ;;
13040         esac
13041         ;;
13042 *)      gethostent_r_proto=0
13043         ;;
13044 esac
13045
13046 : see if prototypes for various gethostxxx netdb.h functions are available
13047 echo " "
13048 set d_gethostprotos gethostent $i_netdb netdb.h
13049 eval $hasproto
13050
13051 : see if getitimer exists
13052 set getitimer d_getitimer
13053 eval $inlibc
13054
13055 : see if getlogin exists
13056 set getlogin d_getlogin
13057 eval $inlibc
13058
13059 : see if getlogin_r exists
13060 set getlogin_r d_getlogin_r
13061 eval $inlibc
13062 case "$d_getlogin_r" in
13063 "$define")
13064         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13065         case "$d_getlogin_r_proto:$usethreads" in
13066         ":define")      d_getlogin_r_proto=define
13067                 set d_getlogin_r_proto getlogin_r $hdrs
13068                 eval $hasproto ;;
13069         *)      ;;
13070         esac
13071         case "$d_getlogin_r_proto" in
13072         define)
13073         case "$getlogin_r_proto" in
13074         ''|0) try='int getlogin_r(char*, size_t);'
13075         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13076         esac
13077         case "$getlogin_r_proto" in
13078         ''|0) try='int getlogin_r(char*, int);'
13079         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13080         esac
13081         case "$getlogin_r_proto" in
13082         ''|0) try='char* getlogin_r(char*, size_t);'
13083         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13084         esac
13085         case "$getlogin_r_proto" in
13086         ''|0) try='char* getlogin_r(char*, int);'
13087         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13088         esac
13089         case "$getlogin_r_proto" in
13090         ''|0)   d_getlogin_r=undef
13091                 getlogin_r_proto=0
13092                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13093         * )     case "$getlogin_r_proto" in
13094                 REENTRANT_PROTO*) ;;
13095                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13096                 esac
13097                 echo "Prototype: $try" ;;
13098         esac
13099         ;;
13100         *)      case "$usethreads" in
13101                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13102                 esac
13103                 d_getlogin_r=undef
13104                 getlogin_r_proto=0
13105                 ;;
13106         esac
13107         ;;
13108 *)      getlogin_r_proto=0
13109         ;;
13110 esac
13111
13112 : see if getmnt exists
13113 set getmnt d_getmnt
13114 eval $inlibc
13115
13116 : see if getmntent exists
13117 set getmntent d_getmntent
13118 eval $inlibc
13119
13120 : see if getnetbyaddr exists
13121 set getnetbyaddr d_getnbyaddr
13122 eval $inlibc
13123
13124 : see if getnetbyname exists
13125 set getnetbyname d_getnbyname
13126 eval $inlibc
13127
13128 : see if getnetent exists
13129 set getnetent d_getnent
13130 eval $inlibc
13131
13132 : see if getnetbyaddr_r exists
13133 set getnetbyaddr_r d_getnetbyaddr_r
13134 eval $inlibc
13135 case "$d_getnetbyaddr_r" in
13136 "$define")
13137         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13138         case "$d_getnetbyaddr_r_proto:$usethreads" in
13139         ":define")      d_getnetbyaddr_r_proto=define
13140                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13141                 eval $hasproto ;;
13142         *)      ;;
13143         esac
13144         case "$d_getnetbyaddr_r_proto" in
13145         define)
13146         case "$getnetbyaddr_r_proto" in
13147         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13148         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13149         esac
13150         case "$getnetbyaddr_r_proto" in
13151         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13152         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13153         esac
13154         case "$getnetbyaddr_r_proto" in
13155         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13156         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13157         esac
13158         case "$getnetbyaddr_r_proto" in
13159         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13160         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13161         esac
13162         case "$getnetbyaddr_r_proto" in
13163         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13164         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13165         esac
13166         case "$getnetbyaddr_r_proto" in
13167         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13168         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13169         esac
13170         case "$getnetbyaddr_r_proto" in
13171         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13172         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13173         esac
13174         case "$getnetbyaddr_r_proto" in
13175         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13176         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13177         esac
13178         case "$getnetbyaddr_r_proto" in
13179         ''|0)   d_getnetbyaddr_r=undef
13180                 getnetbyaddr_r_proto=0
13181                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13182         * )     case "$getnetbyaddr_r_proto" in
13183                 REENTRANT_PROTO*) ;;
13184                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13185                 esac
13186                 echo "Prototype: $try" ;;
13187         esac
13188         ;;
13189         *)      case "$usethreads" in
13190                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13191                 esac
13192                 d_getnetbyaddr_r=undef
13193                 getnetbyaddr_r_proto=0
13194                 ;;
13195         esac
13196         ;;
13197 *)      getnetbyaddr_r_proto=0
13198         ;;
13199 esac
13200
13201 : see if getnetbyname_r exists
13202 set getnetbyname_r d_getnetbyname_r
13203 eval $inlibc
13204 case "$d_getnetbyname_r" in
13205 "$define")
13206         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13207         case "$d_getnetbyname_r_proto:$usethreads" in
13208         ":define")      d_getnetbyname_r_proto=define
13209                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13210                 eval $hasproto ;;
13211         *)      ;;
13212         esac
13213         case "$d_getnetbyname_r_proto" in
13214         define)
13215         case "$getnetbyname_r_proto" in
13216         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13217         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13218         esac
13219         case "$getnetbyname_r_proto" in
13220         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13221         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13222         esac
13223         case "$getnetbyname_r_proto" in
13224         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13225         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13226         esac
13227         case "$getnetbyname_r_proto" in
13228         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13229         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13230         esac
13231         case "$getnetbyname_r_proto" in
13232         ''|0)   d_getnetbyname_r=undef
13233                 getnetbyname_r_proto=0
13234                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13235         * )     case "$getnetbyname_r_proto" in
13236                 REENTRANT_PROTO*) ;;
13237                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13238                 esac
13239                 echo "Prototype: $try" ;;
13240         esac
13241         ;;
13242         *)      case "$usethreads" in
13243                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13244                 esac
13245                 d_getnetbyname_r=undef
13246                 getnetbyname_r_proto=0
13247                 ;;
13248         esac
13249         ;;
13250 *)      getnetbyname_r_proto=0
13251         ;;
13252 esac
13253
13254 : see if getnetent_r exists
13255 set getnetent_r d_getnetent_r
13256 eval $inlibc
13257 case "$d_getnetent_r" in
13258 "$define")
13259         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13260         case "$d_getnetent_r_proto:$usethreads" in
13261         ":define")      d_getnetent_r_proto=define
13262                 set d_getnetent_r_proto getnetent_r $hdrs
13263                 eval $hasproto ;;
13264         *)      ;;
13265         esac
13266         case "$d_getnetent_r_proto" in
13267         define)
13268         case "$getnetent_r_proto" in
13269         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13270         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13271         esac
13272         case "$getnetent_r_proto" in
13273         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13274         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13275         esac
13276         case "$getnetent_r_proto" in
13277         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13278         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13279         esac
13280         case "$getnetent_r_proto" in
13281         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13282         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13283         esac
13284         case "$getnetent_r_proto" in
13285         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13286         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13287         esac
13288         case "$getnetent_r_proto" in
13289         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13290         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13291         esac
13292         case "$getnetent_r_proto" in
13293         ''|0)   d_getnetent_r=undef
13294                 getnetent_r_proto=0
13295                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13296         * )     case "$getnetent_r_proto" in
13297                 REENTRANT_PROTO*) ;;
13298                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13299                 esac
13300                 echo "Prototype: $try" ;;
13301         esac
13302         ;;
13303         *)      case "$usethreads" in
13304                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13305                 esac
13306                 d_getnetent_r=undef
13307                 getnetent_r_proto=0
13308                 ;;
13309         esac
13310         ;;
13311 *)      getnetent_r_proto=0
13312         ;;
13313 esac
13314
13315 : see if prototypes for various getnetxxx netdb.h functions are available
13316 echo " "
13317 set d_getnetprotos getnetent $i_netdb netdb.h
13318 eval $hasproto
13319
13320 : see if getpagesize exists
13321 set getpagesize d_getpagsz
13322 eval $inlibc
13323
13324
13325 : see if getprotobyname exists
13326 set getprotobyname d_getpbyname
13327 eval $inlibc
13328
13329 : see if getprotobynumber exists
13330 set getprotobynumber d_getpbynumber
13331 eval $inlibc
13332
13333 : see if getprotoent exists
13334 set getprotoent d_getpent
13335 eval $inlibc
13336
13337 : see if getpgid exists
13338 set getpgid d_getpgid
13339 eval $inlibc
13340
13341 : see if getpgrp2 exists
13342 set getpgrp2 d_getpgrp2
13343 eval $inlibc
13344
13345 : see if getppid exists
13346 set getppid d_getppid
13347 eval $inlibc
13348
13349 : see if getpriority exists
13350 set getpriority d_getprior
13351 eval $inlibc
13352
13353 : see if getprotobyname_r exists
13354 set getprotobyname_r d_getprotobyname_r
13355 eval $inlibc
13356 case "$d_getprotobyname_r" in
13357 "$define")
13358         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13359         case "$d_getprotobyname_r_proto:$usethreads" in
13360         ":define")      d_getprotobyname_r_proto=define
13361                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13362                 eval $hasproto ;;
13363         *)      ;;
13364         esac
13365         case "$d_getprotobyname_r_proto" in
13366         define)
13367         case "$getprotobyname_r_proto" in
13368         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13369         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13370         esac
13371         case "$getprotobyname_r_proto" in
13372         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13373         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13374         esac
13375         case "$getprotobyname_r_proto" in
13376         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13377         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13378         esac
13379         case "$getprotobyname_r_proto" in
13380         ''|0)   d_getprotobyname_r=undef
13381                 getprotobyname_r_proto=0
13382                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13383         * )     case "$getprotobyname_r_proto" in
13384                 REENTRANT_PROTO*) ;;
13385                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13386                 esac
13387                 echo "Prototype: $try" ;;
13388         esac
13389         ;;
13390         *)      case "$usethreads" in
13391                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13392                 esac
13393                 d_getprotobyname_r=undef
13394                 getprotobyname_r_proto=0
13395                 ;;
13396         esac
13397         ;;
13398 *)      getprotobyname_r_proto=0
13399         ;;
13400 esac
13401
13402 : see if getprotobynumber_r exists
13403 set getprotobynumber_r d_getprotobynumber_r
13404 eval $inlibc
13405 case "$d_getprotobynumber_r" in
13406 "$define")
13407         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13408         case "$d_getprotobynumber_r_proto:$usethreads" in
13409         ":define")      d_getprotobynumber_r_proto=define
13410                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13411                 eval $hasproto ;;
13412         *)      ;;
13413         esac
13414         case "$d_getprotobynumber_r_proto" in
13415         define)
13416         case "$getprotobynumber_r_proto" in
13417         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13418         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13419         esac
13420         case "$getprotobynumber_r_proto" in
13421         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13422         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13423         esac
13424         case "$getprotobynumber_r_proto" in
13425         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13426         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13427         esac
13428         case "$getprotobynumber_r_proto" in
13429         ''|0)   d_getprotobynumber_r=undef
13430                 getprotobynumber_r_proto=0
13431                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13432         * )     case "$getprotobynumber_r_proto" in
13433                 REENTRANT_PROTO*) ;;
13434                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13435                 esac
13436                 echo "Prototype: $try" ;;
13437         esac
13438         ;;
13439         *)      case "$usethreads" in
13440                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13441                 esac
13442                 d_getprotobynumber_r=undef
13443                 getprotobynumber_r_proto=0
13444                 ;;
13445         esac
13446         ;;
13447 *)      getprotobynumber_r_proto=0
13448         ;;
13449 esac
13450
13451 : see if getprotoent_r exists
13452 set getprotoent_r d_getprotoent_r
13453 eval $inlibc
13454 case "$d_getprotoent_r" in
13455 "$define")
13456         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13457         case "$d_getprotoent_r_proto:$usethreads" in
13458         ":define")      d_getprotoent_r_proto=define
13459                 set d_getprotoent_r_proto getprotoent_r $hdrs
13460                 eval $hasproto ;;
13461         *)      ;;
13462         esac
13463         case "$d_getprotoent_r_proto" in
13464         define)
13465         case "$getprotoent_r_proto" in
13466         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13467         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13468         esac
13469         case "$getprotoent_r_proto" in
13470         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13471         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13472         esac
13473         case "$getprotoent_r_proto" in
13474         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13475         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13476         esac
13477         case "$getprotoent_r_proto" in
13478         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13479         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13480         esac
13481         case "$getprotoent_r_proto" in
13482         ''|0)   d_getprotoent_r=undef
13483                 getprotoent_r_proto=0
13484                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13485         * )     case "$getprotoent_r_proto" in
13486                 REENTRANT_PROTO*) ;;
13487                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13488                 esac
13489                 echo "Prototype: $try" ;;
13490         esac
13491         ;;
13492         *)      case "$usethreads" in
13493                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13494                 esac
13495                 d_getprotoent_r=undef
13496                 getprotoent_r_proto=0
13497                 ;;
13498         esac
13499         ;;
13500 *)      getprotoent_r_proto=0
13501         ;;
13502 esac
13503
13504 : see if prototypes for various getprotoxxx netdb.h functions are available
13505 echo " "
13506 set d_getprotoprotos getprotoent $i_netdb netdb.h
13507 eval $hasproto
13508
13509 : see if getprpwnam exists
13510 set getprpwnam d_getprpwnam
13511 eval $inlibc
13512
13513 : see if getpwent exists
13514 set getpwent d_getpwent
13515 eval $inlibc
13516
13517 : see if getpwent_r exists
13518 set getpwent_r d_getpwent_r
13519 eval $inlibc
13520 case "$d_getpwent_r" in
13521 "$define")
13522         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13523         case "$d_getpwent_r_proto:$usethreads" in
13524         ":define")      d_getpwent_r_proto=define
13525                 set d_getpwent_r_proto getpwent_r $hdrs
13526                 eval $hasproto ;;
13527         *)      ;;
13528         esac
13529         case "$d_getpwent_r_proto" in
13530         define)
13531         case "$getpwent_r_proto" in
13532         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13533         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13534         esac
13535         case "$getpwent_r_proto" in
13536         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13537         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13538         esac
13539         case "$getpwent_r_proto" in
13540         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13541         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13542         esac
13543         case "$getpwent_r_proto" in
13544         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13545         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13546         esac
13547         case "$getpwent_r_proto" in
13548         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13549         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13550         esac
13551         case "$getpwent_r_proto" in
13552         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13553         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13554         esac
13555         case "$getpwent_r_proto" in
13556         ''|0)   d_getpwent_r=undef
13557                 getpwent_r_proto=0
13558                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13559         * )     case "$getpwent_r_proto" in
13560                 REENTRANT_PROTO*) ;;
13561                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13562                 esac
13563                 echo "Prototype: $try" ;;
13564         esac
13565         ;;
13566         *)      case "$usethreads" in
13567                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13568                 esac
13569                 d_getpwent_r=undef
13570                 getpwent_r_proto=0
13571                 ;;
13572         esac
13573         ;;
13574 *)      getpwent_r_proto=0
13575         ;;
13576 esac
13577
13578 : see if getpwnam_r exists
13579 set getpwnam_r d_getpwnam_r
13580 eval $inlibc
13581 case "$d_getpwnam_r" in
13582 "$define")
13583         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13584         case "$d_getpwnam_r_proto:$usethreads" in
13585         ":define")      d_getpwnam_r_proto=define
13586                 set d_getpwnam_r_proto getpwnam_r $hdrs
13587                 eval $hasproto ;;
13588         *)      ;;
13589         esac
13590         case "$d_getpwnam_r_proto" in
13591         define)
13592         case "$getpwnam_r_proto" in
13593         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13594         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13595         esac
13596         case "$getpwnam_r_proto" in
13597         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13598         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13599         esac
13600         case "$getpwnam_r_proto" in
13601         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13602         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13603         esac
13604         case "$getpwnam_r_proto" in
13605         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13606         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13607         esac
13608         case "$getpwnam_r_proto" in
13609         ''|0)   d_getpwnam_r=undef
13610                 getpwnam_r_proto=0
13611                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13612         * )     case "$getpwnam_r_proto" in
13613                 REENTRANT_PROTO*) ;;
13614                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13615                 esac
13616                 echo "Prototype: $try" ;;
13617         esac
13618         ;;
13619         *)      case "$usethreads" in
13620                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13621                 esac
13622                 d_getpwnam_r=undef
13623                 getpwnam_r_proto=0
13624                 ;;
13625         esac
13626         ;;
13627 *)      getpwnam_r_proto=0
13628         ;;
13629 esac
13630
13631 : see if getpwuid_r exists
13632 set getpwuid_r d_getpwuid_r
13633 eval $inlibc
13634 case "$d_getpwuid_r" in
13635 "$define")
13636         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13637         case "$d_getpwuid_r_proto:$usethreads" in
13638         ":define")      d_getpwuid_r_proto=define
13639                 set d_getpwuid_r_proto getpwuid_r $hdrs
13640                 eval $hasproto ;;
13641         *)      ;;
13642         esac
13643         case "$d_getpwuid_r_proto" in
13644         define)
13645         case "$getpwuid_r_proto" in
13646         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13647         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13648         esac
13649         case "$getpwuid_r_proto" in
13650         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13651         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13652         esac
13653         case "$getpwuid_r_proto" in
13654         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13655         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13656         esac
13657         case "$getpwuid_r_proto" in
13658         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13659         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13660         esac
13661         case "$getpwuid_r_proto" in
13662         ''|0)   d_getpwuid_r=undef
13663                 getpwuid_r_proto=0
13664                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13665         * )     case "$getpwuid_r_proto" in
13666                 REENTRANT_PROTO*) ;;
13667                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13668                 esac
13669                 echo "Prototype: $try" ;;
13670         esac
13671         ;;
13672         *)      case "$usethreads" in
13673                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13674                 esac
13675                 d_getpwuid_r=undef
13676                 getpwuid_r_proto=0
13677                 ;;
13678         esac
13679         ;;
13680 *)      getpwuid_r_proto=0
13681         ;;
13682 esac
13683
13684
13685 : see if getservbyname exists
13686 set getservbyname d_getsbyname
13687 eval $inlibc
13688
13689 : see if getservbyport exists
13690 set getservbyport d_getsbyport
13691 eval $inlibc
13692
13693 : see if getservent exists
13694 set getservent d_getsent
13695 eval $inlibc
13696
13697 : see if getservbyname_r exists
13698 set getservbyname_r d_getservbyname_r
13699 eval $inlibc
13700 case "$d_getservbyname_r" in
13701 "$define")
13702         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13703         case "$d_getservbyname_r_proto:$usethreads" in
13704         ":define")      d_getservbyname_r_proto=define
13705                 set d_getservbyname_r_proto getservbyname_r $hdrs
13706                 eval $hasproto ;;
13707         *)      ;;
13708         esac
13709         case "$d_getservbyname_r_proto" in
13710         define)
13711         case "$getservbyname_r_proto" in
13712         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13713         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13714         esac
13715         case "$getservbyname_r_proto" in
13716         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13717         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13718         esac
13719         case "$getservbyname_r_proto" in
13720         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13721         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13722         esac
13723         case "$getservbyname_r_proto" in
13724         ''|0)   d_getservbyname_r=undef
13725                 getservbyname_r_proto=0
13726                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13727         * )     case "$getservbyname_r_proto" in
13728                 REENTRANT_PROTO*) ;;
13729                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13730                 esac
13731                 echo "Prototype: $try" ;;
13732         esac
13733         ;;
13734         *)      case "$usethreads" in
13735                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13736                 esac
13737                 d_getservbyname_r=undef
13738                 getservbyname_r_proto=0
13739                 ;;
13740         esac
13741         ;;
13742 *)      getservbyname_r_proto=0
13743         ;;
13744 esac
13745
13746 : see if getservbyport_r exists
13747 set getservbyport_r d_getservbyport_r
13748 eval $inlibc
13749 case "$d_getservbyport_r" in
13750 "$define")
13751         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13752         case "$d_getservbyport_r_proto:$usethreads" in
13753         ":define")      d_getservbyport_r_proto=define
13754                 set d_getservbyport_r_proto getservbyport_r $hdrs
13755                 eval $hasproto ;;
13756         *)      ;;
13757         esac
13758         case "$d_getservbyport_r_proto" in
13759         define)
13760         case "$getservbyport_r_proto" in
13761         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13762         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13763         esac
13764         case "$getservbyport_r_proto" in
13765         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13766         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13767         esac
13768         case "$getservbyport_r_proto" in
13769         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13770         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13771         esac
13772         case "$getservbyport_r_proto" in
13773         ''|0)   d_getservbyport_r=undef
13774                 getservbyport_r_proto=0
13775                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13776         * )     case "$getservbyport_r_proto" in
13777                 REENTRANT_PROTO*) ;;
13778                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13779                 esac
13780                 echo "Prototype: $try" ;;
13781         esac
13782         ;;
13783         *)      case "$usethreads" in
13784                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13785                 esac
13786                 d_getservbyport_r=undef
13787                 getservbyport_r_proto=0
13788                 ;;
13789         esac
13790         ;;
13791 *)      getservbyport_r_proto=0
13792         ;;
13793 esac
13794
13795 : see if getservent_r exists
13796 set getservent_r d_getservent_r
13797 eval $inlibc
13798 case "$d_getservent_r" in
13799 "$define")
13800         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13801         case "$d_getservent_r_proto:$usethreads" in
13802         ":define")      d_getservent_r_proto=define
13803                 set d_getservent_r_proto getservent_r $hdrs
13804                 eval $hasproto ;;
13805         *)      ;;
13806         esac
13807         case "$d_getservent_r_proto" in
13808         define)
13809         case "$getservent_r_proto" in
13810         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13811         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13812         esac
13813         case "$getservent_r_proto" in
13814         ''|0) try='int getservent_r(struct servent*, char*, int);'
13815         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13816         esac
13817         case "$getservent_r_proto" in
13818         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13819         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13820         esac
13821         case "$getservent_r_proto" in
13822         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13823         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13824         esac
13825         case "$getservent_r_proto" in
13826         ''|0)   d_getservent_r=undef
13827                 getservent_r_proto=0
13828                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13829         * )     case "$getservent_r_proto" in
13830                 REENTRANT_PROTO*) ;;
13831                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13832                 esac
13833                 echo "Prototype: $try" ;;
13834         esac
13835         ;;
13836         *)      case "$usethreads" in
13837                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13838                 esac
13839                 d_getservent_r=undef
13840                 getservent_r_proto=0
13841                 ;;
13842         esac
13843         ;;
13844 *)      getservent_r_proto=0
13845         ;;
13846 esac
13847
13848 : see if prototypes for various getservxxx netdb.h functions are available
13849 echo " "
13850 set d_getservprotos getservent $i_netdb netdb.h
13851 eval $hasproto
13852
13853 : see if getspnam exists
13854 set getspnam d_getspnam
13855 eval $inlibc
13856
13857 : see if this is a shadow.h system
13858 set shadow.h i_shadow
13859 eval $inhdr
13860
13861 : see if getspnam_r exists
13862 set getspnam_r d_getspnam_r
13863 eval $inlibc
13864 case "$d_getspnam_r" in
13865 "$define")
13866         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13867         case "$d_getspnam_r_proto:$usethreads" in
13868         ":define")      d_getspnam_r_proto=define
13869                 set d_getspnam_r_proto getspnam_r $hdrs
13870                 eval $hasproto ;;
13871         *)      ;;
13872         esac
13873         case "$d_getspnam_r_proto" in
13874         define)
13875         case "$getspnam_r_proto" in
13876         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13877         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13878         esac
13879         case "$getspnam_r_proto" in
13880         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13881         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13882         esac
13883         case "$getspnam_r_proto" in
13884         ''|0)   d_getspnam_r=undef
13885                 getspnam_r_proto=0
13886                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13887         * )     case "$getspnam_r_proto" in
13888                 REENTRANT_PROTO*) ;;
13889                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13890                 esac
13891                 echo "Prototype: $try" ;;
13892         esac
13893         ;;
13894         *)      case "$usethreads" in
13895                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13896                 esac
13897                 d_getspnam_r=undef
13898                 getspnam_r_proto=0
13899                 ;;
13900         esac
13901         ;;
13902 *)      getspnam_r_proto=0
13903         ;;
13904 esac
13905
13906 : see if gettimeofday or ftime exists
13907 set gettimeofday d_gettimeod
13908 eval $inlibc
13909 case "$d_gettimeod" in
13910 "$undef")
13911         set ftime d_ftime 
13912         eval $inlibc
13913         ;;
13914 *)
13915         val="$undef"; set d_ftime; eval $setvar
13916         ;;
13917 esac
13918 case "$d_gettimeod$d_ftime" in
13919 "$undef$undef")
13920         echo " "
13921         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13922         ;;
13923 esac
13924
13925 : see if gmtime_r exists
13926 set gmtime_r d_gmtime_r
13927 eval $inlibc
13928 case "$d_gmtime_r" in
13929 "$define")
13930         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13931         case "$d_gmtime_r_proto:$usethreads" in
13932         ":define")      d_gmtime_r_proto=define
13933                 set d_gmtime_r_proto gmtime_r $hdrs
13934                 eval $hasproto ;;
13935         *)      ;;
13936         esac
13937         case "$d_gmtime_r_proto" in
13938         define)
13939         case "$gmtime_r_proto" in
13940         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13941         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13942         esac
13943         case "$gmtime_r_proto" in
13944         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13945         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13946         esac
13947         case "$gmtime_r_proto" in
13948         ''|0)   d_gmtime_r=undef
13949                 gmtime_r_proto=0
13950                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13951         * )     case "$gmtime_r_proto" in
13952                 REENTRANT_PROTO*) ;;
13953                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13954                 esac
13955                 echo "Prototype: $try" ;;
13956         esac
13957         ;;
13958         *)      case "$usethreads" in
13959                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13960                 esac
13961                 d_gmtime_r=undef
13962                 gmtime_r_proto=0
13963                 ;;
13964         esac
13965         ;;
13966 *)      gmtime_r_proto=0
13967         ;;
13968 esac
13969
13970 : see if hasmntopt exists
13971 set hasmntopt d_hasmntopt
13972 eval $inlibc
13973
13974 : see if this is a netinet/in.h or sys/in.h system
13975 set netinet/in.h i_niin sys/in.h i_sysin
13976 eval $inhdr
13977
13978 : see if arpa/inet.h has to be included
13979 set arpa/inet.h i_arpainet
13980 eval $inhdr
13981
13982 : see if htonl --and friends-- exists
13983 val=''
13984 set htonl val
13985 eval $inlibc
13986
13987 : Maybe they are macros.
13988 case "$val" in
13989 $undef)
13990         $cat >htonl.c <<EOM
13991 #include <stdio.h>
13992 #include <sys/types.h>
13993 #$i_niin I_NETINET_IN
13994 #$i_sysin I_SYS_IN
13995 #$i_arpainet I_ARPA_INET
13996 #ifdef I_NETINET_IN
13997 #include <netinet/in.h>
13998 #endif
13999 #ifdef I_SYS_IN
14000 #include <sys/in.h>
14001 #endif
14002 #ifdef I_ARPA_INET
14003 #include <arpa/inet.h>
14004 #endif
14005 #ifdef htonl
14006 printf("Defined as a macro.");
14007 #endif
14008 EOM
14009         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14010         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14011                 val="$define"
14012                 echo "But it seems to be defined as a macro." >&4
14013         fi
14014         $rm -f htonl.?
14015         ;;
14016 esac
14017 set d_htonl
14018 eval $setvar
14019
14020 : see if ilogbl exists
14021 set ilogbl d_ilogbl
14022 eval $inlibc
14023
14024 : index or strchr
14025 echo " "
14026 if set index val -f; eval $csym; $val; then
14027         if set strchr val -f d_strchr; eval $csym; $val; then
14028                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14029                         val="$define"
14030                         vali="$undef"
14031                         echo "strchr() found." >&4
14032                 else
14033                         val="$undef"
14034                         vali="$define"
14035                         echo "index() found." >&4
14036                 fi
14037         else
14038                 val="$undef"
14039                 vali="$define"
14040                 echo "index() found." >&4
14041         fi
14042 else
14043         if set strchr val -f d_strchr; eval $csym; $val; then
14044                 val="$define"
14045                 vali="$undef"
14046                 echo "strchr() found." >&4
14047         else
14048                 echo "No index() or strchr() found!" >&4
14049                 val="$undef"
14050                 vali="$undef"
14051         fi
14052 fi
14053 set d_strchr; eval $setvar
14054 val="$vali"
14055 set d_index; eval $setvar
14056
14057 : check whether inet_aton exists
14058 set inet_aton d_inetaton
14059 eval $inlibc
14060
14061 : Look for isascii
14062 echo " "
14063 $cat >isascii.c <<EOCP
14064 #include <stdio.h>
14065 #include <ctype.h>
14066 #$i_stdlib I_STDLIB
14067 #ifdef I_STDLIB
14068 #include <stdlib.h>
14069 #endif
14070 int main() {
14071         int c = 'A';
14072         if (isascii(c))
14073                 exit(0);
14074         else
14075                 exit(1);
14076 }
14077 EOCP
14078 set isascii
14079 if eval $compile; then
14080         echo "isascii() found." >&4
14081         val="$define"
14082 else
14083         echo "isascii() NOT found." >&4
14084         val="$undef"
14085 fi
14086 set d_isascii
14087 eval $setvar
14088 $rm -f isascii*
14089
14090 : see if isfinite exists
14091 set isfinite d_isfinite
14092 eval $inlibc
14093
14094 : see if isinf exists
14095 set isinf d_isinf
14096 eval $inlibc
14097
14098 : see if isnan exists
14099 set isnan d_isnan
14100 eval $inlibc
14101
14102 : see if isnanl exists
14103 set isnanl d_isnanl
14104 eval $inlibc
14105
14106 : see if killpg exists
14107 set killpg d_killpg
14108 eval $inlibc
14109
14110 : see if lchown exists
14111 echo " "
14112 $cat > try.c <<'EOCP'
14113 /* System header to define __stub macros and hopefully few prototypes,
14114     which can conflict with char lchown(); below.  */
14115 #include <assert.h>
14116 /* Override any gcc2 internal prototype to avoid an error.  */
14117 /* We use char because int might match the return type of a gcc2
14118    builtin and then its argument prototype would still apply.  */
14119 char lchown();
14120 int main() {
14121     /*  The GNU C library defines this for functions which it implements
14122         to always fail with ENOSYS.  Some functions are actually named
14123         something starting with __ and the normal name is an alias.  */
14124 #if defined (__stub_lchown) || defined (__stub___lchown)
14125 choke me
14126 #else
14127 lchown();
14128 #endif
14129 ; return 0; }
14130 EOCP
14131 set try
14132 if eval $compile; then
14133     $echo "lchown() found." >&4
14134     val="$define"
14135 else
14136     $echo "lchown() NOT found." >&4
14137     val="$undef"
14138 fi
14139 set d_lchown
14140 eval $setvar
14141
14142 : See if number of significant digits in a double precision number is known
14143 echo " "
14144 $cat >ldbl_dig.c <<EOM
14145 #$i_limits I_LIMITS
14146 #$i_float I_FLOAT
14147 #ifdef I_LIMITS
14148 #include <limits.h>
14149 #endif
14150 #ifdef I_FLOAT
14151 #include <float.h>
14152 #endif
14153 #ifdef LDBL_DIG
14154 printf("Contains LDBL_DIG");
14155 #endif
14156 EOM
14157 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14158 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14159         echo "LDBL_DIG found." >&4
14160         val="$define"
14161 else
14162         echo "LDBL_DIG NOT found." >&4
14163         val="$undef"
14164 fi
14165 $rm -f ldbl_dig.?
14166 set d_ldbl_dig
14167 eval $setvar
14168
14169 : see if this is a math.h system
14170 set math.h i_math
14171 eval $inhdr
14172
14173 d_libm_lib_version="$undef"
14174 case $i_math in
14175     $define)
14176         : check to see if math.h defines _LIB_VERSION
14177         echo " "
14178         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14179         $cat >try.c <<EOCP
14180 #include <unistd.h>
14181 #include <math.h>
14182 int main (int argc, char *argv[])
14183 {
14184     printf ("%d\n", _LIB_VERSION);
14185     return (0);
14186     } /* main */
14187 EOCP
14188         set try
14189         if eval $compile; then
14190             foo=`$run ./try`
14191             echo "Yes, it does ($foo)" >&4
14192             d_libm_lib_version="$define"
14193         else
14194             echo "No, it does not (probably harmless)\n" >&4
14195             fi
14196         $rm -f try.* try core core.try.*
14197         ;;
14198
14199     esac
14200
14201 : see if link exists
14202 set link d_link
14203 eval $inlibc
14204
14205 : see if localtime_r exists
14206 set localtime_r d_localtime_r
14207 eval $inlibc
14208 case "$d_localtime_r" in
14209 "$define")
14210         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14211         case "$d_localtime_r_proto:$usethreads" in
14212         ":define")      d_localtime_r_proto=define
14213                 set d_localtime_r_proto localtime_r $hdrs
14214                 eval $hasproto ;;
14215         *)      ;;
14216         esac
14217         case "$d_localtime_r_proto" in
14218         define)
14219         case "$localtime_r_proto" in
14220         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14221         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14222         esac
14223         case "$localtime_r_proto" in
14224         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14225         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14226         esac
14227         case "$localtime_r_proto" in
14228         ''|0)   d_localtime_r=undef
14229                 localtime_r_proto=0
14230                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14231         * )     case "$localtime_r_proto" in
14232                 REENTRANT_PROTO*) ;;
14233                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14234                 esac
14235                 echo "Prototype: $try" ;;
14236         esac
14237         ;;
14238         *)      case "$usethreads" in
14239                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14240                 esac
14241                 d_localtime_r=undef
14242                 localtime_r_proto=0
14243                 ;;
14244         esac
14245         ;;
14246 *)      localtime_r_proto=0
14247         ;;
14248 esac
14249
14250 : see if localeconv exists
14251 set localeconv d_locconv
14252 eval $inlibc
14253
14254 : see if lockf exists
14255 set lockf d_lockf
14256 eval $inlibc
14257
14258 : see if prototype for lseek is available
14259 echo " "
14260 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14261 eval $hasproto
14262
14263 : see if lstat exists
14264 set lstat d_lstat
14265 eval $inlibc
14266
14267 : see if madvise exists
14268 set madvise d_madvise
14269 eval $inlibc
14270
14271 : see if malloc_size exists
14272 set malloc_size d_malloc_size
14273 eval $inlibc
14274
14275 : see if malloc_size_good exists
14276 set malloc_good_size d_malloc_good_size
14277 eval $inlibc
14278
14279 : see if mblen exists
14280 set mblen d_mblen
14281 eval $inlibc
14282
14283 : see if mbstowcs exists
14284 set mbstowcs d_mbstowcs
14285 eval $inlibc
14286
14287 : see if mbtowc exists
14288 set mbtowc d_mbtowc
14289 eval $inlibc
14290
14291 : see if memchr exists
14292 set memchr d_memchr
14293 eval $inlibc
14294
14295 : see if memcmp exists
14296 set memcmp d_memcmp
14297 eval $inlibc
14298
14299 : see if memcpy exists
14300 set memcpy d_memcpy
14301 eval $inlibc
14302
14303 : see if memmove exists
14304 set memmove d_memmove
14305 eval $inlibc
14306
14307 : see if memset exists
14308 set memset d_memset
14309 eval $inlibc
14310
14311 : see if mkdir exists
14312 set mkdir d_mkdir
14313 eval $inlibc
14314
14315 : see if mkdtemp exists
14316 set mkdtemp d_mkdtemp
14317 eval $inlibc
14318
14319 : see if mkfifo exists
14320 set mkfifo d_mkfifo
14321 eval $inlibc
14322
14323 : see if mkstemp exists
14324 set mkstemp d_mkstemp
14325 eval $inlibc
14326
14327 : see if mkstemps exists
14328 set mkstemps d_mkstemps
14329 eval $inlibc
14330
14331 : see if mktime exists
14332 set mktime d_mktime
14333 eval $inlibc
14334
14335 : see if this is a sys/mman.h system
14336 set sys/mman.h i_sysmman
14337 eval $inhdr
14338
14339 : see if mmap exists
14340 set mmap d_mmap
14341 eval $inlibc
14342 : see what shmat returns
14343 : default to something harmless
14344 mmaptype='void *'
14345 case "$i_sysmman$d_mmap" in
14346 "$define$define")
14347         $cat >mmap.c <<'END'
14348 #include <sys/mman.h>
14349 void *mmap();
14350 END
14351         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14352                 mmaptype='void *'
14353         else
14354                 mmaptype='caddr_t'
14355         fi
14356         echo "and it returns ($mmaptype)." >&4
14357         ;;
14358 esac
14359
14360
14361
14362 : see if sqrtl exists
14363 set sqrtl d_sqrtl
14364 eval $inlibc
14365
14366 : see if scalbnl exists
14367 set scalbnl d_scalbnl
14368 eval $inlibc
14369
14370 : see if modfl exists
14371 set modfl d_modfl
14372 eval $inlibc
14373
14374 : see if prototype for modfl is available
14375 echo " "
14376 set d_modflproto modfl $i_math math.h
14377 eval $hasproto
14378
14379 d_modfl_pow32_bug="$undef"
14380
14381 case "$d_longdbl$d_modfl" in
14382 $define$define)
14383         $cat <<EOM
14384 Checking to see whether your modfl() is okay for large values...
14385 EOM
14386 $cat >try.c <<EOCP
14387 #include <math.h> 
14388 #include <stdio.h>
14389 EOCP
14390 if $test "X$d_modflproto" != "X$define"; then
14391         $cat >>try.c <<EOCP
14392 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14393 long double modfl (long double, long double *);
14394 EOCP
14395 fi
14396 $cat >>try.c <<EOCP
14397 int main() {
14398     long double nv = 4294967303.15;
14399     long double v, w;
14400     v = modfl(nv, &w);         
14401 #ifdef __GLIBC__
14402     printf("glibc");
14403 #endif
14404     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14405     return 0;
14406 }
14407 EOCP
14408         case "$osname:$gccversion" in
14409         aix:)   saveccflags="$ccflags"
14410                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14411         esac
14412         set try
14413         if eval $compile; then
14414                 foo=`$run ./try`
14415                 case "$foo" in
14416                 *" 4294967303.150000 1.150000 4294967302.000000")
14417                         echo >&4 "Your modfl() is broken for large values."
14418                         d_modfl_pow32_bug="$define"
14419                         case "$foo" in
14420                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14421                         ;;
14422                         esac
14423                         ;;
14424                 *" 4294967303.150000 0.150000 4294967303.000000")
14425                         echo >&4 "Your modfl() seems okay for large values."
14426                         ;;
14427                 *)      echo >&4 "I don't understand your modfl() at all."
14428                         d_modfl="$undef"
14429                         ;;
14430                 esac
14431                 $rm -f try.* try core core.try.*
14432         else
14433                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14434                 d_modfl="$undef"
14435         fi
14436         case "$osname:$gccversion" in
14437         aix:)   ccflags="$saveccflags" ;; # restore
14438         esac
14439         ;;
14440 esac
14441
14442 if $test "$uselongdouble" = "$define"; then
14443     message=""
14444     if $test "$d_sqrtl" != "$define"; then
14445         message="$message sqrtl"
14446     fi
14447     if $test "$d_modfl" != "$define"; then
14448         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14449             echo "You have both aintl and copysignl, so I can emulate modfl."
14450         else
14451             message="$message modfl"
14452         fi
14453     fi
14454     if $test "$d_frexpl" != "$define"; then
14455         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14456             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14457         else
14458             message="$message frexpl"
14459         fi
14460     fi
14461
14462     if $test "$message" != ""; then
14463         $cat <<EOM >&4
14464
14465 *** You requested the use of long doubles but you do not seem to have
14466 *** the following mathematical functions needed for long double support:
14467 ***    $message
14468 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14469 *** Cannot continue, aborting.
14470
14471 EOM
14472
14473         exit 1
14474     fi
14475 fi
14476
14477 : see if mprotect exists
14478 set mprotect d_mprotect
14479 eval $inlibc
14480
14481 : see if msgctl exists
14482 set msgctl d_msgctl
14483 eval $inlibc
14484
14485 : see if msgget exists
14486 set msgget d_msgget
14487 eval $inlibc
14488
14489 : see if msgsnd exists
14490 set msgsnd d_msgsnd
14491 eval $inlibc
14492
14493 : see if msgrcv exists
14494 set msgrcv d_msgrcv
14495 eval $inlibc
14496
14497 : see how much of the 'msg*(2)' library is present.
14498 h_msg=true
14499 echo " "
14500 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14501 *"$undef"*) h_msg=false;;
14502 esac
14503 case "$osname" in
14504 freebsd)
14505     case "`ipcs 2>&1`" in
14506     "SVID messages"*"not configured"*)
14507         echo "Your $osname does not have the msg*(2) configured." >&4
14508         h_msg=false
14509         val="$undef"
14510         set msgctl d_msgctl
14511         eval $setvar
14512         set msgget d_msgget
14513         eval $setvar
14514         set msgsnd d_msgsnd
14515         eval $setvar
14516         set msgrcv d_msgrcv
14517         eval $setvar
14518         ;;
14519     esac
14520     ;;
14521 esac
14522 : we could also check for sys/ipc.h ...
14523 if $h_msg && $test `./findhdr sys/msg.h`; then
14524         echo "You have the full msg*(2) library." >&4
14525         val="$define"
14526 else
14527         echo "You don't have the full msg*(2) library." >&4
14528         val="$undef"
14529 fi
14530 set d_msg
14531 eval $setvar
14532
14533
14534 echo " "
14535 echo "Checking to see if your system supports struct msghdr..." >&4
14536 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14537 eval $hasstruct
14538 case "$d_msghdr_s" in
14539 "$define")      echo "Yes, it does."   ;;
14540 *)              echo "No, it doesn't." ;;
14541 esac
14542
14543
14544 : see if msync exists
14545 set msync d_msync
14546 eval $inlibc
14547
14548 : see if munmap exists
14549 set munmap d_munmap
14550 eval $inlibc
14551
14552 : see if nice exists
14553 set nice d_nice
14554 eval $inlibc
14555
14556 : see if this is a langinfo.h system
14557 set langinfo.h i_langinfo
14558 eval $inhdr
14559
14560 : see if nl_langinfo exists
14561 set nl_langinfo d_nl_langinfo
14562 eval $inlibc
14563
14564 : check for length of character
14565 echo " "
14566 case "$charsize" in
14567 '')
14568         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14569         $cat >try.c <<EOCP
14570 #include <stdio.h>
14571 #$i_stdlib I_STDLIB
14572 #ifdef I_STDLIB
14573 #include <stdlib.h>
14574 #endif
14575 int main()
14576 {
14577     printf("%d\n", (int)sizeof(char));
14578     exit(0);
14579 }
14580 EOCP
14581         set try
14582         if eval $compile_ok; then
14583                 dflt=`$run ./try`
14584         else
14585                 dflt='1'
14586                 echo "(I can't seem to compile the test program.  Guessing...)"
14587         fi
14588         ;;
14589 *)
14590         dflt="$charsize"
14591         ;;
14592 esac
14593 rp="What is the size of a character (in bytes)?"
14594 . ./myread
14595 charsize="$ans"
14596 $rm -f try.c try
14597
14598 : check for volatile keyword
14599 echo " "
14600 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14601 $cat >try.c <<'EOCP'
14602 int main()
14603 {
14604         typedef struct _goo_struct goo_struct;
14605         goo_struct * volatile goo = ((goo_struct *)0);
14606         struct _goo_struct {
14607                 long long_int;
14608                 int reg_int;
14609                 char char_var;
14610         };
14611         typedef unsigned short foo_t;
14612         char *volatile foo;
14613         volatile int bar;
14614         volatile foo_t blech;
14615         foo = foo;
14616 }
14617 EOCP
14618 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14619         val="$define"
14620         echo "Yup, it does."
14621 else
14622         val="$undef"
14623         echo "Nope, it doesn't."
14624 fi
14625 set d_volatile
14626 eval $setvar
14627 $rm -f try.*
14628
14629
14630 echo " "
14631 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14632
14633 case "$use64bitint:$d_quad:$quadtype" in
14634 define:define:?*)
14635         ivtype="$quadtype"
14636         uvtype="$uquadtype"
14637         ivsize=8
14638         uvsize=8
14639         ;;
14640 *)      ivtype="long"
14641         uvtype="unsigned long"
14642         ivsize=$longsize
14643         uvsize=$longsize
14644         ;;
14645 esac
14646
14647 case "$uselongdouble:$d_longdbl" in
14648 define:define)
14649         nvtype="long double"
14650         nvsize=$longdblsize
14651         ;;
14652 *)      nvtype=double
14653         nvsize=$doublesize
14654         ;;
14655 esac
14656
14657 $echo "(IV will be "$ivtype", $ivsize bytes)"
14658 $echo "(UV will be "$uvtype", $uvsize bytes)"
14659 $echo "(NV will be "$nvtype", $nvsize bytes)"
14660
14661 $cat >try.c <<EOCP
14662 #$i_inttypes I_INTTYPES
14663 #ifdef I_INTTYPES
14664 #include <inttypes.h>
14665 #endif
14666 #include <stdio.h>
14667 int main() {
14668 #ifdef INT8
14669    int8_t i =  INT8_MAX;
14670   uint8_t u = UINT8_MAX;
14671   printf("int8_t\n");
14672 #endif
14673 #ifdef INT16
14674    int16_t i =  INT16_MAX;
14675   uint16_t i = UINT16_MAX;
14676   printf("int16_t\n");
14677 #endif
14678 #ifdef INT32
14679    int32_t i =  INT32_MAX;
14680   uint32_t u = UINT32_MAX;
14681   printf("int32_t\n");
14682 #endif
14683 }
14684 EOCP
14685
14686 case "$i8type" in
14687 '')     case "$charsize" in
14688         1)      i8type=char
14689                 u8type="unsigned char"
14690                 i8size=$charsize
14691                 u8size=$charsize
14692                 ;;
14693         esac
14694         ;;
14695 esac
14696 case "$i8type" in
14697 '')     set try -DINT8
14698         if eval $compile; then
14699                 case "`$run ./try`" in
14700                 int8_t) i8type=int8_t
14701                         u8type=uint8_t
14702                         i8size=1
14703                         u8size=1
14704                         ;;
14705                 esac
14706         fi
14707         ;;
14708 esac
14709 case "$i8type" in
14710 '')     if $test $charsize -ge 1; then
14711                 i8type=char
14712                 u8type="unsigned char"
14713                 i8size=$charsize
14714                 u8size=$charsize
14715         fi
14716         ;;
14717 esac
14718
14719 case "$i16type" in
14720 '')     case "$shortsize" in
14721         2)      i16type=short
14722                 u16type="unsigned short"
14723                 i16size=$shortsize
14724                 u16size=$shortsize
14725                 ;;
14726         esac
14727         ;;
14728 esac
14729 case "$i16type" in
14730 '')     set try -DINT16
14731         if eval $compile; then
14732                 case "`$run ./try`" in
14733                 int16_t)
14734                         i16type=int16_t
14735                         u16type=uint16_t
14736                         i16size=2
14737                         u16size=2
14738                         ;;
14739                 esac
14740         fi
14741         ;;
14742 esac
14743 case "$i16type" in
14744 '')     if $test $shortsize -ge 2; then
14745                 i16type=short
14746                 u16type="unsigned short"
14747                 i16size=$shortsize
14748                 u16size=$shortsize
14749         fi
14750         ;;
14751 esac
14752
14753 case "$i32type" in
14754 '')     case "$longsize" in
14755         4)      i32type=long
14756                 u32type="unsigned long"
14757                 i32size=$longsize
14758                 u32size=$longsize
14759                 ;;
14760         *)      case "$intsize" in
14761                 4)      i32type=int
14762                         u32type="unsigned int"
14763                         i32size=$intsize
14764                         u32size=$intsize
14765                         ;;
14766                 esac
14767                 ;;
14768         esac
14769         ;;
14770 esac
14771 case "$i32type" in
14772 '')     set try -DINT32
14773         if eval $compile; then
14774                 case "`$run ./try`" in
14775                 int32_t)
14776                         i32type=int32_t
14777                         u32type=uint32_t
14778                         i32size=4
14779                         u32size=4
14780                         ;;
14781                 esac
14782         fi
14783         ;;
14784 esac
14785 case "$i32type" in
14786 '')     if $test $intsize -ge 4; then
14787                 i32type=int
14788                 u32type="unsigned int"
14789                 i32size=$intsize
14790                 u32size=$intsize
14791         fi
14792         ;;
14793 esac
14794
14795 case "$i64type" in
14796 '')     case "$d_quad:$quadtype" in
14797         define:?*)
14798                 i64type="$quadtype"
14799                 u64type="$uquadtype"
14800                 i64size=8
14801                 u64size=8
14802                 ;;
14803         esac
14804         ;;
14805 esac
14806
14807 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14808 : volatile so that the compiler has to store it out to memory.
14809 if test X"$d_volatile" = X"$define"; then
14810         volatile=volatile
14811 fi
14812 $cat <<EOP >try.c
14813 #include <stdio.h>
14814 #$i_stdlib I_STDLIB
14815 #ifdef I_STDLIB
14816 #include <stdlib.h>
14817 #endif
14818 #include <sys/types.h>
14819 #include <signal.h>
14820 #ifdef SIGFPE
14821 $volatile int bletched = 0;
14822 $signal_t blech(s) int s; { bletched = 1; }
14823 #endif
14824 int main() {
14825     $uvtype u = 0;
14826     $nvtype d;
14827     int     n = 8 * $uvsize;
14828     int     i;
14829 #ifdef SIGFPE
14830     signal(SIGFPE, blech);
14831 #endif
14832
14833     for (i = 0; i < n; i++) {
14834       u = u << 1 | ($uvtype)1;
14835       d = ($nvtype)u;
14836       if (($uvtype)d != u)
14837         break;
14838       if (d <= 0)
14839         break;
14840       d = ($nvtype)(u - 1);
14841       if (($uvtype)d != (u - 1))
14842         break;
14843 #ifdef SIGFPE
14844       if (bletched) {
14845         break;
14846 #endif
14847       } 
14848     }
14849     printf("%d\n", ((i == n) ? -n : i));
14850     exit(0);
14851 }
14852 EOP
14853 set try
14854
14855 d_nv_preserves_uv="$undef"
14856 if eval $compile; then
14857         nv_preserves_uv_bits="`$run ./try`"
14858 fi
14859 case "$nv_preserves_uv_bits" in
14860 \-[1-9]*)       
14861         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14862         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14863         d_nv_preserves_uv="$define"
14864         ;;
14865 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14866         d_nv_preserves_uv="$undef" ;;
14867 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14868         nv_preserves_uv_bits="$undef" ;;
14869 esac
14870
14871 $rm -f try.* try
14872
14873 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14874 : volatile so that the compiler has to store it out to memory.
14875 if test X"$d_volatile" = X"$define"; then
14876         volatile=volatile
14877 fi
14878 $cat <<EOP >try.c
14879 #include <stdio.h>
14880 #$i_stdlib I_STDLIB
14881 #ifdef I_STDLIB
14882 #include <stdlib.h>
14883 #endif
14884 #$i_string I_STRING
14885 #ifdef I_STRING
14886 #  include <string.h>
14887 #else
14888 #  include <strings.h>
14889 #endif
14890 #include <sys/types.h>
14891 #include <signal.h>
14892 #ifdef SIGFPE
14893 $volatile int bletched = 0;
14894 $signal_t blech(s) int s; { bletched = 1; }
14895 #endif
14896
14897 int checkit($nvtype d, char *where) {
14898     unsigned char *p = (char *)&d;
14899     unsigned char *end = p + sizeof(d);
14900     int fail = 0;
14901
14902     while (p < end)
14903         fail += *p++;
14904
14905     if (!fail)
14906         return 0;
14907
14908     p = (char *)&d;
14909     printf("No - %s: 0x", where);
14910     while (p < end)
14911         printf ("%02X", *p++);
14912     printf("\n");
14913     return 1;
14914 }
14915
14916 int main(int argc, char **argv) {
14917     $nvtype d = 0.0;
14918     int fail = 0;
14919     fail += checkit(d, "0.0");
14920
14921     /* The compiler shouldn't be assuming that bletched is 0  */
14922     d = bletched;
14923
14924     fail += checkit(d, "bleched");
14925
14926 #ifdef SIGFPE
14927     signal(SIGFPE, blech);
14928 #endif
14929
14930     /* Paranoia - the compiler should have no way of knowing that ANSI says
14931        that argv[argc] will always be NULL.  Actually, if it did assume this it
14932        would be buggy, as this is C and main() can be called from elsewhere in
14933        the program.  */
14934     d = argv[argc] ? 1 : 0;
14935
14936     if (d) {
14937         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14938     }
14939
14940     fail += checkit(d, "ternary");
14941
14942     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14943
14944     if (d != 0.0) {
14945         printf("No - memset doesn't give 0.0\n");
14946         /* This might just blow up:  */
14947         printf("(gives %g)\n", d);
14948         return 1;
14949     }
14950     
14951 #ifdef SIGFPE
14952     if (bletched) {
14953         printf("No - something bleched\n");
14954         return 1;
14955     }
14956 #endif
14957     if (fail) {
14958       printf("No - %d fail(s)\n", fail);
14959       return 1;
14960     }
14961     printf("Yes\n");
14962     return 0;
14963 }
14964 EOP
14965 set try
14966
14967 d_nv_zero_is_allbits_zero="$undef"
14968 if eval $compile; then
14969     xxx="`$run ./try`"
14970     case "$?" in
14971         0)
14972             case "$xxx" in
14973                 Yes)  cat >&4 <<EOM
14974 0.0 is represented as all bits zero in memory
14975 EOM
14976                     d_nv_zero_is_allbits_zero="$define"
14977                     ;;
14978                 *)  cat >&4 <<EOM
14979 0.0 is not represented as all bits zero in memory
14980 EOM
14981                     d_nv_zero_is_allbits_zero="$undef"
14982                     ;;
14983             esac
14984             ;;
14985         *)  cat >&4 <<EOM
14986 0.0 is not represented as all bits zero in memory
14987 EOM
14988             d_nv_zero_is_allbits_zero="$undef"
14989             ;;
14990     esac
14991 fi
14992
14993 $rm -f try.* try
14994
14995
14996 : check for off64_t
14997 echo " "
14998 echo "Checking to see if you have off64_t..." >&4
14999 $cat >try.c <<EOCP
15000 #include <sys/types.h>
15001 #include <unistd.h>
15002 int main() { off64_t x = 7; }
15003 EOCP
15004 set try
15005 if eval $compile; then
15006         val="$define"
15007         echo "You have off64_t."
15008 else
15009         val="$undef"
15010         echo "You do not have off64_t."
15011         case "$lseeksize" in
15012         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15013         esac
15014 fi
15015 $rm -f try.* try
15016 set d_off64_t
15017 eval $setvar
15018
15019 : how to create joinable pthreads
15020 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15021         echo " "
15022         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15023         $cat >try.c <<'EOCP'
15024 #include <pthread.h>
15025 int main() {
15026     int detachstate = JOINABLE;
15027 }
15028 EOCP
15029         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15030         if eval $compile; then
15031                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15032                 val="$undef" # Yes, undef.
15033                 set d_old_pthread_create_joinable
15034                 eval $setvar
15035                 val=""
15036                 set old_pthread_create_joinable
15037                 eval $setvar
15038         else
15039                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15040                 if eval $compile; then
15041                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15042                         val="$define"
15043                         set d_old_pthread_create_joinable
15044                         eval $setvar
15045                         val=PTHREAD_CREATE_UNDETACHED
15046                         set old_pthread_create_joinable
15047                         eval $setvar
15048                 else            
15049                         set try -DJOINABLE=__UNDETACHED
15050                         if eval $compile; then
15051                                 echo "You seem to use __UNDETACHED." >&4
15052                                 val="$define"
15053                                 set d_old_pthread_create_joinable
15054                                 eval $setvar
15055                                 val=__UNDETACHED
15056                                 set old_pthread_create_joinable
15057                                 eval $setvar
15058                         else
15059                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15060                                 val="$define"
15061                                 set d_old_pthread_create_joinable
15062                                 eval $setvar
15063                                 val=0
15064                                 set old_pthread_create_joinable
15065                                 eval $setvar
15066                         fi
15067                 fi
15068         fi
15069         $rm -f try try.*
15070 else
15071     d_old_pthread_create_joinable="$undef"
15072     old_pthread_create_joinable=""
15073 fi
15074
15075 : see if pause exists
15076 set pause d_pause
15077 eval $inlibc
15078
15079 : see if pipe exists
15080 set pipe d_pipe
15081 eval $inlibc
15082
15083 : see if poll exists
15084 set poll d_poll
15085 eval $inlibc
15086
15087 : see if readlink exists
15088 set readlink d_readlink
15089 eval $inlibc
15090
15091 echo " "
15092 procselfexe=''
15093 val="$undef"
15094 case "$d_readlink" in
15095 "$define")
15096         if $issymlink /proc/self/exe ; then
15097                 $ls -l /proc/self/exe > reflect
15098                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15099                         echo "You have Linux-like /proc/self/exe."
15100                         procselfexe='"/proc/self/exe"'
15101                         val="$define"
15102                 fi
15103         fi
15104         if $issymlink /proc/curproc/file ; then
15105                 $ls -l /proc/curproc/file > reflect
15106                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15107                         echo "You have BSD-like /proc/curproc/file."
15108                         procselfexe='"/proc/curproc/file"'
15109                         val="$define"
15110                 fi
15111         fi
15112         ;;
15113 esac
15114 $rm -f reflect
15115 set d_procselfexe
15116 eval $setvar
15117
15118 : see whether the pthread_atfork exists
15119 $cat >try.c <<EOP
15120 #include <pthread.h>
15121 #include <stdio.h>
15122 int main() {
15123 #ifdef  PTHREAD_ATFORK
15124         pthread_atfork(NULL,NULL,NULL);
15125 #endif
15126 }
15127 EOP
15128
15129 : see if pthread_atfork exists
15130 set try -DPTHREAD_ATFORK
15131 if eval $compile; then
15132     val="$define"
15133 else
15134     val="$undef"
15135 fi
15136 case "$usethreads" in
15137 $define)
15138         case "$val" in
15139         $define) echo 'pthread_atfork found.' >&4        ;;
15140         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15141         esac
15142 esac
15143 set d_pthread_atfork
15144 eval $setvar
15145
15146 : see if pthread_attr_setscope exists
15147 set pthread_attr_setscope d_pthread_attr_setscope
15148 eval $inlibc
15149
15150
15151 : see whether the various POSIXish _yields exist
15152 $cat >try.c <<EOP
15153 #include <pthread.h>
15154 #include <stdio.h>
15155 int main() {
15156 #ifdef SCHED_YIELD
15157         sched_yield();
15158 #else
15159 #ifdef PTHREAD_YIELD
15160         pthread_yield();
15161 #else
15162 #ifdef PTHREAD_YIELD_NULL
15163         pthread_yield(NULL);
15164 #endif
15165 #endif
15166 #endif
15167 }
15168 EOP
15169 : see if sched_yield exists
15170 set try -DSCHED_YIELD
15171 if eval $compile; then
15172     val="$define"
15173     sched_yield='sched_yield()'
15174 else
15175     val="$undef"
15176 fi
15177 case "$usethreads" in
15178 $define)
15179         case "$val" in
15180         $define) echo 'sched_yield() found.' >&4        ;;
15181         *)       echo 'sched_yield() NOT found.' >&4    ;;
15182         esac
15183 esac
15184 set d_sched_yield
15185 eval $setvar
15186
15187 : see if pthread_yield exists
15188 set try -DPTHREAD_YIELD
15189 if eval $compile; then
15190     val="$define"
15191     case "$sched_yield" in
15192     '') sched_yield='pthread_yield()' ;;
15193     esac
15194 else
15195     set try -DPTHREAD_YIELD_NULL
15196     if eval $compile; then
15197         val="$define"
15198         case "$sched_yield" in
15199         '') sched_yield='pthread_yield(NULL)' ;;
15200         esac
15201     else
15202         val="$undef"
15203     fi
15204 fi
15205 case "$usethreads" in
15206 $define)
15207         case "$val" in
15208         $define) echo 'pthread_yield() found.' >&4      ;;
15209         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15210         esac
15211         ;;
15212 esac
15213 set d_pthread_yield
15214 eval $setvar
15215
15216 case "$sched_yield" in
15217 '') sched_yield=undef ;;
15218 esac
15219
15220 $rm -f try try.*
15221
15222 : see if random_r exists
15223 set random_r d_random_r
15224 eval $inlibc
15225 case "$d_random_r" in
15226 "$define")
15227         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15228         case "$d_random_r_proto:$usethreads" in
15229         ":define")      d_random_r_proto=define
15230                 set d_random_r_proto random_r $hdrs
15231                 eval $hasproto ;;
15232         *)      ;;
15233         esac
15234         case "$d_random_r_proto" in
15235         define)
15236         case "$random_r_proto" in
15237         ''|0) try='int random_r(int*, struct random_data*);'
15238         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15239         esac
15240         case "$random_r_proto" in
15241         ''|0) try='int random_r(long*, struct random_data*);'
15242         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15243         esac
15244         case "$random_r_proto" in
15245         ''|0) try='int random_r(struct random_data*, int32_t*);'
15246         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15247         esac
15248         case "$random_r_proto" in
15249         ''|0)   d_random_r=undef
15250                 random_r_proto=0
15251                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15252         * )     case "$random_r_proto" in
15253                 REENTRANT_PROTO*) ;;
15254                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15255                 esac
15256                 echo "Prototype: $try" ;;
15257         esac
15258         ;;
15259         *)      case "$usethreads" in
15260                 define) echo "random_r has no prototype, not using it." >&4 ;;
15261                 esac
15262                 d_random_r=undef
15263                 random_r_proto=0
15264                 ;;
15265         esac
15266         ;;
15267 *)      random_r_proto=0
15268         ;;
15269 esac
15270
15271 : see if readdir and friends exist
15272 set readdir d_readdir
15273 eval $inlibc
15274 set seekdir d_seekdir
15275 eval $inlibc
15276 set telldir d_telldir
15277 eval $inlibc
15278 set rewinddir d_rewinddir
15279 eval $inlibc
15280
15281 : see if readdir64_r exists
15282 set readdir64_r d_readdir64_r
15283 eval $inlibc
15284 case "$d_readdir64_r" in
15285 "$define")
15286         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15287         case "$d_readdir64_r_proto:$usethreads" in
15288         ":define")      d_readdir64_r_proto=define
15289                 set d_readdir64_r_proto readdir64_r $hdrs
15290                 eval $hasproto ;;
15291         *)      ;;
15292         esac
15293         case "$d_readdir64_r_proto" in
15294         define)
15295         case "$readdir64_r_proto" in
15296         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15297         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15298         esac
15299         case "$readdir64_r_proto" in
15300         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15301         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15302         esac
15303         case "$readdir64_r_proto" in
15304         ''|0)   d_readdir64_r=undef
15305                 readdir64_r_proto=0
15306                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15307         * )     case "$readdir64_r_proto" in
15308                 REENTRANT_PROTO*) ;;
15309                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15310                 esac
15311                 echo "Prototype: $try" ;;
15312         esac
15313         ;;
15314         *)      case "$usethreads" in
15315                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15316                 esac
15317                 d_readdir64_r=undef
15318                 readdir64_r_proto=0
15319                 ;;
15320         esac
15321         ;;
15322 *)      readdir64_r_proto=0
15323         ;;
15324 esac
15325
15326 : see if readdir_r exists
15327 set readdir_r d_readdir_r
15328 eval $inlibc
15329 case "$d_readdir_r" in
15330 "$define")
15331         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15332         case "$d_readdir_r_proto:$usethreads" in
15333         ":define")      d_readdir_r_proto=define
15334                 set d_readdir_r_proto readdir_r $hdrs
15335                 eval $hasproto ;;
15336         *)      ;;
15337         esac
15338         case "$d_readdir_r_proto" in
15339         define)
15340         case "$readdir_r_proto" in
15341         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15342         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15343         esac
15344         case "$readdir_r_proto" in
15345         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15346         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15347         esac
15348         case "$readdir_r_proto" in
15349         ''|0)   d_readdir_r=undef
15350                 readdir_r_proto=0
15351                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15352         * )     case "$readdir_r_proto" in
15353                 REENTRANT_PROTO*) ;;
15354                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15355                 esac
15356                 echo "Prototype: $try" ;;
15357         esac
15358         ;;
15359         *)      case "$usethreads" in
15360                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15361                 esac
15362                 d_readdir_r=undef
15363                 readdir_r_proto=0
15364                 ;;
15365         esac
15366         ;;
15367 *)      readdir_r_proto=0
15368         ;;
15369 esac
15370
15371 : see if readv exists
15372 set readv d_readv
15373 eval $inlibc
15374
15375 : see if recvmsg exists
15376 set recvmsg d_recvmsg
15377 eval $inlibc
15378
15379 : see if rename exists
15380 set rename d_rename
15381 eval $inlibc
15382
15383 : see if rmdir exists
15384 set rmdir d_rmdir
15385 eval $inlibc
15386
15387 : see if memory.h is available.
15388 val=''
15389 set memory.h val
15390 eval $inhdr
15391
15392 : See if it conflicts with string.h
15393 case "$val" in
15394 $define)
15395         case "$strings" in
15396         '') ;;
15397         *)
15398                 $cppstdin $cppflags $cppminus < $strings > mem.h
15399                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15400                         echo " "
15401                         echo "We won't be including <memory.h>."
15402                         val="$undef"
15403                 fi
15404                 $rm -f mem.h
15405                 ;;
15406         esac
15407 esac
15408 set i_memory
15409 eval $setvar
15410
15411 : can bcopy handle overlapping blocks?
15412 echo " "
15413 val="$undef"
15414 case "$d_memmove" in
15415 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15416 *)      case "$d_bcopy" in
15417         "$define")
15418                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15419                 $cat >try.c <<EOCP
15420 #$i_memory I_MEMORY
15421 #$i_stdlib I_STDLIB
15422 #$i_string I_STRING
15423 #$i_unistd I_UNISTD
15424 EOCP
15425         $cat >>try.c <<'EOCP'
15426 #include <stdio.h>
15427 #ifdef I_MEMORY
15428 #  include <memory.h>
15429 #endif
15430 #ifdef I_STDLIB
15431 #  include <stdlib.h>
15432 #endif
15433 #ifdef I_STRING
15434 #  include <string.h>
15435 #else
15436 #  include <strings.h>
15437 #endif
15438 #ifdef I_UNISTD
15439 #  include <unistd.h>  /* Needed for NetBSD */
15440 #endif
15441 int main()
15442 {
15443 char buf[128], abc[128];
15444 char *b;
15445 int len;
15446 int off;
15447 int align;
15448
15449 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15450    try to store the string in read-only memory. */
15451 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15452
15453 for (align = 7; align >= 0; align--) {
15454         for (len = 36; len; len--) {
15455                 b = buf+align;
15456                 bcopy(abc, b, len);
15457                 for (off = 1; off <= len; off++) {
15458                         bcopy(b, b+off, len);
15459                         bcopy(b+off, b, len);
15460                         if (bcmp(b, abc, len))
15461                                 exit(1);
15462                 }
15463         }
15464 }
15465 exit(0);
15466 }
15467 EOCP
15468                 set try
15469                 if eval $compile_ok; then
15470                         if ./try 2>/dev/null; then
15471                                 echo "Yes, it can."
15472                                 val="$define"
15473                         else
15474                                 echo "It can't, sorry."
15475                         fi
15476                 else
15477                         echo "(I can't compile the test program, so we'll assume not...)"
15478                 fi
15479                 ;;
15480         esac
15481         $rm -f try.* try core
15482         ;;
15483 esac
15484 set d_safebcpy
15485 eval $setvar
15486
15487 : can memcpy handle overlapping blocks?
15488 echo " "
15489 val="$undef"
15490 case "$d_memmove" in
15491 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15492 *)      case "$d_memcpy" in
15493         "$define")
15494                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15495                 $cat >try.c <<EOCP
15496 #$i_memory I_MEMORY
15497 #$i_stdlib I_STDLIB
15498 #$i_string I_STRING
15499 #$i_unistd I_UNISTD
15500 EOCP
15501         $cat >>try.c <<'EOCP'
15502 #include <stdio.h>
15503 #ifdef I_MEMORY
15504 #  include <memory.h>
15505 #endif
15506 #ifdef I_STDLIB
15507 #  include <stdlib.h>
15508 #endif
15509 #ifdef I_STRING
15510 #  include <string.h>
15511 #else
15512 #  include <strings.h>
15513 #endif
15514 #ifdef I_UNISTD
15515 #  include <unistd.h>  /* Needed for NetBSD */
15516 #endif
15517 int main()
15518 {
15519 char buf[128], abc[128];
15520 char *b;
15521 int len;
15522 int off;
15523 int align;
15524
15525 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15526    try to store the string in read-only memory. */
15527 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15528
15529 for (align = 7; align >= 0; align--) {
15530         for (len = 36; len; len--) {
15531                 b = buf+align;
15532                 memcpy(b, abc, len);
15533                 for (off = 1; off <= len; off++) {
15534                         memcpy(b+off, b, len);
15535                         memcpy(b, b+off, len);
15536                         if (memcmp(b, abc, len))
15537                                 exit(1);
15538                 }
15539         }
15540 }
15541 exit(0);
15542 }
15543 EOCP
15544                 set try
15545                 if eval $compile_ok; then
15546                         if ./try 2>/dev/null; then
15547                                 echo "Yes, it can."
15548                                 val="$define"
15549                         else
15550                                 echo "It can't, sorry."
15551                         fi
15552                 else
15553                         echo "(I can't compile the test program, so we'll assume not...)"
15554                 fi
15555                 ;;
15556         esac
15557         $rm -f try.* try core
15558         ;;
15559 esac
15560 set d_safemcpy
15561 eval $setvar
15562
15563 : can memcmp be trusted to compare relative magnitude?
15564 val="$undef"
15565 case "$d_memcmp" in
15566 "$define")
15567         echo " "
15568         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15569         $cat >try.c <<EOCP
15570 #$i_memory I_MEMORY
15571 #$i_stdlib I_STDLIB
15572 #$i_string I_STRING
15573 #$i_unistd I_UNISTD
15574 EOCP
15575         $cat >>try.c <<'EOCP'
15576 #include <stdio.h>
15577 #ifdef I_MEMORY
15578 #  include <memory.h>
15579 #endif
15580 #ifdef I_STDLIB
15581 #  include <stdlib.h>
15582 #endif
15583 #ifdef I_STRING
15584 #  include <string.h>
15585 #else
15586 #  include <strings.h>
15587 #endif
15588 #ifdef I_UNISTD
15589 #  include <unistd.h>  /* Needed for NetBSD */
15590 #endif
15591 int main()
15592 {
15593 char a = -1;
15594 char b = 0;
15595 if ((a < b) && memcmp(&a, &b, 1) < 0)
15596         exit(1);
15597 exit(0);
15598 }
15599 EOCP
15600         set try
15601         if eval $compile_ok; then
15602                 if $run ./try 2>/dev/null; then
15603                         echo "Yes, it can."
15604                         val="$define"
15605                 else
15606                         echo "No, it can't (it uses signed chars)."
15607                 fi
15608         else
15609                 echo "(I can't compile the test program, so we'll assume not...)"
15610         fi
15611         ;;
15612 esac
15613 $rm -f try.* try core
15614 set d_sanemcmp
15615 eval $setvar
15616
15617 : see if prototype for sbrk is available
15618 echo " "
15619 set d_sbrkproto sbrk $i_unistd unistd.h
15620 eval $hasproto
15621
15622 : see if select exists
15623 set select d_select
15624 eval $inlibc
15625
15626 : see if semctl exists
15627 set semctl d_semctl
15628 eval $inlibc
15629
15630 : see if semget exists
15631 set semget d_semget
15632 eval $inlibc
15633
15634 : see if semop exists
15635 set semop d_semop
15636 eval $inlibc
15637
15638 : see how much of the 'sem*(2)' library is present.
15639 h_sem=true
15640 echo " "
15641 case "$d_semctl$d_semget$d_semop" in
15642 *"$undef"*) h_sem=false;;
15643 esac
15644 case "$osname" in
15645 freebsd)
15646     case "`ipcs 2>&1`" in
15647     "SVID messages"*"not configured"*)
15648         echo "Your $osname does not have the sem*(2) configured." >&4
15649         h_sem=false
15650         val="$undef"
15651         set semctl d_semctl
15652         eval $setvar
15653         set semget d_semget
15654         eval $setvar
15655         set semop d_semop
15656         eval $setvar
15657         ;;
15658     esac
15659     ;;
15660 esac
15661 : we could also check for sys/ipc.h ...
15662 if $h_sem && $test `./findhdr sys/sem.h`; then
15663         echo "You have the full sem*(2) library." >&4
15664         val="$define"
15665 else
15666         echo "You don't have the full sem*(2) library." >&4
15667         val="$undef"
15668 fi
15669 set d_sem
15670 eval $setvar
15671
15672 : see whether sys/sem.h defines union semun
15673 echo " "
15674 $cat > try.c <<'END'
15675 #include <sys/types.h>
15676 #include <sys/ipc.h>
15677 #include <sys/sem.h>
15678 int main () { union semun semun; semun.buf = 0; }
15679 END
15680 set try
15681 if eval $compile; then
15682     echo "You have union semun in <sys/sem.h>." >&4
15683     val="$define"
15684 else
15685     echo "You do not have union semun in <sys/sem.h>." >&4
15686     val="$undef"
15687 fi
15688 $rm -f try try.c
15689 set d_union_semun
15690 eval $setvar
15691
15692 : see how to do semctl IPC_STAT
15693 case "$d_sem" in
15694 $define)
15695     echo " "
15696     $cat > try.h <<END
15697 #ifndef S_IRUSR
15698 #   ifdef S_IREAD
15699 #       define S_IRUSR S_IREAD
15700 #       define S_IWUSR S_IWRITE
15701 #       define S_IXUSR S_IEXEC
15702 #   else
15703 #       define S_IRUSR 0400
15704 #       define S_IWUSR 0200
15705 #       define S_IXUSR 0100
15706 #   endif
15707 #   define S_IRGRP (S_IRUSR>>3)
15708 #   define S_IWGRP (S_IWUSR>>3)
15709 #   define S_IXGRP (S_IXUSR>>3)
15710 #   define S_IROTH (S_IRUSR>>6)
15711 #   define S_IWOTH (S_IWUSR>>6)
15712 #   define S_IXOTH (S_IXUSR>>6)
15713 #endif
15714 #ifndef S_IRWXU
15715 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15716 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15717 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15718 #endif
15719 END
15720     : see whether semctl IPC_STAT can use union semun
15721     case "$d_semctl_semun" in
15722     '')
15723       val="$undef"
15724       $cat > try.c <<END
15725 #include <sys/types.h>
15726 #include <sys/ipc.h>
15727 #include <sys/sem.h>
15728 #include <sys/stat.h>
15729 #include <stdio.h>
15730 #include <errno.h>
15731 #include "try.h"
15732 #ifndef errno
15733 extern int errno;
15734 #endif
15735 #$d_union_semun HAS_UNION_SEMUN
15736 int main() {
15737     union semun
15738 #ifndef HAS_UNION_SEMUN
15739     {
15740         int val;
15741         struct semid_ds *buf;
15742         unsigned short *array;
15743     }
15744 #endif
15745     arg;
15746     int sem, st;
15747
15748 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15749     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15750     if (sem > -1) {
15751         struct semid_ds argbuf;
15752         arg.buf = &argbuf;
15753 #       ifdef IPC_STAT
15754         st = semctl(sem, 0, IPC_STAT, arg);
15755         if (st == 0)
15756             printf("semun\n");
15757         else
15758 #       endif /* IPC_STAT */
15759             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15760 #       ifdef IPC_RMID
15761         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15762 #       endif /* IPC_RMID */
15763             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15764     } else
15765 #endif /* IPC_PRIVATE && ... */
15766         printf("semget failed: errno = %d\n", errno);
15767   return 0;
15768 }
15769 END
15770       set try
15771       if eval $compile; then
15772           xxx=`$run ./try`
15773           case "$xxx" in
15774           semun) val="$define" ;;
15775           esac
15776       fi
15777       $rm -f try try.c
15778       set d_semctl_semun
15779       eval $setvar
15780       ;;
15781     esac
15782     case "$d_semctl_semun" in
15783     $define)
15784         echo "You can use union semun for semctl IPC_STAT." >&4
15785         also='also'
15786         ;;
15787     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15788         also=''
15789         ;;
15790     esac
15791
15792     : see whether semctl IPC_STAT can use struct semid_ds pointer
15793     case "$d_semctl_semid_ds" in
15794     '')
15795       val="$undef"
15796       $cat > try.c <<'END'
15797 #include <sys/types.h>
15798 #include <sys/ipc.h>
15799 #include <sys/sem.h>
15800 #include <sys/stat.h>
15801 #include "try.h"
15802 #include <stdio.h>
15803 #include <errno.h>
15804 #ifndef errno
15805 extern int errno;
15806 #endif
15807 int main() {
15808     struct semid_ds arg;
15809     int sem, st;
15810
15811 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15812     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15813     if (sem > -1) {
15814 #       ifdef IPC_STAT
15815         st = semctl(sem, 0, IPC_STAT, &arg);
15816         if (st == 0)
15817             printf("semid_ds\n");
15818         else
15819 #       endif /* IPC_STAT */
15820             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15821 #       ifdef IPC_RMID
15822         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15823 #       endif /* IPC_RMID */
15824             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15825     } else
15826 #endif /* IPC_PRIVATE && ... */
15827         printf("semget failed: errno = %d\n", errno);
15828
15829     return 0;
15830 }
15831 END
15832       set try
15833       if eval $compile; then
15834           xxx=`$run ./try`
15835           case "$xxx" in
15836           semid_ds) val="$define" ;;
15837           esac
15838       fi
15839       $rm -f try try.c
15840       set d_semctl_semid_ds
15841       eval $setvar
15842       ;;
15843     esac
15844     case "$d_semctl_semid_ds" in
15845     $define)
15846         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15847         ;;
15848     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15849         ;;
15850     esac
15851     $rm -f try.h
15852     ;;
15853 *)  val="$undef"
15854
15855     # We do not have the full sem*(2) library, so assume we can not
15856     # use either.
15857
15858     set d_semctl_semun
15859     eval $setvar
15860
15861     set d_semctl_semid_ds
15862     eval $setvar
15863     ;;
15864 esac
15865
15866 : see if sendmsg exists
15867 set sendmsg d_sendmsg
15868 eval $inlibc
15869
15870 : see if setegid exists
15871 set setegid d_setegid
15872 eval $inlibc
15873
15874 : see if seteuid exists
15875 set seteuid d_seteuid
15876 eval $inlibc
15877
15878 : see if setgrent exists
15879 set setgrent d_setgrent
15880 eval $inlibc
15881
15882 : see if setgrent_r exists
15883 set setgrent_r d_setgrent_r
15884 eval $inlibc
15885 case "$d_setgrent_r" in
15886 "$define")
15887         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15888         case "$d_setgrent_r_proto:$usethreads" in
15889         ":define")      d_setgrent_r_proto=define
15890                 set d_setgrent_r_proto setgrent_r $hdrs
15891                 eval $hasproto ;;
15892         *)      ;;
15893         esac
15894         case "$d_setgrent_r_proto" in
15895         define)
15896         case "$setgrent_r_proto" in
15897         ''|0) try='int setgrent_r(FILE**);'
15898         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15899         esac
15900         case "$setgrent_r_proto" in
15901         ''|0) try='void setgrent_r(FILE**);'
15902         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15903         esac
15904         case "$setgrent_r_proto" in
15905         ''|0)   d_setgrent_r=undef
15906                 setgrent_r_proto=0
15907                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15908         * )     case "$setgrent_r_proto" in
15909                 REENTRANT_PROTO*) ;;
15910                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15911                 esac
15912                 echo "Prototype: $try" ;;
15913         esac
15914         ;;
15915         *)      case "$usethreads" in
15916                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15917                 esac
15918                 d_setgrent_r=undef
15919                 setgrent_r_proto=0
15920                 ;;
15921         esac
15922         ;;
15923 *)      setgrent_r_proto=0
15924         ;;
15925 esac
15926
15927 : see if sethostent exists
15928 set sethostent d_sethent
15929 eval $inlibc
15930
15931 : see if sethostent_r exists
15932 set sethostent_r d_sethostent_r
15933 eval $inlibc
15934 case "$d_sethostent_r" in
15935 "$define")
15936         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15937         case "$d_sethostent_r_proto:$usethreads" in
15938         ":define")      d_sethostent_r_proto=define
15939                 set d_sethostent_r_proto sethostent_r $hdrs
15940                 eval $hasproto ;;
15941         *)      ;;
15942         esac
15943         case "$d_sethostent_r_proto" in
15944         define)
15945         case "$sethostent_r_proto" in
15946         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15947         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15948         esac
15949         case "$sethostent_r_proto" in
15950         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15951         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15952         esac
15953         case "$sethostent_r_proto" in
15954         ''|0)   d_sethostent_r=undef
15955                 sethostent_r_proto=0
15956                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15957         * )     case "$sethostent_r_proto" in
15958                 REENTRANT_PROTO*) ;;
15959                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15960                 esac
15961                 echo "Prototype: $try" ;;
15962         esac
15963         ;;
15964         *)      case "$usethreads" in
15965                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15966                 esac
15967                 d_sethostent_r=undef
15968                 sethostent_r_proto=0
15969                 ;;
15970         esac
15971         ;;
15972 *)      sethostent_r_proto=0
15973         ;;
15974 esac
15975
15976 : see if setitimer exists
15977 set setitimer d_setitimer
15978 eval $inlibc
15979
15980 : see if setlinebuf exists
15981 set setlinebuf d_setlinebuf
15982 eval $inlibc
15983
15984 : see if setlocale exists
15985 set setlocale d_setlocale
15986 eval $inlibc
15987
15988 : see if locale.h is available
15989 set locale.h i_locale
15990 eval $inhdr
15991
15992 : see if setlocale_r exists
15993 set setlocale_r d_setlocale_r
15994 eval $inlibc
15995 case "$d_setlocale_r" in
15996 "$define")
15997         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
15998         case "$d_setlocale_r_proto:$usethreads" in
15999         ":define")      d_setlocale_r_proto=define
16000                 set d_setlocale_r_proto setlocale_r $hdrs
16001                 eval $hasproto ;;
16002         *)      ;;
16003         esac
16004         case "$d_setlocale_r_proto" in
16005         define)
16006         case "$setlocale_r_proto" in
16007         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16008         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16009         esac
16010         case "$setlocale_r_proto" in
16011         ''|0)   d_setlocale_r=undef
16012                 setlocale_r_proto=0
16013                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16014         * )     case "$setlocale_r_proto" in
16015                 REENTRANT_PROTO*) ;;
16016                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16017                 esac
16018                 echo "Prototype: $try" ;;
16019         esac
16020         ;;
16021         *)      case "$usethreads" in
16022                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16023                 esac
16024                 d_setlocale_r=undef
16025                 setlocale_r_proto=0
16026                 ;;
16027         esac
16028         ;;
16029 *)      setlocale_r_proto=0
16030         ;;
16031 esac
16032
16033 : see if setnetent exists
16034 set setnetent d_setnent
16035 eval $inlibc
16036
16037 : see if setnetent_r exists
16038 set setnetent_r d_setnetent_r
16039 eval $inlibc
16040 case "$d_setnetent_r" in
16041 "$define")
16042         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16043         case "$d_setnetent_r_proto:$usethreads" in
16044         ":define")      d_setnetent_r_proto=define
16045                 set d_setnetent_r_proto setnetent_r $hdrs
16046                 eval $hasproto ;;
16047         *)      ;;
16048         esac
16049         case "$d_setnetent_r_proto" in
16050         define)
16051         case "$setnetent_r_proto" in
16052         ''|0) try='int setnetent_r(int, struct netent_data*);'
16053         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16054         esac
16055         case "$setnetent_r_proto" in
16056         ''|0) try='void setnetent_r(int, struct netent_data*);'
16057         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16058         esac
16059         case "$setnetent_r_proto" in
16060         ''|0)   d_setnetent_r=undef
16061                 setnetent_r_proto=0
16062                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16063         * )     case "$setnetent_r_proto" in
16064                 REENTRANT_PROTO*) ;;
16065                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16066                 esac
16067                 echo "Prototype: $try" ;;
16068         esac
16069         ;;
16070         *)      case "$usethreads" in
16071                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16072                 esac
16073                 d_setnetent_r=undef
16074                 setnetent_r_proto=0
16075                 ;;
16076         esac
16077         ;;
16078 *)      setnetent_r_proto=0
16079         ;;
16080 esac
16081
16082 : see if setprotoent exists
16083 set setprotoent d_setpent
16084 eval $inlibc
16085
16086 : see if setpgid exists
16087 set setpgid d_setpgid
16088 eval $inlibc
16089
16090 : see if setpgrp2 exists
16091 set setpgrp2 d_setpgrp2
16092 eval $inlibc
16093
16094 : see if setpriority exists
16095 set setpriority d_setprior
16096 eval $inlibc
16097
16098 : see if setproctitle exists
16099 set setproctitle d_setproctitle
16100 eval $inlibc
16101
16102 : see if setprotoent_r exists
16103 set setprotoent_r d_setprotoent_r
16104 eval $inlibc
16105 case "$d_setprotoent_r" in
16106 "$define")
16107         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16108         case "$d_setprotoent_r_proto:$usethreads" in
16109         ":define")      d_setprotoent_r_proto=define
16110                 set d_setprotoent_r_proto setprotoent_r $hdrs
16111                 eval $hasproto ;;
16112         *)      ;;
16113         esac
16114         case "$d_setprotoent_r_proto" in
16115         define)
16116         case "$setprotoent_r_proto" in
16117         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16118         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16119         esac
16120         case "$setprotoent_r_proto" in
16121         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16122         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16123         esac
16124         case "$setprotoent_r_proto" in
16125         ''|0)   d_setprotoent_r=undef
16126                 setprotoent_r_proto=0
16127                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16128         * )     case "$setprotoent_r_proto" in
16129                 REENTRANT_PROTO*) ;;
16130                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16131                 esac
16132                 echo "Prototype: $try" ;;
16133         esac
16134         ;;
16135         *)      case "$usethreads" in
16136                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16137                 esac
16138                 d_setprotoent_r=undef
16139                 setprotoent_r_proto=0
16140                 ;;
16141         esac
16142         ;;
16143 *)      setprotoent_r_proto=0
16144         ;;
16145 esac
16146
16147 : see if setpwent exists
16148 set setpwent d_setpwent
16149 eval $inlibc
16150
16151 : see if setpwent_r exists
16152 set setpwent_r d_setpwent_r
16153 eval $inlibc
16154 case "$d_setpwent_r" in
16155 "$define")
16156         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16157         case "$d_setpwent_r_proto:$usethreads" in
16158         ":define")      d_setpwent_r_proto=define
16159                 set d_setpwent_r_proto setpwent_r $hdrs
16160                 eval $hasproto ;;
16161         *)      ;;
16162         esac
16163         case "$d_setpwent_r_proto" in
16164         define)
16165         case "$setpwent_r_proto" in
16166         ''|0) try='int setpwent_r(FILE**);'
16167         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16168         esac
16169         case "$setpwent_r_proto" in
16170         ''|0) try='void setpwent_r(FILE**);'
16171         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16172         esac
16173         case "$setpwent_r_proto" in
16174         ''|0)   d_setpwent_r=undef
16175                 setpwent_r_proto=0
16176                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16177         * )     case "$setpwent_r_proto" in
16178                 REENTRANT_PROTO*) ;;
16179                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16180                 esac
16181                 echo "Prototype: $try" ;;
16182         esac
16183         ;;
16184         *)      case "$usethreads" in
16185                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16186                 esac
16187                 d_setpwent_r=undef
16188                 setpwent_r_proto=0
16189                 ;;
16190         esac
16191         ;;
16192 *)      setpwent_r_proto=0
16193         ;;
16194 esac
16195
16196 : see if setregid exists
16197 set setregid d_setregid
16198 eval $inlibc
16199 set setresgid d_setresgid
16200 eval $inlibc
16201
16202 : see if setreuid exists
16203 set setreuid d_setreuid
16204 eval $inlibc
16205 set setresuid d_setresuid
16206 eval $inlibc
16207
16208 : see if setrgid exists
16209 set setrgid d_setrgid
16210 eval $inlibc
16211
16212 : see if setruid exists
16213 set setruid d_setruid
16214 eval $inlibc
16215
16216 : see if setservent exists
16217 set setservent d_setsent
16218 eval $inlibc
16219
16220 : see if setservent_r exists
16221 set setservent_r d_setservent_r
16222 eval $inlibc
16223 case "$d_setservent_r" in
16224 "$define")
16225         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16226         case "$d_setservent_r_proto:$usethreads" in
16227         ":define")      d_setservent_r_proto=define
16228                 set d_setservent_r_proto setservent_r $hdrs
16229                 eval $hasproto ;;
16230         *)      ;;
16231         esac
16232         case "$d_setservent_r_proto" in
16233         define)
16234         case "$setservent_r_proto" in
16235         ''|0) try='int setservent_r(int, struct servent_data*);'
16236         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16237         esac
16238         case "$setservent_r_proto" in
16239         ''|0) try='void setservent_r(int, struct servent_data*);'
16240         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16241         esac
16242         case "$setservent_r_proto" in
16243         ''|0)   d_setservent_r=undef
16244                 setservent_r_proto=0
16245                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16246         * )     case "$setservent_r_proto" in
16247                 REENTRANT_PROTO*) ;;
16248                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16249                 esac
16250                 echo "Prototype: $try" ;;
16251         esac
16252         ;;
16253         *)      case "$usethreads" in
16254                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16255                 esac
16256                 d_setservent_r=undef
16257                 setservent_r_proto=0
16258                 ;;
16259         esac
16260         ;;
16261 *)      setservent_r_proto=0
16262         ;;
16263 esac
16264
16265 : see if setsid exists
16266 set setsid d_setsid
16267 eval $inlibc
16268
16269 : see if setvbuf exists
16270 set setvbuf d_setvbuf
16271 eval $inlibc
16272
16273 : see if sfio.h is available
16274 set sfio.h i_sfio
16275 eval $inhdr
16276
16277
16278 : see if sfio library is available
16279 case "$i_sfio" in
16280 $define)
16281         val=''
16282         set sfreserve val
16283         eval $inlibc
16284         ;;
16285 *)
16286         val="$undef"
16287         ;;
16288 esac
16289 : Ok, but do we want to use it.
16290 case "$val" in
16291 $define)
16292         case "$usesfio" in
16293         true|$define|[yY]*) dflt='y';;
16294         *) dflt='n';;
16295         esac
16296         echo "$package can use the sfio library, but it is experimental."
16297         case "$useperlio" in
16298         "$undef")
16299             echo "For sfio also the PerlIO abstraction layer is needed."
16300             echo "Earlier you said you wouldn't want that."
16301             ;;
16302         esac
16303         rp="You seem to have sfio available, do you want to try using it?"
16304         . ./myread
16305         case "$ans" in
16306         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16307                 useperlio="$define"
16308                 val="$define"
16309                 ;;
16310         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16311                 val="$undef"
16312                 ;;
16313         esac
16314         ;;
16315 *)      case "$usesfio" in
16316         true|$define|[yY]*)
16317                 echo "Sorry, cannot find sfio on this machine." >&4
16318                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16319                 val="$undef"
16320                 ;;
16321         esac
16322         ;;
16323 esac
16324 set d_sfio
16325 eval $setvar
16326 case "$d_sfio" in
16327 $define) usesfio='true';;
16328 *) usesfio='false';;
16329 esac
16330 case "$d_sfio" in
16331 $define) ;;
16332 *)      : Remove sfio from list of libraries to use
16333         case "$libs" in
16334         *-lsfio*)
16335                 echo "Removing unneeded -lsfio from library list" >&4
16336                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16337                 shift
16338                 libs="$*"
16339                 echo "libs = $libs" >&4
16340                 ;;
16341         esac
16342 ;;
16343 esac
16344
16345
16346 : see if shmctl exists
16347 set shmctl d_shmctl
16348 eval $inlibc
16349
16350 : see if shmget exists
16351 set shmget d_shmget
16352 eval $inlibc
16353
16354 : see if shmat exists
16355 set shmat d_shmat
16356 eval $inlibc
16357 : see what shmat returns
16358 case "$d_shmat" in
16359 "$define")
16360         $cat >shmat.c <<'END'
16361 #include <sys/shm.h>
16362 void *shmat();
16363 END
16364         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16365                 shmattype='void *'
16366         else
16367                 shmattype='char *'
16368         fi
16369         echo "and it returns ($shmattype)." >&4
16370         : see if a prototype for shmat is available
16371         xxx=`./findhdr sys/shm.h`
16372         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16373         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16374                 val="$define"
16375         else
16376                 val="$undef"
16377         fi
16378         $rm -f shmat.[co]
16379         ;;
16380 *)
16381         val="$undef"
16382         ;;
16383 esac
16384 set d_shmatprototype
16385 eval $setvar
16386
16387 : see if shmdt exists
16388 set shmdt d_shmdt
16389 eval $inlibc
16390
16391 : see how much of the 'shm*(2)' library is present.
16392 h_shm=true
16393 echo " "
16394 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16395 *"$undef"*) h_shm=false;;
16396 esac
16397 case "$osname" in
16398 freebsd)
16399     case "`ipcs 2>&1`" in
16400     "SVID shared memory"*"not configured"*)
16401         echo "Your $osname does not have the shm*(2) configured." >&4
16402         h_shm=false
16403         val="$undef"
16404         set shmctl d_shmctl
16405         evat $setvar
16406         set shmget d_shmget
16407         evat $setvar
16408         set shmat d_shmat
16409         evat $setvar
16410         set shmdt d_shmdt
16411         evat $setvar
16412         ;;
16413     esac
16414     ;;
16415 esac
16416 : we could also check for sys/ipc.h ...
16417 if $h_shm && $test `./findhdr sys/shm.h`; then
16418         echo "You have the full shm*(2) library." >&4
16419         val="$define"
16420 else
16421         echo "You don't have the full shm*(2) library." >&4
16422         val="$undef"
16423 fi
16424 set d_shm
16425 eval $setvar
16426
16427 echo " "
16428 : see if we have sigaction
16429 if set sigaction val -f d_sigaction; eval $csym; $val; then
16430         echo 'sigaction() found.' >&4
16431         $cat > try.c <<EOP
16432 #include <stdio.h>
16433 #include <sys/types.h>
16434 #include <signal.h>
16435 #$i_stdlib I_STDLIB
16436 #ifdef I_STDLIB
16437 #include <stdlib.h>
16438 #endif
16439 int main()
16440 {
16441     struct sigaction act, oact;
16442     act.sa_flags = 0;
16443     oact.sa_handler = 0;
16444     /* so that act and oact are used */
16445     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16446 }
16447 EOP
16448         set try
16449         if eval $compile_ok; then
16450                 val="$define"
16451         else
16452                 echo "But you don't seem to have a useable struct sigaction." >&4
16453                 val="$undef"
16454         fi
16455 else
16456         echo 'sigaction NOT found.' >&4
16457         val="$undef"
16458 fi
16459 set d_sigaction; eval $setvar
16460 $rm -f try try$_o try.c
16461
16462 : see if sigprocmask exists
16463 set sigprocmask d_sigprocmask
16464 eval $inlibc
16465
16466 : see if sigsetjmp exists
16467 echo " "
16468 case "$d_sigsetjmp" in
16469 '')
16470         $cat >try.c <<EOP
16471 #include <setjmp.h>
16472 #$i_stdlib I_STDLIB
16473 #ifdef I_STDLIB
16474 #include <stdlib.h>
16475 #endif
16476 sigjmp_buf env;
16477 int set = 1;
16478 int main()
16479 {
16480         if (sigsetjmp(env,1))
16481                 exit(set);
16482         set = 0;
16483         siglongjmp(env, 1);
16484         exit(1);
16485 }
16486 EOP
16487         set try
16488         if eval $compile; then
16489                 if $run ./try >/dev/null 2>&1; then
16490                         echo "POSIX sigsetjmp found." >&4
16491                         val="$define"
16492                 else
16493                         $cat >&4 <<EOM
16494 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16495 I'll ignore them.
16496 EOM
16497                         val="$undef"
16498                 fi
16499         else
16500                 echo "sigsetjmp not found." >&4
16501                 val="$undef"
16502         fi
16503         ;;
16504 *) val="$d_sigsetjmp"
16505         case "$d_sigsetjmp" in
16506         $define) echo "POSIX sigsetjmp found." >&4;;
16507         $undef) echo "sigsetjmp not found." >&4;;
16508         esac
16509         ;;
16510 esac
16511 set d_sigsetjmp
16512 eval $setvar
16513 $rm -f try.c try
16514
16515 : see if snprintf exists
16516 set snprintf d_snprintf
16517 eval $inlibc
16518
16519 : see if vsnprintf exists
16520 set vsnprintf d_vsnprintf
16521 eval $inlibc
16522
16523 case "$d_snprintf-$d_vsnprintf" in
16524 "$define-$define")
16525     $cat <<EOM
16526 Checking whether your snprintf() and vsnprintf() work okay...
16527 EOM
16528     $cat >try.c <<'EOCP'
16529 /* v?snprintf testing logic courtesy of Russ Allbery.
16530  * According to C99:
16531  * - if the buffer is too short it still must be \0-terminated
16532  * - if the buffer is too short the potentially required length
16533  *   must be returned and not -1
16534  * - if the buffer is NULL the potentially required length
16535  *   must be returned and not -1 or core dump
16536  */
16537 #include <stdio.h>
16538 #include <stdarg.h>
16539
16540 char buf[2];
16541
16542 int test (char *format, ...)
16543 {
16544     va_list args;
16545     int count;
16546
16547     va_start (args, format);
16548     count = vsnprintf (buf, sizeof buf, format, args);
16549     va_end (args);
16550     return count;
16551 }
16552
16553 int main ()
16554 {
16555     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16556              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16557 }
16558 EOCP
16559     set try
16560     if eval $compile; then
16561         `$run ./try`
16562         case "$?" in
16563         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16564         *) cat <<EOM >&4
16565 Your snprintf() and snprintf() don't seem to be working okay.
16566 EOM
16567            d_snprintf="$undef"
16568            d_vsnprintf="$undef"
16569            ;;
16570         esac
16571     else
16572         echo "(I can't seem to compile the test program--assuming they don't)"
16573         d_snprintf="$undef"
16574         d_vsnprintf="$undef"
16575     fi
16576     $rm -f try.* try core core.try.*
16577     ;;
16578 esac
16579
16580 : see if sockatmark exists
16581 set sockatmark d_sockatmark
16582 eval $inlibc
16583
16584 : see if prototype for sockatmark is available
16585 echo " "
16586 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16587 eval $hasproto
16588
16589 : see if socks5_init exists
16590 set socks5_init d_socks5_init
16591 eval $inlibc
16592
16593 : see if sprintf returns the length of the string in the buffer as per ANSI
16594 $echo "Checking whether sprintf returns the length of the string..." >&4
16595 $cat <<EOP >try.c
16596 #include <stdio.h>
16597 #$i_stdlib I_STDLIB
16598 #ifdef I_STDLIB
16599 #include <stdlib.h>
16600 #endif
16601 #$i_string I_STRING
16602 #ifdef I_STRING
16603 #  include <string.h>
16604 #else
16605 #  include <strings.h>
16606 #endif
16607 #$i_math I_MATH
16608 #ifdef I_MATH
16609 #include <math.h>
16610 #endif
16611
16612 char buffer[256];
16613
16614 int check (size_t expect, int test) {
16615   size_t got = strlen(buffer);
16616   if (expect == got)
16617     return 0;
16618
16619   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16620        test, buffer);
16621   exit (test);
16622 }
16623
16624 int main(int argc, char **argv) {
16625   int test = 0;
16626
16627   check(sprintf(buffer, ""), ++test);
16628   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16629   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16630
16631   return 0;
16632 }
16633 EOP
16634 set try
16635
16636 d_sprintf_returns_strlen="$undef"
16637 if eval $compile; then
16638     xxx="`$run ./try`"
16639     case "$?" in
16640         0) cat >&4 <<EOM
16641 sprintf returns the length of the string (as ANSI says it should)
16642 EOM
16643         d_sprintf_returns_strlen="$define"
16644         ;;
16645         *) cat >&4 <<EOM
16646 sprintf does not return the length of the string (how old is this system?)
16647 EOM
16648         d_sprintf_returns_strlen="$undef"
16649         ;;
16650     esac
16651 fi
16652
16653 $rm -f try.* try
16654
16655 : see if srand48_r exists
16656 set srand48_r d_srand48_r
16657 eval $inlibc
16658 case "$d_srand48_r" in
16659 "$define")
16660         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16661         case "$d_srand48_r_proto:$usethreads" in
16662         ":define")      d_srand48_r_proto=define
16663                 set d_srand48_r_proto srand48_r $hdrs
16664                 eval $hasproto ;;
16665         *)      ;;
16666         esac
16667         case "$d_srand48_r_proto" in
16668         define)
16669         case "$srand48_r_proto" in
16670         ''|0) try='int srand48_r(long, struct drand48_data*);'
16671         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16672         esac
16673         case "$srand48_r_proto" in
16674         ''|0)   d_srand48_r=undef
16675                 srand48_r_proto=0
16676                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16677         * )     case "$srand48_r_proto" in
16678                 REENTRANT_PROTO*) ;;
16679                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16680                 esac
16681                 echo "Prototype: $try" ;;
16682         esac
16683         ;;
16684         *)      case "$usethreads" in
16685                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16686                 esac
16687                 d_srand48_r=undef
16688                 srand48_r_proto=0
16689                 ;;
16690         esac
16691         ;;
16692 *)      srand48_r_proto=0
16693         ;;
16694 esac
16695
16696 : see if srandom_r exists
16697 set srandom_r d_srandom_r
16698 eval $inlibc
16699 case "$d_srandom_r" in
16700 "$define")
16701         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16702         case "$d_srandom_r_proto:$usethreads" in
16703         ":define")      d_srandom_r_proto=define
16704                 set d_srandom_r_proto srandom_r $hdrs
16705                 eval $hasproto ;;
16706         *)      ;;
16707         esac
16708         case "$d_srandom_r_proto" in
16709         define)
16710         case "$srandom_r_proto" in
16711         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16712         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16713         esac
16714         case "$srandom_r_proto" in
16715         ''|0)   d_srandom_r=undef
16716                 srandom_r_proto=0
16717                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16718         * )     case "$srandom_r_proto" in
16719                 REENTRANT_PROTO*) ;;
16720                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16721                 esac
16722                 echo "Prototype: $try" ;;
16723         esac
16724         ;;
16725         *)      case "$usethreads" in
16726                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16727                 esac
16728                 d_srandom_r=undef
16729                 srandom_r_proto=0
16730                 ;;
16731         esac
16732         ;;
16733 *)      srandom_r_proto=0
16734         ;;
16735 esac
16736
16737 : see if prototype for setresgid is available
16738 echo " "
16739 set d_sresgproto setresgid $i_unistd unistd.h
16740 eval $hasproto
16741
16742 : see if prototype for setresuid is available
16743 echo " "
16744 set d_sresuproto setresuid $i_unistd unistd.h
16745 eval $hasproto
16746
16747 : see if sys/stat.h is available
16748 set sys/stat.h i_sysstat
16749 eval $inhdr
16750
16751
16752 : see if stat knows about block sizes
16753 echo " "
16754 echo "Checking to see if your struct stat has st_blocks field..." >&4
16755 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16756 eval $hasfield
16757
16758
16759 : see if this is a sys/vfs.h system
16760 set sys/vfs.h i_sysvfs
16761 eval $inhdr
16762
16763
16764 : see if this is a sys/statfs.h system
16765 set sys/statfs.h i_sysstatfs
16766 eval $inhdr
16767
16768
16769 echo " "
16770 echo "Checking to see if your system supports struct statfs..." >&4
16771 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
16772 eval $hasstruct
16773 case "$d_statfs_s" in
16774 "$define")      echo "Yes, it does."   ;;
16775 *)              echo "No, it doesn't." ;;
16776 esac
16777
16778
16779
16780 : see if struct statfs knows about f_flags
16781 case "$d_statfs_s" in
16782 define) 
16783         echo " "
16784         echo "Checking to see if your struct statfs has f_flags field..." >&4
16785         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
16786         eval $hasfield
16787         ;;
16788 *)      val="$undef"
16789         set d_statfs_f_flags
16790         eval $setvar
16791         ;;
16792 esac
16793 case "$d_statfs_f_flags" in
16794 "$define")      echo "Yes, it does."   ;;
16795 *)              echo "No, it doesn't." ;;
16796 esac
16797
16798 $cat >&4 <<EOM
16799 Checking how to access stdio streams by file descriptor number...
16800 EOM
16801 case "$stdio_stream_array" in
16802 '')     $cat >try.c <<EOCP
16803 #include <stdio.h>
16804 int main() {
16805   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16806     printf("yes\n");
16807 }
16808 EOCP
16809         for s in _iob __iob __sF
16810         do
16811                 set try -DSTDIO_STREAM_ARRAY=$s
16812                 if eval $compile; then
16813                         case "`$run ./try`" in
16814                         yes)    stdio_stream_array=$s; break ;;
16815                         esac
16816                 fi
16817         done
16818         $rm -f try.* try$exe_ext
16819 esac
16820 case "$stdio_stream_array" in
16821 '')     $cat >&4 <<EOM
16822 I can't figure out how to access stdio streams by file descriptor number.
16823 EOM
16824         d_stdio_stream_array="$undef"
16825         ;;
16826 *)      $cat >&4 <<EOM
16827 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16828 EOM
16829         d_stdio_stream_array="$define"
16830         ;;
16831 esac
16832
16833 : see if strcoll exists
16834 set strcoll d_strcoll
16835 eval $inlibc
16836
16837 : check for structure copying
16838 echo " "
16839 echo "Checking to see if your C compiler can copy structs..." >&4
16840 $cat >try.c <<'EOCP'
16841 int main()
16842 {
16843         struct blurfl {
16844                 int dyick;
16845         } foo, bar;
16846
16847         foo = bar;
16848 }
16849 EOCP
16850 if $cc -c try.c >/dev/null 2>&1 ; then
16851         val="$define"
16852         echo "Yup, it can."
16853 else
16854         val="$undef"
16855         echo "Nope, it can't."
16856 fi
16857 set d_strctcpy
16858 eval $setvar
16859 $rm -f try.*
16860
16861 : see if strerror and/or sys_errlist[] exist
16862 echo " "
16863 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16864     if set strerror val -f d_strerror; eval $csym; $val; then
16865                 echo 'strerror() found.' >&4
16866                 d_strerror="$define"
16867                 d_strerrm='strerror(e)'
16868                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16869                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16870                         d_syserrlst="$define"
16871                 else
16872                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16873                         d_syserrlst="$undef"
16874                 fi
16875     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16876                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16877                 echo 'strerror() found in string header.' >&4
16878                 d_strerror="$define"
16879                 d_strerrm='strerror(e)'
16880                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16881                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16882                                 d_syserrlst="$define"
16883                 else
16884                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16885                         d_syserrlst="$undef"
16886                 fi
16887     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16888                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16889                 d_strerror="$undef"
16890                 d_syserrlst="$define"
16891                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16892     else
16893                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16894                 d_strerror="$undef"
16895                 d_syserrlst="$undef"
16896                 d_strerrm='"unknown"'
16897     fi
16898 fi
16899
16900 : see if strerror_r exists
16901 set strerror_r d_strerror_r
16902 eval $inlibc
16903 case "$d_strerror_r" in
16904 "$define")
16905         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16906         case "$d_strerror_r_proto:$usethreads" in
16907         ":define")      d_strerror_r_proto=define
16908                 set d_strerror_r_proto strerror_r $hdrs
16909                 eval $hasproto ;;
16910         *)      ;;
16911         esac
16912         case "$d_strerror_r_proto" in
16913         define)
16914         case "$strerror_r_proto" in
16915         ''|0) try='int strerror_r(int, char*, size_t);'
16916         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16917         esac
16918         case "$strerror_r_proto" in
16919         ''|0) try='int strerror_r(int, char*, int);'
16920         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16921         esac
16922         case "$strerror_r_proto" in
16923         ''|0) try='char* strerror_r(int, char*, size_t);'
16924         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16925         esac
16926         case "$strerror_r_proto" in
16927         ''|0)   d_strerror_r=undef
16928                 strerror_r_proto=0
16929                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16930         * )     case "$strerror_r_proto" in
16931                 REENTRANT_PROTO*) ;;
16932                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16933                 esac
16934                 echo "Prototype: $try" ;;
16935         esac
16936         ;;
16937         *)      case "$usethreads" in
16938                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16939                 esac
16940                 d_strerror_r=undef
16941                 strerror_r_proto=0
16942                 ;;
16943         esac
16944         ;;
16945 *)      strerror_r_proto=0
16946         ;;
16947 esac
16948
16949 : see if strftime exists
16950 set strftime d_strftime
16951 eval $inlibc
16952
16953 : see if strlcat exists
16954 set strlcat d_strlcat
16955 eval $inlibc
16956
16957 : see if strlcpy exists
16958 set strlcpy d_strlcpy
16959 eval $inlibc
16960
16961 : see if strtod exists
16962 set strtod d_strtod
16963 eval $inlibc
16964
16965 : see if strtol exists
16966 set strtol d_strtol
16967 eval $inlibc
16968
16969 : see if strtold exists
16970 set strtold d_strtold
16971 eval $inlibc
16972
16973 : see if strtoll exists
16974 set strtoll d_strtoll
16975 eval $inlibc
16976
16977 case "$d_longlong-$d_strtoll" in
16978 "$define-$define")
16979         $cat <<EOM
16980 Checking whether your strtoll() works okay...
16981 EOM
16982         $cat >try.c <<'EOCP'
16983 #include <errno.h>
16984 #ifdef __hpux
16985 #define strtoll __strtoll
16986 #endif
16987 #ifdef __EMX__
16988 #define strtoll _strtoll
16989 #endif
16990 #include <stdio.h>
16991 extern long long int strtoll(char *s, char **, int); 
16992 static int bad = 0;
16993 int check(char *s, long long ell, int een) {
16994         long long gll;
16995         errno = 0;
16996         gll = strtoll(s, 0, 10);
16997         if (!((gll == ell) && (errno == een)))
16998                 bad++;
16999 }
17000 int main() {
17001         check(" 1",                                      1LL, 0);
17002         check(" 0",                                      0LL, 0);
17003         check("-1",                                     -1LL, 0);
17004         check("-9223372036854775808", -9223372036854775808LL, 0);
17005         check("-9223372036854775808", -9223372036854775808LL, 0);
17006         check(" 9223372036854775807",  9223372036854775807LL, 0);
17007         check("-9223372036854775808", -9223372036854775808LL, 0);
17008         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17009         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17010         if (!bad)
17011                 printf("ok\n");
17012 }
17013 EOCP
17014         set try
17015         if eval $compile; then
17016                 yyy=`$run ./try`
17017                 case "$yyy" in
17018                 ok) echo "Your strtoll() seems to be working okay." ;;
17019                 *) cat <<EOM >&4
17020 Your strtoll() doesn't seem to be working okay.
17021 EOM
17022                    d_strtoll="$undef"
17023                    ;;
17024                 esac
17025         else
17026                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17027                 d_strtoll="$undef"
17028         fi
17029         ;;
17030 esac
17031
17032 : see if strtoq exists
17033 set strtoq d_strtoq
17034 eval $inlibc
17035
17036 : see if strtoul exists
17037 set strtoul d_strtoul
17038 eval $inlibc
17039
17040 case "$d_strtoul" in
17041 "$define")
17042         $cat <<EOM
17043 Checking whether your strtoul() works okay...
17044 EOM
17045         $cat >try.c <<'EOCP'
17046 #include <errno.h>
17047 #include <stdio.h>
17048 extern unsigned long int strtoul(char *s, char **, int); 
17049 static int bad = 0;
17050 void check(char *s, unsigned long eul, int een) {
17051         unsigned long gul;
17052         errno = 0;
17053         gul = strtoul(s, 0, 10);
17054         if (!((gul == eul) && (errno == een)))
17055                 bad++;
17056 }
17057 int main() {
17058         check(" 1", 1L, 0);
17059         check(" 0", 0L, 0);
17060 EOCP
17061         case "$longsize" in
17062         8)
17063             $cat >>try.c <<'EOCP'
17064         check("18446744073709551615", 18446744073709551615UL, 0);
17065         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17066 #if 0 /* strtoul() for /^-/ strings is undefined. */
17067         check("-1", 18446744073709551615UL, 0);
17068         check("-18446744073709551614", 2, 0);
17069         check("-18446744073709551615", 1, 0);
17070         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17071         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17072 #endif
17073 EOCP
17074                 ;;
17075         4)
17076                     $cat >>try.c <<'EOCP'
17077         check("4294967295", 4294967295UL, 0);
17078         check("4294967296", 4294967295UL, ERANGE);
17079 #if 0 /* strtoul() for /^-/ strings is undefined. */
17080         check("-1", 4294967295UL, 0);
17081         check("-4294967294", 2, 0);
17082         check("-4294967295", 1, 0);
17083         check("-4294967296", 4294967295UL, ERANGE);
17084         check("-4294967297", 4294967295UL, ERANGE);
17085 #endif
17086 EOCP
17087                 ;;
17088         *)
17089 : Should we write these tests to be more portable by sprintf-ing
17090 : ~0 and then manipulating that char string as input for strtol?
17091                 ;;
17092         esac
17093         $cat >>try.c <<'EOCP'
17094         if (!bad)
17095                 printf("ok\n");
17096         return 0;
17097 }
17098 EOCP
17099         set try
17100         if eval $compile; then
17101                 case "`$run ./try`" in
17102                 ok) echo "Your strtoul() seems to be working okay." ;;
17103                 *) cat <<EOM >&4
17104 Your strtoul() doesn't seem to be working okay.
17105 EOM
17106                    d_strtoul="$undef"
17107                    ;;
17108                 esac
17109         fi
17110         ;;
17111 esac
17112
17113 : see if strtoull exists
17114 set strtoull d_strtoull
17115 eval $inlibc
17116
17117 case "$d_longlong-$d_strtoull" in
17118 "$define-$define")
17119         $cat <<EOM
17120 Checking whether your strtoull() works okay...
17121 EOM
17122         $cat >try.c <<'EOCP'
17123 #include <errno.h>
17124 #ifdef __hpux
17125 #define strtoull __strtoull
17126 #endif
17127 #include <stdio.h>
17128 extern unsigned long long int strtoull(char *s, char **, int); 
17129 static int bad = 0;
17130 int check(char *s, long long eull, int een) {
17131         long long gull;
17132         errno = 0;
17133         gull = strtoull(s, 0, 10);
17134         if (!((gull == eull) && (errno == een)))
17135                 bad++;
17136 }
17137 int main() {
17138         check(" 1",                                        1LL, 0);
17139         check(" 0",                                        0LL, 0);
17140         check("18446744073709551615",  18446744073709551615ULL, 0);
17141         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17142 #if 0 /* strtoull() for /^-/ strings is undefined. */
17143         check("-1",                    18446744073709551615ULL, 0);
17144         check("-18446744073709551614",                     2LL, 0);
17145         check("-18446744073709551615",                     1LL, 0);
17146         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17147         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17148 #endif
17149         if (!bad)
17150                 printf("ok\n");
17151 }
17152 EOCP
17153         set try
17154         if eval $compile; then
17155                 case "`$run ./try`" in
17156                 ok) echo "Your strtoull() seems to be working okay." ;;
17157                 *) cat <<EOM >&4
17158 Your strtoull() doesn't seem to be working okay.
17159 EOM
17160                    d_strtoull="$undef"
17161                    ;;
17162                 esac
17163         fi
17164         ;;
17165 esac
17166
17167 : see if strtouq exists
17168 set strtouq d_strtouq
17169 eval $inlibc
17170
17171 case "$d_strtouq" in
17172 "$define")
17173         $cat <<EOM
17174 Checking whether your strtouq() works okay...
17175 EOM
17176         $cat >try.c <<'EOCP'
17177 #include <errno.h>
17178 #include <stdio.h>
17179 extern unsigned long long int strtouq(char *s, char **, int); 
17180 static int bad = 0;
17181 void check(char *s, unsigned long long eull, int een) {
17182         unsigned long long gull;
17183         errno = 0;
17184         gull = strtouq(s, 0, 10);
17185         if (!((gull == eull) && (errno == een)))
17186                 bad++;
17187 }
17188 int main() {
17189         check(" 1",                                        1LL, 0);
17190         check(" 0",                                        0LL, 0);
17191         check("18446744073709551615",  18446744073709551615ULL, 0);
17192         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17193 #if 0 /* strtouq() for /^-/ strings is undefined. */
17194         check("-1",                    18446744073709551615ULL, 0);
17195         check("-18446744073709551614",                     2LL, 0);
17196         check("-18446744073709551615",                     1LL, 0);
17197         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17198         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17199 #endif
17200         if (!bad)
17201                 printf("ok\n");
17202         return 0;
17203 }
17204 EOCP
17205         set try
17206         if eval $compile; then
17207                 case "`$run ./try`" in
17208                 ok) echo "Your strtouq() seems to be working okay." ;;
17209                 *) cat <<EOM >&4
17210 Your strtouq() doesn't seem to be working okay.
17211 EOM
17212                    d_strtouq="$undef"
17213                    ;;
17214                 esac
17215         fi
17216         ;;
17217 esac
17218
17219 : see if strxfrm exists
17220 set strxfrm d_strxfrm
17221 eval $inlibc
17222
17223 : see if symlink exists
17224 set symlink d_symlink
17225 eval $inlibc
17226
17227 : see if syscall exists
17228 set syscall d_syscall
17229 eval $inlibc
17230
17231 : see if prototype for syscall is available
17232 echo " "
17233 set d_syscallproto syscall $i_unistd unistd.h
17234 eval $hasproto
17235
17236 : see if sysconf exists
17237 set sysconf d_sysconf
17238 eval $inlibc
17239
17240 : see if system exists
17241 set system d_system
17242 eval $inlibc
17243
17244 : see if tcgetpgrp exists
17245 set tcgetpgrp d_tcgetpgrp
17246 eval $inlibc
17247
17248 : see if tcsetpgrp exists
17249 set tcsetpgrp d_tcsetpgrp
17250 eval $inlibc
17251
17252 : see if prototype for telldir is available
17253 echo " "
17254 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17255 eval $hasproto
17256
17257 : see if time exists
17258 echo " "
17259 if test "X$d_time" = X -o X"$timetype" = X; then
17260     if set time val -f d_time; eval $csym; $val; then
17261                 echo 'time() found.' >&4
17262                 val="$define"
17263                 rp="What is the type returned by time() on this system?"
17264                 set time_t timetype long stdio.h sys/types.h
17265                 eval $typedef_ask
17266     else
17267                 echo 'time() not found, hope that will do.' >&4
17268                 val="$undef"
17269                 timetype='int';
17270     fi
17271     set d_time
17272     eval $setvar
17273 fi
17274
17275 : see if this is a sys/times.h system
17276 set sys/times.h i_systimes
17277 eval $inhdr
17278
17279 : see if times exists
17280 echo " "
17281 if set times val -f d_times; eval $csym; $val; then
17282         echo 'times() found.' >&4
17283         d_times="$define"
17284         inc=''
17285         case "$i_systimes" in
17286         "$define") inc='sys/times.h';;
17287         esac
17288         rp="What is the type returned by times() on this system?"
17289         set clock_t clocktype long stdio.h sys/types.h $inc
17290         eval $typedef_ask
17291 else
17292         echo 'times() NOT found, hope that will do.' >&4
17293         d_times="$undef"
17294         clocktype='int'
17295 fi
17296
17297 : see if tmpnam_r exists
17298 set tmpnam_r d_tmpnam_r
17299 eval $inlibc
17300 case "$d_tmpnam_r" in
17301 "$define")
17302         hdrs="$i_systypes sys/types.h define stdio.h "
17303         case "$d_tmpnam_r_proto:$usethreads" in
17304         ":define")      d_tmpnam_r_proto=define
17305                 set d_tmpnam_r_proto tmpnam_r $hdrs
17306                 eval $hasproto ;;
17307         *)      ;;
17308         esac
17309         case "$d_tmpnam_r_proto" in
17310         define)
17311         case "$tmpnam_r_proto" in
17312         ''|0) try='char* tmpnam_r(char*);'
17313         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17314         esac
17315         case "$tmpnam_r_proto" in
17316         ''|0)   d_tmpnam_r=undef
17317                 tmpnam_r_proto=0
17318                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17319         * )     case "$tmpnam_r_proto" in
17320                 REENTRANT_PROTO*) ;;
17321                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17322                 esac
17323                 echo "Prototype: $try" ;;
17324         esac
17325         ;;
17326         *)      case "$usethreads" in
17327                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17328                 esac
17329                 d_tmpnam_r=undef
17330                 tmpnam_r_proto=0
17331                 ;;
17332         esac
17333         ;;
17334 *)      tmpnam_r_proto=0
17335         ;;
17336 esac
17337
17338 : see if truncate exists
17339 set truncate d_truncate
17340 eval $inlibc
17341
17342 : see if ttyname_r exists
17343 set ttyname_r d_ttyname_r
17344 eval $inlibc
17345 case "$d_ttyname_r" in
17346 "$define")
17347         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17348         case "$d_ttyname_r_proto:$usethreads" in
17349         ":define")      d_ttyname_r_proto=define
17350                 set d_ttyname_r_proto ttyname_r $hdrs
17351                 eval $hasproto ;;
17352         *)      ;;
17353         esac
17354         case "$d_ttyname_r_proto" in
17355         define)
17356         case "$ttyname_r_proto" in
17357         ''|0) try='int ttyname_r(int, char*, size_t);'
17358         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17359         esac
17360         case "$ttyname_r_proto" in
17361         ''|0) try='int ttyname_r(int, char*, int);'
17362         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17363         esac
17364         case "$ttyname_r_proto" in
17365         ''|0) try='char* ttyname_r(int, char*, int);'
17366         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17367         esac
17368         case "$ttyname_r_proto" in
17369         ''|0)   d_ttyname_r=undef
17370                 ttyname_r_proto=0
17371                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17372         * )     case "$ttyname_r_proto" in
17373                 REENTRANT_PROTO*) ;;
17374                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17375                 esac
17376                 echo "Prototype: $try" ;;
17377         esac
17378         ;;
17379         *)      case "$usethreads" in
17380                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17381                 esac
17382                 d_ttyname_r=undef
17383                 ttyname_r_proto=0
17384                 ;;
17385         esac
17386         ;;
17387 *)      ttyname_r_proto=0
17388         ;;
17389 esac
17390
17391 : see if tzname[] exists
17392 echo " "
17393 if set tzname val -a d_tzname; eval $csym; $val; then
17394         val="$define"
17395         echo 'tzname[] found.' >&4
17396 else
17397         val="$undef"
17398         echo 'tzname[] NOT found.' >&4
17399 fi
17400 set d_tzname
17401 eval $setvar
17402
17403 case "$osname" in
17404 next|rhapsody|darwin) multiarch="$define" ;;
17405 esac
17406 case "$multiarch" in
17407 ''|[nN]*) multiarch="$undef" ;;
17408 esac
17409
17410 : check for ordering of bytes in a UV
17411 echo " "
17412 case "$usecrosscompile$multiarch" in
17413 *$define*)
17414         $cat <<EOM
17415 You seem to be either cross-compiling or doing a multiarchitecture build,
17416 skipping the byteorder check.
17417
17418 EOM
17419         byteorder='ffff'
17420         ;;
17421 *)
17422         case "$byteorder" in
17423         '')
17424                 $cat <<'EOM'
17425 In the following, larger digits indicate more significance.  A big-endian
17426 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17427 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17428 machines may have weird orders like 3412.  A Cray will report 87654321,
17429 an Alpha will report 12345678. If the test program works the default is
17430 probably right.
17431 I'm now running the test program...
17432 EOM
17433                 $cat >try.c <<EOCP
17434 #include <stdio.h>
17435 #$i_stdlib I_STDLIB
17436 #ifdef I_STDLIB
17437 #include <stdlib.h>
17438 #endif
17439 #include <sys/types.h>
17440 typedef $uvtype UV;
17441 int main()
17442 {
17443         int i;
17444         union {
17445                 UV l;
17446                 char c[$uvsize];
17447         } u;
17448
17449         if ($uvsize > 4)
17450                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17451         else
17452                 u.l = (UV)0x04030201;
17453         for (i = 0; i < $uvsize; i++)
17454                 printf("%c", u.c[i]+'0');
17455         printf("\n");
17456         exit(0);
17457 }
17458 EOCP
17459                 xxx_prompt=y
17460                 set try
17461                 if eval $compile && ./try > /dev/null; then
17462                         dflt=`$run ./try`
17463                         case "$dflt" in
17464                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17465                                 echo "(The test program ran ok.)"
17466                                 echo "byteorder=$dflt"
17467                                 xxx_prompt=n
17468                         ;;
17469                         ????|????????) echo "(The test program ran ok.)" ;;
17470                         *) echo "(The test program didn't run right for some reason.)" ;;
17471                         esac
17472                 else
17473                         dflt='4321'
17474                         cat <<'EOM'
17475 (I can't seem to compile the test program.  Guessing big-endian...)
17476 EOM
17477                 fi
17478                 case "$xxx_prompt" in
17479                 y)
17480                         rp="What is the order of bytes in $uvtype?"
17481                         . ./myread
17482                         byteorder="$ans"
17483                         ;;
17484                 *)      byteorder=$dflt
17485                         ;;
17486                 esac
17487                 ;;
17488         esac
17489         $rm -f try.c try
17490         ;;
17491 esac
17492
17493
17494 $cat <<EOM
17495
17496 Checking to see whether you can access character data unalignedly...
17497 EOM
17498 case "$d_u32align" in
17499 '')   $cat >try.c <<EOCP
17500 #include <stdio.h>
17501 #$i_stdlib I_STDLIB
17502 #ifdef I_STDLIB
17503 #include <stdlib.h>
17504 #endif
17505 #define U32 $u32type
17506 #define BYTEORDER 0x$byteorder
17507 #define U8 $u8type
17508 #include <signal.h>
17509 #ifdef SIGBUS
17510 $signal_t bletch(s) int s; { exit(4); }
17511 #endif
17512 int main() {
17513 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17514     U8 buf[8];
17515     U32 *up;
17516     int i;
17517
17518     if (sizeof(U32) != 4) {
17519         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17520         exit(1);
17521     }
17522
17523     fflush(stdout);
17524
17525 #ifdef SIGBUS
17526     signal(SIGBUS, bletch);
17527 #endif
17528
17529     buf[0] = 0;
17530     buf[1] = 0;
17531     buf[2] = 0;
17532     buf[3] = 1;
17533     buf[4] = 0;
17534     buf[5] = 0;
17535     buf[6] = 0;
17536     buf[7] = 1;
17537
17538     for (i = 0; i < 4; i++) {
17539         up = (U32*)(buf + i);
17540         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17541                (*up == 1 << (8*(3-i)))  /* little-endian */
17542               )
17543            )
17544         {
17545             printf("read failed (%x)\n", *up);
17546             exit(2);
17547         }
17548     }
17549
17550     /* write test */
17551     for (i = 0; i < 4; i++) {
17552         up = (U32*)(buf + i);
17553         *up = 0xBeef;
17554         if (*up != 0xBeef) {
17555             printf("write failed (%x)\n", *up);
17556             exit(3);
17557         }
17558     }
17559
17560     exit(0);
17561 #else
17562     printf("1\n");
17563     exit(1);
17564 #endif
17565     return 0;
17566 }
17567 EOCP
17568 set try
17569 if eval $compile_ok; then
17570         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17571         $run ./try 2>&1 >/dev/null
17572         case "$?" in
17573         0)      cat >&4 <<EOM
17574 You can access character data pretty unalignedly.
17575 EOM
17576                 d_u32align="$undef"
17577                 ;;
17578         *)      cat >&4 <<EOM
17579 It seems that you must access character data in an aligned manner.
17580 EOM
17581                 d_u32align="$define"
17582                 ;;
17583         esac
17584 else
17585         rp='Can you access character data at unaligned addresses?'
17586         dflt='n'
17587         . ./myread
17588         case "$ans" in
17589         [yY]*)  d_u32align="$undef"  ;;
17590         *)      d_u32align="$define" ;;
17591         esac
17592 fi
17593 $rm -f core core.try.* try.core
17594 ;;
17595 esac
17596
17597 : see if ualarm exists
17598 set ualarm d_ualarm
17599 eval $inlibc
17600
17601 : see if umask exists
17602 set umask d_umask
17603 eval $inlibc
17604
17605 : see if unordered exists
17606 set unordered d_unordered
17607 eval $inlibc
17608
17609 : see if unsetenv exists
17610 set unsetenv d_unsetenv
17611 eval $inlibc
17612
17613 : see if usleep exists
17614 set usleep d_usleep
17615 eval $inlibc
17616
17617 : see if prototype for usleep is available
17618 echo " "
17619 set d_usleepproto usleep $i_unistd unistd.h
17620 eval $hasproto
17621
17622 : see if ustat exists
17623 set ustat d_ustat
17624 eval $inlibc
17625
17626 : backward compatibility for d_hvfork
17627 if test X$d_hvfork != X; then
17628         d_vfork="$d_hvfork"
17629         d_hvfork=''
17630 fi
17631 : see if there is a vfork
17632 val=''
17633 set vfork val
17634 eval $inlibc
17635
17636 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17637 : perl on Solaris 2.x, and probably elsewhere.
17638 case "$val" in
17639 $define)
17640         echo " "
17641         case "$usevfork" in
17642         false) dflt='n';;
17643         *) dflt='y';;
17644         esac
17645         cat <<'EOM'
17646  
17647 Perl can only use a vfork() that doesn't suffer from strict
17648 restrictions on calling functions or modifying global data in
17649 the child.  For example, glibc-2.1 contains such a vfork()
17650 that is unsuitable.  If your system provides a proper fork()
17651 call, chances are that you do NOT want perl to use vfork().
17652
17653 EOM
17654         rp="Do you still want to use vfork()?"
17655         . ./myread
17656         case "$ans" in
17657         y|Y) ;;
17658         *)
17659                 echo "Ok, we won't use vfork()."
17660                 val="$undef"
17661                 ;;
17662         esac
17663         ;;
17664 esac
17665 set d_vfork
17666 eval $setvar
17667 case "$d_vfork" in
17668 $define) usevfork='true';;
17669 *) usevfork='false';;
17670 esac
17671
17672 : see if closedir exists
17673 set closedir d_closedir
17674 eval $inlibc
17675
17676 case "$d_closedir" in
17677 "$define")
17678         echo " "
17679         echo "Checking whether closedir() returns a status..." >&4
17680         cat > try.c <<EOM
17681 #$i_dirent I_DIRENT             /**/
17682 #$i_sysdir I_SYS_DIR            /**/
17683 #$i_sysndir I_SYS_NDIR          /**/
17684 #$i_systypes I_SYS_TYPES        /**/
17685
17686 #if defined(I_SYS_TYPES)
17687 #include <sys/types.h>
17688 #endif
17689 #if defined(I_DIRENT)
17690 #include <dirent.h>
17691 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17692 #include <sys/dir.h>
17693 #endif
17694 #else
17695 #ifdef I_SYS_NDIR
17696 #include <sys/ndir.h>
17697 #else
17698 #ifdef I_SYS_DIR
17699 #ifdef hp9000s500
17700 #include <ndir.h>       /* may be wrong in the future */
17701 #else
17702 #include <sys/dir.h>
17703 #endif
17704 #endif
17705 #endif
17706 #endif 
17707 int main() { return closedir(opendir(".")); }
17708 EOM
17709         set try
17710         if eval $compile_ok; then
17711                 if $run ./try > /dev/null 2>&1 ; then
17712                         echo "Yes, it does."
17713                         val="$undef"
17714                 else
17715                         echo "No, it doesn't."
17716                         val="$define"
17717                 fi
17718         else
17719                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17720                 val="$define"
17721         fi
17722         ;;
17723 *)
17724         val="$undef";
17725         ;;
17726 esac
17727 set d_void_closedir
17728 eval $setvar
17729 $rm -f try try.*
17730 : see if there is a wait4
17731 set wait4 d_wait4
17732 eval $inlibc
17733
17734 : see if waitpid exists
17735 set waitpid d_waitpid
17736 eval $inlibc
17737
17738 : see if wcstombs exists
17739 set wcstombs d_wcstombs
17740 eval $inlibc
17741
17742 : see if wctomb exists
17743 set wctomb d_wctomb
17744 eval $inlibc
17745
17746 : see if writev exists
17747 set writev d_writev
17748 eval $inlibc
17749
17750 : preserve RCS keywords in files with variable substitution, grrr
17751 Date='$Date'
17752 Id='$Id'
17753 Log='$Log'
17754 RCSfile='$RCSfile'
17755 Revision='$Revision'
17756
17757 : check for alignment requirements
17758 echo " "
17759 case "$usecrosscompile$multiarch" in
17760 *$define*)
17761         $cat <<EOM
17762 You seem to be either cross-compiling or doing a multiarchitecture build,
17763 skipping the memory alignment check.
17764
17765 EOM
17766         case "$alignbytes" in
17767         '') alignbytes=8 ;;
17768         esac
17769         ;;
17770 *)
17771         case "$alignbytes" in
17772         '') echo "Checking alignment constraints..." >&4
17773                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17774                         $cat >try.c <<'EOCP'
17775 typedef long double NV;
17776 EOCP
17777                 else
17778                         $cat >try.c <<'EOCP'
17779 typedef double NV;
17780 EOCP
17781                 fi
17782                 $cat >>try.c <<'EOCP'
17783 #include <stdio.h>
17784 struct foobar {
17785         char foo;
17786         NV bar;
17787 } try_algn;
17788 int main()
17789 {
17790     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17791     return(0);
17792 }
17793 EOCP
17794                 set try
17795                 if eval $compile_ok; then
17796                         dflt=`$run ./try`
17797                 else
17798                         dflt='8'
17799                         echo "(I can't seem to compile the test program...)"
17800                 fi
17801                 ;;
17802         *) dflt="$alignbytes"
17803                 ;;
17804         esac
17805         rp="Doubles must be aligned on a how-many-byte boundary?"
17806         . ./myread
17807         alignbytes="$ans"
17808         $rm -f try.c try
17809         ;;
17810 esac
17811
17812
17813 : set the base revision
17814 baserev=5.0
17815
17816 : how do we concatenate cpp tokens here?
17817 echo " "
17818 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17819 $cat >cpp_stuff.c <<'EOCP'
17820 #define RCAT(a,b)a/**/b
17821 #define ACAT(a,b)a ## b
17822 RCAT(Rei,ser)
17823 ACAT(Cir,cus)
17824 EOCP
17825 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17826 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17827         echo "Oh!  Smells like ANSI's been here." >&4
17828         echo "We can catify or stringify, separately or together!"
17829         cpp_stuff=42
17830 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17831         echo "Ah, yes!  The good old days!" >&4
17832         echo "However, in the good old days we don't know how to stringify and"
17833         echo "catify at the same time."
17834         cpp_stuff=1
17835 else
17836         $cat >&4 <<EOM
17837 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17838 You're going to have to edit the values of CAT[2-5] in config.h...
17839 EOM
17840         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17841 fi
17842 $rm -f cpp_stuff.*
17843
17844 : see if this is a db.h system
17845 set db.h i_db
17846 eval $inhdr
17847
17848 case "$i_db" in
17849 $define)
17850         : Check db version.
17851         echo " "
17852         echo "Checking Berkeley DB version ..." >&4
17853         $cat >try.c <<EOCP
17854 #$d_const HASCONST
17855 #ifndef HASCONST
17856 #define const
17857 #endif
17858 #include <sys/types.h>
17859 #include <stdio.h>
17860 #$i_stdlib I_STDLIB
17861 #ifdef I_STDLIB
17862 #include <stdlib.h>
17863 #endif
17864 #include <db.h>
17865 int main(int argc, char *argv[])
17866 {
17867 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17868     int Major, Minor, Patch ;
17869     unsigned long Version ;
17870     (void)db_version(&Major, &Minor, &Patch) ;
17871     if (argc == 2) {
17872         printf("%d %d %d %d %d %d\n",
17873                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17874                Major, Minor, Patch);
17875         exit(0);
17876     }
17877     printf("You have Berkeley DB Version 2 or greater.\n");
17878
17879     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17880                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17881     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17882                 Major, Minor, Patch) ;
17883
17884     /* check that db.h & libdb are compatible */
17885     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17886         printf("db.h and libdb are incompatible.\n") ;
17887         exit(3);        
17888     }
17889
17890     printf("db.h and libdb are compatible.\n") ;
17891
17892     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17893                 + DB_VERSION_PATCH ;
17894
17895     /* needs to be >= 2.3.4 */
17896     if (Version < 2003004) {
17897     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17898         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17899         exit(2);        
17900     }
17901
17902     exit(0);
17903 #else
17904 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17905     if (argc == 2) {
17906         printf("1 0 0\n");
17907         exit(0);
17908     }
17909     printf("You have Berkeley DB Version 1.\n");
17910     exit(0);    /* DB version < 2: the coast is clear. */
17911 #else
17912     exit(1);    /* <db.h> not Berkeley DB? */
17913 #endif
17914 #endif
17915 }
17916 EOCP
17917         set try
17918         if eval $compile_ok && $run ./try; then
17919                 echo 'Looks OK.' >&4
17920                 set `$run ./try 1`
17921                 db_version_major=$1
17922                 db_version_minor=$2
17923                 db_version_patch=$3
17924         else
17925                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17926                 i_db=$undef
17927                 case " $libs " in
17928                 *"-ldb "*)
17929                         : Remove db from list of libraries to use
17930                         echo "Removing unusable -ldb from library list" >&4
17931                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17932                         shift
17933                         libs="$*"
17934                         echo "libs = $libs" >&4
17935                         ;;
17936                 esac
17937         fi
17938         $rm -f try.*
17939         ;;
17940 esac
17941
17942 case "$i_db" in
17943 define)
17944         : Check the return type needed for hash 
17945         echo " "
17946         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17947         $cat >try.c <<EOCP
17948 #$d_const HASCONST
17949 #ifndef HASCONST
17950 #define const
17951 #endif
17952 #include <sys/types.h>
17953 #include <db.h>
17954
17955 #ifndef DB_VERSION_MAJOR
17956 u_int32_t hash_cb (ptr, size)
17957 const void *ptr;
17958 size_t size;
17959 {
17960 }
17961 HASHINFO info;
17962 int main()
17963 {
17964         info.hash = hash_cb;
17965 }
17966 #endif
17967 EOCP
17968         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17969                 if $contains warning try.out >>/dev/null 2>&1 ; then
17970                         db_hashtype='int'
17971                 else
17972                         db_hashtype='u_int32_t'
17973                 fi
17974         else
17975                 : XXX Maybe we should just give up here.
17976                 db_hashtype=u_int32_t
17977                 $cat try.out >&4
17978                 echo "Help:  I can't seem to compile the db test program." >&4
17979                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
17980         fi
17981         $rm -f try.*
17982         echo "Your version of Berkeley DB uses $db_hashtype for hash."
17983         ;;
17984 *)      db_hashtype=u_int32_t
17985         ;;
17986 esac
17987 case "$i_db" in
17988 define)
17989         : Check the return type needed for prefix 
17990         echo " "
17991         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
17992         cat >try.c <<EOCP
17993 #$d_const HASCONST
17994 #ifndef HASCONST
17995 #define const
17996 #endif
17997 #include <sys/types.h>
17998 #include <db.h>
17999
18000 #ifndef DB_VERSION_MAJOR
18001 size_t prefix_cb (key1, key2)
18002 const DBT *key1;
18003 const DBT *key2;
18004 {
18005 }
18006 BTREEINFO info;
18007 int main()
18008 {
18009         info.prefix = prefix_cb;
18010 }
18011 #endif
18012 EOCP
18013         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18014                 if $contains warning try.out >>/dev/null 2>&1 ; then
18015                         db_prefixtype='int'
18016                 else
18017                         db_prefixtype='size_t'
18018                 fi
18019         else
18020                 db_prefixtype='size_t'
18021                 : XXX Maybe we should just give up here.
18022                 $cat try.out >&4
18023                 echo "Help:  I can't seem to compile the db test program." >&4
18024                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18025         fi
18026         $rm -f try.*
18027         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18028         ;;
18029 *)      db_prefixtype='size_t'
18030         ;;
18031 esac
18032
18033
18034 : How can we generate normalized random numbers ?
18035 echo " "
18036 echo "Looking for a random number function..." >&4
18037 case "$randfunc" in
18038 '')
18039         if set drand48 val -f; eval $csym; $val; then
18040                 dflt="drand48"
18041                 echo "Good, found drand48()." >&4
18042         elif set random val -f; eval $csym; $val; then
18043                 dflt="random"
18044                 echo "OK, found random()." >&4
18045         else
18046                 dflt="rand"
18047                 echo "Yick, looks like I have to use rand()." >&4
18048         fi
18049         echo " "
18050         ;;
18051 *)
18052         dflt="$randfunc"
18053         ;;
18054 esac
18055 cont=true
18056
18057 case "$ccflags" in
18058 *-Dmy_rand=*|*-Dmy_srand=*)
18059         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18060         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18061         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18062         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18063         ;;
18064 esac
18065
18066 while $test "$cont"; do
18067         rp="Use which function to generate random numbers?"
18068         . ./myread
18069         if $test "$ans" = "$dflt"; then
18070                 : null
18071         else
18072                 randbits=''
18073         fi
18074         randfunc="$ans"
18075         if set $ans val -f; eval $csym; $val; then
18076                 cont=''
18077         else
18078                 dflt=y
18079                 rp="I cannot find function $ans. Use that name anyway?"
18080                 . ./myread
18081                 dflt=rand
18082                 case "$ans" in
18083                         [yY]*) cont='';;
18084                 esac
18085         fi
18086         case "$cont" in
18087         '')
18088                 case "$randfunc" in
18089                 drand48)
18090                         drand01="drand48()"
18091                         seedfunc="srand48"
18092                         randbits=48
18093                         randseedtype=long
18094                         ;;
18095                 rand|random)
18096                         case "$randbits" in
18097                         '')
18098 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18099                                 $cat >try.c <<EOCP
18100 #$i_unistd I_UNISTD
18101 #$i_stdlib I_STDLIB
18102 #include <stdio.h>
18103 #ifdef I_UNISTD
18104 #  include <unistd.h>
18105 #endif
18106 #ifdef I_STDLIB
18107 #  include <stdlib.h>
18108 #endif
18109 int main()
18110 {
18111         register int i;
18112         register unsigned long tmp;
18113         register unsigned long max = 0L;
18114
18115         for (i = 1000; i; i--) {
18116                 tmp = (unsigned long) $randfunc();
18117                 if (tmp > max) max = tmp;
18118         }
18119         for (i = 0; max; i++)
18120                 max /= 2;
18121         printf("%d\n",i);
18122 }
18123 EOCP
18124                                 set try
18125                                 if eval $compile_ok; then
18126                                         dflt=`try`
18127                                 else
18128                                         dflt='?'
18129                                         echo "(I can't seem to compile the test program...)"
18130                                 fi
18131                                 ;;
18132                         *)
18133                                 dflt="$randbits"
18134                                 ;;
18135                         esac
18136                         rp="How many bits does your $randfunc() function produce?"
18137                         . ./myread
18138                         randbits="$ans"
18139                         $rm -f try.c try
18140                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18141                         seedfunc="s$randfunc"
18142                         randseedtype=unsigned
18143                         ;;
18144                 *)
18145                         dflt="31"
18146                         rp="How many bits does your $randfunc() function produce?"
18147                         . ./myread
18148                         randbits="$ans"
18149                         seedfunc="s$randfunc"
18150                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18151                         if set $seedfunc val -f; eval $csym; $val; then
18152                                 echo "(Using $seedfunc() to seed random generator)"
18153                         else
18154                                 echo "(Warning: no $seedfunc() to seed random generator)"
18155                                 seedfunc=rand
18156                         fi
18157                         randseedtype=unsigned
18158                         ;;
18159                 esac
18160                 ;;
18161         esac
18162 done
18163
18164 echo " "
18165 echo "Determining whether or not we are on an EBCDIC system..." >&4
18166 $cat >try.c <<'EOM'
18167 int main()
18168 {
18169   if ('M'==0xd4) return 0;
18170   return 1;
18171 }
18172 EOM
18173
18174 val=$undef
18175 set try
18176 if eval $compile_ok; then
18177         if $run ./try; then
18178                 echo "You seem to speak EBCDIC." >&4
18179                 val="$define"
18180         else
18181                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18182         fi
18183 else
18184         echo "I'm unable to compile the test program." >&4
18185         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18186 fi
18187 $rm -f try try.*
18188 set ebcdic
18189 eval $setvar
18190
18191 echo " "
18192 $cat >&4 <<EOM
18193 Checking how to flush all pending stdio output...
18194 EOM
18195 # I only know how to find the first 32 possibly open files on SunOS.
18196 # See also hints/sunos_4_1.sh and util.c  --AD
18197 case "$osname" in
18198 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18199 esac
18200 $cat >>try.c <<EOCP
18201 #include <stdio.h>
18202 #$i_stdlib I_STDLIB
18203 #ifdef I_STDLIB
18204 #include <stdlib.h>
18205 #endif
18206 #$i_unistd I_UNISTD
18207 #ifdef I_UNISTD
18208 # include <unistd.h>
18209 #endif
18210 #$d_sysconf HAS_SYSCONF
18211 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18212 #ifdef HAS_STDIO_STREAM_ARRAY
18213 # define STDIO_STREAM_ARRAY $stdio_stream_array
18214 #endif
18215 int main() {
18216   FILE* p;
18217   unlink("try.out");
18218   p = fopen("try.out", "w");
18219 #ifdef TRY_FPUTC
18220   fputc('x', p);
18221 #else
18222 # ifdef TRY_FPRINTF
18223   fprintf(p, "x");
18224 # endif
18225 #endif
18226 #ifdef TRY_FFLUSH_NULL
18227   fflush(NULL);
18228 #endif
18229 #ifdef TRY_FFLUSH_ALL
18230   {
18231     long open_max = -1;
18232 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18233     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18234 # else
18235 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18236     open_max = sysconf(_SC_OPEN_MAX);
18237 #  else
18238 #   ifdef FOPEN_MAX
18239     open_max = FOPEN_MAX;
18240 #   else
18241 #    ifdef OPEN_MAX
18242     open_max = OPEN_MAX;
18243 #    else
18244 #     ifdef _NFILE
18245     open_max = _NFILE;
18246 #     endif
18247 #    endif
18248 #   endif
18249 #  endif
18250 # endif 
18251 # ifdef HAS_STDIO_STREAM_ARRAY
18252     if (open_max > 0) {
18253       long i;
18254       for (i = 0; i < open_max; i++)
18255             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18256                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18257                 STDIO_STREAM_ARRAY[i]._flag)
18258                 fflush(&STDIO_STREAM_ARRAY[i]);
18259     }   
18260   }
18261 # endif
18262 #endif
18263   _exit(42);
18264 }
18265 EOCP
18266 : first we have to find out how _not_ to flush
18267 $to try.c
18268 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18269     output=''
18270     set try -DTRY_FPUTC
18271     if eval $compile; then
18272             $run ./try 2>/dev/null
18273             code="$?"
18274             $from try.out
18275             if $test ! -s try.out -a "X$code" = X42; then
18276                 output=-DTRY_FPUTC
18277             fi
18278     fi
18279     case "$output" in
18280     '')
18281             set try -DTRY_FPRINTF
18282             if eval $compile; then
18283                     $run ./try 2>/dev/null
18284                     code="$?"
18285                     $from try.out
18286                     if $test ! -s try.out -a "X$code" = X42; then
18287                         output=-DTRY_FPRINTF
18288                     fi
18289             fi
18290         ;;
18291     esac
18292 fi
18293 : check for fflush NULL behaviour
18294 case "$fflushNULL" in
18295 '')     set try -DTRY_FFLUSH_NULL $output
18296         if eval $compile; then
18297                 $run ./try 2>/dev/null
18298                 code="$?"
18299                 $from try.out
18300                 if $test -s try.out -a "X$code" = X42; then
18301                         fflushNULL="`$cat try.out`"
18302                 else
18303                         if $test "X$code" != X42; then
18304                                 $cat >&4 <<EOM
18305 (If this test failed, don't worry, we'll try another method shortly.)
18306 EOM
18307                         fi
18308                 fi
18309         fi
18310         $rm -f core try.core core.try.*
18311         case "$fflushNULL" in
18312         x)      $cat >&4 <<EOM
18313 Your fflush(NULL) works okay for output streams.
18314 Let's see if it clobbers input pipes...
18315 EOM
18316 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18317 # bug that improperly flushes the input end of pipes.  So we avoid the
18318 # autoflush on fork/system/exec support for now. :-(
18319 $cat >tryp.c <<EOCP
18320 #include <stdio.h>
18321 int
18322 main(int argc, char **argv)
18323 {
18324     char buf[1024];
18325     int i;
18326     char *bp = buf;
18327     while (1) {
18328         while ((i = getc(stdin)) != -1
18329                && (*bp++ = i) != '\n'
18330                && bp < &buf[1024])
18331         /* DO NOTHING */ ;
18332         *bp = '\0';
18333         fprintf(stdout, "%s", buf);
18334         fflush(NULL);
18335         if (i == -1)
18336             return 0;
18337         bp = buf;
18338     }
18339 }
18340 EOCP
18341                 fflushNULL="$define"
18342                 set tryp
18343                 if eval $compile; then
18344                     $rm -f tryp.out
18345                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18346                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18347                        $cat >&4 <<EOM
18348 fflush(NULL) seems to behave okay with input streams.
18349 EOM
18350                         fflushNULL="$define"
18351                     else
18352                         $cat >&4 <<EOM
18353 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18354 EOM
18355                         fflushNULL="$undef"
18356                     fi
18357                 fi
18358                 $rm -f core tryp.c tryp.core core.tryp.*
18359                 ;;
18360         '')     $cat >&4 <<EOM
18361 Your fflush(NULL) isn't working (contrary to ANSI C).
18362 EOM
18363                 fflushNULL="$undef"
18364                 ;;
18365         *)      $cat >&4 <<EOM
18366 Cannot figure out whether your fflush(NULL) works or not.
18367 I'm assuming it doesn't (contrary to ANSI C).
18368 EOM
18369                 fflushNULL="$undef"
18370                 ;;
18371         esac
18372         ;;
18373 $define|true|[yY]*)
18374         fflushNULL="$define"
18375         ;;
18376 *)
18377         fflushNULL="$undef"
18378         ;;
18379 esac
18380 : check explicit looping only if NULL did not work, and if the pipe
18381 : bug does not show up on an explicit flush too
18382 case "$fflushNULL" in
18383 "$undef")
18384         $cat >tryp.c <<EOCP
18385 #include <stdio.h>
18386 int
18387 main(int argc, char **argv)
18388 {
18389     char buf[1024];
18390     int i;
18391     char *bp = buf;
18392     while (1) {
18393         while ((i = getc(stdin)) != -1
18394                && (*bp++ = i) != '\n'
18395                && bp < &buf[1024])
18396         /* DO NOTHING */ ;
18397         *bp = '\0';
18398         fprintf(stdout, "%s", buf);
18399         fflush(stdin);
18400         if (i == -1)
18401             return 0;
18402         bp = buf;
18403     }
18404 }
18405 EOCP
18406         set tryp
18407         if eval $compile; then
18408             $rm -f tryp.out
18409             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18410             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18411                $cat >&4 <<EOM
18412 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18413 EOM
18414                 : now check for fflushall behaviour
18415                 case "$fflushall" in
18416                 '')     set try -DTRY_FFLUSH_ALL $output
18417                         if eval $compile; then
18418                                 $cat >&4 <<EOM
18419 (Now testing the other method--but note that this also may fail.)
18420 EOM
18421                                 $run ./try 2>/dev/null
18422                                 code=$?
18423                                 $from try.out
18424                                 if $test -s try.out -a "X$code" = X42; then
18425                                         fflushall="`$cat try.out`"
18426                                 fi
18427                         fi
18428                         $rm -f core try.core core.try.*
18429                         case "$fflushall" in
18430                         x)      $cat >&4 <<EOM
18431 Whew. Flushing explicitly all the stdio streams works.
18432 EOM
18433                                 fflushall="$define"
18434                                 ;;
18435                         '')     $cat >&4 <<EOM
18436 Sigh. Flushing explicitly all the stdio streams doesn't work.
18437 EOM
18438                                 fflushall="$undef"
18439                                 ;;
18440                         *)      $cat >&4 <<EOM
18441 Cannot figure out whether flushing stdio streams explicitly works or not.
18442 I'm assuming it doesn't.
18443 EOM
18444                                 fflushall="$undef"
18445                                 ;;
18446                         esac
18447                         ;;
18448                 "$define"|true|[yY]*)
18449                         fflushall="$define"
18450                         ;;
18451                 *)
18452                         fflushall="$undef"
18453                         ;;
18454                 esac
18455             else
18456                 $cat >&4 <<EOM
18457 All is futile.  Even fflush(stdin) clobbers input pipes!
18458 EOM
18459                 fflushall="$undef"
18460             fi
18461         else
18462             fflushall="$undef"
18463         fi
18464         $rm -f core tryp.c tryp.core core.tryp.*
18465         ;;
18466 *)      fflushall="$undef"
18467         ;;
18468 esac
18469
18470 case "$fflushNULL$fflushall" in
18471 undefundef)
18472         $cat <<EOM
18473 OK, I give up.  I cannot figure out how to flush pending stdio output.
18474 We won't be flushing handles at all before fork/exec/popen.
18475 EOM
18476         ;;
18477 esac
18478 $rm -f try.* try$exe_ext
18479
18480 : Store the full pathname to the ar program for use in the C program
18481 : Respect a hint or command line value for full_ar.
18482 case "$full_ar" in
18483 '') full_ar=$ar ;;
18484 esac
18485
18486 : Store the full pathname to the sed program for use in the C program
18487 full_sed=$sed
18488
18489 : see what type gids are declared as in the kernel
18490 echo " "
18491 echo "Looking for the type for group ids returned by getgid()."
18492 set gid_t gidtype xxx stdio.h sys/types.h
18493 eval $typedef
18494 case "$gidtype" in
18495 xxx)
18496         xxx=`./findhdr sys/user.h`
18497         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18498         case $1 in
18499         unsigned) dflt="$1 $2" ;;
18500         *) dflt="$1" ;;
18501         esac
18502         ;;
18503 *) dflt="$gidtype";;
18504 esac
18505 case "$gidtype" in
18506 gid_t) echo "gid_t found." ;;
18507 *)      rp="What is the type for group ids returned by getgid()?"
18508         . ./myread
18509         gidtype="$ans"
18510         ;;
18511 esac
18512
18513 echo " "
18514 case "$gidtype" in
18515 *_t) zzz="$gidtype"     ;;
18516 *)   zzz="gid"          ;;
18517 esac
18518 echo "Checking the size of $zzz..." >&4 
18519 cat > try.c <<EOCP
18520 #include <sys/types.h>
18521 #include <stdio.h>
18522 #$i_stdlib I_STDLIB
18523 #ifdef I_STDLIB
18524 #include <stdlib.h>
18525 #endif
18526 int main() {
18527     printf("%d\n", (int)sizeof($gidtype));
18528     exit(0);
18529 }
18530 EOCP
18531 set try
18532 if eval $compile_ok; then
18533         yyy=`$run ./try`
18534         case "$yyy" in
18535         '')     gidsize=4
18536                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18537                 ;;
18538         *)      gidsize=$yyy
18539                 echo "Your $zzz is $gidsize bytes long."
18540                 ;;
18541         esac
18542 else
18543         gidsize=4
18544         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18545 fi
18546
18547
18548 echo " "
18549 case "$gidtype" in
18550 *_t) zzz="$gidtype"     ;;
18551 *)   zzz="gid"          ;;
18552 esac
18553 echo "Checking the sign of $zzz..." >&4 
18554 cat > try.c <<EOCP
18555 #include <sys/types.h>
18556 #include <stdio.h>
18557 int main() {
18558         $gidtype foo = -1;
18559         if (foo < 0)
18560                 printf("-1\n");
18561         else
18562                 printf("1\n");
18563 }
18564 EOCP
18565 set try
18566 if eval $compile; then
18567         yyy=`$run ./try`
18568         case "$yyy" in
18569         '')     gidsign=1
18570                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18571                 ;;
18572         *)      gidsign=$yyy
18573                 case "$gidsign" in
18574                  1) echo "Your $zzz is unsigned." ;;
18575                 -1) echo "Your $zzz is signed."   ;;
18576                 esac
18577                 ;;
18578         esac
18579 else
18580         gidsign=1
18581         echo "(I can't compile the test program--guessing unsigned.)" >&4
18582 fi
18583
18584
18585 echo " "
18586
18587 if $test X"$quadtype" != X; then
18588
18589 echo "Checking how to print 64-bit integers..." >&4
18590
18591 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18592         $cat >try.c <<'EOCP'
18593 #include <sys/types.h>
18594 #include <stdio.h>
18595 int main() {
18596   int q = 12345678901;
18597   printf("%ld\n", q);
18598 }
18599 EOCP
18600         set try
18601         if eval $compile; then
18602                 yyy=`$run ./try`
18603                 case "$yyy" in
18604                 12345678901)
18605                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18606                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18607                         echo "We will use %d."
18608                         ;;
18609                 esac
18610         fi
18611 fi
18612
18613 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18614         $cat >try.c <<'EOCP'
18615 #include <sys/types.h>
18616 #include <stdio.h>
18617 int main() {
18618   long q = 12345678901;
18619   printf("%ld\n", q);
18620 }
18621 EOCP
18622         set try
18623         if eval $compile; then
18624                 yyy=`$run ./try`
18625                 case "$yyy" in
18626                 12345678901)
18627                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18628                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18629                         echo "We will use %ld."
18630                         ;;
18631                 esac
18632         fi
18633 fi
18634
18635 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18636         $cat >try.c <<'EOCP'
18637 #include <sys/types.h>
18638 #include <inttypes.h>
18639 #include <stdio.h>
18640 int main() {
18641   int64_t q = 12345678901;
18642   printf("%" PRId64 "\n", q);
18643 }
18644 EOCP
18645         set try
18646         if eval $compile; then
18647                 yyy=`$run ./try`
18648                 case "$yyy" in
18649                 12345678901)
18650                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18651                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18652                         echo "We will use the C9X style."
18653                         ;;
18654                 esac
18655         fi
18656 fi
18657
18658 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18659         $cat >try.c <<EOCP
18660 #include <sys/types.h>
18661 #include <stdio.h>
18662 int main() {
18663   $quadtype q = 12345678901;
18664   printf("%Ld\n", q);
18665 }
18666 EOCP
18667         set try
18668         if eval $compile; then
18669                 yyy=`$run ./try`
18670                 case "$yyy" in
18671                 12345678901)
18672                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18673                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18674                         echo "We will use %Ld."
18675                         ;;
18676                 esac
18677         fi
18678 fi
18679
18680 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18681         $cat >try.c <<'EOCP'
18682 #include <sys/types.h>
18683 #include <stdio.h>
18684 int main() {
18685   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18686   printf("%lld\n", q);
18687 }
18688 EOCP
18689         set try
18690         if eval $compile; then
18691                 yyy=`$run ./try`
18692                 case "$yyy" in
18693                 12345678901)
18694                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18695                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18696                         echo "We will use the %lld style."
18697                         ;;
18698                 esac
18699         fi
18700 fi
18701
18702 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18703         $cat >try.c <<EOCP
18704 #include <sys/types.h>
18705 #include <stdio.h>
18706 int main() {
18707   $quadtype q = 12345678901;
18708   printf("%qd\n", q);
18709 }
18710 EOCP
18711         set try
18712         if eval $compile; then
18713                 yyy=`$run ./try`
18714                 case "$yyy" in
18715                 12345678901)
18716                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18717                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18718                         echo "We will use %qd."
18719                         ;;
18720                 esac
18721         fi
18722 fi
18723
18724 if $test X"$sPRId64" = X; then
18725         echo "Cannot figure out how to print 64-bit integers." >&4
18726 fi
18727
18728 $rm -f try try.*
18729
18730 fi
18731
18732 case "$sPRId64" in
18733 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18734         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18735         ;;
18736 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18737         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18738         ;;
18739 esac
18740
18741
18742 echo " "
18743 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18744
18745 if $test X"$ivsize" = X8; then
18746         ivdformat="$sPRId64"
18747         uvuformat="$sPRIu64"
18748         uvoformat="$sPRIo64"
18749         uvxformat="$sPRIx64"
18750         uvXUformat="$sPRIXU64"
18751 else
18752         if $test X"$ivsize" = X"$longsize"; then
18753                 ivdformat='"ld"'
18754                 uvuformat='"lu"'
18755                 uvoformat='"lo"'
18756                 uvxformat='"lx"'
18757                 uvXUformat='"lX"'
18758         else
18759                 if $test X"$ivsize" = X"$intsize"; then
18760                         ivdformat='"d"'
18761                         uvuformat='"u"'
18762                         uvoformat='"o"'
18763                         uvxformat='"x"'
18764                         uvXUformat='"X"'
18765                 else
18766                         : far out
18767                         if $test X"$ivsize" = X"$shortsize"; then
18768                                 ivdformat='"hd"'
18769                                 uvuformat='"hu"'
18770                                 uvoformat='"ho"'
18771                                 uvxformat='"hx"'
18772                                 uvXUformat='"hX"'
18773                         fi
18774                 fi
18775         fi
18776 fi
18777
18778 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18779         nveformat="$sPRIeldbl"
18780         nvfformat="$sPRIfldbl"
18781         nvgformat="$sPRIgldbl"
18782         nvEUformat="$sPRIEUldbl"
18783         nvFUformat="$sPRIFUldbl"
18784         nvGUformat="$sPRIGUldbl"
18785 else
18786         nveformat='"e"'
18787         nvfformat='"f"'
18788         nvgformat='"g"'
18789         nvEUformat='"E"'
18790         nvFUformat='"F"'
18791         nvGUformat='"G"'
18792 fi
18793
18794 case "$ivdformat" in
18795 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18796     exit 1
18797     ;;
18798 esac
18799
18800
18801 echo " "
18802 $echo "Checking the format string to be used for gids..." >&4
18803
18804 case "$gidsign" in
18805 -1)     if $test X"$gidsize" = X"$ivsize"; then
18806                 gidformat="$ivdformat"
18807         else
18808                 if $test X"$gidsize" = X"$longsize"; then
18809                         gidformat='"ld"'
18810                 else
18811                         if $test X"$gidsize" = X"$intsize"; then
18812                                 gidformat='"d"'
18813                         else
18814                                 if $test X"$gidsize" = X"$shortsize"; then
18815                                         gidformat='"hd"'
18816                                 fi
18817                         fi
18818                 fi
18819         fi
18820         ;;
18821 *)      if $test X"$gidsize" = X"$uvsize"; then
18822                 gidformat="$uvuformat"
18823         else
18824                 if $test X"$gidsize" = X"$longsize"; then
18825                         gidformat='"lu"'
18826                 else
18827                         if $test X"$gidsize" = X"$intsize"; then
18828                                 gidformat='"u"'
18829                         else
18830                                 if $test X"$gidsize" = X"$shortsize"; then
18831                                         gidformat='"hu"'
18832                                 fi
18833                         fi
18834                 fi
18835         fi
18836         ;;
18837 esac
18838
18839 : see if getgroups exists
18840 set getgroups d_getgrps
18841 eval $inlibc
18842
18843 : see if setgroups exists
18844 set setgroups d_setgrps
18845 eval $inlibc
18846
18847
18848 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18849 echo " "
18850 case "$d_getgrps$d_setgrps" in
18851 *define*)
18852         case "$groupstype" in
18853         '') dflt="$gidtype" ;;
18854         *)  dflt="$groupstype" ;;
18855         esac
18856         $cat <<EOM
18857 What type of pointer is the second argument to getgroups() and setgroups()?
18858 Usually this is the same as group ids, $gidtype, but not always.
18859
18860 EOM
18861         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18862         . ./myread
18863         groupstype="$ans"
18864         ;;
18865 *)  groupstype="$gidtype";;
18866 esac
18867
18868
18869 case "$mad" in
18870 $define|true|[yY]*)     dflt='y' ;;
18871 *)                      dflt='n' ;;
18872 esac
18873 cat <<EOM
18874
18875 Would you like to build with Misc Attribute Decoration? This is development
18876 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18877 overhead on the interpreter.
18878
18879 If this doesn't make any sense to you, just accept the default '$dflt'.
18880 EOM
18881 rp='Build Perl with MAD?'
18882 . ./myread
18883 case "$ans" in
18884 y|Y)    val="$define"
18885         madlyh='madly.h madly.act madly.tab'
18886         madlysrc='madly.c'
18887         madlyobj="madly$_o" ;;
18888 *)      val="$undef"
18889         madlyh=''
18890         madlysrc=''
18891         madlyobj='' ;;
18892 esac
18893 set mad
18894 eval $setvar
18895
18896 echo " "
18897 echo "Checking if your $make program sets \$(MAKE)..." >&4
18898 case "$make_set_make" in
18899 '')
18900         $sed 's/^X //' > testmake.mak << 'EOF'
18901 Xall:
18902 X       @echo 'maketemp="$(MAKE)"'
18903 EOF
18904         case "`$make -f testmake.mak 2>/dev/null`" in
18905         *maketemp=*) make_set_make='#' ;;
18906         *)      make_set_make="MAKE=$make" ;;
18907         esac
18908         $rm -f testmake.mak
18909         ;;
18910 esac
18911 case "$make_set_make" in
18912 '#') echo "Yup, it does.";;
18913 *) echo "Nope, it doesn't.";;
18914 esac
18915
18916 : see what type is used for mode_t
18917 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18918 set mode_t modetype int stdio.h sys/types.h
18919 eval $typedef_ask
18920
18921 : see if stdarg is available
18922 echo " "
18923 if $test `./findhdr stdarg.h`; then
18924         echo "<stdarg.h> found." >&4
18925         valstd="$define"
18926 else
18927         echo "<stdarg.h> NOT found." >&4
18928         valstd="$undef"
18929 fi
18930
18931 : see if varags is available
18932 echo " "
18933 if $test `./findhdr varargs.h`; then
18934         echo "<varargs.h> found." >&4
18935 else
18936         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18937 fi
18938
18939 : set up the varargs testing programs
18940 $cat > varargs.c <<EOP
18941 #ifdef I_STDARG
18942 #include <stdarg.h>
18943 #endif
18944 #ifdef I_VARARGS
18945 #include <varargs.h>
18946 #endif
18947
18948 #ifdef I_STDARG
18949 int f(char *p, ...)
18950 #else
18951 int f(va_alist)
18952 va_dcl
18953 #endif
18954 {
18955         va_list ap;
18956 #ifndef I_STDARG
18957         char *p;
18958 #endif
18959 #ifdef I_STDARG
18960         va_start(ap,p);
18961 #else
18962         va_start(ap);
18963         p = va_arg(ap, char *);
18964 #endif
18965         va_end(ap);
18966 }
18967 EOP
18968 $cat > varargs <<EOP
18969 $startsh
18970 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
18971         echo "true"
18972 else
18973         echo "false"
18974 fi
18975 $rm -f varargs$_o
18976 EOP
18977 chmod +x varargs
18978
18979 : now check which varargs header should be included
18980 echo " "
18981 i_varhdr=''
18982 case "$valstd" in
18983 "$define")
18984         if `./varargs I_STDARG`; then
18985                 val='stdarg.h'
18986         elif `./varargs I_VARARGS`; then
18987                 val='varargs.h'
18988         fi
18989         ;;
18990 *)
18991         if `./varargs I_VARARGS`; then
18992                 val='varargs.h'
18993         fi
18994         ;;
18995 esac
18996 case "$val" in
18997 '')
18998 echo "I could not find the definition for va_dcl... You have problems..." >&4
18999         val="$undef"; set i_stdarg; eval $setvar
19000         val="$undef"; set i_varargs; eval $setvar
19001         ;;
19002 *) 
19003         set i_varhdr
19004         eval $setvar
19005         case "$i_varhdr" in
19006         stdarg.h)
19007                 val="$define"; set i_stdarg; eval $setvar
19008                 val="$undef"; set i_varargs; eval $setvar
19009                 ;;
19010         varargs.h)
19011                 val="$undef"; set i_stdarg; eval $setvar
19012                 val="$define"; set i_varargs; eval $setvar
19013                 ;;
19014         esac
19015         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19016 esac
19017 $rm -f varargs*
19018
19019 : see if we need va_copy
19020 echo " "
19021 case "$i_stdarg" in
19022 "$define")
19023         $cat >try.c <<EOCP
19024 #include <stdarg.h>
19025 #include <stdio.h>
19026 #$i_stdlib I_STDLIB
19027 #ifdef I_STDLIB
19028 #include <stdlib.h>
19029 #endif
19030 #include <signal.h>
19031
19032 int
19033 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19034 {
19035   return vfprintf(f, fmt, *valp);
19036 }
19037  
19038 int    
19039 myvfprintf(FILE *f, const  char *fmt, va_list val)
19040 {
19041   return ivfprintf(f, fmt, &val);
19042 }
19043       
19044 int
19045 myprintf(char *fmt, ...) 
19046 {
19047   va_list val;
19048   va_start(val, fmt);
19049   return myvfprintf(stdout, fmt, val); 
19050 }         
19051
19052 int
19053 main(int ac, char **av)
19054 {
19055   signal(SIGSEGV, exit);
19056
19057   myprintf("%s%cs all right, then\n", "that", '\'');                            
19058   exit(0);      
19059 }
19060 EOCP
19061         set try
19062         if eval $compile && $run ./try 2>&1 >/dev/null; then
19063                 case "`$run ./try`" in
19064                 "that's all right, then")
19065                         okay=yes
19066                         ;;
19067                 esac
19068         fi
19069         case "$okay" in
19070         yes)    echo "It seems that you don't need va_copy()." >&4
19071                 need_va_copy="$undef"
19072                 ;;
19073         *)      echo "It seems that va_copy() or similar will be needed." >&4
19074                 need_va_copy="$define"
19075                 ;;
19076         esac
19077         $rm -f try.* core core.* *.core *.core.*
19078         ;;
19079 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19080         ;;
19081 esac
19082
19083 : see what type is used for size_t
19084 rp="What is the type used for the length parameter for string functions?"
19085 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19086 eval $typedef_ask
19087
19088 : check for type of arguments to gethostbyaddr. 
19089 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19090         case "$d_gethbyaddr" in
19091         $define)
19092                 $cat <<EOM
19093
19094 Checking to see what type of arguments are accepted by gethostbyaddr().
19095 EOM
19096                 hdrs="$define sys/types.h
19097                         $d_socket sys/socket.h 
19098                         $i_niin netinet/in.h 
19099                         $i_netdb netdb.h
19100                         $i_unistd unistd.h"
19101                 : The first arg can 'char *' or 'void *'
19102                 : The second arg is some of integral type
19103                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19104                         for yyy in size_t long int; do
19105                                 case "$netdb_host_type" in
19106                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19107                                         if ./protochk "$try" $hdrs; then
19108                                                 echo "Your system accepts $xxx for the first arg."
19109                                                 echo "...and $yyy for the second arg."
19110                                                 netdb_host_type="$xxx"
19111                                                 netdb_hlen_type="$yyy"
19112                                         fi
19113                                         ;;
19114                                 esac
19115                         done
19116                 done
19117                 : In case none of those worked, prompt the user.
19118                 case "$netdb_host_type" in
19119                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19120                         dflt='char *'
19121                         . ./myread
19122                         netdb_host_type=$ans
19123                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19124                         dflt="$sizetype"
19125                         . ./myread
19126                         netdb_hlen_type=$ans
19127                         ;;
19128                 esac
19129                 ;;
19130         *)      : no gethostbyaddr, so pick harmless defaults
19131                 netdb_host_type='char *'
19132                 netdb_hlen_type="$sizetype"
19133                 ;;
19134         esac
19135         # Remove the "const" if needed. -- but then we'll have a 
19136         # prototype clash!
19137         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19138 fi
19139
19140 : check for type of argument to gethostbyname. 
19141 if test "X$netdb_name_type" = X ; then
19142         case "$d_gethbyname" in
19143         $define)
19144                 $cat <<EOM
19145
19146 Checking to see what type of argument is accepted by gethostbyname().
19147 EOM
19148                 hdrs="$define sys/types.h
19149                         $d_socket sys/socket.h 
19150                         $i_niin netinet/in.h 
19151                         $i_netdb netdb.h
19152                         $i_unistd unistd.h"
19153                 for xxx in "const char *" "char *"; do
19154                         case "$netdb_name_type" in
19155                         '')     try="extern struct hostent *gethostbyname($xxx);"
19156                                 if ./protochk "$try" $hdrs; then
19157                                         echo "Your system accepts $xxx."
19158                                         netdb_name_type="$xxx"
19159                                 fi
19160                                 ;;
19161                         esac
19162                 done
19163                 : In case none of those worked, prompt the user.
19164                 case "$netdb_name_type" in
19165                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19166                         dflt='char *'
19167                         . ./myread
19168                         netdb_name_type=$ans
19169                         ;;
19170                 esac
19171                 ;;
19172         *)      : no gethostbyname, so pick harmless default
19173                 netdb_name_type='char *'
19174                 ;;
19175         esac
19176 fi
19177
19178 : check for type of 1st argument to getnetbyaddr. 
19179 if test "X$netdb_net_type" = X ; then
19180         case "$d_getnbyaddr" in
19181         $define)
19182                 $cat <<EOM
19183
19184 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19185 EOM
19186                 hdrs="$define sys/types.h
19187                         $d_socket sys/socket.h 
19188                         $i_niin netinet/in.h 
19189                         $i_netdb netdb.h
19190                         $i_unistd unistd.h"
19191                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19192                         case "$netdb_net_type" in
19193                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19194                                 if ./protochk "$try" $hdrs; then
19195                                         echo "Your system accepts $xxx."
19196                                         netdb_net_type="$xxx"
19197                                 fi
19198                                 ;;
19199                         esac
19200                 done
19201                 : In case none of those worked, prompt the user.
19202                 case "$netdb_net_type" in
19203                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19204                         dflt='long'
19205                         . ./myread
19206                         netdb_net_type=$ans
19207                         ;;
19208                 esac
19209                 ;;
19210         *)      : no getnetbyaddr, so pick harmless default
19211                 netdb_net_type='long'
19212                 ;;
19213         esac
19214 fi
19215 : locate the preferred pager for this system
19216 fn=f/
19217 case "$pager" in
19218 '')
19219         dflt=''
19220         case "$pg" in
19221         /*) dflt=$pg;;
19222         [a-zA-Z]:/*) dflt=$pg;;
19223         esac
19224         case "$more" in
19225         /*) dflt=$more;;
19226         [a-zA-Z]:/*) dflt=$more;;
19227         esac
19228         case "$less" in
19229         /*) dflt=$less;;
19230         [a-zA-Z]:/*) dflt=$less;;
19231         esac
19232         case "$dflt" in
19233         '') dflt=/usr/ucb/more;;
19234         esac
19235         ;;
19236 *)      dflt="$pager"
19237         : Instruct ./getfile to trust the hinted or previous pager value,
19238         : even if it does not begin with a slash.  For example, on os2,
19239         : pager might be cmd /c more.  See comments in UU/getfile.
19240         fn="f/($pager)"
19241         ;;
19242 esac
19243 echo " "
19244 rp='What pager is used on your system?'
19245 . ./getfile
19246 pager="$ans"
19247
19248 : see what type pids are declared as in the kernel
19249 rp="What is the type of process ids on this system?"
19250 set pid_t pidtype int stdio.h sys/types.h
19251 eval $typedef_ask
19252
19253 : see if ar generates random libraries by itself
19254 echo " "
19255 echo "Checking how to generate random libraries on your machine..." >&4
19256 echo 'int bar1() { return bar2(); }' > bar1.c
19257 echo 'int bar2() { return 2; }' > bar2.c
19258 $cat > foo.c <<EOP
19259 #$i_stdlib I_STDLIB
19260 #ifdef I_STDLIB
19261 #include <stdlib.h>
19262 #endif
19263 int main() { printf("%d\n", bar1()); exit(0); }
19264 EOP
19265 $cc $ccflags -c bar1.c >/dev/null 2>&1
19266 $cc $ccflags -c bar2.c >/dev/null 2>&1
19267 $cc $ccflags -c foo.c >/dev/null 2>&1
19268 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19269 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19270         $run ./foobar >/dev/null 2>&1; then
19271         echo "$ar appears to generate random libraries itself."
19272         orderlib=false
19273         if [ "X$ranlib" = "X" ]; then
19274             ranlib=":"
19275         fi
19276 elif $ar s bar$_a >/dev/null 2>&1 &&
19277         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19278         $run ./foobar >/dev/null 2>&1; then
19279                 echo "a table of contents needs to be added with '$ar s'."
19280                 orderlib=false
19281                 ranlib="$ar s"
19282 elif $ar ts bar$_a >/dev/null 2>&1 &&
19283         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19284         $run ./foobar >/dev/null 2>&1; then
19285                 echo "a table of contents needs to be added with '$ar ts'."
19286                 orderlib=false
19287                 ranlib="$ar ts"
19288 else
19289         case "$ranlib" in
19290         :) ranlib='';;
19291         '')
19292                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19293                 $test -f $ranlib || ranlib=''
19294                 ;;
19295         esac
19296         if $test -n "$ranlib"; then
19297                 echo "your system has '$ranlib'; we'll use that."
19298                 orderlib=false
19299         else
19300                 echo "your system doesn't seem to support random libraries"
19301                 echo "so we'll use lorder and tsort to order the libraries."
19302                 orderlib=true
19303                 ranlib=":"
19304         fi
19305 fi
19306 $rm -f foo* bar*
19307
19308 : check for type of arguments to select. 
19309 case "$selecttype" in
19310 '') case "$d_select" in
19311         $define)
19312                 echo " "
19313                 $cat <<EOM
19314 Checking to see what type of arguments are accepted by select().
19315 EOM
19316                 hdrs="$define sys/types.h
19317                         $i_systime sys/time.h 
19318                         $i_sysselct sys/select.h
19319                         $d_socket sys/socket.h"
19320                 : The first arg can be int, unsigned, or size_t
19321                 : The last arg may or may not be 'const'
19322                 val=''
19323                 : void pointer has been seen but using that
19324                 : breaks the selectminbits test
19325                 for xxx in 'fd_set *' 'int *'; do
19326                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19327                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19328                                         case "$val" in
19329                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19330                                                 if ./protochk "$try" $hdrs; then
19331                                                         echo "Your system accepts $xxx."
19332                                                         val="$xxx"
19333                                                 fi
19334                                                 ;;
19335                                         esac
19336                                 done
19337                         done
19338                 done
19339                 case "$val" in
19340                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19341                         case "$d_fd_set" in
19342                                 $define) dflt="fd_set *" ;;
19343                                 *)              dflt="int *" ;;
19344                         esac
19345                         . ./myread
19346                         val=$ans
19347                         ;;
19348                 esac
19349                 selecttype="$val"
19350                 ;;
19351         *)      : no select, so pick a harmless default
19352                 selecttype='int *'
19353                 ;;
19354         esac
19355         ;;
19356 esac
19357
19358 : check for the select 'width'
19359 case "$selectminbits" in
19360 '') safebits=`expr $ptrsize \* 8`
19361     case "$d_select" in
19362         $define)
19363                 $cat <<EOM
19364
19365 Checking to see on how many bits at a time your select() operates...
19366 EOM
19367                 $cat >try.c <<EOCP
19368 #include <sys/types.h>
19369 #$i_time I_TIME
19370 #$i_systime I_SYS_TIME
19371 #$i_systimek I_SYS_TIME_KERNEL
19372 #ifdef I_TIME
19373 #   include <time.h>
19374 #endif
19375 #ifdef I_SYS_TIME
19376 #   ifdef I_SYS_TIME_KERNEL
19377 #       define KERNEL
19378 #   endif
19379 #   include <sys/time.h>
19380 #   ifdef I_SYS_TIME_KERNEL
19381 #       undef KERNEL
19382 #   endif
19383 #endif
19384 #$i_sysselct I_SYS_SELECT
19385 #ifdef I_SYS_SELECT
19386 #include <sys/select.h>
19387 #endif
19388 #$d_socket HAS_SOCKET
19389 #ifdef HAS_SOCKET
19390 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19391 #endif
19392 #include <stdio.h>
19393 #$i_stdlib I_STDLIB
19394 #ifdef I_STDLIB
19395 #include <stdlib.h>
19396 #endif
19397 $selecttype b;
19398 #define S sizeof(*(b))
19399 #define MINBITS 64
19400 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19401 #define NBITS  (NBYTES * 8)
19402 int main() {
19403     char *s = malloc(NBYTES);
19404     struct timeval t;
19405     int i;
19406     FILE* fp;
19407     int fd;
19408
19409     if (!s)
19410         exit(1);
19411     fclose(stdin);
19412     fp = fopen("try.c", "r");
19413     if (fp == 0)
19414       exit(2);
19415     fd = fileno(fp);
19416     if (fd < 0)
19417       exit(3);
19418     b = ($selecttype)s;
19419     for (i = 0; i < NBITS; i++)
19420         FD_SET(i, b);
19421     t.tv_sec  = 0;
19422     t.tv_usec = 0;
19423     select(fd + 1, b, 0, 0, &t);
19424     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19425     free(s);
19426     printf("%d\n", i + 1);
19427     return 0;
19428 }
19429 EOCP
19430                 set try
19431                 if eval $compile_ok; then
19432                         selectminbits=`$run ./try`
19433                         case "$selectminbits" in
19434                         '')     cat >&4 <<EOM
19435 Cannot figure out on how many bits at a time your select() operates.
19436 I'll play safe and guess it is $safebits bits.
19437 EOM
19438                                 selectminbits=$safebits
19439                                 bits="$safebits bits"
19440                                 ;;
19441                         1)      bits="1 bit" ;;
19442                         *)      bits="$selectminbits bits" ;;
19443                         esac
19444                         echo "Your select() operates on $bits at a time." >&4
19445                 else
19446                         rp='What is the minimum number of bits your select() operates on?'
19447                         case "$byteorder" in
19448                         12345678)       dflt=64 ;;
19449                         1234)           dflt=32 ;;
19450                         *)              dflt=1  ;;
19451                         esac
19452                         . ./myread
19453                         val=$ans
19454                         selectminbits="$val"
19455                 fi
19456                 $rm -f try.* try
19457                 ;;
19458         *)      : no select, so pick a harmless default
19459                 selectminbits=$safebits
19460                 ;;
19461         esac
19462         ;;
19463 esac
19464
19465 : Trace out the files included by signal.h, then look for SIGxxx names.
19466 : Remove SIGARRAYSIZE used by HPUX.
19467 : Remove SIGSTKSIZE used by Linux.
19468 : Remove SIGSTKSZ used by Posix.
19469 : Remove SIGTYP void lines used by OS2.
19470 : Some cpps, like os390, dont give the file name anywhere
19471 if [ "X$fieldn" = X ]; then
19472         : Just make some guesses.  We check them later.
19473         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19474 else
19475         xxx=`echo '#include <signal.h>' |
19476         $cppstdin $cppminus $cppflags 2>/dev/null |
19477         $grep '^[       ]*#.*include' | 
19478         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19479 fi
19480 : Check this list of files to be sure we have parsed the cpp output ok.
19481 : This will also avoid potentially non-existent files, such 
19482 : as ../foo/bar.h
19483 xxxfiles=''
19484 for xx in $xxx /dev/null ; do
19485         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19486 done
19487 : If we have found no files, at least try signal.h
19488 case "$xxxfiles" in
19489 '')     xxxfiles=`./findhdr signal.h` ;;
19490 esac
19491 xxx=`awk '
19492 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19493         print substr($2, 4, 20)
19494 }
19495 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19496         print substr($3, 4, 20)
19497 }' $xxxfiles`
19498 : Append some common names just in case the awk scan failed.
19499 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19500 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19501 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19502 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19503 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19504
19505 : generate a few handy files for later
19506 $cat > signal.c <<EOCP
19507 #include <sys/types.h>
19508 #include <signal.h>
19509 #$i_stdlib I_STDLIB
19510 #ifdef I_STDLIB
19511 #include <stdlib.h>
19512 #endif
19513 #include <stdio.h>
19514 int main() {
19515
19516 /* Strange style to avoid deeply-nested #if/#else/#endif */
19517 #ifndef NSIG
19518 #  ifdef _NSIG
19519 #    define NSIG (_NSIG)
19520 #  endif
19521 #endif
19522
19523 #ifndef NSIG
19524 #  ifdef SIGMAX
19525 #    define NSIG (SIGMAX+1)
19526 #  endif
19527 #endif
19528
19529 #ifndef NSIG
19530 #  ifdef SIG_MAX
19531 #    define NSIG (SIG_MAX+1)
19532 #  endif
19533 #endif
19534
19535 #ifndef NSIG
19536 #  ifdef _SIG_MAX
19537 #    define NSIG (_SIG_MAX+1)
19538 #  endif
19539 #endif
19540
19541 #ifndef NSIG
19542 #  ifdef MAXSIG
19543 #    define NSIG (MAXSIG+1)
19544 #  endif
19545 #endif
19546
19547 #ifndef NSIG
19548 #  ifdef MAX_SIG
19549 #    define NSIG (MAX_SIG+1)
19550 #  endif
19551 #endif
19552
19553 #ifndef NSIG
19554 #  ifdef SIGARRAYSIZE
19555 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19556 #  endif
19557 #endif
19558
19559 #ifndef NSIG
19560 #  ifdef _sys_nsig
19561 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19562 #  endif
19563 #endif
19564
19565 /* Default to some arbitrary number that's big enough to get most
19566    of the common signals.
19567 */
19568 #ifndef NSIG
19569 #    define NSIG 50
19570 #endif
19571
19572 printf("NSIG %d\n", NSIG);
19573
19574 #ifndef JUST_NSIG
19575
19576 EOCP
19577
19578 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19579 {
19580         printf "#ifdef SIG"; printf $1; printf "\n"
19581         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19582         printf $1; printf ");\n"
19583         printf "#endif\n"
19584 }
19585 END {
19586         printf "#endif /* JUST_NSIG */\n";
19587         printf "exit(0);\n}\n";
19588 }
19589 ' >>signal.c
19590 $cat >signal.awk <<'EOP'
19591 BEGIN { ndups = 0 }
19592 $1 ~ /^NSIG$/ { nsig = $2 }
19593 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19594     if ($2 > maxsig) { maxsig = $2 }
19595     if (sig_name[$2]) {
19596         dup_name[ndups] = $1
19597         dup_num[ndups] = $2
19598         ndups++ 
19599     }
19600     else {
19601         sig_name[$2] = $1
19602         sig_num[$2] = $2
19603     }
19604 }
19605 END { 
19606     if (nsig == 0) {
19607         nsig = maxsig + 1
19608     }
19609     printf("NSIG %d\n", nsig);
19610     for (n = 1; n < nsig; n++) {
19611         if (sig_name[n]) {
19612             printf("%s %d\n", sig_name[n], sig_num[n])
19613         }
19614         else {
19615             printf("NUM%d %d\n", n, n) 
19616         }
19617     }
19618     for (n = 0; n < ndups; n++) {
19619         printf("%s %d\n", dup_name[n], dup_num[n])
19620     }
19621 }
19622 EOP
19623 $cat >signal_cmd <<EOS
19624 $startsh
19625 if $test -s signal.lst; then
19626     echo "Using your existing signal.lst file"
19627         exit 0
19628 fi
19629 xxx="$xxx"
19630 EOS
19631 $cat >>signal_cmd <<'EOS'
19632
19633 set signal
19634 if eval $compile_ok; then
19635         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19636 else
19637         echo "(I can't seem be able to compile the whole test program)" >&4
19638         echo "(I'll try it in little pieces.)" >&4
19639         set signal -DJUST_NSIG
19640         if eval $compile_ok; then
19641                 $run ./signal$_exe > signal.nsg
19642                 $cat signal.nsg
19643         else
19644                 echo "I can't seem to figure out how many signals you have." >&4
19645                 echo "Guessing 50." >&4
19646                 echo 'NSIG 50' > signal.nsg
19647         fi
19648         : Now look at all the signal names, one at a time.
19649         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19650                 $cat > signal.c <<EOCP
19651 #include <sys/types.h>
19652 #include <signal.h>
19653 #include <stdio.h>
19654 int main() {
19655 printf("$xx %d\n", SIG${xx});
19656 return 0;
19657 }
19658 EOCP
19659                 set signal
19660                 if eval $compile; then
19661                         echo "SIG${xx} found."
19662                         $run ./signal$_exe  >> signal.ls1
19663                 else
19664                         echo "SIG${xx} NOT found."
19665                 fi
19666         done
19667         if $test -s signal.ls1; then
19668                 $cat signal.nsg signal.ls1 |
19669                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19670         fi
19671
19672 fi
19673 if $test -s signal.lst; then
19674         :
19675 else
19676         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19677         echo 'kill -l' >signal
19678         set X `csh -f <signal`
19679         $rm -f signal
19680         shift
19681         case $# in
19682         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19683         esac
19684         echo $@ | $tr ' ' $trnl | \
19685             $awk '{ printf "%s %d\n", $1, ++s; }
19686                   END { printf "NSIG %d\n", ++s }' >signal.lst
19687 fi
19688 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19689 EOS
19690 chmod a+x signal_cmd
19691 $eunicefix signal_cmd
19692
19693 : generate list of signal names
19694 echo " "
19695 case "$sig_name_init" in
19696 '') doinit=yes ;;
19697 *)  case "$sig_num_init" in
19698     ''|*,*) doinit=yes ;;
19699     esac ;;
19700 esac
19701 case "$doinit" in
19702 yes)
19703         echo "Generating a list of signal names and numbers..." >&4
19704         . ./signal_cmd
19705         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19706         sig_name=`$awk 'BEGIN { printf "ZERO " }
19707                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19708         sig_num=`$awk  'BEGIN { printf "0 " }
19709                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19710         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19711                              !/^NSIG/   { printf "\"%s\", ", $1 }
19712                              END        { printf "0\n" }' signal.lst`
19713         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19714                              !/^NSIG/   { printf "%d, ", $2}
19715                              END        { printf "0\n"}' signal.lst`
19716         ;;
19717 esac
19718 echo "The following $sig_count signals are available:"
19719 echo " "
19720 echo $sig_name | $awk \
19721 'BEGIN { linelen = 0 }
19722 {
19723         for (i = 1; i <= NF; i++) {
19724                 name = "SIG" $i " "
19725                 linelen = linelen + length(name)
19726                 if (linelen > 70) {
19727                         printf "\n"
19728                         linelen = length(name)
19729                 }
19730                 printf "%s", name
19731         }
19732         printf "\n"
19733 }'
19734 sig_size=`echo $sig_name | awk '{print NF}'`
19735 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19736
19737 echo " "
19738 case "$sizetype" in
19739 *_t) zzz="$sizetype"    ;;
19740 *)   zzz="filesize"     ;;
19741 esac
19742 echo "Checking the size of $zzz..." >&4 
19743 cat > try.c <<EOCP
19744 #include <sys/types.h>
19745 #include <stdio.h>
19746 #$i_stdlib I_STDLIB
19747 #ifdef I_STDLIB
19748 #include <stdlib.h>
19749 #endif
19750 int main() {
19751     printf("%d\n", (int)sizeof($sizetype));
19752     exit(0);
19753 }
19754 EOCP
19755 set try
19756 if eval $compile_ok; then
19757         yyy=`$run ./try`
19758         case "$yyy" in
19759         '')     sizesize=4
19760                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19761                 ;;
19762         *)      sizesize=$yyy
19763                 echo "Your $zzz size is $sizesize bytes."
19764                 ;;
19765         esac
19766 else
19767         sizesize=4
19768         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19769 fi
19770
19771
19772 : check for socklen_t
19773 echo " "
19774 echo "Checking to see if you have socklen_t..." >&4
19775 $cat >try.c <<EOCP
19776 #include <sys/types.h>
19777 #$d_socket HAS_SOCKET
19778 #ifdef HAS_SOCKET
19779 #include <sys/socket.h>
19780 #endif
19781 int main() { socklen_t x = 16; }
19782 EOCP
19783 set try
19784 if eval $compile; then
19785         val="$define"
19786         echo "You have socklen_t."
19787 else
19788         val="$undef"
19789         echo "You do not have socklen_t."
19790         case "$sizetype" in
19791         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19792         esac
19793 fi
19794 $rm -f try try.*
19795 set d_socklen_t
19796 eval $setvar
19797
19798 : see if this is a socks.h system
19799 set socks.h i_socks
19800 eval $inhdr
19801
19802 : check for type of the size argument to socket calls
19803 case "$d_socket" in
19804 "$define")
19805         $cat <<EOM
19806
19807 Checking to see what type is the last argument of accept().
19808 EOM
19809         yyy=''
19810         case "$d_socklen_t" in
19811         "$define") yyy="$yyy socklen_t"
19812         esac
19813         yyy="$yyy $sizetype int long unsigned"
19814         for xxx in $yyy; do
19815                 case "$socksizetype" in
19816                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19817                         case "$usesocks" in
19818                         "$define")
19819                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19820                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19821                                         socksizetype="$xxx"
19822                                 fi
19823                                 ;;
19824                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19825                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19826                                         socksizetype="$xxx"
19827                                 fi
19828                                 ;;
19829                         esac
19830                         ;;
19831                 esac
19832         done
19833 : In case none of those worked, prompt the user.
19834         case "$socksizetype" in
19835         '')     rp='What is the type for socket address structure sizes?'
19836                 dflt='int'
19837                 . ./myread
19838                 socksizetype=$ans
19839                 ;;
19840         esac
19841         ;;
19842 *)      : no sockets, so pick relatively harmless default
19843         socksizetype='int'
19844         ;;
19845 esac
19846
19847 : see what type is used for signed size_t
19848 set ssize_t ssizetype int stdio.h sys/types.h
19849 eval $typedef
19850 dflt="$ssizetype"
19851 $cat > try.c <<EOM
19852 #include <stdio.h>
19853 #$i_stdlib I_STDLIB
19854 #ifdef I_STDLIB
19855 #include <stdlib.h>
19856 #endif
19857 #include <sys/types.h>
19858 #define Size_t $sizetype
19859 #define SSize_t $dflt
19860 int main()
19861 {
19862         if (sizeof(Size_t) == sizeof(SSize_t))
19863                 printf("$dflt\n");
19864         else if (sizeof(Size_t) == sizeof(int))
19865                 printf("int\n");
19866         else 
19867                 printf("long\n");
19868         exit(0);
19869 }
19870 EOM
19871 echo " "
19872 set try
19873 if eval $compile_ok && $run ./try > /dev/null; then
19874         ssizetype=`$run ./try`
19875         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19876 else
19877         $cat >&4 <<EOM
19878 Help! I can't compile and run the ssize_t test program: please enlighten me!
19879 (This is probably a misconfiguration in your system or libraries, and
19880 you really ought to fix it.  Still, I'll try anyway.)
19881
19882 I need a type that is the same size as $sizetype, but is guaranteed to
19883 be signed.  Common values are ssize_t, int and long.
19884
19885 EOM
19886         rp="What signed type is the same size as $sizetype?"
19887         . ./myread
19888         ssizetype="$ans"
19889 fi
19890 $rm -f try try.*
19891
19892 : see what type of char stdio uses.
19893 echo " "
19894 echo '#include <stdio.h>' > stdio.c
19895 $cppstdin $cppminus < stdio.c > stdioh
19896 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19897         echo "Your stdio uses unsigned chars." >&4
19898         stdchar="unsigned char"
19899 else
19900         echo "Your stdio uses signed chars." >&4
19901         stdchar="char"
19902 fi
19903 $rm -f stdio.* stdioh
19904
19905 : see what type uids are declared as in the kernel
19906 echo " "
19907 echo "Looking for the type for user ids returned by getuid()."
19908 set uid_t uidtype xxx stdio.h sys/types.h
19909 eval $typedef
19910 case "$uidtype" in
19911 xxx)
19912         xxx=`./findhdr sys/user.h`
19913         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19914         case $1 in
19915         unsigned) dflt="$1 $2" ;;
19916         *) dflt="$1" ;;
19917         esac
19918         ;;
19919 *) dflt="$uidtype";;
19920 esac
19921 case "$uidtype" in
19922 uid_t)  echo "uid_t found." ;;
19923 *)      rp="What is the type for user ids returned by getuid()?"
19924         . ./myread
19925         uidtype="$ans"
19926         ;;
19927 esac
19928
19929 echo " "
19930 case "$uidtype" in
19931 *_t) zzz="$uidtype"     ;;
19932 *)   zzz="uid"          ;;
19933 esac
19934 echo "Checking the size of $zzz..." >&4 
19935 cat > try.c <<EOCP
19936 #include <sys/types.h>
19937 #include <stdio.h>
19938 #$i_stdlib I_STDLIB
19939 #ifdef I_STDLIB
19940 #include <stdlib.h>
19941 #endif
19942 int main() {
19943     printf("%d\n", (int)sizeof($uidtype));
19944     exit(0);
19945 }
19946 EOCP
19947 set try
19948 if eval $compile_ok; then
19949         yyy=`$run ./try`
19950         case "$yyy" in
19951         '')     uidsize=4
19952                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19953                 ;;
19954         *)      uidsize=$yyy
19955                 echo "Your $zzz is $uidsize bytes long."
19956                 ;;
19957         esac
19958 else
19959         uidsize=4
19960         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19961 fi
19962
19963 echo " "
19964 case "$uidtype" in
19965 *_t) zzz="$uidtype"     ;;
19966 *)   zzz="uid"          ;;
19967 esac
19968 echo "Checking the sign of $zzz..." >&4
19969 cat > try.c <<EOCP
19970 #include <sys/types.h>
19971 #include <stdio.h>
19972 int main() {
19973         $uidtype foo = -1;
19974         if (foo < 0)
19975                 printf("-1\n");
19976         else
19977                 printf("1\n");
19978 }
19979 EOCP
19980 set try
19981 if eval $compile; then
19982         yyy=`$run ./try`
19983         case "$yyy" in
19984         '')     uidsign=1
19985                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19986                 ;;
19987         *)      uidsign=$yyy
19988                 case "$uidsign" in
19989                  1) echo "Your $zzz is unsigned." ;;
19990                 -1) echo "Your $zzz is signed."   ;;
19991                 esac
19992                 ;;
19993         esac
19994 else
19995         uidsign=1
19996         echo "(I can't compile the test program--guessing unsigned.)" >&4
19997 fi
19998
19999
20000
20001 echo " "
20002 $echo "Checking the format string to be used for uids..." >&4
20003
20004 case "$uidsign" in
20005 -1)     if $test X"$uidsize" = X"$ivsize"; then
20006                 uidformat="$ivdformat"
20007         else
20008                 if $test X"$uidsize" = X"$longsize"; then
20009                         uidformat='"ld"'
20010                 else
20011                         if $test X"$uidsize" = X"$intsize"; then
20012                                 uidformat='"d"'
20013                         else
20014                                 if $test X"$uidsize" = X"$shortsize"; then
20015                                         uidformat='"hd"'
20016                                 fi
20017                         fi
20018                 fi
20019         fi
20020         ;;
20021 *)      if $test X"$uidsize" = X"$uvsize"; then
20022                 uidformat="$uvuformat"
20023         else
20024                 if $test X"$uidsize" = X"$longsize"; then
20025                         uidformat='"lu"'
20026                 else
20027                         if $test X"$uidsize" = X"$intsize"; then
20028                                 uidformat='"u"'
20029                         else
20030                                 if $test X"$uidsize" = X"$shortsize"; then
20031                                         uidformat='"hu"'
20032                                 fi
20033                         fi
20034                 fi
20035         fi
20036         ;;
20037 esac
20038
20039
20040 case "$usesitecustomize" in
20041     $define|true|[Yy]*)
20042         usesitecustomize="$define"
20043         ;;
20044     *)
20045         usesitecustomize="$undef"
20046         ;;
20047     esac
20048
20049 : determine compiler compiler
20050 case "$yacc" in
20051 '')
20052         dflt=yacc;;
20053 *)
20054         dflt="$yacc";;
20055 esac
20056 echo " "
20057 comp='yacc'
20058 if $test -f "$byacc$_exe"; then
20059         dflt="$byacc"
20060         comp="byacc or $comp"
20061 fi
20062 if $test -f "$bison$_exe"; then
20063         comp="$comp or bison -y"
20064 fi
20065 rp="Which compiler compiler ($comp) shall I use?"
20066 . ./myread
20067 yacc="$ans"
20068 case "$yacc" in
20069 *bis*)
20070         case "$yacc" in
20071         *-y*) ;;
20072         *)
20073                 yacc="$yacc -y"
20074                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20075                 ;;
20076         esac
20077         ;;
20078 esac
20079
20080 : see if this is a fp.h system
20081 set fp.h i_fp
20082 eval $inhdr
20083
20084 : see if this is a fp_class.h system
20085 set fp_class.h i_fp_class
20086 eval $inhdr
20087
20088 : see if this is a ieeefp.h system
20089 case "$i_ieeefp" in
20090 '' ) set ieeefp.h i_ieeefp
20091      eval $inhdr
20092      ;;
20093 esac
20094
20095 : see if this is a libutil.h system
20096 set libutil.h i_libutil
20097 eval $inhdr
20098
20099 : see if mach cthreads are available
20100 if test "X$usethreads" = "X$define"; then
20101         set mach/cthreads.h i_machcthr
20102         eval $inhdr
20103 else
20104         i_machcthr="$undef"
20105 fi
20106
20107
20108
20109 : see if this is a mntent.h system
20110 set mntent.h i_mntent
20111 eval $inhdr
20112
20113 : see if ndbm.h is available
20114 set ndbm.h t_ndbm
20115 eval $inhdr
20116
20117 case "$t_ndbm" in
20118 $undef)
20119     # Some Linux distributions such as RedHat 7.1 put the
20120     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20121     if $test -f /usr/include/gdbm/ndbm.h; then
20122         echo '<gdbm/ndbm.h> found.'
20123         ccflags="$ccflags -I/usr/include/gdbm"
20124         cppflags="$cppflags -I/usr/include/gdbm"
20125         t_ndbm=$define
20126     fi
20127     ;;
20128 esac
20129
20130 case "$t_ndbm" in
20131 $define)
20132         : see if dbm_open exists
20133         set dbm_open d_dbm_open
20134         eval $inlibc
20135         case "$d_dbm_open" in
20136         $undef)
20137                 t_ndbm="$undef"
20138                 echo "We won't be including <ndbm.h>"
20139                 ;;
20140         esac
20141         ;;
20142 esac
20143 val="$t_ndbm"
20144 set i_ndbm
20145 eval $setvar
20146
20147 : see if net/errno.h is available
20148 val=''
20149 set net/errno.h val
20150 eval $inhdr
20151
20152 : Unfortunately, it causes problems on some systems.  Arrgh.
20153 case "$val" in
20154 $define)
20155         cat > try.c <<'EOM'
20156 #include <stdio.h>
20157 #include <errno.h>
20158 #include <net/errno.h>
20159 int func()
20160 {
20161         return ENOTSOCK;
20162 }
20163 EOM
20164         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20165                 echo "We'll be including <net/errno.h>." >&4
20166         else
20167                 echo "We won't be including <net/errno.h>." >&4
20168                 val="$undef"
20169         fi
20170         $rm -f try.* try
20171         ;;
20172 esac
20173 set i_neterrno
20174 eval $setvar
20175
20176 : see if netinet/tcp.h is available
20177 set netinet/tcp.h i_netinettcp
20178 eval $inhdr
20179
20180 : see if this is a poll.h system
20181 set poll.h i_poll
20182 eval $inhdr
20183
20184 : see if this is a prot.h system
20185 set prot.h i_prot
20186 eval $inhdr
20187
20188 echo " "
20189 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20190 $cat <<'EOSH' > Cppsym.know
20191 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20192 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20193 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20194 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20195 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20196 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20197 bull c cadmus clipper CMU COFF COMPILER_VERSION
20198 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20199 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20200 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20201 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20202 GLIBC GLIBC_MINOR
20203 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20204 H3050R H3050RX hbullx20 hcx host_mips
20205 hp200 hp300 hp700 HP700 hp800 hp9000
20206 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20207 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20208 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20209 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20210 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20211 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20212 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20213 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20214 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20215 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20216 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20217 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20218 MATH_HAS_NO_SIDE_EFFECTS
20219 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20220 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20221 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20222 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20223 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20224 NetBSD news1500 news1700 news1800 news1900 news3700
20225 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20226 ns32016 ns32332 ns32k nsc32000
20227 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20228 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20229 pc532 pdp11 PGC PIC plexus PORTAR posix
20230 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20231 POSIX_C_SOURCE POSIX_SOURCE POWER
20232 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20233 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20234 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20235 sony sony_news sonyrisc sparc sparclite spectrum
20236 stardent stdc STDC_EXT stratos sun sun3 sun386
20237 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20238 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20239 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20240 sysV68 sysV88 Tek4132 Tek4300 titan
20241 TM3200 TM5400 TM5600
20242 tower tower32 tower32_200 tower32_600 tower32_700
20243 tower32_800 tower32_850 tss
20244 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20245 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20246 unix UNIX95 UNIX99 unixpc unos
20247 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20248 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20249 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20250 USGr4 USGr4_2
20251 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20252 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20253 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20254 z8000
20255 EOSH
20256 # Maybe put other stuff here too.
20257 cat <<EOSH >>Cppsym.know
20258 $osname
20259 EOSH
20260 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20261 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20262 $cat Cppsym.know > Cppsym.c
20263 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20264 $rm -f Cppsym.a Cppsym.b Cppsym.c
20265 cat <<EOSH > Cppsym
20266 $startsh
20267 if $test \$# -gt 0; then
20268     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20269     if $test -s Cppsym.got; then
20270         $rm -f Cppsym.got
20271         exit 0
20272     fi
20273     $rm -f Cppsym.got
20274     exit 1
20275 else
20276     $tr " " "$trnl" | ./Cppsym.try
20277     exit 0
20278 fi
20279 EOSH
20280 chmod +x Cppsym
20281 $eunicefix Cppsym
20282 cat <<EOSH > Cppsym.try
20283 $startsh
20284 cat <<'EOCP' > try.c
20285 #include <stdio.h>
20286 #if cpp_stuff == 1
20287 #define STRINGIFY(a)    "a"
20288 #endif
20289 #if cpp_stuff == 42
20290 #define StGiFy(a)  #a
20291 #define STRINGIFY(a)    StGiFy(a)
20292 #endif
20293 #if $cpp_stuff != 1 && $cpp_stuff != 42
20294 #   include "Bletch: How does this C preprocessor stringify macros?"
20295 #endif
20296 int main() {
20297 EOCP
20298 $awk \\
20299 EOSH
20300 cat <<'EOSH' >> Cppsym.try
20301 'length($1) > 0 {
20302     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20303     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20304     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20305     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20306 }'       >> try.c
20307 echo 'return 0;}' >> try.c
20308 EOSH
20309 cat <<EOSH >> Cppsym.try
20310 ccflags="$ccflags"
20311 case "$osname-$gccversion" in
20312 irix-) ccflags="\$ccflags -woff 1178" ;;
20313 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20314 esac
20315 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20316 EOSH
20317 chmod +x Cppsym.try
20318 $eunicefix Cppsym.try
20319 ./Cppsym < Cppsym.know > Cppsym.true
20320 : Add in any linux cpp "predefined macros":
20321 case "$osname::$gccversion" in
20322   *linux*::*.*)
20323     tHdrH=_tmpHdr
20324     rm -f $tHdrH'.h' $tHdrH
20325     touch $tHdrH'.h'
20326     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20327        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20328        if [ -s $tHdrH'_cppsym.real' ]; then
20329           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20330        fi
20331     fi
20332     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20333   ;;
20334 esac
20335 : now check the C compiler for additional symbols
20336 postprocess_cc_v=''
20337 case "$osname" in
20338 aix) postprocess_cc_v="|$tr , ' '" ;;
20339 esac
20340 $cat >ccsym <<EOS
20341 $startsh
20342 $cat >tmp.c <<EOF
20343 extern int foo;
20344 EOF
20345 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20346 do
20347         case "\$i" in
20348         -D*) echo "\$i" | $sed 's/^-D//';;
20349         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20350         esac
20351 done
20352 $rm -f try.c
20353 EOS
20354 postprocess_cc_v=''
20355 chmod +x ccsym
20356 $eunicefix ccsym
20357 ./ccsym > ccsym1.raw
20358 if $test -s ccsym1.raw; then
20359        $sort ccsym1.raw | $uniq >ccsym.raw
20360 else
20361        mv ccsym1.raw ccsym.raw
20362 fi
20363
20364 $awk '/\=/ { print $0; next }
20365         { print $0"=1" }' ccsym.raw >ccsym.list
20366 $comm -13 Cppsym.true ccsym.list >ccsym.own
20367 $comm -12 Cppsym.true ccsym.list >ccsym.com
20368 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20369 also=''
20370 if $test -z ccsym.raw; then
20371         echo "Your C compiler doesn't seem to define any symbols!" >&4
20372         echo " "
20373         echo "However, your C preprocessor defines the following symbols:"
20374         $cat Cppsym.true
20375         ccsymbols=''
20376         cppsymbols=`$cat Cppsym.true`
20377         cppsymbols=`echo $cppsymbols`
20378         cppccsymbols="$cppsymbols"
20379 else
20380         if $test -s ccsym.com; then
20381                 echo "Your C compiler and pre-processor define these symbols:"
20382                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20383                 also='also '
20384                 symbols='ones'
20385                 cppccsymbols=`$cat ccsym.com`
20386                 cppccsymbols=`echo $cppccsymbols`
20387                 $test "$silent" || sleep 1
20388         fi
20389         if $test -s ccsym.cpp; then
20390                 $test "$also" && echo " "
20391                 echo "Your C pre-processor ${also}defines the following symbols:"
20392                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20393                 also='further '
20394                 cppsymbols=`$cat ccsym.cpp`
20395                 cppsymbols=`echo $cppsymbols`
20396                 $test "$silent" || sleep 1
20397         fi
20398         if $test -s ccsym.own; then
20399                 $test "$also" && echo " "
20400                 echo "Your C compiler ${also}defines the following cpp symbols:"
20401                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20402                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20403                 ccsymbols=`$cat ccsym.own`
20404                 ccsymbols=`echo $ccsymbols`
20405                 $test "$silent" || sleep 1
20406         fi
20407 fi
20408
20409 : see if this is a termio system
20410 val="$undef"
20411 val2="$undef"
20412 val3="$undef"
20413 if $test `./findhdr termios.h`; then
20414         set tcsetattr i_termios
20415         eval $inlibc
20416         val3="$i_termios"
20417 fi
20418 echo " "
20419 case "$val3" in
20420 "$define") echo "You have POSIX termios.h... good!" >&4;;
20421 *) if ./Cppsym pyr; then
20422                 case "`/bin/universe`" in
20423                 ucb) if $test `./findhdr sgtty.h`; then
20424                                 val2="$define"
20425                                 echo "<sgtty.h> found." >&4
20426                         else
20427                                 echo "System is pyramid with BSD universe."
20428                                 echo "<sgtty.h> not found--you could have problems." >&4
20429                         fi;;
20430                 *) if $test `./findhdr termio.h`; then
20431                                 val="$define"
20432                                 echo "<termio.h> found." >&4
20433                         else
20434                                 echo "System is pyramid with USG universe."
20435                                 echo "<termio.h> not found--you could have problems." >&4
20436                         fi;;
20437                 esac
20438         elif ./usg; then
20439                 if $test `./findhdr termio.h`; then
20440                         echo "<termio.h> found." >&4
20441                         val="$define"
20442                 elif $test `./findhdr sgtty.h`; then
20443                         echo "<sgtty.h> found." >&4
20444                         val2="$define"
20445                 else
20446 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20447                 fi
20448         else
20449                 if $test `./findhdr sgtty.h`; then
20450                         echo "<sgtty.h> found." >&4
20451                         val2="$define"
20452                 elif $test `./findhdr termio.h`; then
20453                         echo "<termio.h> found." >&4
20454                         val="$define"
20455                 else
20456 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20457                 fi
20458         fi;;
20459 esac
20460 set i_termio; eval $setvar
20461 val=$val2; set i_sgtty; eval $setvar
20462 val=$val3; set i_termios; eval $setvar
20463
20464 : see if stddef is available
20465 set stddef.h i_stddef
20466 eval $inhdr
20467
20468 : see if this is a sunmath.h system
20469 set sunmath.h i_sunmath
20470 eval $inhdr
20471
20472 : see if sys/access.h is available
20473 set sys/access.h i_sysaccess
20474 eval $inhdr
20475
20476 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20477 set sys/filio.h i_sysfilio
20478 eval $inhdr
20479 echo " "
20480 if $test `./findhdr sys/ioctl.h`; then
20481         val="$define"
20482         echo '<sys/ioctl.h> found.' >&4
20483 else
20484         val="$undef"
20485         if $test $i_sysfilio = "$define"; then
20486             echo '<sys/ioctl.h> NOT found.' >&4
20487         else
20488                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20489                 $test $i_termio = "$define" && xxx="termio.h"
20490                 $test $i_termios = "$define" && xxx="termios.h"
20491 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20492         fi
20493 fi
20494 set i_sysioctl
20495 eval $setvar
20496
20497 : see if socket ioctl defs are in sys/sockio.h
20498 echo " "
20499 xxx=`./findhdr sys/sockio.h`
20500 if $test "$xxx"; then
20501         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20502                 val="$define"
20503                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20504         else
20505                 val="$undef"
20506                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20507         fi
20508 else
20509         val="$undef"
20510         $cat <<EOM
20511 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20512 EOM
20513 fi
20514 set i_syssockio
20515 eval $setvar
20516
20517
20518 : see if this is a syslog.h system
20519 set syslog.h i_syslog
20520 eval $inhdr
20521
20522
20523 : see if this is a sys/mode.h system
20524 set sys/mode.h i_sysmode
20525 eval $inhdr
20526
20527 : see if sys/resource.h has to be included
20528 set sys/resource.h i_sysresrc
20529 eval $inhdr
20530
20531 : see if sys/security.h is available
20532 set sys/security.h i_syssecrt
20533 eval $inhdr
20534
20535 : see if this is a sys/statvfs.h system
20536 set sys/statvfs.h i_sysstatvfs
20537 eval $inhdr
20538
20539 : see if this is a sys/un.h system
20540 set sys/un.h i_sysun
20541 eval $inhdr
20542
20543
20544 : see if this is a sys/utsname.h system
20545 set sys/utsname.h i_sysutsname
20546 eval $inhdr
20547
20548 : see if this is a syswait system
20549 set sys/wait.h i_syswait
20550 eval $inhdr
20551
20552 : see if this is a ustat.h system
20553 set ustat.h i_ustat
20554 eval $inhdr
20555
20556 : see if this is an utime system
20557 set utime.h i_utime
20558 eval $inhdr
20559
20560 : see if this is a values.h system
20561 set values.h i_values
20562 eval $inhdr
20563
20564 : see if this is a vfork system
20565 case "$d_vfork" in
20566 "$define")
20567         set vfork.h i_vfork
20568         eval $inhdr
20569         ;;
20570 *)
20571         i_vfork="$undef"
20572         ;;
20573 esac
20574
20575 : see if gdbm.h is available
20576 set gdbm.h t_gdbm
20577 eval $inhdr
20578 case "$t_gdbm" in
20579 $define)
20580         : see if gdbm_open exists
20581         set gdbm_open d_gdbm_open
20582         eval $inlibc
20583         case "$d_gdbm_open" in
20584         $undef)
20585                 t_gdbm="$undef"
20586                 echo "We won't be including <gdbm.h>"
20587                 ;;
20588         esac
20589         ;;
20590 esac
20591 val="$t_gdbm"
20592 set i_gdbm
20593 eval $setvar
20594
20595 echo " "
20596 echo "Looking for extensions..." >&4
20597 : If we are using the old config.sh, known_extensions may contain
20598 : old or inaccurate or duplicate values.
20599 known_extensions=''
20600 nonxs_extensions=''
20601 : We do not use find because it might not be available.
20602 : We do not just use MANIFEST because the user may have dropped
20603 : some additional extensions into the source tree and expect them
20604 : to be built.
20605
20606 : Function to recursively find available extensions, ignoring DynaLoader
20607 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20608 find_extensions='
20609     for xxx in *; do
20610        case "$xxx" in
20611            DynaLoader|dynaload) ;;
20612            *)
20613            if $test -f $xxx/$xxx.xs; then
20614                known_extensions="$known_extensions $1$xxx";
20615            elif $test -f $xxx/Makefile.PL; then
20616                nonxs_extensions="$nonxs_extensions $1$xxx";
20617            else
20618                if $test -d $xxx -a $# -lt 10; then
20619                    set $1$xxx/ $*;
20620                    cd "$xxx";
20621                    eval $find_extensions;
20622                    cd ..;
20623                    shift;
20624                fi;
20625            fi
20626            ;;
20627        esac;
20628     done'
20629 tdir=`pwd`
20630 cd "$rsrc/ext"
20631 set X
20632 shift
20633 eval $find_extensions
20634 # Special case:  Add in threads/shared since it is not picked up by the
20635 # recursive find above (and adding in general recursive finding breaks
20636 # SDBM_File/sdbm).  A.D.  10/25/2001.
20637 known_extensions="$known_extensions threads/shared"
20638 set X $nonxs_extensions
20639 shift
20640 nonxs_extensions="$*"
20641 set X $known_extensions
20642 shift
20643 known_extensions="$*"
20644 cd "$tdir"
20645
20646 : Now see which are supported on this system.
20647 avail_ext=''
20648 for xxx in $known_extensions ; do
20649         case "$xxx" in
20650         DB_File|db_file)
20651                 case "$i_db" in
20652                 $define) avail_ext="$avail_ext $xxx" ;;
20653                 esac
20654                 ;;
20655         GDBM_File|gdbm_fil)
20656                 case "$i_gdbm" in 
20657                 $define) avail_ext="$avail_ext $xxx" ;;
20658                 esac
20659                 ;;
20660         I18N/Langinfo|i18n_lan)
20661                 case "$i_langinfo$d_nl_langinfo" in 
20662                 $define$define) avail_ext="$avail_ext $xxx" ;;
20663                 esac
20664                 ;;
20665         NDBM_File|ndbm_fil)
20666                 case "$i_ndbm" in
20667                 $define)
20668                     case "$osname-$use64bitint" in
20669                     hpux-define)
20670                         case "$libs" in
20671                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20672                         esac
20673                         ;;
20674                     *) avail_ext="$avail_ext $xxx" ;;
20675                     esac
20676                     ;;
20677                 esac
20678                 ;;
20679         ODBM_File|odbm_fil) 
20680                 case "${i_dbm}${i_rpcsvcdbm}" in
20681                 *"${define}"*)
20682                     case "$osname-$use64bitint" in
20683                     hpux-define)
20684                         case "$libs" in
20685                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20686                         esac
20687                         ;;
20688                     *) avail_ext="$avail_ext $xxx" ;;
20689                     esac
20690                     ;;
20691                 esac
20692                 ;;
20693         POSIX|posix)
20694                 case "$useposix" in
20695                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20696                 esac
20697                 ;;
20698         Opcode|opcode)
20699                 case "$useopcode" in
20700                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20701                 esac
20702                 ;;
20703         Socket|socket)
20704                 case "$d_socket" in 
20705                 true|$define|y)
20706                     case "$osname" in
20707                     beos) ;; # not unless BONE
20708                     *) avail_ext="$avail_ext $xxx" ;;
20709                     esac
20710                     ;;
20711                 esac
20712                 ;;
20713         Sys/Syslog|sys/syslog)
20714                 : XXX syslog requires socket
20715                 case "$d_socket" in 
20716                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20717                 esac
20718                 ;;
20719         Thread|thread)
20720                 case "$usethreads" in
20721                 true|$define|y)
20722                         case "$useithreads" in
20723                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20724                         esac
20725                 esac
20726                 ;;
20727         XS/APItest|xs/apitest)
20728                 # This is just for testing.  Skip it unless we have dynamic loading.
20729
20730                 case "$usedl" in
20731                 $define) avail_ext="$avail_ext $xxx" ;;
20732                 esac
20733                 ;;
20734         XS/Typemap|xs/typemap)
20735                 # This is just for testing.  Skip it unless we have dynamic loading.
20736                 case "$usedl" in
20737                 $define) avail_ext="$avail_ext $xxx" ;;
20738                 esac
20739                 ;;
20740         threads|threads/shared)
20741                 # threads and threads::shared are special cases.
20742                 # To stop people from asking "Perl 5.8.0 was supposed
20743                 # to have this new fancy threads implementation but my
20744                 # perl doesn't have it" and from people trying to
20745                 # (re)install the threads module using CPAN.pm and
20746                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20747                 # the threads.pm and threads/shared.pm will always be
20748                 # there, croaking informatively ("you need to rebuild
20749                 # all of Perl with threads, sorry") when threads haven't
20750                 # been compiled in.
20751                 # --jhi
20752                 avail_ext="$avail_ext $xxx"
20753                 ;;
20754         IPC/SysV|ipc/sysv)
20755                 : XXX Do we need a useipcsysv variable here
20756                 case "${d_msg}${d_sem}${d_shm}" in 
20757                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20758                 esac
20759                 ;;
20760         *)      avail_ext="$avail_ext $xxx"
20761                 ;;
20762         esac
20763 done
20764
20765 set X $avail_ext
20766 shift
20767 avail_ext="$*"
20768
20769 case "$onlyextensions" in
20770 '') ;;
20771 *)  keepextensions=''
20772     echo "You have requested that only certains extensions be included..." >&4
20773     for i in $onlyextensions; do
20774         case " $avail_ext " in
20775         *" $i "*)
20776             echo "Keeping extension $i."
20777             keepextensions="$keepextensions $i"
20778             ;;
20779         *) echo "Ignoring extension $i." ;;
20780         esac
20781     done
20782     avail_ext="$keepextensions"
20783     ;;
20784 esac
20785
20786 case "$noextensions" in
20787 '') ;;
20788 *)  keepextensions=''
20789     echo "You have requested that certain extensions be ignored..." >&4
20790     for i in $avail_ext; do
20791         case " $noextensions " in
20792         *" $i "*) echo "Ignoring extension $i." ;;
20793         *) echo "Keeping extension $i.";
20794            keepextensions="$keepextensions $i"
20795            ;;
20796         esac
20797     done
20798     avail_ext="$keepextensions"
20799     ;;
20800 esac
20801
20802 : Now see which nonxs extensions are supported on this system.
20803 : For now assume all are.
20804 nonxs_ext=''
20805 for xxx in $nonxs_extensions ; do
20806         case "$xxx" in
20807         *)      nonxs_ext="$nonxs_ext $xxx"
20808                 ;;
20809         esac
20810 done
20811
20812 set X $nonxs_ext
20813 shift
20814 nonxs_ext="$*"
20815
20816 case $usedl in
20817 $define)
20818         $cat <<EOM
20819 A number of extensions are supplied with $package.  You may choose to
20820 compile these extensions for dynamic loading (the default), compile
20821 them into the $package executable (static loading), or not include
20822 them at all.  Answer "none" to include no extensions.
20823 Note that DynaLoader is always built and need not be mentioned here.
20824
20825 EOM
20826         case "$dynamic_ext" in
20827         '')
20828                 : Exclude those listed in static_ext
20829                 dflt=''
20830                 for xxx in $avail_ext; do
20831                         case " $static_ext " in
20832                         *" $xxx "*) ;;
20833                         *) dflt="$dflt $xxx" ;;
20834                         esac
20835                 done
20836                 set X $dflt
20837                 shift
20838                 dflt="$*"
20839                 ;;
20840         *)      dflt="$dynamic_ext"
20841                 # Perhaps we are reusing an old out-of-date config.sh.
20842                 case "$hint" in
20843                 previous)
20844                         if test X"$dynamic_ext" != X"$avail_ext"; then
20845                                 $cat <<EOM
20846 NOTICE:  Your previous config.sh list may be incorrect. 
20847 The extensions now available to you are 
20848         ${avail_ext}
20849 but the default list from your previous config.sh is
20850         ${dynamic_ext} 
20851
20852 EOM
20853                         fi
20854                         ;;
20855                 esac
20856                 ;;
20857         esac
20858         case "$dflt" in
20859         '')     dflt=none;;
20860         esac
20861         rp="What extensions do you wish to load dynamically?"
20862         . ./myread
20863         case "$ans" in
20864         none) dynamic_ext=' ' ;;
20865         *) dynamic_ext="$ans" ;;
20866         esac
20867
20868         case "$static_ext" in
20869         '')
20870                 : Exclude those already listed in dynamic linking
20871                 dflt=''
20872                 for xxx in $avail_ext; do
20873                         case " $dynamic_ext " in
20874                         *" $xxx "*) ;;
20875                         *) dflt="$dflt $xxx" ;;
20876                         esac
20877                 done
20878                 set X $dflt
20879                 shift
20880                 dflt="$*"
20881                 ;;
20882         *)  dflt="$static_ext" 
20883                 ;;
20884         esac
20885
20886         case "$dflt" in
20887         '')     dflt=none;;
20888         esac
20889         rp="What extensions do you wish to load statically?"
20890         . ./myread
20891         case "$ans" in
20892         none) static_ext=' ' ;;
20893         *) static_ext="$ans" ;;
20894         esac
20895         ;;
20896 *)
20897         $cat <<EOM
20898 A number of extensions are supplied with $package.  Answer "none" 
20899 to include no extensions. 
20900 Note that DynaLoader is always built and need not be mentioned here.
20901
20902 EOM
20903         case "$static_ext" in
20904         '') dflt="$avail_ext" ;;
20905         *)      dflt="$static_ext"
20906                 # Perhaps we are reusing an old out-of-date config.sh.
20907                 case "$hint" in
20908                 previous)
20909                         if test X"$static_ext" != X"$avail_ext"; then
20910                                 $cat <<EOM
20911 NOTICE:  Your previous config.sh list may be incorrect. 
20912 The extensions now available to you are 
20913         ${avail_ext}
20914 but the default list from your previous config.sh is
20915         ${static_ext} 
20916
20917 EOM
20918                         fi
20919                         ;;
20920                 esac
20921                 ;;
20922         esac
20923         : Exclude those that are not xs extensions
20924         case "$dflt" in
20925         '')     dflt=none;;
20926         esac
20927         rp="What extensions do you wish to include?"
20928         . ./myread
20929         case "$ans" in
20930         none) static_ext=' ' ;;
20931         *) static_ext="$ans" ;;
20932         esac
20933         ;;
20934 esac
20935 #        
20936 # Encode is a special case.  If we are building Encode as a static
20937 # extension, we need to explicitly list its subextensions as well.
20938 # For other nested extensions, this is handled automatically by
20939 # the appropriate Makefile.PL.
20940 case " $static_ext " in
20941         *" Encode "*) # Add the subextensions of Encode
20942         cd "$rsrc/ext"
20943         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20944                 static_ext="$static_ext Encode/$xxx"
20945         done
20946         cd "$tdir"
20947         ;;
20948 esac
20949
20950 set X $dynamic_ext $static_ext $nonxs_ext
20951 shift
20952 extensions="$*"
20953
20954 # Sanity check:  We require an extension suitable for use with
20955 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20956 # should show up as failures in the test suite, but it's helpful to
20957 # catch them now.) The 'extensions' list is normally sorted
20958 # alphabetically, so we need to accept either
20959 #    DB_File ... Fcntl ... IO  ....
20960 # or something like
20961 #    Fcntl ... NDBM_File ... IO  ....
20962 case " $extensions"  in
20963 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20964 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20965 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20966 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20967    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20968    ;;
20969 esac
20970
20971 : Remove libraries needed only for extensions
20972 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
20973 : The exception is SunOS 4.x, which needs them.
20974 case "${osname}X${osvers}" in
20975 sunos*X4*)
20976     perllibs="$libs"
20977     ;;
20978 *) case "$usedl" in
20979     $define|true|[yY]*)
20980             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
20981             shift
20982             perllibs="$*"
20983             ;;
20984     *)  perllibs="$libs"
20985             ;;
20986     esac
20987     ;;
20988 esac
20989
20990 : Remove build directory name from cppstdin so it can be used from
20991 : either the present location or the final installed location.
20992 echo " "
20993 : Get out of the UU directory to get correct path name.
20994 cd ..
20995 case "$cppstdin" in
20996 `pwd`/cppstdin)
20997         echo "Stripping down cppstdin path name"
20998         cppstdin=cppstdin
20999         ;;
21000 esac
21001 cd UU
21002
21003 : end of configuration questions
21004 echo " "
21005 echo "End of configuration questions."
21006 echo " "
21007
21008 : back to where it started
21009 if test -d ../UU; then
21010         cd ..
21011 fi
21012
21013 : configuration may be patched via a 'config.arch' file
21014 if $test -f config.arch; then
21015         echo "I see a config.arch file, loading it."
21016         . ./config.arch
21017 fi
21018
21019 : configuration may be patched via a 'config.over' file
21020 if $test -f config.over; then
21021         echo " "
21022         dflt=y
21023         rp='I see a config.over file.  Do you wish to load it?'
21024         . UU/myread
21025         case "$ans" in
21026         n*) echo "OK, I'll ignore it.";;
21027         *)      . ./config.over
21028                 echo "Configuration override changes have been loaded."
21029                 ;;
21030         esac
21031 fi
21032
21033 : in case they want portability, strip down executable paths
21034 case "$d_portable" in
21035 "$define")
21036         echo " "
21037         echo "Stripping down executable paths..." >&4
21038         for file in $loclist $trylist; do
21039                 eval temp=\$$file
21040                 eval $file=`basename $temp`
21041         done
21042         ;;
21043 esac
21044
21045 : create config.sh file
21046 echo " "
21047 echo "Creating config.sh..." >&4
21048 $spitshell <<EOT >config.sh
21049 $startsh
21050 #
21051 # This file was produced by running the Configure script. It holds all the
21052 # definitions figured out by Configure. Should you modify one of these values,
21053 # do not forget to propagate your changes by running "Configure -der". You may
21054 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21055 #
21056
21057 # Package name      : $package
21058 # Source directory  : $src
21059 # Configuration time: $cf_time
21060 # Configured by     : $cf_by
21061 # Target system     : $myuname
21062
21063 Author='$Author'
21064 Date='$Date'
21065 Header='$Header'
21066 Id='$Id'
21067 Locker='$Locker'
21068 Log='$Log'
21069 Mcc='$Mcc'
21070 RCSfile='$RCSfile'
21071 Revision='$Revision'
21072 Source='$Source'
21073 State='$State'
21074 _a='$_a'
21075 _exe='$_exe'
21076 _o='$_o'
21077 afs='$afs'
21078 afsroot='$afsroot'
21079 alignbytes='$alignbytes'
21080 ansi2knr='$ansi2knr'
21081 aphostname='$aphostname'
21082 api_revision='$api_revision'
21083 api_subversion='$api_subversion'
21084 api_version='$api_version'
21085 api_versionstring='$api_versionstring'
21086 ar='$ar'
21087 archlib='$archlib'
21088 archlibexp='$archlibexp'
21089 archname64='$archname64'
21090 archname='$archname'
21091 archobjs='$archobjs'
21092 asctime_r_proto='$asctime_r_proto'
21093 awk='$awk'
21094 baserev='$baserev'
21095 bash='$bash'
21096 bin='$bin'
21097 binexp='$binexp'
21098 bison='$bison'
21099 byacc='$byacc'
21100 byteorder='$byteorder'
21101 c='$c'
21102 castflags='$castflags'
21103 cat='$cat'
21104 cc='$cc'
21105 cccdlflags='$cccdlflags'
21106 ccdlflags='$ccdlflags'
21107 ccflags='$ccflags'
21108 ccflags_uselargefiles='$ccflags_uselargefiles'
21109 ccname='$ccname'
21110 ccsymbols='$ccsymbols'
21111 ccversion='$ccversion'
21112 cf_by='$cf_by'
21113 cf_email='$cf_email'
21114 cf_time='$cf_time'
21115 charsize='$charsize'
21116 chgrp='$chgrp'
21117 chmod='$chmod'
21118 chown='$chown'
21119 clocktype='$clocktype'
21120 comm='$comm'
21121 compress='$compress'
21122 contains='$contains'
21123 cp='$cp'
21124 cpio='$cpio'
21125 cpp='$cpp'
21126 cpp_stuff='$cpp_stuff'
21127 cppccsymbols='$cppccsymbols'
21128 cppflags='$cppflags'
21129 cpplast='$cpplast'
21130 cppminus='$cppminus'
21131 cpprun='$cpprun'
21132 cppstdin='$cppstdin'
21133 cppsymbols='$cppsymbols'
21134 crypt_r_proto='$crypt_r_proto'
21135 cryptlib='$cryptlib'
21136 csh='$csh'
21137 ctermid_r_proto='$ctermid_r_proto'
21138 ctime_r_proto='$ctime_r_proto'
21139 d_Gconvert='$d_Gconvert'
21140 d_PRIEUldbl='$d_PRIEUldbl'
21141 d_PRIFUldbl='$d_PRIFUldbl'
21142 d_PRIGUldbl='$d_PRIGUldbl'
21143 d_PRIXU64='$d_PRIXU64'
21144 d_PRId64='$d_PRId64'
21145 d_PRIeldbl='$d_PRIeldbl'
21146 d_PRIfldbl='$d_PRIfldbl'
21147 d_PRIgldbl='$d_PRIgldbl'
21148 d_PRIi64='$d_PRIi64'
21149 d_PRIo64='$d_PRIo64'
21150 d_PRIu64='$d_PRIu64'
21151 d_PRIx64='$d_PRIx64'
21152 d_SCNfldbl='$d_SCNfldbl'
21153 d__fwalk='$d__fwalk'
21154 d_access='$d_access'
21155 d_accessx='$d_accessx'
21156 d_aintl='$d_aintl'
21157 d_alarm='$d_alarm'
21158 d_archlib='$d_archlib'
21159 d_asctime_r='$d_asctime_r'
21160 d_atolf='$d_atolf'
21161 d_atoll='$d_atoll'
21162 d_attribute_format='$d_attribute_format'
21163 d_attribute_malloc='$d_attribute_malloc'
21164 d_attribute_nonnull='$d_attribute_nonnull'
21165 d_attribute_noreturn='$d_attribute_noreturn'
21166 d_attribute_pure='$d_attribute_pure'
21167 d_attribute_unused='$d_attribute_unused'
21168 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21169 d_bcmp='$d_bcmp'
21170 d_bcopy='$d_bcopy'
21171 d_bsd='$d_bsd'
21172 d_bsdgetpgrp='$d_bsdgetpgrp'
21173 d_bsdsetpgrp='$d_bsdsetpgrp'
21174 d_builtin_choose_expr='$d_builtin_choose_expr'
21175 d_builtin_expect='$d_builtin_expect'
21176 d_bzero='$d_bzero'
21177 d_casti32='$d_casti32'
21178 d_castneg='$d_castneg'
21179 d_charvspr='$d_charvspr'
21180 d_chown='$d_chown'
21181 d_chroot='$d_chroot'
21182 d_chsize='$d_chsize'
21183 d_class='$d_class'
21184 d_clearenv='$d_clearenv'
21185 d_closedir='$d_closedir'
21186 d_cmsghdr_s='$d_cmsghdr_s'
21187 d_const='$d_const'
21188 d_copysignl='$d_copysignl'
21189 d_crypt='$d_crypt'
21190 d_crypt_r='$d_crypt_r'
21191 d_csh='$d_csh'
21192 d_ctermid_r='$d_ctermid_r'
21193 d_ctime_r='$d_ctime_r'
21194 d_cuserid='$d_cuserid'
21195 d_dbl_dig='$d_dbl_dig'
21196 d_dbminitproto='$d_dbminitproto'
21197 d_difftime='$d_difftime'
21198 d_dirfd='$d_dirfd'
21199 d_dirnamlen='$d_dirnamlen'
21200 d_dlerror='$d_dlerror'
21201 d_dlopen='$d_dlopen'
21202 d_dlsymun='$d_dlsymun'
21203 d_dosuid='$d_dosuid'
21204 d_drand48_r='$d_drand48_r'
21205 d_drand48proto='$d_drand48proto'
21206 d_dup2='$d_dup2'
21207 d_eaccess='$d_eaccess'
21208 d_endgrent='$d_endgrent'
21209 d_endgrent_r='$d_endgrent_r'
21210 d_endhent='$d_endhent'
21211 d_endhostent_r='$d_endhostent_r'
21212 d_endnent='$d_endnent'
21213 d_endnetent_r='$d_endnetent_r'
21214 d_endpent='$d_endpent'
21215 d_endprotoent_r='$d_endprotoent_r'
21216 d_endpwent='$d_endpwent'
21217 d_endpwent_r='$d_endpwent_r'
21218 d_endsent='$d_endsent'
21219 d_endservent_r='$d_endservent_r'
21220 d_eofnblk='$d_eofnblk'
21221 d_eunice='$d_eunice'
21222 d_faststdio='$d_faststdio'
21223 d_fchdir='$d_fchdir'
21224 d_fchmod='$d_fchmod'
21225 d_fchown='$d_fchown'
21226 d_fcntl='$d_fcntl'
21227 d_fcntl_can_lock='$d_fcntl_can_lock'
21228 d_fd_macros='$d_fd_macros'
21229 d_fd_set='$d_fd_set'
21230 d_fds_bits='$d_fds_bits'
21231 d_fgetpos='$d_fgetpos'
21232 d_finite='$d_finite'
21233 d_finitel='$d_finitel'
21234 d_flexfnam='$d_flexfnam'
21235 d_flock='$d_flock'
21236 d_flockproto='$d_flockproto'
21237 d_fork='$d_fork'
21238 d_fp_class='$d_fp_class'
21239 d_fpathconf='$d_fpathconf'
21240 d_fpclass='$d_fpclass'
21241 d_fpclassify='$d_fpclassify'
21242 d_fpclassl='$d_fpclassl'
21243 d_fpos64_t='$d_fpos64_t'
21244 d_frexpl='$d_frexpl'
21245 d_fs_data_s='$d_fs_data_s'
21246 d_fseeko='$d_fseeko'
21247 d_fsetpos='$d_fsetpos'
21248 d_fstatfs='$d_fstatfs'
21249 d_fstatvfs='$d_fstatvfs'
21250 d_fsync='$d_fsync'
21251 d_ftello='$d_ftello'
21252 d_ftime='$d_ftime'
21253 d_futimes='$d_futimes'
21254 d_getcwd='$d_getcwd'
21255 d_getespwnam='$d_getespwnam'
21256 d_getfsstat='$d_getfsstat'
21257 d_getgrent='$d_getgrent'
21258 d_getgrent_r='$d_getgrent_r'
21259 d_getgrgid_r='$d_getgrgid_r'
21260 d_getgrnam_r='$d_getgrnam_r'
21261 d_getgrps='$d_getgrps'
21262 d_gethbyaddr='$d_gethbyaddr'
21263 d_gethbyname='$d_gethbyname'
21264 d_gethent='$d_gethent'
21265 d_gethname='$d_gethname'
21266 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21267 d_gethostbyname_r='$d_gethostbyname_r'
21268 d_gethostent_r='$d_gethostent_r'
21269 d_gethostprotos='$d_gethostprotos'
21270 d_getitimer='$d_getitimer'
21271 d_getlogin='$d_getlogin'
21272 d_getlogin_r='$d_getlogin_r'
21273 d_getmnt='$d_getmnt'
21274 d_getmntent='$d_getmntent'
21275 d_getnbyaddr='$d_getnbyaddr'
21276 d_getnbyname='$d_getnbyname'
21277 d_getnent='$d_getnent'
21278 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21279 d_getnetbyname_r='$d_getnetbyname_r'
21280 d_getnetent_r='$d_getnetent_r'
21281 d_getnetprotos='$d_getnetprotos'
21282 d_getpagsz='$d_getpagsz'
21283 d_getpbyname='$d_getpbyname'
21284 d_getpbynumber='$d_getpbynumber'
21285 d_getpent='$d_getpent'
21286 d_getpgid='$d_getpgid'
21287 d_getpgrp2='$d_getpgrp2'
21288 d_getpgrp='$d_getpgrp'
21289 d_getppid='$d_getppid'
21290 d_getprior='$d_getprior'
21291 d_getprotobyname_r='$d_getprotobyname_r'
21292 d_getprotobynumber_r='$d_getprotobynumber_r'
21293 d_getprotoent_r='$d_getprotoent_r'
21294 d_getprotoprotos='$d_getprotoprotos'
21295 d_getprpwnam='$d_getprpwnam'
21296 d_getpwent='$d_getpwent'
21297 d_getpwent_r='$d_getpwent_r'
21298 d_getpwnam_r='$d_getpwnam_r'
21299 d_getpwuid_r='$d_getpwuid_r'
21300 d_getsbyname='$d_getsbyname'
21301 d_getsbyport='$d_getsbyport'
21302 d_getsent='$d_getsent'
21303 d_getservbyname_r='$d_getservbyname_r'
21304 d_getservbyport_r='$d_getservbyport_r'
21305 d_getservent_r='$d_getservent_r'
21306 d_getservprotos='$d_getservprotos'
21307 d_getspnam='$d_getspnam'
21308 d_getspnam_r='$d_getspnam_r'
21309 d_gettimeod='$d_gettimeod'
21310 d_gmtime_r='$d_gmtime_r'
21311 d_gnulibc='$d_gnulibc'
21312 d_grpasswd='$d_grpasswd'
21313 d_hasmntopt='$d_hasmntopt'
21314 d_htonl='$d_htonl'
21315 d_ilogbl='$d_ilogbl'
21316 d_index='$d_index'
21317 d_inetaton='$d_inetaton'
21318 d_int64_t='$d_int64_t'
21319 d_isascii='$d_isascii'
21320 d_isfinite='$d_isfinite'
21321 d_isinf='$d_isinf'
21322 d_isnan='$d_isnan'
21323 d_isnanl='$d_isnanl'
21324 d_killpg='$d_killpg'
21325 d_lchown='$d_lchown'
21326 d_ldbl_dig='$d_ldbl_dig'
21327 d_libm_lib_version='$d_libm_lib_version'
21328 d_link='$d_link'
21329 d_localtime_r='$d_localtime_r'
21330 d_locconv='$d_locconv'
21331 d_lockf='$d_lockf'
21332 d_longdbl='$d_longdbl'
21333 d_longlong='$d_longlong'
21334 d_lseekproto='$d_lseekproto'
21335 d_lstat='$d_lstat'
21336 d_madvise='$d_madvise'
21337 d_malloc_good_size='$d_malloc_good_size'
21338 d_malloc_size='$d_malloc_size'
21339 d_mblen='$d_mblen'
21340 d_mbstowcs='$d_mbstowcs'
21341 d_mbtowc='$d_mbtowc'
21342 d_memchr='$d_memchr'
21343 d_memcmp='$d_memcmp'
21344 d_memcpy='$d_memcpy'
21345 d_memmove='$d_memmove'
21346 d_memset='$d_memset'
21347 d_mkdir='$d_mkdir'
21348 d_mkdtemp='$d_mkdtemp'
21349 d_mkfifo='$d_mkfifo'
21350 d_mkstemp='$d_mkstemp'
21351 d_mkstemps='$d_mkstemps'
21352 d_mktime='$d_mktime'
21353 d_mmap='$d_mmap'
21354 d_modfl='$d_modfl'
21355 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21356 d_modflproto='$d_modflproto'
21357 d_mprotect='$d_mprotect'
21358 d_msg='$d_msg'
21359 d_msg_ctrunc='$d_msg_ctrunc'
21360 d_msg_dontroute='$d_msg_dontroute'
21361 d_msg_oob='$d_msg_oob'
21362 d_msg_peek='$d_msg_peek'
21363 d_msg_proxy='$d_msg_proxy'
21364 d_msgctl='$d_msgctl'
21365 d_msgget='$d_msgget'
21366 d_msghdr_s='$d_msghdr_s'
21367 d_msgrcv='$d_msgrcv'
21368 d_msgsnd='$d_msgsnd'
21369 d_msync='$d_msync'
21370 d_munmap='$d_munmap'
21371 d_mymalloc='$d_mymalloc'
21372 d_nice='$d_nice'
21373 d_nl_langinfo='$d_nl_langinfo'
21374 d_nv_preserves_uv='$d_nv_preserves_uv'
21375 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21376 d_off64_t='$d_off64_t'
21377 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21378 d_oldpthreads='$d_oldpthreads'
21379 d_oldsock='$d_oldsock'
21380 d_open3='$d_open3'
21381 d_pathconf='$d_pathconf'
21382 d_pause='$d_pause'
21383 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21384 d_phostname='$d_phostname'
21385 d_pipe='$d_pipe'
21386 d_poll='$d_poll'
21387 d_portable='$d_portable'
21388 d_procselfexe='$d_procselfexe'
21389 d_pthread_atfork='$d_pthread_atfork'
21390 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21391 d_pthread_yield='$d_pthread_yield'
21392 d_pwage='$d_pwage'
21393 d_pwchange='$d_pwchange'
21394 d_pwclass='$d_pwclass'
21395 d_pwcomment='$d_pwcomment'
21396 d_pwexpire='$d_pwexpire'
21397 d_pwgecos='$d_pwgecos'
21398 d_pwpasswd='$d_pwpasswd'
21399 d_pwquota='$d_pwquota'
21400 d_qgcvt='$d_qgcvt'
21401 d_quad='$d_quad'
21402 d_random_r='$d_random_r'
21403 d_readdir64_r='$d_readdir64_r'
21404 d_readdir='$d_readdir'
21405 d_readdir_r='$d_readdir_r'
21406 d_readlink='$d_readlink'
21407 d_readv='$d_readv'
21408 d_recvmsg='$d_recvmsg'
21409 d_rename='$d_rename'
21410 d_rewinddir='$d_rewinddir'
21411 d_rmdir='$d_rmdir'
21412 d_safebcpy='$d_safebcpy'
21413 d_safemcpy='$d_safemcpy'
21414 d_sanemcmp='$d_sanemcmp'
21415 d_sbrkproto='$d_sbrkproto'
21416 d_scalbnl='$d_scalbnl'
21417 d_sched_yield='$d_sched_yield'
21418 d_scm_rights='$d_scm_rights'
21419 d_seekdir='$d_seekdir'
21420 d_select='$d_select'
21421 d_sem='$d_sem'
21422 d_semctl='$d_semctl'
21423 d_semctl_semid_ds='$d_semctl_semid_ds'
21424 d_semctl_semun='$d_semctl_semun'
21425 d_semget='$d_semget'
21426 d_semop='$d_semop'
21427 d_sendmsg='$d_sendmsg'
21428 d_setegid='$d_setegid'
21429 d_seteuid='$d_seteuid'
21430 d_setgrent='$d_setgrent'
21431 d_setgrent_r='$d_setgrent_r'
21432 d_setgrps='$d_setgrps'
21433 d_sethent='$d_sethent'
21434 d_sethostent_r='$d_sethostent_r'
21435 d_setitimer='$d_setitimer'
21436 d_setlinebuf='$d_setlinebuf'
21437 d_setlocale='$d_setlocale'
21438 d_setlocale_r='$d_setlocale_r'
21439 d_setnent='$d_setnent'
21440 d_setnetent_r='$d_setnetent_r'
21441 d_setpent='$d_setpent'
21442 d_setpgid='$d_setpgid'
21443 d_setpgrp2='$d_setpgrp2'
21444 d_setpgrp='$d_setpgrp'
21445 d_setprior='$d_setprior'
21446 d_setproctitle='$d_setproctitle'
21447 d_setprotoent_r='$d_setprotoent_r'
21448 d_setpwent='$d_setpwent'
21449 d_setpwent_r='$d_setpwent_r'
21450 d_setregid='$d_setregid'
21451 d_setresgid='$d_setresgid'
21452 d_setresuid='$d_setresuid'
21453 d_setreuid='$d_setreuid'
21454 d_setrgid='$d_setrgid'
21455 d_setruid='$d_setruid'
21456 d_setsent='$d_setsent'
21457 d_setservent_r='$d_setservent_r'
21458 d_setsid='$d_setsid'
21459 d_setvbuf='$d_setvbuf'
21460 d_sfio='$d_sfio'
21461 d_shm='$d_shm'
21462 d_shmat='$d_shmat'
21463 d_shmatprototype='$d_shmatprototype'
21464 d_shmctl='$d_shmctl'
21465 d_shmdt='$d_shmdt'
21466 d_shmget='$d_shmget'
21467 d_sigaction='$d_sigaction'
21468 d_sigprocmask='$d_sigprocmask'
21469 d_sigsetjmp='$d_sigsetjmp'
21470 d_snprintf='$d_snprintf'
21471 d_sockatmark='$d_sockatmark'
21472 d_sockatmarkproto='$d_sockatmarkproto'
21473 d_socket='$d_socket'
21474 d_socklen_t='$d_socklen_t'
21475 d_sockpair='$d_sockpair'
21476 d_socks5_init='$d_socks5_init'
21477 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21478 d_sqrtl='$d_sqrtl'
21479 d_srand48_r='$d_srand48_r'
21480 d_srandom_r='$d_srandom_r'
21481 d_sresgproto='$d_sresgproto'
21482 d_sresuproto='$d_sresuproto'
21483 d_statblks='$d_statblks'
21484 d_statfs_f_flags='$d_statfs_f_flags'
21485 d_statfs_s='$d_statfs_s'
21486 d_statvfs='$d_statvfs'
21487 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21488 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21489 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21490 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21491 d_stdio_stream_array='$d_stdio_stream_array'
21492 d_stdiobase='$d_stdiobase'
21493 d_stdstdio='$d_stdstdio'
21494 d_strchr='$d_strchr'
21495 d_strcoll='$d_strcoll'
21496 d_strctcpy='$d_strctcpy'
21497 d_strerrm='$d_strerrm'
21498 d_strerror='$d_strerror'
21499 d_strerror_r='$d_strerror_r'
21500 d_strftime='$d_strftime'
21501 d_strlcat='$d_strlcat'
21502 d_strlcpy='$d_strlcpy'
21503 d_strtod='$d_strtod'
21504 d_strtol='$d_strtol'
21505 d_strtold='$d_strtold'
21506 d_strtoll='$d_strtoll'
21507 d_strtoq='$d_strtoq'
21508 d_strtoul='$d_strtoul'
21509 d_strtoull='$d_strtoull'
21510 d_strtouq='$d_strtouq'
21511 d_strxfrm='$d_strxfrm'
21512 d_suidsafe='$d_suidsafe'
21513 d_symlink='$d_symlink'
21514 d_syscall='$d_syscall'
21515 d_syscallproto='$d_syscallproto'
21516 d_sysconf='$d_sysconf'
21517 d_sysernlst='$d_sysernlst'
21518 d_syserrlst='$d_syserrlst'
21519 d_system='$d_system'
21520 d_tcgetpgrp='$d_tcgetpgrp'
21521 d_tcsetpgrp='$d_tcsetpgrp'
21522 d_telldir='$d_telldir'
21523 d_telldirproto='$d_telldirproto'
21524 d_time='$d_time'
21525 d_times='$d_times'
21526 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21527 d_tm_tm_zone='$d_tm_tm_zone'
21528 d_tmpnam_r='$d_tmpnam_r'
21529 d_truncate='$d_truncate'
21530 d_ttyname_r='$d_ttyname_r'
21531 d_tzname='$d_tzname'
21532 d_u32align='$d_u32align'
21533 d_ualarm='$d_ualarm'
21534 d_umask='$d_umask'
21535 d_uname='$d_uname'
21536 d_union_semun='$d_union_semun'
21537 d_unordered='$d_unordered'
21538 d_unsetenv='$d_unsetenv'
21539 d_usleep='$d_usleep'
21540 d_usleepproto='$d_usleepproto'
21541 d_ustat='$d_ustat'
21542 d_vendorarch='$d_vendorarch'
21543 d_vendorbin='$d_vendorbin'
21544 d_vendorlib='$d_vendorlib'
21545 d_vendorscript='$d_vendorscript'
21546 d_vfork='$d_vfork'
21547 d_void_closedir='$d_void_closedir'
21548 d_voidsig='$d_voidsig'
21549 d_voidtty='$d_voidtty'
21550 d_volatile='$d_volatile'
21551 d_vprintf='$d_vprintf'
21552 d_vsnprintf='$d_vsnprintf'
21553 d_wait4='$d_wait4'
21554 d_waitpid='$d_waitpid'
21555 d_wcstombs='$d_wcstombs'
21556 d_wctomb='$d_wctomb'
21557 d_writev='$d_writev'
21558 d_xenix='$d_xenix'
21559 date='$date'
21560 db_hashtype='$db_hashtype'
21561 db_prefixtype='$db_prefixtype'
21562 db_version_major='$db_version_major'
21563 db_version_minor='$db_version_minor'
21564 db_version_patch='$db_version_patch'
21565 defvoidused='$defvoidused'
21566 direntrytype='$direntrytype'
21567 dlext='$dlext'
21568 dlsrc='$dlsrc'
21569 doublesize='$doublesize'
21570 drand01='$drand01'
21571 drand48_r_proto='$drand48_r_proto'
21572 dynamic_ext='$dynamic_ext'
21573 eagain='$eagain'
21574 ebcdic='$ebcdic'
21575 echo='$echo'
21576 egrep='$egrep'
21577 emacs='$emacs'
21578 endgrent_r_proto='$endgrent_r_proto'
21579 endhostent_r_proto='$endhostent_r_proto'
21580 endnetent_r_proto='$endnetent_r_proto'
21581 endprotoent_r_proto='$endprotoent_r_proto'
21582 endpwent_r_proto='$endpwent_r_proto'
21583 endservent_r_proto='$endservent_r_proto'
21584 eunicefix='$eunicefix'
21585 exe_ext='$exe_ext'
21586 expr='$expr'
21587 extensions='$extensions'
21588 extras='$extras'
21589 fflushNULL='$fflushNULL'
21590 fflushall='$fflushall'
21591 find='$find'
21592 firstmakefile='$firstmakefile'
21593 flex='$flex'
21594 fpossize='$fpossize'
21595 fpostype='$fpostype'
21596 freetype='$freetype'
21597 from='$from'
21598 full_ar='$full_ar'
21599 full_csh='$full_csh'
21600 full_sed='$full_sed'
21601 gccansipedantic='$gccansipedantic'
21602 gccosandvers='$gccosandvers'
21603 gccversion='$gccversion'
21604 getgrent_r_proto='$getgrent_r_proto'
21605 getgrgid_r_proto='$getgrgid_r_proto'
21606 getgrnam_r_proto='$getgrnam_r_proto'
21607 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21608 gethostbyname_r_proto='$gethostbyname_r_proto'
21609 gethostent_r_proto='$gethostent_r_proto'
21610 getlogin_r_proto='$getlogin_r_proto'
21611 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21612 getnetbyname_r_proto='$getnetbyname_r_proto'
21613 getnetent_r_proto='$getnetent_r_proto'
21614 getprotobyname_r_proto='$getprotobyname_r_proto'
21615 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21616 getprotoent_r_proto='$getprotoent_r_proto'
21617 getpwent_r_proto='$getpwent_r_proto'
21618 getpwnam_r_proto='$getpwnam_r_proto'
21619 getpwuid_r_proto='$getpwuid_r_proto'
21620 getservbyname_r_proto='$getservbyname_r_proto'
21621 getservbyport_r_proto='$getservbyport_r_proto'
21622 getservent_r_proto='$getservent_r_proto'
21623 getspnam_r_proto='$getspnam_r_proto'
21624 gidformat='$gidformat'
21625 gidsign='$gidsign'
21626 gidsize='$gidsize'
21627 gidtype='$gidtype'
21628 glibpth='$glibpth'
21629 gmake='$gmake'
21630 gmtime_r_proto='$gmtime_r_proto'
21631 gnulibc_version='$gnulibc_version'
21632 grep='$grep'
21633 groupcat='$groupcat'
21634 groupstype='$groupstype'
21635 gzip='$gzip'
21636 h_fcntl='$h_fcntl'
21637 h_sysfile='$h_sysfile'
21638 hint='$hint'
21639 hostcat='$hostcat'
21640 html1dir='$html1dir'
21641 html1direxp='$html1direxp'
21642 html3dir='$html3dir'
21643 html3direxp='$html3direxp'
21644 i16size='$i16size'
21645 i16type='$i16type'
21646 i32size='$i32size'
21647 i32type='$i32type'
21648 i64size='$i64size'
21649 i64type='$i64type'
21650 i8size='$i8size'
21651 i8type='$i8type'
21652 i_arpainet='$i_arpainet'
21653 i_bsdioctl='$i_bsdioctl'
21654 i_crypt='$i_crypt'
21655 i_db='$i_db'
21656 i_dbm='$i_dbm'
21657 i_dirent='$i_dirent'
21658 i_dld='$i_dld'
21659 i_dlfcn='$i_dlfcn'
21660 i_fcntl='$i_fcntl'
21661 i_float='$i_float'
21662 i_fp='$i_fp'
21663 i_fp_class='$i_fp_class'
21664 i_gdbm='$i_gdbm'
21665 i_grp='$i_grp'
21666 i_ieeefp='$i_ieeefp'
21667 i_inttypes='$i_inttypes'
21668 i_langinfo='$i_langinfo'
21669 i_libutil='$i_libutil'
21670 i_limits='$i_limits'
21671 i_locale='$i_locale'
21672 i_machcthr='$i_machcthr'
21673 i_malloc='$i_malloc'
21674 i_math='$i_math'
21675 i_memory='$i_memory'
21676 i_mntent='$i_mntent'
21677 i_ndbm='$i_ndbm'
21678 i_netdb='$i_netdb'
21679 i_neterrno='$i_neterrno'
21680 i_netinettcp='$i_netinettcp'
21681 i_niin='$i_niin'
21682 i_poll='$i_poll'
21683 i_prot='$i_prot'
21684 i_pthread='$i_pthread'
21685 i_pwd='$i_pwd'
21686 i_rpcsvcdbm='$i_rpcsvcdbm'
21687 i_sfio='$i_sfio'
21688 i_sgtty='$i_sgtty'
21689 i_shadow='$i_shadow'
21690 i_socks='$i_socks'
21691 i_stdarg='$i_stdarg'
21692 i_stddef='$i_stddef'
21693 i_stdlib='$i_stdlib'
21694 i_string='$i_string'
21695 i_sunmath='$i_sunmath'
21696 i_sysaccess='$i_sysaccess'
21697 i_sysdir='$i_sysdir'
21698 i_sysfile='$i_sysfile'
21699 i_sysfilio='$i_sysfilio'
21700 i_sysin='$i_sysin'
21701 i_sysioctl='$i_sysioctl'
21702 i_syslog='$i_syslog'
21703 i_sysmman='$i_sysmman'
21704 i_sysmode='$i_sysmode'
21705 i_sysmount='$i_sysmount'
21706 i_sysndir='$i_sysndir'
21707 i_sysparam='$i_sysparam'
21708 i_sysresrc='$i_sysresrc'
21709 i_syssecrt='$i_syssecrt'
21710 i_sysselct='$i_sysselct'
21711 i_syssockio='$i_syssockio'
21712 i_sysstat='$i_sysstat'
21713 i_sysstatfs='$i_sysstatfs'
21714 i_sysstatvfs='$i_sysstatvfs'
21715 i_systime='$i_systime'
21716 i_systimek='$i_systimek'
21717 i_systimes='$i_systimes'
21718 i_systypes='$i_systypes'
21719 i_sysuio='$i_sysuio'
21720 i_sysun='$i_sysun'
21721 i_sysutsname='$i_sysutsname'
21722 i_sysvfs='$i_sysvfs'
21723 i_syswait='$i_syswait'
21724 i_termio='$i_termio'
21725 i_termios='$i_termios'
21726 i_time='$i_time'
21727 i_unistd='$i_unistd'
21728 i_ustat='$i_ustat'
21729 i_utime='$i_utime'
21730 i_values='$i_values'
21731 i_varargs='$i_varargs'
21732 i_varhdr='$i_varhdr'
21733 i_vfork='$i_vfork'
21734 ignore_versioned_solibs='$ignore_versioned_solibs'
21735 inc_version_list='$inc_version_list'
21736 inc_version_list_init='$inc_version_list_init'
21737 incpath='$incpath'
21738 inews='$inews'
21739 installarchlib='$installarchlib'
21740 installbin='$installbin'
21741 installhtml1dir='$installhtml1dir'
21742 installhtml3dir='$installhtml3dir'
21743 installman1dir='$installman1dir'
21744 installman3dir='$installman3dir'
21745 installprefix='$installprefix'
21746 installprefixexp='$installprefixexp'
21747 installprivlib='$installprivlib'
21748 installscript='$installscript'
21749 installsitearch='$installsitearch'
21750 installsitebin='$installsitebin'
21751 installsitehtml1dir='$installsitehtml1dir'
21752 installsitehtml3dir='$installsitehtml3dir'
21753 installsitelib='$installsitelib'
21754 installsiteman1dir='$installsiteman1dir'
21755 installsiteman3dir='$installsiteman3dir'
21756 installsitescript='$installsitescript'
21757 installstyle='$installstyle'
21758 installusrbinperl='$installusrbinperl'
21759 installvendorarch='$installvendorarch'
21760 installvendorbin='$installvendorbin'
21761 installvendorhtml1dir='$installvendorhtml1dir'
21762 installvendorhtml3dir='$installvendorhtml3dir'
21763 installvendorlib='$installvendorlib'
21764 installvendorman1dir='$installvendorman1dir'
21765 installvendorman3dir='$installvendorman3dir'
21766 installvendorscript='$installvendorscript'
21767 intsize='$intsize'
21768 issymlink='$issymlink'
21769 ivdformat='$ivdformat'
21770 ivsize='$ivsize'
21771 ivtype='$ivtype'
21772 known_extensions='$known_extensions'
21773 ksh='$ksh'
21774 ld='$ld'
21775 lddlflags='$lddlflags'
21776 ldflags='$ldflags'
21777 ldflags_uselargefiles='$ldflags_uselargefiles'
21778 ldlibpthname='$ldlibpthname'
21779 less='$less'
21780 lib_ext='$lib_ext'
21781 libc='$libc'
21782 libperl='$libperl'
21783 libpth='$libpth'
21784 libs='$libs'
21785 libsdirs='$libsdirs'
21786 libsfiles='$libsfiles'
21787 libsfound='$libsfound'
21788 libspath='$libspath'
21789 libswanted='$libswanted'
21790 libswanted_uselargefiles='$libswanted_uselargefiles'
21791 line='$line'
21792 lint='$lint'
21793 lkflags='$lkflags'
21794 ln='$ln'
21795 lns='$lns'
21796 localtime_r_proto='$localtime_r_proto'
21797 locincpth='$locincpth'
21798 loclibpth='$loclibpth'
21799 longdblsize='$longdblsize'
21800 longlongsize='$longlongsize'
21801 longsize='$longsize'
21802 lp='$lp'
21803 lpr='$lpr'
21804 ls='$ls'
21805 lseeksize='$lseeksize'
21806 lseektype='$lseektype'
21807 mad='$mad'
21808 mail='$mail'
21809 mailx='$mailx'
21810 make='$make'
21811 make_set_make='$make_set_make'
21812 mallocobj='$mallocobj'
21813 mallocsrc='$mallocsrc'
21814 madlyh='$madlyh'
21815 madlyobj='$madlyobj'
21816 madlysrc='$madlysrc'
21817 malloctype='$malloctype'
21818 man1dir='$man1dir'
21819 man1direxp='$man1direxp'
21820 man1ext='$man1ext'
21821 man3dir='$man3dir'
21822 man3direxp='$man3direxp'
21823 man3ext='$man3ext'
21824 mips_type='$mips_type'
21825 mistrustnm='$mistrustnm'
21826 mkdir='$mkdir'
21827 mmaptype='$mmaptype'
21828 modetype='$modetype'
21829 more='$more'
21830 multiarch='$multiarch'
21831 mv='$mv'
21832 myarchname='$myarchname'
21833 mydomain='$mydomain'
21834 myhostname='$myhostname'
21835 myuname='$myuname'
21836 n='$n'
21837 need_va_copy='$need_va_copy'
21838 netdb_hlen_type='$netdb_hlen_type'
21839 netdb_host_type='$netdb_host_type'
21840 netdb_name_type='$netdb_name_type'
21841 netdb_net_type='$netdb_net_type'
21842 nm='$nm'
21843 nm_opt='$nm_opt'
21844 nm_so_opt='$nm_so_opt'
21845 nonxs_ext='$nonxs_ext'
21846 nroff='$nroff'
21847 nvEUformat='$nvEUformat'
21848 nvFUformat='$nvFUformat'
21849 nvGUformat='$nvGUformat'
21850 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21851 nveformat='$nveformat'
21852 nvfformat='$nvfformat'
21853 nvgformat='$nvgformat'
21854 nvsize='$nvsize'
21855 nvtype='$nvtype'
21856 o_nonblock='$o_nonblock'
21857 obj_ext='$obj_ext'
21858 old_pthread_create_joinable='$old_pthread_create_joinable'
21859 optimize='$optimize'
21860 orderlib='$orderlib'
21861 osname='$osname'
21862 osvers='$osvers'
21863 otherlibdirs='$otherlibdirs'
21864 package='$package'
21865 pager='$pager'
21866 passcat='$passcat'
21867 patchlevel='$patchlevel'
21868 path_sep='$path_sep'
21869 perl5='$perl5'
21870 perl='$perl'
21871 perl_patchlevel='$perl_patchlevel'
21872 perladmin='$perladmin'
21873 perllibs='$perllibs'
21874 perlpath='$perlpath'
21875 pg='$pg'
21876 phostname='$phostname'
21877 pidtype='$pidtype'
21878 plibpth='$plibpth'
21879 pmake='$pmake'
21880 pr='$pr'
21881 prefix='$prefix'
21882 prefixexp='$prefixexp'
21883 privlib='$privlib'
21884 privlibexp='$privlibexp'
21885 procselfexe='$procselfexe'
21886 prototype='$prototype'
21887 ptrsize='$ptrsize'
21888 quadkind='$quadkind'
21889 quadtype='$quadtype'
21890 randbits='$randbits'
21891 randfunc='$randfunc'
21892 random_r_proto='$random_r_proto'
21893 randseedtype='$randseedtype'
21894 ranlib='$ranlib'
21895 rd_nodata='$rd_nodata'
21896 readdir64_r_proto='$readdir64_r_proto'
21897 readdir_r_proto='$readdir_r_proto'
21898 revision='$revision'
21899 rm='$rm'
21900 rmail='$rmail'
21901 run='$run'
21902 runnm='$runnm'
21903 sPRIEUldbl='$sPRIEUldbl'
21904 sPRIFUldbl='$sPRIFUldbl'
21905 sPRIGUldbl='$sPRIGUldbl'
21906 sPRIXU64='$sPRIXU64'
21907 sPRId64='$sPRId64'
21908 sPRIeldbl='$sPRIeldbl'
21909 sPRIfldbl='$sPRIfldbl'
21910 sPRIgldbl='$sPRIgldbl'
21911 sPRIi64='$sPRIi64'
21912 sPRIo64='$sPRIo64'
21913 sPRIu64='$sPRIu64'
21914 sPRIx64='$sPRIx64'
21915 sSCNfldbl='$sSCNfldbl'
21916 sched_yield='$sched_yield'
21917 scriptdir='$scriptdir'
21918 scriptdirexp='$scriptdirexp'
21919 sed='$sed'
21920 seedfunc='$seedfunc'
21921 selectminbits='$selectminbits'
21922 selecttype='$selecttype'
21923 sendmail='$sendmail'
21924 setgrent_r_proto='$setgrent_r_proto'
21925 sethostent_r_proto='$sethostent_r_proto'
21926 setlocale_r_proto='$setlocale_r_proto'
21927 setnetent_r_proto='$setnetent_r_proto'
21928 setprotoent_r_proto='$setprotoent_r_proto'
21929 setpwent_r_proto='$setpwent_r_proto'
21930 setservent_r_proto='$setservent_r_proto'
21931 sh='$sh'
21932 shar='$shar'
21933 sharpbang='$sharpbang'
21934 shmattype='$shmattype'
21935 shortsize='$shortsize'
21936 shrpenv='$shrpenv'
21937 shsharp='$shsharp'
21938 sig_count='$sig_count'
21939 sig_name='$sig_name'
21940 sig_name_init='$sig_name_init'
21941 sig_num='$sig_num'
21942 sig_num_init='$sig_num_init'
21943 sig_size='$sig_size'
21944 signal_t='$signal_t'
21945 sitearch='$sitearch'
21946 sitearchexp='$sitearchexp'
21947 sitebin='$sitebin'
21948 sitebinexp='$sitebinexp'
21949 sitehtml1dir='$sitehtml1dir'
21950 sitehtml1direxp='$sitehtml1direxp'
21951 sitehtml3dir='$sitehtml3dir'
21952 sitehtml3direxp='$sitehtml3direxp'
21953 sitelib='$sitelib'
21954 sitelib_stem='$sitelib_stem'
21955 sitelibexp='$sitelibexp'
21956 siteman1dir='$siteman1dir'
21957 siteman1direxp='$siteman1direxp'
21958 siteman3dir='$siteman3dir'
21959 siteman3direxp='$siteman3direxp'
21960 siteprefix='$siteprefix'
21961 siteprefixexp='$siteprefixexp'
21962 sitescript='$sitescript'
21963 sitescriptexp='$sitescriptexp'
21964 sizesize='$sizesize'
21965 sizetype='$sizetype'
21966 sleep='$sleep'
21967 smail='$smail'
21968 so='$so'
21969 sockethdr='$sockethdr'
21970 socketlib='$socketlib'
21971 socksizetype='$socksizetype'
21972 sort='$sort'
21973 spackage='$spackage'
21974 spitshell='$spitshell'
21975 srand48_r_proto='$srand48_r_proto'
21976 srandom_r_proto='$srandom_r_proto'
21977 src='$src'
21978 ssizetype='$ssizetype'
21979 startperl='$startperl'
21980 startsh='$startsh'
21981 static_ext='$static_ext'
21982 stdchar='$stdchar'
21983 stdio_base='$stdio_base'
21984 stdio_bufsiz='$stdio_bufsiz'
21985 stdio_cnt='$stdio_cnt'
21986 stdio_filbuf='$stdio_filbuf'
21987 stdio_ptr='$stdio_ptr'
21988 stdio_stream_array='$stdio_stream_array'
21989 strerror_r_proto='$strerror_r_proto'
21990 strings='$strings'
21991 submit='$submit'
21992 subversion='$subversion'
21993 sysman='$sysman'
21994 tail='$tail'
21995 tar='$tar'
21996 targetarch='$targetarch'
21997 tbl='$tbl'
21998 tee='$tee'
21999 test='$test'
22000 timeincl='$timeincl'
22001 timetype='$timetype'
22002 tmpnam_r_proto='$tmpnam_r_proto'
22003 to='$to'
22004 touch='$touch'
22005 tr='$tr'
22006 trnl='$trnl'
22007 troff='$troff'
22008 ttyname_r_proto='$ttyname_r_proto'
22009 u16size='$u16size'
22010 u16type='$u16type'
22011 u32size='$u32size'
22012 u32type='$u32type'
22013 u64size='$u64size'
22014 u64type='$u64type'
22015 u8size='$u8size'
22016 u8type='$u8type'
22017 uidformat='$uidformat'
22018 uidsign='$uidsign'
22019 uidsize='$uidsize'
22020 uidtype='$uidtype'
22021 uname='$uname'
22022 uniq='$uniq'
22023 uquadtype='$uquadtype'
22024 use5005threads='$use5005threads'
22025 use64bitall='$use64bitall'
22026 use64bitint='$use64bitint'
22027 usecrosscompile='$usecrosscompile'
22028 usedl='$usedl'
22029 usefaststdio='$usefaststdio'
22030 useithreads='$useithreads'
22031 uselargefiles='$uselargefiles'
22032 uselongdouble='$uselongdouble'
22033 usemallocwrap='$usemallocwrap'
22034 usemorebits='$usemorebits'
22035 usemultiplicity='$usemultiplicity'
22036 usemymalloc='$usemymalloc'
22037 usenm='$usenm'
22038 useopcode='$useopcode'
22039 useperlio='$useperlio'
22040 useposix='$useposix'
22041 usereentrant='$usereentrant'
22042 userelocatableinc='$userelocatableinc'
22043 usesfio='$usesfio'
22044 useshrplib='$useshrplib'
22045 usesitecustomize='$usesitecustomize'
22046 usesocks='$usesocks'
22047 usethreads='$usethreads'
22048 usevendorprefix='$usevendorprefix'
22049 usevfork='$usevfork'
22050 usrinc='$usrinc'
22051 uuname='$uuname'
22052 uvXUformat='$uvXUformat'
22053 uvoformat='$uvoformat'
22054 uvsize='$uvsize'
22055 uvtype='$uvtype'
22056 uvuformat='$uvuformat'
22057 uvxformat='$uvxformat'
22058 vendorarch='$vendorarch'
22059 vendorarchexp='$vendorarchexp'
22060 vendorbin='$vendorbin'
22061 vendorbinexp='$vendorbinexp'
22062 vendorhtml1dir='$vendorhtml1dir'
22063 vendorhtml1direxp='$vendorhtml1direxp'
22064 vendorhtml3dir='$vendorhtml3dir'
22065 vendorhtml3direxp='$vendorhtml3direxp'
22066 vendorlib='$vendorlib'
22067 vendorlib_stem='$vendorlib_stem'
22068 vendorlibexp='$vendorlibexp'
22069 vendorman1dir='$vendorman1dir'
22070 vendorman1direxp='$vendorman1direxp'
22071 vendorman3dir='$vendorman3dir'
22072 vendorman3direxp='$vendorman3direxp'
22073 vendorprefix='$vendorprefix'
22074 vendorprefixexp='$vendorprefixexp'
22075 vendorscript='$vendorscript'
22076 vendorscriptexp='$vendorscriptexp'
22077 version='$version'
22078 version_patchlevel_string='$version_patchlevel_string'
22079 versiononly='$versiononly'
22080 vi='$vi'
22081 voidflags='$voidflags'
22082 xlibpth='$xlibpth'
22083 yacc='$yacc'
22084 yaccflags='$yaccflags'
22085 zcat='$zcat'
22086 zip='$zip'
22087 EOT
22088
22089 : Add in command line options if available
22090 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22091
22092 : add special variables
22093 $test -f $src/patchlevel.h && \
22094 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22095 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22096 echo "PERL_CONFIG_SH=true" >>config.sh
22097
22098 : propagate old symbols
22099 if $test -f UU/config.sh; then
22100         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22101         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22102         $sort | $uniq -u >UU/oldsyms
22103         set X `cat UU/oldsyms`
22104         shift
22105         case $# in
22106         0) ;;
22107         *)
22108                 cat <<EOM
22109 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22110 EOM
22111                 echo "# Variables propagated from previous config.sh file." >>config.sh
22112                 for sym in `cat UU/oldsyms`; do
22113                         echo "    Propagating $hint variable "'$'"$sym..."
22114                         eval 'tmp="$'"${sym}"'"'
22115                         echo "$tmp" | \
22116                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22117                 done
22118                 ;;
22119         esac
22120 fi
22121
22122 : Finish up by extracting the .SH files
22123 case "$alldone" in
22124 exit)
22125         $rm -rf UU
22126         echo "Extraction done."
22127         exit 0
22128         ;;
22129 cont)
22130         ;;
22131 '')
22132         dflt=''
22133         nostick=true
22134         $cat <<EOM
22135
22136 If you'd like to make any changes to the config.sh file before I begin
22137 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22138
22139 EOM
22140         rp="Press return or use a shell escape to edit config.sh:"
22141         . UU/myread
22142         nostick=''
22143         case "$ans" in
22144         '') ;;
22145         *) : in case they cannot read
22146                 sh 1>&4 -c "$ans";;
22147         esac
22148         ;;
22149 esac
22150
22151 : if this fails, just run all the .SH files by hand
22152 . ./config.sh
22153
22154 echo " "
22155 exec 1>&4
22156 pwd=`pwd`
22157 . ./UU/extract
22158 cd "$pwd"
22159
22160 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22161         dflt=y
22162         case "$silent" in
22163         true) ;;
22164         *)
22165                 $cat <<EOM
22166
22167 Now you need to generate make dependencies by running "$make depend".
22168 You might prefer to run it in background: "$make depend > makedepend.out &"
22169 It can take a while, so you might not want to run it right now.
22170
22171 EOM
22172                 ;;
22173         esac
22174         rp="Run $make depend now?"
22175         . UU/myread
22176         case "$ans" in
22177         y*)
22178                 $make depend && echo "Now you must run '$make'."
22179                 ;;
22180         *)
22181                 echo "You must run '$make depend' then '$make'."
22182                 ;;
22183         esac
22184 elif test -f [Mm]akefile; then
22185         echo " "
22186         echo "Now you must run a $make."
22187 else
22188         echo "Configure done."
22189 fi
22190
22191 if $test -f Policy.sh; then
22192     $cat <<EOM
22193
22194 If you compile $package on a different machine or from a different object
22195 directory, copy the Policy.sh file from this object directory to the
22196 new one before you run Configure -- this will help you with most of
22197 the policy defaults.
22198
22199 EOM
22200 fi
22201 if $test -f config.msg; then
22202     echo "Hmm.  I also noted the following information while running:"
22203     echo " "
22204     $cat config.msg >&4
22205     $rm -f config.msg
22206 fi
22207 $rm -f kit*isdone ark*isdone
22208 $rm -rf UU
22209
22210 : End of Configure
22211