Compress::Raw::Zlib, Compress::Zlib, IO::Compress::Zlib 2.000_10
[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 initialinstalllocation=''
1165 userelocatableinc=''
1166 usesocks=''
1167 d_oldpthreads=''
1168 use5005threads=''
1169 useithreads=''
1170 usereentrant=''
1171 usethreads=''
1172 incpath=''
1173 mips_type=''
1174 usrinc=''
1175 d_vendorarch=''
1176 installvendorarch=''
1177 vendorarch=''
1178 vendorarchexp=''
1179 d_vendorbin=''
1180 installvendorbin=''
1181 vendorbin=''
1182 vendorbinexp=''
1183 installvendorhtml1dir=''
1184 vendorhtml1dir=''
1185 vendorhtml1direxp=''
1186 installvendorhtml3dir=''
1187 vendorhtml3dir=''
1188 vendorhtml3direxp=''
1189 d_vendorlib=''
1190 installvendorlib=''
1191 vendorlib=''
1192 vendorlib_stem=''
1193 vendorlibexp=''
1194 installvendorman1dir=''
1195 vendorman1dir=''
1196 vendorman1direxp=''
1197 installvendorman3dir=''
1198 vendorman3dir=''
1199 vendorman3direxp=''
1200 usevendorprefix=''
1201 vendorprefix=''
1202 vendorprefixexp=''
1203 d_vendorscript=''
1204 installvendorscript=''
1205 vendorscript=''
1206 vendorscriptexp=''
1207 versiononly=''
1208 defvoidused=''
1209 voidflags=''
1210 yacc=''
1211 yaccflags=''
1212 CONFIG=''
1213
1214 define='define'
1215 undef='undef'
1216 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1217 rmlist=''
1218
1219 : We must find out about Eunice early
1220 eunicefix=':'
1221 if test -f /etc/unixtovms; then
1222         eunicefix=/etc/unixtovms
1223 fi
1224 if test -f /etc/unixtovms.exe; then
1225         eunicefix=/etc/unixtovms.exe
1226 fi
1227
1228 : Set executable suffix now -- needed before hints available
1229 if test -f "/libs/version.library"; then
1230 : Amiga OS
1231     _exe=""
1232 elif test -f "/system/gnu_library/bin/ar.pm"; then
1233 : Stratus VOS
1234     _exe=".pm"
1235 elif test -n "$DJGPP"; then
1236 : DOS DJGPP
1237     _exe=".exe"
1238 elif test -d c:/. -o -n "$is_os2" ; then
1239 : OS/2 or cygwin
1240     _exe=".exe"
1241 fi
1242
1243 i_whoami=''
1244 ccname=''
1245 ccversion=''
1246 perllibs=''
1247 : set useposix=false in your hint file to disable the POSIX extension.
1248 useposix=true
1249 : set useopcode=false in your hint file to disable the Opcode extension.
1250 useopcode=true
1251 : Trailing extension.  Override this in a hint file, if needed.
1252 : Extra object files, if any, needed on this platform.
1253 archobjs=''
1254 archname=''
1255 : Possible local include directories to search.
1256 : Set locincpth to "" in a hint file to defeat local include searches.
1257 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1258 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1259 :
1260 : no include file wanted by default
1261 inclwanted=''
1262
1263 groupstype=''
1264 libnames=''
1265 : change the next line if compiling for Xenix/286 on Xenix/386
1266 xlibpth='/usr/lib/386 /lib/386'
1267 : Possible local library directories to search.
1268 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1269 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1270
1271 : general looking path for locating libraries
1272 glibpth="/lib /usr/lib $xlibpth"
1273 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1274 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1275 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1276
1277 : Private path used by Configure to find libraries.  Its value
1278 : is prepended to libpth. This variable takes care of special
1279 : machines, like the mips.  Usually, it should be empty.
1280 plibpth=''
1281
1282 : default library list
1283 libswanted=''
1284 : some systems want to use only the non-versioned libso:s
1285 ignore_versioned_solibs=''
1286 siteman1dir=''
1287 siteman3dir=''
1288 sitescript=''
1289 archname64=''
1290 ccflags_uselargefiles=''
1291 ldflags_uselargefiles=''
1292 libswanted_uselargefiles=''
1293 : set usemultiplicity on the Configure command line to enable multiplicity.
1294 : set usesocks on the Configure command line to enable socks.
1295 : set usethreads on the Configure command line to enable threads.
1296 usereentrant='undef'
1297 : full support for void wanted by default
1298 defvoidused=15
1299
1300 : List of libraries we want.
1301 : If anyone needs extra -lxxx, put those in a hint file.
1302 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1303 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1304 : We probably want to search /usr/shlib before most other libraries.
1305 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1306 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1307 glibpth="/usr/shlib $glibpth"
1308 : Do not use vfork unless overridden by a hint file.
1309 usevfork=false
1310
1311 : Find the basic shell for Bourne shell scripts
1312 case "$sh" in
1313 '')
1314         case "$SYSTYPE" in
1315         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1316         *) xxx='/bin/sh';;
1317         esac
1318         if test -f "$xxx"; then
1319                 sh="$xxx"
1320         else
1321                 : Build up a list and do a single loop so we can 'break' out.
1322                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1323                 for xxx in sh bash ksh pdksh ash; do
1324                         for p in $pth; do
1325                                 try="$try ${p}/${xxx}"
1326                         done
1327                 done
1328                 for xxx in $try; do
1329                         if test -f "$xxx"; then
1330                                 sh="$xxx";
1331                                 break
1332                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1333                                 sh="$xxx";
1334                                 break
1335                         elif test -f "$xxx.exe"; then
1336                                 sh="$xxx";
1337                                 break
1338                         fi
1339                 done
1340         fi
1341         ;;
1342 esac
1343
1344 case "$sh" in
1345 '')     cat >&2 <<EOM
1346 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1347
1348 Usually it's in /bin/sh.  How did you even get this far?
1349 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1350 we'll try to straighten this all out.
1351 EOM
1352         exit 1
1353         ;;
1354 esac
1355
1356 : see if sh knows # comments
1357 if `$sh -c '#' >/dev/null 2>&1`; then
1358         shsharp=true
1359         spitshell=cat
1360         xcat=/bin/cat
1361         test -f $xcat$_exe || xcat=/usr/bin/cat
1362         if test ! -f $xcat$_exe; then
1363                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1364                         if test -f $p/cat$_exe; then
1365                                 xcat=$p/cat
1366                                 break
1367                         fi
1368                 done
1369                 if test ! -f $xcat$_exe; then
1370                         echo "Can't find cat anywhere!"
1371                         exit 1
1372                 fi
1373         fi
1374         echo "#!$xcat" >sharp
1375         $eunicefix sharp
1376         chmod +x sharp
1377         ./sharp > today
1378         if test -s today; then
1379                 sharpbang='#!'
1380         else
1381                 echo "#! $xcat" > sharp
1382                 $eunicefix sharp
1383                 chmod +x sharp
1384                 ./sharp > today
1385                 if test -s today; then
1386                         sharpbang='#! '
1387                 else
1388                         sharpbang=': use '
1389                 fi
1390         fi
1391 else
1392         echo " "
1393         echo "Your $sh doesn't grok # comments--I will strip them later on."
1394         shsharp=false
1395         cd ..
1396         echo "exec grep -v '^[  ]*#'" >spitshell
1397         chmod +x spitshell
1398         $eunicefix spitshell
1399         spitshell=`pwd`/spitshell
1400         cd UU
1401         echo "I presume that if # doesn't work, #! won't work either!"
1402         sharpbang=': use '
1403 fi
1404 rm -f sharp today
1405
1406 : figure out how to guarantee sh startup
1407 case "$startsh" in
1408 '') startsh=${sharpbang}${sh} ;;
1409 *)
1410 esac
1411 cat >sharp <<EOSS
1412 $startsh
1413 set abc
1414 test "$?abc" != 1
1415 EOSS
1416
1417 chmod +x sharp
1418 $eunicefix sharp
1419 if ./sharp; then
1420         : echo "Yup, it does."
1421 else
1422         echo "Hmm... '$startsh' does not guarantee sh startup..."
1423         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1424 fi
1425 rm -f sharp
1426
1427
1428 : Save command line options in file UU/cmdline.opt for later use in
1429 : generating config.sh.
1430 cat > cmdline.opt <<EOSH
1431 # Configure command line arguments.
1432 config_arg0='$0'
1433 config_args='$*'
1434 config_argc=$#
1435 EOSH
1436 argn=1
1437 args_exp=''
1438 args_sep=''
1439 for arg in "$@"; do
1440         cat >>cmdline.opt <<EOSH
1441 config_arg$argn='$arg'
1442 EOSH
1443         # Extreme backslashitis: replace each ' by '"'"'
1444         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1445 $arg
1446 EOC
1447         arg_exp=`cat cmdl.opt`
1448         args_exp="$args_exp$args_sep'$arg_exp'"
1449         argn=`expr $argn + 1`
1450         args_sep=' '
1451 done
1452 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1453 # used by ./hints/os2.sh
1454 rm -f cmdl.opt
1455
1456 : produce awk script to parse command line options
1457 cat >options.awk <<'EOF'
1458 BEGIN {
1459         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1460
1461         len = length(optstr);
1462         for (i = 1; i <= len; i++) {
1463                 c = substr(optstr, i, 1);
1464                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1465                 if (a == ":") {
1466                         arg[c] = 1;
1467                         i++;
1468                 }
1469                 opt[c] = 1;
1470         }
1471 }
1472 {
1473         expect = 0;
1474         str = $0;
1475         if (substr(str, 1, 1) != "-") {
1476                 printf("'%s'\n", str);
1477                 next;
1478         }
1479         len = length($0);
1480         for (i = 2; i <= len; i++) {
1481                 c = substr(str, i, 1);
1482                 if (!opt[c]) {
1483                         printf("-%s\n", substr(str, i));
1484                         next;
1485                 }
1486                 printf("-%s\n", c);
1487                 if (arg[c]) {
1488                         if (i < len)
1489                                 printf("'%s'\n", substr(str, i + 1));
1490                         else
1491                                 expect = 1;
1492                         next;
1493                 }
1494         }
1495 }
1496 END {
1497         if (expect)
1498                 print "?";
1499 }
1500 EOF
1501
1502 : process the command line options
1503 set X `for arg in "$@"; do echo "X$arg"; done |
1504         sed -e s/X// | awk -f options.awk`
1505 eval "set $*"
1506 shift
1507 rm -f options.awk
1508
1509 : set up default values
1510 fastread=''
1511 reuseval=false
1512 config_sh=''
1513 alldone=''
1514 error=''
1515 silent=''
1516 extractsh=''
1517 override=''
1518 knowitall=''
1519 rm -f optdef.sh posthint.sh
1520 cat >optdef.sh <<EOS
1521 $startsh
1522 EOS
1523
1524
1525 : option parsing
1526 while test $# -gt 0; do
1527         case "$1" in
1528         -d) shift; fastread=yes;;
1529         -e) shift; alldone=cont;;
1530         -f)
1531                 shift
1532                 cd ..
1533                 if test -r "$1"; then
1534                         config_sh="$1"
1535                 else
1536                         echo "$me: cannot read config file $1." >&2
1537                         error=true
1538                 fi
1539                 cd UU
1540                 shift;;
1541         -h) shift; error=true;;
1542         -r) shift; reuseval=true;;
1543         -s) shift; silent=true; realsilent=true;;
1544         -E) shift; alldone=exit;;
1545         -K) shift; knowitall=true;;
1546         -O) shift; override=true;;
1547         -S) shift; silent=true; extractsh=true;;
1548         -D)
1549                 shift
1550                 case "$1" in
1551                 *=)
1552                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1553                         echo "$me: ignoring -D $1" >&2
1554                         ;;
1555                 *=*) echo "$1" | \
1556                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1557                 *) echo "$1='define'" >> optdef.sh;;
1558                 esac
1559                 shift
1560                 ;;
1561         -U)
1562                 shift
1563                 case "$1" in
1564                 *=) echo "$1" >> optdef.sh;;
1565                 *=*)
1566                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1567                         echo "$me: ignoring -U $1" >&2
1568                         ;;
1569                 *) echo "$1='undef'" >> optdef.sh;;
1570                 esac
1571                 shift
1572                 ;;
1573         -A)
1574             shift
1575             xxx=''
1576             yyy="$1"
1577             zzz=''
1578             uuu=undef
1579             case "$yyy" in
1580             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1581                  case "$zzz" in
1582                  *:*) zzz='' ;;
1583                  *)   xxx=append
1584                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1585                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1586                  esac
1587                  ;;
1588             esac
1589             case "$xxx" in
1590             '')  case "$yyy" in
1591                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1592                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1593                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1594                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1595                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1596                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1597                  esac
1598                  ;;       
1599             esac
1600             case "$xxx" in
1601             append)
1602                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1603             clear)
1604                 echo "$yyy=''"                  >> posthint.sh ;;
1605             define)
1606                 case "$zzz" in
1607                 '') zzz=define ;;
1608                 esac
1609                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1610             eval)
1611                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1612             prepend)
1613                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1614             undef)
1615                 case "$zzz" in
1616                 '') zzz="$uuu" ;;
1617                 esac
1618                 echo "$yyy=$zzz"                >> posthint.sh ;;
1619             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1620             esac
1621             shift
1622             ;;
1623         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1624             exit 0;;
1625         --) break;;
1626         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1627         *) break;;
1628         esac
1629 done
1630
1631 case "$error" in
1632 true)
1633         cat >&2 <<EOM
1634 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1635                  [-U symbol] [-U symbol=] [-A command:symbol...]
1636   -d : use defaults for all answers.
1637   -e : go on without questioning past the production of config.sh.
1638   -f : specify an alternate default configuration file.
1639   -h : print this help message and exit (with an error status).
1640   -r : reuse C symbols value if possible (skips costly nm extraction).
1641   -s : silent mode, only echoes questions and essential information.
1642   -D : define symbol to have some value:
1643          -D symbol         symbol gets the value 'define'
1644          -D symbol=value   symbol gets the value 'value'
1645   -E : stop at the end of questions, after having produced config.sh.
1646   -K : do not use unless you know what you are doing.
1647   -O : let -D and -U override definitions from loaded configuration file.
1648   -S : perform variable substitutions on all .SH files (can mix with -f)
1649   -U : undefine symbol:
1650          -U symbol    symbol gets the value 'undef'
1651          -U symbol=   symbol gets completely empty
1652   -A : manipulate symbol after the platform specific hints have been applied:
1653          -A symbol=value                append " "value to symbol
1654          -A append:symbol=value         append value to symbol
1655          -A define:symbol=value         define symbol to have value
1656          -A clear:symbol                define symbol to be ''
1657          -A define:symbol               define symbol to be 'define'
1658          -A eval:symbol=value           define symbol to be eval of value
1659          -A prepend:symbol=value        prepend value to symbol
1660          -A undef:symbol                define symbol to be 'undef'
1661          -A undef:symbol=               define symbol to be ''
1662   -V : print version number and exit (with a zero status).
1663 EOM
1664         exit 1
1665         ;;
1666 esac
1667
1668 : Sanity checks
1669 case "$fastread$alldone" in
1670 yescont|yesexit) ;;
1671 *)
1672         case "$extractsh" in
1673         true) ;;
1674         *)
1675                 if test ! -t 0; then
1676                         echo "Say 'sh Configure', not 'sh <Configure'"
1677                         exit 1
1678                 fi
1679                 ;;
1680         esac
1681         ;;
1682 esac
1683
1684 exec 4>&1
1685 case "$silent" in
1686 true) exec 1>/dev/null;;
1687 esac
1688
1689 : run the defines and the undefines, if any, but leave the file out there...
1690 touch optdef.sh
1691 . ./optdef.sh
1692 : create the posthint manipulation script and leave the file out there...
1693 touch posthint.sh
1694
1695 : set package name
1696 package=perl5
1697 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1698 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1699 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1700 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1701 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1702 esac
1703
1704 : Some greps do not return status, grrr.
1705 echo "grimblepritz" >grimble
1706 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1707         contains=contains
1708 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1709         contains=grep
1710 else
1711         contains=contains
1712 fi
1713 rm -f grimble
1714 : the following should work in any shell
1715 case "$contains" in
1716 contains*)
1717         echo " "
1718         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1719         cat >contains <<'EOSS'
1720 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1721 EOSS
1722 chmod +x contains
1723 esac
1724
1725 : Find the path to the source tree
1726 case "$src" in
1727 '') case "$0" in
1728     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1729          case "$src" in
1730          /*)    ;;
1731          .)     ;;
1732          *)     src=`cd ../$src && pwd` ;;
1733          esac
1734          ;;
1735     *)   src='.';;
1736     esac;;
1737 esac
1738 case "$src" in
1739 '')     src=/
1740         rsrc=/
1741         ;;
1742 /*) rsrc="$src";;
1743 *) rsrc="../$src";;
1744 esac
1745 if test -f $rsrc/Configure && \
1746         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1747 then
1748    : found it, so we are ok.
1749 else
1750         rsrc=''
1751         for src in . .. ../.. ../../.. ../../../..; do
1752                 if test -f ../$src/Configure && \
1753                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1754                 then
1755                         rsrc=../$src
1756                         break
1757                 fi
1758         done
1759 fi
1760 case "$rsrc" in
1761 '')
1762         cat <<EOM >&4
1763
1764 Sorry, I can't seem to locate the source dir for $package.  Please start
1765 Configure with an explicit path -- i.e. /some/path/Configure.
1766
1767 EOM
1768         exit 1
1769         ;;
1770 ../.)   rsrc='..';;
1771 *)
1772         echo " "
1773         echo "Sources for $package found in \"$src\"." >&4
1774         ;;
1775 esac
1776
1777 : script used to extract .SH files with variable substitutions
1778 cat >extract <<'EOS'
1779 PERL_CONFIG_SH=true
1780 echo "Doing variable substitutions on .SH files..."
1781 if test -f MANIFEST; then
1782         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1783 else
1784         echo "(Looking for .SH files under the source directory.)"
1785         set x `(cd "$src"; find . -name "*.SH" -print)`
1786 fi
1787 shift
1788 case $# in
1789 0) set x `(cd "$src"; echo *.SH)`; shift;;
1790 esac
1791 if test ! -f "$src/$1"; then
1792         shift
1793 fi
1794 mkdir_p='
1795 name=$1;
1796 create="";
1797 while test $name; do
1798         if test ! -d "$name"; then
1799                 create="$name $create";
1800                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1801                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1802         else
1803                 name="";
1804         fi;
1805 done;
1806 for file in $create; do
1807         mkdir $file;
1808 done
1809 '
1810 for file in $*; do
1811         case "$src" in
1812         ".")
1813                 case "$file" in
1814                 */*)
1815                         dir=`expr X$file : 'X\(.*\)/'`
1816                         file=`expr X$file : 'X.*/\(.*\)'`
1817                         (cd "$dir" && . ./$file)
1818                         ;;
1819                 *)
1820                         . ./$file
1821                         ;;
1822                 esac
1823                 ;;
1824         *)
1825                 case "$file" in
1826                 */*)
1827                         dir=`expr X$file : 'X\(.*\)/'`
1828                         file=`expr X$file : 'X.*/\(.*\)'`
1829                         (set x $dir; shift; eval $mkdir_p)
1830                         sh <"$src/$dir/$file"
1831                         ;;
1832                 *)
1833                         sh <"$src/$file"
1834                         ;;
1835                 esac
1836                 ;;
1837         esac
1838 done
1839 if test -f "$src/config_h.SH"; then
1840         if test ! -f config.h; then
1841         : oops, they left it out of MANIFEST, probably, so do it anyway.
1842         . "$src/config_h.SH"
1843         fi
1844 fi
1845 EOS
1846
1847 : extract files and exit if asked to do so
1848 case "$extractsh" in
1849 true)
1850         case "$realsilent" in
1851         true) ;;
1852         *) exec 1>&4;;
1853         esac
1854         case "$config_sh" in
1855         '') config_sh='config.sh';;
1856         esac
1857         echo " "
1858         echo "Fetching answers from $config_sh..."
1859         cd ..
1860         . $config_sh
1861         test "$override" && . ./optdef.sh
1862         echo " "
1863         . UU/extract
1864         rm -rf UU
1865         echo "Extraction done."
1866         exit 0
1867         ;;
1868 esac
1869
1870 : Eunice requires " " instead of "", can you believe it
1871 echo " "
1872 : Here we go...
1873 echo "Beginning of configuration questions for $package."
1874
1875 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1876
1877 : first determine how to suppress newline on echo command
1878 echo " "
1879 echo "Checking echo to see how to suppress newlines..."
1880 (echo "hi there\c" ; echo " ") >.echotmp
1881 if $contains c .echotmp >/dev/null 2>&1 ; then
1882         echo "...using -n."
1883         n='-n'
1884         c=''
1885 else
1886         cat <<'EOM'
1887 ...using \c
1888 EOM
1889         n=''
1890         c='\c'
1891 fi
1892 echo $n "The star should be here-->$c"
1893 echo '*'
1894 rm -f .echotmp
1895
1896 : Now test for existence of everything in MANIFEST
1897 echo " "
1898 if test -f "$rsrc/MANIFEST"; then
1899         echo "First let's make sure your kit is complete.  Checking..." >&4
1900         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1901         rm -f missing
1902         tmppwd=`pwd`
1903         for filelist in x??; do
1904                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1905         done
1906         if test -s missing; then
1907                 cat missing >&4
1908                 cat >&4 <<'EOM'
1909
1910 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1911
1912 You have the option of continuing the configuration process, despite the
1913 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1914 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1915 and contact the author (perlbug@perl.org).
1916
1917 EOM
1918                 echo $n "Continue? [n] $c" >&4
1919                 read ans
1920                 case "$ans" in
1921                 y*)
1922                         echo "Continuing..." >&4
1923                         rm -f missing
1924                         ;;
1925                 *)
1926                         echo "ABORTING..." >&4
1927                         kill $$
1928                         ;;
1929                 esac
1930         else
1931                 echo "Looks good..."
1932         fi
1933 else
1934         echo "There is no MANIFEST file.  I hope your kit is complete !"
1935 fi
1936 rm -f missing x??
1937
1938 echo " "
1939 : Find the appropriate value for a newline for tr
1940 if test -n "$DJGPP"; then
1941        trnl='\012'
1942 fi
1943 if test X"$trnl" = X; then
1944         case "`echo foo|tr '\n' x 2>/dev/null`" in
1945         foox) trnl='\n' ;;
1946         esac
1947 fi
1948 if test X"$trnl" = X; then
1949         case "`echo foo|tr '\012' x 2>/dev/null`" in
1950         foox) trnl='\012' ;;
1951         esac
1952 fi
1953 if test X"$trnl" = X; then
1954        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1955        fooxy) trnl='\n\r' ;;
1956        esac
1957 fi
1958 if test X"$trnl" = X; then
1959         cat <<EOM >&2
1960
1961 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1962
1963 EOM
1964         exit 1
1965 fi
1966
1967 : compute the number of columns on the terminal for proper question formatting
1968 case "$COLUMNS" in
1969 '') COLUMNS='80';;
1970 esac
1971
1972 : set up the echo used in my read
1973 myecho="case \"\$xxxm\" in
1974 '') echo $n \"\$rp $c\" >&4;;
1975 *) case \"\$rp\" in
1976         '') echo $n \"[\$xxxm] $c\";;
1977         *)
1978                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
1979                         echo \"\$rp\" >&4
1980                         echo $n \"[\$xxxm] $c\" >&4
1981                 else
1982                         echo $n \"\$rp [\$xxxm] $c\" >&4
1983                 fi
1984                 ;;
1985         esac;;
1986 esac"
1987
1988 : now set up to do reads with possible shell escape and default assignment
1989 cat <<EOSC >myread
1990 $startsh
1991 xxxm=\$dflt
1992 $myecho
1993 ans='!'
1994 case "\$fastread" in
1995 yes) case "\$dflt" in
1996         '') ;;
1997         *) ans='';
1998                 case "\$silent-\$rp" in
1999                 true-) ;;
2000                 *) echo " " >&4;;
2001                 esac;;
2002         esac;;
2003 *) case "\$silent" in
2004         true) case "\$rp" in
2005                 '') ans='';;
2006                 esac;;
2007         esac;;
2008 esac
2009 while expr "X\$ans" : "X!" >/dev/null; do
2010         read answ
2011         set x \$xxxm
2012         shift
2013         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2014         case  "\$answ" in
2015         "!")
2016                 sh 1>&4
2017                 echo " "
2018                 $myecho
2019                 ;;
2020         !*)
2021                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2022                 shift
2023                 sh 1>&4 -c "\$*"
2024                 echo " "
2025                 $myecho
2026                 ;;
2027         "\$ans")
2028                 case "\$ans" in
2029                 \\&*)
2030                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2031                         shift
2032                         case "\$1" in
2033                         -d)
2034                                 fastread=yes
2035                                 echo "(OK, I'll run with -d after this question.)" >&4
2036                                 ;;
2037                         -*)
2038                                 echo "*** Sorry, \$1 not supported yet." >&4
2039                                 ;;
2040                         esac
2041                         $myecho
2042                         ans=!
2043                         ;;
2044                 esac;;
2045         *)
2046                 case "\$aok" in
2047                 y)
2048                         echo "*** Substitution done -- please confirm."
2049                         xxxm="\$ans"
2050                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2051                         xxxm="\$ans"
2052                         ans=!
2053                         ;;
2054                 *)
2055                         echo "*** Error -- try again."
2056                         ans=!
2057                         ;;
2058                 esac
2059                 $myecho
2060                 ;;
2061         esac
2062         case "\$ans\$xxxm\$nostick" in
2063         '')
2064                 ans=!
2065                 $myecho
2066                 ;;
2067         esac
2068 done
2069 case "\$ans" in
2070 '') ans="\$xxxm";;
2071 esac
2072 EOSC
2073
2074 : create .config dir to save info across Configure sessions
2075 test -d ../.config || mkdir ../.config
2076 cat >../.config/README <<EOF
2077 This directory created by Configure to save information that should
2078 persist across sessions for $package.
2079
2080 You may safely delete it if you wish.
2081 EOF
2082
2083 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2084 case "$usedevel" in
2085 $define|true|[yY]*) ;;
2086 *) case "$xversion" in
2087    *[13579])
2088         cat >&4 <<EOH
2089 *** WHOA THERE!!! ***
2090
2091     This is an UNSTABLE DEVELOPMENT release.
2092     The version of this $package distribution is $xversion, that is, odd,
2093     (as opposed to even) and that signifies a development release.
2094     If you want a maintenance release, you want an even-numbered version.
2095
2096     Do ***NOT*** install this into production use.
2097     Data corruption and crashes are possible.
2098
2099     It is most seriously suggested that you do not continue any further
2100     unless you want to help in developing and debugging Perl.
2101
2102     If you *still* want to build perl, you can answer 'y' now,
2103     or pass -Dusedevel to Configure.
2104
2105 EOH
2106         rp='Do you really want to continue?'
2107         dflt='n'
2108         . ./myread
2109         case "$ans" in
2110         [yY]) echo >&4 "Okay, continuing."
2111               usedevel="$define" ;;
2112         *) echo >&4 "Okay, bye."
2113            exit 1
2114            ;;
2115         esac
2116         ;;
2117     esac
2118     ;;
2119 esac
2120 case "$usedevel" in
2121 $define|true|[yY]*)
2122         case "$versiononly" in
2123         '') versiononly="$define" ;;
2124         esac
2125         case "$installusrbinperl" in
2126         '') installusrbinperl="$undef" ;;
2127         esac
2128         ;;
2129 esac
2130
2131 : general instructions
2132 needman=true
2133 firsttime=true
2134 user=`(logname) 2>/dev/null`
2135 case "$user" in
2136 '') user=`whoami 2>&1`;;
2137 esac
2138 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2139         firsttime=false
2140         echo " "
2141         rp='Would you like to see the instructions?'
2142         dflt=n
2143         . ./myread
2144         case "$ans" in
2145         [yY]*) ;;
2146         *) needman=false;;
2147         esac
2148 fi
2149 if $needman; then
2150         cat <<EOH
2151
2152 This installation shell script will examine your system and ask you questions
2153 to determine how the perl5 package should be installed. If you get
2154 stuck on a question, you may use a ! shell escape to start a subshell or
2155 execute a command.  Many of the questions will have default answers in square
2156 brackets; typing carriage return will give you the default.
2157
2158 On some of the questions which ask for file or directory names you are allowed
2159 to use the ~name construct to specify the login directory belonging to "name",
2160 even if you don't have a shell which knows about that.  Questions where this is
2161 allowed will be marked "(~name ok)".
2162
2163 EOH
2164         rp=''
2165         dflt='Type carriage return to continue'
2166         . ./myread
2167         cat <<'EOH'
2168
2169 The prompter used in this script allows you to use shell variables and
2170 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2171 in the default answer, as if the default line was a set of arguments given to a
2172 script shell.  This means you may also use $* to repeat the whole default line,
2173 so you do not have to re-type everything to add something to the default.
2174
2175 Everytime there is a substitution, you will have to confirm.  If there is an
2176 error (e.g. an unmatched backtick), the default answer will remain unchanged
2177 and you will be prompted again.
2178
2179 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2180 the questions and use the computed defaults (or the previous answers if there
2181 was already a config.sh file). Type 'Configure -h' for a list of options.
2182 You may also start interactively and then answer '& -d' at any prompt to turn
2183 on the non-interactive behaviour for the remainder of the execution.
2184
2185 EOH
2186         . ./myread
2187         cat <<EOH
2188
2189 Much effort has been expended to ensure that this shell script will run on any
2190 Unix system.  If despite that it blows up on yours, your best bet is to edit
2191 Configure and run it again.  If you can't run Configure for some reason,
2192 you'll have to generate a config.sh file by hand.  Whatever problems you
2193 have, let me (perlbug@perl.org) know how I blew it.
2194
2195 This installation script affects things in two ways:
2196
2197 1) it may do direct variable substitutions on some of the files included
2198    in this kit.
2199 2) it builds a config.h file for inclusion in C programs.  You may edit
2200    any of these files as the need arises after running this script.
2201
2202 If you make a mistake on a question, there is no easy way to back up to it
2203 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2204 files.  Configure will offer to let you do this before it runs the SH files.
2205
2206 EOH
2207         dflt='Type carriage return to continue'
2208         . ./myread
2209         case "$firsttime" in
2210         true) echo $user >>../.config/instruct;;
2211         esac
2212 fi
2213
2214 : find out where common programs are
2215 echo " "
2216 echo "Locating common programs..." >&4
2217 cat <<EOSC >loc
2218 $startsh
2219 case \$# in
2220 0) exit 1;;
2221 esac
2222 thing=\$1
2223 shift
2224 dflt=\$1
2225 shift
2226 for dir in \$*; do
2227         case "\$thing" in
2228         .)
2229         if test -d \$dir/\$thing; then
2230                 echo \$dir
2231                 exit 0
2232         fi
2233         ;;
2234         *)
2235         for thisthing in \$dir/\$thing; do
2236                 : just loop through to pick last item
2237         done
2238         if test -f \$thisthing; then
2239                 echo \$thisthing
2240                 exit 0
2241         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2242                 echo \$thisthing
2243                 exit 0
2244         elif test -f \$dir/\$thing.exe; then
2245                 if test -n "$DJGPP"; then
2246                         echo \$dir/\$thing.exe
2247                 elif test "$eunicefix" != ":"; then
2248                         : on Eunice apparently
2249                         echo \$dir/\$thing
2250                         exit 0
2251                 fi
2252                 exit 0
2253         fi
2254         ;;
2255         esac
2256 done
2257 echo \$dflt
2258 exit 1
2259 EOSC
2260 chmod +x loc
2261 $eunicefix loc
2262 loclist="
2263 awk
2264 cat
2265 chmod
2266 comm
2267 cp
2268 echo
2269 expr
2270 grep
2271 ls
2272 mkdir
2273 rm
2274 sed
2275 sort
2276 touch
2277 tr
2278 uniq
2279 "
2280 trylist="
2281 Mcc
2282 ar
2283 bison
2284 byacc
2285 cpp
2286 csh
2287 date
2288 egrep
2289 gmake
2290 gzip
2291 less
2292 ln
2293 make
2294 more
2295 nm
2296 nroff
2297 pg
2298 test
2299 uname
2300 zip
2301 "
2302 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2303 pth="$pth /lib /usr/lib"
2304 for file in $loclist; do
2305         eval xxx=\$$file
2306         case "$xxx" in
2307         /*|?:[\\/]*)
2308                 if test -f "$xxx"; then
2309                         : ok
2310                 else
2311                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2312                         xxx=`./loc $file $file $pth`
2313                 fi
2314                 ;;
2315         '') xxx=`./loc $file $file $pth`;;
2316         *) xxx=`./loc $xxx $xxx $pth`;;
2317         esac
2318         eval $file=$xxx$_exe
2319         eval _$file=$xxx
2320         case "$xxx" in
2321         /*)
2322                 echo $file is in $xxx.
2323                 ;;
2324         ?:[\\/]*)
2325                 echo $file is in $xxx.
2326                 ;;
2327         *)
2328                 echo "I don't know where '$file' is, and my life depends on it." >&4
2329                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2330                 exit 1
2331                 ;;
2332         esac
2333 done
2334 echo " "
2335 echo "Don't worry if any of the following aren't found..."
2336 say=offhand
2337 for file in $trylist; do
2338         eval xxx=\$$file
2339         case "$xxx" in
2340         /*|?:[\\/]*)
2341                 if test -f "$xxx"; then
2342                         : ok
2343                 else
2344                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2345                         xxx=`./loc $file $file $pth`
2346                 fi
2347                 ;;
2348         '') xxx=`./loc $file $file $pth`;;
2349         *) xxx=`./loc $xxx $xxx $pth`;;
2350         esac
2351         eval $file=$xxx$_exe
2352         eval _$file=$xxx
2353         case "$xxx" in
2354         /*)
2355                 echo $file is in $xxx.
2356                 ;;
2357         ?:[\\/]*)
2358                 echo $file is in $xxx.
2359                 ;;
2360         *)
2361                 echo "I don't see $file out there, $say."
2362                 say=either
2363                 ;;
2364         esac
2365 done
2366 case "$egrep" in
2367 egrep)
2368         echo "Substituting grep for egrep."
2369         egrep=$grep
2370         _egrep=$grep
2371         ;;
2372 esac
2373 case "$ln" in
2374 ln)
2375         echo "Substituting cp for ln."
2376         ln=$cp
2377         _ln=$cp
2378         ;;
2379 esac
2380 case "$make" in
2381 make)   
2382         case "$gmake" in
2383         gmake)
2384         echo "I can't find make or gmake, and my life depends on it." >&4
2385         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2386         exit 1
2387         ;;
2388         esac
2389         ;;
2390 esac    
2391 case "$gmake" in
2392 gmake)  ;;
2393 *)      # We can't have osname yet.
2394         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2395                 # Assume that gmake, if found, is definitely GNU make
2396                 # and prefer it over the system make.
2397                 echo "Substituting gmake for make."
2398                 make=$gmake
2399                 _make=$gmake
2400         fi
2401         ;;
2402 esac
2403 case "$test" in
2404 test)
2405         echo "Hopefully test is built into your sh."
2406         ;;
2407 *)
2408         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2409                 echo "Using the test built into your sh."
2410                 test=test
2411                 _test=test
2412         fi
2413         ;;
2414 esac
2415 case "$echo" in
2416 echo)
2417         echo "Hopefully echo is built into your sh."
2418         ;;
2419 '') ;;
2420 *)
2421         echo " "
2422 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2423         $echo $n "hi there$c" >foo1
2424         echo $n "hi there$c" >foo2
2425         if cmp foo1 foo2 >/dev/null 2>&1; then
2426                 echo "They are compatible.  In fact, they may be identical."
2427         else
2428                 case "$n" in
2429                 '-n') n='' c='\c';;
2430                 *) n='-n' c='';;
2431                 esac
2432                 cat <<FOO
2433 They are not compatible!  You are probably running ksh on a non-USG system.
2434 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2435 have echo built in and we may have to run some Bourne shell scripts.  That
2436 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2437
2438 FOO
2439                 $echo $n "The star should be here-->$c"
2440                 $echo "*"
2441         fi
2442         $rm -f foo1 foo2
2443         ;;
2444 esac
2445
2446 cat <<EOS >trygcc
2447 $startsh
2448 EOS
2449 cat <<'EOSC' >>trygcc
2450 case "$cc" in
2451 '') ;;
2452 *)  $rm -f try try.*
2453     $cat >try.c <<EOM
2454 int main(int argc, char *argv[]) {
2455   return 0;
2456 }
2457 EOM
2458     if $cc -o try $ccflags $ldflags try.c; then
2459        :
2460     else
2461         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2462         despair=yes
2463         trygcc=yes
2464         case "$cc" in
2465         *gcc*) trygcc=no ;;
2466         esac
2467         case "`$cc -v -c try.c 2>&1`" in
2468         *gcc*) trygcc=no ;;
2469         esac
2470         if $test X"$trygcc" = Xyes; then
2471             if gcc -o try -c try.c; then
2472                 echo " "
2473                 echo "You seem to have a working gcc, though." >&4
2474                 rp="Would you like to use it?"
2475                 dflt=y
2476                 if $test -f myread; then
2477                     . ./myread
2478                 else
2479                     if $test -f UU/myread; then
2480                         . ./UU/myread
2481                     else
2482                         echo "Cannot find myread, sorry.  Aborting." >&2
2483                         exit 1
2484                     fi
2485                 fi  
2486                 case "$ans" in
2487                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2488                        if $test -f usethreads.cbu; then
2489                            $cat >&4 <<EOM 
2490
2491 *** However, any setting of the C compiler flags (e.g. for thread support)
2492 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2493 *** (together with e.g. -Dusethreads).
2494
2495 EOM
2496                        fi;;
2497                 esac
2498             fi
2499         fi
2500     fi
2501     $rm -f try try.*
2502     ;;
2503 esac
2504 EOSC
2505
2506 cat <<EOS >checkcc
2507 $startsh
2508 EOS
2509 cat <<'EOSC' >>checkcc
2510 case "$cc" in        
2511 '') ;;
2512 *)  $rm -f try try.*              
2513     $cat >try.c <<EOM
2514 int main(int argc, char *argv[]) {
2515   return 0;
2516 }
2517 EOM
2518     if $cc -o try $ccflags $ldflags try.c; then
2519        :
2520     else
2521         if $test X"$despair" = Xyes; then
2522            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2523         fi
2524         $cat >&4 <<EOM         
2525 You need to find a working C compiler.
2526 Either (purchase and) install the C compiler supplied by your OS vendor,
2527 or for a free C compiler try http://gcc.gnu.org/
2528 I cannot continue any further, aborting.
2529 EOM
2530         exit 1
2531     fi
2532     $rm -f try try.*
2533     ;;
2534 esac
2535 EOSC
2536
2537 : determine whether symbolic links are supported
2538 echo " "
2539 $touch blurfl
2540 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2541         echo "Symbolic links are supported." >&4
2542         lns="$ln -s"
2543 else
2544         echo "Symbolic links are NOT supported." >&4
2545         lns="$ln"
2546 fi
2547 $rm -f blurfl sym
2548
2549 : determine whether symbolic links are supported
2550 echo " "
2551 case "$lns" in
2552 *"ln"*" -s")
2553         echo "Checking how to test for symbolic links..." >&4
2554         $lns blurfl sym
2555         if $test "X$issymlink" = X; then
2556                 case "$newsh" in
2557                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2558                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2559                 esac
2560                 if test $? = 0; then
2561                         issymlink="test -h"
2562                 else
2563                         echo "Your builtin 'test -h' may be broken." >&4
2564                         case "$test" in
2565                         /*)     ;;
2566                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2567                                 for p in $pth
2568                                 do
2569                                         if test -f "$p/$test"; then
2570                                                 test="$p/$test"
2571                                                 break
2572                                         fi
2573                                 done
2574                                 ;;
2575                         esac
2576                         case "$test" in
2577                         /*)
2578                                 echo "Trying external '$test -h'." >&4
2579                                 issymlink="$test -h"
2580                                 if $test ! -h sym >/dev/null 2>&1; then
2581                                         echo "External '$test -h' is broken, too." >&4
2582                                         issymlink=''
2583                                 fi
2584                                 ;;
2585                         *)      issymlink='' ;;
2586                         esac
2587                 fi              
2588         fi
2589         if $test "X$issymlink" = X; then
2590                 if $test -L sym 2>/dev/null; then
2591                         issymlink="$test -L"
2592                         echo "The builtin '$test -L' worked." >&4
2593                 fi
2594         fi
2595         if $test "X$issymlink" != X; then
2596                 echo "You can test for symbolic links with '$issymlink'." >&4
2597         else
2598                 echo "I do not know how you can test for symbolic links." >&4
2599         fi
2600         $rm -f blurfl sym
2601         ;;
2602 *)      echo "No symbolic links, so not testing for their testing..." >&4
2603         ;;
2604 esac
2605 echo " "
2606
2607
2608 case "$mksymlinks" in
2609 $define|true|[yY]*)
2610         case "$src" in
2611         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2612                 exit 1
2613                 ;;
2614         *)      case "$lns:$issymlink" in
2615                 *"ln"*" -s:"*"test -"?)
2616                         echo "Creating the symbolic links..." >&4
2617                         echo "(First creating the subdirectories...)" >&4
2618                         cd ..
2619                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2620                                 read directory
2621                                 test -z "$directory" && break
2622                                 mkdir -p $directory
2623                         done
2624                         # Sanity check 1.
2625                         if test ! -d t/base; then
2626                                 echo "Failed to create the subdirectories.  Aborting." >&4
2627                                 exit 1
2628                         fi
2629                         echo "(Then creating the symlinks...)" >&4
2630                         awk '{print $1}' $src/MANIFEST | while true; do
2631                                 read filename
2632                                 test -z "$filename" && break
2633                                 if test -f $filename; then
2634                                         if $issymlink $filename; then
2635                                                 rm -f $filename
2636                                         fi
2637                                 fi
2638                                 if test -f $filename; then
2639                                         echo "$filename already exists, not symlinking."
2640                                 else
2641                                         ln -s $src/$filename $filename
2642                                 fi
2643                         done
2644                         # Sanity check 2.
2645                         if test ! -f t/base/lex.t; then
2646                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2647                                 exit 1
2648                         fi
2649                         cd UU
2650                         ;;
2651                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2652                         ;;
2653                 esac
2654                 ;;
2655         esac
2656         ;;
2657 esac
2658
2659
2660 case "$usecrosscompile" in
2661 $define|true|[yY]*)
2662         $echo "Cross-compiling..."
2663         croak=''
2664         case "$cc" in
2665         *-*-gcc) # A cross-compiling gcc, probably.
2666             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2667             ar=$targetarch-ar
2668             # leave out ld, choosing it is more complex
2669             nm=$targetarch-nm
2670             ranlib=$targetarch-ranlib
2671             $echo 'extern int foo;' > try.c
2672             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2673             shift
2674             if $test $# -gt 0; then
2675                 incpth="$incpth $*"
2676                 incpth="`$echo $incpth|$sed 's/^ //'`"
2677                 echo "Guessing incpth '$incpth'." >&4
2678                 for i in $*; do
2679                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2680                     if $test -d $j; then
2681                         libpth="$libpth $j"
2682                     fi
2683                 done   
2684                 libpth="`$echo $libpth|$sed 's/^ //'`"
2685                 echo "Guessing libpth '$libpth'." >&4
2686             fi
2687             $rm -f try.c
2688             ;;
2689         esac
2690         case "$targetarch" in
2691         '') echo "Targetarch not defined." >&4; croak=y ;;
2692         *)  echo "Using targetarch $targetarch." >&4 ;;
2693         esac
2694         case "$incpth" in
2695         '') echo "Incpth not defined." >&4; croak=y ;;
2696         *)  echo "Using incpth '$incpth'." >&4 ;;
2697         esac
2698         case "$libpth" in
2699         '') echo "Libpth not defined." >&4; croak=y ;;
2700         *)  echo "Using libpth '$libpth'." >&4 ;;
2701         esac
2702         case "$usrinc" in
2703         '') for i in $incpth; do
2704                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2705                     usrinc=$i
2706                     echo "Guessing usrinc $usrinc." >&4
2707                     break
2708                 fi
2709             done
2710             case "$usrinc" in
2711             '') echo "Usrinc not defined." >&4; croak=y ;;
2712             esac
2713             ;;
2714         *)  echo "Using usrinc $usrinc." >&4 ;;
2715         esac
2716         case "$targethost" in
2717         '') echo "Targethost not defined." >&4; croak=y ;;
2718         *)  echo "Using targethost $targethost." >&4
2719         esac
2720         locincpth=' '
2721         loclibpth=' '
2722         case "$croak" in
2723         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2724         esac
2725         case "$src" in
2726         /*) run=$src/Cross/run
2727             targetmkdir=$src/Cross/mkdir
2728             to=$src/Cross/to
2729             from=$src/Cross/from
2730             ;;
2731         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2732             run=$pwd/Cross/run
2733             targetmkdir=$pwd/Cross/mkdir
2734             to=$pwd/Cross/to
2735             from=$pwd/Cross/from
2736             ;;
2737         esac
2738         case "$targetrun" in
2739         '') targetrun=ssh ;;
2740         esac
2741         case "$targetto" in
2742         '') targetto=scp ;;
2743         esac
2744         case "$targetfrom" in
2745         '') targetfrom=scp ;;
2746         esac
2747         run=$run-$targetrun
2748         to=$to-$targetto
2749         from=$from-$targetfrom
2750         case "$targetdir" in
2751         '')  targetdir=/tmp
2752              echo "Guessing targetdir $targetdir." >&4
2753              ;;
2754         esac
2755         case "$targetuser" in
2756         '')  targetuser=root
2757              echo "Guessing targetuser $targetuser." >&4
2758              ;;
2759         esac
2760         case "$targetfrom" in
2761         scp)    q=-q ;;
2762         *)      q='' ;;
2763         esac
2764         case "$targetrun" in
2765         ssh|rsh)
2766             cat >$run <<EOF
2767 #!/bin/sh
2768 case "\$1" in
2769 -cwd)
2770   shift
2771   cwd=\$1
2772   shift
2773   ;;
2774 esac
2775 case "\$cwd" in
2776 '') cwd=$targetdir ;;
2777 esac
2778 exe=\$1
2779 shift
2780 if $test ! -f \$exe.xok; then
2781   $to \$exe
2782   $touch \$exe.xok
2783 fi
2784 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2785 EOF
2786             ;;
2787         *)  echo "Unknown targetrun '$targetrun'" >&4
2788             exit 1
2789             ;;
2790         esac
2791         case "$targetmkdir" in
2792         */Cross/mkdir)
2793             cat >$targetmkdir <<EOF
2794 #!/bin/sh
2795 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2796 EOF
2797             $chmod a+rx $targetmkdir
2798             ;;
2799         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2800             exit 1
2801             ;;
2802         esac
2803         case "$targetto" in
2804         scp|rcp)
2805             cat >$to <<EOF
2806 #!/bin/sh
2807 for f in \$@
2808 do
2809   case "\$f" in
2810   /*)
2811     $targetmkdir \`dirname \$f\`
2812     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2813     ;;
2814   *)
2815     $targetmkdir $targetdir/\`dirname \$f\`
2816     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2817     ;;
2818   esac
2819 done
2820 exit 0
2821 EOF
2822             ;;
2823         cp) cat >$to <<EOF
2824 #!/bin/sh
2825 for f in \$@
2826 do
2827   case "\$f" in
2828   /*)
2829     $mkdir -p $targetdir/\`dirname \$f\`
2830     $cp \$f $targetdir/\$f || exit 1
2831     ;;
2832   *)
2833     $targetmkdir $targetdir/\`dirname \$f\`
2834     $cp \$f $targetdir/\$f || exit 1
2835     ;;
2836   esac
2837 done
2838 exit 0
2839 EOF
2840             ;;
2841         *)  echo "Unknown targetto '$targetto'" >&4
2842             exit 1
2843             ;;
2844         esac
2845         case "$targetfrom" in
2846         scp|rcp)
2847           cat >$from <<EOF
2848 #!/bin/sh
2849 for f in \$@
2850 do
2851   $rm -f \$f
2852   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2853 done
2854 exit 0
2855 EOF
2856             ;;
2857         cp) cat >$from <<EOF
2858 #!/bin/sh
2859 for f in \$@
2860 do
2861   $rm -f \$f
2862   cp $targetdir/\$f . || exit 1
2863 done
2864 exit 0
2865 EOF
2866             ;;
2867         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2868             exit 1
2869             ;;
2870         esac
2871         if $test ! -f $run; then
2872             echo "Target 'run' script '$run' not found." >&4
2873         else
2874             $chmod a+rx $run
2875         fi
2876         if $test ! -f $to; then
2877             echo "Target 'to' script '$to' not found." >&4
2878         else
2879             $chmod a+rx $to
2880         fi
2881         if $test ! -f $from; then
2882             echo "Target 'from' script '$from' not found." >&4
2883         else
2884             $chmod a+rx $from
2885         fi
2886         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2887             exit 1
2888         fi
2889         cat >&4 <<EOF
2890 Using '$run' for remote execution,
2891 and '$from' and '$to'
2892 for remote file transfer.
2893 EOF
2894         ;;
2895 *)      run=''
2896         to=:
2897         from=:
2898         usecrosscompile='undef'
2899         targetarch=''
2900         ;;
2901 esac
2902
2903 : see whether [:lower:] and [:upper:] are supported character classes
2904 echo " "
2905 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2906 ABYZ)
2907         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2908         up='[:upper:]'
2909         low='[:lower:]'
2910         ;;
2911 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2912         # (0xd9 and 0xe2), therefore that is a nice testing point.
2913         if test "X$up" = X -o "X$low" = X; then
2914             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2915             rs) up='[A-Z]'
2916                 low='[a-z]'
2917                 ;;
2918             esac
2919         fi
2920         if test "X$up" = X -o "X$low" = X; then
2921             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2922             rs) up='A-Z'
2923                 low='a-z'
2924                 ;;
2925             esac
2926         fi
2927         if test "X$up" = X -o "X$low" = X; then
2928             case "`echo RS | od -x 2>/dev/null`" in
2929             *D9E2*|*d9e2*)
2930                 echo "Hey, this might be EBCDIC." >&4
2931                 if test "X$up" = X -o "X$low" = X; then
2932                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2933                     rs) up='[A-IJ-RS-Z]'
2934                         low='[a-ij-rs-z]'
2935                         ;;
2936                     esac
2937                 fi
2938                 if test "X$up" = X -o "X$low" = X; then
2939                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2940                     rs) up='A-IJ-RS-Z'
2941                         low='a-ij-rs-z'
2942                         ;;
2943                     esac
2944                 fi
2945                 ;;
2946             esac
2947         fi
2948 esac
2949 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2950 rs)
2951     echo "Using $up and $low to convert case." >&4
2952     ;;
2953 *)
2954     echo "I don't know how to translate letters from upper to lower case." >&4
2955     echo "Your tr is not acting any way I know of." >&4
2956     exit 1
2957     ;;
2958 esac
2959 : set up the translation script tr, must be called with ./tr of course
2960 cat >tr <<EOSC
2961 $startsh
2962 case "\$1\$2" in
2963 '[A-Z][a-z]') exec $tr '$up' '$low';;
2964 '[a-z][A-Z]') exec $tr '$low' '$up';;
2965 esac
2966 exec $tr "\$@"
2967 EOSC
2968 chmod +x tr
2969 $eunicefix tr
2970
2971 : Try to determine whether config.sh was made on this system
2972 case "$config_sh" in
2973 '')
2974 myuname=`$uname -a 2>/dev/null`
2975 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
2976 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
2977 # because the A-Z/a-z are not consecutive.
2978 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
2979         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
2980 newmyuname="$myuname"
2981 dflt=n
2982 case "$knowitall" in
2983 '')
2984         if test -f ../config.sh; then
2985                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
2986                         eval "`grep myuname= ../config.sh`"
2987                 fi
2988                 if test "X$myuname" = "X$newmyuname"; then
2989                         dflt=y
2990                 fi
2991         fi
2992         ;;
2993 *) dflt=y;;
2994 esac
2995
2996 : Get old answers from old config file if Configure was run on the
2997 : same system, otherwise use the hints.
2998 hint=default
2999 cd ..
3000 if test -f config.sh; then
3001         echo " "
3002         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3003         . UU/myread
3004         case "$ans" in
3005         n*|N*) echo "OK, I'll ignore it."
3006                 mv config.sh config.sh.old
3007                 myuname="$newmyuname"
3008                 ;;
3009         *)  echo "Fetching default answers from your old config.sh file..." >&4
3010                 tmp_n="$n"
3011                 tmp_c="$c"
3012                 tmp_sh="$sh"
3013                 . ./config.sh
3014                 cp config.sh UU
3015                 n="$tmp_n"
3016                 c="$tmp_c"
3017                 : Older versions did not always set $sh.  Catch re-use of such
3018                 : an old config.sh.
3019                 case "$sh" in
3020                 '') sh="$tmp_sh" ;;
3021                 esac
3022                 hint=previous
3023                 ;;
3024         esac
3025 fi
3026 . ./UU/checkcc
3027 if test ! -f config.sh; then
3028         $cat <<EOM
3029
3030 First time through, eh?  I have some defaults handy for some systems
3031 that need some extra help getting the Configure answers right:
3032
3033 EOM
3034         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3035         dflt=''
3036         : Half the following guesses are probably wrong... If you have better
3037         : tests or hints, please send them to perlbug@perl.org
3038         : The metaconfig authors would also appreciate a copy...
3039         $test -f /irix && osname=irix
3040         $test -f /xenix && osname=sco_xenix
3041         $test -f /dynix && osname=dynix
3042         $test -f /dnix && osname=dnix
3043         $test -f /lynx.os && osname=lynxos
3044         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3045         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3046         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3047         $test -f /bin/mips && /bin/mips && osname=mips
3048         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3049                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3050         $test -d /usr/apollo/bin && osname=apollo
3051         $test -f /etc/saf/_sactab && osname=svr4
3052         $test -d /usr/include/minix && osname=minix
3053         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3054         if $test -d /MachTen -o -d /MachTen_Folder; then
3055                 osname=machten
3056                 if $test -x /sbin/version; then
3057                         osvers=`/sbin/version | $awk '{print $2}' |
3058                         $sed -e 's/[A-Za-z]$//'`
3059                 elif $test -x /usr/etc/version; then
3060                         osvers=`/usr/etc/version | $awk '{print $2}' |
3061                         $sed -e 's/[A-Za-z]$//'`
3062                 else
3063                         osvers="$2.$3"
3064                 fi
3065         fi
3066
3067         $test -f /sys/posix.dll &&
3068                 $test -f /usr/bin/what &&
3069                 set X `/usr/bin/what /sys/posix.dll` &&
3070                 $test "$3" = UWIN &&
3071                 osname=uwin &&
3072                 osvers="$5"
3073
3074         if $test -f $uname; then
3075                 set X $myuname
3076                 shift
3077
3078                 case "$5" in
3079                 fps*) osname=fps ;;
3080                 mips*)
3081                         case "$4" in
3082                         umips) osname=umips ;;
3083                         *) osname=mips ;;
3084                         esac;;
3085                 [23]100) osname=mips ;;
3086                 next*) osname=next ;;
3087                 i386*)
3088                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3089                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3090                                 osname='sco'
3091                                 osvers=$tmp
3092                         elif $test -f /etc/kconfig; then
3093                                 osname=isc
3094                                 if test "$lns" = "$ln -s"; then
3095                                         osvers=4
3096                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3097                                         osvers=3
3098                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3099                                         osvers=2
3100                                 fi
3101                         fi
3102                         tmp=''
3103                         ;;
3104                 pc*)
3105                         if test -n "$DJGPP"; then
3106                                 osname=dos
3107                                 osvers=djgpp
3108                         fi
3109                         ;;
3110                 esac
3111
3112                 case "$1" in
3113                 aix) osname=aix
3114                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3115                         case "$tmp" in
3116                         # oslevel can fail with:
3117                         # oslevel: Unable to acquire lock.
3118                         *not\ found) osvers="$4"."$3" ;;
3119                         '<3240'|'<>3240') osvers=3.2.0 ;;
3120                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3121                         '=3250'|'>3250') osvers=3.2.5 ;;
3122                         *) osvers=$tmp;;
3123                         esac
3124                         ;;
3125                 bsd386) osname=bsd386
3126                         osvers=`$uname -r`
3127                         ;;
3128                 cygwin*) osname=cygwin
3129                         osvers="$3"
3130                         ;;
3131                 *dc.osx) osname=dcosx
3132                         osvers="$3"
3133                         ;;
3134                 dnix) osname=dnix
3135                         osvers="$3"
3136                         ;;
3137                 domainos) osname=apollo
3138                         osvers="$3"
3139                         ;;
3140                 dgux)   osname=dgux
3141                         osvers="$3"
3142                         ;;
3143                 dragonfly) osname=dragonfly
3144                         osvers="$3"
3145                         ;;
3146                 dynixptx*) osname=dynixptx
3147                         osvers=`echo "$4"|sed 's/^v//'`
3148                         ;;
3149                 freebsd) osname=freebsd
3150                         osvers="$3" ;;
3151                 genix)  osname=genix ;;
3152                 gnu)    osname=gnu
3153                         osvers="$3" ;;
3154                 hp*)    osname=hpux
3155                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3156                         ;;
3157                 irix*)  osname=irix
3158                         case "$3" in
3159                         4*) osvers=4 ;;
3160                         5*) osvers=5 ;;
3161                         *)      osvers="$3" ;;
3162                         esac
3163                         ;;
3164                 linux)  osname=linux
3165                         case "$3" in
3166                         *)      osvers="$3" ;;
3167                         esac
3168                         ;;
3169                 MiNT)   osname=mint
3170                         ;;
3171                 netbsd*) osname=netbsd
3172                         osvers="$3"
3173                         ;;
3174                 news-os) osvers="$3"
3175                         case "$3" in
3176                         4*) osname=newsos4 ;;
3177                         *) osname=newsos ;;
3178                         esac
3179                         ;;
3180                 next*) osname=next ;;
3181                 nonstop-ux) osname=nonstopux ;;
3182                 openbsd) osname=openbsd
3183                         osvers="$3"
3184                         ;;
3185                 os2)    osname=os2
3186                         osvers="$4"
3187                         ;;
3188                 POSIX-BC | posix-bc ) osname=posix-bc
3189                         osvers="$3"
3190                         ;;
3191                 powerux | power_ux | powermax_os | powermaxos | \
3192                 powerunix | power_unix) osname=powerux
3193                         osvers="$3"
3194                         ;;
3195                 qnx) osname=qnx
3196                         osvers="$4"
3197                         ;;
3198                 solaris) osname=solaris
3199                         case "$3" in
3200                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3201                         *)      osvers="$3" ;;
3202                         esac
3203                         ;;
3204                 sunos) osname=sunos
3205                         case "$3" in
3206                         5*) osname=solaris
3207                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3208                         *)      osvers="$3" ;;
3209                         esac
3210                         ;;
3211                 titanos) osname=titanos
3212                         case "$3" in
3213                         1*) osvers=1 ;;
3214                         2*) osvers=2 ;;
3215                         3*) osvers=3 ;;
3216                         4*) osvers=4 ;;
3217                         *)      osvers="$3" ;;
3218                         esac
3219                         ;;
3220                 ultrix) osname=ultrix
3221                         osvers="$3"
3222                         ;;
3223                 osf1|mls+)      case "$5" in
3224                                 alpha)
3225                                         osname=dec_osf
3226                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3227                                         case "$osvers" in
3228                                         [1-9].[0-9]*) ;;
3229                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3230                                         esac
3231                                         ;;
3232                         hp*)    osname=hp_osf1  ;;
3233                         mips)   osname=mips_osf1 ;;
3234                         esac
3235                         ;;
3236                 # UnixWare 7.1.2 is known as Open UNIX 8
3237                 openunix|unixware) osname=svr5
3238                         osvers="$4"
3239                         ;;
3240                 uts)    osname=uts
3241                         osvers="$3"
3242                         ;;
3243                 vos) osvers="$3"
3244                         ;;
3245                 $2) case "$osname" in
3246                         *isc*) ;;
3247                         *freebsd*) ;;
3248                         svr*)
3249                                 : svr4.x or possibly later
3250                                 case "svr$3" in
3251                                 ${osname}*)
3252                                         osname=svr$3
3253                                         osvers=$4
3254                                         ;;
3255                                 esac
3256                                 case "$osname" in
3257                                 svr4.0)
3258                                         : Check for ESIX
3259                                         if test -f /stand/boot ; then
3260                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3261                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3262                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3263                                                         if test -n "$isesix"; then
3264                                                                 osname=esix4
3265                                                         fi
3266                                                 fi
3267                                         fi
3268                                         ;;
3269                                 esac
3270                                 ;;
3271                         *)      if test -f /etc/systemid; then
3272                                         osname=sco
3273                                         set `echo $3 | $sed 's/\./ /g'` $4
3274                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3275                                                 osvers=$1.$2.$3
3276                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3277                                                 osvers=$1.$2
3278                                         elif $test -f $src/hints/sco_$1.sh; then
3279                                                 osvers=$1
3280                                         fi
3281                                 else
3282                                         case "$osname" in
3283                                         '') : Still unknown.  Probably a generic Sys V.
3284                                                 osname="sysv"
3285                                                 osvers="$3"
3286                                                 ;;
3287                                         esac
3288                                 fi
3289                                 ;;
3290                         esac
3291                         ;;
3292                 *)      case "$osname" in
3293                         '') : Still unknown.  Probably a generic BSD.
3294                                 osname="$1"
3295                                 osvers="$3"
3296                                 ;;
3297                         esac
3298                         ;;
3299                 esac
3300         else
3301                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3302                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3303                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3304                                 osname=news_os
3305                         fi
3306                         $rm -f UU/kernel.what
3307                 elif test -d c:/. -o -n "$is_os2" ; then
3308                         set X $myuname
3309                         osname=os2
3310                         osvers="$5"
3311                 fi
3312         fi
3313
3314         case "$targetarch" in
3315         '') ;;
3316         *)  hostarch=$osname
3317             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3318             osvers=''
3319             ;;
3320         esac
3321
3322         : Now look for a hint file osname_osvers, unless one has been
3323         : specified already.
3324         case "$hintfile" in
3325         ''|' ')
3326                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3327                 : Also try without trailing minor version numbers.
3328                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3329                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3330                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3331                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3332                 case "$file" in
3333                 '') dflt=none ;;
3334                 *)  case "$osvers" in
3335                         '') dflt=$file
3336                                 ;;
3337                         *)  if $test -f $src/hints/$file.sh ; then
3338                                         dflt=$file
3339                                 elif $test -f $src/hints/$xfile.sh ; then
3340                                         dflt=$xfile
3341                                 elif $test -f $src/hints/$xxfile.sh ; then
3342                                         dflt=$xxfile
3343                                 elif $test -f $src/hints/$xxxfile.sh ; then
3344                                         dflt=$xxxfile
3345                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3346                                         dflt=$xxxxfile
3347                                 elif $test -f "$src/hints/${osname}.sh" ; then
3348                                         dflt="${osname}"
3349                                 else
3350                                         dflt=none
3351                                 fi
3352                                 ;;
3353                         esac
3354                         ;;
3355                 esac
3356                 if $test -f Policy.sh ; then
3357                         case "$dflt" in
3358                         *Policy*) ;;
3359                         none) dflt="Policy" ;;
3360                         *) dflt="Policy $dflt" ;;
3361                         esac
3362                 fi
3363                 ;;
3364         *)
3365                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3366                 ;;
3367         esac
3368
3369         if $test -f Policy.sh ; then
3370                 $cat <<EOM
3371
3372 There's also a Policy hint file available, which should make the
3373 site-specific (policy) questions easier to answer.
3374 EOM
3375
3376         fi
3377
3378         $cat <<EOM
3379
3380 You may give one or more space-separated answers, or "none" if appropriate.
3381 A well-behaved OS will have no hints, so answering "none" or just "Policy"
3382 is a good thing.  DO NOT give a wrong version or a wrong OS.
3383
3384 EOM
3385
3386         rp="Which of these apply, if any?"
3387         . UU/myread
3388         tans=$ans
3389         for file in $tans; do
3390                 if $test X$file = XPolicy -a -f Policy.sh; then
3391                         . Policy.sh
3392                         $cat Policy.sh >> UU/config.sh
3393                 elif $test -f $src/hints/$file.sh; then
3394                         . $src/hints/$file.sh
3395                         $cat $src/hints/$file.sh >> UU/config.sh
3396                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3397                         : nothing
3398                 else
3399                         : Give one chance to correct a possible typo.
3400                         echo "$file.sh does not exist"
3401                         dflt=$file
3402                         rp="hint to use instead?"
3403                         . UU/myread
3404                         for file in $ans; do
3405                                 if $test -f "$src/hints/$file.sh"; then
3406                                         . $src/hints/$file.sh
3407                                         $cat $src/hints/$file.sh >> UU/config.sh
3408                                 elif $test X$ans = X -o X$ans = Xnone ; then
3409                                         : nothing
3410                                 else
3411                                         echo "$file.sh does not exist -- ignored."
3412                                 fi
3413                         done
3414                 fi
3415         done
3416
3417         hint=recommended
3418         : Remember our hint file for later.
3419         if $test -f "$src/hints/$file.sh" ; then
3420                 hintfile="$file"
3421         else
3422                 hintfile=''
3423         fi
3424 fi
3425 cd UU
3426 ;;
3427 *)
3428         echo " "
3429         echo "Fetching default answers from $config_sh..." >&4
3430         tmp_n="$n"
3431         tmp_c="$c"
3432         cd ..
3433         cp $config_sh config.sh 2>/dev/null
3434         chmod +w config.sh
3435         . ./config.sh
3436         cd UU
3437         cp ../config.sh .
3438         n="$tmp_n"
3439         c="$tmp_c"
3440         hint=previous
3441         ;;
3442 esac
3443 test "$override" && . ./optdef.sh
3444
3445 : Restore computed paths
3446 for file in $loclist $trylist; do
3447         eval $file="\$_$file"
3448 done
3449
3450 cat << EOM
3451
3452 Configure uses the operating system name and version to set some defaults.
3453 The default value is probably right if the name rings a bell. Otherwise,
3454 since spelling matters for me, either accept the default or answer "none"
3455 to leave it blank.
3456
3457 EOM
3458 case "$osname" in
3459         ''|' ')
3460                 case "$hintfile" in
3461                 ''|' '|none) dflt=none ;;
3462                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3463                 esac
3464                 ;;
3465         *) dflt="$osname" ;;
3466 esac
3467 rp="Operating system name?"
3468 . ./myread
3469 case "$ans" in
3470 none)  osname='' ;;
3471 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3472 esac
3473 echo " "
3474 case "$osvers" in
3475         ''|' ')
3476                 case "$hintfile" in
3477                 ''|' '|none) dflt=none ;;
3478                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3479                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3480                         case "$dflt" in
3481                         ''|' ') dflt=none ;;
3482                         esac
3483                         ;;
3484                 esac
3485                 ;;
3486         *) dflt="$osvers" ;;
3487 esac
3488 rp="Operating system version?"
3489 . ./myread
3490 case "$ans" in
3491 none)  osvers='' ;;
3492 *) osvers="$ans" ;;
3493 esac
3494
3495
3496 . ./posthint.sh
3497
3498 : who configured the system
3499 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3500 case "$cf_by" in
3501 "")
3502         cf_by=`(logname) 2>/dev/null`
3503         case "$cf_by" in
3504         "")
3505                 cf_by=`(whoami) 2>/dev/null`
3506                 case "$cf_by" in
3507                 "") cf_by=unknown ;;
3508                 esac ;;
3509         esac ;;
3510 esac
3511
3512 : set up the script used to warn in case of inconsistency
3513 cat <<EOS >whoa
3514 $startsh
3515 EOS
3516 cat <<'EOSC' >>whoa
3517 dflt=y
3518 echo " "
3519 echo "*** WHOA THERE!!! ***" >&4
3520 echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3521 rp="    Keep the $hint value?"
3522 . ./myread
3523 case "$ans" in
3524 y) td=$was; tu=$was;;
3525 esac
3526 EOSC
3527
3528 : function used to set $1 to $val
3529 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3530 case "$val$was" in
3531 $define$undef) . ./whoa; eval "$var=\$td";;
3532 $undef$define) . ./whoa; eval "$var=\$tu";;
3533 *) eval "$var=$val";;
3534 esac'
3535
3536 case "$usesocks" in
3537 $define|true|[yY]*)     dflt='y';;
3538 *) dflt='n';;
3539 esac
3540 cat <<EOM
3541
3542 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3543 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3544 to use the PerlIO abstraction layer, this will be implicitly selected.
3545
3546 If this doesn't make any sense to you, just accept the default '$dflt'.
3547 EOM
3548 rp='Build Perl for SOCKS?'
3549 . ./myread
3550 case "$ans" in
3551 y|Y)    val="$define" ;;     
3552 *)      val="$undef" ;;
3553 esac
3554 set usesocks
3555 eval $setvar
3556
3557 case "$usesocks" in
3558 $define|true|[yY]*) useperlio="$define";;
3559 esac
3560
3561 case "$useperlio" in
3562 $define|true|[yY]*|'')  dflt='y';;
3563 *) dflt='n';;
3564 esac
3565 cat <<EOM
3566
3567 Previous version of $package used the standard IO mechanisms as
3568 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
3569 alternate IO mechanisms via the PerlIO abstraction layer, but the
3570 stdio mechanism is still available if needed.  The abstraction layer
3571 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
3572 Using PerlIO with sfio may cause problems with some extension modules.
3573
3574 If this doesn't make any sense to you, just accept the default '$dflt'.
3575 EOM
3576 rp='Use the PerlIO abstraction layer?'
3577 . ./myread
3578 case "$ans" in
3579 y|Y) 
3580         val="$define"
3581         ;;
3582 *)      
3583         echo "Ok, doing things the stdio way."
3584         val="$undef"
3585         ;;
3586 esac
3587 set useperlio
3588 eval $setvar 
3589
3590 case "$usesocks" in
3591 $define|true|[yY]*)
3592         case "$useperlio" in
3593         $define|true|[yY]*) ;;
3594         *)      cat >&4 <<EOM
3595
3596 You are using the SOCKS proxy protocol library which means that you
3597 should also use the PerlIO layer.  You may be headed for trouble.
3598
3599 EOM
3600                 ;;
3601         esac
3602         ;;
3603 esac
3604
3605         
3606 case "$usethreads" in
3607 $define|true|[yY]*)     dflt='y';;
3608 *)     # Catch case where user specified ithreads or 5005threads but
3609        # forgot -Dusethreads (A.D. 4/2002)
3610        case "$useithreads$use5005threads" in
3611        *$define*)      
3612                 case "$useperlio" in
3613                 "$define")      dflt='y' ;;
3614                 *)              dflt='n' ;;
3615                 esac
3616                 ;;
3617        *)       dflt='n';;
3618        esac
3619        ;;
3620 esac
3621 cat <<EOM
3622
3623 Perl can be built to take advantage of threads on some systems.
3624 To do so, Configure can be run with -Dusethreads.
3625
3626 Note that Perl built with threading support runs slightly slower
3627 and uses more memory than plain Perl. The current implementation
3628 is believed to be stable, but it is fairly new, and so should be
3629 treated with caution.
3630
3631 If this doesn't make any sense to you, just accept the default '$dflt'.
3632 EOM
3633 rp='Build a threading Perl?'
3634 . ./myread
3635 case "$ans" in
3636 y|Y)    val="$define" ;;
3637 *)      val="$undef" ;;
3638 esac
3639 set usethreads
3640 eval $setvar
3641
3642 case "$usethreads" in
3643 $define)
3644         $cat <<EOM
3645
3646 Since release 5.6, Perl has had two different threading implementations,
3647 the newer interpreter-based version (ithreads) with one interpreter per
3648 thread, and the older 5.005 version (5005threads).
3649 The 5005threads version is effectively unmaintained and will probably be
3650 removed in Perl 5.10, so there should be no need to build a Perl using it
3651 unless needed for backwards compatibility with some existing 5.005threads
3652 code.
3653
3654 EOM
3655         : Default to ithreads unless overridden on command line or with
3656         : old config.sh
3657         dflt='y'
3658         case "$use5005threads" in
3659                 $define|true|[yY]*) dflt='n';;
3660         esac
3661         case "$useithreads" in
3662                 $undef|false|[nN]*) dflt='n';;
3663         esac
3664         rp='Use the newer interpreter-based ithreads?'
3665         . ./myread
3666         case "$ans" in
3667         y|Y)    val="$define" ;;
3668         *)      val="$undef" ;;
3669         esac
3670         set useithreads
3671         eval $setvar
3672         : Now set use5005threads to the opposite value.
3673         case "$useithreads" in
3674         $define) val="$undef" ;;
3675         *) val="$define" ;;
3676         esac
3677         set use5005threads
3678         eval $setvar
3679         ;;
3680 *)
3681         useithreads="$undef"
3682         use5005threads="$undef"
3683         ;;
3684 esac
3685
3686 case "$useithreads$use5005threads" in
3687 "$define$define")
3688         $cat >&4 <<EOM
3689
3690 You cannot have both the ithreads and the 5.005 threads enabled
3691 at the same time.  Disabling the 5.005 threads since they are
3692 much less stable than the ithreads.
3693
3694 EOM
3695         use5005threads="$undef"
3696         ;;
3697 esac
3698
3699 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
3700         cat >&4 <<EOF
3701 ***
3702 *** To build with ithreads you must also use the PerlIO layer.
3703 *** Cannot continue, aborting.
3704 ***
3705 EOF
3706         exit 1
3707 fi
3708
3709 case "$d_oldpthreads" in
3710 '')     : Configure tests would be welcome here.  For now, assume undef.
3711         val="$undef" ;;
3712 *)      val="$d_oldpthreads" ;;
3713 esac
3714 set d_oldpthreads
3715 eval $setvar
3716
3717
3718 : Look for a hint-file generated 'call-back-unit'.  If the
3719 : user has specified that a threading perl is to be built,
3720 : we may need to set or change some other defaults.
3721 if $test -f usethreads.cbu; then
3722     echo "Your platform has some specific hints regarding threaded builds, using them..."
3723     . ./usethreads.cbu
3724 else
3725     case "$usethreads" in
3726         "$define"|true|[yY]*)
3727                 $cat <<EOM
3728 (Your platform does not have any specific hints for threaded builds.
3729  Assuming POSIX threads, then.)
3730 EOM
3731         ;;
3732     esac
3733 fi
3734
3735 cat <<EOM
3736
3737 Perl can be built so that multiple Perl interpreters can coexist
3738 within the same Perl executable.
3739 EOM
3740
3741 case "$useithreads" in
3742 $define)
3743         cat <<EOM
3744 This multiple interpreter support is required for interpreter-based threads.
3745 EOM
3746         val="$define"
3747         ;;
3748 *)      case "$usemultiplicity" in
3749         $define|true|[yY]*)     dflt='y';;
3750         *) dflt='n';;
3751         esac
3752         echo " "
3753         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
3754         rp='Build Perl for multiplicity?'
3755         . ./myread
3756         case "$ans" in
3757         y|Y)    val="$define" ;;
3758         *)      val="$undef" ;;
3759         esac
3760         ;;
3761 esac
3762 set usemultiplicity
3763 eval $setvar
3764
3765
3766 case "$usemorebits" in
3767 "$define"|true|[yY]*)
3768         use64bitint="$define"
3769         uselongdouble="$define"
3770         usemorebits="$define"
3771         ;;
3772 *)      usemorebits="$undef"
3773         ;;
3774 esac
3775
3776 : make some quick guesses about what we are up against
3777 echo " "
3778 $echo $n "Hmm...  $c"
3779 echo exit 1 >bsd
3780 echo exit 1 >usg
3781 echo exit 1 >v7
3782 echo exit 1 >osf1
3783 echo exit 1 >eunice
3784 echo exit 1 >xenix
3785 echo exit 1 >venix
3786 echo exit 1 >os2
3787 d_bsd="$undef"
3788 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
3789 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
3790 then
3791         echo "Looks kind of like an OSF/1 system, but we'll see..."
3792         echo exit 0 >osf1
3793 elif test `echo abc | $tr a-z A-Z` = Abc ; then
3794         xxx=`./loc addbib blurfl $pth`
3795         if $test -f $xxx; then
3796         echo "Looks kind of like a USG system with BSD features, but we'll see..."
3797                 echo exit 0 >bsd
3798                 echo exit 0 >usg
3799         else
3800                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
3801                         echo "Looks kind of like an extended USG system, but we'll see..."
3802                 else
3803                         echo "Looks kind of like a USG system, but we'll see..."
3804                 fi
3805                 echo exit 0 >usg
3806         fi
3807 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
3808         echo "Looks kind of like a BSD system, but we'll see..."
3809         d_bsd="$define"
3810         echo exit 0 >bsd
3811 else
3812         echo "Looks kind of like a Version 7 system, but we'll see..."
3813         echo exit 0 >v7
3814 fi
3815 case "$eunicefix" in
3816 *unixtovms*)
3817         $cat <<'EOI'
3818 There is, however, a strange, musty smell in the air that reminds me of
3819 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
3820 EOI
3821         echo exit 0 >eunice
3822         d_eunice="$define"
3823 : it so happens the Eunice I know will not run shell scripts in Unix format
3824         ;;
3825 *)
3826         echo " "
3827         echo "Congratulations.  You aren't running Eunice."
3828         d_eunice="$undef"
3829         ;;
3830 esac
3831 : Detect OS2.  The p_ variable is set above in the Head.U unit.
3832 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
3833 : semicolon as a patch separator
3834 case "$p_" in
3835 :) ;;
3836 *)
3837         $cat <<'EOI'
3838 I have the feeling something is not exactly right, however...don't tell me...
3839 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
3840 (Or you may be running DOS with DJGPP.)
3841 EOI
3842         echo exit 0 >os2
3843         ;;
3844 esac
3845 if test -f /xenix; then
3846         echo "Actually, this looks more like a XENIX system..."
3847         echo exit 0 >xenix
3848         d_xenix="$define"
3849 else
3850         echo " "
3851         echo "It's not Xenix..."
3852         d_xenix="$undef"
3853 fi
3854 chmod +x xenix
3855 $eunicefix xenix
3856 if test -f /venix; then
3857         echo "Actually, this looks more like a VENIX system..."
3858         echo exit 0 >venix
3859 else
3860         echo " "
3861         if ./xenix; then
3862                 : null
3863         else
3864                 echo "Nor is it Venix..."
3865         fi
3866 fi
3867 chmod +x bsd usg v7 osf1 eunice xenix venix os2
3868 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
3869 $rm -f foo
3870
3871 case "$cc" in
3872 '') dflt=cc;;
3873 *) dflt="$cc";;
3874 esac
3875 rp="Use which C compiler?"
3876 . ./myread
3877 cc="$ans"
3878
3879 : See if they have not cc but they do have gcc
3880 . ./trygcc
3881 : Look for a hint-file generated 'call-back-unit'.  Now that the
3882 : user has specified the compiler, we may need to set or change some
3883 : other defaults.
3884 if $test -f cc.cbu; then
3885     . ./cc.cbu
3886 fi
3887 . ./checkcc
3888
3889 echo " "
3890 echo "Checking for GNU cc in disguise and/or its version number..." >&4
3891 $cat >try.c <<EOM
3892 #include <stdio.h>
3893 int main() {
3894 #ifdef __GNUC__
3895 #ifdef __VERSION__
3896         printf("%s\n", __VERSION__);
3897 #else
3898         printf("%s\n", "1");
3899 #endif
3900 #endif
3901         return(0);
3902 }
3903 EOM
3904 if $cc -o try $ccflags $ldflags try.c; then
3905         gccversion=`$run ./try`
3906         case "$gccversion" in
3907         '') echo "You are not using GNU cc." ;;
3908         *)  echo "You are using GNU cc $gccversion."
3909             ccname=gcc
3910             ;;
3911         esac
3912 else
3913         echo " "
3914         echo "*** WHOA THERE!!! ***" >&4
3915         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
3916         case "$knowitall" in
3917         '')
3918         echo "    You'd better start hunting for one and let me know about it." >&4
3919                 exit 1
3920                 ;;
3921         esac
3922 fi
3923 $rm -f try try.*
3924 case "$gccversion" in
3925 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
3926 esac
3927 case "$gccversion" in
3928 '') gccosandvers='' ;;
3929 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
3930    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
3931    gccshortvers=''
3932    case "$gccosandvers" in
3933    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
3934    $osname$osvers) ;; # looking good
3935    $osname*) cat <<EOM >&4
3936
3937 *** WHOA THERE!!! ***
3938
3939     Your gcc has not been compiled for the exact release of
3940     your operating system ($gccosandvers versus $osname$osvers).
3941
3942     In general it is a good idea to keep gcc synchronized with
3943     the operating system because otherwise serious problems
3944     may ensue when trying to compile software, like Perl.
3945
3946     I'm trying to be optimistic here, though, and will continue.
3947     If later during the configuration and build icky compilation
3948     problems appear (headerfile conflicts being the most common
3949     manifestation), I suggest reinstalling the gcc to match
3950     your operating system release.
3951
3952 EOM
3953       ;;
3954    *) gccosandvers='' ;; # failed to parse, better be silent
3955    esac
3956    ;;
3957 esac
3958 case "$ccname" in
3959 '') ccname="$cc" ;;
3960 esac
3961
3962 # gcc 3.* complain about adding -Idirectories that they already know about,
3963 # so we will take those off from locincpth.
3964 case "$gccversion" in
3965 3*)
3966     echo "main(){}">try.c
3967     for incdir in $locincpth; do
3968        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
3969              grep '^c[cp]p*[01]: warning: changing search order '`
3970        if test "X$warn" != X; then
3971            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
3972        fi
3973     done
3974     $rm -f try try.*
3975 esac
3976
3977 : decide how portable to be.  Allow command line overrides.
3978 case "$d_portable" in
3979 "$undef") ;;
3980 *)      d_portable="$define" ;;
3981 esac
3982
3983 : set up shell script to do ~ expansion
3984 cat >filexp <<EOSS
3985 $startsh
3986 : expand filename
3987 case "\$1" in
3988  ~/*|~)
3989         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3990         ;;
3991  ~*)
3992         if $test -f /bin/csh; then
3993                 /bin/csh -f -c "glob \$1"
3994                 failed=\$?
3995                 echo ""
3996                 exit \$failed
3997         else
3998                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3999                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
4000                 if $test ! -d "\$dir"; then
4001                         me=\`basename \$0\`
4002                         echo "\$me: can't locate home directory for: \$name" >&2
4003                         exit 1
4004                 fi
4005                 case "\$1" in
4006                 */*)
4007                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
4008                         ;;
4009                 *)
4010                         echo \$dir
4011                         ;;
4012                 esac
4013         fi
4014         ;;
4015 *)
4016         echo \$1
4017         ;;
4018 esac
4019 EOSS
4020 chmod +x filexp
4021 $eunicefix filexp
4022
4023 : now set up to get a file name
4024 cat <<EOS >getfile
4025 $startsh
4026 EOS
4027 cat <<'EOSC' >>getfile
4028 tilde=''
4029 fullpath=''
4030 already=''
4031 skip=''
4032 none_ok=''
4033 exp_file=''
4034 nopath_ok=''
4035 orig_rp="$rp"
4036 orig_dflt="$dflt"
4037 case "$gfpth" in
4038 '') gfpth='.' ;;
4039 esac
4040
4041 case "$fn" in
4042 *\(*)
4043         : getfile will accept an answer from the comma-separated list
4044         : enclosed in parentheses even if it does not meet other criteria.
4045         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
4046         fn=`echo $fn | sed 's/(.*)//'`
4047         ;;
4048 esac
4049
4050 case "$fn" in
4051 *:*)
4052         loc_file=`expr $fn : '.*:\(.*\)'`
4053         fn=`expr $fn : '\(.*\):.*'`
4054         ;;
4055 esac
4056
4057 case "$fn" in
4058 *~*) tilde=true;;
4059 esac
4060 case "$fn" in
4061 */*) fullpath=true;;
4062 esac
4063 case "$fn" in
4064 *+*) skip=true;;
4065 esac
4066 case "$fn" in
4067 *n*) none_ok=true;;
4068 esac
4069 case "$fn" in
4070 *e*) exp_file=true;;
4071 esac
4072 case "$fn" in
4073 *p*) nopath_ok=true;;
4074 esac
4075
4076 case "$fn" in
4077 *f*) type='File';;
4078 *d*) type='Directory';;
4079 *l*) type='Locate';;
4080 esac
4081
4082 what="$type"
4083 case "$what" in
4084 Locate) what='File';;
4085 esac
4086
4087 case "$exp_file" in
4088 '')
4089         case "$d_portable" in
4090         "$define") ;;
4091         *) exp_file=true;;
4092         esac
4093         ;;
4094 esac
4095
4096 cd ..
4097 while test "$type"; do
4098         redo=''
4099         rp="$orig_rp"
4100         dflt="$orig_dflt"
4101         case "$tilde" in
4102         true) rp="$rp (~name ok)";;
4103         esac
4104         . UU/myread
4105         if test -f UU/getfile.ok && \
4106                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
4107         then
4108                 value="$ans"
4109                 ansexp="$ans"
4110                 break
4111         fi
4112         case "$ans" in
4113         none)
4114                 value=''
4115                 ansexp=''
4116                 case "$none_ok" in
4117                 true) type='';;
4118                 esac
4119                 ;;
4120         *)
4121                 case "$tilde" in
4122                 '') value="$ans"
4123                         ansexp="$ans";;
4124                 *)
4125                         value=`UU/filexp $ans`
4126                         case $? in
4127                         0)
4128                                 if test "$ans" != "$value"; then
4129                                         echo "(That expands to $value on this system.)"
4130                                 fi
4131                                 ;;
4132                         *) value="$ans";;
4133                         esac
4134                         ansexp="$value"
4135                         case "$exp_file" in
4136                         '') value="$ans";;
4137                         esac
4138                         ;;
4139                 esac
4140                 case "$fullpath" in
4141                 true)
4142                         case "$ansexp" in
4143                         /*) value="$ansexp" ;;
4144                         [a-zA-Z]:/*) value="$ansexp" ;;
4145                         *)
4146                                 redo=true
4147                                 case "$already" in
4148                                 true)
4149                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
4150                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
4151                                         ;;
4152                                 *)
4153                                 echo "Please give a full path name, starting with slash." >&4
4154                                         case "$tilde" in
4155                                         true)
4156                                 echo "Note that using ~name is ok provided it expands well." >&4
4157                                                 already=true
4158                                                 ;;
4159                                         esac
4160                                 esac
4161                                 ;;
4162                         esac
4163                         ;;
4164                 esac
4165                 case "$redo" in
4166                 '')
4167                         case "$type" in
4168                         File)
4169                                 for fp in $gfpth; do
4170                                         if test "X$fp" = X.; then
4171                                             pf="$ansexp"
4172                                         else    
4173                                             pf="$fp/$ansexp"
4174                                         fi
4175                                         if test -f "$pf"; then
4176                                                 type=''
4177                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
4178                                         then
4179                                                 echo "($value is not a plain file, but that's ok.)"
4180                                                 type=''
4181                                         fi
4182                                         if test X"$type" = X; then
4183                                             value="$pf"
4184                                             break
4185                                         fi
4186                                 done
4187                                 ;;
4188                         Directory)
4189                                 for fp in $gfpth; do
4190                                         if test "X$fp" = X.; then
4191                                             dir="$ans"
4192                                             direxp="$ansexp"
4193                                         else    
4194                                             dir="$fp/$ansexp"
4195                                             direxp="$fp/$ansexp"
4196                                         fi
4197                                         if test -d "$direxp"; then
4198                                                 type=''
4199                                                 value="$dir"
4200                                                 break
4201                                         fi
4202                                 done
4203                                 ;;
4204                         Locate)
4205                                 if test -d "$ansexp"; then
4206                                         echo "(Looking for $loc_file in directory $value.)"
4207                                         value="$value/$loc_file"
4208                                         ansexp="$ansexp/$loc_file"
4209                                 fi
4210                                 if test -f "$ansexp"; then
4211                                         type=''
4212                                 fi
4213                                 case "$nopath_ok" in
4214                                 true)   case "$value" in
4215                                         */*) ;;
4216                                         *)      echo "Assuming $value will be in people's path."
4217                                                 type=''
4218                                                 ;;
4219                                         esac
4220                                         ;;
4221                                 esac
4222                                 ;;
4223                         esac
4224
4225                         case "$skip" in
4226                         true) type='';
4227                         esac
4228
4229                         case "$type" in
4230                         '') ;;
4231                         *)
4232                                 if test "$fastread" = yes; then
4233                                         dflt=y
4234                                 else
4235                                         dflt=n
4236                                 fi
4237                                 rp="$what $value doesn't exist.  Use that name anyway?"
4238                                 . UU/myread
4239                                 dflt=''
4240                                 case "$ans" in
4241                                 y*) type='';;
4242                                 *) echo " ";;
4243                                 esac
4244                                 ;;
4245                         esac
4246                         ;;
4247                 esac
4248                 ;;
4249         esac
4250 done
4251 cd UU
4252 ans="$value"
4253 rp="$orig_rp"
4254 dflt="$orig_dflt"
4255 rm -f getfile.ok
4256 test "X$gfpthkeep" != Xy && gfpth=""
4257 EOSC
4258
4259 : What should the include directory be ?
4260 echo " "
4261 $echo $n "Hmm...  $c"
4262 dflt='/usr/include'
4263 incpath=''
4264 mips_type=''
4265 if $test -f /bin/mips && /bin/mips; then
4266         echo "Looks like a MIPS system..."
4267         $cat >usr.c <<'EOCP'
4268 #ifdef SYSTYPE_BSD43
4269 /bsd43
4270 #endif
4271 EOCP
4272         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4273                 dflt='/bsd43/usr/include'
4274                 incpath='/bsd43'
4275                 mips_type='BSD 4.3'
4276         else
4277                 mips_type='System V'
4278         fi
4279         $rm -f usr.c usr.out
4280         echo "and you're compiling with the $mips_type compiler and libraries."
4281         xxx_prompt=y
4282         echo "exit 0" >mips
4283 else
4284         echo "Doesn't look like a MIPS system."
4285         xxx_prompt=n
4286         echo "exit 1" >mips
4287 fi
4288 chmod +x mips
4289 $eunicefix mips
4290 case "$usrinc" in
4291 '') ;;
4292 *) dflt="$usrinc";;
4293 esac
4294 case "$xxx_prompt" in
4295 y)      fn=d/
4296         echo " "
4297         rp='Where are the include files you want to use?'
4298         . ./getfile
4299         usrinc="$ans"
4300         ;;
4301 *)      usrinc="$dflt"
4302         ;;
4303 esac
4304
4305 : see how we invoke the C preprocessor
4306 echo " "
4307 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4308 cat <<'EOT' >testcpp.c
4309 #define ABC abc
4310 #define XYZ xyz
4311 ABC.XYZ
4312 EOT
4313 cd ..
4314 if test ! -f cppstdin; then
4315         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4316                 # AIX cc -E doesn't show the absolute headerfile
4317                 # locations but we'll cheat by using the -M flag.
4318                 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
4319         else
4320                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4321         fi
4322 else
4323         echo "Keeping your $hint cppstdin wrapper."
4324 fi
4325 chmod 755 cppstdin
4326 wrapper=`pwd`/cppstdin
4327 ok='false'
4328 cd UU
4329
4330 if $test "X$cppstdin" != "X" && \
4331         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4332         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4333 then
4334         echo "You used to use $cppstdin $cppminus so we'll use that again."
4335         case "$cpprun" in
4336         '') echo "But let's see if we can live without a wrapper..." ;;
4337         *)
4338                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4339                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4340                 then
4341                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4342                         ok='true'
4343                 else
4344                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4345                 fi
4346                 ;;
4347         esac
4348 else
4349         case "$cppstdin" in
4350         '') ;;
4351         *)
4352                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4353                 ;;
4354         esac
4355 fi
4356
4357 if $ok; then
4358         : nothing
4359 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4360         $cc -E <testcpp.c >testcpp.out 2>&1; \
4361         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4362         echo "Yup, it does."
4363         x_cpp="$cc -E"
4364         x_minus='';
4365 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4366         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4367         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4368         echo "Yup, it does."
4369         x_cpp="$cc -E"
4370         x_minus='-';
4371 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4372         $cc -P <testcpp.c >testcpp.out 2>&1; \
4373         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4374         echo "Yipee, that works!"
4375         x_cpp="$cc -P"
4376         x_minus='';
4377 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4378         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4379         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4380         echo "At long last!"
4381         x_cpp="$cc -P"
4382         x_minus='-';
4383 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4384         $cpp <testcpp.c >testcpp.out 2>&1; \
4385         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4386         echo "It works!"
4387         x_cpp="$cpp"
4388         x_minus='';
4389 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4390         $cpp - <testcpp.c >testcpp.out 2>&1; \
4391         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4392         echo "Hooray, it works!  I was beginning to wonder."
4393         x_cpp="$cpp"
4394         x_minus='-';
4395 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4396         $wrapper <testcpp.c >testcpp.out 2>&1; \
4397         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4398         x_cpp="$wrapper"
4399         x_minus=''
4400         echo "Eureka!"
4401 else
4402         dflt=''
4403         rp="No dice.  I can't find a C preprocessor.  Name one:"
4404         . ./myread
4405         x_cpp="$ans"
4406         x_minus=''
4407         $x_cpp <testcpp.c >testcpp.out 2>&1
4408         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4409                 echo "OK, that will do." >&4
4410         else
4411 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4412                 exit 1
4413         fi
4414 fi
4415
4416 case "$ok" in
4417 false)
4418         cppstdin="$x_cpp"
4419         cppminus="$x_minus"
4420         cpprun="$x_cpp"
4421         cpplast="$x_minus"
4422         set X $x_cpp
4423         shift
4424         case "$1" in
4425         "$cpp")
4426                 echo "Perhaps can we force $cc -E using a wrapper..."
4427                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4428                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4429                 then
4430                         echo "Yup, we can."
4431                         cppstdin="$wrapper"
4432                         cppminus='';
4433                 else
4434                         echo "Nope, we'll have to live without it..."
4435                 fi
4436                 ;;
4437         esac
4438         case "$cpprun" in
4439         "$wrapper")
4440                 cpprun=''
4441                 cpplast=''
4442                 ;;
4443         esac
4444         ;;
4445 esac
4446
4447 case "$cppstdin" in
4448 "$wrapper"|'cppstdin') ;;
4449 *) $rm -f $wrapper;;
4450 esac
4451 $rm -f testcpp.c testcpp.out
4452
4453 : Set private lib path
4454 case "$plibpth" in
4455 '') if ./mips; then
4456                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4457         fi;;
4458 esac
4459 case "$libpth" in
4460 ' ') dlist='';;
4461 '') dlist="$loclibpth $plibpth $glibpth";;
4462 *) dlist="$libpth";;
4463 esac
4464
4465 : Now check and see which directories actually exist, avoiding duplicates
4466 libpth=''
4467 for xxx in $dlist
4468 do
4469     if $test -d $xxx; then
4470                 case " $libpth " in
4471                 *" $xxx "*) ;;
4472                 *) libpth="$libpth $xxx";;
4473                 esac
4474     fi
4475 done
4476 $cat <<'EOM'
4477
4478 Some systems have incompatible or broken versions of libraries.  Among
4479 the directories listed in the question below, please remove any you
4480 know not to be holding relevant libraries, and add any that are needed.
4481 Say "none" for none.
4482
4483 EOM
4484 case "$libpth" in
4485 '') dflt='none';;
4486 *)
4487         set X $libpth
4488         shift
4489         dflt=${1+"$@"}
4490         ;;
4491 esac
4492 rp="Directories to use for library searches?"
4493 . ./myread
4494 case "$ans" in
4495 none) libpth=' ';;
4496 *) libpth="$ans";;
4497 esac
4498
4499 : compute shared library extension
4500 case "$so" in
4501 '')
4502         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4503                 dflt='sl'
4504         else
4505                 dflt='so'
4506         fi
4507         ;;
4508 *) dflt="$so";;
4509 esac
4510 $cat <<EOM
4511
4512 On some systems, shared libraries may be available.  Answer 'none' if
4513 you want to suppress searching of shared libraries for the remainder
4514 of this configuration.
4515
4516 EOM
4517 rp='What is the file extension used for shared libraries?'
4518 . ./myread
4519 so="$ans"
4520
4521 : Define several unixisms.
4522 : Hints files or command line option can be used to override them.
4523 : The convoluted testing is in case hints files set either the old
4524 : or the new name.
4525 case "$_exe" in
4526 '')     case "$exe_ext" in
4527         '')     ;;
4528         *)      _exe="$exe_ext" ;;
4529         esac
4530         ;;
4531 esac
4532 case "$_a" in
4533 '')     case "$lib_ext" in
4534     '') _a='.a';;
4535         *)      _a="$lib_ext" ;;
4536         esac
4537         ;;
4538 esac
4539 case "$_o" in
4540 '') case "$obj_ext" in
4541         '')     _o='.o';;
4542         *)      _o="$obj_ext";;
4543         esac
4544         ;;
4545 esac
4546 case "$p_" in
4547 '') case "$path_sep" in
4548         '')     p_=':';;
4549         *)      p_="$path_sep";;
4550         esac
4551         ;;
4552 esac
4553 exe_ext=$_exe
4554 lib_ext=$_a
4555 obj_ext=$_o
4556 path_sep=$p_
4557
4558 : Which makefile gets called first.  This is used by make depend.
4559 case "$firstmakefile" in
4560 '') firstmakefile='makefile';;
4561 esac
4562
4563 case "$ccflags" in
4564 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4565 esac
4566
4567 case "$uselongdouble" in
4568 $define|true|[yY]*)     dflt='y';;
4569 *) dflt='n';;
4570 esac
4571 cat <<EOM
4572
4573 Perl can be built to take advantage of long doubles which
4574 (if available) may give more accuracy and range for floating point numbers.
4575
4576 If this doesn't make any sense to you, just accept the default '$dflt'.
4577 EOM
4578 rp='Try to use long doubles if available?'
4579 . ./myread
4580 case "$ans" in
4581 y|Y)    val="$define"   ;;
4582 *)      val="$undef"    ;;
4583 esac
4584 set uselongdouble
4585 eval $setvar
4586
4587 case "$uselongdouble" in
4588 true|[yY]*) uselongdouble="$define" ;;
4589 esac
4590
4591 : Look for a hint-file generated 'call-back-unit'.  If the
4592 : user has specified that long doubles should be used,
4593 : we may need to set or change some other defaults.
4594 if $test -f uselongdouble.cbu; then
4595     echo "Your platform has some specific hints regarding long doubles, using them..."
4596     . ./uselongdouble.cbu
4597 else
4598     case "$uselongdouble" in
4599         $define)
4600                 $cat <<EOM
4601 (Your platform does not have any specific hints for long doubles.)
4602 EOM
4603         ;;
4604     esac
4605 fi
4606
4607 : Looking for optional libraries
4608 echo " "
4609 echo "Checking for optional libraries..." >&4
4610 case "$libs" in
4611 ' '|'') dflt='';;
4612 *) dflt="$libs";;
4613 esac
4614 case "$libswanted" in
4615 '') libswanted='c_s';;
4616 esac
4617 case "$usesocks" in
4618 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4619 esac
4620 libsfound=''
4621 libsfiles=''
4622 libsdirs=''
4623 libspath=''
4624 for thisdir in $libpth $xlibpth; do
4625   test -d $thisdir && libspath="$libspath $thisdir"
4626 done
4627 for thislib in $libswanted; do
4628         for thisdir in $libspath; do
4629             xxx=''
4630             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4631                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4632                 $test -f "$xxx" && eval $libscheck
4633                 $test -f "$xxx" && libstyle=shared
4634             fi
4635             if test ! -f "$xxx"; then
4636                 xxx=$thisdir/lib$thislib.$so
4637                 $test -f "$xxx" && eval $libscheck
4638                 $test -f "$xxx" && libstyle=shared
4639             fi  
4640             if test ! -f "$xxx"; then
4641                 xxx=$thisdir/lib$thislib$_a
4642                 $test -f "$xxx" && eval $libscheck
4643                 $test -f "$xxx" && libstyle=static
4644             fi
4645             if test ! -f "$xxx"; then
4646                 xxx=$thisdir/$thislib$_a
4647                 $test -f "$xxx" && eval $libscheck
4648                 $test -f "$xxx" && libstyle=static
4649             fi
4650             if test ! -f "$xxx"; then
4651                 xxx=$thisdir/lib${thislib}_s$_a
4652                 $test -f "$xxx" && eval $libscheck
4653                 $test -f "$xxx" && libstyle=static
4654                 $test -f "$xxx" && thislib=${thislib}_s
4655             fi
4656             if test ! -f "$xxx"; then
4657                 xxx=$thisdir/Slib$thislib$_a
4658                 $test -f "$xxx" && eval $libscheck
4659                 $test -f "$xxx" && libstyle=static
4660             fi
4661             if $test -f "$xxx"; then
4662                 case "$libstyle" in
4663                 shared) echo "Found -l$thislib (shared)." ;;
4664                 static) echo "Found -l$thislib." ;;
4665                 *)      echo "Found -l$thislib ($libstyle)." ;;
4666                 esac
4667                 case " $dflt " in
4668                 *"-l$thislib "*);;
4669                 *) dflt="$dflt -l$thislib"
4670                    libsfound="$libsfound $xxx"
4671                    yyy=`basename $xxx`
4672                    libsfiles="$libsfiles $yyy"
4673                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4674                    case " $libsdirs " in
4675                    *" $yyy "*) ;;
4676                    *) libsdirs="$libsdirs $yyy" ;;
4677                    esac
4678                    ;;
4679                 esac
4680                 break
4681             fi  
4682         done
4683         if $test ! -f "$xxx"; then
4684             echo "No -l$thislib."
4685         fi
4686 done
4687 set X $dflt
4688 shift
4689 dflt="$*"
4690 case "$libs" in
4691 '') dflt="$dflt";;
4692 *) dflt="$libs";;
4693 esac
4694 case "$dflt" in
4695 ' '|'') dflt='none';;
4696 esac
4697
4698 $cat <<EOM
4699
4700 In order to compile $package on your machine, a number of libraries
4701 are usually needed.  Include any other special libraries here as well.
4702 Say "none" for none.  The default list is almost always right.
4703 EOM
4704
4705 echo " "
4706 rp="What libraries to use?"
4707 . ./myread
4708 case "$ans" in
4709 none) libs=' ';;
4710 *) libs="$ans";;
4711 esac
4712
4713 : determine optimization, if desired, or use for debug flag also
4714 case "$optimize" in
4715 ' '|$undef) dflt='none';;
4716 '') dflt='-O';;
4717 *) dflt="$optimize";;
4718 esac
4719 $cat <<EOH
4720
4721 By default, $package compiles with the -O flag to use the optimizer.
4722 Alternately, you might want to use the symbolic debugger, which uses
4723 the -g flag (on traditional Unix systems).  Either flag can be
4724 specified here.  To use neither flag, specify the word "none".
4725
4726 EOH
4727 rp="What optimizer/debugger flag should be used?"
4728 . ./myread
4729 optimize="$ans"
4730 case "$optimize" in
4731 'none') optimize=" ";;
4732 esac
4733
4734 dflt=''
4735 : We will not override a previous value, but we might want to
4736 : augment a hint file
4737 case "$hint" in
4738 default|recommended)
4739         case "$gccversion" in
4740         1*) dflt='-fpcc-struct-return' ;;
4741         esac
4742         case "$optimize" in
4743         *-g*) dflt="$dflt -DDEBUGGING";;
4744         esac
4745         case "$gccversion" in
4746         2*) if test -d /etc/conf/kconfig.d &&
4747                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
4748                 then
4749                         # Interactive Systems (ISC) POSIX mode.
4750                         dflt="$dflt -posix"
4751                 fi
4752                 ;;
4753         esac
4754         case "$gccversion" in
4755         1*) ;;
4756         2.[0-8]*) ;;
4757         ?*)     echo " "
4758                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
4759                 echo 'int main(void) { return 0; }' > gcctest.c
4760                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
4761                         echo "Yes, it does." 2>&1
4762                         case "$ccflags" in
4763                         *strict-aliasing*)
4764                                 echo "Leaving current flags $ccflags alone." 2>&1
4765                                 ;;
4766                         *) dflt="$dflt -fno-strict-aliasing" ;;
4767                         esac
4768                 else
4769                         echo "Nope, it doesn't, but that's ok." 2>&1
4770                 fi
4771                 ;;
4772         esac
4773         # For gcc, adding -pipe speeds up compilations for some, but apparently
4774         # some assemblers can't read from stdin.  (It also slows down compilations
4775         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
4776         case "$gccversion" in
4777         ?*)     echo " "
4778                 echo "Checking if your compiler accepts -pipe" 2>&1
4779                 echo 'int main(void) { return 0; }' > gcctest.c
4780                 if $cc -pipe -o gcctest gcctest.c; then
4781                         echo "Yes, it does." 2>&1
4782                         case "$ccflags" in
4783                         *-pipe*)
4784                                 echo "Leaving current flags $ccflags alone." 2>&1
4785                                 ;;
4786                         *) dflt="$dflt -pipe" ;;
4787                         esac
4788                 else
4789                         echo "Nope, it doesn't, but that's ok." 2>&1
4790                 fi
4791
4792                 echo "Checking if your compiler accepts -Wdeclaration-after-statement" 2>&1
4793                 echo 'int main(void) { return 0; }' > gcctest.c
4794                 if $cc -Wdeclaration-after-statement -o gcctest gcctest.c; then
4795                         echo "Yes, it does." 2>&1
4796                         case "$ccflags" in
4797                         *-Wdeclaration-after-statement*)
4798                                 echo "Leaving current flags $ccflags alone." 2>&1
4799                                 ;;
4800                         *) dflt="$dflt -Wdeclaration-after-statement" ;;
4801                         esac
4802                 else
4803                         echo "Nope, it doesn't, but that's ok." 2>&1
4804                 fi
4805                 ;;
4806         esac
4807         ;;
4808 esac
4809
4810 case "$mips_type" in
4811 *BSD*|'') inclwanted="$locincpth $usrinc";;
4812 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
4813 esac
4814 for thisincl in $inclwanted; do
4815         if $test -d $thisincl; then
4816                 if $test x$thisincl != x$usrinc; then
4817                         case "$dflt" in
4818                         *" -I$thisincl "*);;
4819                         *) dflt="$dflt -I$thisincl ";;
4820                         esac
4821                 fi
4822         fi
4823 done
4824
4825 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
4826         xxx=true;
4827 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
4828         xxx=true;
4829 else
4830         xxx=false;
4831 fi;
4832 if $xxx; then
4833         case "$dflt" in
4834         *$2*);;
4835         *) dflt="$dflt -D$2";;
4836         esac;
4837 fi'
4838
4839 set signal.h LANGUAGE_C; eval $inctest
4840
4841 case "$usesocks" in
4842 $define)
4843         ccflags="$ccflags -DSOCKS"
4844         ;;
4845 esac
4846
4847 case "$hint" in
4848 default|recommended) dflt="$ccflags $dflt" ;;
4849 *) dflt="$ccflags";;
4850 esac
4851
4852 case "$dflt" in
4853 ''|' ') dflt=none;;
4854 esac
4855
4856 $cat <<EOH
4857
4858 Your C compiler may want other flags.  For this question you should include
4859 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
4860 but you should NOT include libraries or ld flags like -lwhatever.  If you
4861 want $package to honor its debug switch, you should include -DDEBUGGING here.
4862 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
4863
4864 To use no flags, specify the word "none".
4865
4866 EOH
4867 set X $dflt
4868 shift
4869 dflt=${1+"$@"}
4870 rp="Any additional cc flags?"
4871 . ./myread
4872 case "$ans" in
4873 none) ccflags='';;
4874 *) ccflags="$ans";;
4875 esac
4876
4877 : the following weeds options from ccflags that are of no interest to cpp
4878 case "$cppflags" in
4879 '') cppflags="$ccflags" ;;
4880 *)  cppflags="$cppflags $ccflags" ;;
4881 esac
4882 case "$gccversion" in
4883 1*) cppflags="$cppflags -D__GNUC__"
4884 esac
4885 case "$mips_type" in
4886 '');;
4887 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
4888 esac
4889 case "$cppflags" in
4890 '');;
4891 *)
4892         echo " "
4893         echo "Let me guess what the preprocessor flags are..." >&4
4894         set X $cppflags
4895         shift
4896         cppflags=''
4897         $cat >cpp.c <<'EOM'
4898 #define BLURFL foo
4899
4900 BLURFL xx LFRULB
4901 EOM
4902         previous=''
4903         for flag in $*
4904         do
4905                 case "$flag" in
4906                 -*) ftry="$flag";;
4907                 *) ftry="$previous $flag";;
4908                 esac
4909                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
4910                         >cpp1.out 2>/dev/null && \
4911                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
4912                         >cpp2.out 2>/dev/null && \
4913                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
4914                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
4915                 then
4916                         cppflags="$cppflags $ftry"
4917                         previous=''
4918                 else
4919                         previous="$flag"
4920                 fi
4921         done
4922         set X $cppflags
4923         shift
4924         cppflags=${1+"$@"}
4925         case "$cppflags" in
4926         *-*)  echo "They appear to be: $cppflags";;
4927         esac
4928         $rm -f cpp.c cpp?.out
4929         ;;
4930 esac
4931
4932 : flags used in final linking phase
4933 case "$ldflags" in
4934 '') if ./venix; then
4935                 dflt='-i -z'
4936         else
4937                 dflt=''
4938         fi
4939         case "$ccflags" in
4940         *-posix*) dflt="$dflt -posix" ;;
4941         esac
4942         ;;
4943 *) dflt="$ldflags";;
4944 esac
4945
4946 : Try to guess additional flags to pick up local libraries.
4947 for thislibdir in $libpth; do
4948         case " $loclibpth " in
4949         *" $thislibdir "*)
4950                 case "$dflt " in
4951                 *"-L$thislibdir "*) ;;
4952                 *)  dflt="$dflt -L$thislibdir" ;;
4953                 esac
4954                 ;;
4955         esac
4956 done
4957
4958 case "$dflt" in
4959 '') dflt='none' ;;
4960 esac
4961
4962 $cat <<EOH
4963
4964 Your C linker may need flags.  For this question you should
4965 include -L/whatever and any other flags used by the C linker, but you
4966 should NOT include libraries like -lwhatever.
4967
4968 Make sure you include the appropriate -L/path flags if your C linker
4969 does not normally search all of the directories you specified above,
4970 namely
4971         $libpth
4972 To use no flags, specify the word "none".
4973
4974 EOH
4975
4976 rp="Any additional ld flags (NOT including libraries)?"
4977 . ./myread
4978 case "$ans" in
4979 none) ldflags='';;
4980 *) ldflags="$ans";;
4981 esac
4982 rmlist="$rmlist pdp11"
4983
4984 : coherency check
4985 echo " "
4986 echo "Checking your choice of C compiler and flags for coherency..." >&4
4987 $cat > try.c <<'EOF'
4988 #include <stdio.h>
4989 int main() { printf("Ok\n"); return(0); }
4990 EOF
4991 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
4992 shift
4993 $cat >try.msg <<'EOM'
4994 I've tried to compile and run the following simple program:
4995
4996 EOM
4997 $cat try.c >> try.msg
4998
4999 $cat >> try.msg <<EOM
5000
5001 I used the command:
5002
5003         $*
5004         $run ./try
5005
5006 and I got the following output:
5007
5008 EOM
5009 dflt=y
5010 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5011         if $sh -c "$run ./try" >>try.msg 2>&1; then
5012                 xxx=`$run ./try`
5013                 case "$xxx" in
5014                 "Ok") dflt=n ;;
5015                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5016                         case " $libs " in
5017                         *" -lsfio "*)
5018                                 cat >> try.msg <<'EOQS'
5019 If $libs contains -lsfio, and sfio is mis-configured, then it
5020 sometimes (apparently) runs and exits with a 0 status, but with no
5021 output!  It may have to do with sfio's use of _exit vs. exit.
5022
5023 EOQS
5024                                 rp="You have a big problem.  Shall I abort Configure"
5025                                 dflt=y
5026                                 ;;
5027                         esac
5028                         ;;
5029                 esac
5030         else
5031                 echo "The program compiled OK, but exited with status $?." >>try.msg
5032                 rp="You have a problem.  Shall I abort Configure"
5033                 dflt=y
5034         fi
5035 else
5036         echo "I can't compile the test program." >>try.msg
5037         rp="You have a BIG problem.  Shall I abort Configure"
5038         dflt=y
5039 fi
5040 case "$dflt" in
5041 y)
5042         $cat try.msg >&4
5043         case "$knowitall" in
5044         '')
5045                 echo "(The supplied flags or libraries might be incorrect.)"
5046                 ;;
5047         *) dflt=n;;
5048         esac
5049         echo " "
5050         . ./myread
5051         case "$ans" in
5052         n*|N*) ;;
5053         *)      echo "Ok.  Stopping Configure." >&4
5054                 exit 1
5055                 ;;
5056         esac
5057         ;;
5058 n) echo "OK, that should do.";;
5059 esac
5060 $rm -f try try.* core
5061
5062 : define a shorthand compile call
5063 compile='
5064 mc_file=$1;
5065 shift;
5066 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5067 : define a shorthand compile call for compilations that should be ok.
5068 compile_ok='
5069 mc_file=$1;
5070 shift;
5071 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5072
5073 : determine filename position in cpp output
5074 echo " "
5075 echo "Computing filename position in cpp output for #include directives..." >&4
5076 case "$osname" in
5077 vos) testaccess=-e ;;
5078 *)   testaccess=-r ;;
5079 esac
5080 echo '#include <stdio.h>' > foo.c
5081 $cat >fieldn <<EOF
5082 $startsh
5083 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5084 $grep '^[       ]*#.*stdio\.h' | \
5085 while read cline; do
5086         pos=1
5087         set \$cline
5088         while $test \$# -gt 0; do
5089                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5090                         echo "\$pos"
5091                         exit 0
5092                 fi
5093                 shift
5094                 pos=\`expr \$pos + 1\`
5095         done
5096 done
5097 EOF
5098 chmod +x fieldn
5099 fieldn=`./fieldn`
5100 $rm -f foo.c fieldn
5101 case $fieldn in
5102 '') pos='???';;
5103 1) pos=first;;
5104 2) pos=second;;
5105 3) pos=third;;
5106 *) pos="${fieldn}th";;
5107 esac
5108 echo "Your cpp writes the filename in the $pos field of the line."
5109
5110 case "$osname" in
5111 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5112 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5113 *)   cppfilter='' ;;
5114 esac
5115 : locate header file
5116 $cat >findhdr <<EOF
5117 $startsh
5118 wanted=\$1
5119 name=''
5120 for usrincdir in $usrinc
5121 do
5122         if test -f \$usrincdir/\$wanted; then
5123                 echo "\$usrincdir/\$wanted"
5124                 exit 0
5125         fi
5126 done
5127 awkprg='{ print \$$fieldn }'
5128 echo "#include <\$wanted>" > foo\$\$.c
5129 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5130 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5131 while read cline; do
5132         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5133         case "\$name" in
5134         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5135         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5136         *) exit 2;;
5137         esac;
5138 done;
5139 #
5140 # status = 0: grep returned 0 lines, case statement not executed
5141 # status = 1: headerfile found
5142 # status = 2: while loop executed, no headerfile found
5143 #
5144 status=\$?
5145 $rm -f foo\$\$.c;
5146 if test \$status -eq 1; then
5147         exit 0;
5148 fi
5149 exit 1
5150 EOF
5151 chmod +x findhdr
5152
5153 : define an alternate in-header-list? function
5154 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5155 cont=true; xxf="echo \"<\$1> found.\" >&4";
5156 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5157 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5158 esac;
5159 case $# in 4) instead=instead;; *) instead="at last";; esac;
5160 while $test "$cont"; do
5161         xxx=`./findhdr $1`
5162         var=$2; eval "was=\$$2";
5163         if $test "$xxx" && $test -r "$xxx";
5164         then eval $xxf;
5165         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5166                 cont="";
5167         else eval $xxnf;
5168         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5169         set $yyy; shift; shift; yyy=$@;
5170         case $# in 0) cont="";;
5171         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5172                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5173         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5174                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5175         esac;
5176 done;
5177 while $test "$yyy";
5178 do set $yyy; var=$2; eval "was=\$$2";
5179         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5180         set $yyy; shift; shift; yyy=$@;
5181 done'
5182
5183 : see if stdlib is available
5184 set stdlib.h i_stdlib
5185 eval $inhdr
5186
5187 : check for lengths of integral types
5188 echo " "
5189 case "$intsize" in
5190 '')
5191         echo "Checking to see how big your integers are..." >&4
5192         $cat >try.c <<EOCP
5193 #include <stdio.h>
5194 #$i_stdlib I_STDLIB
5195 #ifdef I_STDLIB
5196 #include <stdlib.h>
5197 #endif
5198 int main()
5199 {
5200         printf("intsize=%d;\n", (int)sizeof(int));
5201         printf("longsize=%d;\n", (int)sizeof(long));
5202         printf("shortsize=%d;\n", (int)sizeof(short));
5203         exit(0);
5204 }
5205 EOCP
5206         set try
5207         if eval $compile_ok && $run ./try > /dev/null; then
5208                 eval `$run ./try`
5209                 echo "Your integers are $intsize bytes long."
5210                 echo "Your long integers are $longsize bytes long."
5211                 echo "Your short integers are $shortsize bytes long."
5212         else
5213                 $cat >&4 <<EOM
5214 !
5215 Help! I can't compile and run the intsize test program: please enlighten me!
5216 (This is probably a misconfiguration in your system or libraries, and
5217 you really ought to fix it.  Still, I'll try anyway.)
5218 !
5219 EOM
5220                 dflt=4
5221                 rp="What is the size of an integer (in bytes)?"
5222                 . ./myread
5223                 intsize="$ans"
5224                 dflt=$intsize
5225                 rp="What is the size of a long integer (in bytes)?"
5226                 . ./myread
5227                 longsize="$ans"
5228                 dflt=2
5229                 rp="What is the size of a short integer (in bytes)?"
5230                 . ./myread
5231                 shortsize="$ans"
5232         fi
5233         ;;
5234 esac
5235 $rm -f try try.*
5236
5237 : check for long long
5238 echo " "
5239 echo "Checking to see if you have long long..." >&4
5240 echo 'int main() { long long x = 7; return 0; }' > try.c
5241 set try
5242 if eval $compile; then
5243         val="$define"
5244         echo "You have long long."
5245 else
5246         val="$undef"
5247         echo "You do not have long long."
5248 fi
5249 $rm try.*
5250 set d_longlong
5251 eval $setvar
5252
5253 : check for length of long long
5254 case "${d_longlong}${longlongsize}" in
5255 $define)
5256         echo " "
5257         echo "Checking to see how big your long longs are..." >&4
5258         $cat >try.c <<'EOCP'
5259 #include <stdio.h>
5260 int main()
5261 {
5262     printf("%d\n", (int)sizeof(long long));
5263     return(0);
5264 }
5265 EOCP
5266         set try
5267         if eval $compile_ok; then
5268                 longlongsize=`$run ./try`
5269                 echo "Your long longs are $longlongsize bytes long."
5270         else
5271                 dflt='8'
5272                 echo " "
5273                 echo "(I can't seem to compile the test program.  Guessing...)"
5274                 rp="What is the size of a long long (in bytes)?"
5275                 . ./myread
5276                 longlongsize="$ans"
5277         fi
5278         if $test "X$longsize" = "X$longlongsize"; then
5279                 echo "(That isn't any different from an ordinary long.)"
5280         fi      
5281         ;;
5282 esac
5283 $rm -f try.* try
5284
5285 : see if inttypes.h is available
5286 : we want a real compile instead of Inhdr because some systems
5287 : have an inttypes.h which includes non-existent headers
5288 echo " "
5289 $cat >try.c <<EOCP
5290 #include <inttypes.h>
5291 int main() {
5292         static int32_t foo32 = 0x12345678;
5293 }
5294 EOCP
5295 set try
5296 if eval $compile; then
5297         echo "<inttypes.h> found." >&4
5298         val="$define"
5299 else
5300         echo "<inttypes.h> NOT found." >&4
5301         val="$undef"
5302 fi
5303 $rm -f try.c try
5304 set i_inttypes
5305 eval $setvar
5306
5307 : check for int64_t
5308 echo " "
5309 echo "Checking to see if you have int64_t..." >&4
5310 $cat >try.c <<EOCP
5311 #include <sys/types.h>
5312 #$i_inttypes I_INTTYPES
5313 #ifdef I_INTTYPES
5314 #include <inttypes.h>
5315 #endif
5316 int main() { int64_t x = 7; }
5317 EOCP
5318 set try
5319 if eval $compile; then
5320         val="$define"
5321         echo "You have int64_t."
5322 else
5323         val="$undef"
5324         echo "You do not have int64_t."
5325 fi
5326 $rm -f try try.*
5327 set d_int64_t
5328 eval $setvar
5329
5330
5331 echo " "
5332 echo "Checking which 64-bit integer type we could use..." >&4
5333
5334 case "$intsize" in
5335 8) val=int
5336    set quadtype
5337    eval $setvar
5338    val='"unsigned int"'
5339    set uquadtype
5340    eval $setvar
5341    quadkind=1
5342    ;;
5343 *) case "$longsize" in
5344    8) val=long
5345       set quadtype
5346       eval $setvar
5347       val='"unsigned long"'
5348       set uquadtype
5349       eval $setvar
5350       quadkind=2
5351       ;;
5352    *) case "$d_longlong:$longlongsize" in
5353       define:8)
5354         val='"long long"'
5355         set quadtype
5356         eval $setvar
5357         val='"unsigned long long"'
5358         set uquadtype
5359         eval $setvar
5360         quadkind=3
5361         ;;
5362       *) case "$d_int64_t" in
5363          define)
5364            val=int64_t
5365            set quadtype
5366            eval $setvar
5367            val=uint64_t
5368            set uquadtype
5369            eval $setvar
5370            quadkind=4
5371            ;;
5372          esac
5373          ;;
5374       esac
5375       ;;
5376    esac
5377    ;;
5378 esac
5379
5380 case "$quadtype" in
5381 '')     echo "Alas, no 64-bit integer types in sight." >&4
5382         d_quad="$undef"
5383         ;;
5384 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5385         d_quad="$define"
5386         ;;
5387 esac
5388
5389
5390 case "$uselonglong" in
5391 "$define"|true|[yY]*)
5392         cat <<EOM >&4
5393
5394 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5395 EOM
5396         use64bitint="$define"
5397         ;;
5398 esac                          
5399 case "$use64bits" in
5400 "$define"|true|[yY]*)
5401         cat <<EOM >&4
5402
5403 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5404 EOM
5405         use64bitint="$define"
5406         ;;
5407 esac                          
5408 case "$use64bitints" in
5409 "$define"|true|[yY]*)
5410         cat <<EOM >&4
5411
5412 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5413 EOM
5414         use64bitint="$define"
5415         ;;
5416 esac                          
5417 case "$use64bitsint" in
5418 "$define"|true|[yY]*)
5419         cat <<EOM >&4
5420
5421 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5422 EOM
5423         use64bitint="$define"
5424         ;;
5425 esac                          
5426 case "$uselonglongs" in
5427 "$define"|true|[yY]*)
5428         cat <<EOM >&4
5429
5430 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5431 EOM
5432         use64bitint="$define"
5433         ;;
5434 esac                          
5435 case "$use64bitsall" in
5436 "$define"|true|[yY]*)
5437         cat <<EOM >&4
5438
5439 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5440 EOM
5441         use64bitall="$define"
5442         ;;
5443 esac                          
5444
5445 case "$ccflags" in
5446 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5447 esac
5448 case "$use64bitall" in
5449 "$define"|true|[yY]*) use64bitint="$define" ;;
5450 esac
5451
5452 case "$longsize" in
5453 8) cat <<EOM
5454
5455 You have natively 64-bit long integers.
5456 EOM
5457    val="$define"
5458    ;;
5459 *) case "$use64bitint" in
5460    "$define"|true|[yY]*) dflt='y';;
5461    *) dflt='n';;
5462    esac
5463    case "$d_quad" in
5464    "$define") ;;
5465    *) dflt='n' ;;
5466    esac
5467    cat <<EOM
5468
5469 Perl can be built to take advantage of 64-bit integer types
5470 on some systems.  To do so, Configure can be run with -Duse64bitint.
5471 Choosing this option will most probably introduce binary incompatibilities.
5472
5473 If this doesn't make any sense to you, just accept the default '$dflt'.
5474 (The default has been chosen based on your configuration.)
5475 EOM
5476    rp='Try to use 64-bit integers, if available?'
5477    . ./myread
5478    case "$ans" in
5479    [yY]*) val="$define" ;;
5480    *)     val="$undef"  ;;
5481    esac
5482    ;;
5483 esac
5484 set use64bitint
5485 eval $setvar
5486
5487 case "$use64bitall" in
5488 "$define"|true|[yY]*) dflt='y' ;;
5489 *) case "$longsize" in
5490    8) dflt='y' ;;
5491    *) dflt='n' ;;
5492    esac
5493    ;;
5494 esac    
5495 cat <<EOM
5496
5497 You may also choose to try maximal 64-bitness.  It means using as much
5498 64-bitness as possible on the platform.  This in turn means even more
5499 binary incompatibilities.  On the other hand, your platform may not
5500 have any more 64-bitness available than what you already have chosen.
5501
5502 If this doesn't make any sense to you, just accept the default '$dflt'.
5503 (The default has been chosen based on your configuration.)
5504 EOM
5505 rp='Try to use maximal 64-bit support, if available?'
5506 . ./myread
5507 case "$ans" in
5508 [yY]*) val="$define" ;;
5509 *)     val="$undef"  ;;
5510 esac
5511 set use64bitall
5512 eval $setvar
5513 case "$use64bitall" in
5514 "$define")
5515         case "$use64bitint" in
5516         "$undef")
5517                 cat <<EOM
5518
5519 Since you have chosen a maximally 64-bit build, I'm also turning on
5520 the use of 64-bit integers.
5521 EOM
5522                 use64bitint="$define" ;;
5523         esac
5524         ;;
5525 esac
5526
5527 : Look for a hint-file generated 'call-back-unit'.  If the
5528 : user has specified that a 64-bit perl is to be built,
5529 : we may need to set or change some other defaults.
5530 if $test -f use64bitint.cbu; then
5531         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5532         . ./use64bitint.cbu
5533 fi
5534 case "$use64bitint" in
5535 "$define"|true|[yY]*)
5536         case "$longsize" in
5537         4) case "$archname64" in
5538            '') archname64=64int ;;
5539            esac
5540            ;;
5541         esac
5542         ;;
5543 esac
5544
5545 : Look for a hint-file generated 'call-back-unit'.  If the
5546 : user has specified that a maximally 64-bit perl is to be built,
5547 : we may need to set or change some other defaults.
5548 if $test -f use64bitall.cbu; then
5549         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5550         . ./use64bitall.cbu
5551 fi
5552 case "$use64bitall" in
5553 "$define"|true|[yY]*)
5554         case "$longsize" in
5555         4) case "$archname64" in
5556            ''|64int) archname64=64all ;;
5557            esac
5558            ;;
5559         esac
5560         ;;
5561 esac
5562
5563 case "$d_quad:$use64bitint" in
5564 $undef:$define)
5565         cat >&4 <<EOF
5566
5567 *** You have chosen to use 64-bit integers,
5568 *** but none can be found.
5569 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5570 *** Cannot continue, aborting.
5571
5572 EOF
5573         exit 1
5574         ;;
5575 esac
5576
5577 : check for length of double
5578 echo " "
5579 case "$doublesize" in
5580 '')
5581         echo "Checking to see how big your double precision numbers are..." >&4
5582         $cat >try.c <<EOCP
5583 #include <stdio.h>
5584 #$i_stdlib I_STDLIB
5585 #ifdef I_STDLIB
5586 #include <stdlib.h>
5587 #endif
5588 int main()
5589 {
5590     printf("%d\n", (int)sizeof(double));
5591     exit(0);
5592 }
5593 EOCP
5594         set try
5595         if eval $compile_ok; then
5596                 doublesize=`$run ./try`
5597                 echo "Your double is $doublesize bytes long."
5598         else
5599                 dflt='8'
5600                 echo "(I can't seem to compile the test program.  Guessing...)"
5601                 rp="What is the size of a double precision number (in bytes)?"
5602                 . ./myread
5603                 doublesize="$ans"
5604         fi
5605         ;;
5606 esac
5607 $rm -f try.c try
5608
5609 : check for long doubles
5610 echo " "
5611 echo "Checking to see if you have long double..." >&4
5612 echo 'int main() { long double x = 7.0; }' > try.c
5613 set try
5614 if eval $compile; then
5615         val="$define"
5616         echo "You have long double."
5617 else
5618         val="$undef"
5619         echo "You do not have long double."
5620 fi
5621 $rm try.*
5622 set d_longdbl
5623 eval $setvar
5624
5625 : check for length of long double
5626 case "${d_longdbl}${longdblsize}" in
5627 $define)
5628         echo " "
5629         echo "Checking to see how big your long doubles are..." >&4
5630         $cat >try.c <<'EOCP'
5631 #include <stdio.h>
5632 int main()
5633 {
5634         printf("%d\n", sizeof(long double));
5635 }
5636 EOCP
5637         set try
5638         set try
5639         if eval $compile; then
5640                 longdblsize=`$run ./try`
5641                 echo "Your long doubles are $longdblsize bytes long."
5642         else
5643                 dflt='8'
5644                 echo " "
5645                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5646                 rp="What is the size of a long double (in bytes)?"
5647                 . ./myread
5648                 longdblsize="$ans"
5649         fi
5650         if $test "X$doublesize" = "X$longdblsize"; then
5651                 echo "That isn't any different from an ordinary double."
5652                 echo "I'll keep your setting anyway, but you may see some"
5653                 echo "harmless compilation warnings."
5654         fi      
5655         ;;
5656 esac
5657 $rm -f try.* try
5658
5659 : determine the architecture name
5660 echo " "
5661 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5662         tarch=`arch`"-$osname"
5663 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5664         if uname -m > tmparch 2>&1 ; then
5665                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5666                         -e 's/$/'"-$osname/" tmparch`
5667         else
5668                 tarch="$osname"
5669         fi
5670         $rm -f tmparch
5671 else
5672         tarch="$osname"
5673 fi
5674 case "$myarchname" in
5675 ''|"$tarch") ;;
5676 *)
5677         echo "(Your architecture name used to be $myarchname.)"
5678         archname=''
5679         ;;
5680 esac
5681 case "$targetarch" in
5682 '') ;;
5683 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5684 esac
5685 myarchname="$tarch"
5686 case "$archname" in
5687 '') dflt="$tarch";;
5688 *) dflt="$archname";;
5689 esac
5690 rp='What is your architecture name'
5691 . ./myread
5692 archname="$ans"
5693 case "$usethreads" in
5694 $define)
5695         echo "Threads selected." >&4
5696         case "$archname" in
5697         *-thread*) echo "...and architecture name already has -thread." >&4
5698                 ;;
5699         *)      archname="$archname-thread"
5700                 echo "...setting architecture name to $archname." >&4
5701                 ;;
5702         esac
5703         ;;
5704 esac
5705 case "$usemultiplicity" in
5706 $define)
5707         echo "Multiplicity selected." >&4
5708         case "$archname" in
5709         *-multi*) echo "...and architecture name already has -multi." >&4
5710                 ;;
5711         *)      archname="$archname-multi"
5712                 echo "...setting architecture name to $archname." >&4
5713                 ;;
5714         esac
5715         ;;
5716 esac
5717 case "$use64bitint$use64bitall" in
5718 *"$define"*)
5719         case "$archname64" in
5720         '')
5721                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5722                 ;;
5723         *)
5724                 case "$use64bitint" in
5725                 "$define") echo "64 bit integers selected." >&4 ;;
5726                 esac
5727                 case "$use64bitall" in
5728                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5729                 esac
5730                 case "$archname" in
5731                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5732                         ;;
5733                 *)      archname="$archname-$archname64"
5734                         echo "...setting architecture name to $archname." >&4
5735                         ;;
5736                 esac
5737                 ;;
5738         esac
5739 esac
5740 case "$uselongdouble" in
5741 $define)
5742         echo "Long doubles selected." >&4
5743         case "$longdblsize" in
5744         $doublesize)
5745                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
5746                 ;;
5747         *)
5748                 case "$archname" in
5749                 *-ld*) echo "...and architecture name already has -ld." >&4
5750                         ;;
5751                 *)      archname="$archname-ld"
5752                         echo "...setting architecture name to $archname." >&4
5753                         ;;
5754                 esac
5755                 ;;
5756         esac
5757         ;;
5758 esac
5759 case "$useperlio" in
5760 $define)
5761         echo "Perlio selected." >&4
5762         ;;
5763 *)
5764         echo "Perlio not selected, using stdio." >&4
5765         case "$archname" in
5766         *-stdio*) echo "...and architecture name already has -stdio." >&4
5767                 ;;
5768         *)      archname="$archname-stdio"
5769                 echo "...setting architecture name to $archname." >&4
5770                 ;;
5771         esac
5772         ;;
5773 esac
5774 if $test -f archname.cbu; then
5775         echo "Your platform has some specific hints for architecture name, using them..."
5776         . ./archname.cbu
5777 fi
5778
5779 : determine root of directory hierarchy where package will be installed.
5780 case "$prefix" in
5781 '')
5782         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
5783         ;;
5784 *?/)
5785         dflt=`echo "$prefix" | sed 's/.$//'`
5786         ;;
5787 *)
5788         dflt="$prefix"
5789         ;;
5790 esac
5791 $cat <<EOM
5792
5793 By default, $package will be installed in $dflt/bin, manual pages
5794 under $dflt/man, etc..., i.e. with $dflt as prefix for all
5795 installation directories. Typically this is something like /usr/local.
5796 If you wish to have binaries under /usr/bin but other parts of the
5797 installation under /usr/local, that's ok: you will be prompted
5798 separately for each of the installation directories, the prefix being
5799 only used to set the defaults.
5800
5801 EOM
5802 fn=d~
5803 rp='Installation prefix to use?'
5804 . ./getfile
5805 oldprefix=''
5806 case "$prefix" in
5807 '') ;;
5808 *)
5809         case "$ans" in
5810         "$prefix") ;;
5811         *) oldprefix="$prefix";;
5812         esac
5813         ;;
5814 esac
5815 prefix="$ans"
5816 prefixexp="$ansexp"
5817
5818 case "$afsroot" in
5819 '')     afsroot=/afs ;;
5820 *)      afsroot=$afsroot ;;
5821 esac
5822
5823 : is AFS running?
5824 echo " "
5825 case "$afs" in
5826 $define|true)   afs=true ;;
5827 $undef|false)   afs=false ;;
5828 *)      if test -d $afsroot; then
5829                 afs=true
5830         else
5831                 afs=false
5832         fi
5833         ;;
5834 esac
5835 if $afs; then
5836         echo "AFS may be running... I'll be extra cautious then..." >&4
5837 else
5838         echo "AFS does not seem to be running..." >&4
5839 fi
5840
5841 : determine installation prefix for where package is to be installed.
5842 if $afs; then 
5843 $cat <<EOM
5844
5845 Since you are running AFS, I need to distinguish the directory in which
5846 files will reside from the directory in which they are installed (and from
5847 which they are presumably copied to the former directory by occult means).
5848
5849 EOM
5850         case "$installprefix" in
5851         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
5852         *) dflt="$installprefix";;
5853         esac
5854 else
5855 $cat <<EOM
5856
5857 In some special cases, particularly when building $package for distribution,
5858 it is convenient to distinguish the directory in which files should be
5859 installed from the directory ($prefix) in which they will
5860 eventually reside.  For most users, these two directories are the same.
5861
5862 EOM
5863         case "$installprefix" in
5864         '') dflt=$prefix ;;
5865         *) dflt=$installprefix;;
5866         esac
5867 fi
5868 fn=d~
5869 rp='What installation prefix should I use for installing files?'
5870 . ./getfile
5871 installprefix="$ans"
5872 installprefixexp="$ansexp"
5873
5874 : set the prefixit variable, to compute a suitable default value
5875 prefixit='case "$3" in
5876 ""|none)
5877         case "$oldprefix" in
5878         "") eval "$1=\"\$$2\"";;
5879         *)
5880                 case "$3" in
5881                 "") eval "$1=";;
5882                 none)
5883                         eval "tp=\"\$$2\"";
5884                         case "$tp" in
5885                         ""|" ") eval "$1=\"\$$2\"";;
5886                         *) eval "$1=";;
5887                         esac;;
5888                 esac;;
5889         esac;;
5890 *)
5891         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
5892         case "$tp" in
5893         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
5894         /*-$oldprefix/*|\~*-$oldprefix/*)
5895                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
5896         *) eval "$1=\"\$$2\"";;
5897         esac;;
5898 esac'
5899
5900 : get the patchlevel
5901 echo " "
5902 echo "Getting the current patchlevel..." >&4
5903 if $test -r $rsrc/patchlevel.h;then
5904         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
5905         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
5906         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5907         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
5908         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
5909         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
5910         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
5911 else
5912         revision=0
5913         patchlevel=0
5914         subversion=0
5915         api_revision=0
5916         api_version=0
5917         api_subversion=0
5918         perl_patchlevel=0
5919         $echo "(You do not have patchlevel.h.  Eek.)"
5920 fi
5921 if $test -r $rsrc/.patch ; then
5922         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
5923                 perl_patchlevel=`cat $rsrc/.patch`
5924         fi
5925 fi
5926 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
5927 version_patchlevel_string="version $patchlevel subversion $subversion"
5928 case "$perl_patchlevel" in
5929 0|'') ;;
5930 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
5931 esac
5932
5933 $echo "(You have $package $version_patchlevel_string.)"
5934
5935 case "$osname" in
5936 dos|vms)
5937         : XXX Should be a Configure test for double-dots in filenames.
5938         version=`echo $revision $patchlevel $subversion | \
5939                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5940         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5941                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
5942         ;;
5943 *)
5944         version=`echo $revision $patchlevel $subversion | \
5945                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5946         api_versionstring=`echo $api_revision $api_version $api_subversion | \
5947                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
5948         ;;
5949 esac
5950 : Special case the 5.005_xx maintenance series, which used 5.005
5951 : without any subversion label as a subdirectory in $sitelib
5952 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
5953         api_versionstring='5.005'
5954 fi
5955
5956 : determine installation style
5957 : For now, try to deduce it from prefix unless it is already set.
5958 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
5959 case "$installstyle" in
5960 '')     case "$prefix" in
5961                 *perl*) dflt='lib';;
5962                 *) dflt='lib/perl5' ;;
5963         esac
5964         ;;
5965 *)      dflt="$installstyle" ;;
5966 esac
5967 : Probably not worth prompting for this since we prompt for all
5968 : the directories individually, and the prompt would be too long and
5969 : confusing anyway.
5970 installstyle=$dflt
5971
5972
5973 : Perform the prefixexp/installprefixexp correction if necessary
5974 cat <<EOS >installprefix
5975 $startsh
5976 EOS
5977 cat <<'EOSC' >>installprefix
5978 : Change installation prefix, if necessary.
5979 if $test X"$prefix" != X"$installprefix"; then
5980         eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
5981 else
5982         eval "install${prefixvar}=\"\$${prefixvar}exp\""
5983 fi
5984 EOSC
5985
5986 : Set variables such as privlib and privlibexp from the output of ./getfile
5987 : performing the prefixexp/installprefixexp correction if necessary.
5988 cat <<EOS >setprefixvar
5989 $startsh
5990 EOS
5991 cat <<'EOSC' >>setprefixvar
5992 eval "${prefixvar}=\"\$ans\""
5993 eval "${prefixvar}exp=\"\$ansexp\""
5994 . ./installprefix
5995 EOSC
5996
5997 : determine where public executables go
5998 echo " "
5999 set dflt bin bin
6000 eval $prefixit
6001 fn=d~
6002 rp='Pathname where the public executables will reside?'
6003 . ./getfile
6004 if $test "X$ansexp" != "X$binexp"; then
6005         installbin=''
6006 fi
6007 prefixvar=bin
6008 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6009 . ./setprefixvar
6010
6011 case "$userelocatableinc" in
6012 $define|true|[yY]*)     dflt='y';;
6013 *) dflt='n';;
6014 esac
6015 cat <<EOM
6016
6017 Would you like to build Perl so that the installation is relocatable, so that
6018 library paths in @INC are determined relative to the path of the perl binary?
6019 This is not advised for system Perl installs, or if you need to run setid
6020 scripts or scripts under taint mode.
6021
6022 If this doesn't make any sense to you, just accept the default '$dflt'.
6023 EOM
6024 rp='Use relocatable @INC?'
6025 . ./myread
6026 case "$ans" in
6027 y|Y)    val="$define" ;;     
6028 *)      val="$undef" ;;
6029 esac
6030 set userelocatableinc
6031 eval $setvar
6032
6033 : Default prefix is now "up one level from where the binaries are"
6034 case "$userelocatableinc" in
6035 $define|true|[yY]*) initialinstalllocation="$binexp"
6036                     bin=".../"
6037                     binexp=".../"
6038                     prefix=".../.."
6039                     prefixexp=".../.."
6040                     installprefixexp=".../..";;
6041 esac
6042
6043
6044 : determine where private library files go
6045 : Usual default is /usr/local/lib/perl5/$version.
6046 : Also allow things like /opt/perl/lib/$version, since 
6047 : /opt/perl/lib/perl5... would be redundant.
6048 : The default "style" setting is made in installstyle.U
6049 case "$installstyle" in
6050 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6051 *)       set dflt privlib lib/$version ;;
6052 esac
6053 eval $prefixit
6054 $cat <<EOM
6055
6056 There are some auxiliary files for $package that need to be put into a
6057 private library directory that is accessible by everyone.
6058
6059 EOM
6060 fn=d~+
6061 rp='Pathname where the private library files will reside?'
6062 . ./getfile
6063 prefixvar=privlib
6064 . ./setprefixvar
6065
6066 : set the prefixup variable, to restore leading tilda escape
6067 prefixup='case "$prefixexp" in
6068 "$prefix") ;;
6069 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6070 esac'
6071
6072 : determine where public architecture dependent libraries go
6073 set archlib archlib
6074 eval $prefixit
6075 : privlib default is /usr/local/lib/$package/$version
6076 : archlib default is /usr/local/lib/$package/$version/$archname
6077 : privlib may have an optional trailing /share.
6078 tdflt=`echo $privlib | $sed 's,/share$,,'`
6079 tdflt=$tdflt/$archname
6080 case "$archlib" in
6081 '')     dflt=$tdflt
6082         ;;
6083 *)      dflt="$archlib"
6084     ;;
6085 esac
6086 $cat <<EOM
6087
6088 $spackage contains architecture-dependent library files.  If you are
6089 sharing libraries in a heterogeneous environment, you might store
6090 these files in a separate location.  Otherwise, you can just include
6091 them with the rest of the public library files.
6092
6093 EOM
6094 fn=d+~
6095 rp='Where do you want to put the public architecture-dependent libraries?'
6096 . ./getfile
6097 prefixvar=archlib
6098 . ./setprefixvar
6099 if $test X"$archlib" = X"$privlib"; then
6100         d_archlib="$undef"
6101 else
6102         d_archlib="$define"
6103 fi
6104
6105 : see if setuid scripts can be secure
6106 $cat <<EOM
6107
6108 Some kernels have a bug that prevents setuid #! scripts from being
6109 secure.  Some sites have disabled setuid #! scripts because of this.
6110
6111 First let's decide if your kernel supports secure setuid #! scripts.
6112 (If setuid #! scripts would be secure but have been disabled anyway,
6113 don't say that they are secure if asked.)
6114
6115 EOM
6116
6117 val="$undef"
6118 if $test -d /dev/fd; then
6119         echo "#!$ls" >reflect
6120         chmod +x,u+s reflect
6121         ./reflect >flect 2>&1
6122         if $contains "/dev/fd" flect >/dev/null; then
6123                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6124                 val="$define"
6125         else
6126                 $cat <<EOM
6127 If you are not sure if they are secure, I can check but I'll need a
6128 username and password different from the one you are using right now.
6129 If you don't have such a username or don't want me to test, simply
6130 enter 'none'.
6131
6132 EOM
6133                 rp='Other username to test security of setuid scripts with?'
6134                 dflt='none'
6135                 . ./myread
6136                 case "$ans" in
6137                 n|none)
6138                         case "$d_suidsafe" in
6139                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6140                                 dflt=n;;
6141                         "$undef")
6142                                 echo "Well, the $hint value is *not* secure." >&4
6143                                 dflt=n;;
6144                         *)      echo "Well, the $hint value *is* secure." >&4
6145                                 dflt=y;;
6146                         esac
6147                         ;;
6148                 *)
6149                         $rm -f reflect flect
6150                         echo "#!$ls" >reflect
6151                         chmod +x,u+s reflect
6152                         echo >flect
6153                         chmod a+w flect
6154                         echo '"su" will (probably) prompt you for '"$ans's password."
6155                         su $ans -c './reflect >flect'
6156                         if $contains "/dev/fd" flect >/dev/null; then
6157                                 echo "Okay, it looks like setuid scripts are secure." >&4
6158                                 dflt=y
6159                         else
6160                                 echo "I don't think setuid scripts are secure." >&4
6161                                 dflt=n
6162                         fi
6163                         ;;
6164                 esac
6165                 rp='Does your kernel have *secure* setuid scripts?'
6166                 . ./myread
6167                 case "$ans" in
6168                 [yY]*)  val="$define";;
6169                 *)      val="$undef";;
6170                 esac
6171         fi
6172 else
6173         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6174         echo "(That's for file descriptors, not floppy disks.)"
6175         val="$undef"
6176 fi
6177 set d_suidsafe
6178 eval $setvar
6179
6180 $rm -f reflect flect
6181
6182 : now see if they want to do setuid emulation
6183 echo " "
6184 val="$undef"
6185 case "$d_suidsafe" in
6186 "$define")
6187         val="$undef"
6188         echo "No need to emulate SUID scripts since they are secure here." >&4
6189         ;;
6190 *)
6191         $cat <<EOM
6192 Some systems have disabled setuid scripts, especially systems where
6193 setuid scripts cannot be secure.  On systems where setuid scripts have
6194 been disabled, the setuid/setgid bits on scripts are currently
6195 useless.  It is possible for $package to detect those bits and emulate
6196 setuid/setgid in a secure fashion.  This emulation will only work if
6197 setuid scripts have been disabled in your kernel.
6198
6199 EOM
6200         case "$d_dosuid" in
6201         "$define") dflt=y ;;
6202         *) dflt=n ;;
6203         esac
6204         rp="Do you want to do setuid/setgid emulation?"
6205         . ./myread
6206         case "$ans" in
6207         [yY]*)  val="$define";;
6208         *)      val="$undef";;
6209         esac
6210         ;;
6211 esac
6212 set d_dosuid
6213 eval $setvar
6214
6215 : see if this is a malloc.h system
6216 : we want a real compile instead of Inhdr because some systems have a
6217 : malloc.h that just gives a compile error saying to use stdlib.h instead
6218 echo " "
6219 $cat >try.c <<EOCP
6220 #include <stdlib.h>
6221 #include <malloc.h>
6222 int main () { return 0; }
6223 EOCP
6224 set try
6225 if eval $compile; then
6226     echo "<malloc.h> found." >&4
6227     val="$define"
6228 else
6229     echo "<malloc.h> NOT found." >&4
6230     val="$undef"
6231 fi
6232 $rm -f try.c try
6233 set i_malloc
6234 eval $setvar
6235
6236 : check for void type
6237 echo " "
6238 echo "Checking to see how well your C compiler groks the void type..." >&4
6239 case "$voidflags" in
6240 '')
6241         $cat >try.c <<EOCP
6242 #$i_stdlib I_STDLIB
6243 #ifdef I_STDLIB
6244 #include <stdlib.h>
6245 #endif
6246 #if TRY & 1
6247 void sub() {
6248 #else
6249 sub() {
6250 #endif
6251         extern void moo();      /* function returning void */
6252         void (*goo)();          /* ptr to func returning void */
6253 #if TRY & 8
6254         void *hue;              /* generic ptr */
6255 #endif
6256 #if TRY & 2
6257         void (*foo[10])();
6258 #endif
6259
6260 #if TRY & 4
6261         if(goo == moo) {
6262                 exit(0);
6263         }
6264 #endif
6265         exit(0);
6266 }
6267 int main() { sub(); }
6268 EOCP
6269         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6270                 voidflags=$defvoidused
6271         echo "Good.  It appears to support void to the level $package wants.">&4
6272                 if $contains warning .out >/dev/null 2>&1; then
6273                         echo "However, you might get some warnings that look like this:"
6274                         $cat .out
6275                 fi
6276         else
6277 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6278                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6279                         echo "It supports 1..."
6280                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6281                                 echo "It also supports 2..."
6282                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6283                                         voidflags=7
6284                                         echo "And it supports 4 but not 8 definitely."
6285                                 else
6286                                         echo "It doesn't support 4..."
6287                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6288                                                 voidflags=11
6289                                                 echo "But it supports 8."
6290                                         else
6291                                                 voidflags=3
6292                                                 echo "Neither does it support 8."
6293                                         fi
6294                                 fi
6295                         else
6296                                 echo "It does not support 2..."
6297                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6298                                         voidflags=13
6299                                         echo "But it supports 4 and 8."
6300                                 else
6301                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6302                                                 voidflags=5
6303                                                 echo "And it supports 4 but has not heard about 8."
6304                                         else
6305                                                 echo "However it supports 8 but not 4."
6306                                         fi
6307                                 fi
6308                         fi
6309                 else
6310                         echo "There is no support at all for void."
6311                         voidflags=0
6312                 fi
6313         fi
6314 esac
6315 case "$voidflags" in
6316 "$defvoidused") ;;
6317 *)      $cat >&4 <<'EOM'
6318   Support flag bits are:
6319     1: basic void declarations.
6320     2: arrays of pointers to functions returning void.
6321     4: operations between pointers to and addresses of void functions.
6322     8: generic void pointers.
6323 EOM
6324         dflt="$voidflags";
6325         rp="Your void support flags add up to what?"
6326         . ./myread
6327         voidflags="$ans"
6328         ;;
6329 esac
6330 $rm -f try.* .out
6331
6332 : check for length of pointer
6333 echo " "
6334 case "$ptrsize" in
6335 '')
6336         echo "Checking to see how big your pointers are..." >&4
6337         if test "$voidflags" -gt 7; then
6338                 echo '#define VOID_PTR char *' > try.c
6339         else
6340                 echo '#define VOID_PTR void *' > try.c
6341         fi
6342         $cat >>try.c <<EOCP
6343 #include <stdio.h>
6344 #$i_stdlib I_STDLIB
6345 #ifdef I_STDLIB
6346 #include <stdlib.h>
6347 #endif
6348 int main()
6349 {
6350     printf("%d\n", (int)sizeof(VOID_PTR));
6351     exit(0);
6352 }
6353 EOCP
6354         set try
6355         if eval $compile_ok; then
6356                 ptrsize=`$run ./try`
6357                 echo "Your pointers are $ptrsize bytes long."
6358         else
6359                 dflt='4'
6360                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6361                 rp="What is the size of a pointer (in bytes)?"
6362                 . ./myread
6363                 ptrsize="$ans"
6364         fi
6365         ;;
6366 esac
6367 $rm -f try.c try
6368 case "$use64bitall" in
6369 "$define"|true|[yY]*)
6370         case "$ptrsize" in
6371         4)      cat <<EOM >&4
6372
6373 *** You have chosen a maximally 64-bit build,
6374 *** but your pointers are only 4 bytes wide.
6375 *** Please rerun Configure without -Duse64bitall.
6376 EOM
6377                 case "$d_quad" in
6378                 define)
6379                         cat <<EOM >&4
6380 *** Since you have quads, you could possibly try with -Duse64bitint.
6381 EOM
6382                         ;;
6383                 esac
6384                 cat <<EOM >&4
6385 *** Cannot continue, aborting.
6386
6387 EOM
6388
6389                 exit 1
6390                 ;;
6391         esac
6392         ;;
6393 esac
6394
6395
6396 : determine whether to use malloc wrapping
6397 echo " "
6398 case "$usemallocwrap" in
6399 [yY]*|true|$define)     dflt='y' ;;
6400 [nN]*|false|$undef)     dflt='n' ;;
6401 *)      case "$usedevel" in
6402         [yY]*|true|$define)     dflt='y' ;;
6403         *) dflt='n' ;;
6404         esac
6405         ;;
6406 esac
6407 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6408 . ./myread
6409 usemallocwrap="$ans"
6410 case "$ans" in
6411 y*|true)
6412         usemallocwrap="$define" ;;
6413 *)
6414         usemallocwrap="$undef" ;;
6415 esac
6416
6417 : determine which malloc to compile in
6418 echo " "
6419 case "$usemymalloc" in
6420 [yY]*|true|$define)     dflt='y' ;;
6421 [nN]*|false|$undef)     dflt='n' ;;
6422 *)      case "$ptrsize" in
6423         4) dflt='y' ;;
6424         *) dflt='n' ;;
6425         esac
6426         ;;
6427 esac
6428 rp="Do you wish to attempt to use the malloc that comes with $package?"
6429 . ./myread
6430 usemymalloc="$ans"
6431 case "$ans" in
6432 y*|true)
6433         usemymalloc='y'
6434         mallocsrc='malloc.c'
6435         mallocobj="malloc$_o"
6436         d_mymalloc="$define"
6437         case "$libs" in
6438         *-lmalloc*)
6439                 : Remove malloc from list of libraries to use
6440                 echo "Removing unneeded -lmalloc from library list" >&4
6441                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6442                 shift
6443                 libs="$*"
6444                 echo "libs = $libs" >&4
6445                 ;;
6446         esac
6447         ;;
6448 *)
6449         usemymalloc='n'
6450         mallocsrc=''
6451         mallocobj=''
6452         d_mymalloc="$undef"
6453         ;;
6454 esac
6455
6456 : compute the return types of malloc and free
6457 echo " "
6458 $cat >malloc.c <<END
6459 #$i_malloc I_MALLOC
6460 #$i_stdlib I_STDLIB
6461 #include <stdio.h>
6462 #include <sys/types.h>
6463 #ifdef I_MALLOC
6464 #include <malloc.h>
6465 #endif
6466 #ifdef I_STDLIB
6467 #include <stdlib.h>
6468 #endif
6469 #ifdef TRY_MALLOC
6470 void *malloc();
6471 #endif
6472 #ifdef TRY_FREE
6473 void free();
6474 #endif
6475 END
6476 case "$malloctype" in
6477 '')
6478         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6479                 malloctype='void *'
6480         else
6481                 malloctype='char *'
6482         fi
6483         ;;
6484 esac
6485 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6486
6487 case "$freetype" in
6488 '')
6489         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6490                 freetype='void'
6491         else
6492                 freetype='int'
6493         fi
6494         ;;
6495 esac
6496 echo "Your system uses $freetype free(), it would seem." >&4
6497 $rm -f malloc.[co]
6498 $cat <<EOM
6499
6500 After $package is installed, you may wish to install various
6501 add-on modules and utilities.  Typically, these add-ons will
6502 be installed under $prefix with the rest
6503 of this package.  However, you may wish to install such add-ons
6504 elsewhere under a different prefix.
6505
6506 If you do not wish to put everything under a single prefix, that's
6507 ok.  You will be prompted for the individual locations; this siteprefix
6508 is only used to suggest the defaults.
6509
6510 The default should be fine for most people.
6511
6512 EOM
6513 fn=d~+
6514 rp='Installation prefix to use for add-on modules and utilities?'
6515 : XXX Here might be another good place for an installstyle setting.
6516 case "$siteprefix" in
6517 '') dflt=$prefix ;;
6518 *)  dflt=$siteprefix ;;
6519 esac
6520 . ./getfile
6521 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6522 oldsiteprefix=''
6523 case "$siteprefix" in
6524 '') ;;
6525 *)      case "$ans" in
6526         "$prefix") ;;
6527         *) oldsiteprefix="$prefix";;
6528         esac
6529         ;;
6530 esac
6531 siteprefix="$ans"
6532 siteprefixexp="$ansexp"
6533
6534 : determine where site specific libraries go.
6535 : Usual default is /usr/local/lib/perl5/site_perl/$version
6536 : The default "style" setting is made in installstyle.U
6537 : XXX No longer works with Prefixit stuff.
6538 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6539 case "$sitelib" in
6540 '') case "$installstyle" in
6541         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6542         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6543         esac
6544         ;;
6545 *)      dflt="$sitelib"
6546         ;;
6547 esac
6548 $cat <<EOM
6549
6550 The installation process will create a directory for
6551 site-specific extensions and modules.  Most users find it convenient
6552 to place all site-specific files in this directory rather than in the
6553 main distribution directory.
6554
6555 EOM
6556 fn=d~+
6557 rp='Pathname for the site-specific library files?'
6558 . ./getfile
6559 prefixvar=sitelib
6560 . ./setprefixvar
6561 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6562
6563 : determine where site specific architecture-dependent libraries go.
6564 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6565 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6566 : sitelib may have an optional trailing /share.
6567 case "$sitearch" in
6568 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6569         dflt="$dflt/$archname"
6570         ;;
6571 *)      dflt="$sitearch"
6572         ;;
6573 esac
6574 set sitearch sitearch none
6575 eval $prefixit
6576 $cat <<EOM
6577
6578 The installation process will also create a directory for
6579 architecture-dependent site-specific extensions and modules.
6580
6581 EOM
6582 fn=d~+
6583 rp='Pathname for the site-specific architecture-dependent library files?'
6584 . ./getfile
6585 prefixvar=sitearch
6586 . ./setprefixvar
6587
6588 $cat <<EOM
6589
6590 The installation process will also create a directory for
6591 vendor-supplied add-ons.  Vendors who supply perl with their system
6592 may find it convenient to place all vendor-supplied files in this
6593 directory rather than in the main distribution directory.  This will
6594 ease upgrades between binary-compatible maintenance versions of perl.
6595
6596 Of course you may also use these directories in whatever way you see
6597 fit.  For example, you might use them to access modules shared over a
6598 company-wide network.
6599
6600 The default answer should be fine for most people.
6601 This causes further questions about vendor add-ons to be skipped
6602 and no vendor-specific directories will be configured for perl.
6603
6604 EOM
6605 rp='Do you want to configure vendor-specific add-on directories?'
6606 case "$usevendorprefix" in
6607 define|true|[yY]*) dflt=y ;;
6608 *)      : User may have set vendorprefix directly on Configure command line.
6609         case "$vendorprefix" in
6610         ''|' ') dflt=n ;;
6611         *)      dflt=y ;;
6612         esac
6613         ;;
6614 esac
6615 . ./myread
6616 case "$ans" in
6617 [yY]*)  fn=d~+
6618         rp='Installation prefix to use for vendor-supplied add-ons?'
6619         case "$vendorprefix" in
6620         '') dflt='' ;;
6621         *)  dflt=$vendorprefix ;;
6622         esac
6623         . ./getfile
6624         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6625         oldvendorprefix=''
6626         case "$vendorprefix" in
6627         '') ;;
6628         *)      case "$ans" in
6629                 "$prefix") ;;
6630                 *) oldvendorprefix="$prefix";;
6631                 esac
6632                 ;;
6633         esac
6634         usevendorprefix="$define"
6635         vendorprefix="$ans"
6636         vendorprefixexp="$ansexp"
6637         ;;
6638 *)      usevendorprefix="$undef"
6639         vendorprefix=''
6640         vendorprefixexp=''
6641         ;;
6642 esac
6643
6644 case "$vendorprefix" in
6645 '')     d_vendorlib="$undef"
6646         vendorlib=''
6647         vendorlibexp=''
6648         ;;
6649 *)      d_vendorlib="$define"
6650         : determine where vendor-supplied modules go.
6651         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6652         case "$vendorlib" in
6653         '')
6654                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6655                 case "$installstyle" in
6656                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6657                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6658                 esac
6659                 ;;
6660         *)      dflt="$vendorlib"
6661                 ;;
6662         esac
6663         fn=d~+
6664         rp='Pathname for the vendor-supplied library files?'
6665         . ./getfile
6666         vendorlib="$ans"
6667         vendorlibexp="$ansexp"
6668         ;;
6669 esac
6670 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6671 prefixvar=vendorlib
6672 . ./installprefix
6673
6674 case "$vendorprefix" in
6675 '')     d_vendorarch="$undef"
6676         vendorarch=''
6677         vendorarchexp=''
6678         ;;
6679 *)      d_vendorarch="$define"
6680         : determine where vendor-supplied architecture-dependent libraries go.
6681         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6682         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6683         : vendorlib may have an optional trailing /share.
6684         case "$vendorarch" in
6685         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6686                 dflt="$dflt/$archname"
6687                 ;;
6688         *)      dflt="$vendorarch" ;;
6689         esac
6690         fn=d~+
6691         rp='Pathname for vendor-supplied architecture-dependent files?'
6692         . ./getfile
6693         vendorarch="$ans"
6694         vendorarchexp="$ansexp"
6695         ;;
6696 esac
6697 prefixvar=vendorarch
6698 . ./installprefix
6699
6700 : Final catch-all directories to search
6701 $cat <<EOM
6702
6703 Lastly, you can have perl look in other directories for extensions and
6704 modules in addition to those already specified.
6705 These directories will be searched after 
6706         $sitearch 
6707         $sitelib 
6708 EOM
6709 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6710 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6711 echo ' '
6712 case "$otherlibdirs" in
6713 ''|' ') dflt='none' ;;
6714 *)      dflt="$otherlibdirs" ;;
6715 esac
6716 $cat <<EOM
6717 Enter a colon-separated set of extra paths to include in perl's @INC
6718 search path, or enter 'none' for no extra paths.
6719
6720 EOM
6721
6722 rp='Colon-separated list of additional directories for perl to search?'
6723 . ./myread
6724 case "$ans" in
6725 ' '|''|none)    otherlibdirs=' ' ;;     
6726 *)      otherlibdirs="$ans" ;;
6727 esac
6728 case "$otherlibdirs" in
6729 ' ') val=$undef ;;
6730 *)      val=$define ;;
6731 esac
6732 set d_perl_otherlibdirs
6733 eval $setvar
6734
6735 : Cruising for prototypes
6736 echo " "
6737 echo "Checking out function prototypes..." >&4
6738 $cat >prototype.c <<EOCP
6739 #$i_stdlib I_STDLIB
6740 #ifdef I_STDLIB
6741 #include <stdlib.h>
6742 #endif
6743 int main(int argc, char *argv[]) {
6744         exit(0);}
6745 EOCP
6746 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6747         echo "Your C compiler appears to support function prototypes."
6748         val="$define"
6749 else
6750         echo "Your C compiler doesn't seem to understand function prototypes."
6751         val="$undef"
6752 fi
6753 set prototype
6754 eval $setvar
6755 $rm -f prototype*
6756
6757 case "$prototype" in
6758 "$define") ;;
6759 *)      ansi2knr='ansi2knr'
6760         echo " "
6761         cat <<EOM >&4
6762
6763 $me:  FATAL ERROR:
6764 This version of $package can only be compiled by a compiler that 
6765 understands function prototypes.  Unfortunately, your C compiler 
6766         $cc $ccflags
6767 doesn't seem to understand them.  Sorry about that.
6768
6769 If GNU cc is available for your system, perhaps you could try that instead.  
6770
6771 Eventually, we hope to support building Perl with pre-ANSI compilers.
6772 If you would like to help in that effort, please contact <perlbug@perl.org>.
6773
6774 Aborting Configure now.
6775 EOM
6776         exit 2
6777         ;;
6778 esac
6779
6780 echo " "
6781 case "$extras" in
6782 '') dflt='n';;
6783 *) dflt='y';;
6784 esac
6785 cat <<EOM
6786 Perl can be built with extra modules or bundles of modules which
6787 will be fetched from the CPAN and installed alongside Perl.
6788
6789 Notice that you will need access to the CPAN; either via the Internet,
6790 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
6791 be asked later to configure the CPAN.pm module which will in turn do
6792 the installation of the rest of the extra modules or bundles.)
6793
6794 Notice also that if the modules require any external software such as
6795 libraries and headers (the libz library and the zlib.h header for the
6796 Compress::Zlib module, for example) you MUST have any such software
6797 already installed, this configuration process will NOT install such
6798 things for you.
6799
6800 If this doesn't make any sense to you, just accept the default '$dflt'.
6801 EOM
6802 rp='Install any extra modules (y or n)?'
6803 . ./myread
6804 case "$ans" in
6805 y|Y)
6806         cat <<EOM
6807
6808 Please list any extra modules or bundles to be installed from CPAN,
6809 with spaces between the names.  The names can be in any format the
6810 'install' command of CPAN.pm will understand.  (Answer 'none',
6811 without the quotes, to install no extra modules or bundles.)
6812 EOM
6813         rp='Extras?'
6814         dflt="$extras"
6815         . ./myread
6816         extras="$ans"
6817 esac
6818 case "$extras" in
6819 ''|'none')
6820         val=''
6821         $rm -f ../extras.lst
6822         ;;
6823 *)      echo "(Saving the list of extras for later...)"
6824         echo "$extras" > ../extras.lst
6825         val="'$extras'"
6826         ;;
6827 esac
6828 set extras
6829 eval $setvar
6830 echo " "
6831
6832 : determine where html pages for programs go
6833 set html1dir html1dir none
6834 eval $prefixit
6835 $cat <<EOM
6836
6837 If you wish to install html files for programs in $spackage, indicate 
6838 the appropriate directory here.  To skip installing html files,
6839 answer "none".
6840 EOM
6841 case "$html1dir" in
6842 ''|none|$undef|' ') dflt=none ;;
6843 *) dflt=$html1dir ;;
6844 esac
6845 fn=dn+~
6846 rp="Directory for the main $spackage html pages?"
6847 . ./getfile
6848 prefixvar=html1dir
6849 . ./setprefixvar
6850 : Use ' ' for none so value is preserved next time through Configure
6851 $test X"$html1dir" = "X" && html1dir=' '
6852
6853 : determine where html pages for libraries and modules go
6854 set html3dir html3dir none
6855 eval $prefixit
6856 $cat <<EOM
6857
6858 If you wish to install html files for modules associated with $spackage,
6859 indicate the appropriate directory here.  To skip installing html files,
6860 answer "none".
6861 EOM
6862 : There is no obvious default.  If they have specified html1dir, then
6863 : try to key off that, possibly changing .../html1 into .../html3.
6864 case "$html3dir" in
6865 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
6866 *) dflt=$html3dir ;;
6867 esac
6868 fn=dn+~
6869 rp="Directory for the $spackage module html pages?"
6870 . ./getfile
6871 prefixvar=html3dir
6872 . ./setprefixvar
6873 : Use ' ' for none so value is preserved next time through Configure
6874 $test X"$html3dir" = "X" && html3dir=' '
6875
6876 : Find perl5.005 or later.
6877 echo "Looking for a previously installed perl5.005 or later... "
6878 case "$perl5" in
6879 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6880                 : Check if this perl is recent and can load a simple module
6881                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6882                         perl5=$tdir/perl
6883                         break;
6884                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6885                         perl5=$tdir/perl5
6886                         break;
6887                 fi
6888         done
6889         ;;
6890 *)      perl5="$perl5"
6891         ;;
6892 esac
6893 case "$perl5" in
6894 '')     echo "None found.  That's ok.";;
6895 *)      echo "Using $perl5." ;;
6896 esac
6897
6898 : Determine list of previous versions to include in @INC
6899 $cat > getverlist <<EOPL
6900 #!$perl5 -w
6901 use File::Basename;
6902 \$api_versionstring = "$api_versionstring";
6903 \$version = "$version";
6904 \$stem = "$sitelib_stem";
6905 \$archname = "$archname";
6906 EOPL
6907         $cat >> getverlist <<'EOPL'
6908 # Can't have leading @ because metaconfig interprets it as a command!
6909 ;@inc_version_list=();
6910 # XXX Redo to do opendir/readdir? 
6911 if (-d $stem) {
6912     chdir($stem);
6913     ;@candidates = glob("5.*");
6914 }
6915 else {
6916     ;@candidates = ();
6917 }
6918
6919 # XXX ToDo:  These comparisons must be reworked when two-digit
6920 # subversions come along, so that 5.7.10 compares as greater than
6921 # 5.7.3!  By that time, hope that 5.6.x is sufficiently
6922 # widespread that we can use the built-in version vectors rather
6923 # than reinventing them here.  For 5.6.0, however, we must
6924 # assume this script will likely be run by 5.005_0x.  --AD 1/2000.
6925 foreach $d (@candidates) {
6926     if ($d lt $version) {
6927         if ($d ge $api_versionstring) {
6928             unshift(@inc_version_list, grep { -d } "$d/$archname", $d);
6929         }
6930         elsif ($d ge "5.005") {
6931             unshift(@inc_version_list, grep { -d } $d);
6932         }
6933     }
6934     else {
6935         # Skip newer version.  I.e. don't look in
6936         # 5.7.0 if we're installing 5.6.1.
6937     }
6938 }
6939
6940 if (@inc_version_list) {
6941     print join(' ', @inc_version_list);
6942 }
6943 else {
6944     # Blank space to preserve value for next Configure run.
6945     print " ";
6946 }
6947 EOPL
6948 chmod +x getverlist
6949 case "$inc_version_list" in
6950 '')     if test -x "$perl5$exe_ext"; then
6951                 dflt=`$perl5 getverlist`
6952         else
6953                 dflt='none'
6954         fi
6955         ;;
6956 $undef) dflt='none' ;;
6957 *)  eval dflt=\"$inc_version_list\" ;;
6958 esac
6959 case "$dflt" in
6960 ''|' ') dflt=none ;;
6961 esac
6962 case "$dflt" in
6963 5.005) dflt=none ;;
6964 esac
6965 $cat <<EOM
6966
6967 In order to ease the process of upgrading, this version of perl 
6968 can be configured to use modules built and installed with earlier 
6969 versions of perl that were installed under $prefix.  Specify here
6970 the list of earlier versions that this version of perl should check.
6971 If Configure detected no earlier versions of perl installed under
6972 $prefix, then the list will be empty.  Answer 'none' to tell perl
6973 to not search earlier versions.
6974
6975 The default should almost always be sensible, so if you're not sure,
6976 just accept the default.
6977 EOM
6978
6979 rp='List of earlier versions to include in @INC?'
6980 . ./myread
6981 case "$ans" in
6982 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6983 *) inc_version_list="$ans" ;;
6984 esac
6985 case "$inc_version_list" in
6986 ''|' ') 
6987         inc_version_list_init='0';;
6988 *)      inc_version_list_init=`echo $inc_version_list |
6989                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6990         ;;
6991 esac
6992 $rm -f getverlist
6993
6994 : determine whether to install perl also as /usr/bin/perl
6995
6996 echo " "
6997 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
6998         $cat <<EOM
6999 Many scripts expect perl to be installed as /usr/bin/perl.
7000
7001 If you want to, I can install the perl you are about to compile
7002 as /usr/bin/perl (in addition to $bin/perl).
7003 EOM
7004         if test -f /usr/bin/perl; then
7005             $cat <<EOM
7006
7007 However, please note that because you already have a /usr/bin/perl,
7008 overwriting that with a new Perl would very probably cause problems.
7009 Therefore I'm assuming you don't want to do that (unless you insist).
7010
7011 EOM
7012             case "$installusrbinperl" in
7013             "$define"|[yY]*)    dflt='y';;
7014             *)                  dflt='n';;
7015             esac
7016         else
7017             $cat <<EOM
7018
7019 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7020
7021 EOM
7022             case "$installusrbinperl" in
7023             "$undef"|[nN]*)     dflt='n';;
7024             *)                  dflt='y';;
7025             esac
7026         fi
7027         rp="Do you want to install perl as /usr/bin/perl?"
7028         . ./myread
7029         case "$ans" in
7030         [yY]*)  val="$define";;
7031         *)      val="$undef" ;;
7032         esac
7033 else
7034         val="$undef"
7035 fi
7036 set installusrbinperl
7037 eval $setvar
7038
7039 echo " "
7040 echo "Checking for GNU C Library..." >&4
7041 cat >try.c <<'EOCP'
7042 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7043    alone are insufficient to distinguish different versions, such as
7044    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7045    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7046 */
7047 #include <stdio.h>
7048 int main(void)
7049 {
7050 #ifdef __GLIBC__
7051 #   ifdef __GLIBC_MINOR__
7052 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1
7053 #           include <gnu/libc-version.h>
7054             printf("%s\n",  gnu_get_libc_version());
7055 #       else
7056             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7057 #       endif
7058 #   else
7059         printf("%d\n",  __GLIBC__);
7060 #   endif
7061     return 0;
7062 #else
7063     return 1;
7064 #endif
7065 }
7066 EOCP
7067 set try
7068 if eval $compile_ok && $run ./try > glibc.ver; then
7069         val="$define"
7070         gnulibc_version=`$cat glibc.ver`
7071         echo "You are using the GNU C Library version $gnulibc_version"
7072 else
7073         val="$undef"
7074         gnulibc_version=''
7075         echo "You are not using the GNU C Library"
7076 fi
7077 $rm -f try try.* glibc.ver
7078 set d_gnulibc
7079 eval $setvar
7080
7081 : see if nm is to be used to determine whether a symbol is defined or not
7082 case "$usenm" in
7083 '')
7084         dflt=''
7085         case "$d_gnulibc" in
7086         "$define")
7087                 echo " "
7088                 echo "nm probably won't work on the GNU C Library." >&4
7089                 dflt=n
7090                 ;;
7091         esac
7092         case "$dflt" in
7093         '') 
7094                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7095                         echo " "
7096                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7097                         echo "'nm' won't be sufficient on this sytem." >&4
7098                         dflt=n
7099                 fi
7100                 ;;
7101         esac
7102         case "$dflt" in
7103         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7104                 if $test $dflt -gt 20; then
7105                         dflt=y
7106                 else
7107                         dflt=n
7108                 fi
7109                 ;;
7110         esac
7111         ;;
7112 *)
7113         case "$usenm" in
7114         true|$define) dflt=y;;
7115         *) dflt=n;;
7116         esac
7117         ;;
7118 esac
7119 $cat <<EOM
7120
7121 I can use $nm to extract the symbols from your C libraries. This
7122 is a time consuming task which may generate huge output on the disk (up
7123 to 3 megabytes) but that should make the symbols extraction faster. The
7124 alternative is to skip the 'nm' extraction part and to compile a small
7125 test program instead to determine whether each symbol is present. If
7126 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7127 this may be the best solution.
7128
7129 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7130
7131 EOM
7132 rp="Shall I use $nm to extract C symbols from the libraries?"
7133 . ./myread
7134 case "$ans" in
7135 [Nn]*) usenm=false;;
7136 *) usenm=true;;
7137 esac
7138
7139 runnm=$usenm
7140 case "$reuseval" in
7141 true) runnm=false;;
7142 esac
7143
7144 : nm options which may be necessary
7145 case "$nm_opt" in
7146 '') if $test -f /mach_boot; then
7147                 nm_opt=''       # Mach
7148         elif $test -d /usr/ccs/lib; then
7149                 nm_opt='-p'     # Solaris (and SunOS?)
7150         elif $test -f /dgux; then
7151                 nm_opt='-p'     # DG-UX
7152         elif $test -f /lib64/rld; then
7153                 nm_opt='-p'     # 64-bit Irix
7154         else
7155                 nm_opt=''
7156         fi;;
7157 esac
7158
7159 : nm options which may be necessary for shared libraries but illegal
7160 : for archive libraries.  Thank you, Linux.
7161 case "$nm_so_opt" in
7162 '')     case "$myuname" in
7163         *linux*|gnu*)
7164                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7165                         nm_so_opt='--dynamic'
7166                 fi
7167                 ;;
7168         esac
7169         ;;
7170 esac
7171
7172 case "$runnm" in
7173 true)
7174 : get list of predefined functions in a handy place
7175 echo " "
7176 case "$libc" in
7177 '') libc=unknown
7178         case "$libs" in
7179         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7180         esac
7181         ;;
7182 esac
7183 case "$libs" in
7184 '') ;;
7185 *)  for thislib in $libs; do
7186         case "$thislib" in
7187         -lc|-lc_s)
7188                 : Handle C library specially below.
7189                 ;;
7190         -l*)
7191                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7192                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7193                         :
7194                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7195                         :
7196                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7197                         :
7198                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7199                         :
7200                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7201                         :
7202                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7203                         :
7204                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7205                         :
7206                 else
7207                         try=''
7208                 fi
7209                 libnames="$libnames $try"
7210                 ;;
7211         *) libnames="$libnames $thislib" ;;
7212         esac
7213         done
7214         ;;
7215 esac
7216 xxx=normal
7217 case "$libc" in
7218 unknown)
7219         set /lib/libc.$so
7220         for xxx in $libpth; do
7221                 $test -r $1 || set $xxx/libc.$so
7222                 : The messy sed command sorts on library version numbers.
7223                 $test -r $1 || \
7224                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7225                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7226                                 h
7227                                 s/[0-9][0-9]*/0000&/g
7228                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7229                                 G
7230                                 s/\n/ /' | \
7231                          $sort | $sed -e 's/^.* //'`
7232                 eval set \$$#
7233         done
7234         $test -r $1 || set /usr/ccs/lib/libc.$so
7235         $test -r $1 || set /lib/libsys_s$_a
7236         ;;
7237 *)
7238         set blurfl
7239         ;;
7240 esac
7241 if $test -r "$1"; then
7242         echo "Your (shared) C library seems to be in $1."
7243         libc="$1"
7244 elif $test -r /lib/libc && $test -r /lib/clib; then
7245         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7246         xxx=apollo
7247         libc='/lib/clib /lib/libc'
7248         if $test -r /lib/syslib; then
7249                 echo "(Your math library is in /lib/syslib.)"
7250                 libc="$libc /lib/syslib"
7251         fi
7252 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7253         echo "Your C library seems to be in $libc, as you said before."
7254 elif $test -r $incpath/usr/lib/libc$_a; then
7255         libc=$incpath/usr/lib/libc$_a;
7256         echo "Your C library seems to be in $libc.  That's fine."
7257 elif $test -r /lib/libc$_a; then
7258         libc=/lib/libc$_a;
7259         echo "Your C library seems to be in $libc.  You're normal."
7260 else
7261         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7262                 :
7263         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7264                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7265         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7266                 :
7267         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7268                 :
7269         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7270                 :
7271         else
7272                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7273         fi
7274         if $test -r "$tans"; then
7275                 echo "Your C library seems to be in $tans, of all places."
7276                 libc=$tans
7277         else
7278                 libc='blurfl'
7279         fi
7280 fi
7281 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7282         dflt="$libc"
7283         cat <<EOM
7284
7285 If the guess above is wrong (which it might be if you're using a strange
7286 compiler, or your machine supports multiple models), you can override it here.
7287
7288 EOM
7289 else
7290         dflt=''
7291         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7292         cat >&4 <<EOM
7293 I can't seem to find your C library.  I've looked in the following places:
7294
7295 EOM
7296         $sed 's/^/      /' libpath
7297         cat <<EOM
7298
7299 None of these seems to contain your C library. I need to get its name...
7300
7301 EOM
7302 fi
7303 fn=f
7304 rp='Where is your C library?'
7305 . ./getfile
7306 libc="$ans"
7307
7308 echo " "
7309 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7310 set X `cat libnames`
7311 shift
7312 xxx=files
7313 case $# in 1) xxx=file; esac
7314 echo "Extracting names from the following $xxx for later perusal:" >&4
7315 echo " "
7316 $sed 's/^/      /' libnames >&4
7317 echo " "
7318 $echo $n "This may take a while...$c" >&4
7319
7320 for file in $*; do
7321         case $file in
7322         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7323         *) $nm $nm_opt $file 2>/dev/null;;
7324         esac
7325 done >libc.tmp
7326
7327 $echo $n ".$c"
7328 $grep fprintf libc.tmp > libc.ptf
7329 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7330 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7331 xxx='[ADTSIW]'
7332 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7333         eval $xscan;\
7334         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7335                 eval $xrun
7336 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7337         eval $xscan;\
7338         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7339                 eval $xrun
7340 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7341         eval $xscan;\
7342         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7343                 eval $xrun
7344 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7345         eval $xscan;\
7346         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7347                 eval $xrun
7348 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7349         eval $xscan;\
7350         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7351                 eval $xrun
7352 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7353         eval $xscan;\
7354         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7355                 eval $xrun
7356 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7357                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7358         eval $xscan;\
7359         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7360                 eval $xrun
7361 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7362         eval $xscan;\
7363         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7364                 eval $xrun
7365 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7366         eval $xscan;\
7367         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7368                 eval $xrun
7369 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7370         eval $xscan;\
7371         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7372                 eval $xrun
7373 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7374         eval $xscan;\
7375         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7376                 eval $xrun
7377 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7378         eval $xscan;\
7379         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7380                 eval $xrun
7381 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7382         eval $xscan;\
7383         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7384                 eval $xrun
7385 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7386         eval $xscan;\
7387         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7388                 eval $xrun
7389 else
7390         $nm -p $* 2>/dev/null >libc.tmp
7391         $grep fprintf libc.tmp > libc.ptf
7392         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7393                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7394         then
7395                 nm_opt='-p'
7396                 eval $xrun
7397         else
7398                 echo " "
7399                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7400                 com=''
7401                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7402                         for thisname in $libnames $libc; do
7403                                 $ar t $thisname >>libc.tmp
7404                         done
7405                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7406                         echo "Ok." >&4
7407                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7408                         # Repeat libc to extract forwarders to DLL entries too
7409                         for thisname in $libnames $libc; do
7410                                 $ar tv $thisname >>libc.tmp
7411                                 # Revision 50 of EMX has bug in $ar.
7412                                 # it will not extract forwarders to DLL entries
7413                                 # Use emximp which will extract exactly them.
7414                                 emximp -o tmp.imp $thisname \
7415                                     2>/dev/null && \
7416                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7417                                     < tmp.imp >>libc.tmp
7418                                 $rm tmp.imp
7419                         done
7420                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7421                         echo "Ok." >&4
7422                 else
7423                         echo "$ar didn't seem to work right." >&4
7424                         echo "Maybe this is a Cray...trying bld instead..." >&4
7425                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7426                         then
7427                                 for thisname in $libnames; do
7428                                         bld t $libnames | \
7429                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7430                                         $ar t $thisname >>libc.tmp
7431                                 done
7432                                 echo "Ok." >&4
7433                         else
7434                                 echo "That didn't work either.  Giving up." >&4
7435                                 exit 1
7436                         fi
7437                 fi
7438         fi
7439 fi
7440 nm_extract="$com"
7441 case "$PASE" in
7442 define)
7443     echo " "
7444     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7445     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7446     ;;
7447 *)  if $test -f /lib/syscalls.exp; then
7448         echo " "
7449         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7450         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7451     fi
7452     ;;
7453 esac
7454 ;;
7455 esac
7456 $rm -f libnames libpath
7457
7458 : see if dld is available
7459 set dld.h i_dld
7460 eval $inhdr
7461
7462 : is a C symbol defined?
7463 csym='tlook=$1;
7464 case "$3" in
7465 -v) tf=libc.tmp; tdc="";;
7466 -a) tf=libc.tmp; tdc="[]";;
7467 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7468 esac;
7469 tx=yes;
7470 case "$reuseval-$4" in
7471 true-) ;;
7472 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7473 esac;
7474 case "$tx" in
7475 yes)
7476         tval=false;
7477         if $test "$runnm" = true; then
7478                 if $contains $tlook $tf >/dev/null 2>&1; then
7479                         tval=true;
7480                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7481                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7482                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7483                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7484                         $rm -f try$_exe try.c core core.* try.core;
7485                 fi;
7486         else
7487                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7488                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7489                 $rm -f try$_exe try.c;
7490         fi;
7491         ;;
7492 *)
7493         case "$tval" in
7494         $define) tval=true;;
7495         *) tval=false;;
7496         esac;
7497         ;;
7498 esac;
7499 eval "$2=$tval"'
7500
7501 : define an is-in-libc? function
7502 inlibc='echo " "; td=$define; tu=$undef;
7503 sym=$1; var=$2; eval "was=\$$2";
7504 tx=yes;
7505 case "$reuseval$was" in
7506 true) ;;
7507 true*) tx=no;;
7508 esac;
7509 case "$tx" in
7510 yes)
7511         set $sym tres -f;
7512         eval $csym;
7513         case "$tres" in
7514         true)
7515                 echo "$sym() found." >&4;
7516                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7517         *)
7518                 echo "$sym() NOT found." >&4;
7519                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7520         esac;;
7521 *)
7522         case "$was" in
7523         $define) echo "$sym() found." >&4;;
7524         *) echo "$sym() NOT found." >&4;;
7525         esac;;
7526 esac'
7527
7528 : see if dlopen exists
7529 xxx_runnm="$runnm"
7530 runnm=false
7531 set dlopen d_dlopen
7532 eval $inlibc
7533 runnm="$xxx_runnm"
7534
7535 : determine which dynamic loading, if any, to compile in
7536 echo " "
7537 dldir="ext/DynaLoader"
7538 case "$usedl" in
7539 $define|y|true)
7540         dflt='y'
7541         usedl="$define"
7542         ;;
7543 $undef|n|false)
7544         dflt='n'
7545         usedl="$undef"
7546         ;;
7547 *) 
7548         dflt='n'
7549         case "$d_dlopen" in
7550             $define) dflt='y' ;;
7551         esac
7552         case "$i_dld" in
7553             $define) dflt='y' ;;
7554         esac
7555         : Does a dl_xxx.xs file exist for this operating system
7556         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7557         ;;
7558 esac
7559 rp="Do you wish to use dynamic loading?"
7560 . ./myread
7561 usedl="$ans"
7562 case "$ans" in
7563 y*) usedl="$define"
7564         case "$dlsrc" in
7565         '')
7566                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7567                         dflt="$dldir/dl_${osname}.xs"
7568                 elif $test "$d_dlopen" = "$define" ; then
7569                         dflt="$dldir/dl_dlopen.xs"
7570                 elif $test "$i_dld" = "$define" ; then
7571                         dflt="$dldir/dl_dld.xs"
7572                 else
7573                         dflt=''
7574                 fi
7575                 ;;
7576         *)      dflt="$dldir/$dlsrc"
7577                 ;;
7578         esac
7579     echo "The following dynamic loading files are available:"
7580         : Can not go over to $dldir because getfile has path hard-coded in.
7581         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7582         rp="Source file to use for dynamic loading"
7583         fn="fne"
7584         gfpth="$src"
7585         . ./getfile
7586         usedl="$define"
7587         : emulate basename
7588         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7589
7590         $cat << EOM
7591
7592 Some systems may require passing special flags to $cc -c to
7593 compile modules that will be used to create a shared library.
7594 To use no flags, say "none".
7595
7596 EOM
7597     case "$cccdlflags" in
7598     '') case "$gccversion" in
7599                 '') case "$osname" in
7600                         hpux)   dflt='+z' ;;
7601                         next)   dflt='none' ;;
7602                         irix*)  dflt='-KPIC' ;;
7603                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7604                         sunos)  dflt='-pic' ;;
7605                         *)      dflt='none' ;;
7606                     esac
7607                         ;;
7608                 *)  case "$osname" in
7609                         darwin) dflt='none' ;;
7610                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7611                         *)      dflt='-fpic' ;;
7612                     esac ;;
7613             esac ;;
7614         ' ') dflt='none' ;;
7615     *)  dflt="$cccdlflags" ;;
7616     esac
7617     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7618     . ./myread
7619     case "$ans" in
7620     none) cccdlflags=' ' ;;
7621     *) cccdlflags="$ans" ;;
7622     esac
7623
7624     cat << EOM
7625
7626 Some systems use ld to create libraries that can be dynamically loaded,
7627 while other systems (such as those using ELF) use $cc.
7628
7629 EOM
7630         case "$ld" in
7631         '')     $cat >try.c <<EOM
7632 /* Test for whether ELF binaries are produced */
7633 #include <fcntl.h>
7634 #$i_stdlib I_STDLIB
7635 #ifdef I_STDLIB
7636 #include <stdlib.h>
7637 #endif
7638 int main() {
7639         char b[4];
7640         int i = open("a.out",O_RDONLY);
7641         if(i == -1) 
7642                 exit(1); /* fail */
7643         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7644                 exit(0); /* succeed (yes, it's ELF) */
7645         else
7646                 exit(1); /* fail */
7647 }
7648 EOM
7649                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7650                         cat <<EOM
7651 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7652 EOM
7653                         dflt="$cc"
7654                 else
7655                         echo "I'll use ld to build dynamic libraries."
7656                         dflt='ld'
7657                 fi
7658                 rm -f try.c a.out
7659                 ;;
7660         *)      dflt="$ld"
7661                 ;;
7662         esac
7663
7664     rp="What command should be used to create dynamic libraries?"
7665     . ./myread
7666         ld="$ans"
7667
7668     cat << EOM
7669
7670 Some systems may require passing special flags to $ld to create a
7671 library that can be dynamically loaded.  If your ld flags include
7672 -L/other/path options to locate libraries outside your loader's normal
7673 search path, you may need to specify those -L options here as well.  To
7674 use no flags, say "none".
7675
7676 EOM
7677     case "$lddlflags" in
7678     '') case "$osname" in
7679                         beos) dflt='-nostart' ;;
7680                         hpux) dflt='-b';
7681                               case "$gccversion" in
7682                               '') dflt="$dflt +vnocompatwarnings" ;;
7683                               esac
7684                               ;;        
7685                         linux|irix*|gnu*)       dflt='-shared' ;;
7686                         next)  dflt='none' ;;
7687                         solaris) dflt='-G' ;;
7688                         sunos) dflt='-assert nodefinitions' ;;
7689                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7690                 *)     dflt='none' ;;
7691                         esac
7692                         ;;
7693     *) dflt="$lddlflags" ;;
7694     esac
7695
7696         : Try to guess additional flags to pick up local libraries.
7697         : Be careful not to append to a plain 'none'
7698         case "$dflt" in
7699         none) dflt='' ;;
7700         esac
7701         for thisflag in $ldflags; do
7702                 case "$thisflag" in
7703                 -L*|-R*|-Wl,-R*)
7704                         case " $dflt " in
7705                         *" $thisflag "*) ;;
7706                         *) dflt="$dflt $thisflag" ;;
7707                         esac
7708                         ;;
7709                 esac
7710         done
7711
7712         case "$dflt" in
7713         ''|' ') dflt='none' ;;
7714         esac
7715
7716     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7717     . ./myread
7718     case "$ans" in
7719     none) lddlflags=' ' ;;
7720     *) lddlflags="$ans" ;;
7721     esac
7722
7723         cat <<EOM
7724
7725 Some systems may require passing special flags to $cc to indicate that
7726 the resulting executable will use dynamic linking.  To use no flags,
7727 say "none".
7728
7729 EOM
7730     case "$ccdlflags" in
7731     '') case "$osname" in
7732             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7733             next|sunos) dflt='none' ;;
7734             *)          dflt='none' ;;
7735             esac ;;
7736     ' ')  dflt='none' ;;
7737     *)  dflt="$ccdlflags" ;;
7738     esac
7739     rp="Any special flags to pass to $cc to use dynamic linking?"
7740     . ./myread
7741     case "$ans" in
7742     none) ccdlflags=' ' ;;
7743     *) ccdlflags="$ans" ;;
7744     esac
7745     ;;
7746 *)  usedl="$undef"
7747         ld='ld'
7748     dlsrc='dl_none.xs'
7749     lddlflags=''
7750     ccdlflags=''
7751     ;;
7752 esac
7753
7754 also=''
7755 case "$usedl" in
7756 $undef)
7757         # No dynamic loading being used, so don't bother even to prompt.
7758         useshrplib='false'
7759         ;;
7760 *)      case "$useshrplib" in
7761         '')     case "$osname" in
7762                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7763                         dflt=y
7764                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7765                         ;;
7766                 next*)
7767                         case "$osvers" in
7768                         4*)     dflt=y
7769                                 also='Building a shared libperl is needed for MAB support.'
7770                                 ;;
7771                         *)      dflt=n
7772                                 ;;
7773                         esac
7774                         ;;
7775                 *)      dflt=n
7776                         ;;
7777                 esac
7778                 ;;
7779         $define|true|[Yy]*)
7780                 dflt=y
7781                 ;;
7782         *)      dflt=n
7783                 ;;
7784         esac
7785         $cat << EOM
7786
7787 The perl executable is normally obtained by linking perlmain.c with
7788 libperl${_a}, any static extensions (usually just DynaLoader), and
7789 any other libraries needed on this system (such as -lm, etc.).  Since
7790 your system supports dynamic loading, it is probably possible to build
7791 a shared libperl.$so.  If you will have more than one executable linked
7792 to libperl.$so, this will significantly reduce the size of each
7793 executable, but it may have a noticeable effect on performance.  The
7794 default is probably sensible for your system.
7795 $also
7796
7797 EOM
7798         rp="Build a shared libperl.$so (y/n)"
7799         . ./myread
7800         case "$ans" in
7801         true|$define|[Yy]*)
7802                 useshrplib='true'  ;;
7803         *)      useshrplib='false' ;;
7804         esac
7805         ;;
7806 esac
7807
7808 case "$useshrplib" in
7809 true)
7810         case "$libperl" in
7811         '')
7812                 # Figure out a good name for libperl.so.  Since it gets stored in
7813                 # a version-specific architecture-dependent library, the version
7814                 # number isn't really that important, except for making cc/ld happy.
7815                 #
7816                 # A name such as libperl.so.3.1
7817                 majmin="libperl.$so.$patchlevel.$subversion"
7818                 # A name such as libperl.so.301
7819                 majonly=`echo $patchlevel $subversion |
7820                         $awk '{printf "%d%02d", $1, $2}'`
7821                 majonly=libperl.$so.$majonly
7822                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7823                 # rely on figuring it out from the naming of libc.
7824                 case "${osname}${osvers}" in
7825                 next4*)
7826                         dflt=libperl.5.$so
7827                         # XXX How handle the --version stuff for MAB?
7828                         ;;
7829                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7830                         dflt=libperl.$so
7831                         ;;
7832                 cygwin*) # ld links against an importlib
7833                         dflt=libperl$lib_ext
7834                         ;;
7835                 *)      # Try to guess based on whether libc has major.minor.
7836                         case "$libc" in
7837                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7838                         *libc.$so.[0-9]*) dflt=$majonly ;;
7839                         *)      dflt=libperl.$so ;;
7840                         esac
7841                         ;;
7842                 esac
7843                 ;;
7844         *)      dflt=$libperl
7845                 ;;
7846         esac
7847         cat << EOM
7848
7849 I need to select a good name for the shared libperl.  If your system uses
7850 library names with major and minor numbers, then you might want something
7851 like $majmin.  Alternatively, if your system uses a single version
7852 number for shared libraries, then you might want to use $majonly.
7853 Or, your system might be quite happy with a simple libperl.$so.
7854
7855 Since the shared libperl will get installed into a version-specific
7856 architecture-dependent directory, the version number of the shared perl
7857 library probably isn't important, so the default should be o.k.
7858
7859 EOM
7860         rp='What name do you want to give to the shared libperl?'
7861         . ./myread
7862         libperl=$ans
7863         echo "Ok, I'll use $libperl"
7864         ;;
7865 *)
7866         libperl="libperl${_a}"
7867         ;;
7868 esac
7869
7870 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
7871 case "$shrpdir" in
7872 '') ;;
7873 *)      $cat >&4 <<EOM
7874 WARNING:  Use of the shrpdir variable for the installation location of
7875 the shared $libperl is not supported.  It was never documented and
7876 will not work in this version.  Let me (perlbug@perl.org)
7877 know of any problems this may cause.
7878
7879 EOM
7880         case "$shrpdir" in
7881         "$archlibexp/CORE")
7882                 $cat >&4 <<EOM
7883 But your current setting of $shrpdir is
7884 the default anyway, so it's harmless.
7885 EOM
7886                 ;;
7887         *)
7888                 $cat >&4 <<EOM
7889 Further, your current attempted setting of $shrpdir
7890 conflicts with the value of $archlibexp/CORE
7891 that installperl will use.
7892 EOM
7893                 ;;
7894         esac
7895         ;;
7896 esac
7897
7898 # How will the perl executable find the installed shared $libperl?
7899 # Add $xxx to ccdlflags.
7900 # If we can't figure out a command-line option, use $shrpenv to
7901 # set env LD_RUN_PATH.  The main perl makefile uses this.
7902 shrpdir=$archlibexp/CORE
7903 xxx=''
7904 tmp_shrpenv=''
7905 if "$useshrplib"; then
7906     case "$osname" in 
7907         aix)
7908                 # We'll set it in Makefile.SH...
7909                 ;;
7910         solaris)
7911                 xxx="-R $shrpdir"
7912                 ;;
7913         freebsd|netbsd|openbsd|interix|dragonfly)
7914                 xxx="-Wl,-R$shrpdir"
7915                 ;;
7916         bsdos|linux|irix*|dec_osf|gnu*)
7917                 xxx="-Wl,-rpath,$shrpdir"
7918                 ;;
7919         next)
7920                 # next doesn't like the default...
7921                 ;;
7922         beos)
7923                 # beos doesn't like the default, either.
7924                 ;;
7925         hpux*)
7926                 # hpux doesn't like the default, either.
7927                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
7928                 ;;
7929         *)
7930                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
7931                 ;;
7932         esac
7933         case "$xxx" in
7934         '') ;;
7935         *)      
7936                 # Only add $xxx if it isn't already in ccdlflags.
7937                 case " $ccdlflags " in
7938                 *" $xxx "*)     ;;
7939                 *)      ccdlflags="$ccdlflags $xxx"
7940                         cat <<EOM >&4
7941
7942 Adding $xxx to the flags
7943 passed to $ld so that the perl executable will find the 
7944 installed shared $libperl.
7945
7946 EOM
7947                         ;;
7948                 esac
7949                 ;;
7950         esac
7951 fi
7952 # Fix ccdlflags in AIX for building external extensions.
7953 # (For building Perl itself bare -bE:perl.exp is needed,
7954 #  Makefile.SH takes care of this.)
7955 case "$osname" in
7956 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
7957 esac
7958 # Respect a hint or command-line value.
7959 case "$shrpenv" in
7960 '') shrpenv="$tmp_shrpenv" ;;
7961 esac
7962 case "$ldlibpthname" in
7963 '')     ldlibpthname=LD_LIBRARY_PATH ;;
7964 none)   ldlibpthname='' ;;
7965 esac
7966
7967 : determine where manual pages are on this system
7968 echo " "
7969 case "$sysman" in
7970 '') 
7971         syspath='/usr/share/man/man1 /usr/man/man1'
7972         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
7973         syspath="$syspath /usr/man/u_man/man1"
7974         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
7975         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
7976         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
7977         sysman=`./loc . /usr/man/man1 $syspath`
7978         ;;
7979 esac
7980 if $test -d "$sysman"; then
7981         echo "System manual is in $sysman." >&4
7982 else
7983         echo "Could not find manual pages in source form." >&4
7984 fi
7985
7986 : determine where manual pages go
7987 set man1dir man1dir none
7988 eval $prefixit
7989 $cat <<EOM
7990
7991 $spackage has manual pages available in source form.
7992 EOM
7993 case "$nroff" in
7994 nroff)
7995         echo "However, you don't have nroff, so they're probably useless to you."
7996         case "$man1dir" in
7997         '') man1dir="none";;
7998         esac;;
7999 esac
8000 echo "If you don't want the manual sources installed, answer 'none'."
8001 case "$man1dir" in
8002 ' ') dflt=none
8003         ;;
8004 '')
8005         lookpath="$prefixexp/share/man/man1"
8006         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8007         lookpath="$lookpath $prefixexp/man/p_man/man1"
8008         lookpath="$lookpath $prefixexp/man/u_man/man1"
8009         lookpath="$lookpath $prefixexp/man/man.1"
8010         case "$sysman" in
8011         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8012         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8013         esac
8014         set dflt
8015         eval $prefixup
8016         ;;
8017 *)  dflt="$man1dir"
8018         ;;
8019 esac
8020 echo " "
8021 fn=dn+~
8022 rp="Where do the main $spackage manual pages (source) go?"
8023 . ./getfile
8024 if $test "X$man1direxp" != "X$ansexp"; then
8025         installman1dir=''
8026 fi
8027 prefixvar=man1dir
8028 . ./setprefixvar
8029
8030 case "$man1dir" in
8031 '')     man1dir=' '
8032         installman1dir='';;
8033 esac
8034
8035 : What suffix to use on installed man pages
8036
8037 case "$man1dir" in
8038 ' ')
8039         man1ext='0'
8040         ;;
8041 *)
8042         rp="What suffix should be used for the main $spackage man pages?"
8043         case "$man1ext" in
8044         '')     case "$man1dir" in
8045                 *1)  dflt=1 ;;
8046                 *1p) dflt=1p ;;
8047                 *1pm) dflt=1pm ;;
8048                 *l) dflt=l;;
8049                 *n) dflt=n;;
8050                 *o) dflt=o;;
8051                 *p) dflt=p;;
8052                 *C) dflt=C;;
8053                 *L) dflt=L;;
8054                 *L1) dflt=L1;;
8055                 *) dflt=1;;
8056                 esac
8057                 ;;
8058         *)      dflt="$man1ext";;
8059         esac
8060         . ./myread
8061         man1ext="$ans"
8062         ;;
8063 esac
8064
8065 : see if we can have long filenames
8066 echo " "
8067 first=123456789abcdef
8068 $rm -f $first
8069 if (echo hi >$first) 2>/dev/null; then
8070         if $test -f 123456789abcde; then
8071                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8072                 val="$undef"
8073         else
8074                 echo 'You can have filenames longer than 14 characters.'>&4
8075                 val="$define"
8076         fi
8077 else
8078         $cat <<'EOM'
8079 You can't have filenames longer than 14 chars.
8080 You can't even think about them!
8081 EOM
8082         val="$undef"
8083 fi 
8084 set d_flexfnam
8085 eval $setvar
8086 $rm -rf 123456789abcde*
8087
8088 : determine where library module manual pages go
8089 set man3dir man3dir none
8090 eval $prefixit
8091 $cat <<EOM
8092
8093 $spackage has manual pages for many of the library modules.
8094 EOM
8095
8096 case "$nroff" in
8097 nroff)
8098         $cat <<'EOM'
8099 However, you don't have nroff, so they're probably useless to you.
8100 EOM
8101         case "$man3dir" in
8102         '') man3dir="none";;
8103         esac;;
8104 esac
8105
8106 case "$d_flexfnam" in
8107 undef)
8108         $cat <<'EOM'
8109 However, your system can't handle the long file names like File::Basename.3. 
8110 EOM
8111         case "$man3dir" in
8112         '') man3dir="none";;
8113         esac;;
8114 esac
8115
8116 echo "If you don't want the manual sources installed, answer 'none'."
8117 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8118 case "$man3dir" in
8119 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8120         if $test -d "$privlib/man/man3"; then
8121                 cat <<EOM >&4
8122
8123 WARNING:  Previous versions of perl installed man3 pages into
8124 $privlib/man/man3.  This version will suggest a 
8125 new default of $dflt.  
8126 EOM
8127                 tdflt=$dflt
8128                 dflt='n'
8129                 rp='Do you wish to preserve the old behavior?(y/n)'
8130                 . ./myread
8131                 case "$ans" in
8132                 y*) dflt="$privlib/man/man3" ;;
8133                 *)  dflt=$tdflt ;;
8134                 esac
8135     fi
8136         ;;
8137 *)      dflt="$man3dir" ;;
8138 esac
8139 case "$dflt" in
8140 ' ') dflt=none ;;
8141 esac
8142 echo " "
8143 fn=dn+~
8144 rp="Where do the $package library man pages (source) go?"
8145 . ./getfile
8146 prefixvar=man3dir
8147 . ./setprefixvar
8148
8149 case "$man3dir" in
8150 '')     man3dir=' '
8151         installman3dir='';;
8152 esac
8153
8154 : What suffix to use on installed man pages
8155 case "$man3dir" in
8156 ' ')
8157         man3ext='0'
8158         ;;
8159 *)
8160         rp="What suffix should be used for the $package library man pages?"
8161         case "$man3ext" in
8162         '')     case "$man3dir" in
8163                 *3)  dflt=3 ;;
8164                 *3p) dflt=3p ;;
8165                 *3pm) dflt=3pm ;;
8166                 *l) dflt=l;;
8167                 *n) dflt=n;;
8168                 *o) dflt=o;;
8169                 *p) dflt=p;;
8170                 *C) dflt=C;;
8171                 *L) dflt=L;;
8172                 *L3) dflt=L3;;
8173                 *) dflt=3;;
8174                 esac
8175                 ;;
8176         *)      dflt="$man3ext";;
8177         esac
8178         . ./myread
8179         man3ext="$ans"
8180         ;;
8181 esac
8182
8183 : see if we have to deal with yellow pages, now NIS.
8184 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8185         if $test -f /usr/etc/nibindd; then
8186                 echo " "
8187                 echo "I'm fairly confident you're on a NeXT."
8188                 echo " "
8189                 rp='Do you get the hosts file via NetInfo?'
8190                 dflt=y
8191                 case "$hostcat" in
8192                 nidump*) ;;
8193                 '') ;;
8194                 *) dflt=n;;
8195                 esac
8196                 . ./myread
8197                 case "$ans" in
8198                 y*) hostcat='nidump hosts .';;
8199                 *)      case "$hostcat" in
8200                         nidump*) hostcat='';;
8201                         esac
8202                         ;;
8203                 esac
8204         fi
8205         case "$hostcat" in
8206         nidump*) ;;
8207         *)
8208                 case "$hostcat" in
8209                 *ypcat*) dflt=y;;
8210                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8211                                 dflt=y
8212                         else
8213                                 dflt=n
8214                         fi;;
8215                 *) dflt=n;;
8216                 esac
8217                 echo " "
8218                 rp='Are you getting the hosts file via yellow pages?'
8219                 . ./myread
8220                 case "$ans" in
8221                 y*) hostcat='ypcat hosts';;
8222                 *) hostcat='cat /etc/hosts';;
8223                 esac
8224                 ;;
8225         esac
8226 fi
8227 case "$hostcat" in
8228 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8229 esac
8230 case "$groupcat" in
8231 '') test -f /etc/group && groupcat='cat /etc/group';;
8232 esac
8233 case "$passcat" in
8234 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8235 esac
8236
8237 : now get the host name
8238 echo " "
8239 echo "Figuring out host name..." >&4
8240 case "$myhostname" in
8241 '') cont=true
8242         echo 'Maybe "hostname" will work...'
8243         if tans=`sh -c hostname 2>&1` ; then
8244                 myhostname=$tans
8245                 phostname=hostname
8246                 cont=''
8247         fi
8248         ;;
8249 *) cont='';;
8250 esac
8251 if $test "$cont"; then
8252         if ./xenix; then
8253                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8254                 if tans=`cat /etc/systemid 2>&1` ; then
8255                         myhostname=$tans
8256                         phostname='cat /etc/systemid'
8257                         echo "Whadyaknow.  Xenix always was a bit strange..."
8258                         cont=''
8259                 fi
8260         elif $test -r /etc/systemid; then
8261                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8262         fi
8263 fi
8264 if $test "$cont"; then
8265         echo 'No, maybe "uuname -l" will work...'
8266         if tans=`sh -c 'uuname -l' 2>&1` ; then
8267                 myhostname=$tans
8268                 phostname='uuname -l'
8269         else
8270                 echo 'Strange.  Maybe "uname -n" will work...'
8271                 if tans=`sh -c 'uname -n' 2>&1` ; then
8272                         myhostname=$tans
8273                         phostname='uname -n'
8274                 else
8275                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8276                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8277                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8278                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8279                         else
8280                                 case "$myhostname" in
8281                                 '') echo "Does this machine have an identity crisis or something?"
8282                                         phostname='';;
8283                                 *)
8284                                         echo "Well, you said $myhostname before..."
8285                                         phostname='echo $myhostname';;
8286                                 esac
8287                         fi
8288                 fi
8289         fi
8290 fi
8291 case "$myhostname" in
8292 '') myhostname=noname ;;
8293 esac
8294 : you do not want to know about this
8295 set $myhostname
8296 myhostname=$1
8297
8298 : verify guess
8299 if $test "$myhostname" ; then
8300         dflt=y
8301         rp='Your host name appears to be "'$myhostname'".'" Right?"
8302         . ./myread
8303         case "$ans" in
8304         y*) ;;
8305         *) myhostname='';;
8306         esac
8307 fi
8308
8309 : bad guess or no guess
8310 while $test "X$myhostname" = X ; do
8311         dflt=''
8312         rp="Please type the (one word) name of your host:"
8313         . ./myread
8314         myhostname="$ans"
8315 done
8316
8317 : translate upper to lower if necessary
8318 case "$myhostname" in
8319 *[A-Z]*)
8320         echo "(Normalizing case in your host name)"
8321         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8322         ;;
8323 esac
8324
8325 case "$myhostname" in
8326 *.*)
8327         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8328         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8329         echo "(Trimming domain name from host name--host name is now $myhostname)"
8330         ;;
8331 *) case "$mydomain" in
8332         '')
8333                 {
8334                         test "X$hostcat" = "Xypcat hosts" &&
8335                         ypmatch "$myhostname" hosts 2>/dev/null |\
8336                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8337                         $test -s hosts
8338                 } || {
8339                         test "X$hostcat" != "X" &&
8340                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8341                                         /[       ]$myhostname[  . ]/p" > hosts
8342                 }
8343                 tmp_re="[       . ]"
8344                 if $test -f hosts; then
8345                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8346                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8347                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8348                                 hosts | $sort | $uniq | \
8349                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8350                         case `$echo X$dflt` in
8351                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8352                                 dflt=.
8353                                 ;;
8354                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8355                                 ;;
8356                         esac
8357                 else
8358                         echo "(I cannot locate a hosts database anywhere)"
8359                         dflt=.
8360                 fi
8361                 case "$dflt" in
8362                 .)
8363                         tans=`./loc resolv.conf X /etc /usr/etc`
8364                         if $test -f "$tans"; then
8365                                 echo "(Attempting domain name extraction from $tans)"
8366                                 dflt=.`$sed -n -e 's/   / /g' \
8367                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8368                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8369                                 case "$dflt" in
8370                                 .) dflt=.`$sed -n -e 's/        / /g' \
8371                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8372                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8373                                         ;;
8374                                 esac
8375                         fi
8376                         ;;
8377                 esac
8378                 case "$dflt" in
8379                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8380                         dflt=.`sh -c domainname 2>/dev/null`
8381                         case "$dflt" in
8382                         '') dflt='.';;
8383                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8384                         esac
8385                         ;;
8386                 esac
8387                 case "$dflt$osname" in
8388                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8389                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8390                         ;;
8391                 esac
8392                 case "$dflt" in
8393                 .) echo "(Lost all hope -- silly guess then)"
8394                         dflt='.nonet'
8395                         ;;
8396                 esac
8397                 $rm -f hosts
8398                 ;;
8399         *) dflt="$mydomain";;
8400         esac;;
8401 esac
8402 echo " "
8403 rp="What is your domain name?"
8404 . ./myread
8405 tans="$ans"
8406 case "$ans" in
8407 '') ;;
8408 .*) ;;
8409 *) tans=".$tans";;
8410 esac
8411 mydomain="$tans"
8412
8413 : translate upper to lower if necessary
8414 case "$mydomain" in
8415 *[A-Z]*)
8416         echo "(Normalizing case in your domain name)"
8417         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8418         ;;
8419 esac
8420
8421 : a little sanity check here
8422 case "$phostname" in
8423 '') ;;
8424 *)
8425         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8426         $myhostname$mydomain|$myhostname) ;;
8427         *)
8428                 case "$phostname" in
8429                 sed*)
8430                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8431                         ;;
8432                 *)
8433                         echo "(That doesn't agree with your $phostname command, by the way.)"
8434                         ;;
8435                 esac
8436         ;;
8437         esac
8438         ;;
8439 esac
8440
8441 $cat <<EOM
8442
8443 I need to get your e-mail address in Internet format if possible, i.e.
8444 something like user@host.domain. Please answer accurately since I have
8445 no easy means to double check it. The default value provided below
8446 is most probably close to reality but may not be valid from outside
8447 your organization...
8448
8449 EOM
8450 cont=x
8451 while test "$cont"; do
8452         case "$cf_email" in
8453         '') dflt="$cf_by@$myhostname$mydomain";;
8454         *) dflt="$cf_email";;
8455         esac
8456         rp='What is your e-mail address?'
8457         . ./myread
8458         cf_email="$ans"
8459         case "$cf_email" in
8460         *@*.*) cont='' ;;
8461         *)
8462                 rp='Address does not look like an Internet one.  Use it anyway?'
8463                 case "$fastread" in
8464                 yes) dflt=y ;;
8465                 *) dflt=n ;;
8466                 esac
8467                 . ./myread
8468                 case "$ans" in
8469                 y*) cont='' ;;
8470                 *) echo " " ;;
8471                 esac
8472                 ;;
8473         esac
8474 done
8475
8476 $cat <<EOM
8477
8478 If you or somebody else will be maintaining perl at your site, please
8479 fill in the correct e-mail address here so that they may be contacted
8480 if necessary. Currently, the "perlbug" program included with perl
8481 will send mail to this address in addition to perlbug@perl.org. You may
8482 enter "none" for no administrator.
8483
8484 EOM
8485 case "$perladmin" in
8486 '') dflt="$cf_email";;
8487 *) dflt="$perladmin";;
8488 esac
8489 rp='Perl administrator e-mail address'
8490 . ./myread
8491 perladmin="$ans"
8492
8493 : determine whether to only install version-specific parts.
8494 echo " "
8495 $cat <<EOM
8496 Do you want to install only the version-specific parts of the perl
8497 distribution?  Usually you do *not* want to do this.
8498 EOM
8499 case "$versiononly" in
8500 "$define"|[Yy]*|true) dflt='y' ;;
8501 *) dflt='n';
8502 esac
8503 rp="Do you want to install only the version-specific parts of perl?"
8504 . ./myread
8505 case "$ans" in
8506 [yY]*)  val="$define";;
8507 *)      val="$undef" ;;
8508 esac
8509 set versiononly
8510 eval $setvar
8511
8512 case "$versiononly" in
8513 "$define") inc_version_list=''
8514            inc_version_list_init=0
8515            ;;
8516 esac
8517
8518 : figure out how to guarantee perl startup
8519 case "$startperl" in
8520 '')
8521         case "$sharpbang" in
8522         *!)
8523                 $cat <<EOH
8524
8525 I can use the #! construct to start perl on your system. This will
8526 make startup of perl scripts faster, but may cause problems if you
8527 want to share those scripts and perl is not in a standard place
8528 ($binexp/perl) on all your platforms. The alternative is to force
8529 a shell by starting the script with a single ':' character.
8530
8531 EOH
8532                 case "$versiononly" in
8533                 "$define")      dflt="$binexp/perl$version";;  
8534                 *)              dflt="$binexp/perl";;
8535                 esac
8536                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8537                 . ./myread
8538                 case "$ans" in
8539                 none)   startperl=": # use perl";;
8540                 *)      startperl="#!$ans"
8541                         if $test 30 -lt `echo "$ans" | wc -c`; then
8542                                 $cat >&4 <<EOM
8543
8544 WARNING:  Some systems limit the #! command to 32 characters.
8545 If you experience difficulty running Perl scripts with #!, try
8546 installing Perl in a directory with a shorter pathname.
8547
8548 EOM
8549                         fi ;;
8550                 esac
8551                 ;;
8552         *) startperl=": # use perl"
8553                 ;;
8554         esac
8555         ;;
8556 esac
8557 echo "I'll use $startperl to start perl scripts."
8558
8559 : figure best path for perl in scripts
8560 case "$perlpath" in
8561 '')
8562         case "$versiononly" in
8563         "$define")      perlpath="$binexp/perl$version";;
8564         *)              perlpath="$binexp/perl";;
8565         esac
8566         case "$startperl" in
8567         *!*) ;;
8568         *)
8569                 $cat <<EOH
8570
8571 I will use the "eval 'exec'" idiom to start Perl on your system.
8572 I can use the full path of your Perl binary for this purpose, but
8573 doing so may cause problems if you want to share those scripts and
8574 Perl is not always in a standard place ($binexp/perl).
8575
8576 EOH
8577                 dflt="$binexp/perl"
8578                 rp="What path shall I use in \"eval 'exec'\"?"
8579                 . ./myread
8580                 perlpath="$ans"
8581                 ;;
8582         esac
8583         ;;
8584 esac
8585 case "$startperl" in
8586 *!*)    ;;
8587 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8588 esac
8589
8590 : determine where public executable scripts go
8591 set scriptdir scriptdir
8592 eval $prefixit
8593 case "$scriptdir" in
8594 '')
8595         dflt="$bin"
8596         : guess some guesses
8597         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8598         $test -d /usr/share/bin     && dflt=/usr/share/bin
8599         $test -d /usr/local/script  && dflt=/usr/local/script
8600         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8601         $test -d $prefixexp/script  && dflt=$prefixexp/script
8602         set dflt
8603         eval $prefixup
8604         ;;
8605 *)  dflt="$scriptdir"
8606         ;;
8607 esac
8608 $cat <<EOM
8609  
8610 Some installations have a separate directory just for executable scripts so
8611 that they can mount it across multiple architectures but keep the scripts in
8612 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8613 Or you might just lump your scripts in with all your other executables.
8614  
8615 EOM
8616 fn=d~
8617 rp='Where do you keep publicly executable scripts?'
8618 . ./getfile
8619 if $test "X$ansexp" != "X$scriptdirexp"; then
8620         installscript=''
8621 fi
8622 prefixvar=scriptdir
8623 . ./setprefixvar
8624 : A little fix up for an irregularly named variable.
8625 installscript="$installscriptdir"
8626
8627
8628 : determine where add-on public executables go
8629 case "$sitebin" in
8630 '')     dflt=$siteprefix/bin ;;
8631 *)      dflt=$sitebin ;;
8632 esac
8633 fn=d~
8634 rp='Pathname where the add-on public executables should be installed?'
8635 . ./getfile
8636 prefixvar=sitebin
8637 . ./setprefixvar
8638
8639 : determine where add-on html pages go
8640 : There is no standard location, so try to copy the previously-selected
8641 : directory structure for the core html pages.
8642 case "$sitehtml1dir" in
8643 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8644 *)     dflt=$sitehtml1dir ;;
8645 esac
8646 case "$dflt" in
8647 ''|' ') dflt=none ;;
8648 esac
8649 fn=dn+~
8650 rp='Pathname where the site-specific html pages should be installed?'
8651 . ./getfile
8652 prefixvar=sitehtml1dir
8653 . ./setprefixvar
8654
8655 : determine where add-on library html pages go
8656 : There is no standard location, so try to copy the previously-selected
8657 : directory structure for the core html pages.
8658 case "$sitehtml3dir" in
8659 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8660 *)     dflt=$sitehtml3dir ;;
8661 esac
8662 case "$dflt" in
8663 ''|' ') dflt=none ;;
8664 esac
8665 fn=dn+~
8666 rp='Pathname where the site-specific library html pages should be installed?'
8667 . ./getfile
8668 prefixvar=sitehtml3dir
8669 . ./setprefixvar
8670
8671 : determine where add-on manual pages go
8672 case "$siteman1dir" in
8673 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8674 *)      dflt=$siteman1dir ;;
8675 esac
8676 case "$dflt" in
8677 ''|' ') dflt=none ;;
8678 esac
8679 fn=dn+~
8680 rp='Pathname where the site-specific manual pages should be installed?'
8681 . ./getfile
8682 prefixvar=siteman1dir
8683 . ./setprefixvar
8684
8685 : determine where add-on library man pages go
8686 case "$siteman3dir" in
8687 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8688 *)      dflt=$siteman3dir ;;
8689 esac
8690 case "$dflt" in
8691 ''|' ') dflt=none ;;
8692 esac
8693 fn=dn+~
8694 rp='Pathname where the site-specific library manual pages should be installed?'
8695 . ./getfile
8696 prefixvar=siteman3dir
8697 . ./setprefixvar
8698
8699 : determine where add-on public executable scripts go
8700 case "$sitescript" in
8701 '')     dflt=$siteprefix/script
8702         $test -d $dflt || dflt=$sitebin ;;
8703 *)  dflt="$sitescript" ;;
8704 esac
8705 fn=d~+
8706 rp='Pathname where add-on public executable scripts should be installed?'
8707 . ./getfile
8708 prefixvar=sitescript
8709 . ./setprefixvar
8710
8711 case "$usefaststdio" in
8712 $define|true|[yY]*|'')
8713         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8714         case "$xversion" in
8715         [68])   dflt='y' ;;
8716         *)      dflt='n' ;;
8717         esac
8718         ;;
8719 *) dflt='n';;
8720 esac
8721 cat <<EOM
8722
8723 Perl can be built to use 'fast stdio', which means using the stdio
8724 library but also directly manipulating the stdio buffers to enable
8725 faster I/O.  Using stdio is better for backward compatibility (especially
8726 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8727 interface has been preferred instead of stdio.
8728
8729 If this doesn't make any sense to you, just accept the default '$dflt'.
8730 EOM
8731 rp='Use the "fast stdio" if available?'
8732 . ./myread
8733 case "$ans" in
8734 y|Y)    val="$define" ;;     
8735 *)      val="$undef" ;;
8736 esac
8737 set usefaststdio
8738 eval $setvar
8739
8740
8741 : define an is-a-typedef? function
8742 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8743 case "$inclist" in
8744 "") inclist="sys/types.h";;
8745 esac;
8746 eval "varval=\$$var";
8747 case "$varval" in
8748 "")
8749         $rm -f temp.c;
8750         for inc in $inclist; do
8751                 echo "#include <$inc>" >>temp.c;
8752         done;
8753         echo "#ifdef $type" >> temp.c;
8754         echo "printf(\"We have $type\");" >> temp.c;
8755         echo "#endif" >> temp.c;
8756         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8757         if $contains $type temp.E >/dev/null 2>&1; then
8758                 eval "$var=\$type";
8759         else
8760                 eval "$var=\$def";
8761         fi;
8762         $rm -f temp.?;;
8763 *) eval "$var=\$varval";;
8764 esac'
8765
8766 : define an is-a-typedef? function that prompts if the type is not available.
8767 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8768 case "$inclist" in
8769 "") inclist="sys/types.h";;
8770 esac;
8771 eval "varval=\$$var";
8772 case "$varval" in
8773 "")
8774         $rm -f temp.c;
8775         for inc in $inclist; do
8776                 echo "#include <$inc>" >>temp.c;
8777         done;
8778         echo "#ifdef $type" >> temp.c;
8779         echo "printf(\"We have $type\");" >> temp.c;
8780         echo "#endif" >> temp.c;
8781         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8782         echo " " ;
8783         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8784         if $contains $type temp.E >/dev/null 2>&1; then
8785                 echo "$type found." >&4;
8786                 eval "$var=\$type";
8787         else
8788                 echo "$type NOT found." >&4;
8789                 dflt="$def";
8790                 . ./myread ;
8791                 eval "$var=\$ans";
8792         fi;
8793         $rm -f temp.?;;
8794 *) eval "$var=\$varval";;
8795 esac'
8796
8797 : see what type lseek is declared as in the kernel
8798 rp="What is the type used for lseek's offset on this system?"
8799 set off_t lseektype long stdio.h sys/types.h
8800 eval $typedef_ask
8801
8802 echo " "
8803 echo "Checking to see how big your file offsets are..." >&4
8804 $cat >try.c <<EOCP
8805 #include <sys/types.h>
8806 #include <stdio.h>
8807 int main()
8808 {
8809     printf("%d\n", (int)sizeof($lseektype));
8810     return(0); 
8811 }
8812 EOCP
8813 set try
8814 if eval $compile_ok; then
8815         lseeksize=`$run ./try`
8816         echo "Your file offsets are $lseeksize bytes long."
8817 else
8818         dflt=$longsize
8819         echo " "
8820         echo "(I can't seem to compile the test program.  Guessing...)"
8821         rp="What is the size of your file offsets (in bytes)?"
8822         . ./myread
8823         lseeksize="$ans"
8824 fi
8825 $rm -f try.c try
8826
8827 : see what type file positions are declared as in the library
8828 rp="What is the type for file position used by fsetpos()?"
8829 set fpos_t fpostype long stdio.h sys/types.h
8830 eval $typedef_ask
8831
8832 echo " "
8833 case "$fpostype" in
8834 *_t) zzz="$fpostype"    ;;
8835 *)   zzz="fpos_t"       ;;
8836 esac
8837 echo "Checking the size of $zzz..." >&4 
8838 cat > try.c <<EOCP
8839 #include <sys/types.h>
8840 #include <stdio.h>
8841 #$i_stdlib I_STDLIB
8842 #ifdef I_STDLIB
8843 #include <stdlib.h>
8844 #endif
8845 int main() {
8846     printf("%d\n", (int)sizeof($fpostype));
8847     exit(0);
8848 }
8849 EOCP
8850 set try
8851 if eval $compile_ok; then
8852         yyy=`$run ./try`
8853         case "$yyy" in
8854         '')     fpossize=4
8855                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8856                 ;;
8857         *)      fpossize=$yyy
8858                 echo "Your $zzz is $fpossize bytes long."
8859                 ;;
8860         esac
8861 else
8862         dflt="$longsize"
8863         echo " " >&4
8864         echo "(I can't compile the test program.  Guessing...)" >&4
8865         rp="What is the size of your file positions (in bytes)?"
8866         . ./myread
8867         fpossize="$ans"
8868 fi
8869
8870 # Backward compatibility (uselfs is deprecated).
8871 case "$uselfs" in
8872 "$define"|true|[yY]*)
8873         cat <<EOM >&4
8874
8875 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
8876 EOM
8877         uselargefiles="$define"
8878         ;;
8879 esac                          
8880
8881 case "$lseeksize:$fpossize" in
8882 8:8) cat <<EOM
8883
8884 You can have files larger than 2 gigabytes.
8885 EOM
8886    val="$define" ;;
8887 *)    case "$uselargefiles" in
8888    "$undef"|false|[nN]*) dflt='n' ;;
8889    *)   dflt='y' ;;
8890    esac
8891    cat <<EOM
8892
8893 Perl can be built to understand large files (files larger than 2 gigabytes)
8894 on some systems.  To do so, Configure can be run with -Duselargefiles.
8895
8896 If this doesn't make any sense to you, just accept the default '$dflt'.
8897 EOM
8898    rp='Try to understand large files, if available?'
8899    . ./myread
8900    case "$ans" in
8901    y|Y)         val="$define" ;;
8902    *)           val="$undef"  ;;
8903    esac
8904    ;;
8905 esac
8906 set uselargefiles
8907 eval $setvar
8908 : Look for a hint-file generated 'call-back-unit'.  If the
8909 : user has specified that a large files perl is to be built,
8910 : we may need to set or change some other defaults.
8911 if $test -f uselargefiles.cbu; then
8912         echo "Your platform has some specific hints regarding large file builds, using them..."
8913         . ./uselargefiles.cbu
8914 fi
8915 case "$uselargefiles" in
8916 "$define")
8917         if $test -f uselargefiles.cbu; then
8918                 echo " "
8919                 echo "Rechecking to see how big your file offsets are..." >&4
8920                 $cat >try.c <<EOCP
8921 #include <sys/types.h>
8922 #include <stdio.h>
8923 int main()
8924 {
8925     printf("%d\n", (int)sizeof($lseektype));
8926     return(0); 
8927 }
8928 EOCP
8929                 set try
8930                 if eval $compile_ok; then
8931                         lseeksize=`$run ./try`
8932                         $echo "Your file offsets are now $lseeksize bytes long."
8933                 else
8934                         dflt="$lseeksize"
8935                         echo " "
8936                         echo "(I can't seem to compile the test program.  Guessing...)"
8937                         rp="What is the size of your file offsets (in bytes)?"
8938                         . ./myread
8939                         lseeksize="$ans"
8940                 fi
8941                 case "$fpostype" in
8942                 *_t) zzz="$fpostype"    ;;
8943                 *)   zzz="fpos_t"       ;;
8944                 esac
8945                 $echo $n "Rechecking the size of $zzz...$c" >&4 
8946                 $cat > try.c <<EOCP
8947 #include <sys/types.h>
8948 #include <stdio.h>
8949 #$i_stdlib I_STDLIB
8950 #ifdef I_STDLIB
8951 #include <stdlib.h>
8952 #endif
8953 int main() {
8954     printf("%d\n", (int)sizeof($fpostype));
8955     return(0);
8956 }
8957 EOCP
8958                 set try
8959                 if eval $compile_ok; then
8960                         yyy=`$run ./try`
8961                         dflt="$lseeksize"
8962                         case "$yyy" in
8963                         '')     echo " "
8964                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
8965                                 ;;
8966                         *)      fpossize=$yyy
8967                                 echo " $fpossize bytes." >&4
8968                                 ;;
8969                         esac
8970                 else
8971                         dflt="$fpossize"
8972                         echo " "
8973                         echo "(I can't compile the test program.  Guessing...)" >&4
8974                         rp="What is the size of your file positions (in bytes)?"
8975                         . ./myread
8976                         fpossize="$ans"
8977                 fi
8978                 $rm -f try.c try
8979         fi
8980         ;;
8981 esac
8982
8983 case "$vendorprefix" in
8984 '')     d_vendorbin="$undef"
8985         vendorbin=''
8986         vendorbinexp=''
8987         ;;
8988 *)      d_vendorbin="$define"
8989         : determine where vendor-supplied executables go.
8990         case "$vendorbin" in
8991         '') dflt=$vendorprefix/bin ;;
8992         *)      dflt="$vendorbin" ;;
8993         esac
8994         fn=d~+
8995         rp='Pathname for the vendor-supplied executables directory?'
8996         . ./getfile
8997         vendorbin="$ans"
8998         vendorbinexp="$ansexp"
8999         ;;
9000 esac
9001 prefixvar=vendorbin
9002 . ./installprefix
9003
9004 case "$vendorprefix" in
9005 '')     vendorhtml1dir=''
9006         vendorhtml1direxp=''
9007         ;;
9008 *)      : determine where vendor-supplied html pages go.
9009         : There is no standard location, so try to copy the previously-selected
9010         : directory structure for the core html pages.
9011         : XXX Better default suggestions would be welcome.
9012         case "$vendorhtml1dir" in
9013         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9014         *)      dflt=$vendorhtml1dir ;;
9015         esac
9016         case "$dflt" in
9017         ''|' ') dflt=none ;;
9018         esac
9019         fn=dn+~
9020         rp='Pathname for the vendor-supplied html pages?'
9021         . ./getfile
9022         vendorhtml1dir="$ans"
9023         vendorhtml1direxp="$ansexp"
9024         ;;
9025 esac
9026 : Use ' ' for none so value is preserved next time through Configure
9027 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9028 prefixvar=vendorhtml1dir
9029 . ./installprefix
9030
9031 case "$vendorprefix" in
9032 '')     vendorhtml3dir=''
9033         vendorhtml3direxp=''
9034         ;;
9035 *)      : determine where vendor-supplied module html pages go.
9036         : There is no standard location, so try to copy the previously-selected
9037         : directory structure for the core html pages.
9038         : XXX Better default suggestions would be welcome.
9039         case "$vendorhtml3dir" in
9040         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9041         *)      dflt=$vendorhtml3dir ;;
9042         esac
9043         case "$dflt" in
9044         ''|' ') dflt=none ;;
9045         esac
9046         fn=dn+~
9047         rp='Pathname for the vendor-supplied html pages?'
9048         . ./getfile
9049         vendorhtml3dir="$ans"
9050         vendorhtml3direxp="$ansexp"
9051         ;;
9052 esac
9053 : Use ' ' for none so value is preserved next time through Configure
9054 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9055 prefixvar=vendorhtml3dir
9056 . ./installprefix
9057
9058 case "$vendorprefix" in
9059 '')     vendorman1dir=''
9060         vendorman1direxp=''
9061         ;;
9062 *)      : determine where vendor-supplied manual pages go.
9063         case "$vendorman1dir" in
9064         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9065         *)      dflt=$vendorman1dir ;;
9066         esac
9067         case "$dflt" in
9068         ''|' ') dflt=none ;;
9069         esac
9070         fn=nd~+
9071         rp='Pathname for the vendor-supplied manual section 1 pages?'
9072         . ./getfile
9073         vendorman1dir="$ans"
9074         vendorman1direxp="$ansexp"
9075         ;;
9076 esac
9077 : Use ' ' for none so value is preserved next time through Configure
9078 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9079 prefixvar=vendorman1dir
9080 . ./installprefix
9081
9082 case "$vendorprefix" in
9083 '')     vendorman3dir=''
9084         vendorman3direxp=''
9085         ;;
9086 *)      : determine where vendor-supplied module manual pages go.
9087         case "$vendorman3dir" in
9088         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9089         *)      dflt=$vendorman3dir ;;
9090         esac
9091         case "$dflt" in
9092         ''|' ') dflt=none ;;
9093         esac
9094         fn=nd~+
9095         rp='Pathname for the vendor-supplied manual section 3 pages?'
9096         . ./getfile
9097         vendorman3dir="$ans"
9098         vendorman3direxp="$ansexp"
9099         ;;
9100 esac
9101 : Use ' ' for none so value is preserved next time through Configure
9102 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9103 prefixvar=vendorman3dir
9104 . ./installprefix
9105
9106 case "$vendorprefix" in
9107 '')     d_vendorscript="$undef"
9108         vendorscript=''
9109         vendorscriptexp=''
9110         ;;
9111 *)      d_vendorscript="$define"
9112         : determine where vendor-supplied scripts go.
9113         case "$vendorscript" in
9114         '')     dflt=$vendorprefix/script
9115                 $test -d $dflt || dflt=$vendorbin ;;
9116         *)  dflt="$vendorscript" ;;
9117         esac
9118         $cat <<EOM
9119
9120 The installation process will create a directory for 
9121 vendor-supplied scripts.
9122
9123 EOM
9124         fn=d~+
9125         rp='Pathname for the vendor-supplied scripts directory?'
9126         . ./getfile
9127         vendorscript="$ans"
9128         vendorscriptexp="$ansexp"
9129         ;;
9130 esac
9131 prefixvar=vendorscript
9132 . ./installprefix
9133
9134 : see if qgcvt exists
9135 set qgcvt d_qgcvt
9136 eval $inlibc
9137
9138 echo " "
9139
9140 if $test X"$d_longdbl" = X"$define"; then
9141
9142 echo "Checking how to print long doubles..." >&4
9143
9144 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9145         $cat >try.c <<'EOCP'
9146 #include <sys/types.h>
9147 #include <stdio.h>
9148 int main() {
9149   double d = 123.456;
9150   printf("%.3f\n", d);
9151 }
9152 EOCP
9153         set try
9154         if eval $compile; then
9155                 yyy=`$run ./try`
9156                 case "$yyy" in
9157                 123.456)
9158                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9159                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9160                         echo "We will use %f."
9161                         ;;
9162                 esac
9163         fi
9164 fi
9165
9166 if $test X"$sPRIfldbl" = X; then
9167         $cat >try.c <<'EOCP'
9168 #include <sys/types.h>
9169 #include <stdio.h>
9170 int main() {
9171   long double d = 123.456;
9172   printf("%.3Lf\n", d);
9173 }
9174 EOCP
9175         set try
9176         if eval $compile; then
9177                 yyy=`$run ./try`
9178                 case "$yyy" in
9179                 123.456)
9180                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9181                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9182                         echo "We will use %Lf."
9183                         ;;
9184                 esac
9185         fi
9186 fi
9187
9188 if $test X"$sPRIfldbl" = X; then
9189         $cat >try.c <<'EOCP'
9190 #include <sys/types.h>
9191 #include <stdio.h>
9192 int main() {
9193   long double d = 123.456;
9194   printf("%.3llf\n", d);
9195 }
9196 EOCP
9197         set try
9198         if eval $compile; then
9199                 yyy=`$run ./try`
9200                 case "$yyy" in
9201                 123.456)
9202                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9203                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9204                         echo "We will use %llf."
9205                         ;;
9206                 esac
9207         fi
9208 fi
9209
9210 if $test X"$sPRIfldbl" = X; then
9211         $cat >try.c <<'EOCP'
9212 #include <sys/types.h>
9213 #include <stdio.h>
9214 int main() {
9215   long double d = 123.456;
9216   printf("%.3lf\n", d);
9217 }
9218 EOCP
9219         set try
9220         if eval $compile; then
9221                 yyy=`$run ./try`
9222                 case "$yyy" in
9223                 123.456)
9224                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9225                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9226                         echo "We will use %lf."
9227                         ;;
9228                 esac
9229         fi
9230 fi
9231
9232 if $test X"$sPRIfldbl" = X; then
9233         echo "Cannot figure out how to print long doubles." >&4
9234 else
9235         sSCNfldbl=$sPRIfldbl    # expect consistency
9236 fi
9237
9238 $rm -f try try.*
9239
9240 fi # d_longdbl
9241
9242 case "$sPRIfldbl" in
9243 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9244         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9245         d_SCNfldbl="$undef";
9246         ;;
9247 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9248         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9249         d_SCNfldbl="$define";
9250         ;;
9251 esac
9252
9253 : Check how to convert floats to strings.
9254
9255 if test "X$d_Gconvert" = X; then
9256
9257 echo " "
9258 echo "Checking for an efficient way to convert floats to strings."
9259 echo " " > try.c
9260 case "$uselongdouble" in
9261 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9262 esac
9263 case "$d_longdbl" in
9264 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9265 esac
9266 case "$d_PRIgldbl" in
9267 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9268 esac
9269 $cat >>try.c <<EOP
9270 #ifdef TRY_gconvert
9271 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9272 char *myname = "gconvert";
9273 #endif
9274 #ifdef TRY_gcvt
9275 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9276 char *myname = "gcvt";
9277 #endif
9278 #ifdef TRY_qgcvt
9279 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9280 char *myname = "qgcvt";
9281 #define DOUBLETYPE long double
9282 #endif
9283 #ifdef TRY_sprintf
9284 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9285 #ifdef HAS_PRIgldbl
9286 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9287 #else
9288 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9289 #endif
9290 #else
9291 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9292 #endif
9293 char *myname = "sprintf";
9294 #endif
9295
9296 #ifndef DOUBLETYPE
9297 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9298 #define DOUBLETYPE long double
9299 #else
9300 #define DOUBLETYPE double
9301 #endif
9302 #endif
9303
9304 #include <stdio.h>
9305
9306 #define I_STDLIB $i_stdlib
9307 #ifdef I_STDLIB
9308 #include <stdlib.h>
9309 #endif
9310
9311 int
9312 checkit(expect, got)
9313 char *expect;
9314 char *got;
9315 {
9316     if (strcmp(expect, got)) {
9317                 printf("%s oddity:  Expected %s, got %s\n",
9318                         myname, expect, got);
9319                 exit(1);
9320         }
9321 }
9322
9323 int main()
9324
9325         char buf[64]; 
9326         buf[63] = '\0';
9327
9328         /* This must be 1st test on (which?) platform */
9329         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9330         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9331         checkit("0.1", buf);
9332
9333         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9334         checkit("0.01", buf);
9335
9336         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9337         checkit("0.001", buf);
9338
9339         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9340         checkit("0.0001", buf);
9341
9342         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9343         if (strlen(buf) > 5)
9344             checkit("9e-005", buf); /* for Microsoft ?? */
9345         else
9346             checkit("9e-05", buf);
9347
9348         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9349         checkit("1", buf);
9350
9351         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9352         checkit("1.1", buf);
9353
9354         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9355         checkit("1.01", buf);
9356
9357         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9358         checkit("1.001", buf);
9359
9360         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9361         checkit("1.0001", buf);
9362
9363         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9364         checkit("1.00001", buf);
9365
9366         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9367         checkit("1.000001", buf);
9368
9369         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9370         checkit("0", buf);
9371
9372         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9373         checkit("-1", buf);
9374
9375         /* Some Linux gcvt's give 1.e+5 here. */
9376         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9377         checkit("100000", buf);
9378         
9379         /* Some Linux gcvt's give -1.e+5 here. */
9380         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9381         checkit("-100000", buf);
9382
9383         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9384         checkit("123.456", buf);
9385
9386         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9387         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9388         /* 34 should be enough to scare even long double
9389          * places into using the e notation. */
9390         if (strlen(buf) > 5)
9391             checkit("1e+034", buf); /* for Microsoft */
9392         else
9393             checkit("1e+34", buf);
9394
9395         /* For Perl, if you add additional tests here, also add them to
9396          * t/base/num.t for benefit of platforms not using Configure or
9397          * overriding d_Gconvert */
9398
9399         exit(0);
9400 }
9401 EOP
9402 : first add preferred functions to our list
9403 xxx_list=""
9404 for xxx_convert in $gconvert_preference; do
9405     case $xxx_convert in
9406     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9407     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9408     esac 
9409 done
9410 : then add any others
9411 for xxx_convert in gconvert gcvt sprintf; do
9412     case "$xxx_list" in
9413     *$xxx_convert*) ;;
9414     *) xxx_list="$xxx_list $xxx_convert" ;;
9415     esac 
9416 done
9417
9418 case "$d_longdbl$uselongdouble" in
9419 "$define$define")
9420     : again, add prefered functions to our list first
9421     xxx_ld_list=""
9422     for xxx_convert in $gconvert_ld_preference; do
9423         case $xxx_convert in
9424         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9425         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9426         esac
9427     done
9428     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9429     for xxx_convert in qgcvt sprintf $xxx_list; do
9430         case "$xxx_ld_list" in
9431         $xxx_convert*|*" $xxx_convert"*) ;;
9432         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9433         esac
9434     done
9435     : if sprintf cannot do long doubles, move it to the end
9436     if test "$d_PRIgldbl" != "$define"; then
9437         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9438     fi
9439     : if no qgcvt, remove it
9440     if test "$d_qgcvt" != "$define"; then
9441         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9442     fi
9443     : use the ld_list
9444     xxx_list="$xxx_ld_list"
9445     ;;
9446 esac
9447
9448 for xxx_convert in $xxx_list; do
9449         echo "Trying $xxx_convert..."
9450         $rm -f try try$_o
9451         set try -DTRY_$xxx_convert
9452         if eval $compile; then
9453                 echo "$xxx_convert() found." >&4
9454                 if $run ./try; then
9455                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9456                         break;
9457                 else
9458                         echo "...But $xxx_convert didn't work as I expected."
9459                         xxx_convert=''
9460                 fi
9461         else
9462                 echo "$xxx_convert NOT found." >&4
9463         fi
9464 done
9465
9466 if test X$xxx_convert = X; then
9467     echo "*** WHOA THERE!!! ***" >&4
9468     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9469     xxx_convert=sprintf
9470 fi
9471
9472 case "$xxx_convert" in
9473 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9474 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9475 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9476 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9477    "$define$define$define")
9478       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9479    "$define$define$undef")
9480       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9481    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9482    esac
9483    ;;  
9484 esac
9485
9486 fi
9487
9488 : see if _fwalk exists
9489 set fwalk d__fwalk
9490 eval $inlibc
9491
9492 : Initialize h_fcntl
9493 h_fcntl=false
9494
9495 : Initialize h_sysfile
9496 h_sysfile=false
9497
9498 : access call always available on UNIX
9499 set access d_access
9500 eval $inlibc
9501
9502 : locate the flags for 'access()'
9503 case "$d_access" in
9504 "$define")
9505         echo " "
9506         $cat >access.c <<EOCP
9507 #include <sys/types.h>
9508 #ifdef I_FCNTL
9509 #include <fcntl.h>
9510 #endif
9511 #ifdef I_SYS_FILE
9512 #include <sys/file.h>
9513 #endif
9514 #ifdef I_UNISTD
9515 #include <unistd.h>
9516 #endif
9517 #$i_stdlib I_STDLIB
9518 #ifdef I_STDLIB
9519 #include <stdlib.h>
9520 #endif
9521 int main() {
9522         exit(R_OK);
9523 }
9524 EOCP
9525         : check sys/file.h first, no particular reason here
9526         if $test `./findhdr sys/file.h` && \
9527                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9528                 h_sysfile=true;
9529                 echo "<sys/file.h> defines the *_OK access constants." >&4
9530         elif $test `./findhdr fcntl.h` && \
9531                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9532                 h_fcntl=true;
9533                 echo "<fcntl.h> defines the *_OK access constants." >&4
9534         elif $test `./findhdr unistd.h` && \
9535                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9536                 echo "<unistd.h> defines the *_OK access constants." >&4
9537         else
9538                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9539         fi
9540         ;;
9541 esac
9542 $rm -f access*
9543
9544 : see if accessx exists
9545 set accessx d_accessx
9546 eval $inlibc
9547
9548 : see if aintl exists
9549 set aintl d_aintl
9550 eval $inlibc
9551
9552 : see if alarm exists
9553 set alarm d_alarm
9554 eval $inlibc
9555
9556 : see if POSIX threads are available
9557 set pthread.h i_pthread
9558 eval $inhdr
9559
9560 : define a fucntion to check prototypes
9561 $cat > protochk <<EOSH
9562 $startsh
9563 cc="$cc"
9564 optimize="$optimize"
9565 ccflags="$ccflags"
9566 prototype="$prototype"
9567 define="$define"
9568 rm=$rm
9569 usethreads=$usethreads
9570 i_pthread=$i_pthread
9571 pthread_h_first=$pthread_h_first
9572 EOSH
9573
9574 $cat >> protochk <<'EOSH'
9575
9576 $rm -f try.c
9577 foo="$1"
9578 shift
9579 while test $# -ge 2; do
9580         case "$1" in
9581                 $define) echo "#include <$2>" >> try.c ;;
9582                 literal) echo "$2" >> try.c ;;
9583         esac
9584     # Extra magic for the benefit of systems that need pthread.h
9585     # to be included early to correctly detect threadsafe functions.
9586     # Such functions must guarantee themselves, though, that the usethreads
9587     # and i_pthread have been defined, before calling protochk.
9588     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9589         echo "#include <pthread.h>" >> try.c
9590         pthread_h_done=yes
9591     fi
9592     shift 2
9593 done
9594 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9595 cat >> try.c <<'EOCP'
9596 #ifdef CAN_PROTOTYPE
9597 #define _(args) args
9598 #else
9599 #define _(args) ()
9600 #endif
9601 EOCP
9602 echo "$foo" >> try.c
9603 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9604 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9605 status=$?
9606 $rm -f try.[co]
9607 exit $status
9608 EOSH
9609 chmod +x protochk
9610 $eunicefix protochk
9611
9612 hasproto='varname=$1; func=$2; shift; shift;
9613 while $test $# -ge 2; do
9614         case "$1" in
9615         $define) echo "#include <$2>";;
9616         esac ;
9617     shift 2;
9618 done > try.c;
9619 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9620 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9621         echo "$func() prototype found.";
9622         val="$define";
9623 else
9624         echo "$func() prototype NOT found.";
9625         val="$undef";
9626 fi;
9627 set $varname;
9628 eval $setvar;
9629 $rm -f try.c tryout.c'
9630
9631 : see if sys/types.h has to be included
9632 set sys/types.h i_systypes
9633 eval $inhdr
9634
9635 : see if sys/select.h has to be included
9636 set sys/select.h i_sysselct
9637 eval $inhdr
9638
9639 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9640 while $test $# -ge 2; do
9641         case "$1" in
9642         $define) echo "#include <$2>";;
9643         esac ;
9644     shift 2;
9645 done > try.c;
9646 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9647 set try;
9648 if eval $compile; then
9649         val="$define";
9650 else
9651         val="$undef";
9652 fi;
9653 set $varname;
9654 eval $setvar;
9655 $rm -f try.c try.o'
9656
9657 : see if we should include time.h, sys/time.h, or both
9658 echo " "
9659 if test "X$timeincl" = X; then
9660         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9661         $echo $n "I'm now running the test program...$c"
9662         $cat >try.c <<EOCP
9663 #include <sys/types.h>
9664 #ifdef I_TIME
9665 #include <time.h>
9666 #endif
9667 #ifdef I_SYSTIME
9668 #ifdef SYSTIMEKERNEL
9669 #define KERNEL
9670 #endif
9671 #include <sys/time.h>
9672 #endif
9673 #ifdef I_SYSSELECT
9674 #include <sys/select.h>
9675 #endif
9676 #$i_stdlib I_STDLIB
9677 #ifdef I_STDLIB
9678 #include <stdlib.h>
9679 #endif
9680 int main()
9681 {
9682         struct tm foo;
9683 #ifdef S_TIMEVAL
9684         struct timeval bar;
9685 #endif
9686 #ifdef S_TIMEZONE
9687         struct timezone tzp;
9688 #endif
9689         if (foo.tm_sec == foo.tm_sec)
9690                 exit(0);
9691 #ifdef S_TIMEVAL
9692         if (bar.tv_sec == bar.tv_sec)
9693                 exit(0);
9694 #endif
9695         exit(1);
9696 }
9697 EOCP
9698         flags=''
9699         for s_timezone in '-DS_TIMEZONE' ''; do
9700         sysselect=''
9701         for s_timeval in '-DS_TIMEVAL' ''; do
9702         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9703         for i_time in '' '-DI_TIME'; do
9704         for i_systime in '-DI_SYSTIME' ''; do
9705                 case "$flags" in
9706                 '') $echo $n ".$c"
9707                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9708                         if eval $compile; then
9709                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9710                                 shift
9711                                 flags="$*"
9712                                 echo " "
9713                                 $echo $n "Succeeded with $flags$c"
9714                         fi
9715                         ;;
9716                 esac
9717         done
9718         done
9719         done
9720         done
9721         done
9722         timeincl=''
9723         echo " "
9724         case "$flags" in
9725         *SYSTIMEKERNEL*) i_systimek="$define"
9726                 timeincl=`./findhdr sys/time.h`
9727                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9728         *) i_systimek="$undef";;
9729         esac
9730         case "$flags" in
9731         *I_TIME*) i_time="$define"
9732                 timeincl=`./findhdr time.h`" $timeincl"
9733                 echo "We'll include <time.h>." >&4;;
9734         *) i_time="$undef";;
9735         esac
9736         case "$flags" in
9737         *I_SYSTIME*) i_systime="$define"
9738                 timeincl=`./findhdr sys/time.h`" $timeincl"
9739                 echo "We'll include <sys/time.h>." >&4;;
9740         *) i_systime="$undef";;
9741         esac
9742         $rm -f try.c try
9743 fi
9744 : see if struct tm knows about tm_zone
9745 case "$i_systime$i_time" in
9746 *$define*) 
9747         echo " "
9748         echo "Checking to see if your struct tm has tm_zone field..." >&4
9749         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9750         eval $hasfield
9751         ;;
9752 *)      val="$undef"
9753         set d_tm_tm_zone
9754         eval $setvar
9755         ;;
9756 esac
9757 case "$d_tm_tm_zone" in
9758 "$define")      echo "Yes, it does."   ;;
9759 *)              echo "No, it doesn't." ;;
9760 esac
9761 : see if struct tm knows about tm_gmtoff
9762 case "$i_systime$i_time" in
9763 *$define*) 
9764         echo " "
9765         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9766         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9767         eval $hasfield
9768         ;;
9769 *)      val="$undef"
9770         set d_tm_tm_gmtoff
9771         eval $setvar
9772         ;;
9773 esac
9774 case "$d_tm_tm_gmtoff" in
9775 "$define")      echo "Yes, it does."   ;;
9776 *)              echo "No, it doesn't." ;;
9777 esac
9778
9779 : see if asctime_r exists
9780 set asctime_r d_asctime_r
9781 eval $inlibc
9782 case "$d_asctime_r" in
9783 "$define")
9784         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9785         case "$d_asctime_r_proto:$usethreads" in
9786         ":define")      d_asctime_r_proto=define
9787                 set d_asctime_r_proto asctime_r $hdrs
9788                 eval $hasproto ;;
9789         *)      ;;
9790         esac
9791         case "$d_asctime_r_proto" in
9792         define)
9793         case "$asctime_r_proto" in
9794         ''|0) try='char* asctime_r(const struct tm*, char*);'
9795         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9796         esac
9797         case "$asctime_r_proto" in
9798         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9799         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9800         esac
9801         case "$asctime_r_proto" in
9802         ''|0) try='int asctime_r(const struct tm*, char*);'
9803         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9804         esac
9805         case "$asctime_r_proto" in
9806         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9807         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9808         esac
9809         case "$asctime_r_proto" in
9810         ''|0)   d_asctime_r=undef
9811                 asctime_r_proto=0
9812                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9813         * )     case "$asctime_r_proto" in
9814                 REENTRANT_PROTO*) ;;
9815                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9816                 esac
9817                 echo "Prototype: $try" ;;
9818         esac
9819         ;;
9820         *)      case "$usethreads" in
9821                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9822                 esac
9823                 d_asctime_r=undef
9824                 asctime_r_proto=0
9825                 ;;
9826         esac
9827         ;;
9828 *)      asctime_r_proto=0
9829         ;;
9830 esac
9831
9832 : see if atolf exists
9833 set atolf d_atolf
9834 eval $inlibc
9835
9836 : see if atoll exists
9837 set atoll d_atoll
9838 eval $inlibc
9839
9840 : Look for GCC-style attribute format
9841 case "$d_attribute_format" in
9842 '')
9843 echo " "
9844 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
9845 $cat >attrib.c <<'EOCP'
9846 #include <stdio.h>
9847 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
9848 EOCP
9849 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9850         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9851                 echo "Your C compiler doesn't support __attribute__((format))."
9852                 val="$undef"
9853         else
9854                 echo "Your C compiler supports __attribute__((format))."
9855                 val="$define"
9856         fi
9857 else
9858         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9859         val="$undef"
9860 fi
9861 ;;
9862 *) val="$d_attribute_format" ;;
9863 esac
9864 set d_attribute_format
9865 eval $setvar
9866 $rm -f attrib*
9867
9868 : Look for GCC-style attribute malloc
9869 case "$d_attribute_malloc" in
9870 '')
9871 echo " "
9872 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
9873 $cat >attrib.c <<'EOCP'
9874 #include <stdio.h>
9875 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
9876 EOCP
9877 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9878         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9879                 echo "Your C compiler doesn't support __attribute__((malloc))."
9880                 val="$undef"
9881         else
9882                 echo "Your C compiler supports __attribute__((malloc))."
9883                 val="$define"
9884         fi
9885 else
9886         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9887         val="$undef"
9888 fi
9889 ;;
9890 *) val="$d_attribute_malloc" ;;
9891 esac
9892 set d_attribute_malloc
9893 eval $setvar
9894 $rm -f attrib*
9895
9896 : Look for GCC-style attribute nonnull
9897 case "$d_attribute_nonnull" in
9898 '')
9899 echo " "
9900 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
9901 $cat >attrib.c <<'EOCP'
9902 #include <stdio.h>
9903 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
9904 EOCP
9905 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9906         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9907                 echo "Your C compiler doesn't support __attribute__((nonnull))."
9908                 val="$undef"
9909         else
9910                 echo "Your C compiler supports __attribute__((nonnull))."
9911                 val="$define"
9912         fi
9913 else
9914         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9915         val="$undef"
9916 fi
9917 ;;
9918 *) val="$d_attribute_nonnull" ;;
9919 esac
9920 set d_attribute_nonnull
9921 eval $setvar
9922 $rm -f attrib*
9923
9924 : Look for GCC-style attribute noreturn
9925 case "$d_attribute_noreturn" in
9926 '')
9927 echo " "
9928 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
9929 $cat >attrib.c <<'EOCP'
9930 #include <stdio.h>
9931 void fall_over_dead( void ) __attribute__((noreturn));
9932 EOCP
9933 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9934         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9935                 echo "Your C compiler doesn't support __attribute__((noreturn))."
9936                 val="$undef"
9937         else
9938                 echo "Your C compiler supports __attribute__((noreturn))."
9939                 val="$define"
9940         fi
9941 else
9942         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9943         val="$undef"
9944 fi
9945 ;;
9946 *) val="$d_attribute_noreturn" ;;
9947 esac
9948 set d_attribute_noreturn
9949 eval $setvar
9950 $rm -f attrib*
9951
9952 : Look for GCC-style attribute pure
9953 case "$d_attribute_pure" in
9954 '')
9955 echo " "
9956 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
9957 $cat >attrib.c <<'EOCP'
9958 #include <stdio.h>
9959 int square( int n ) __attribute__((pure));
9960 EOCP
9961 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9962         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9963                 echo "Your C compiler doesn't support __attribute__((pure))."
9964                 val="$undef"
9965         else
9966                 echo "Your C compiler supports __attribute__((pure))."
9967                 val="$define"
9968         fi
9969 else
9970         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9971         val="$undef"
9972 fi
9973 ;;
9974 *) val="$d_attribute_pure" ;;
9975 esac
9976 set d_attribute_pure
9977 eval $setvar
9978 $rm -f attrib*
9979
9980 : Look for GCC-style attribute unused
9981 case "$d_attribute_unused" in
9982 '')
9983 echo " "
9984 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
9985 $cat >attrib.c <<'EOCP'
9986 #include <stdio.h>
9987 int do_something( int dummy __attribute__((unused)), int n );
9988 EOCP
9989 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
9990         if $contains 'warning' attrib.out >/dev/null 2>&1; then
9991                 echo "Your C compiler doesn't support __attribute__((unused))."
9992                 val="$undef"
9993         else
9994                 echo "Your C compiler supports __attribute__((unused))."
9995                 val="$define"
9996         fi
9997 else
9998         echo "Your C compiler doesn't seem to understand __attribute__ at all."
9999         val="$undef"
10000 fi
10001 ;;
10002 *) val="$d_attribute_unused" ;;
10003 esac
10004 set d_attribute_unused
10005 eval $setvar
10006 $rm -f attrib*
10007
10008 : Look for GCC-style attribute warn_unused_result
10009 case "$d_attribute_warn_unused_result" in
10010 '')
10011 echo " "
10012 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10013 $cat >attrib.c <<'EOCP'
10014 #include <stdio.h>
10015 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10016 EOCP
10017 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10018         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10019                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10020                 val="$undef"
10021         else
10022                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10023                 val="$define"
10024         fi
10025 else
10026         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10027         val="$undef"
10028 fi
10029 ;;
10030 *) val="$d_attribute_warn_unused_result" ;;
10031 esac
10032 set d_attribute_warn_unused_result
10033 eval $setvar
10034 $rm -f attrib*
10035
10036 : see if bcmp exists
10037 set bcmp d_bcmp
10038 eval $inlibc
10039
10040 : see if bcopy exists
10041 set bcopy d_bcopy
10042 eval $inlibc
10043
10044 : see if this is a unistd.h system
10045 set unistd.h i_unistd
10046 eval $inhdr
10047
10048 : see if getpgrp exists
10049 set getpgrp d_getpgrp
10050 eval $inlibc
10051
10052 case "$d_getpgrp" in
10053 "$define")
10054         echo " "
10055         echo "Checking to see which flavor of getpgrp is in use..."
10056         $cat >try.c <<EOP
10057 #$i_unistd I_UNISTD
10058 #include <sys/types.h>
10059 #ifdef I_UNISTD
10060 #  include <unistd.h>
10061 #endif
10062 #$i_stdlib I_STDLIB
10063 #ifdef I_STDLIB
10064 #include <stdlib.h>
10065 #endif
10066 int main()
10067 {
10068         if (getuid() == 0) {
10069                 printf("(I see you are running Configure as super-user...)\n");
10070                 setuid(1);
10071         }
10072 #ifdef TRY_BSD_PGRP
10073         if (getpgrp(1) == 0)
10074                 exit(0);
10075 #else
10076         if (getpgrp() > 0)
10077                 exit(0);
10078 #endif
10079         exit(1);
10080 }
10081 EOP
10082         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10083                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10084                 val="$define"
10085         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10086                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10087                 val="$undef"
10088         else
10089                 echo "I can't seem to compile and run the test program."
10090                 if ./usg; then
10091                         xxx="a USG one, i.e. you use getpgrp()."
10092                 else
10093                         # SVR4 systems can appear rather BSD-ish.
10094                         case "$i_unistd" in
10095                         $undef)
10096                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10097                                 val="$define"
10098                                 ;;
10099                         $define)
10100                                 xxx="probably a USG one, i.e. you use getpgrp()."
10101                                 val="$undef"
10102                                 ;;
10103                         esac
10104                 fi
10105                 echo "Assuming your getpgrp is $xxx" >&4
10106         fi
10107         ;;
10108 *) val="$undef";;
10109 esac
10110 set d_bsdgetpgrp
10111 eval $setvar
10112 $rm -f try try.*
10113
10114 : see if setpgrp exists
10115 set setpgrp d_setpgrp
10116 eval $inlibc
10117
10118 case "$d_setpgrp" in
10119 "$define")
10120         echo " "
10121         echo "Checking to see which flavor of setpgrp is in use..."
10122         $cat >try.c <<EOP
10123 #$i_unistd I_UNISTD
10124 #include <sys/types.h>
10125 #ifdef I_UNISTD
10126 #  include <unistd.h>
10127 #endif
10128 #$i_stdlib I_STDLIB
10129 #ifdef I_STDLIB
10130 #include <stdlib.h>
10131 #endif
10132 int main()
10133 {
10134         if (getuid() == 0) {
10135                 printf("(I see you are running Configure as super-user...)\n");
10136                 setuid(1);
10137         }
10138 #ifdef TRY_BSD_PGRP
10139         if (-1 == setpgrp(1, 1))
10140                 exit(0);
10141 #else
10142         if (setpgrp() != -1)
10143                 exit(0);
10144 #endif
10145         exit(1);
10146 }
10147 EOP
10148         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10149                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10150                 val="$define"
10151         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10152                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10153                 val="$undef"
10154         else
10155                 echo "(I can't seem to compile and run the test program.)"
10156                 if ./usg; then
10157                         xxx="a USG one, i.e. you use setpgrp()."
10158                 else
10159                         # SVR4 systems can appear rather BSD-ish.
10160                         case "$i_unistd" in
10161                         $undef)
10162                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10163                                 val="$define"
10164                                 ;;
10165                         $define)
10166                                 xxx="probably a USG one, i.e. you use setpgrp()."
10167                                 val="$undef"
10168                                 ;;
10169                         esac
10170                 fi
10171                 echo "Assuming your setpgrp is $xxx" >&4
10172         fi
10173         ;;
10174 *) val="$undef";;
10175 esac
10176 set d_bsdsetpgrp
10177 eval $setvar
10178 $rm -f try try.*
10179 : Look for GCC-style __builtin_choose_expr
10180 case "$d_builtin_choose_expr" in
10181 '')
10182     echo " "
10183     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10184     $cat >try.c <<'EOCP'
10185 #include <assert.h>
10186 #include <stdlib.h>
10187 #include <stdio.h>
10188
10189 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10190
10191 int main(void) {
10192     assert( SYRINX(1) == 2112 );
10193     assert( SYRINX(1) != 5150 );
10194     assert( SYRINX(0) == 5150 );
10195     assert( SYRINX(0) != 2112 );
10196     puts( "All good!" );
10197     exit(0);
10198 }
10199
10200 EOCP
10201     set try
10202     if eval $compile; then
10203         echo "Your C compiler supports __builtin_choose_expr."
10204         val="$define"
10205     else
10206         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10207         val="$undef"
10208     fi
10209 ;;
10210 *) val="$d_builtin_choose_expr" ;;
10211 esac
10212
10213 set d_builtin_choose_expr
10214 eval $setvar
10215 $rm -f try.* try core core.try.*
10216
10217 : Look for GCC-style __builtin_expect
10218 case "$d_builtin_expect" in
10219 '')
10220     echo " "
10221     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10222     $cat >builtin.c <<'EOCP'
10223 int main(void) {
10224     int n = 50;
10225     if ( __builtin_expect(n, 0) ) n = 1;
10226 }
10227 EOCP
10228     set try
10229     if eval $compile; then
10230         echo "Your C compiler supports __builtin_choose_expr."
10231         val="$define"
10232     else
10233         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10234         val="$undef"
10235     fi
10236     ;;
10237 *) val="$d_builtin_expect" ;;
10238 esac
10239
10240 set d_builtin_expect
10241 eval $setvar
10242 $rm -f try.* try core core.try.*
10243
10244 : see if bzero exists
10245 set bzero d_bzero
10246 eval $inlibc
10247
10248 : see if signal is declared as pointer to function returning int or void
10249 echo " "
10250 xxx=`./findhdr signal.h`
10251 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10252 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10253         echo "You have int (*signal())() instead of void." >&4
10254         val="$undef"
10255 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10256         echo "You have void (*signal())()." >&4
10257         val="$define"
10258 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10259         echo "You have int (*signal())() instead of void." >&4
10260         val="$undef"
10261 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10262         echo "You have void (*signal())()." >&4
10263         val="$define"
10264 else
10265         case "$d_voidsig" in
10266         '')
10267         echo "I can't determine whether signal handler returns void or int..." >&4
10268                 dflt=void
10269                 rp="What type does your signal handler return?"
10270                 . ./myread
10271                 case "$ans" in
10272                 v*) val="$define";;
10273                 *) val="$undef";;
10274                 esac;;
10275         "$define")
10276                 echo "As you already told me, signal handler returns void." >&4
10277                 val="$define"
10278                 ;;
10279         *)      echo "As you already told me, signal handler returns int." >&4
10280                 val="$undef"
10281                 ;;
10282         esac
10283 fi
10284 set d_voidsig
10285 eval $setvar
10286 case "$d_voidsig" in
10287 "$define") signal_t="void";;
10288 *) signal_t="int";;
10289 esac
10290 $rm -f $$.tmp
10291
10292 : check for ability to cast large floats to 32-bit ints.
10293 echo " "
10294 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10295 if $test "$intsize" -ge 4; then
10296         xxx=int
10297 else
10298         xxx=long
10299 fi
10300 $cat >try.c <<EOCP
10301 #include <stdio.h>
10302 #$i_stdlib I_STDLIB
10303 #ifdef I_STDLIB
10304 #include <stdlib.h>
10305 #endif
10306 #include <sys/types.h>
10307 #include <signal.h>
10308 $signal_t blech(s) int s; { exit(3); }
10309 int main()
10310 {
10311         $xxx i32;
10312         double f, g;
10313         int result = 0;
10314         char str[16];
10315         signal(SIGFPE, blech);
10316
10317         /* Don't let compiler optimize the test away.  Store the number 
10318            in a writable string for gcc to pass to sscanf under HP/UX.
10319         */
10320         sprintf(str, "2147483647");
10321         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10322         g = 10 * f;
10323         i32  = ($xxx) g;
10324
10325         /* x86 processors will probably give 0x8000 0000, which is a
10326            sign change.  We don't want that.  We want to mimic SPARC
10327            behavior here, which is to preserve the sign and give
10328            back 0x7fff ffff.
10329         */
10330         if (i32 != ($xxx) f)
10331                 result |= 1;
10332         exit(result);
10333 }
10334 EOCP
10335 set try
10336 if eval $compile_ok; then
10337         $run ./try
10338         yyy=$?
10339 else
10340         echo "(I can't seem to compile the test program--assuming it can't)"
10341         yyy=1
10342 fi
10343 case "$yyy" in
10344 0)      val="$define"
10345         echo "Yup, it can."
10346         ;;
10347 *)      val="$undef"
10348         echo "Nope, it can't."
10349         ;;
10350 esac
10351 set d_casti32
10352 eval $setvar
10353 $rm -f try try.*
10354
10355 : check for ability to cast negative floats to unsigned
10356 echo " "
10357 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10358 $cat >try.c <<EOCP
10359 #include <stdio.h>
10360 #$i_stdlib I_STDLIB
10361 #ifdef I_STDLIB
10362 #include <stdlib.h>
10363 #endif
10364 #include <sys/types.h>
10365 #include <signal.h>
10366 $signal_t blech(s) int s; { exit(7); }
10367 $signal_t blech_in_list(s) int s; { exit(4); }
10368 unsigned long dummy_long(p) unsigned long p; { return p; }
10369 unsigned int dummy_int(p) unsigned int p; { return p; }
10370 unsigned short dummy_short(p) unsigned short p; { return p; }
10371 int main()
10372 {
10373         double f;
10374         unsigned long along;
10375         unsigned int aint;
10376         unsigned short ashort;
10377         int result = 0;
10378         char str[16];
10379         
10380         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10381            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10382            optimized the whole file away
10383         */
10384         /* Store the number in a writable string for gcc to pass to 
10385            sscanf under HP/UX.
10386         */
10387         sprintf(str, "-123");
10388         sscanf(str, "%lf", &f);  /* f = -123.; */
10389
10390         signal(SIGFPE, blech);
10391         along = (unsigned long)f;
10392         aint = (unsigned int)f;
10393         ashort = (unsigned short)f;
10394         if (along != (unsigned long)-123)
10395                 result |= 1;
10396         if (aint != (unsigned int)-123)
10397                 result |= 1;
10398         if (ashort != (unsigned short)-123)
10399                 result |= 1;
10400         sprintf(str, "1073741824.");
10401         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10402         f = f + f;
10403         along = 0;
10404         along = (unsigned long)f;
10405         if (along != 0x80000000)
10406                 result |= 2;
10407         f -= 1.;
10408         along = 0;
10409         along = (unsigned long)f;
10410         if (along != 0x7fffffff)
10411                 result |= 1;
10412         f += 2.;
10413         along = 0;
10414         along = (unsigned long)f;
10415         if (along != 0x80000001)
10416                 result |= 2;
10417         if (result)
10418                 exit(result);
10419         signal(SIGFPE, blech_in_list);
10420         sprintf(str, "123.");
10421         sscanf(str, "%lf", &f);  /* f = 123.; */
10422         along = dummy_long((unsigned long)f);
10423         aint = dummy_int((unsigned int)f);
10424         ashort = dummy_short((unsigned short)f);
10425         if (along != (unsigned long)123)
10426                 result |= 4;
10427         if (aint != (unsigned int)123)
10428                 result |= 4;
10429         if (ashort != (unsigned short)123)
10430                 result |= 4;
10431         exit(result);
10432
10433 }
10434 EOCP
10435 set try
10436 if eval $compile_ok; then
10437         $run ./try
10438         castflags=$?
10439 else
10440         echo "(I can't seem to compile the test program--assuming it can't)"
10441         castflags=7
10442 fi
10443 case "$castflags" in
10444 0)      val="$define"
10445         echo "Yup, it can."
10446         ;;
10447 *)      val="$undef"
10448         echo "Nope, it can't."
10449         ;;
10450 esac
10451 set d_castneg
10452 eval $setvar
10453 $rm -f try.*
10454
10455 : see if vprintf exists
10456 echo " "
10457 if set vprintf val -f d_vprintf; eval $csym; $val; then
10458         echo 'vprintf() found.' >&4
10459         val="$define"
10460         $cat >try.c <<EOF
10461 #include <varargs.h>
10462 #$i_stdlib I_STDLIB
10463 #ifdef I_STDLIB
10464 #include <stdlib.h>
10465 #endif
10466
10467 int main() { xxx("foo"); }
10468
10469 xxx(va_alist)
10470 va_dcl
10471 {
10472         va_list args;
10473         char buf[10];
10474
10475         va_start(args);
10476         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10477 }
10478 EOF
10479         set try
10480         if eval $compile && $run ./try; then
10481                 echo "Your vsprintf() returns (int)." >&4
10482                 val2="$undef"
10483         else
10484                 echo "Your vsprintf() returns (char*)." >&4
10485                 val2="$define"
10486         fi
10487 else
10488         echo 'vprintf() NOT found.' >&4
10489                 val="$undef"
10490                 val2="$undef"
10491 fi
10492 $rm -f try try.*
10493 set d_vprintf
10494 eval $setvar
10495 val=$val2
10496 set d_charvspr
10497 eval $setvar
10498
10499 : see if chown exists
10500 set chown d_chown
10501 eval $inlibc
10502
10503 : see if chroot exists
10504 set chroot d_chroot
10505 eval $inlibc
10506
10507 : see if chsize exists
10508 set chsize d_chsize
10509 eval $inlibc
10510
10511 : see if class exists
10512 set class d_class
10513 eval $inlibc
10514
10515 : see if clearenv exists
10516 set clearenv d_clearenv
10517 eval $inlibc
10518
10519 hasstruct='varname=$1; struct=$2; shift; shift;
10520 while $test $# -ge 2; do
10521         case "$1" in
10522         $define) echo "#include <$2>";;
10523         esac ;
10524     shift 2;
10525 done > try.c;
10526 echo "int main () { struct $struct foo; }" >> try.c;
10527 set try;
10528 if eval $compile; then
10529         val="$define";
10530 else
10531         val="$undef";
10532 fi;
10533 set $varname;
10534 eval $setvar;
10535 $rm -f try.c try.o'
10536
10537 socketlib=''
10538 sockethdr=''
10539 : see whether socket exists
10540 echo " "
10541 $echo $n "Hmm... $c" >&4
10542 if set socket val -f d_socket; eval $csym; $val; then
10543         echo "Looks like you have Berkeley networking support." >&4
10544         d_socket="$define"
10545         if set setsockopt val -f; eval $csym; $val; then
10546                 d_oldsock="$undef"
10547         else
10548                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10549                 d_oldsock="$define"
10550         fi
10551 else
10552         if $contains socklib libc.list >/dev/null 2>&1; then
10553                 echo "Looks like you have Berkeley networking support." >&4
10554                 d_socket="$define"
10555                 : we will have to assume that it supports the 4.2 BSD interface
10556                 d_oldsock="$undef"
10557         else
10558                 echo "You don't have Berkeley networking in libc$_a..." >&4
10559                 if test "X$d_socket" = "X$define"; then
10560                    echo "...but you seem to believe that you have sockets." >&4
10561                 else
10562                         for net in net socket
10563                         do
10564                                 if test -f /usr/lib/lib$net$_a; then
10565                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10566                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10567                                         if $contains socket libc.list >/dev/null 2>&1; then
10568                                                 d_socket="$define"
10569                                                 socketlib="-l$net"
10570                                                 case "$net" in
10571                                                 net)
10572                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10573                                                         sockethdr="-I/usr/netinclude"
10574                                                         ;;
10575                                                 esac
10576                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10577                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10578                                                         d_oldsock="$undef"
10579                                                 else
10580                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10581                                                         d_oldsock="$define"
10582                                                 fi
10583                                                 break
10584                                         fi
10585                                 fi
10586                         done
10587                         if test "X$d_socket" != "X$define"; then
10588                            echo "or anywhere else I see." >&4
10589                            d_socket="$undef"
10590                            d_oldsock="$undef"
10591                         fi
10592                 fi
10593         fi
10594 fi
10595
10596 : see if socketpair exists
10597 set socketpair d_sockpair
10598 eval $inlibc
10599
10600
10601 echo " "
10602 echo "Checking the availability of certain socket constants..." >&4
10603 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10604         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10605         $cat >try.c <<EOF
10606 #include <sys/types.h>
10607 #include <sys/socket.h>
10608 int main() {
10609     int i = $ENUM;
10610 }
10611 EOF
10612         val="$undef"
10613         set try; if eval $compile; then
10614                 val="$define"
10615         fi
10616         set d_${enum}; eval $setvar
10617         $rm -f try.c try
10618 done
10619
10620 : see if this is a sys/uio.h system
10621 set sys/uio.h i_sysuio
10622 eval $inhdr
10623
10624
10625 echo " "
10626 echo "Checking to see if your system supports struct cmsghdr..." >&4
10627 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10628 eval $hasstruct
10629 case "$d_cmsghdr_s" in
10630 "$define")      echo "Yes, it does."   ;;
10631 *)              echo "No, it doesn't." ;;
10632 esac
10633
10634
10635 : check for const keyword
10636 echo " "
10637 echo 'Checking to see if your C compiler knows about "const"...' >&4
10638 $cat >const.c <<'EOCP'
10639 typedef struct spug { int drokk; } spug;
10640 int main()
10641 {
10642         const char *foo;
10643         const spug y;
10644 }
10645 EOCP
10646 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10647         val="$define"
10648         echo "Yup, it does."
10649 else
10650         val="$undef"
10651         echo "Nope, it doesn't."
10652 fi
10653 set d_const
10654 eval $setvar
10655
10656 : see if copysignl exists
10657 set copysignl d_copysignl
10658 eval $inlibc
10659
10660 : see if crypt exists
10661 echo " "
10662 set crypt d_crypt
10663 eval $inlibc
10664 case "$d_crypt" in
10665 $define) cryptlib='' ;;
10666 *)      if set crypt val -f d_crypt; eval $csym; $val; then
10667                 echo 'crypt() found.' >&4
10668                 val="$define"
10669                 cryptlib=''
10670         else
10671                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
10672                 if $test -z "$cryptlib"; then
10673                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
10674                 else
10675                         cryptlib=-lcrypt
10676                 fi
10677                 if $test -z "$cryptlib"; then
10678                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
10679                 else
10680                         cryptlib=-lcrypt
10681                 fi
10682                 if $test -z "$cryptlib"; then
10683                         cryptlib=`./loc libcrypt$_a "" $libpth`
10684                 else
10685                         cryptlib=-lcrypt
10686                 fi
10687                 if $test -z "$cryptlib"; then
10688                         echo 'crypt() NOT found.' >&4
10689                         val="$undef"
10690                 else
10691                         val="$define"
10692                 fi
10693         fi
10694         set d_crypt
10695         eval $setvar
10696         ;;
10697 esac
10698
10699 : see if this is a crypt.h system
10700 set crypt.h i_crypt
10701 eval $inhdr
10702
10703 : see if crypt_r exists
10704 set crypt_r d_crypt_r
10705 eval $inlibc
10706 case "$d_crypt_r" in
10707 "$define")
10708         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
10709         case "$d_crypt_r_proto:$usethreads" in
10710         ":define")      d_crypt_r_proto=define
10711                 set d_crypt_r_proto crypt_r $hdrs
10712                 eval $hasproto ;;
10713         *)      ;;
10714         esac
10715         case "$d_crypt_r_proto" in
10716         define)
10717         case "$crypt_r_proto" in
10718         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
10719         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
10720         esac
10721         case "$crypt_r_proto" in
10722         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
10723         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
10724         esac
10725         case "$crypt_r_proto" in
10726         ''|0)   d_crypt_r=undef
10727                 crypt_r_proto=0
10728                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
10729         * )     case "$crypt_r_proto" in
10730                 REENTRANT_PROTO*) ;;
10731                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
10732                 esac
10733                 echo "Prototype: $try" ;;
10734         esac
10735         ;;
10736         *)      case "$usethreads" in
10737                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
10738                 esac
10739                 d_crypt_r=undef
10740                 crypt_r_proto=0
10741                 ;;
10742         esac
10743         ;;
10744 *)      crypt_r_proto=0
10745         ;;
10746 esac
10747
10748 : get csh whereabouts
10749 case "$csh" in
10750 'csh') val="$undef" ;;
10751 *) val="$define" ;;
10752 esac
10753 set d_csh
10754 eval $setvar
10755 : Respect a hint or command line value for full_csh.
10756 case "$full_csh" in
10757 '') full_csh=$csh ;;
10758 esac
10759
10760 : see if ctermid_r exists
10761 set ctermid_r d_ctermid_r
10762 eval $inlibc
10763 case "$d_ctermid_r" in
10764 "$define")
10765         hdrs="$i_systypes sys/types.h define stdio.h "
10766         case "$d_ctermid_r_proto:$usethreads" in
10767         ":define")      d_ctermid_r_proto=define
10768                 set d_ctermid_r_proto ctermid_r $hdrs
10769                 eval $hasproto ;;
10770         *)      ;;
10771         esac
10772         case "$d_ctermid_r_proto" in
10773         define)
10774         case "$ctermid_r_proto" in
10775         ''|0) try='char* ctermid_r(char*);'
10776         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
10777         esac
10778         case "$ctermid_r_proto" in
10779         ''|0)   d_ctermid_r=undef
10780                 ctermid_r_proto=0
10781                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
10782         * )     case "$ctermid_r_proto" in
10783                 REENTRANT_PROTO*) ;;
10784                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
10785                 esac
10786                 echo "Prototype: $try" ;;
10787         esac
10788         ;;
10789         *)      case "$usethreads" in
10790                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
10791                 esac
10792                 d_ctermid_r=undef
10793                 ctermid_r_proto=0
10794                 ;;
10795         esac
10796         ;;
10797 *)      ctermid_r_proto=0
10798         ;;
10799 esac
10800
10801 : see if ctime_r exists
10802 set ctime_r d_ctime_r
10803 eval $inlibc
10804 case "$d_ctime_r" in
10805 "$define")
10806         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
10807         case "$d_ctime_r_proto:$usethreads" in
10808         ":define")      d_ctime_r_proto=define
10809                 set d_ctime_r_proto ctime_r $hdrs
10810                 eval $hasproto ;;
10811         *)      ;;
10812         esac
10813         case "$d_ctime_r_proto" in
10814         define)
10815         case "$ctime_r_proto" in
10816         ''|0) try='char* ctime_r(const time_t*, char*);'
10817         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
10818         esac
10819         case "$ctime_r_proto" in
10820         ''|0) try='char* ctime_r(const time_t*, char*, int);'
10821         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
10822         esac
10823         case "$ctime_r_proto" in
10824         ''|0) try='int ctime_r(const time_t*, char*);'
10825         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
10826         esac
10827         case "$ctime_r_proto" in
10828         ''|0) try='int ctime_r(const time_t*, char*, int);'
10829         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
10830         esac
10831         case "$ctime_r_proto" in
10832         ''|0)   d_ctime_r=undef
10833                 ctime_r_proto=0
10834                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
10835         * )     case "$ctime_r_proto" in
10836                 REENTRANT_PROTO*) ;;
10837                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
10838                 esac
10839                 echo "Prototype: $try" ;;
10840         esac
10841         ;;
10842         *)      case "$usethreads" in
10843                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
10844                 esac
10845                 d_ctime_r=undef
10846                 ctime_r_proto=0
10847                 ;;
10848         esac
10849         ;;
10850 *)      ctime_r_proto=0
10851         ;;
10852 esac
10853
10854 : see if cuserid exists
10855 set cuserid d_cuserid
10856 eval $inlibc
10857
10858 : see if this is a limits.h system
10859 set limits.h i_limits
10860 eval $inhdr
10861
10862 : see if this is a float.h system
10863 set float.h i_float
10864 eval $inhdr
10865
10866 : See if number of significant digits in a double precision number is known
10867 echo " "
10868 $cat >dbl_dig.c <<EOM
10869 #$i_limits I_LIMITS
10870 #$i_float I_FLOAT
10871 #ifdef I_LIMITS
10872 #include <limits.h>
10873 #endif
10874 #ifdef I_FLOAT
10875 #include <float.h>
10876 #endif
10877 #ifdef DBL_DIG
10878 printf("Contains DBL_DIG");
10879 #endif
10880 EOM
10881 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
10882 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
10883         echo "DBL_DIG found." >&4
10884         val="$define"
10885 else
10886         echo "DBL_DIG NOT found." >&4
10887         val="$undef"
10888 fi
10889 $rm -f dbl_dig.?
10890 set d_dbl_dig
10891 eval $setvar
10892
10893 : see if dbm.h is available
10894 : see if dbmclose exists
10895 set dbmclose d_dbmclose
10896 eval $inlibc
10897
10898 case "$d_dbmclose" in
10899 $define)
10900         set dbm.h i_dbm
10901         eval $inhdr
10902         case "$i_dbm" in
10903         $define)
10904                 val="$undef"
10905                 set i_rpcsvcdbm
10906                 eval $setvar
10907                 ;;
10908         *)      set rpcsvc/dbm.h i_rpcsvcdbm
10909                 eval $inhdr
10910                 ;;
10911         esac
10912         ;;
10913 *)      echo "We won't be including <dbm.h>"
10914         val="$undef"
10915         set i_dbm
10916         eval $setvar
10917         val="$undef"
10918         set i_rpcsvcdbm
10919         eval $setvar
10920         ;;
10921 esac
10922
10923 : see if prototype for dbminit is available
10924 echo " "
10925 set d_dbminitproto dbminit $i_dbm dbm.h
10926 eval $hasproto
10927
10928 : see if difftime exists
10929 set difftime d_difftime
10930 eval $inlibc
10931
10932 : see if this is a dirent system
10933 echo " "
10934 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
10935         val="$define"
10936         echo "<dirent.h> found." >&4
10937 else
10938         val="$undef"
10939         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
10940                 echo "<sys/dir.h> found." >&4
10941                 echo " "
10942         else
10943                 xinc=`./findhdr sys/ndir.h`
10944         fi
10945         echo "<dirent.h> NOT found." >&4
10946 fi
10947 set i_dirent
10948 eval $setvar
10949
10950 : Look for type of directory structure.
10951 echo " "
10952 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10953
10954 case "$direntrytype" in
10955 ''|' ')
10956         case "$i_dirent" in
10957         $define) guess1='struct dirent' ;;
10958         *) guess1='struct direct'  ;;
10959         esac
10960         ;;
10961 *)      guess1="$direntrytype"
10962         ;;
10963 esac
10964
10965 case "$guess1" in
10966 'struct dirent') guess2='struct direct' ;;
10967 *) guess2='struct dirent' ;;
10968 esac
10969                 
10970 if $contains "$guess1" try.c >/dev/null 2>&1; then
10971         direntrytype="$guess1"
10972         echo "Your directory entries are $direntrytype." >&4
10973 elif $contains "$guess2" try.c >/dev/null 2>&1; then
10974         direntrytype="$guess2"
10975         echo "Your directory entries seem to be $direntrytype." >&4
10976 else
10977         echo "I don't recognize your system's directory entries." >&4
10978         rp="What type is used for directory entries on this system?"
10979         dflt="$guess1"
10980         . ./myread
10981         direntrytype="$ans"
10982 fi
10983 $rm -f try.c
10984
10985
10986 : see if the directory entry stores field length
10987 echo " "
10988 $cppstdin $cppflags $cppminus < "$xinc" > try.c
10989 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
10990         echo "Good, your directory entry keeps length information in d_namlen." >&4
10991         val="$define"
10992 else
10993         echo "Your directory entry does not know about the d_namlen field." >&4
10994         val="$undef"
10995 fi
10996 set d_dirnamlen
10997 eval $setvar
10998 $rm -f try.c
10999
11000 : see if this is an sysdir system
11001 set sys/dir.h i_sysdir
11002 eval $inhdr
11003
11004 : see if this is an sysndir system
11005 set sys/ndir.h i_sysndir
11006 eval $inhdr
11007
11008 : Look for dirfd
11009 echo " "
11010 $cat >dirfd.c <<EOM
11011 #include <stdio.h>
11012 #$i_stdlib I_STDLIB
11013 #ifdef I_STDLIB
11014 #include <stdlib.h>
11015 #endif
11016 #$i_dirent I_DIRENT             /**/
11017 #$i_sysdir I_SYS_DIR            /**/
11018 #$i_sysndir I_SYS_NDIR          /**/
11019 #$i_systypes I_SYS_TYPES        /**/
11020 #if defined(I_SYS_TYPES)
11021 #include <sys/types.h>
11022 #endif
11023 #if defined(I_DIRENT)
11024 #include <dirent.h>
11025 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11026 #include <sys/dir.h>
11027 #endif
11028 #else
11029 #ifdef I_SYS_NDIR
11030 #include <sys/ndir.h>
11031 #else
11032 #ifdef I_SYS_DIR
11033 #ifdef hp9000s500
11034 #include <ndir.h>       /* may be wrong in the future */
11035 #else
11036 #include <sys/dir.h>
11037 #endif
11038 #endif
11039 #endif
11040 #endif 
11041 int main() {
11042         DIR *dirp = opendir(".");
11043         if (dirfd(dirp) >= 0)
11044                 exit(0);
11045         else
11046                 exit(1);
11047 }
11048 EOM
11049 val=$undef
11050 set dirfd
11051 if eval $compile; then
11052         val="$define"
11053 fi
11054 case "$val" in
11055 $define)        echo "dirfd() found." >&4       ;;
11056 *)              echo "dirfd() NOT found." >&4   ;;
11057 esac
11058 set d_dirfd
11059 eval $setvar
11060 $rm -f dirfd*
11061
11062 : see if dlerror exists
11063 xxx_runnm="$runnm"
11064 runnm=false
11065 set dlerror d_dlerror
11066 eval $inlibc
11067 runnm="$xxx_runnm"
11068
11069 : see if dlfcn is available
11070 set dlfcn.h i_dlfcn
11071 eval $inhdr
11072
11073 case "$usedl" in
11074 $define|y|true)
11075         $cat << EOM
11076
11077 On a few systems, the dynamically loaded modules that perl generates and uses
11078 will need a different extension than shared libs. The default will probably
11079 be appropriate.
11080
11081 EOM
11082         case "$dlext" in
11083         '')     dflt="$so" ;;
11084         *)      dflt="$dlext" ;;
11085         esac
11086         rp='What is the extension of dynamically loaded modules'
11087         . ./myread
11088         dlext="$ans"
11089         ;;
11090 *)
11091         dlext="none"
11092         ;;
11093 esac
11094
11095 : Check if dlsym need a leading underscore
11096 echo " "
11097 val="$undef"
11098
11099 case "$dlsrc" in
11100 dl_dlopen.xs)
11101         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11102         $cat >dyna.c <<'EOM'
11103 fred () { }
11104 EOM
11105
11106 $cat >fred.c<<EOM
11107
11108 #include <stdio.h>
11109 #$i_stdlib I_STDLIB
11110 #ifdef I_STDLIB
11111 #include <stdlib.h>
11112 #endif
11113 #$i_dlfcn I_DLFCN
11114 #ifdef I_DLFCN
11115 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11116 #else
11117 #include <sys/types.h>
11118 #include <nlist.h>
11119 #include <link.h>
11120 #endif
11121
11122 extern int fred() ;
11123
11124 int main()
11125 {
11126     void * handle ;
11127     void * symbol ;
11128 #ifndef RTLD_LAZY
11129     int mode = 1 ;
11130 #else
11131     int mode = RTLD_LAZY ;
11132 #endif
11133     handle = dlopen("./dyna.$dlext", mode) ;
11134     if (handle == NULL) {
11135         printf ("1\n") ;
11136         fflush (stdout) ;
11137         exit(0);
11138     }
11139     symbol = dlsym(handle, "fred") ;
11140     if (symbol == NULL) {
11141         /* try putting a leading underscore */
11142         symbol = dlsym(handle, "_fred") ;
11143         if (symbol == NULL) {
11144             printf ("2\n") ;
11145             fflush (stdout) ;
11146             exit(0);
11147         }
11148         printf ("3\n") ;
11149     }
11150     else
11151         printf ("4\n") ;
11152     fflush (stdout) ;
11153     exit(0);
11154 }
11155 EOM
11156         : Call the object file tmp-dyna.o in case dlext=o.
11157         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11158                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11159                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11160                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11161                 xxx=`$run ./fred`
11162                 case $xxx in
11163                 1)      echo "Test program failed using dlopen." >&4
11164                         echo "Perhaps you should not use dynamic loading." >&4;;
11165                 2)      echo "Test program failed using dlsym." >&4
11166                         echo "Perhaps you should not use dynamic loading." >&4;;
11167                 3)      echo "dlsym needs a leading underscore" >&4
11168                         val="$define" ;;
11169                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11170                 esac
11171         else
11172                 echo "I can't compile and run the test program." >&4
11173                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11174         fi
11175         ;;
11176 esac
11177                 
11178 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11179
11180 set d_dlsymun
11181 eval $setvar
11182
11183 : see if drand48_r exists
11184 set drand48_r d_drand48_r
11185 eval $inlibc
11186 case "$d_drand48_r" in
11187 "$define")
11188         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11189         case "$d_drand48_r_proto:$usethreads" in
11190         ":define")      d_drand48_r_proto=define
11191                 set d_drand48_r_proto drand48_r $hdrs
11192                 eval $hasproto ;;
11193         *)      ;;
11194         esac
11195         case "$d_drand48_r_proto" in
11196         define)
11197         case "$drand48_r_proto" in
11198         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11199         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11200         esac
11201         case "$drand48_r_proto" in
11202         ''|0)   d_drand48_r=undef
11203                 drand48_r_proto=0
11204                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11205         * )     case "$drand48_r_proto" in
11206                 REENTRANT_PROTO*) ;;
11207                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11208                 esac
11209                 echo "Prototype: $try" ;;
11210         esac
11211         ;;
11212         *)      case "$usethreads" in
11213                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11214                 esac
11215                 d_drand48_r=undef
11216                 drand48_r_proto=0
11217                 ;;
11218         esac
11219         ;;
11220 *)      drand48_r_proto=0
11221         ;;
11222 esac
11223
11224 : see if prototype for drand48 is available
11225 echo " "
11226 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11227 eval $hasproto
11228
11229 : see if dup2 exists
11230 set dup2 d_dup2
11231 eval $inlibc
11232
11233 : see if eaccess exists
11234 set eaccess d_eaccess
11235 eval $inlibc
11236
11237 : see if endgrent exists
11238 set endgrent d_endgrent
11239 eval $inlibc
11240
11241 : see if this is an grp system
11242 set grp.h i_grp
11243 eval $inhdr
11244
11245 case "$i_grp" in
11246 $define)
11247         xxx=`./findhdr grp.h`
11248         $cppstdin $cppflags $cppminus < $xxx >$$.h
11249
11250         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11251                 val="$define"
11252         else
11253                 val="$undef"
11254         fi
11255         set d_grpasswd
11256         eval $setvar
11257
11258         $rm -f $$.h
11259         ;;
11260 *)
11261         val="$undef";
11262         set d_grpasswd; eval $setvar
11263         ;;
11264 esac
11265
11266 : see if endgrent_r exists
11267 set endgrent_r d_endgrent_r
11268 eval $inlibc
11269 case "$d_endgrent_r" in
11270 "$define")
11271         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11272         case "$d_endgrent_r_proto:$usethreads" in
11273         ":define")      d_endgrent_r_proto=define
11274                 set d_endgrent_r_proto endgrent_r $hdrs
11275                 eval $hasproto ;;
11276         *)      ;;
11277         esac
11278         case "$d_endgrent_r_proto" in
11279         define)
11280         case "$endgrent_r_proto" in
11281         ''|0) try='int endgrent_r(FILE**);'
11282         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11283         esac
11284         case "$endgrent_r_proto" in
11285         ''|0) try='void endgrent_r(FILE**);'
11286         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11287         esac
11288         case "$endgrent_r_proto" in
11289         ''|0)   d_endgrent_r=undef
11290                 endgrent_r_proto=0
11291                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11292         * )     case "$endgrent_r_proto" in
11293                 REENTRANT_PROTO*) ;;
11294                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11295                 esac
11296                 echo "Prototype: $try" ;;
11297         esac
11298         ;;
11299         *)      case "$usethreads" in
11300                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11301                 esac
11302                 d_endgrent_r=undef
11303                 endgrent_r_proto=0
11304                 ;;
11305         esac
11306         ;;
11307 *)      endgrent_r_proto=0
11308         ;;
11309 esac
11310
11311 : see if endhostent exists
11312 set endhostent d_endhent
11313 eval $inlibc
11314
11315 : see if this is a netdb.h system
11316 set netdb.h i_netdb
11317 eval $inhdr
11318
11319 : see if endhostent_r exists
11320 set endhostent_r d_endhostent_r
11321 eval $inlibc
11322 case "$d_endhostent_r" in
11323 "$define")
11324         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11325         case "$d_endhostent_r_proto:$usethreads" in
11326         ":define")      d_endhostent_r_proto=define
11327                 set d_endhostent_r_proto endhostent_r $hdrs
11328                 eval $hasproto ;;
11329         *)      ;;
11330         esac
11331         case "$d_endhostent_r_proto" in
11332         define)
11333         case "$endhostent_r_proto" in
11334         ''|0) try='int endhostent_r(struct hostent_data*);'
11335         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11336         esac
11337         case "$endhostent_r_proto" in
11338         ''|0) try='void endhostent_r(struct hostent_data*);'
11339         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11340         esac
11341         case "$endhostent_r_proto" in
11342         ''|0)   d_endhostent_r=undef
11343                 endhostent_r_proto=0
11344                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11345         * )     case "$endhostent_r_proto" in
11346                 REENTRANT_PROTO*) ;;
11347                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11348                 esac
11349                 echo "Prototype: $try" ;;
11350         esac
11351         ;;
11352         *)      case "$usethreads" in
11353                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11354                 esac
11355                 d_endhostent_r=undef
11356                 endhostent_r_proto=0
11357                 ;;
11358         esac
11359         ;;
11360 *)      endhostent_r_proto=0
11361         ;;
11362 esac
11363
11364 : see if endnetent exists
11365 set endnetent d_endnent
11366 eval $inlibc
11367
11368 : see if endnetent_r exists
11369 set endnetent_r d_endnetent_r
11370 eval $inlibc
11371 case "$d_endnetent_r" in
11372 "$define")
11373         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11374         case "$d_endnetent_r_proto:$usethreads" in
11375         ":define")      d_endnetent_r_proto=define
11376                 set d_endnetent_r_proto endnetent_r $hdrs
11377                 eval $hasproto ;;
11378         *)      ;;
11379         esac
11380         case "$d_endnetent_r_proto" in
11381         define)
11382         case "$endnetent_r_proto" in
11383         ''|0) try='int endnetent_r(struct netent_data*);'
11384         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11385         esac
11386         case "$endnetent_r_proto" in
11387         ''|0) try='void endnetent_r(struct netent_data*);'
11388         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11389         esac
11390         case "$endnetent_r_proto" in
11391         ''|0)   d_endnetent_r=undef
11392                 endnetent_r_proto=0
11393                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11394         * )     case "$endnetent_r_proto" in
11395                 REENTRANT_PROTO*) ;;
11396                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11397                 esac
11398                 echo "Prototype: $try" ;;
11399         esac
11400         ;;
11401         *)      case "$usethreads" in
11402                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11403                 esac
11404                 d_endnetent_r=undef
11405                 endnetent_r_proto=0
11406                 ;;
11407         esac
11408         ;;
11409 *)      endnetent_r_proto=0
11410         ;;
11411 esac
11412
11413 : see if endprotoent exists
11414 set endprotoent d_endpent
11415 eval $inlibc
11416
11417 : see if endprotoent_r exists
11418 set endprotoent_r d_endprotoent_r
11419 eval $inlibc
11420 case "$d_endprotoent_r" in
11421 "$define")
11422         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11423         case "$d_endprotoent_r_proto:$usethreads" in
11424         ":define")      d_endprotoent_r_proto=define
11425                 set d_endprotoent_r_proto endprotoent_r $hdrs
11426                 eval $hasproto ;;
11427         *)      ;;
11428         esac
11429         case "$d_endprotoent_r_proto" in
11430         define)
11431         case "$endprotoent_r_proto" in
11432         ''|0) try='int endprotoent_r(struct protoent_data*);'
11433         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11434         esac
11435         case "$endprotoent_r_proto" in
11436         ''|0) try='void endprotoent_r(struct protoent_data*);'
11437         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11438         esac
11439         case "$endprotoent_r_proto" in
11440         ''|0)   d_endprotoent_r=undef
11441                 endprotoent_r_proto=0
11442                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11443         * )     case "$endprotoent_r_proto" in
11444                 REENTRANT_PROTO*) ;;
11445                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11446                 esac
11447                 echo "Prototype: $try" ;;
11448         esac
11449         ;;
11450         *)      case "$usethreads" in
11451                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11452                 esac
11453                 d_endprotoent_r=undef
11454                 endprotoent_r_proto=0
11455                 ;;
11456         esac
11457         ;;
11458 *)      endprotoent_r_proto=0
11459         ;;
11460 esac
11461
11462 : see if endpwent exists
11463 set endpwent d_endpwent
11464 eval $inlibc
11465
11466 : see if this is a pwd.h system
11467 set pwd.h i_pwd
11468 eval $inhdr
11469
11470 case "$i_pwd" in
11471 $define)
11472         xxx=`./findhdr pwd.h`
11473         $cppstdin $cppflags $cppminus < $xxx >$$.h
11474
11475         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11476                 val="$define"
11477         else
11478                 val="$undef"
11479         fi
11480         set d_pwquota
11481         eval $setvar
11482
11483         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11484                 val="$define"
11485         else
11486                 val="$undef"
11487         fi
11488         set d_pwage
11489         eval $setvar
11490
11491         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11492                 val="$define"
11493         else
11494                 val="$undef"
11495         fi
11496         set d_pwchange
11497         eval $setvar
11498
11499         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11500                 val="$define"
11501         else
11502                 val="$undef"
11503         fi
11504         set d_pwclass
11505         eval $setvar
11506
11507         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11508                 val="$define"
11509         else
11510                 val="$undef"
11511         fi
11512         set d_pwexpire
11513         eval $setvar
11514
11515         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11516                 val="$define"
11517         else
11518                 val="$undef"
11519         fi
11520         set d_pwcomment
11521         eval $setvar
11522
11523         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11524                 val="$define"
11525         else
11526                 val="$undef"
11527         fi
11528         set d_pwgecos
11529         eval $setvar
11530
11531         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11532                 val="$define"
11533         else
11534                 val="$undef"
11535         fi
11536         set d_pwpasswd
11537         eval $setvar
11538
11539         $rm -f $$.h
11540         ;;
11541 *)
11542         val="$undef"; 
11543         set d_pwquota; eval $setvar
11544         set d_pwage; eval $setvar
11545         set d_pwchange; eval $setvar
11546         set d_pwclass; eval $setvar
11547         set d_pwexpire; eval $setvar
11548         set d_pwcomment; eval $setvar
11549         set d_pwgecos; eval $setvar
11550         set d_pwpasswd; eval $setvar
11551         ;;
11552 esac
11553
11554 : see if endpwent_r exists
11555 set endpwent_r d_endpwent_r
11556 eval $inlibc
11557 case "$d_endpwent_r" in
11558 "$define")
11559         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11560         case "$d_endpwent_r_proto:$usethreads" in
11561         ":define")      d_endpwent_r_proto=define
11562                 set d_endpwent_r_proto endpwent_r $hdrs
11563                 eval $hasproto ;;
11564         *)      ;;
11565         esac
11566         case "$d_endpwent_r_proto" in
11567         define)
11568         case "$endpwent_r_proto" in
11569         ''|0) try='int endpwent_r(FILE**);'
11570         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11571         esac
11572         case "$endpwent_r_proto" in
11573         ''|0) try='void endpwent_r(FILE**);'
11574         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11575         esac
11576         case "$endpwent_r_proto" in
11577         ''|0)   d_endpwent_r=undef
11578                 endpwent_r_proto=0
11579                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11580         * )     case "$endpwent_r_proto" in
11581                 REENTRANT_PROTO*) ;;
11582                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11583                 esac
11584                 echo "Prototype: $try" ;;
11585         esac
11586         ;;
11587         *)      case "$usethreads" in
11588                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11589                 esac
11590                 d_endpwent_r=undef
11591                 endpwent_r_proto=0
11592                 ;;
11593         esac
11594         ;;
11595 *)      endpwent_r_proto=0
11596         ;;
11597 esac
11598
11599 : see if endservent exists
11600 set endservent d_endsent
11601 eval $inlibc
11602
11603 : see if endservent_r exists
11604 set endservent_r d_endservent_r
11605 eval $inlibc
11606 case "$d_endservent_r" in
11607 "$define")
11608         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11609         case "$d_endservent_r_proto:$usethreads" in
11610         ":define")      d_endservent_r_proto=define
11611                 set d_endservent_r_proto endservent_r $hdrs
11612                 eval $hasproto ;;
11613         *)      ;;
11614         esac
11615         case "$d_endservent_r_proto" in
11616         define)
11617         case "$endservent_r_proto" in
11618         ''|0) try='int endservent_r(struct servent_data*);'
11619         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11620         esac
11621         case "$endservent_r_proto" in
11622         ''|0) try='void endservent_r(struct servent_data*);'
11623         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11624         esac
11625         case "$endservent_r_proto" in
11626         ''|0)   d_endservent_r=undef
11627                 endservent_r_proto=0
11628                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
11629         * )     case "$endservent_r_proto" in
11630                 REENTRANT_PROTO*) ;;
11631                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
11632                 esac
11633                 echo "Prototype: $try" ;;
11634         esac
11635         ;;
11636         *)      case "$usethreads" in
11637                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
11638                 esac
11639                 d_endservent_r=undef
11640                 endservent_r_proto=0
11641                 ;;
11642         esac
11643         ;;
11644 *)      endservent_r_proto=0
11645         ;;
11646 esac
11647
11648 : Locate the flags for 'open()'
11649 echo " "
11650 $cat >try.c <<EOCP
11651 #include <sys/types.h>
11652 #ifdef I_FCNTL
11653 #include <fcntl.h>
11654 #endif
11655 #ifdef I_SYS_FILE
11656 #include <sys/file.h>
11657 #endif
11658 #$i_stdlib I_STDLIB
11659 #ifdef I_STDLIB
11660 #include <stdlib.h>
11661 #endif
11662 int main() {
11663         if(O_RDONLY);
11664 #ifdef O_TRUNC
11665         exit(0);
11666 #else
11667         exit(1);
11668 #endif
11669 }
11670 EOCP
11671 : check sys/file.h first to get FREAD on Sun
11672 if $test `./findhdr sys/file.h` && \
11673                 set try -DI_SYS_FILE && eval $compile; then
11674         h_sysfile=true;
11675         echo "<sys/file.h> defines the O_* constants..." >&4
11676         if $run ./try; then
11677                 echo "and you have the 3 argument form of open()." >&4
11678                 val="$define"
11679         else
11680                 echo "but not the 3 argument form of open().  Oh, well." >&4
11681                 val="$undef"
11682         fi
11683 elif $test `./findhdr fcntl.h` && \
11684                 set try -DI_FCNTL && eval $compile; then
11685         h_fcntl=true;
11686         echo "<fcntl.h> defines the O_* constants..." >&4
11687         if $run ./try; then
11688                 echo "and you have the 3 argument form of open()." >&4
11689                 val="$define"
11690         else
11691                 echo "but not the 3 argument form of open().  Oh, well." >&4
11692                 val="$undef"
11693         fi
11694 else
11695         val="$undef"
11696         echo "I can't find the O_* constant definitions!  You got problems." >&4
11697 fi
11698 set d_open3
11699 eval $setvar
11700 $rm -f try try.*
11701
11702 : see which of string.h or strings.h is needed
11703 echo " "
11704 strings=`./findhdr string.h`
11705 if $test "$strings" && $test -r "$strings"; then
11706         echo "Using <string.h> instead of <strings.h>." >&4
11707         val="$define"
11708 else
11709         val="$undef"
11710         strings=`./findhdr strings.h`
11711         if $test "$strings" && $test -r "$strings"; then
11712                 echo "Using <strings.h> instead of <string.h>." >&4
11713         else
11714                 echo "No string header found -- You'll surely have problems." >&4
11715         fi
11716 fi
11717 set i_string
11718 eval $setvar
11719 case "$i_string" in
11720 "$undef") strings=`./findhdr strings.h`;;
11721 *)        strings=`./findhdr string.h`;;
11722 esac
11723
11724 : see if this is a sys/file.h system
11725 val=''
11726 set sys/file.h val
11727 eval $inhdr
11728
11729 : do we need to include sys/file.h ?
11730 case "$val" in
11731 "$define")
11732         echo " "
11733         if $h_sysfile; then
11734                 val="$define"
11735                 echo "We'll be including <sys/file.h>." >&4
11736         else
11737                 val="$undef"
11738                 echo "We won't be including <sys/file.h>." >&4
11739         fi
11740         ;;
11741 *)
11742         h_sysfile=false
11743         ;;
11744 esac
11745 set i_sysfile
11746 eval $setvar
11747
11748 : see if fcntl.h is there
11749 val=''
11750 set fcntl.h val
11751 eval $inhdr
11752
11753 : see if we can include fcntl.h
11754 case "$val" in
11755 "$define")
11756         echo " "
11757         if $h_fcntl; then
11758                 val="$define"
11759                 echo "We'll be including <fcntl.h>." >&4
11760         else
11761                 val="$undef"
11762                 if $h_sysfile; then
11763         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
11764                 else
11765                         echo "We won't be including <fcntl.h>." >&4
11766                 fi
11767         fi
11768         ;;
11769 *)
11770         h_fcntl=false
11771         val="$undef"
11772         ;;
11773 esac
11774 set i_fcntl
11775 eval $setvar
11776
11777 : check for non-blocking I/O stuff
11778 case "$h_sysfile" in
11779 true) echo "#include <sys/file.h>" > head.c;;
11780 *)
11781        case "$h_fcntl" in
11782        true) echo "#include <fcntl.h>" > head.c;;
11783        *) echo "#include <sys/fcntl.h>" > head.c;;
11784        esac
11785        ;;
11786 esac
11787 echo " "
11788 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
11789 case "$o_nonblock" in
11790 '')
11791         $cat head.c > try.c
11792         $cat >>try.c <<EOCP
11793 #include <stdio.h>
11794 #$i_stdlib I_STDLIB
11795 #ifdef I_STDLIB
11796 #include <stdlib.h>
11797 #endif
11798 #$i_fcntl I_FCNTL
11799 #ifdef I_FCNTL
11800 #include <fcntl.h>
11801 #endif
11802 int main() {
11803 #ifdef O_NONBLOCK
11804         printf("O_NONBLOCK\n");
11805         exit(0);
11806 #endif
11807 #ifdef O_NDELAY
11808         printf("O_NDELAY\n");
11809         exit(0);
11810 #endif
11811 #ifdef FNDELAY
11812         printf("FNDELAY\n");
11813         exit(0);
11814 #endif
11815         exit(0);
11816 }
11817 EOCP
11818         set try
11819         if eval $compile_ok; then
11820                 o_nonblock=`$run ./try`
11821                 case "$o_nonblock" in
11822                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
11823                 *) echo "Seems like we can use $o_nonblock.";;
11824                 esac
11825         else
11826                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
11827         fi
11828         ;;
11829 *) echo "Using $hint value $o_nonblock.";;
11830 esac
11831 $rm -f try try.* .out core
11832
11833 echo " "
11834 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
11835 case "$eagain" in
11836 '')
11837         $cat head.c > try.c
11838         $cat >>try.c <<EOCP
11839 #include <errno.h>
11840 #include <sys/types.h>
11841 #include <signal.h>
11842 #include <stdio.h> 
11843 #$i_stdlib I_STDLIB
11844 #ifdef I_STDLIB
11845 #include <stdlib.h>
11846 #endif
11847 #$i_fcntl I_FCNTL
11848 #ifdef I_FCNTL
11849 #include <fcntl.h>
11850 #endif
11851 #define MY_O_NONBLOCK $o_nonblock
11852 #ifndef errno  /* XXX need better Configure test */
11853 extern int errno;
11854 #endif
11855 #$i_unistd I_UNISTD
11856 #ifdef I_UNISTD
11857 #include <unistd.h>
11858 #endif
11859 #$i_string I_STRING
11860 #ifdef I_STRING
11861 #include <string.h>
11862 #else
11863 #include <strings.h>
11864 #endif
11865 $signal_t blech(x) int x; { exit(3); }
11866 EOCP
11867         $cat >> try.c <<'EOCP'
11868 int main()
11869 {
11870         int pd[2];
11871         int pu[2];
11872         char buf[1];
11873         char string[100];
11874
11875         pipe(pd);       /* Down: child -> parent */
11876         pipe(pu);       /* Up: parent -> child */
11877         if (0 != fork()) {
11878                 int ret;
11879                 close(pd[1]);   /* Parent reads from pd[0] */
11880                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
11881 #ifdef F_SETFL
11882                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
11883                         exit(1);
11884 #else
11885                 exit(4);
11886 #endif
11887                 signal(SIGALRM, blech);
11888                 alarm(5);
11889                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
11890                         exit(2);
11891                 sprintf(string, "%d\n", ret);
11892                 write(2, string, strlen(string));
11893                 alarm(0);
11894 #ifdef EAGAIN
11895                 if (errno == EAGAIN) {
11896                         printf("EAGAIN\n");
11897                         goto ok;
11898                 }
11899 #endif
11900 #ifdef EWOULDBLOCK
11901                 if (errno == EWOULDBLOCK)
11902                         printf("EWOULDBLOCK\n");
11903 #endif
11904         ok:
11905                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
11906                 sleep(2);                               /* Give it time to close our pipe */
11907                 alarm(5);
11908                 ret = read(pd[0], buf, 1);      /* Should read EOF */
11909                 alarm(0);
11910                 sprintf(string, "%d\n", ret);
11911                 write(4, string, strlen(string));
11912                 exit(0);
11913         }
11914
11915         close(pd[0]);                   /* We write to pd[1] */
11916         close(pu[1]);                   /* We read from pu[0] */
11917         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
11918         close(pd[1]);                   /* Pipe pd is now fully closed! */
11919         exit(0);                                /* Bye bye, thank you for playing! */
11920 }
11921 EOCP
11922         set try
11923         if eval $compile_ok; then
11924                 echo "$startsh" >mtry
11925                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
11926                 chmod +x mtry
11927                 ./mtry >/dev/null 2>&1
11928                 case $? in
11929                 0) eagain=`$cat try.out`;;
11930                 1) echo "Could not perform non-blocking setting!";;
11931                 2) echo "I did a successful read() for something that was not there!";;
11932                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
11933                 4) echo "Could not find F_SETFL!";;
11934                 *) echo "Something terribly wrong happened during testing.";;
11935                 esac
11936                 rd_nodata=`$cat try.ret`
11937                 echo "A read() system call with no data present returns $rd_nodata."
11938                 case "$rd_nodata" in
11939                 0|-1) ;;
11940                 *)
11941                         echo "(That's peculiar, fixing that to be -1.)"
11942                         rd_nodata=-1
11943                         ;;
11944                 esac
11945                 case "$eagain" in
11946                 '')
11947                         echo "Forcing errno EAGAIN on read() with no data available."
11948                         eagain=EAGAIN
11949                         ;;
11950                 *)
11951                         echo "Your read() sets errno to $eagain when no data is available."
11952                         ;;
11953                 esac
11954                 status=`$cat try.err`
11955                 case "$status" in
11956                 0) echo "And it correctly returns 0 to signal EOF.";;
11957                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
11958                 *) echo "However, your read() returns '$status' on EOF??";;
11959                 esac
11960                 val="$define"
11961                 if test "$status" = "$rd_nodata"; then
11962                         echo "WARNING: you can't distinguish between EOF and no data!"
11963                         val="$undef"
11964                 fi
11965         else
11966                 echo "I can't compile the test program--assuming errno EAGAIN will do."
11967                 eagain=EAGAIN
11968         fi
11969         set d_eofnblk
11970         eval $setvar
11971         ;;
11972 *)
11973         echo "Using $hint value $eagain."
11974         echo "Your read() returns $rd_nodata when no data is present."
11975         case "$d_eofnblk" in
11976         "$define") echo "And you can see EOF because read() returns 0.";;
11977         "$undef") echo "But you can't see EOF status from read() returned value.";;
11978         *)
11979                 echo "(Assuming you can't see EOF status from read anyway.)"
11980                 d_eofnblk=$undef
11981                 ;;
11982         esac
11983         ;;
11984 esac
11985 $rm -f try try.* .out core head.c mtry
11986
11987 : see if _ptr and _cnt from stdio act std
11988 echo " "
11989
11990 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
11991         echo "(Looks like you have stdio.h from BSD.)"
11992         case "$stdio_ptr" in
11993         '') stdio_ptr='((fp)->_p)'
11994                 ptr_lval=$define
11995                 ;;
11996         *)      ptr_lval=$d_stdio_ptr_lval;;
11997         esac
11998         case "$stdio_cnt" in
11999         '') stdio_cnt='((fp)->_r)'
12000                 cnt_lval=$define
12001                 ;;
12002         *)      cnt_lval=$d_stdio_cnt_lval;;
12003         esac
12004         case "$stdio_base" in
12005         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12006         esac
12007         case "$stdio_bufsiz" in
12008         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12009         esac
12010 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12011         echo "(Looks like you have stdio.h from Linux.)"
12012         case "$stdio_ptr" in
12013         '') stdio_ptr='((fp)->_IO_read_ptr)'
12014                 ptr_lval=$define
12015                 ;;
12016         *)      ptr_lval=$d_stdio_ptr_lval;;
12017         esac
12018         case "$stdio_cnt" in
12019         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12020                 cnt_lval=$undef
12021                 ;;
12022         *)      cnt_lval=$d_stdio_cnt_lval;;
12023         esac
12024         case "$stdio_base" in
12025         '') stdio_base='((fp)->_IO_read_base)';;
12026         esac
12027         case "$stdio_bufsiz" in
12028         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12029         esac
12030 else
12031         case "$stdio_ptr" in
12032         '') stdio_ptr='((fp)->_ptr)'
12033                 ptr_lval=$define
12034                 ;;
12035         *)      ptr_lval=$d_stdio_ptr_lval;;
12036         esac
12037         case "$stdio_cnt" in
12038         '') stdio_cnt='((fp)->_cnt)'
12039                 cnt_lval=$define
12040                 ;;
12041         *)      cnt_lval=$d_stdio_cnt_lval;;
12042         esac
12043         case "$stdio_base" in
12044         '') stdio_base='((fp)->_base)';;
12045         esac
12046         case "$stdio_bufsiz" in
12047         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12048         esac
12049 fi
12050
12051 : test whether _ptr and _cnt really work
12052 echo "Checking how std your stdio is..." >&4
12053 $cat >try.c <<EOP
12054 #include <stdio.h>
12055 #$i_stdlib I_STDLIB
12056 #ifdef I_STDLIB
12057 #include <stdlib.h>
12058 #endif
12059 #define FILE_ptr(fp)    $stdio_ptr
12060 #define FILE_cnt(fp)    $stdio_cnt
12061 int main() {
12062         FILE *fp = fopen("try.c", "r");
12063         char c = getc(fp);
12064         if (
12065                 18 <= FILE_cnt(fp) &&
12066                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12067         )
12068                 exit(0);
12069         exit(1);
12070 }
12071 EOP
12072 val="$undef"
12073 set try
12074 if eval $compile && $to try.c; then
12075         if $run ./try; then
12076                 echo "Your stdio acts pretty std."
12077                 val="$define"
12078         else
12079                 echo "Your stdio isn't very std."
12080         fi
12081 else
12082         echo "Your stdio doesn't appear very std."
12083 fi
12084 $rm -f try.c try
12085
12086 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12087 # direct buffer manipulation no longer works.  The Configure tests
12088 # should be changed to correctly detect this, but until then,
12089 # the following check should at least let perl compile and run.
12090 # (This quick fix should be updated before 5.8.1.)
12091 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12092 # A. Dougherty, June 3, 2002.
12093 case "$d_gnulibc" in
12094 $define)
12095         case "$gnulibc_version" in
12096         2.[01]*)  ;;
12097         2.2) ;;
12098         2.2.[0-9]) ;;
12099         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12100                 val="$undef"
12101                 ;;
12102         esac
12103         ;;
12104 esac
12105 set d_stdstdio
12106 eval $setvar
12107
12108 : Can _ptr be used as an lvalue?
12109 case "$d_stdstdio$ptr_lval" in
12110 $define$define) val=$define ;;
12111 *) val=$undef ;;
12112 esac
12113 set d_stdio_ptr_lval
12114 eval $setvar
12115
12116 : Can _cnt be used as an lvalue?
12117 case "$d_stdstdio$cnt_lval" in
12118 $define$define) val=$define ;;
12119 *) val=$undef ;;
12120 esac
12121 set d_stdio_cnt_lval
12122 eval $setvar
12123
12124
12125 : test whether setting _ptr sets _cnt as a side effect
12126 d_stdio_ptr_lval_sets_cnt="$undef"
12127 d_stdio_ptr_lval_nochange_cnt="$undef"
12128 case "$d_stdio_ptr_lval$d_stdstdio" in
12129 $define$define)
12130         echo "Checking to see what happens if we set the stdio ptr..." >&4
12131 $cat >try.c <<EOP
12132 #include <stdio.h>
12133 /* Can we scream? */
12134 /* Eat dust sed :-) */
12135 /* In the buffer space, no one can hear you scream. */
12136 #$i_stdlib I_STDLIB
12137 #ifdef I_STDLIB
12138 #include <stdlib.h>
12139 #endif
12140 #define FILE_ptr(fp)    $stdio_ptr
12141 #define FILE_cnt(fp)    $stdio_cnt
12142 #include <sys/types.h>
12143 int main() {
12144         FILE *fp = fopen("try.c", "r");
12145         int c;
12146         char *ptr;
12147         size_t cnt;
12148         if (!fp) {
12149             puts("Fail even to read");
12150             exit(1);
12151         }
12152         c = getc(fp); /* Read away the first # */
12153         if (c == EOF) {
12154             puts("Fail even to read");
12155             exit(1);
12156         }
12157         if (!(
12158                 18 <= FILE_cnt(fp) &&
12159                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12160         )) {
12161                 puts("Fail even to read");
12162                 exit (1);
12163         }
12164         ptr = (char*) FILE_ptr(fp);
12165         cnt = (size_t)FILE_cnt(fp);
12166
12167         FILE_ptr(fp) += 42;
12168
12169         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12170                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12171                 exit (1);
12172         }
12173         if (FILE_cnt(fp) <= 20) {
12174                 printf ("Fail (<20 chars to test)");
12175                 exit (1);
12176         }
12177         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12178                 puts("Fail compare");
12179                 exit (1);
12180         }
12181         if (cnt == FILE_cnt(fp)) {
12182                 puts("Pass_unchanged");
12183                 exit (0);
12184         }       
12185         if (FILE_cnt(fp) == (cnt - 42)) {
12186                 puts("Pass_changed");
12187                 exit (0);
12188         }
12189         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12190         return 1;
12191
12192 }
12193 EOP
12194         set try
12195         if eval $compile && $to try.c; then
12196                 case `$run ./try` in
12197                 Pass_changed)
12198                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12199                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12200                 Pass_unchanged)
12201                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12202                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12203                 Fail*)
12204                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12205                 *)
12206                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12207         esac
12208         else
12209                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12210         fi
12211         $rm -f try.c try
12212         ;;
12213 esac
12214
12215 : see if _base is also standard
12216 val="$undef"
12217 case "$d_stdstdio" in
12218 $define)
12219         $cat >try.c <<EOP
12220 #include <stdio.h>
12221 #$i_stdlib I_STDLIB
12222 #ifdef I_STDLIB
12223 #include <stdlib.h>
12224 #endif
12225 #define FILE_base(fp)   $stdio_base
12226 #define FILE_bufsiz(fp) $stdio_bufsiz
12227 int main() {
12228         FILE *fp = fopen("try.c", "r");
12229         char c = getc(fp);
12230         if (
12231                 19 <= FILE_bufsiz(fp) &&
12232                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12233         )
12234                 exit(0);
12235         exit(1);
12236 }
12237 EOP
12238         set try
12239         if eval $compile && $to try.c; then
12240                 if $run ./try; then
12241                         echo "And its _base field acts std."
12242                         val="$define"
12243                 else
12244                         echo "But its _base field isn't std."
12245                 fi
12246         else
12247                 echo "However, it seems to be lacking the _base field."
12248         fi
12249         $rm -f try.c try
12250         ;;
12251 esac
12252 set d_stdiobase
12253 eval $setvar
12254
12255 : see if fast_stdio exists
12256 val="$undef"
12257 case "$d_stdstdio:$d_stdio_ptr_lval" in
12258 "$define:$define")
12259         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12260         *$define*)
12261                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12262                 val="$define"
12263                 ;;
12264         esac
12265         ;;
12266 esac
12267 set d_faststdio
12268 eval $setvar
12269
12270
12271
12272 : see if fchdir exists
12273 set fchdir d_fchdir
12274 eval $inlibc
12275
12276 : see if fchmod exists
12277 set fchmod d_fchmod
12278 eval $inlibc
12279
12280 : see if fchown exists
12281 set fchown d_fchown
12282 eval $inlibc
12283
12284 : see if this is an fcntl system
12285 set fcntl d_fcntl
12286 eval $inlibc
12287
12288 echo " "
12289 : See if fcntl-based locking works.
12290 $cat >try.c <<EOCP
12291 #$i_stdlib I_STDLIB
12292 #ifdef I_STDLIB
12293 #include <stdlib.h>
12294 #endif
12295 #include <unistd.h>
12296 #include <fcntl.h>
12297 #include <signal.h>
12298 $signal_t blech(x) int x; { exit(3); }
12299 int main() {
12300 #if defined(F_SETLK) && defined(F_SETLKW)
12301      struct flock flock;
12302      int retval, fd;
12303      fd = open("try.c", O_RDONLY);
12304      flock.l_type = F_RDLCK;
12305      flock.l_whence = SEEK_SET;
12306      flock.l_start = flock.l_len = 0;
12307      signal(SIGALRM, blech);
12308      alarm(10);
12309      retval = fcntl(fd, F_SETLK, &flock);
12310      close(fd);
12311      (retval < 0 ? exit(2) : exit(0));
12312 #else
12313      exit(2);
12314 #endif
12315 }
12316 EOCP
12317 echo "Checking if fcntl-based file locking works... "
12318 case "$d_fcntl" in
12319 "$define")
12320         set try
12321         if eval $compile_ok; then
12322                 if $run ./try; then
12323                         echo "Yes, it seems to work."
12324                         val="$define"
12325                 else
12326                         echo "Nope, it didn't work."
12327                         val="$undef"
12328                         case "$?" in
12329                         3) $cat >&4 <<EOM
12330 ***
12331 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12332 *** This is (almost) impossible.
12333 *** If your NFS lock daemons are not feeling well, something like
12334 *** this may happen, please investigate.  Cannot continue, aborting.
12335 ***
12336 EOM
12337                                 exit 1
12338                                 ;;
12339                         esac
12340                 fi
12341         else
12342                 echo "I'm unable to compile the test program, so I'll assume not."
12343                 val="$undef"
12344         fi
12345         ;;
12346 *) val="$undef";
12347         echo "Nope, since you don't even have fcntl()."
12348         ;;
12349 esac
12350 set d_fcntl_can_lock
12351 eval $setvar
12352 $rm -f try*
12353
12354
12355 : check for fd_set items
12356 $cat <<EOM
12357
12358 Checking to see how well your C compiler handles fd_set and friends ...
12359 EOM
12360 $cat >try.c <<EOCP
12361 #$i_stdlib I_STDLIB
12362 #ifdef I_STDLIB
12363 #include <stdlib.h>
12364 #endif
12365 #$i_systime I_SYS_TIME
12366 #$i_sysselct I_SYS_SELECT
12367 #$d_socket HAS_SOCKET
12368 #include <sys/types.h>
12369 #ifdef HAS_SOCKET
12370 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12371 #endif
12372 #ifdef I_SYS_TIME
12373 #include <sys/time.h>
12374 #endif
12375 #ifdef I_SYS_SELECT
12376 #include <sys/select.h>
12377 #endif
12378 int main() {
12379         fd_set fds;
12380
12381 #ifdef TRYBITS
12382         if(fds.fds_bits);
12383 #endif
12384
12385 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12386         exit(0);
12387 #else
12388         exit(1);
12389 #endif
12390 }
12391 EOCP
12392 set try -DTRYBITS
12393 if eval $compile; then
12394         d_fds_bits="$define"
12395         d_fd_set="$define"
12396         echo "Well, your system knows about the normal fd_set typedef..." >&4
12397         if $run ./try; then
12398                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12399                 d_fd_macros="$define"
12400         else
12401                 $cat >&4 <<'EOM'
12402 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12403 EOM
12404                 d_fd_macros="$undef"
12405         fi
12406 else
12407         $cat <<'EOM'
12408 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12409 EOM
12410         set try
12411         if eval $compile; then
12412                 d_fds_bits="$undef"
12413                 d_fd_set="$define"
12414                 echo "Well, your system has some sort of fd_set available..." >&4
12415                 if $run ./try; then
12416                         echo "and you have the normal fd_set macros." >&4
12417                         d_fd_macros="$define"
12418                 else
12419                         $cat <<'EOM'
12420 but not the normal fd_set macros!  Gross!  More work for me...
12421 EOM
12422                         d_fd_macros="$undef"
12423                 fi
12424         else
12425         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12426                 d_fd_set="$undef"
12427                 d_fds_bits="$undef"
12428                 d_fd_macros="$undef"
12429         fi
12430 fi
12431 $rm -f try try.*
12432
12433 : see if fgetpos exists
12434 set fgetpos d_fgetpos
12435 eval $inlibc
12436
12437 : see if finite exists
12438 set finite d_finite
12439 eval $inlibc
12440
12441 : see if finitel exists
12442 set finitel d_finitel
12443 eval $inlibc
12444
12445 : see if flock exists
12446 set flock d_flock
12447 eval $inlibc
12448
12449 : see if prototype for flock is available
12450 echo " "
12451 set d_flockproto flock $i_sysfile sys/file.h
12452 eval $hasproto
12453
12454 : see if fork exists
12455 set fork d_fork
12456 eval $inlibc
12457
12458 : see if fp_class exists
12459 set fp_class d_fp_class
12460 eval $inlibc
12461
12462 : see if pathconf exists
12463 set pathconf d_pathconf
12464 eval $inlibc
12465
12466 : see if fpathconf exists
12467 set fpathconf d_fpathconf
12468 eval $inlibc
12469
12470 : see if fpclass exists
12471 set fpclass d_fpclass
12472 eval $inlibc
12473
12474 : see if fpclassify exists
12475 set fpclassify d_fpclassify
12476 eval $inlibc
12477
12478 : see if fpclassl exists
12479 set fpclassl d_fpclassl
12480 eval $inlibc
12481
12482
12483 : check for fpos64_t
12484 echo " "
12485 echo "Checking to see if you have fpos64_t..." >&4
12486 $cat >try.c <<EOCP
12487 #include <stdio.h>
12488 int main() { fpos64_t x = 7; }
12489 EOCP
12490 set try
12491 if eval $compile; then
12492         val="$define"
12493         echo "You have fpos64_t."
12494 else
12495         val="$undef"
12496         echo "You do not have fpos64_t."
12497         case "$fpossize" in
12498         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12499         esac
12500 fi
12501 $rm -f try.* try
12502 set d_fpos64_t
12503 eval $setvar
12504
12505 : see if frexpl exists
12506 set frexpl d_frexpl
12507 eval $inlibc
12508
12509 : see if this is a sys/param system
12510 set sys/param.h i_sysparam
12511 eval $inhdr
12512
12513 : see if this is a sys/mount.h system
12514 set sys/mount.h i_sysmount
12515 eval $inhdr
12516
12517
12518 echo " "
12519 echo "Checking to see if your system supports struct fs_data..." >&4
12520 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12521 eval $hasstruct
12522 case "$d_fs_data_s" in
12523 "$define")      echo "Yes, it does."   ;;
12524 *)              echo "No, it doesn't." ;;
12525 esac
12526
12527 : see if fseeko exists
12528 set fseeko d_fseeko
12529 eval $inlibc
12530 case "$longsize" in
12531 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12532 esac
12533
12534 : see if fsetpos exists
12535 set fsetpos d_fsetpos
12536 eval $inlibc
12537
12538
12539 : see if fstatfs exists
12540 set fstatfs d_fstatfs
12541 eval $inlibc
12542
12543
12544 : see if statvfs exists
12545 set statvfs d_statvfs
12546 eval $inlibc
12547
12548 : see if fstatvfs exists
12549 set fstatvfs d_fstatvfs
12550 eval $inlibc
12551
12552
12553 : see if fsync exists
12554 set fsync d_fsync
12555 eval $inlibc
12556
12557 : see if ftello exists
12558 set ftello d_ftello
12559 eval $inlibc
12560 case "$longsize" in
12561 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12562 esac
12563
12564 d_futimes="$undef"
12565 : check for a working futimes
12566 echo " "
12567 echo "Checking for a working futimes()" >&4
12568 $cat >try.c <<EOCP
12569 #include <stdio.h>
12570 #include <sys/time.h>
12571 #include <errno.h>
12572 #include <fcntl.h>
12573
12574 int main ()
12575 {
12576     int fd, rv;
12577     fd = open ("try.c", O_RDWR);
12578     if (-1 == fd) exit (1);
12579     rv = futimes (fd, NULL);
12580     exit (rv == -1 ? errno : 0);
12581 }
12582 EOCP
12583 set try
12584 if eval $compile; then
12585     `$run ./try`
12586     rc=$?
12587     case "$rc" in
12588         0)  echo "Yes, it does" >&4
12589             d_futimes="$define"
12590             ;;
12591         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12592             ;;
12593     esac
12594 else
12595     echo "No, it does not (probably harmless)\n" >&4
12596 fi
12597 $rm -f try.* try core core.try.*
12598
12599 : see if getcwd exists
12600 set getcwd d_getcwd
12601 eval $inlibc
12602
12603 : see if getespwnam exists
12604 set getespwnam d_getespwnam
12605 eval $inlibc
12606
12607
12608 : see if getfsstat exists
12609 set getfsstat d_getfsstat
12610 eval $inlibc
12611
12612 : see if getgrent exists
12613 set getgrent d_getgrent
12614 eval $inlibc
12615
12616 : see if getgrent_r exists
12617 set getgrent_r d_getgrent_r
12618 eval $inlibc
12619 case "$d_getgrent_r" in
12620 "$define")
12621         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12622         case "$d_getgrent_r_proto:$usethreads" in
12623         ":define")      d_getgrent_r_proto=define
12624                 set d_getgrent_r_proto getgrent_r $hdrs
12625                 eval $hasproto ;;
12626         *)      ;;
12627         esac
12628         case "$d_getgrent_r_proto" in
12629         define)
12630         case "$getgrent_r_proto" in
12631         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
12632         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
12633         esac
12634         case "$getgrent_r_proto" in
12635         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
12636         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
12637         esac
12638         case "$getgrent_r_proto" in
12639         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
12640         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
12641         esac
12642         case "$getgrent_r_proto" in
12643         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
12644         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
12645         esac
12646         case "$getgrent_r_proto" in
12647         ''|0) try='int getgrent_r(struct group*, char*, int);'
12648         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
12649         esac
12650         case "$getgrent_r_proto" in
12651         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
12652         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
12653         esac
12654         case "$getgrent_r_proto" in
12655         ''|0)   d_getgrent_r=undef
12656                 getgrent_r_proto=0
12657                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
12658         * )     case "$getgrent_r_proto" in
12659                 REENTRANT_PROTO*) ;;
12660                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
12661                 esac
12662                 echo "Prototype: $try" ;;
12663         esac
12664         ;;
12665         *)      case "$usethreads" in
12666                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
12667                 esac
12668                 d_getgrent_r=undef
12669                 getgrent_r_proto=0
12670                 ;;
12671         esac
12672         ;;
12673 *)      getgrent_r_proto=0
12674         ;;
12675 esac
12676
12677 : see if getgrgid_r exists
12678 set getgrgid_r d_getgrgid_r
12679 eval $inlibc
12680 case "$d_getgrgid_r" in
12681 "$define")
12682         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12683         case "$d_getgrgid_r_proto:$usethreads" in
12684         ":define")      d_getgrgid_r_proto=define
12685                 set d_getgrgid_r_proto getgrgid_r $hdrs
12686                 eval $hasproto ;;
12687         *)      ;;
12688         esac
12689         case "$d_getgrgid_r_proto" in
12690         define)
12691         case "$getgrgid_r_proto" in
12692         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
12693         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
12694         esac
12695         case "$getgrgid_r_proto" in
12696         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
12697         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
12698         esac
12699         case "$getgrgid_r_proto" in
12700         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
12701         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
12702         esac
12703         case "$getgrgid_r_proto" in
12704         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
12705         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
12706         esac
12707         case "$getgrgid_r_proto" in
12708         ''|0)   d_getgrgid_r=undef
12709                 getgrgid_r_proto=0
12710                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
12711         * )     case "$getgrgid_r_proto" in
12712                 REENTRANT_PROTO*) ;;
12713                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
12714                 esac
12715                 echo "Prototype: $try" ;;
12716         esac
12717         ;;
12718         *)      case "$usethreads" in
12719                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
12720                 esac
12721                 d_getgrgid_r=undef
12722                 getgrgid_r_proto=0
12723                 ;;
12724         esac
12725         ;;
12726 *)      getgrgid_r_proto=0
12727         ;;
12728 esac
12729
12730 : see if getgrnam_r exists
12731 set getgrnam_r d_getgrnam_r
12732 eval $inlibc
12733 case "$d_getgrnam_r" in
12734 "$define")
12735         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12736         case "$d_getgrnam_r_proto:$usethreads" in
12737         ":define")      d_getgrnam_r_proto=define
12738                 set d_getgrnam_r_proto getgrnam_r $hdrs
12739                 eval $hasproto ;;
12740         *)      ;;
12741         esac
12742         case "$d_getgrnam_r_proto" in
12743         define)
12744         case "$getgrnam_r_proto" in
12745         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
12746         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
12747         esac
12748         case "$getgrnam_r_proto" in
12749         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
12750         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
12751         esac
12752         case "$getgrnam_r_proto" in
12753         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
12754         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
12755         esac
12756         case "$getgrnam_r_proto" in
12757         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
12758         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
12759         esac
12760         case "$getgrnam_r_proto" in
12761         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
12762         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
12763         esac
12764         case "$getgrnam_r_proto" in
12765         ''|0)   d_getgrnam_r=undef
12766                 getgrnam_r_proto=0
12767                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
12768         * )     case "$getgrnam_r_proto" in
12769                 REENTRANT_PROTO*) ;;
12770                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
12771                 esac
12772                 echo "Prototype: $try" ;;
12773         esac
12774         ;;
12775         *)      case "$usethreads" in
12776                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
12777                 esac
12778                 d_getgrnam_r=undef
12779                 getgrnam_r_proto=0
12780                 ;;
12781         esac
12782         ;;
12783 *)      getgrnam_r_proto=0
12784         ;;
12785 esac
12786
12787 : see if gethostbyaddr exists
12788 set gethostbyaddr d_gethbyaddr
12789 eval $inlibc
12790
12791 : see if gethostbyname exists
12792 set gethostbyname d_gethbyname
12793 eval $inlibc
12794
12795 : see if gethostent exists
12796 set gethostent d_gethent
12797 eval $inlibc
12798
12799 : see how we will look up host name
12800 echo " "
12801 call=''
12802 if set gethostname val -f d_gethname; eval $csym; $val; then
12803         echo 'gethostname() found.' >&4
12804         d_gethname="$define"
12805         call=gethostname
12806 fi
12807 if set uname val -f d_uname; eval $csym; $val; then
12808         if ./xenix; then
12809                 $cat <<'EOM'
12810 uname() was found, but you're running xenix, and older versions of xenix
12811 have a broken uname(). If you don't really know whether your xenix is old
12812 enough to have a broken system call, use the default answer.
12813
12814 EOM
12815                 dflt=y
12816                 case "$d_uname" in
12817                 "$define") dflt=n;;
12818                 esac
12819                 rp='Is your uname() broken?'
12820                 . ./myread
12821                 case "$ans" in
12822                 n*) d_uname="$define"; call=uname;;
12823                 esac
12824         else
12825                 echo 'uname() found.' >&4
12826                 d_uname="$define"
12827                 case "$call" in
12828                 '') call=uname ;;
12829                 esac
12830         fi
12831 fi
12832 case "$d_gethname" in
12833 '') d_gethname="$undef";;
12834 esac
12835 case "$d_uname" in
12836 '') d_uname="$undef";;
12837 esac
12838 case "$d_uname$d_gethname" in
12839 *define*)
12840         dflt=n
12841         cat <<EOM
12842  
12843 Every now and then someone has a $call() that lies about the hostname
12844 but can't be fixed for political or economic reasons.  If you wish, I can
12845 pretend $call() isn't there and maybe compute hostname at run-time
12846 thanks to the '$phostname' command.
12847
12848 EOM
12849         rp="Shall I ignore $call() from now on?"
12850         . ./myread
12851         case "$ans" in
12852         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
12853         esac;;
12854 esac
12855 case "$phostname" in
12856 '') aphostname='';;
12857 *) case "$aphostname" in
12858         /*) ;;
12859         *) set X $phostname
12860                 shift
12861                 file=$1
12862                 shift
12863                 file=`./loc $file $file $pth`
12864                 aphostname=`echo $file $*`
12865                 ;;
12866         esac
12867         ;;
12868 esac
12869 case "$d_uname$d_gethname" in
12870 *define*) ;;
12871 *)
12872         case "$phostname" in
12873         '')
12874                 echo "There will be no way for $package to get your hostname." >&4;;
12875         *)
12876         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
12877                 ;;
12878         esac;;
12879 esac
12880 case "$d_phostname" in
12881 '') d_phostname="$undef";;
12882 esac
12883
12884 : see if gethostbyaddr_r exists
12885 set gethostbyaddr_r d_gethostbyaddr_r
12886 eval $inlibc
12887 case "$d_gethostbyaddr_r" in
12888 "$define")
12889         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12890         case "$d_gethostbyaddr_r_proto:$usethreads" in
12891         ":define")      d_gethostbyaddr_r_proto=define
12892                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
12893                 eval $hasproto ;;
12894         *)      ;;
12895         esac
12896         case "$d_gethostbyaddr_r_proto" in
12897         define)
12898         case "$gethostbyaddr_r_proto" in
12899         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12900         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
12901         esac
12902         case "$gethostbyaddr_r_proto" in
12903         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
12904         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
12905         esac
12906         case "$gethostbyaddr_r_proto" in
12907         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
12908         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
12909         esac
12910         case "$gethostbyaddr_r_proto" in
12911         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
12912         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
12913         esac
12914         case "$gethostbyaddr_r_proto" in
12915         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
12916         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
12917         esac
12918         case "$gethostbyaddr_r_proto" in
12919         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
12920         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
12921         esac
12922         case "$gethostbyaddr_r_proto" in
12923         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
12924         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
12925         esac
12926         case "$gethostbyaddr_r_proto" in
12927         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
12928         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
12929         esac
12930         case "$gethostbyaddr_r_proto" in
12931         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
12932         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
12933         esac
12934         case "$gethostbyaddr_r_proto" in
12935         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
12936         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
12937         esac
12938         case "$gethostbyaddr_r_proto" in
12939         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
12940         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
12941         esac
12942         case "$gethostbyaddr_r_proto" in
12943         ''|0)   d_gethostbyaddr_r=undef
12944                 gethostbyaddr_r_proto=0
12945                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
12946         * )     case "$gethostbyaddr_r_proto" in
12947                 REENTRANT_PROTO*) ;;
12948                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
12949                 esac
12950                 echo "Prototype: $try" ;;
12951         esac
12952         ;;
12953         *)      case "$usethreads" in
12954                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
12955                 esac
12956                 d_gethostbyaddr_r=undef
12957                 gethostbyaddr_r_proto=0
12958                 ;;
12959         esac
12960         ;;
12961 *)      gethostbyaddr_r_proto=0
12962         ;;
12963 esac
12964
12965 : see if gethostbyname_r exists
12966 set gethostbyname_r d_gethostbyname_r
12967 eval $inlibc
12968 case "$d_gethostbyname_r" in
12969 "$define")
12970         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
12971         case "$d_gethostbyname_r_proto:$usethreads" in
12972         ":define")      d_gethostbyname_r_proto=define
12973                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
12974                 eval $hasproto ;;
12975         *)      ;;
12976         esac
12977         case "$d_gethostbyname_r_proto" in
12978         define)
12979         case "$gethostbyname_r_proto" in
12980         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
12981         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
12982         esac
12983         case "$gethostbyname_r_proto" in
12984         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
12985         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
12986         esac
12987         case "$gethostbyname_r_proto" in
12988         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
12989         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
12990         esac
12991         case "$gethostbyname_r_proto" in
12992         ''|0)   d_gethostbyname_r=undef
12993                 gethostbyname_r_proto=0
12994                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
12995         * )     case "$gethostbyname_r_proto" in
12996                 REENTRANT_PROTO*) ;;
12997                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
12998                 esac
12999                 echo "Prototype: $try" ;;
13000         esac
13001         ;;
13002         *)      case "$usethreads" in
13003                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13004                 esac
13005                 d_gethostbyname_r=undef
13006                 gethostbyname_r_proto=0
13007                 ;;
13008         esac
13009         ;;
13010 *)      gethostbyname_r_proto=0
13011         ;;
13012 esac
13013
13014 : see if gethostent_r exists
13015 set gethostent_r d_gethostent_r
13016 eval $inlibc
13017 case "$d_gethostent_r" in
13018 "$define")
13019         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13020         case "$d_gethostent_r_proto:$usethreads" in
13021         ":define")      d_gethostent_r_proto=define
13022                 set d_gethostent_r_proto gethostent_r $hdrs
13023                 eval $hasproto ;;
13024         *)      ;;
13025         esac
13026         case "$d_gethostent_r_proto" in
13027         define)
13028         case "$gethostent_r_proto" in
13029         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13030         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13031         esac
13032         case "$gethostent_r_proto" in
13033         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13034         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13035         esac
13036         case "$gethostent_r_proto" in
13037         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13038         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13039         esac
13040         case "$gethostent_r_proto" in
13041         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13042         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13043         esac
13044         case "$gethostent_r_proto" in
13045         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13046         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13047         esac
13048         case "$gethostent_r_proto" in
13049         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13050         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13051         esac
13052         case "$gethostent_r_proto" in
13053         ''|0)   d_gethostent_r=undef
13054                 gethostent_r_proto=0
13055                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13056         * )     case "$gethostent_r_proto" in
13057                 REENTRANT_PROTO*) ;;
13058                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13059                 esac
13060                 echo "Prototype: $try" ;;
13061         esac
13062         ;;
13063         *)      case "$usethreads" in
13064                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13065                 esac
13066                 d_gethostent_r=undef
13067                 gethostent_r_proto=0
13068                 ;;
13069         esac
13070         ;;
13071 *)      gethostent_r_proto=0
13072         ;;
13073 esac
13074
13075 : see if prototypes for various gethostxxx netdb.h functions are available
13076 echo " "
13077 set d_gethostprotos gethostent $i_netdb netdb.h
13078 eval $hasproto
13079
13080 : see if getitimer exists
13081 set getitimer d_getitimer
13082 eval $inlibc
13083
13084 : see if getlogin exists
13085 set getlogin d_getlogin
13086 eval $inlibc
13087
13088 : see if getlogin_r exists
13089 set getlogin_r d_getlogin_r
13090 eval $inlibc
13091 case "$d_getlogin_r" in
13092 "$define")
13093         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13094         case "$d_getlogin_r_proto:$usethreads" in
13095         ":define")      d_getlogin_r_proto=define
13096                 set d_getlogin_r_proto getlogin_r $hdrs
13097                 eval $hasproto ;;
13098         *)      ;;
13099         esac
13100         case "$d_getlogin_r_proto" in
13101         define)
13102         case "$getlogin_r_proto" in
13103         ''|0) try='int getlogin_r(char*, size_t);'
13104         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13105         esac
13106         case "$getlogin_r_proto" in
13107         ''|0) try='int getlogin_r(char*, int);'
13108         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13109         esac
13110         case "$getlogin_r_proto" in
13111         ''|0) try='char* getlogin_r(char*, size_t);'
13112         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13113         esac
13114         case "$getlogin_r_proto" in
13115         ''|0) try='char* getlogin_r(char*, int);'
13116         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13117         esac
13118         case "$getlogin_r_proto" in
13119         ''|0)   d_getlogin_r=undef
13120                 getlogin_r_proto=0
13121                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13122         * )     case "$getlogin_r_proto" in
13123                 REENTRANT_PROTO*) ;;
13124                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13125                 esac
13126                 echo "Prototype: $try" ;;
13127         esac
13128         ;;
13129         *)      case "$usethreads" in
13130                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13131                 esac
13132                 d_getlogin_r=undef
13133                 getlogin_r_proto=0
13134                 ;;
13135         esac
13136         ;;
13137 *)      getlogin_r_proto=0
13138         ;;
13139 esac
13140
13141 : see if getmnt exists
13142 set getmnt d_getmnt
13143 eval $inlibc
13144
13145 : see if getmntent exists
13146 set getmntent d_getmntent
13147 eval $inlibc
13148
13149 : see if getnetbyaddr exists
13150 set getnetbyaddr d_getnbyaddr
13151 eval $inlibc
13152
13153 : see if getnetbyname exists
13154 set getnetbyname d_getnbyname
13155 eval $inlibc
13156
13157 : see if getnetent exists
13158 set getnetent d_getnent
13159 eval $inlibc
13160
13161 : see if getnetbyaddr_r exists
13162 set getnetbyaddr_r d_getnetbyaddr_r
13163 eval $inlibc
13164 case "$d_getnetbyaddr_r" in
13165 "$define")
13166         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13167         case "$d_getnetbyaddr_r_proto:$usethreads" in
13168         ":define")      d_getnetbyaddr_r_proto=define
13169                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13170                 eval $hasproto ;;
13171         *)      ;;
13172         esac
13173         case "$d_getnetbyaddr_r_proto" in
13174         define)
13175         case "$getnetbyaddr_r_proto" in
13176         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13177         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13178         esac
13179         case "$getnetbyaddr_r_proto" in
13180         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13181         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13182         esac
13183         case "$getnetbyaddr_r_proto" in
13184         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13185         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13186         esac
13187         case "$getnetbyaddr_r_proto" in
13188         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13189         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13190         esac
13191         case "$getnetbyaddr_r_proto" in
13192         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13193         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13194         esac
13195         case "$getnetbyaddr_r_proto" in
13196         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13197         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13198         esac
13199         case "$getnetbyaddr_r_proto" in
13200         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13201         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13202         esac
13203         case "$getnetbyaddr_r_proto" in
13204         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13205         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13206         esac
13207         case "$getnetbyaddr_r_proto" in
13208         ''|0)   d_getnetbyaddr_r=undef
13209                 getnetbyaddr_r_proto=0
13210                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13211         * )     case "$getnetbyaddr_r_proto" in
13212                 REENTRANT_PROTO*) ;;
13213                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13214                 esac
13215                 echo "Prototype: $try" ;;
13216         esac
13217         ;;
13218         *)      case "$usethreads" in
13219                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13220                 esac
13221                 d_getnetbyaddr_r=undef
13222                 getnetbyaddr_r_proto=0
13223                 ;;
13224         esac
13225         ;;
13226 *)      getnetbyaddr_r_proto=0
13227         ;;
13228 esac
13229
13230 : see if getnetbyname_r exists
13231 set getnetbyname_r d_getnetbyname_r
13232 eval $inlibc
13233 case "$d_getnetbyname_r" in
13234 "$define")
13235         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13236         case "$d_getnetbyname_r_proto:$usethreads" in
13237         ":define")      d_getnetbyname_r_proto=define
13238                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13239                 eval $hasproto ;;
13240         *)      ;;
13241         esac
13242         case "$d_getnetbyname_r_proto" in
13243         define)
13244         case "$getnetbyname_r_proto" in
13245         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13246         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13247         esac
13248         case "$getnetbyname_r_proto" in
13249         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13250         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13251         esac
13252         case "$getnetbyname_r_proto" in
13253         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13254         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13255         esac
13256         case "$getnetbyname_r_proto" in
13257         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13258         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13259         esac
13260         case "$getnetbyname_r_proto" in
13261         ''|0)   d_getnetbyname_r=undef
13262                 getnetbyname_r_proto=0
13263                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13264         * )     case "$getnetbyname_r_proto" in
13265                 REENTRANT_PROTO*) ;;
13266                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13267                 esac
13268                 echo "Prototype: $try" ;;
13269         esac
13270         ;;
13271         *)      case "$usethreads" in
13272                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13273                 esac
13274                 d_getnetbyname_r=undef
13275                 getnetbyname_r_proto=0
13276                 ;;
13277         esac
13278         ;;
13279 *)      getnetbyname_r_proto=0
13280         ;;
13281 esac
13282
13283 : see if getnetent_r exists
13284 set getnetent_r d_getnetent_r
13285 eval $inlibc
13286 case "$d_getnetent_r" in
13287 "$define")
13288         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13289         case "$d_getnetent_r_proto:$usethreads" in
13290         ":define")      d_getnetent_r_proto=define
13291                 set d_getnetent_r_proto getnetent_r $hdrs
13292                 eval $hasproto ;;
13293         *)      ;;
13294         esac
13295         case "$d_getnetent_r_proto" in
13296         define)
13297         case "$getnetent_r_proto" in
13298         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13299         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13300         esac
13301         case "$getnetent_r_proto" in
13302         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13303         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13304         esac
13305         case "$getnetent_r_proto" in
13306         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13307         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13308         esac
13309         case "$getnetent_r_proto" in
13310         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13311         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13312         esac
13313         case "$getnetent_r_proto" in
13314         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13315         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13316         esac
13317         case "$getnetent_r_proto" in
13318         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13319         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13320         esac
13321         case "$getnetent_r_proto" in
13322         ''|0)   d_getnetent_r=undef
13323                 getnetent_r_proto=0
13324                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13325         * )     case "$getnetent_r_proto" in
13326                 REENTRANT_PROTO*) ;;
13327                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13328                 esac
13329                 echo "Prototype: $try" ;;
13330         esac
13331         ;;
13332         *)      case "$usethreads" in
13333                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13334                 esac
13335                 d_getnetent_r=undef
13336                 getnetent_r_proto=0
13337                 ;;
13338         esac
13339         ;;
13340 *)      getnetent_r_proto=0
13341         ;;
13342 esac
13343
13344 : see if prototypes for various getnetxxx netdb.h functions are available
13345 echo " "
13346 set d_getnetprotos getnetent $i_netdb netdb.h
13347 eval $hasproto
13348
13349 : see if getpagesize exists
13350 set getpagesize d_getpagsz
13351 eval $inlibc
13352
13353
13354 : see if getprotobyname exists
13355 set getprotobyname d_getpbyname
13356 eval $inlibc
13357
13358 : see if getprotobynumber exists
13359 set getprotobynumber d_getpbynumber
13360 eval $inlibc
13361
13362 : see if getprotoent exists
13363 set getprotoent d_getpent
13364 eval $inlibc
13365
13366 : see if getpgid exists
13367 set getpgid d_getpgid
13368 eval $inlibc
13369
13370 : see if getpgrp2 exists
13371 set getpgrp2 d_getpgrp2
13372 eval $inlibc
13373
13374 : see if getppid exists
13375 set getppid d_getppid
13376 eval $inlibc
13377
13378 : see if getpriority exists
13379 set getpriority d_getprior
13380 eval $inlibc
13381
13382 : see if getprotobyname_r exists
13383 set getprotobyname_r d_getprotobyname_r
13384 eval $inlibc
13385 case "$d_getprotobyname_r" in
13386 "$define")
13387         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13388         case "$d_getprotobyname_r_proto:$usethreads" in
13389         ":define")      d_getprotobyname_r_proto=define
13390                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13391                 eval $hasproto ;;
13392         *)      ;;
13393         esac
13394         case "$d_getprotobyname_r_proto" in
13395         define)
13396         case "$getprotobyname_r_proto" in
13397         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13398         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13399         esac
13400         case "$getprotobyname_r_proto" in
13401         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13402         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13403         esac
13404         case "$getprotobyname_r_proto" in
13405         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13406         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13407         esac
13408         case "$getprotobyname_r_proto" in
13409         ''|0)   d_getprotobyname_r=undef
13410                 getprotobyname_r_proto=0
13411                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13412         * )     case "$getprotobyname_r_proto" in
13413                 REENTRANT_PROTO*) ;;
13414                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13415                 esac
13416                 echo "Prototype: $try" ;;
13417         esac
13418         ;;
13419         *)      case "$usethreads" in
13420                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13421                 esac
13422                 d_getprotobyname_r=undef
13423                 getprotobyname_r_proto=0
13424                 ;;
13425         esac
13426         ;;
13427 *)      getprotobyname_r_proto=0
13428         ;;
13429 esac
13430
13431 : see if getprotobynumber_r exists
13432 set getprotobynumber_r d_getprotobynumber_r
13433 eval $inlibc
13434 case "$d_getprotobynumber_r" in
13435 "$define")
13436         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13437         case "$d_getprotobynumber_r_proto:$usethreads" in
13438         ":define")      d_getprotobynumber_r_proto=define
13439                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13440                 eval $hasproto ;;
13441         *)      ;;
13442         esac
13443         case "$d_getprotobynumber_r_proto" in
13444         define)
13445         case "$getprotobynumber_r_proto" in
13446         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13447         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13448         esac
13449         case "$getprotobynumber_r_proto" in
13450         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13451         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13452         esac
13453         case "$getprotobynumber_r_proto" in
13454         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13455         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13456         esac
13457         case "$getprotobynumber_r_proto" in
13458         ''|0)   d_getprotobynumber_r=undef
13459                 getprotobynumber_r_proto=0
13460                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13461         * )     case "$getprotobynumber_r_proto" in
13462                 REENTRANT_PROTO*) ;;
13463                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13464                 esac
13465                 echo "Prototype: $try" ;;
13466         esac
13467         ;;
13468         *)      case "$usethreads" in
13469                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13470                 esac
13471                 d_getprotobynumber_r=undef
13472                 getprotobynumber_r_proto=0
13473                 ;;
13474         esac
13475         ;;
13476 *)      getprotobynumber_r_proto=0
13477         ;;
13478 esac
13479
13480 : see if getprotoent_r exists
13481 set getprotoent_r d_getprotoent_r
13482 eval $inlibc
13483 case "$d_getprotoent_r" in
13484 "$define")
13485         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13486         case "$d_getprotoent_r_proto:$usethreads" in
13487         ":define")      d_getprotoent_r_proto=define
13488                 set d_getprotoent_r_proto getprotoent_r $hdrs
13489                 eval $hasproto ;;
13490         *)      ;;
13491         esac
13492         case "$d_getprotoent_r_proto" in
13493         define)
13494         case "$getprotoent_r_proto" in
13495         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13496         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13497         esac
13498         case "$getprotoent_r_proto" in
13499         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13500         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13501         esac
13502         case "$getprotoent_r_proto" in
13503         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13504         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13505         esac
13506         case "$getprotoent_r_proto" in
13507         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13508         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13509         esac
13510         case "$getprotoent_r_proto" in
13511         ''|0)   d_getprotoent_r=undef
13512                 getprotoent_r_proto=0
13513                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13514         * )     case "$getprotoent_r_proto" in
13515                 REENTRANT_PROTO*) ;;
13516                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13517                 esac
13518                 echo "Prototype: $try" ;;
13519         esac
13520         ;;
13521         *)      case "$usethreads" in
13522                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13523                 esac
13524                 d_getprotoent_r=undef
13525                 getprotoent_r_proto=0
13526                 ;;
13527         esac
13528         ;;
13529 *)      getprotoent_r_proto=0
13530         ;;
13531 esac
13532
13533 : see if prototypes for various getprotoxxx netdb.h functions are available
13534 echo " "
13535 set d_getprotoprotos getprotoent $i_netdb netdb.h
13536 eval $hasproto
13537
13538 : see if getprpwnam exists
13539 set getprpwnam d_getprpwnam
13540 eval $inlibc
13541
13542 : see if getpwent exists
13543 set getpwent d_getpwent
13544 eval $inlibc
13545
13546 : see if getpwent_r exists
13547 set getpwent_r d_getpwent_r
13548 eval $inlibc
13549 case "$d_getpwent_r" in
13550 "$define")
13551         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13552         case "$d_getpwent_r_proto:$usethreads" in
13553         ":define")      d_getpwent_r_proto=define
13554                 set d_getpwent_r_proto getpwent_r $hdrs
13555                 eval $hasproto ;;
13556         *)      ;;
13557         esac
13558         case "$d_getpwent_r_proto" in
13559         define)
13560         case "$getpwent_r_proto" in
13561         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13562         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13563         esac
13564         case "$getpwent_r_proto" in
13565         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13566         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13567         esac
13568         case "$getpwent_r_proto" in
13569         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13570         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13571         esac
13572         case "$getpwent_r_proto" in
13573         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13574         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13575         esac
13576         case "$getpwent_r_proto" in
13577         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13578         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13579         esac
13580         case "$getpwent_r_proto" in
13581         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13582         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13583         esac
13584         case "$getpwent_r_proto" in
13585         ''|0)   d_getpwent_r=undef
13586                 getpwent_r_proto=0
13587                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13588         * )     case "$getpwent_r_proto" in
13589                 REENTRANT_PROTO*) ;;
13590                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13591                 esac
13592                 echo "Prototype: $try" ;;
13593         esac
13594         ;;
13595         *)      case "$usethreads" in
13596                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13597                 esac
13598                 d_getpwent_r=undef
13599                 getpwent_r_proto=0
13600                 ;;
13601         esac
13602         ;;
13603 *)      getpwent_r_proto=0
13604         ;;
13605 esac
13606
13607 : see if getpwnam_r exists
13608 set getpwnam_r d_getpwnam_r
13609 eval $inlibc
13610 case "$d_getpwnam_r" in
13611 "$define")
13612         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13613         case "$d_getpwnam_r_proto:$usethreads" in
13614         ":define")      d_getpwnam_r_proto=define
13615                 set d_getpwnam_r_proto getpwnam_r $hdrs
13616                 eval $hasproto ;;
13617         *)      ;;
13618         esac
13619         case "$d_getpwnam_r_proto" in
13620         define)
13621         case "$getpwnam_r_proto" in
13622         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13623         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13624         esac
13625         case "$getpwnam_r_proto" in
13626         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
13627         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
13628         esac
13629         case "$getpwnam_r_proto" in
13630         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
13631         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
13632         esac
13633         case "$getpwnam_r_proto" in
13634         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
13635         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
13636         esac
13637         case "$getpwnam_r_proto" in
13638         ''|0)   d_getpwnam_r=undef
13639                 getpwnam_r_proto=0
13640                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
13641         * )     case "$getpwnam_r_proto" in
13642                 REENTRANT_PROTO*) ;;
13643                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
13644                 esac
13645                 echo "Prototype: $try" ;;
13646         esac
13647         ;;
13648         *)      case "$usethreads" in
13649                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
13650                 esac
13651                 d_getpwnam_r=undef
13652                 getpwnam_r_proto=0
13653                 ;;
13654         esac
13655         ;;
13656 *)      getpwnam_r_proto=0
13657         ;;
13658 esac
13659
13660 : see if getpwuid_r exists
13661 set getpwuid_r d_getpwuid_r
13662 eval $inlibc
13663 case "$d_getpwuid_r" in
13664 "$define")
13665         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13666         case "$d_getpwuid_r_proto:$usethreads" in
13667         ":define")      d_getpwuid_r_proto=define
13668                 set d_getpwuid_r_proto getpwuid_r $hdrs
13669                 eval $hasproto ;;
13670         *)      ;;
13671         esac
13672         case "$d_getpwuid_r_proto" in
13673         define)
13674         case "$getpwuid_r_proto" in
13675         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
13676         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
13677         esac
13678         case "$getpwuid_r_proto" in
13679         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
13680         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
13681         esac
13682         case "$getpwuid_r_proto" in
13683         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
13684         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
13685         esac
13686         case "$getpwuid_r_proto" in
13687         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
13688         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
13689         esac
13690         case "$getpwuid_r_proto" in
13691         ''|0)   d_getpwuid_r=undef
13692                 getpwuid_r_proto=0
13693                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
13694         * )     case "$getpwuid_r_proto" in
13695                 REENTRANT_PROTO*) ;;
13696                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
13697                 esac
13698                 echo "Prototype: $try" ;;
13699         esac
13700         ;;
13701         *)      case "$usethreads" in
13702                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
13703                 esac
13704                 d_getpwuid_r=undef
13705                 getpwuid_r_proto=0
13706                 ;;
13707         esac
13708         ;;
13709 *)      getpwuid_r_proto=0
13710         ;;
13711 esac
13712
13713
13714 : see if getservbyname exists
13715 set getservbyname d_getsbyname
13716 eval $inlibc
13717
13718 : see if getservbyport exists
13719 set getservbyport d_getsbyport
13720 eval $inlibc
13721
13722 : see if getservent exists
13723 set getservent d_getsent
13724 eval $inlibc
13725
13726 : see if getservbyname_r exists
13727 set getservbyname_r d_getservbyname_r
13728 eval $inlibc
13729 case "$d_getservbyname_r" in
13730 "$define")
13731         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13732         case "$d_getservbyname_r_proto:$usethreads" in
13733         ":define")      d_getservbyname_r_proto=define
13734                 set d_getservbyname_r_proto getservbyname_r $hdrs
13735                 eval $hasproto ;;
13736         *)      ;;
13737         esac
13738         case "$d_getservbyname_r_proto" in
13739         define)
13740         case "$getservbyname_r_proto" in
13741         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
13742         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
13743         esac
13744         case "$getservbyname_r_proto" in
13745         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
13746         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
13747         esac
13748         case "$getservbyname_r_proto" in
13749         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
13750         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
13751         esac
13752         case "$getservbyname_r_proto" in
13753         ''|0)   d_getservbyname_r=undef
13754                 getservbyname_r_proto=0
13755                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
13756         * )     case "$getservbyname_r_proto" in
13757                 REENTRANT_PROTO*) ;;
13758                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
13759                 esac
13760                 echo "Prototype: $try" ;;
13761         esac
13762         ;;
13763         *)      case "$usethreads" in
13764                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
13765                 esac
13766                 d_getservbyname_r=undef
13767                 getservbyname_r_proto=0
13768                 ;;
13769         esac
13770         ;;
13771 *)      getservbyname_r_proto=0
13772         ;;
13773 esac
13774
13775 : see if getservbyport_r exists
13776 set getservbyport_r d_getservbyport_r
13777 eval $inlibc
13778 case "$d_getservbyport_r" in
13779 "$define")
13780         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13781         case "$d_getservbyport_r_proto:$usethreads" in
13782         ":define")      d_getservbyport_r_proto=define
13783                 set d_getservbyport_r_proto getservbyport_r $hdrs
13784                 eval $hasproto ;;
13785         *)      ;;
13786         esac
13787         case "$d_getservbyport_r_proto" in
13788         define)
13789         case "$getservbyport_r_proto" in
13790         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
13791         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
13792         esac
13793         case "$getservbyport_r_proto" in
13794         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
13795         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
13796         esac
13797         case "$getservbyport_r_proto" in
13798         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
13799         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
13800         esac
13801         case "$getservbyport_r_proto" in
13802         ''|0)   d_getservbyport_r=undef
13803                 getservbyport_r_proto=0
13804                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
13805         * )     case "$getservbyport_r_proto" in
13806                 REENTRANT_PROTO*) ;;
13807                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
13808                 esac
13809                 echo "Prototype: $try" ;;
13810         esac
13811         ;;
13812         *)      case "$usethreads" in
13813                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
13814                 esac
13815                 d_getservbyport_r=undef
13816                 getservbyport_r_proto=0
13817                 ;;
13818         esac
13819         ;;
13820 *)      getservbyport_r_proto=0
13821         ;;
13822 esac
13823
13824 : see if getservent_r exists
13825 set getservent_r d_getservent_r
13826 eval $inlibc
13827 case "$d_getservent_r" in
13828 "$define")
13829         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13830         case "$d_getservent_r_proto:$usethreads" in
13831         ":define")      d_getservent_r_proto=define
13832                 set d_getservent_r_proto getservent_r $hdrs
13833                 eval $hasproto ;;
13834         *)      ;;
13835         esac
13836         case "$d_getservent_r_proto" in
13837         define)
13838         case "$getservent_r_proto" in
13839         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
13840         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
13841         esac
13842         case "$getservent_r_proto" in
13843         ''|0) try='int getservent_r(struct servent*, char*, int);'
13844         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
13845         esac
13846         case "$getservent_r_proto" in
13847         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
13848         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
13849         esac
13850         case "$getservent_r_proto" in
13851         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
13852         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
13853         esac
13854         case "$getservent_r_proto" in
13855         ''|0)   d_getservent_r=undef
13856                 getservent_r_proto=0
13857                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
13858         * )     case "$getservent_r_proto" in
13859                 REENTRANT_PROTO*) ;;
13860                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
13861                 esac
13862                 echo "Prototype: $try" ;;
13863         esac
13864         ;;
13865         *)      case "$usethreads" in
13866                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
13867                 esac
13868                 d_getservent_r=undef
13869                 getservent_r_proto=0
13870                 ;;
13871         esac
13872         ;;
13873 *)      getservent_r_proto=0
13874         ;;
13875 esac
13876
13877 : see if prototypes for various getservxxx netdb.h functions are available
13878 echo " "
13879 set d_getservprotos getservent $i_netdb netdb.h
13880 eval $hasproto
13881
13882 : see if getspnam exists
13883 set getspnam d_getspnam
13884 eval $inlibc
13885
13886 : see if this is a shadow.h system
13887 set shadow.h i_shadow
13888 eval $inhdr
13889
13890 : see if getspnam_r exists
13891 set getspnam_r d_getspnam_r
13892 eval $inlibc
13893 case "$d_getspnam_r" in
13894 "$define")
13895         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
13896         case "$d_getspnam_r_proto:$usethreads" in
13897         ":define")      d_getspnam_r_proto=define
13898                 set d_getspnam_r_proto getspnam_r $hdrs
13899                 eval $hasproto ;;
13900         *)      ;;
13901         esac
13902         case "$d_getspnam_r_proto" in
13903         define)
13904         case "$getspnam_r_proto" in
13905         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
13906         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
13907         esac
13908         case "$getspnam_r_proto" in
13909         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
13910         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
13911         esac
13912         case "$getspnam_r_proto" in
13913         ''|0)   d_getspnam_r=undef
13914                 getspnam_r_proto=0
13915                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
13916         * )     case "$getspnam_r_proto" in
13917                 REENTRANT_PROTO*) ;;
13918                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
13919                 esac
13920                 echo "Prototype: $try" ;;
13921         esac
13922         ;;
13923         *)      case "$usethreads" in
13924                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
13925                 esac
13926                 d_getspnam_r=undef
13927                 getspnam_r_proto=0
13928                 ;;
13929         esac
13930         ;;
13931 *)      getspnam_r_proto=0
13932         ;;
13933 esac
13934
13935 : see if gettimeofday or ftime exists
13936 set gettimeofday d_gettimeod
13937 eval $inlibc
13938 case "$d_gettimeod" in
13939 "$undef")
13940         set ftime d_ftime 
13941         eval $inlibc
13942         ;;
13943 *)
13944         val="$undef"; set d_ftime; eval $setvar
13945         ;;
13946 esac
13947 case "$d_gettimeod$d_ftime" in
13948 "$undef$undef")
13949         echo " "
13950         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
13951         ;;
13952 esac
13953
13954 : see if gmtime_r exists
13955 set gmtime_r d_gmtime_r
13956 eval $inlibc
13957 case "$d_gmtime_r" in
13958 "$define")
13959         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
13960         case "$d_gmtime_r_proto:$usethreads" in
13961         ":define")      d_gmtime_r_proto=define
13962                 set d_gmtime_r_proto gmtime_r $hdrs
13963                 eval $hasproto ;;
13964         *)      ;;
13965         esac
13966         case "$d_gmtime_r_proto" in
13967         define)
13968         case "$gmtime_r_proto" in
13969         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
13970         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
13971         esac
13972         case "$gmtime_r_proto" in
13973         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
13974         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
13975         esac
13976         case "$gmtime_r_proto" in
13977         ''|0)   d_gmtime_r=undef
13978                 gmtime_r_proto=0
13979                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
13980         * )     case "$gmtime_r_proto" in
13981                 REENTRANT_PROTO*) ;;
13982                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
13983                 esac
13984                 echo "Prototype: $try" ;;
13985         esac
13986         ;;
13987         *)      case "$usethreads" in
13988                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
13989                 esac
13990                 d_gmtime_r=undef
13991                 gmtime_r_proto=0
13992                 ;;
13993         esac
13994         ;;
13995 *)      gmtime_r_proto=0
13996         ;;
13997 esac
13998
13999 : see if hasmntopt exists
14000 set hasmntopt d_hasmntopt
14001 eval $inlibc
14002
14003 : see if this is a netinet/in.h or sys/in.h system
14004 set netinet/in.h i_niin sys/in.h i_sysin
14005 eval $inhdr
14006
14007 : see if arpa/inet.h has to be included
14008 set arpa/inet.h i_arpainet
14009 eval $inhdr
14010
14011 : see if htonl --and friends-- exists
14012 val=''
14013 set htonl val
14014 eval $inlibc
14015
14016 : Maybe they are macros.
14017 case "$val" in
14018 $undef)
14019         $cat >htonl.c <<EOM
14020 #include <stdio.h>
14021 #include <sys/types.h>
14022 #$i_niin I_NETINET_IN
14023 #$i_sysin I_SYS_IN
14024 #$i_arpainet I_ARPA_INET
14025 #ifdef I_NETINET_IN
14026 #include <netinet/in.h>
14027 #endif
14028 #ifdef I_SYS_IN
14029 #include <sys/in.h>
14030 #endif
14031 #ifdef I_ARPA_INET
14032 #include <arpa/inet.h>
14033 #endif
14034 #ifdef htonl
14035 printf("Defined as a macro.");
14036 #endif
14037 EOM
14038         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14039         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14040                 val="$define"
14041                 echo "But it seems to be defined as a macro." >&4
14042         fi
14043         $rm -f htonl.?
14044         ;;
14045 esac
14046 set d_htonl
14047 eval $setvar
14048
14049 : see if ilogbl exists
14050 set ilogbl d_ilogbl
14051 eval $inlibc
14052
14053 : index or strchr
14054 echo " "
14055 if set index val -f; eval $csym; $val; then
14056         if set strchr val -f d_strchr; eval $csym; $val; then
14057                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14058                         val="$define"
14059                         vali="$undef"
14060                         echo "strchr() found." >&4
14061                 else
14062                         val="$undef"
14063                         vali="$define"
14064                         echo "index() found." >&4
14065                 fi
14066         else
14067                 val="$undef"
14068                 vali="$define"
14069                 echo "index() found." >&4
14070         fi
14071 else
14072         if set strchr val -f d_strchr; eval $csym; $val; then
14073                 val="$define"
14074                 vali="$undef"
14075                 echo "strchr() found." >&4
14076         else
14077                 echo "No index() or strchr() found!" >&4
14078                 val="$undef"
14079                 vali="$undef"
14080         fi
14081 fi
14082 set d_strchr; eval $setvar
14083 val="$vali"
14084 set d_index; eval $setvar
14085
14086 : check whether inet_aton exists
14087 set inet_aton d_inetaton
14088 eval $inlibc
14089
14090 : Look for isascii
14091 echo " "
14092 $cat >isascii.c <<EOCP
14093 #include <stdio.h>
14094 #include <ctype.h>
14095 #$i_stdlib I_STDLIB
14096 #ifdef I_STDLIB
14097 #include <stdlib.h>
14098 #endif
14099 int main() {
14100         int c = 'A';
14101         if (isascii(c))
14102                 exit(0);
14103         else
14104                 exit(1);
14105 }
14106 EOCP
14107 set isascii
14108 if eval $compile; then
14109         echo "isascii() found." >&4
14110         val="$define"
14111 else
14112         echo "isascii() NOT found." >&4
14113         val="$undef"
14114 fi
14115 set d_isascii
14116 eval $setvar
14117 $rm -f isascii*
14118
14119 : see if isfinite exists
14120 set isfinite d_isfinite
14121 eval $inlibc
14122
14123 : see if isinf exists
14124 set isinf d_isinf
14125 eval $inlibc
14126
14127 : see if isnan exists
14128 set isnan d_isnan
14129 eval $inlibc
14130
14131 : see if isnanl exists
14132 set isnanl d_isnanl
14133 eval $inlibc
14134
14135 : see if killpg exists
14136 set killpg d_killpg
14137 eval $inlibc
14138
14139 : see if lchown exists
14140 echo " "
14141 $cat > try.c <<'EOCP'
14142 /* System header to define __stub macros and hopefully few prototypes,
14143     which can conflict with char lchown(); below.  */
14144 #include <assert.h>
14145 /* Override any gcc2 internal prototype to avoid an error.  */
14146 /* We use char because int might match the return type of a gcc2
14147    builtin and then its argument prototype would still apply.  */
14148 char lchown();
14149 int main() {
14150     /*  The GNU C library defines this for functions which it implements
14151         to always fail with ENOSYS.  Some functions are actually named
14152         something starting with __ and the normal name is an alias.  */
14153 #if defined (__stub_lchown) || defined (__stub___lchown)
14154 choke me
14155 #else
14156 lchown();
14157 #endif
14158 ; return 0; }
14159 EOCP
14160 set try
14161 if eval $compile; then
14162     $echo "lchown() found." >&4
14163     val="$define"
14164 else
14165     $echo "lchown() NOT found." >&4
14166     val="$undef"
14167 fi
14168 set d_lchown
14169 eval $setvar
14170
14171 : See if number of significant digits in a double precision number is known
14172 echo " "
14173 $cat >ldbl_dig.c <<EOM
14174 #$i_limits I_LIMITS
14175 #$i_float I_FLOAT
14176 #ifdef I_LIMITS
14177 #include <limits.h>
14178 #endif
14179 #ifdef I_FLOAT
14180 #include <float.h>
14181 #endif
14182 #ifdef LDBL_DIG
14183 printf("Contains LDBL_DIG");
14184 #endif
14185 EOM
14186 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14187 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14188         echo "LDBL_DIG found." >&4
14189         val="$define"
14190 else
14191         echo "LDBL_DIG NOT found." >&4
14192         val="$undef"
14193 fi
14194 $rm -f ldbl_dig.?
14195 set d_ldbl_dig
14196 eval $setvar
14197
14198 : see if this is a math.h system
14199 set math.h i_math
14200 eval $inhdr
14201
14202 d_libm_lib_version="$undef"
14203 case $i_math in
14204     $define)
14205         : check to see if math.h defines _LIB_VERSION
14206         echo " "
14207         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14208         $cat >try.c <<EOCP
14209 #include <unistd.h>
14210 #include <math.h>
14211 int main (int argc, char *argv[])
14212 {
14213     printf ("%d\n", _LIB_VERSION);
14214     return (0);
14215     } /* main */
14216 EOCP
14217         set try
14218         if eval $compile; then
14219             foo=`$run ./try`
14220             echo "Yes, it does ($foo)" >&4
14221             d_libm_lib_version="$define"
14222         else
14223             echo "No, it does not (probably harmless)\n" >&4
14224             fi
14225         $rm -f try.* try core core.try.*
14226         ;;
14227
14228     esac
14229
14230 : see if link exists
14231 set link d_link
14232 eval $inlibc
14233
14234 : see if localtime_r exists
14235 set localtime_r d_localtime_r
14236 eval $inlibc
14237 case "$d_localtime_r" in
14238 "$define")
14239         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14240         case "$d_localtime_r_proto:$usethreads" in
14241         ":define")      d_localtime_r_proto=define
14242                 set d_localtime_r_proto localtime_r $hdrs
14243                 eval $hasproto ;;
14244         *)      ;;
14245         esac
14246         case "$d_localtime_r_proto" in
14247         define)
14248         case "$localtime_r_proto" in
14249         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14250         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14251         esac
14252         case "$localtime_r_proto" in
14253         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14254         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14255         esac
14256         case "$localtime_r_proto" in
14257         ''|0)   d_localtime_r=undef
14258                 localtime_r_proto=0
14259                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14260         * )     case "$localtime_r_proto" in
14261                 REENTRANT_PROTO*) ;;
14262                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14263                 esac
14264                 echo "Prototype: $try" ;;
14265         esac
14266         ;;
14267         *)      case "$usethreads" in
14268                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14269                 esac
14270                 d_localtime_r=undef
14271                 localtime_r_proto=0
14272                 ;;
14273         esac
14274         ;;
14275 *)      localtime_r_proto=0
14276         ;;
14277 esac
14278
14279 : see if localeconv exists
14280 set localeconv d_locconv
14281 eval $inlibc
14282
14283 : see if lockf exists
14284 set lockf d_lockf
14285 eval $inlibc
14286
14287 : see if prototype for lseek is available
14288 echo " "
14289 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14290 eval $hasproto
14291
14292 : see if lstat exists
14293 set lstat d_lstat
14294 eval $inlibc
14295
14296 : see if madvise exists
14297 set madvise d_madvise
14298 eval $inlibc
14299
14300 : see if malloc_size exists
14301 set malloc_size d_malloc_size
14302 eval $inlibc
14303
14304 : see if malloc_size_good exists
14305 set malloc_good_size d_malloc_good_size
14306 eval $inlibc
14307
14308 : see if mblen exists
14309 set mblen d_mblen
14310 eval $inlibc
14311
14312 : see if mbstowcs exists
14313 set mbstowcs d_mbstowcs
14314 eval $inlibc
14315
14316 : see if mbtowc exists
14317 set mbtowc d_mbtowc
14318 eval $inlibc
14319
14320 : see if memchr exists
14321 set memchr d_memchr
14322 eval $inlibc
14323
14324 : see if memcmp exists
14325 set memcmp d_memcmp
14326 eval $inlibc
14327
14328 : see if memcpy exists
14329 set memcpy d_memcpy
14330 eval $inlibc
14331
14332 : see if memmove exists
14333 set memmove d_memmove
14334 eval $inlibc
14335
14336 : see if memset exists
14337 set memset d_memset
14338 eval $inlibc
14339
14340 : see if mkdir exists
14341 set mkdir d_mkdir
14342 eval $inlibc
14343
14344 : see if mkdtemp exists
14345 set mkdtemp d_mkdtemp
14346 eval $inlibc
14347
14348 : see if mkfifo exists
14349 set mkfifo d_mkfifo
14350 eval $inlibc
14351
14352 : see if mkstemp exists
14353 set mkstemp d_mkstemp
14354 eval $inlibc
14355
14356 : see if mkstemps exists
14357 set mkstemps d_mkstemps
14358 eval $inlibc
14359
14360 : see if mktime exists
14361 set mktime d_mktime
14362 eval $inlibc
14363
14364 : see if this is a sys/mman.h system
14365 set sys/mman.h i_sysmman
14366 eval $inhdr
14367
14368 : see if mmap exists
14369 set mmap d_mmap
14370 eval $inlibc
14371 : see what shmat returns
14372 : default to something harmless
14373 mmaptype='void *'
14374 case "$i_sysmman$d_mmap" in
14375 "$define$define")
14376         $cat >mmap.c <<'END'
14377 #include <sys/mman.h>
14378 void *mmap();
14379 END
14380         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14381                 mmaptype='void *'
14382         else
14383                 mmaptype='caddr_t'
14384         fi
14385         echo "and it returns ($mmaptype)." >&4
14386         ;;
14387 esac
14388
14389
14390
14391 : see if sqrtl exists
14392 set sqrtl d_sqrtl
14393 eval $inlibc
14394
14395 : see if scalbnl exists
14396 set scalbnl d_scalbnl
14397 eval $inlibc
14398
14399 : see if modfl exists
14400 set modfl d_modfl
14401 eval $inlibc
14402
14403 : see if prototype for modfl is available
14404 echo " "
14405 set d_modflproto modfl $i_math math.h
14406 eval $hasproto
14407
14408 d_modfl_pow32_bug="$undef"
14409
14410 case "$d_longdbl$d_modfl" in
14411 $define$define)
14412         $cat <<EOM
14413 Checking to see whether your modfl() is okay for large values...
14414 EOM
14415 $cat >try.c <<EOCP
14416 #include <math.h> 
14417 #include <stdio.h>
14418 EOCP
14419 if $test "X$d_modflproto" != "X$define"; then
14420         $cat >>try.c <<EOCP
14421 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14422 long double modfl (long double, long double *);
14423 EOCP
14424 fi
14425 $cat >>try.c <<EOCP
14426 int main() {
14427     long double nv = 4294967303.15;
14428     long double v, w;
14429     v = modfl(nv, &w);         
14430 #ifdef __GLIBC__
14431     printf("glibc");
14432 #endif
14433     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14434     return 0;
14435 }
14436 EOCP
14437         case "$osname:$gccversion" in
14438         aix:)   saveccflags="$ccflags"
14439                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14440         esac
14441         set try
14442         if eval $compile; then
14443                 foo=`$run ./try`
14444                 case "$foo" in
14445                 *" 4294967303.150000 1.150000 4294967302.000000")
14446                         echo >&4 "Your modfl() is broken for large values."
14447                         d_modfl_pow32_bug="$define"
14448                         case "$foo" in
14449                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14450                         ;;
14451                         esac
14452                         ;;
14453                 *" 4294967303.150000 0.150000 4294967303.000000")
14454                         echo >&4 "Your modfl() seems okay for large values."
14455                         ;;
14456                 *)      echo >&4 "I don't understand your modfl() at all."
14457                         d_modfl="$undef"
14458                         ;;
14459                 esac
14460                 $rm -f try.* try core core.try.*
14461         else
14462                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14463                 d_modfl="$undef"
14464         fi
14465         case "$osname:$gccversion" in
14466         aix:)   ccflags="$saveccflags" ;; # restore
14467         esac
14468         ;;
14469 esac
14470
14471 if $test "$uselongdouble" = "$define"; then
14472     message=""
14473     if $test "$d_sqrtl" != "$define"; then
14474         message="$message sqrtl"
14475     fi
14476     if $test "$d_modfl" != "$define"; then
14477         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14478             echo "You have both aintl and copysignl, so I can emulate modfl."
14479         else
14480             message="$message modfl"
14481         fi
14482     fi
14483     if $test "$d_frexpl" != "$define"; then
14484         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14485             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14486         else
14487             message="$message frexpl"
14488         fi
14489     fi
14490
14491     if $test "$message" != ""; then
14492         $cat <<EOM >&4
14493
14494 *** You requested the use of long doubles but you do not seem to have
14495 *** the following mathematical functions needed for long double support:
14496 ***    $message
14497 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14498 *** Cannot continue, aborting.
14499
14500 EOM
14501
14502         exit 1
14503     fi
14504 fi
14505
14506 : see if mprotect exists
14507 set mprotect d_mprotect
14508 eval $inlibc
14509
14510 : see if msgctl exists
14511 set msgctl d_msgctl
14512 eval $inlibc
14513
14514 : see if msgget exists
14515 set msgget d_msgget
14516 eval $inlibc
14517
14518 : see if msgsnd exists
14519 set msgsnd d_msgsnd
14520 eval $inlibc
14521
14522 : see if msgrcv exists
14523 set msgrcv d_msgrcv
14524 eval $inlibc
14525
14526 : see how much of the 'msg*(2)' library is present.
14527 h_msg=true
14528 echo " "
14529 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14530 *"$undef"*) h_msg=false;;
14531 esac
14532 case "$osname" in
14533 freebsd)
14534     case "`ipcs 2>&1`" in
14535     "SVID messages"*"not configured"*)
14536         echo "Your $osname does not have the msg*(2) configured." >&4
14537         h_msg=false
14538         val="$undef"
14539         set msgctl d_msgctl
14540         eval $setvar
14541         set msgget d_msgget
14542         eval $setvar
14543         set msgsnd d_msgsnd
14544         eval $setvar
14545         set msgrcv d_msgrcv
14546         eval $setvar
14547         ;;
14548     esac
14549     ;;
14550 esac
14551 : we could also check for sys/ipc.h ...
14552 if $h_msg && $test `./findhdr sys/msg.h`; then
14553         echo "You have the full msg*(2) library." >&4
14554         val="$define"
14555 else
14556         echo "You don't have the full msg*(2) library." >&4
14557         val="$undef"
14558 fi
14559 set d_msg
14560 eval $setvar
14561
14562
14563 echo " "
14564 echo "Checking to see if your system supports struct msghdr..." >&4
14565 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14566 eval $hasstruct
14567 case "$d_msghdr_s" in
14568 "$define")      echo "Yes, it does."   ;;
14569 *)              echo "No, it doesn't." ;;
14570 esac
14571
14572
14573 : see if msync exists
14574 set msync d_msync
14575 eval $inlibc
14576
14577 : see if munmap exists
14578 set munmap d_munmap
14579 eval $inlibc
14580
14581 : see if nice exists
14582 set nice d_nice
14583 eval $inlibc
14584
14585 : see if this is a langinfo.h system
14586 set langinfo.h i_langinfo
14587 eval $inhdr
14588
14589 : see if nl_langinfo exists
14590 set nl_langinfo d_nl_langinfo
14591 eval $inlibc
14592
14593 : check for length of character
14594 echo " "
14595 case "$charsize" in
14596 '')
14597         echo "Checking to see how big your characters are (hey, you never know)..." >&4
14598         $cat >try.c <<EOCP
14599 #include <stdio.h>
14600 #$i_stdlib I_STDLIB
14601 #ifdef I_STDLIB
14602 #include <stdlib.h>
14603 #endif
14604 int main()
14605 {
14606     printf("%d\n", (int)sizeof(char));
14607     exit(0);
14608 }
14609 EOCP
14610         set try
14611         if eval $compile_ok; then
14612                 dflt=`$run ./try`
14613         else
14614                 dflt='1'
14615                 echo "(I can't seem to compile the test program.  Guessing...)"
14616         fi
14617         ;;
14618 *)
14619         dflt="$charsize"
14620         ;;
14621 esac
14622 rp="What is the size of a character (in bytes)?"
14623 . ./myread
14624 charsize="$ans"
14625 $rm -f try.c try
14626
14627 : check for volatile keyword
14628 echo " "
14629 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
14630 $cat >try.c <<'EOCP'
14631 int main()
14632 {
14633         typedef struct _goo_struct goo_struct;
14634         goo_struct * volatile goo = ((goo_struct *)0);
14635         struct _goo_struct {
14636                 long long_int;
14637                 int reg_int;
14638                 char char_var;
14639         };
14640         typedef unsigned short foo_t;
14641         char *volatile foo;
14642         volatile int bar;
14643         volatile foo_t blech;
14644         foo = foo;
14645 }
14646 EOCP
14647 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
14648         val="$define"
14649         echo "Yup, it does."
14650 else
14651         val="$undef"
14652         echo "Nope, it doesn't."
14653 fi
14654 set d_volatile
14655 eval $setvar
14656 $rm -f try.*
14657
14658
14659 echo " "
14660 $echo "Choosing the C types to be used for Perl's internal types..." >&4
14661
14662 case "$use64bitint:$d_quad:$quadtype" in
14663 define:define:?*)
14664         ivtype="$quadtype"
14665         uvtype="$uquadtype"
14666         ivsize=8
14667         uvsize=8
14668         ;;
14669 *)      ivtype="long"
14670         uvtype="unsigned long"
14671         ivsize=$longsize
14672         uvsize=$longsize
14673         ;;
14674 esac
14675
14676 case "$uselongdouble:$d_longdbl" in
14677 define:define)
14678         nvtype="long double"
14679         nvsize=$longdblsize
14680         ;;
14681 *)      nvtype=double
14682         nvsize=$doublesize
14683         ;;
14684 esac
14685
14686 $echo "(IV will be "$ivtype", $ivsize bytes)"
14687 $echo "(UV will be "$uvtype", $uvsize bytes)"
14688 $echo "(NV will be "$nvtype", $nvsize bytes)"
14689
14690 $cat >try.c <<EOCP
14691 #$i_inttypes I_INTTYPES
14692 #ifdef I_INTTYPES
14693 #include <inttypes.h>
14694 #endif
14695 #include <stdio.h>
14696 int main() {
14697 #ifdef INT8
14698    int8_t i =  INT8_MAX;
14699   uint8_t u = UINT8_MAX;
14700   printf("int8_t\n");
14701 #endif
14702 #ifdef INT16
14703    int16_t i =  INT16_MAX;
14704   uint16_t i = UINT16_MAX;
14705   printf("int16_t\n");
14706 #endif
14707 #ifdef INT32
14708    int32_t i =  INT32_MAX;
14709   uint32_t u = UINT32_MAX;
14710   printf("int32_t\n");
14711 #endif
14712 }
14713 EOCP
14714
14715 case "$i8type" in
14716 '')     case "$charsize" in
14717         1)      i8type=char
14718                 u8type="unsigned char"
14719                 i8size=$charsize
14720                 u8size=$charsize
14721                 ;;
14722         esac
14723         ;;
14724 esac
14725 case "$i8type" in
14726 '')     set try -DINT8
14727         if eval $compile; then
14728                 case "`$run ./try`" in
14729                 int8_t) i8type=int8_t
14730                         u8type=uint8_t
14731                         i8size=1
14732                         u8size=1
14733                         ;;
14734                 esac
14735         fi
14736         ;;
14737 esac
14738 case "$i8type" in
14739 '')     if $test $charsize -ge 1; then
14740                 i8type=char
14741                 u8type="unsigned char"
14742                 i8size=$charsize
14743                 u8size=$charsize
14744         fi
14745         ;;
14746 esac
14747
14748 case "$i16type" in
14749 '')     case "$shortsize" in
14750         2)      i16type=short
14751                 u16type="unsigned short"
14752                 i16size=$shortsize
14753                 u16size=$shortsize
14754                 ;;
14755         esac
14756         ;;
14757 esac
14758 case "$i16type" in
14759 '')     set try -DINT16
14760         if eval $compile; then
14761                 case "`$run ./try`" in
14762                 int16_t)
14763                         i16type=int16_t
14764                         u16type=uint16_t
14765                         i16size=2
14766                         u16size=2
14767                         ;;
14768                 esac
14769         fi
14770         ;;
14771 esac
14772 case "$i16type" in
14773 '')     if $test $shortsize -ge 2; then
14774                 i16type=short
14775                 u16type="unsigned short"
14776                 i16size=$shortsize
14777                 u16size=$shortsize
14778         fi
14779         ;;
14780 esac
14781
14782 case "$i32type" in
14783 '')     case "$longsize" in
14784         4)      i32type=long
14785                 u32type="unsigned long"
14786                 i32size=$longsize
14787                 u32size=$longsize
14788                 ;;
14789         *)      case "$intsize" in
14790                 4)      i32type=int
14791                         u32type="unsigned int"
14792                         i32size=$intsize
14793                         u32size=$intsize
14794                         ;;
14795                 esac
14796                 ;;
14797         esac
14798         ;;
14799 esac
14800 case "$i32type" in
14801 '')     set try -DINT32
14802         if eval $compile; then
14803                 case "`$run ./try`" in
14804                 int32_t)
14805                         i32type=int32_t
14806                         u32type=uint32_t
14807                         i32size=4
14808                         u32size=4
14809                         ;;
14810                 esac
14811         fi
14812         ;;
14813 esac
14814 case "$i32type" in
14815 '')     if $test $intsize -ge 4; then
14816                 i32type=int
14817                 u32type="unsigned int"
14818                 i32size=$intsize
14819                 u32size=$intsize
14820         fi
14821         ;;
14822 esac
14823
14824 case "$i64type" in
14825 '')     case "$d_quad:$quadtype" in
14826         define:?*)
14827                 i64type="$quadtype"
14828                 u64type="$uquadtype"
14829                 i64size=8
14830                 u64size=8
14831                 ;;
14832         esac
14833         ;;
14834 esac
14835
14836 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
14837 : volatile so that the compiler has to store it out to memory.
14838 if test X"$d_volatile" = X"$define"; then
14839         volatile=volatile
14840 fi
14841 $cat <<EOP >try.c
14842 #include <stdio.h>
14843 #$i_stdlib I_STDLIB
14844 #ifdef I_STDLIB
14845 #include <stdlib.h>
14846 #endif
14847 #include <sys/types.h>
14848 #include <signal.h>
14849 #ifdef SIGFPE
14850 $volatile int bletched = 0;
14851 $signal_t blech(s) int s; { bletched = 1; }
14852 #endif
14853 int main() {
14854     $uvtype u = 0;
14855     $nvtype d;
14856     int     n = 8 * $uvsize;
14857     int     i;
14858 #ifdef SIGFPE
14859     signal(SIGFPE, blech);
14860 #endif
14861
14862     for (i = 0; i < n; i++) {
14863       u = u << 1 | ($uvtype)1;
14864       d = ($nvtype)u;
14865       if (($uvtype)d != u)
14866         break;
14867       if (d <= 0)
14868         break;
14869       d = ($nvtype)(u - 1);
14870       if (($uvtype)d != (u - 1))
14871         break;
14872 #ifdef SIGFPE
14873       if (bletched) {
14874         break;
14875 #endif
14876       } 
14877     }
14878     printf("%d\n", ((i == n) ? -n : i));
14879     exit(0);
14880 }
14881 EOP
14882 set try
14883
14884 d_nv_preserves_uv="$undef"
14885 if eval $compile; then
14886         nv_preserves_uv_bits="`$run ./try`"
14887 fi
14888 case "$nv_preserves_uv_bits" in
14889 \-[1-9]*)       
14890         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
14891         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
14892         d_nv_preserves_uv="$define"
14893         ;;
14894 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
14895         d_nv_preserves_uv="$undef" ;;
14896 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
14897         nv_preserves_uv_bits="$undef" ;;
14898 esac
14899
14900 $rm -f try.* try
14901
14902 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
14903 : volatile so that the compiler has to store it out to memory.
14904 if test X"$d_volatile" = X"$define"; then
14905         volatile=volatile
14906 fi
14907 $cat <<EOP >try.c
14908 #include <stdio.h>
14909 #$i_stdlib I_STDLIB
14910 #ifdef I_STDLIB
14911 #include <stdlib.h>
14912 #endif
14913 #$i_string I_STRING
14914 #ifdef I_STRING
14915 #  include <string.h>
14916 #else
14917 #  include <strings.h>
14918 #endif
14919 #include <sys/types.h>
14920 #include <signal.h>
14921 #ifdef SIGFPE
14922 $volatile int bletched = 0;
14923 $signal_t blech(s) int s; { bletched = 1; }
14924 #endif
14925
14926 int checkit($nvtype d, char *where) {
14927     unsigned char *p = (char *)&d;
14928     unsigned char *end = p + sizeof(d);
14929     int fail = 0;
14930
14931     while (p < end)
14932         fail += *p++;
14933
14934     if (!fail)
14935         return 0;
14936
14937     p = (char *)&d;
14938     printf("No - %s: 0x", where);
14939     while (p < end)
14940         printf ("%02X", *p++);
14941     printf("\n");
14942     return 1;
14943 }
14944
14945 int main(int argc, char **argv) {
14946     $nvtype d = 0.0;
14947     int fail = 0;
14948     fail += checkit(d, "0.0");
14949
14950     /* The compiler shouldn't be assuming that bletched is 0  */
14951     d = bletched;
14952
14953     fail += checkit(d, "bleched");
14954
14955 #ifdef SIGFPE
14956     signal(SIGFPE, blech);
14957 #endif
14958
14959     /* Paranoia - the compiler should have no way of knowing that ANSI says
14960        that argv[argc] will always be NULL.  Actually, if it did assume this it
14961        would be buggy, as this is C and main() can be called from elsewhere in
14962        the program.  */
14963     d = argv[argc] ? 1 : 0;
14964
14965     if (d) {
14966         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
14967     }
14968
14969     fail += checkit(d, "ternary");
14970
14971     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
14972
14973     if (d != 0.0) {
14974         printf("No - memset doesn't give 0.0\n");
14975         /* This might just blow up:  */
14976         printf("(gives %g)\n", d);
14977         return 1;
14978     }
14979     
14980 #ifdef SIGFPE
14981     if (bletched) {
14982         printf("No - something bleched\n");
14983         return 1;
14984     }
14985 #endif
14986     if (fail) {
14987       printf("No - %d fail(s)\n", fail);
14988       return 1;
14989     }
14990     printf("Yes\n");
14991     return 0;
14992 }
14993 EOP
14994 set try
14995
14996 d_nv_zero_is_allbits_zero="$undef"
14997 if eval $compile; then
14998     xxx="`$run ./try`"
14999     case "$?" in
15000         0)
15001             case "$xxx" in
15002                 Yes)  cat >&4 <<EOM
15003 0.0 is represented as all bits zero in memory
15004 EOM
15005                     d_nv_zero_is_allbits_zero="$define"
15006                     ;;
15007                 *)  cat >&4 <<EOM
15008 0.0 is not represented as all bits zero in memory
15009 EOM
15010                     d_nv_zero_is_allbits_zero="$undef"
15011                     ;;
15012             esac
15013             ;;
15014         *)  cat >&4 <<EOM
15015 0.0 is not represented as all bits zero in memory
15016 EOM
15017             d_nv_zero_is_allbits_zero="$undef"
15018             ;;
15019     esac
15020 fi
15021
15022 $rm -f try.* try
15023
15024
15025 : check for off64_t
15026 echo " "
15027 echo "Checking to see if you have off64_t..." >&4
15028 $cat >try.c <<EOCP
15029 #include <sys/types.h>
15030 #include <unistd.h>
15031 int main() { off64_t x = 7; }
15032 EOCP
15033 set try
15034 if eval $compile; then
15035         val="$define"
15036         echo "You have off64_t."
15037 else
15038         val="$undef"
15039         echo "You do not have off64_t."
15040         case "$lseeksize" in
15041         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15042         esac
15043 fi
15044 $rm -f try.* try
15045 set d_off64_t
15046 eval $setvar
15047
15048 : how to create joinable pthreads
15049 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15050         echo " "
15051         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15052         $cat >try.c <<'EOCP'
15053 #include <pthread.h>
15054 int main() {
15055     int detachstate = JOINABLE;
15056 }
15057 EOCP
15058         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15059         if eval $compile; then
15060                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15061                 val="$undef" # Yes, undef.
15062                 set d_old_pthread_create_joinable
15063                 eval $setvar
15064                 val=""
15065                 set old_pthread_create_joinable
15066                 eval $setvar
15067         else
15068                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15069                 if eval $compile; then
15070                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15071                         val="$define"
15072                         set d_old_pthread_create_joinable
15073                         eval $setvar
15074                         val=PTHREAD_CREATE_UNDETACHED
15075                         set old_pthread_create_joinable
15076                         eval $setvar
15077                 else            
15078                         set try -DJOINABLE=__UNDETACHED
15079                         if eval $compile; then
15080                                 echo "You seem to use __UNDETACHED." >&4
15081                                 val="$define"
15082                                 set d_old_pthread_create_joinable
15083                                 eval $setvar
15084                                 val=__UNDETACHED
15085                                 set old_pthread_create_joinable
15086                                 eval $setvar
15087                         else
15088                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15089                                 val="$define"
15090                                 set d_old_pthread_create_joinable
15091                                 eval $setvar
15092                                 val=0
15093                                 set old_pthread_create_joinable
15094                                 eval $setvar
15095                         fi
15096                 fi
15097         fi
15098         $rm -f try try.*
15099 else
15100     d_old_pthread_create_joinable="$undef"
15101     old_pthread_create_joinable=""
15102 fi
15103
15104 : see if pause exists
15105 set pause d_pause
15106 eval $inlibc
15107
15108 : see if pipe exists
15109 set pipe d_pipe
15110 eval $inlibc
15111
15112 : see if poll exists
15113 set poll d_poll
15114 eval $inlibc
15115
15116 : see if readlink exists
15117 set readlink d_readlink
15118 eval $inlibc
15119
15120 echo " "
15121 procselfexe=''
15122 val="$undef"
15123 case "$d_readlink" in
15124 "$define")
15125         if $issymlink /proc/self/exe ; then
15126                 $ls -l /proc/self/exe > reflect
15127                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15128                         echo "You have Linux-like /proc/self/exe."
15129                         procselfexe='"/proc/self/exe"'
15130                         val="$define"
15131                 fi
15132         fi
15133         if $issymlink /proc/curproc/file ; then
15134                 $ls -l /proc/curproc/file > reflect
15135                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15136                         echo "You have BSD-like /proc/curproc/file."
15137                         procselfexe='"/proc/curproc/file"'
15138                         val="$define"
15139                 fi
15140         fi
15141         ;;
15142 esac
15143 $rm -f reflect
15144 set d_procselfexe
15145 eval $setvar
15146
15147 : see whether the pthread_atfork exists
15148 $cat >try.c <<EOP
15149 #include <pthread.h>
15150 #include <stdio.h>
15151 int main() {
15152 #ifdef  PTHREAD_ATFORK
15153         pthread_atfork(NULL,NULL,NULL);
15154 #endif
15155 }
15156 EOP
15157
15158 : see if pthread_atfork exists
15159 set try -DPTHREAD_ATFORK
15160 if eval $compile; then
15161     val="$define"
15162 else
15163     val="$undef"
15164 fi
15165 case "$usethreads" in
15166 $define)
15167         case "$val" in
15168         $define) echo 'pthread_atfork found.' >&4        ;;
15169         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15170         esac
15171 esac
15172 set d_pthread_atfork
15173 eval $setvar
15174
15175 : see if pthread_attr_setscope exists
15176 set pthread_attr_setscope d_pthread_attr_setscope
15177 eval $inlibc
15178
15179
15180 : see whether the various POSIXish _yields exist
15181 $cat >try.c <<EOP
15182 #include <pthread.h>
15183 #include <stdio.h>
15184 int main() {
15185 #ifdef SCHED_YIELD
15186         sched_yield();
15187 #else
15188 #ifdef PTHREAD_YIELD
15189         pthread_yield();
15190 #else
15191 #ifdef PTHREAD_YIELD_NULL
15192         pthread_yield(NULL);
15193 #endif
15194 #endif
15195 #endif
15196 }
15197 EOP
15198 : see if sched_yield exists
15199 set try -DSCHED_YIELD
15200 if eval $compile; then
15201     val="$define"
15202     sched_yield='sched_yield()'
15203 else
15204     val="$undef"
15205 fi
15206 case "$usethreads" in
15207 $define)
15208         case "$val" in
15209         $define) echo 'sched_yield() found.' >&4        ;;
15210         *)       echo 'sched_yield() NOT found.' >&4    ;;
15211         esac
15212 esac
15213 set d_sched_yield
15214 eval $setvar
15215
15216 : see if pthread_yield exists
15217 set try -DPTHREAD_YIELD
15218 if eval $compile; then
15219     val="$define"
15220     case "$sched_yield" in
15221     '') sched_yield='pthread_yield()' ;;
15222     esac
15223 else
15224     set try -DPTHREAD_YIELD_NULL
15225     if eval $compile; then
15226         val="$define"
15227         case "$sched_yield" in
15228         '') sched_yield='pthread_yield(NULL)' ;;
15229         esac
15230     else
15231         val="$undef"
15232     fi
15233 fi
15234 case "$usethreads" in
15235 $define)
15236         case "$val" in
15237         $define) echo 'pthread_yield() found.' >&4      ;;
15238         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15239         esac
15240         ;;
15241 esac
15242 set d_pthread_yield
15243 eval $setvar
15244
15245 case "$sched_yield" in
15246 '') sched_yield=undef ;;
15247 esac
15248
15249 $rm -f try try.*
15250
15251 : see if random_r exists
15252 set random_r d_random_r
15253 eval $inlibc
15254 case "$d_random_r" in
15255 "$define")
15256         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15257         case "$d_random_r_proto:$usethreads" in
15258         ":define")      d_random_r_proto=define
15259                 set d_random_r_proto random_r $hdrs
15260                 eval $hasproto ;;
15261         *)      ;;
15262         esac
15263         case "$d_random_r_proto" in
15264         define)
15265         case "$random_r_proto" in
15266         ''|0) try='int random_r(int*, struct random_data*);'
15267         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15268         esac
15269         case "$random_r_proto" in
15270         ''|0) try='int random_r(long*, struct random_data*);'
15271         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15272         esac
15273         case "$random_r_proto" in
15274         ''|0) try='int random_r(struct random_data*, int32_t*);'
15275         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15276         esac
15277         case "$random_r_proto" in
15278         ''|0)   d_random_r=undef
15279                 random_r_proto=0
15280                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15281         * )     case "$random_r_proto" in
15282                 REENTRANT_PROTO*) ;;
15283                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15284                 esac
15285                 echo "Prototype: $try" ;;
15286         esac
15287         ;;
15288         *)      case "$usethreads" in
15289                 define) echo "random_r has no prototype, not using it." >&4 ;;
15290                 esac
15291                 d_random_r=undef
15292                 random_r_proto=0
15293                 ;;
15294         esac
15295         ;;
15296 *)      random_r_proto=0
15297         ;;
15298 esac
15299
15300 : see if readdir and friends exist
15301 set readdir d_readdir
15302 eval $inlibc
15303 set seekdir d_seekdir
15304 eval $inlibc
15305 set telldir d_telldir
15306 eval $inlibc
15307 set rewinddir d_rewinddir
15308 eval $inlibc
15309
15310 : see if readdir64_r exists
15311 set readdir64_r d_readdir64_r
15312 eval $inlibc
15313 case "$d_readdir64_r" in
15314 "$define")
15315         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15316         case "$d_readdir64_r_proto:$usethreads" in
15317         ":define")      d_readdir64_r_proto=define
15318                 set d_readdir64_r_proto readdir64_r $hdrs
15319                 eval $hasproto ;;
15320         *)      ;;
15321         esac
15322         case "$d_readdir64_r_proto" in
15323         define)
15324         case "$readdir64_r_proto" in
15325         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15326         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15327         esac
15328         case "$readdir64_r_proto" in
15329         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15330         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15331         esac
15332         case "$readdir64_r_proto" in
15333         ''|0)   d_readdir64_r=undef
15334                 readdir64_r_proto=0
15335                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15336         * )     case "$readdir64_r_proto" in
15337                 REENTRANT_PROTO*) ;;
15338                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15339                 esac
15340                 echo "Prototype: $try" ;;
15341         esac
15342         ;;
15343         *)      case "$usethreads" in
15344                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15345                 esac
15346                 d_readdir64_r=undef
15347                 readdir64_r_proto=0
15348                 ;;
15349         esac
15350         ;;
15351 *)      readdir64_r_proto=0
15352         ;;
15353 esac
15354
15355 : see if readdir_r exists
15356 set readdir_r d_readdir_r
15357 eval $inlibc
15358 case "$d_readdir_r" in
15359 "$define")
15360         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15361         case "$d_readdir_r_proto:$usethreads" in
15362         ":define")      d_readdir_r_proto=define
15363                 set d_readdir_r_proto readdir_r $hdrs
15364                 eval $hasproto ;;
15365         *)      ;;
15366         esac
15367         case "$d_readdir_r_proto" in
15368         define)
15369         case "$readdir_r_proto" in
15370         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15371         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15372         esac
15373         case "$readdir_r_proto" in
15374         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15375         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15376         esac
15377         case "$readdir_r_proto" in
15378         ''|0)   d_readdir_r=undef
15379                 readdir_r_proto=0
15380                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15381         * )     case "$readdir_r_proto" in
15382                 REENTRANT_PROTO*) ;;
15383                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15384                 esac
15385                 echo "Prototype: $try" ;;
15386         esac
15387         ;;
15388         *)      case "$usethreads" in
15389                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15390                 esac
15391                 d_readdir_r=undef
15392                 readdir_r_proto=0
15393                 ;;
15394         esac
15395         ;;
15396 *)      readdir_r_proto=0
15397         ;;
15398 esac
15399
15400 : see if readv exists
15401 set readv d_readv
15402 eval $inlibc
15403
15404 : see if recvmsg exists
15405 set recvmsg d_recvmsg
15406 eval $inlibc
15407
15408 : see if rename exists
15409 set rename d_rename
15410 eval $inlibc
15411
15412 : see if rmdir exists
15413 set rmdir d_rmdir
15414 eval $inlibc
15415
15416 : see if memory.h is available.
15417 val=''
15418 set memory.h val
15419 eval $inhdr
15420
15421 : See if it conflicts with string.h
15422 case "$val" in
15423 $define)
15424         case "$strings" in
15425         '') ;;
15426         *)
15427                 $cppstdin $cppflags $cppminus < $strings > mem.h
15428                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15429                         echo " "
15430                         echo "We won't be including <memory.h>."
15431                         val="$undef"
15432                 fi
15433                 $rm -f mem.h
15434                 ;;
15435         esac
15436 esac
15437 set i_memory
15438 eval $setvar
15439
15440 : can bcopy handle overlapping blocks?
15441 echo " "
15442 val="$undef"
15443 case "$d_memmove" in
15444 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15445 *)      case "$d_bcopy" in
15446         "$define")
15447                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15448                 $cat >try.c <<EOCP
15449 #$i_memory I_MEMORY
15450 #$i_stdlib I_STDLIB
15451 #$i_string I_STRING
15452 #$i_unistd I_UNISTD
15453 EOCP
15454         $cat >>try.c <<'EOCP'
15455 #include <stdio.h>
15456 #ifdef I_MEMORY
15457 #  include <memory.h>
15458 #endif
15459 #ifdef I_STDLIB
15460 #  include <stdlib.h>
15461 #endif
15462 #ifdef I_STRING
15463 #  include <string.h>
15464 #else
15465 #  include <strings.h>
15466 #endif
15467 #ifdef I_UNISTD
15468 #  include <unistd.h>  /* Needed for NetBSD */
15469 #endif
15470 int main()
15471 {
15472 char buf[128], abc[128];
15473 char *b;
15474 int len;
15475 int off;
15476 int align;
15477
15478 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15479    try to store the string in read-only memory. */
15480 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15481
15482 for (align = 7; align >= 0; align--) {
15483         for (len = 36; len; len--) {
15484                 b = buf+align;
15485                 bcopy(abc, b, len);
15486                 for (off = 1; off <= len; off++) {
15487                         bcopy(b, b+off, len);
15488                         bcopy(b+off, b, len);
15489                         if (bcmp(b, abc, len))
15490                                 exit(1);
15491                 }
15492         }
15493 }
15494 exit(0);
15495 }
15496 EOCP
15497                 set try
15498                 if eval $compile_ok; then
15499                         if ./try 2>/dev/null; then
15500                                 echo "Yes, it can."
15501                                 val="$define"
15502                         else
15503                                 echo "It can't, sorry."
15504                         fi
15505                 else
15506                         echo "(I can't compile the test program, so we'll assume not...)"
15507                 fi
15508                 ;;
15509         esac
15510         $rm -f try.* try core
15511         ;;
15512 esac
15513 set d_safebcpy
15514 eval $setvar
15515
15516 : can memcpy handle overlapping blocks?
15517 echo " "
15518 val="$undef"
15519 case "$d_memmove" in
15520 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15521 *)      case "$d_memcpy" in
15522         "$define")
15523                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
15524                 $cat >try.c <<EOCP
15525 #$i_memory I_MEMORY
15526 #$i_stdlib I_STDLIB
15527 #$i_string I_STRING
15528 #$i_unistd I_UNISTD
15529 EOCP
15530         $cat >>try.c <<'EOCP'
15531 #include <stdio.h>
15532 #ifdef I_MEMORY
15533 #  include <memory.h>
15534 #endif
15535 #ifdef I_STDLIB
15536 #  include <stdlib.h>
15537 #endif
15538 #ifdef I_STRING
15539 #  include <string.h>
15540 #else
15541 #  include <strings.h>
15542 #endif
15543 #ifdef I_UNISTD
15544 #  include <unistd.h>  /* Needed for NetBSD */
15545 #endif
15546 int main()
15547 {
15548 char buf[128], abc[128];
15549 char *b;
15550 int len;
15551 int off;
15552 int align;
15553
15554 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15555    try to store the string in read-only memory. */
15556 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
15557
15558 for (align = 7; align >= 0; align--) {
15559         for (len = 36; len; len--) {
15560                 b = buf+align;
15561                 memcpy(b, abc, len);
15562                 for (off = 1; off <= len; off++) {
15563                         memcpy(b+off, b, len);
15564                         memcpy(b, b+off, len);
15565                         if (memcmp(b, abc, len))
15566                                 exit(1);
15567                 }
15568         }
15569 }
15570 exit(0);
15571 }
15572 EOCP
15573                 set try
15574                 if eval $compile_ok; then
15575                         if ./try 2>/dev/null; then
15576                                 echo "Yes, it can."
15577                                 val="$define"
15578                         else
15579                                 echo "It can't, sorry."
15580                         fi
15581                 else
15582                         echo "(I can't compile the test program, so we'll assume not...)"
15583                 fi
15584                 ;;
15585         esac
15586         $rm -f try.* try core
15587         ;;
15588 esac
15589 set d_safemcpy
15590 eval $setvar
15591
15592 : can memcmp be trusted to compare relative magnitude?
15593 val="$undef"
15594 case "$d_memcmp" in
15595 "$define")
15596         echo " "
15597         echo "Checking if your memcmp() can compare relative magnitude..." >&4
15598         $cat >try.c <<EOCP
15599 #$i_memory I_MEMORY
15600 #$i_stdlib I_STDLIB
15601 #$i_string I_STRING
15602 #$i_unistd I_UNISTD
15603 EOCP
15604         $cat >>try.c <<'EOCP'
15605 #include <stdio.h>
15606 #ifdef I_MEMORY
15607 #  include <memory.h>
15608 #endif
15609 #ifdef I_STDLIB
15610 #  include <stdlib.h>
15611 #endif
15612 #ifdef I_STRING
15613 #  include <string.h>
15614 #else
15615 #  include <strings.h>
15616 #endif
15617 #ifdef I_UNISTD
15618 #  include <unistd.h>  /* Needed for NetBSD */
15619 #endif
15620 int main()
15621 {
15622 char a = -1;
15623 char b = 0;
15624 if ((a < b) && memcmp(&a, &b, 1) < 0)
15625         exit(1);
15626 exit(0);
15627 }
15628 EOCP
15629         set try
15630         if eval $compile_ok; then
15631                 if $run ./try 2>/dev/null; then
15632                         echo "Yes, it can."
15633                         val="$define"
15634                 else
15635                         echo "No, it can't (it uses signed chars)."
15636                 fi
15637         else
15638                 echo "(I can't compile the test program, so we'll assume not...)"
15639         fi
15640         ;;
15641 esac
15642 $rm -f try.* try core
15643 set d_sanemcmp
15644 eval $setvar
15645
15646 : see if prototype for sbrk is available
15647 echo " "
15648 set d_sbrkproto sbrk $i_unistd unistd.h
15649 eval $hasproto
15650
15651 : see if select exists
15652 set select d_select
15653 eval $inlibc
15654
15655 : see if semctl exists
15656 set semctl d_semctl
15657 eval $inlibc
15658
15659 : see if semget exists
15660 set semget d_semget
15661 eval $inlibc
15662
15663 : see if semop exists
15664 set semop d_semop
15665 eval $inlibc
15666
15667 : see how much of the 'sem*(2)' library is present.
15668 h_sem=true
15669 echo " "
15670 case "$d_semctl$d_semget$d_semop" in
15671 *"$undef"*) h_sem=false;;
15672 esac
15673 case "$osname" in
15674 freebsd)
15675     case "`ipcs 2>&1`" in
15676     "SVID messages"*"not configured"*)
15677         echo "Your $osname does not have the sem*(2) configured." >&4
15678         h_sem=false
15679         val="$undef"
15680         set semctl d_semctl
15681         eval $setvar
15682         set semget d_semget
15683         eval $setvar
15684         set semop d_semop
15685         eval $setvar
15686         ;;
15687     esac
15688     ;;
15689 esac
15690 : we could also check for sys/ipc.h ...
15691 if $h_sem && $test `./findhdr sys/sem.h`; then
15692         echo "You have the full sem*(2) library." >&4
15693         val="$define"
15694 else
15695         echo "You don't have the full sem*(2) library." >&4
15696         val="$undef"
15697 fi
15698 set d_sem
15699 eval $setvar
15700
15701 : see whether sys/sem.h defines union semun
15702 echo " "
15703 $cat > try.c <<'END'
15704 #include <sys/types.h>
15705 #include <sys/ipc.h>
15706 #include <sys/sem.h>
15707 int main () { union semun semun; semun.buf = 0; }
15708 END
15709 set try
15710 if eval $compile; then
15711     echo "You have union semun in <sys/sem.h>." >&4
15712     val="$define"
15713 else
15714     echo "You do not have union semun in <sys/sem.h>." >&4
15715     val="$undef"
15716 fi
15717 $rm -f try try.c
15718 set d_union_semun
15719 eval $setvar
15720
15721 : see how to do semctl IPC_STAT
15722 case "$d_sem" in
15723 $define)
15724     echo " "
15725     $cat > try.h <<END
15726 #ifndef S_IRUSR
15727 #   ifdef S_IREAD
15728 #       define S_IRUSR S_IREAD
15729 #       define S_IWUSR S_IWRITE
15730 #       define S_IXUSR S_IEXEC
15731 #   else
15732 #       define S_IRUSR 0400
15733 #       define S_IWUSR 0200
15734 #       define S_IXUSR 0100
15735 #   endif
15736 #   define S_IRGRP (S_IRUSR>>3)
15737 #   define S_IWGRP (S_IWUSR>>3)
15738 #   define S_IXGRP (S_IXUSR>>3)
15739 #   define S_IROTH (S_IRUSR>>6)
15740 #   define S_IWOTH (S_IWUSR>>6)
15741 #   define S_IXOTH (S_IXUSR>>6)
15742 #endif
15743 #ifndef S_IRWXU
15744 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
15745 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
15746 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
15747 #endif
15748 END
15749     : see whether semctl IPC_STAT can use union semun
15750     case "$d_semctl_semun" in
15751     '')
15752       val="$undef"
15753       $cat > try.c <<END
15754 #include <sys/types.h>
15755 #include <sys/ipc.h>
15756 #include <sys/sem.h>
15757 #include <sys/stat.h>
15758 #include <stdio.h>
15759 #include <errno.h>
15760 #include "try.h"
15761 #ifndef errno
15762 extern int errno;
15763 #endif
15764 #$d_union_semun HAS_UNION_SEMUN
15765 int main() {
15766     union semun
15767 #ifndef HAS_UNION_SEMUN
15768     {
15769         int val;
15770         struct semid_ds *buf;
15771         unsigned short *array;
15772     }
15773 #endif
15774     arg;
15775     int sem, st;
15776
15777 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
15778     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15779     if (sem > -1) {
15780         struct semid_ds argbuf;
15781         arg.buf = &argbuf;
15782 #       ifdef IPC_STAT
15783         st = semctl(sem, 0, IPC_STAT, arg);
15784         if (st == 0)
15785             printf("semun\n");
15786         else
15787 #       endif /* IPC_STAT */
15788             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15789 #       ifdef IPC_RMID
15790         if (semctl(sem, 0, IPC_RMID, arg) != 0)
15791 #       endif /* IPC_RMID */
15792             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15793     } else
15794 #endif /* IPC_PRIVATE && ... */
15795         printf("semget failed: errno = %d\n", errno);
15796   return 0;
15797 }
15798 END
15799       set try
15800       if eval $compile; then
15801           xxx=`$run ./try`
15802           case "$xxx" in
15803           semun) val="$define" ;;
15804           esac
15805       fi
15806       $rm -f try try.c
15807       set d_semctl_semun
15808       eval $setvar
15809       ;;
15810     esac
15811     case "$d_semctl_semun" in
15812     $define)
15813         echo "You can use union semun for semctl IPC_STAT." >&4
15814         also='also'
15815         ;;
15816     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
15817         also=''
15818         ;;
15819     esac
15820
15821     : see whether semctl IPC_STAT can use struct semid_ds pointer
15822     case "$d_semctl_semid_ds" in
15823     '')
15824       val="$undef"
15825       $cat > try.c <<'END'
15826 #include <sys/types.h>
15827 #include <sys/ipc.h>
15828 #include <sys/sem.h>
15829 #include <sys/stat.h>
15830 #include "try.h"
15831 #include <stdio.h>
15832 #include <errno.h>
15833 #ifndef errno
15834 extern int errno;
15835 #endif
15836 int main() {
15837     struct semid_ds arg;
15838     int sem, st;
15839
15840 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
15841     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
15842     if (sem > -1) {
15843 #       ifdef IPC_STAT
15844         st = semctl(sem, 0, IPC_STAT, &arg);
15845         if (st == 0)
15846             printf("semid_ds\n");
15847         else
15848 #       endif /* IPC_STAT */
15849             printf("semctl IPC_STAT failed: errno = %d\n", errno);
15850 #       ifdef IPC_RMID
15851         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
15852 #       endif /* IPC_RMID */
15853             printf("semctl IPC_RMID failed: errno = %d\n", errno);
15854     } else
15855 #endif /* IPC_PRIVATE && ... */
15856         printf("semget failed: errno = %d\n", errno);
15857
15858     return 0;
15859 }
15860 END
15861       set try
15862       if eval $compile; then
15863           xxx=`$run ./try`
15864           case "$xxx" in
15865           semid_ds) val="$define" ;;
15866           esac
15867       fi
15868       $rm -f try try.c
15869       set d_semctl_semid_ds
15870       eval $setvar
15871       ;;
15872     esac
15873     case "$d_semctl_semid_ds" in
15874     $define)
15875         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
15876         ;;
15877     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
15878         ;;
15879     esac
15880     $rm -f try.h
15881     ;;
15882 *)  val="$undef"
15883
15884     # We do not have the full sem*(2) library, so assume we can not
15885     # use either.
15886
15887     set d_semctl_semun
15888     eval $setvar
15889
15890     set d_semctl_semid_ds
15891     eval $setvar
15892     ;;
15893 esac
15894
15895 : see if sendmsg exists
15896 set sendmsg d_sendmsg
15897 eval $inlibc
15898
15899 : see if setegid exists
15900 set setegid d_setegid
15901 eval $inlibc
15902
15903 : see if seteuid exists
15904 set seteuid d_seteuid
15905 eval $inlibc
15906
15907 : see if setgrent exists
15908 set setgrent d_setgrent
15909 eval $inlibc
15910
15911 : see if setgrent_r exists
15912 set setgrent_r d_setgrent_r
15913 eval $inlibc
15914 case "$d_setgrent_r" in
15915 "$define")
15916         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
15917         case "$d_setgrent_r_proto:$usethreads" in
15918         ":define")      d_setgrent_r_proto=define
15919                 set d_setgrent_r_proto setgrent_r $hdrs
15920                 eval $hasproto ;;
15921         *)      ;;
15922         esac
15923         case "$d_setgrent_r_proto" in
15924         define)
15925         case "$setgrent_r_proto" in
15926         ''|0) try='int setgrent_r(FILE**);'
15927         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
15928         esac
15929         case "$setgrent_r_proto" in
15930         ''|0) try='void setgrent_r(FILE**);'
15931         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
15932         esac
15933         case "$setgrent_r_proto" in
15934         ''|0)   d_setgrent_r=undef
15935                 setgrent_r_proto=0
15936                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
15937         * )     case "$setgrent_r_proto" in
15938                 REENTRANT_PROTO*) ;;
15939                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
15940                 esac
15941                 echo "Prototype: $try" ;;
15942         esac
15943         ;;
15944         *)      case "$usethreads" in
15945                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
15946                 esac
15947                 d_setgrent_r=undef
15948                 setgrent_r_proto=0
15949                 ;;
15950         esac
15951         ;;
15952 *)      setgrent_r_proto=0
15953         ;;
15954 esac
15955
15956 : see if sethostent exists
15957 set sethostent d_sethent
15958 eval $inlibc
15959
15960 : see if sethostent_r exists
15961 set sethostent_r d_sethostent_r
15962 eval $inlibc
15963 case "$d_sethostent_r" in
15964 "$define")
15965         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
15966         case "$d_sethostent_r_proto:$usethreads" in
15967         ":define")      d_sethostent_r_proto=define
15968                 set d_sethostent_r_proto sethostent_r $hdrs
15969                 eval $hasproto ;;
15970         *)      ;;
15971         esac
15972         case "$d_sethostent_r_proto" in
15973         define)
15974         case "$sethostent_r_proto" in
15975         ''|0) try='int sethostent_r(int, struct hostent_data*);'
15976         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
15977         esac
15978         case "$sethostent_r_proto" in
15979         ''|0) try='void sethostent_r(int, struct hostent_data*);'
15980         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
15981         esac
15982         case "$sethostent_r_proto" in
15983         ''|0)   d_sethostent_r=undef
15984                 sethostent_r_proto=0
15985                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
15986         * )     case "$sethostent_r_proto" in
15987                 REENTRANT_PROTO*) ;;
15988                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
15989                 esac
15990                 echo "Prototype: $try" ;;
15991         esac
15992         ;;
15993         *)      case "$usethreads" in
15994                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
15995                 esac
15996                 d_sethostent_r=undef
15997                 sethostent_r_proto=0
15998                 ;;
15999         esac
16000         ;;
16001 *)      sethostent_r_proto=0
16002         ;;
16003 esac
16004
16005 : see if setitimer exists
16006 set setitimer d_setitimer
16007 eval $inlibc
16008
16009 : see if setlinebuf exists
16010 set setlinebuf d_setlinebuf
16011 eval $inlibc
16012
16013 : see if setlocale exists
16014 set setlocale d_setlocale
16015 eval $inlibc
16016
16017 : see if locale.h is available
16018 set locale.h i_locale
16019 eval $inhdr
16020
16021 : see if setlocale_r exists
16022 set setlocale_r d_setlocale_r
16023 eval $inlibc
16024 case "$d_setlocale_r" in
16025 "$define")
16026         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16027         case "$d_setlocale_r_proto:$usethreads" in
16028         ":define")      d_setlocale_r_proto=define
16029                 set d_setlocale_r_proto setlocale_r $hdrs
16030                 eval $hasproto ;;
16031         *)      ;;
16032         esac
16033         case "$d_setlocale_r_proto" in
16034         define)
16035         case "$setlocale_r_proto" in
16036         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16037         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16038         esac
16039         case "$setlocale_r_proto" in
16040         ''|0)   d_setlocale_r=undef
16041                 setlocale_r_proto=0
16042                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16043         * )     case "$setlocale_r_proto" in
16044                 REENTRANT_PROTO*) ;;
16045                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16046                 esac
16047                 echo "Prototype: $try" ;;
16048         esac
16049         ;;
16050         *)      case "$usethreads" in
16051                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16052                 esac
16053                 d_setlocale_r=undef
16054                 setlocale_r_proto=0
16055                 ;;
16056         esac
16057         ;;
16058 *)      setlocale_r_proto=0
16059         ;;
16060 esac
16061
16062 : see if setnetent exists
16063 set setnetent d_setnent
16064 eval $inlibc
16065
16066 : see if setnetent_r exists
16067 set setnetent_r d_setnetent_r
16068 eval $inlibc
16069 case "$d_setnetent_r" in
16070 "$define")
16071         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16072         case "$d_setnetent_r_proto:$usethreads" in
16073         ":define")      d_setnetent_r_proto=define
16074                 set d_setnetent_r_proto setnetent_r $hdrs
16075                 eval $hasproto ;;
16076         *)      ;;
16077         esac
16078         case "$d_setnetent_r_proto" in
16079         define)
16080         case "$setnetent_r_proto" in
16081         ''|0) try='int setnetent_r(int, struct netent_data*);'
16082         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16083         esac
16084         case "$setnetent_r_proto" in
16085         ''|0) try='void setnetent_r(int, struct netent_data*);'
16086         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16087         esac
16088         case "$setnetent_r_proto" in
16089         ''|0)   d_setnetent_r=undef
16090                 setnetent_r_proto=0
16091                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16092         * )     case "$setnetent_r_proto" in
16093                 REENTRANT_PROTO*) ;;
16094                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16095                 esac
16096                 echo "Prototype: $try" ;;
16097         esac
16098         ;;
16099         *)      case "$usethreads" in
16100                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16101                 esac
16102                 d_setnetent_r=undef
16103                 setnetent_r_proto=0
16104                 ;;
16105         esac
16106         ;;
16107 *)      setnetent_r_proto=0
16108         ;;
16109 esac
16110
16111 : see if setprotoent exists
16112 set setprotoent d_setpent
16113 eval $inlibc
16114
16115 : see if setpgid exists
16116 set setpgid d_setpgid
16117 eval $inlibc
16118
16119 : see if setpgrp2 exists
16120 set setpgrp2 d_setpgrp2
16121 eval $inlibc
16122
16123 : see if setpriority exists
16124 set setpriority d_setprior
16125 eval $inlibc
16126
16127 : see if setproctitle exists
16128 set setproctitle d_setproctitle
16129 eval $inlibc
16130
16131 : see if setprotoent_r exists
16132 set setprotoent_r d_setprotoent_r
16133 eval $inlibc
16134 case "$d_setprotoent_r" in
16135 "$define")
16136         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16137         case "$d_setprotoent_r_proto:$usethreads" in
16138         ":define")      d_setprotoent_r_proto=define
16139                 set d_setprotoent_r_proto setprotoent_r $hdrs
16140                 eval $hasproto ;;
16141         *)      ;;
16142         esac
16143         case "$d_setprotoent_r_proto" in
16144         define)
16145         case "$setprotoent_r_proto" in
16146         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16147         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16148         esac
16149         case "$setprotoent_r_proto" in
16150         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16151         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16152         esac
16153         case "$setprotoent_r_proto" in
16154         ''|0)   d_setprotoent_r=undef
16155                 setprotoent_r_proto=0
16156                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16157         * )     case "$setprotoent_r_proto" in
16158                 REENTRANT_PROTO*) ;;
16159                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16160                 esac
16161                 echo "Prototype: $try" ;;
16162         esac
16163         ;;
16164         *)      case "$usethreads" in
16165                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16166                 esac
16167                 d_setprotoent_r=undef
16168                 setprotoent_r_proto=0
16169                 ;;
16170         esac
16171         ;;
16172 *)      setprotoent_r_proto=0
16173         ;;
16174 esac
16175
16176 : see if setpwent exists
16177 set setpwent d_setpwent
16178 eval $inlibc
16179
16180 : see if setpwent_r exists
16181 set setpwent_r d_setpwent_r
16182 eval $inlibc
16183 case "$d_setpwent_r" in
16184 "$define")
16185         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16186         case "$d_setpwent_r_proto:$usethreads" in
16187         ":define")      d_setpwent_r_proto=define
16188                 set d_setpwent_r_proto setpwent_r $hdrs
16189                 eval $hasproto ;;
16190         *)      ;;
16191         esac
16192         case "$d_setpwent_r_proto" in
16193         define)
16194         case "$setpwent_r_proto" in
16195         ''|0) try='int setpwent_r(FILE**);'
16196         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16197         esac
16198         case "$setpwent_r_proto" in
16199         ''|0) try='void setpwent_r(FILE**);'
16200         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16201         esac
16202         case "$setpwent_r_proto" in
16203         ''|0)   d_setpwent_r=undef
16204                 setpwent_r_proto=0
16205                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16206         * )     case "$setpwent_r_proto" in
16207                 REENTRANT_PROTO*) ;;
16208                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16209                 esac
16210                 echo "Prototype: $try" ;;
16211         esac
16212         ;;
16213         *)      case "$usethreads" in
16214                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16215                 esac
16216                 d_setpwent_r=undef
16217                 setpwent_r_proto=0
16218                 ;;
16219         esac
16220         ;;
16221 *)      setpwent_r_proto=0
16222         ;;
16223 esac
16224
16225 : see if setregid exists
16226 set setregid d_setregid
16227 eval $inlibc
16228 set setresgid d_setresgid
16229 eval $inlibc
16230
16231 : see if setreuid exists
16232 set setreuid d_setreuid
16233 eval $inlibc
16234 set setresuid d_setresuid
16235 eval $inlibc
16236
16237 : see if setrgid exists
16238 set setrgid d_setrgid
16239 eval $inlibc
16240
16241 : see if setruid exists
16242 set setruid d_setruid
16243 eval $inlibc
16244
16245 : see if setservent exists
16246 set setservent d_setsent
16247 eval $inlibc
16248
16249 : see if setservent_r exists
16250 set setservent_r d_setservent_r
16251 eval $inlibc
16252 case "$d_setservent_r" in
16253 "$define")
16254         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16255         case "$d_setservent_r_proto:$usethreads" in
16256         ":define")      d_setservent_r_proto=define
16257                 set d_setservent_r_proto setservent_r $hdrs
16258                 eval $hasproto ;;
16259         *)      ;;
16260         esac
16261         case "$d_setservent_r_proto" in
16262         define)
16263         case "$setservent_r_proto" in
16264         ''|0) try='int setservent_r(int, struct servent_data*);'
16265         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16266         esac
16267         case "$setservent_r_proto" in
16268         ''|0) try='void setservent_r(int, struct servent_data*);'
16269         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16270         esac
16271         case "$setservent_r_proto" in
16272         ''|0)   d_setservent_r=undef
16273                 setservent_r_proto=0
16274                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16275         * )     case "$setservent_r_proto" in
16276                 REENTRANT_PROTO*) ;;
16277                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16278                 esac
16279                 echo "Prototype: $try" ;;
16280         esac
16281         ;;
16282         *)      case "$usethreads" in
16283                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16284                 esac
16285                 d_setservent_r=undef
16286                 setservent_r_proto=0
16287                 ;;
16288         esac
16289         ;;
16290 *)      setservent_r_proto=0
16291         ;;
16292 esac
16293
16294 : see if setsid exists
16295 set setsid d_setsid
16296 eval $inlibc
16297
16298 : see if setvbuf exists
16299 set setvbuf d_setvbuf
16300 eval $inlibc
16301
16302 : see if sfio.h is available
16303 set sfio.h i_sfio
16304 eval $inhdr
16305
16306
16307 : see if sfio library is available
16308 case "$i_sfio" in
16309 $define)
16310         val=''
16311         set sfreserve val
16312         eval $inlibc
16313         ;;
16314 *)
16315         val="$undef"
16316         ;;
16317 esac
16318 : Ok, but do we want to use it.
16319 case "$val" in
16320 $define)
16321         case "$usesfio" in
16322         true|$define|[yY]*) dflt='y';;
16323         *) dflt='n';;
16324         esac
16325         echo "$package can use the sfio library, but it is experimental."
16326         case "$useperlio" in
16327         "$undef")
16328             echo "For sfio also the PerlIO abstraction layer is needed."
16329             echo "Earlier you said you wouldn't want that."
16330             ;;
16331         esac
16332         rp="You seem to have sfio available, do you want to try using it?"
16333         . ./myread
16334         case "$ans" in
16335         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16336                 useperlio="$define"
16337                 val="$define"
16338                 ;;
16339         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16340                 val="$undef"
16341                 ;;
16342         esac
16343         ;;
16344 *)      case "$usesfio" in
16345         true|$define|[yY]*)
16346                 echo "Sorry, cannot find sfio on this machine." >&4
16347                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16348                 val="$undef"
16349                 ;;
16350         esac
16351         ;;
16352 esac
16353 set d_sfio
16354 eval $setvar
16355 case "$d_sfio" in
16356 $define) usesfio='true';;
16357 *) usesfio='false';;
16358 esac
16359 case "$d_sfio" in
16360 $define) ;;
16361 *)      : Remove sfio from list of libraries to use
16362         case "$libs" in
16363         *-lsfio*)
16364                 echo "Removing unneeded -lsfio from library list" >&4
16365                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16366                 shift
16367                 libs="$*"
16368                 echo "libs = $libs" >&4
16369                 ;;
16370         esac
16371 ;;
16372 esac
16373
16374
16375 : see if shmctl exists
16376 set shmctl d_shmctl
16377 eval $inlibc
16378
16379 : see if shmget exists
16380 set shmget d_shmget
16381 eval $inlibc
16382
16383 : see if shmat exists
16384 set shmat d_shmat
16385 eval $inlibc
16386 : see what shmat returns
16387 case "$d_shmat" in
16388 "$define")
16389         $cat >shmat.c <<'END'
16390 #include <sys/shm.h>
16391 void *shmat();
16392 END
16393         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16394                 shmattype='void *'
16395         else
16396                 shmattype='char *'
16397         fi
16398         echo "and it returns ($shmattype)." >&4
16399         : see if a prototype for shmat is available
16400         xxx=`./findhdr sys/shm.h`
16401         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16402         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16403                 val="$define"
16404         else
16405                 val="$undef"
16406         fi
16407         $rm -f shmat.[co]
16408         ;;
16409 *)
16410         val="$undef"
16411         ;;
16412 esac
16413 set d_shmatprototype
16414 eval $setvar
16415
16416 : see if shmdt exists
16417 set shmdt d_shmdt
16418 eval $inlibc
16419
16420 : see how much of the 'shm*(2)' library is present.
16421 h_shm=true
16422 echo " "
16423 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16424 *"$undef"*) h_shm=false;;
16425 esac
16426 case "$osname" in
16427 freebsd)
16428     case "`ipcs 2>&1`" in
16429     "SVID shared memory"*"not configured"*)
16430         echo "Your $osname does not have the shm*(2) configured." >&4
16431         h_shm=false
16432         val="$undef"
16433         set shmctl d_shmctl
16434         evat $setvar
16435         set shmget d_shmget
16436         evat $setvar
16437         set shmat d_shmat
16438         evat $setvar
16439         set shmdt d_shmdt
16440         evat $setvar
16441         ;;
16442     esac
16443     ;;
16444 esac
16445 : we could also check for sys/ipc.h ...
16446 if $h_shm && $test `./findhdr sys/shm.h`; then
16447         echo "You have the full shm*(2) library." >&4
16448         val="$define"
16449 else
16450         echo "You don't have the full shm*(2) library." >&4
16451         val="$undef"
16452 fi
16453 set d_shm
16454 eval $setvar
16455
16456 echo " "
16457 : see if we have sigaction
16458 if set sigaction val -f d_sigaction; eval $csym; $val; then
16459         echo 'sigaction() found.' >&4
16460         $cat > try.c <<EOP
16461 #include <stdio.h>
16462 #include <sys/types.h>
16463 #include <signal.h>
16464 #$i_stdlib I_STDLIB
16465 #ifdef I_STDLIB
16466 #include <stdlib.h>
16467 #endif
16468 int main()
16469 {
16470     struct sigaction act, oact;
16471     act.sa_flags = 0;
16472     oact.sa_handler = 0;
16473     /* so that act and oact are used */
16474     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16475 }
16476 EOP
16477         set try
16478         if eval $compile_ok; then
16479                 val="$define"
16480         else
16481                 echo "But you don't seem to have a useable struct sigaction." >&4
16482                 val="$undef"
16483         fi
16484 else
16485         echo 'sigaction NOT found.' >&4
16486         val="$undef"
16487 fi
16488 set d_sigaction; eval $setvar
16489 $rm -f try try$_o try.c
16490
16491 : see if sigprocmask exists
16492 set sigprocmask d_sigprocmask
16493 eval $inlibc
16494
16495 : see if sigsetjmp exists
16496 echo " "
16497 case "$d_sigsetjmp" in
16498 '')
16499         $cat >try.c <<EOP
16500 #include <setjmp.h>
16501 #$i_stdlib I_STDLIB
16502 #ifdef I_STDLIB
16503 #include <stdlib.h>
16504 #endif
16505 sigjmp_buf env;
16506 int set = 1;
16507 int main()
16508 {
16509         if (sigsetjmp(env,1))
16510                 exit(set);
16511         set = 0;
16512         siglongjmp(env, 1);
16513         exit(1);
16514 }
16515 EOP
16516         set try
16517         if eval $compile; then
16518                 if $run ./try >/dev/null 2>&1; then
16519                         echo "POSIX sigsetjmp found." >&4
16520                         val="$define"
16521                 else
16522                         $cat >&4 <<EOM
16523 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
16524 I'll ignore them.
16525 EOM
16526                         val="$undef"
16527                 fi
16528         else
16529                 echo "sigsetjmp not found." >&4
16530                 val="$undef"
16531         fi
16532         ;;
16533 *) val="$d_sigsetjmp"
16534         case "$d_sigsetjmp" in
16535         $define) echo "POSIX sigsetjmp found." >&4;;
16536         $undef) echo "sigsetjmp not found." >&4;;
16537         esac
16538         ;;
16539 esac
16540 set d_sigsetjmp
16541 eval $setvar
16542 $rm -f try.c try
16543
16544 : see if snprintf exists
16545 set snprintf d_snprintf
16546 eval $inlibc
16547
16548 : see if vsnprintf exists
16549 set vsnprintf d_vsnprintf
16550 eval $inlibc
16551
16552 case "$d_snprintf-$d_vsnprintf" in
16553 "$define-$define")
16554     $cat <<EOM
16555 Checking whether your snprintf() and vsnprintf() work okay...
16556 EOM
16557     $cat >try.c <<'EOCP'
16558 /* v?snprintf testing logic courtesy of Russ Allbery.
16559  * According to C99:
16560  * - if the buffer is too short it still must be \0-terminated
16561  * - if the buffer is too short the potentially required length
16562  *   must be returned and not -1
16563  * - if the buffer is NULL the potentially required length
16564  *   must be returned and not -1 or core dump
16565  */
16566 #include <stdio.h>
16567 #include <stdarg.h>
16568
16569 char buf[2];
16570
16571 int test (char *format, ...)
16572 {
16573     va_list args;
16574     int count;
16575
16576     va_start (args, format);
16577     count = vsnprintf (buf, sizeof buf, format, args);
16578     va_end (args);
16579     return count;
16580 }
16581
16582 int main ()
16583 {
16584     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
16585              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
16586 }
16587 EOCP
16588     set try
16589     if eval $compile; then
16590         `$run ./try`
16591         case "$?" in
16592         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
16593         *) cat <<EOM >&4
16594 Your snprintf() and snprintf() don't seem to be working okay.
16595 EOM
16596            d_snprintf="$undef"
16597            d_vsnprintf="$undef"
16598            ;;
16599         esac
16600     else
16601         echo "(I can't seem to compile the test program--assuming they don't)"
16602         d_snprintf="$undef"
16603         d_vsnprintf="$undef"
16604     fi
16605     $rm -f try.* try core core.try.*
16606     ;;
16607 esac
16608
16609 : see if sockatmark exists
16610 set sockatmark d_sockatmark
16611 eval $inlibc
16612
16613 : see if prototype for sockatmark is available
16614 echo " "
16615 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
16616 eval $hasproto
16617
16618 : see if socks5_init exists
16619 set socks5_init d_socks5_init
16620 eval $inlibc
16621
16622 : see if sprintf returns the length of the string in the buffer as per ANSI
16623 $echo "Checking whether sprintf returns the length of the string..." >&4
16624 $cat <<EOP >try.c
16625 #include <stdio.h>
16626 #$i_stdlib I_STDLIB
16627 #ifdef I_STDLIB
16628 #include <stdlib.h>
16629 #endif
16630 #$i_string I_STRING
16631 #ifdef I_STRING
16632 #  include <string.h>
16633 #else
16634 #  include <strings.h>
16635 #endif
16636 #$i_math I_MATH
16637 #ifdef I_MATH
16638 #include <math.h>
16639 #endif
16640
16641 char buffer[256];
16642
16643 int check (size_t expect, int test) {
16644   size_t got = strlen(buffer);
16645   if (expect == got)
16646     return 0;
16647
16648   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
16649        test, buffer);
16650   exit (test);
16651 }
16652
16653 int main(int argc, char **argv) {
16654   int test = 0;
16655
16656   check(sprintf(buffer, ""), ++test);
16657   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
16658   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
16659
16660   return 0;
16661 }
16662 EOP
16663 set try
16664
16665 d_sprintf_returns_strlen="$undef"
16666 if eval $compile; then
16667     xxx="`$run ./try`"
16668     case "$?" in
16669         0) cat >&4 <<EOM
16670 sprintf returns the length of the string (as ANSI says it should)
16671 EOM
16672         d_sprintf_returns_strlen="$define"
16673         ;;
16674         *) cat >&4 <<EOM
16675 sprintf does not return the length of the string (how old is this system?)
16676 EOM
16677         d_sprintf_returns_strlen="$undef"
16678         ;;
16679     esac
16680 fi
16681
16682 $rm -f try.* try
16683
16684 : see if srand48_r exists
16685 set srand48_r d_srand48_r
16686 eval $inlibc
16687 case "$d_srand48_r" in
16688 "$define")
16689         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16690         case "$d_srand48_r_proto:$usethreads" in
16691         ":define")      d_srand48_r_proto=define
16692                 set d_srand48_r_proto srand48_r $hdrs
16693                 eval $hasproto ;;
16694         *)      ;;
16695         esac
16696         case "$d_srand48_r_proto" in
16697         define)
16698         case "$srand48_r_proto" in
16699         ''|0) try='int srand48_r(long, struct drand48_data*);'
16700         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
16701         esac
16702         case "$srand48_r_proto" in
16703         ''|0)   d_srand48_r=undef
16704                 srand48_r_proto=0
16705                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
16706         * )     case "$srand48_r_proto" in
16707                 REENTRANT_PROTO*) ;;
16708                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
16709                 esac
16710                 echo "Prototype: $try" ;;
16711         esac
16712         ;;
16713         *)      case "$usethreads" in
16714                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
16715                 esac
16716                 d_srand48_r=undef
16717                 srand48_r_proto=0
16718                 ;;
16719         esac
16720         ;;
16721 *)      srand48_r_proto=0
16722         ;;
16723 esac
16724
16725 : see if srandom_r exists
16726 set srandom_r d_srandom_r
16727 eval $inlibc
16728 case "$d_srandom_r" in
16729 "$define")
16730         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
16731         case "$d_srandom_r_proto:$usethreads" in
16732         ":define")      d_srandom_r_proto=define
16733                 set d_srandom_r_proto srandom_r $hdrs
16734                 eval $hasproto ;;
16735         *)      ;;
16736         esac
16737         case "$d_srandom_r_proto" in
16738         define)
16739         case "$srandom_r_proto" in
16740         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
16741         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
16742         esac
16743         case "$srandom_r_proto" in
16744         ''|0)   d_srandom_r=undef
16745                 srandom_r_proto=0
16746                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
16747         * )     case "$srandom_r_proto" in
16748                 REENTRANT_PROTO*) ;;
16749                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
16750                 esac
16751                 echo "Prototype: $try" ;;
16752         esac
16753         ;;
16754         *)      case "$usethreads" in
16755                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
16756                 esac
16757                 d_srandom_r=undef
16758                 srandom_r_proto=0
16759                 ;;
16760         esac
16761         ;;
16762 *)      srandom_r_proto=0
16763         ;;
16764 esac
16765
16766 : see if prototype for setresgid is available
16767 echo " "
16768 set d_sresgproto setresgid $i_unistd unistd.h
16769 eval $hasproto
16770
16771 : see if prototype for setresuid is available
16772 echo " "
16773 set d_sresuproto setresuid $i_unistd unistd.h
16774 eval $hasproto
16775
16776 : see if sys/stat.h is available
16777 set sys/stat.h i_sysstat
16778 eval $inhdr
16779
16780
16781 : see if stat knows about block sizes
16782 echo " "
16783 echo "Checking to see if your struct stat has st_blocks field..." >&4
16784 set d_statblks stat st_blocks $i_sysstat sys/stat.h
16785 eval $hasfield
16786
16787
16788 : see if this is a sys/vfs.h system
16789 set sys/vfs.h i_sysvfs
16790 eval $inhdr
16791
16792
16793 : see if this is a sys/statfs.h system
16794 set sys/statfs.h i_sysstatfs
16795 eval $inhdr
16796
16797
16798 echo " "
16799 echo "Checking to see if your system supports struct statfs..." >&4
16800 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
16801 eval $hasstruct
16802 case "$d_statfs_s" in
16803 "$define")      echo "Yes, it does."   ;;
16804 *)              echo "No, it doesn't." ;;
16805 esac
16806
16807
16808
16809 : see if struct statfs knows about f_flags
16810 case "$d_statfs_s" in
16811 define) 
16812         echo " "
16813         echo "Checking to see if your struct statfs has f_flags field..." >&4
16814         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
16815         eval $hasfield
16816         ;;
16817 *)      val="$undef"
16818         set d_statfs_f_flags
16819         eval $setvar
16820         ;;
16821 esac
16822 case "$d_statfs_f_flags" in
16823 "$define")      echo "Yes, it does."   ;;
16824 *)              echo "No, it doesn't." ;;
16825 esac
16826
16827 $cat >&4 <<EOM
16828 Checking how to access stdio streams by file descriptor number...
16829 EOM
16830 case "$stdio_stream_array" in
16831 '')     $cat >try.c <<EOCP
16832 #include <stdio.h>
16833 int main() {
16834   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
16835     printf("yes\n");
16836 }
16837 EOCP
16838         for s in _iob __iob __sF
16839         do
16840                 set try -DSTDIO_STREAM_ARRAY=$s
16841                 if eval $compile; then
16842                         case "`$run ./try`" in
16843                         yes)    stdio_stream_array=$s; break ;;
16844                         esac
16845                 fi
16846         done
16847         $rm -f try.* try$exe_ext
16848 esac
16849 case "$stdio_stream_array" in
16850 '')     $cat >&4 <<EOM
16851 I can't figure out how to access stdio streams by file descriptor number.
16852 EOM
16853         d_stdio_stream_array="$undef"
16854         ;;
16855 *)      $cat >&4 <<EOM
16856 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
16857 EOM
16858         d_stdio_stream_array="$define"
16859         ;;
16860 esac
16861
16862 : see if strcoll exists
16863 set strcoll d_strcoll
16864 eval $inlibc
16865
16866 : check for structure copying
16867 echo " "
16868 echo "Checking to see if your C compiler can copy structs..." >&4
16869 $cat >try.c <<'EOCP'
16870 int main()
16871 {
16872         struct blurfl {
16873                 int dyick;
16874         } foo, bar;
16875
16876         foo = bar;
16877 }
16878 EOCP
16879 if $cc -c try.c >/dev/null 2>&1 ; then
16880         val="$define"
16881         echo "Yup, it can."
16882 else
16883         val="$undef"
16884         echo "Nope, it can't."
16885 fi
16886 set d_strctcpy
16887 eval $setvar
16888 $rm -f try.*
16889
16890 : see if strerror and/or sys_errlist[] exist
16891 echo " "
16892 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
16893     if set strerror val -f d_strerror; eval $csym; $val; then
16894                 echo 'strerror() found.' >&4
16895                 d_strerror="$define"
16896                 d_strerrm='strerror(e)'
16897                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16898                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
16899                         d_syserrlst="$define"
16900                 else
16901                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
16902                         d_syserrlst="$undef"
16903                 fi
16904     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
16905                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
16906                 echo 'strerror() found in string header.' >&4
16907                 d_strerror="$define"
16908                 d_strerrm='strerror(e)'
16909                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
16910                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
16911                                 d_syserrlst="$define"
16912                 else
16913                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
16914                         d_syserrlst="$undef"
16915                 fi
16916     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
16917                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
16918                 d_strerror="$undef"
16919                 d_syserrlst="$define"
16920                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
16921     else
16922                 echo 'strerror() and sys_errlist[] NOT found.' >&4
16923                 d_strerror="$undef"
16924                 d_syserrlst="$undef"
16925                 d_strerrm='"unknown"'
16926     fi
16927 fi
16928
16929 : see if strerror_r exists
16930 set strerror_r d_strerror_r
16931 eval $inlibc
16932 case "$d_strerror_r" in
16933 "$define")
16934         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
16935         case "$d_strerror_r_proto:$usethreads" in
16936         ":define")      d_strerror_r_proto=define
16937                 set d_strerror_r_proto strerror_r $hdrs
16938                 eval $hasproto ;;
16939         *)      ;;
16940         esac
16941         case "$d_strerror_r_proto" in
16942         define)
16943         case "$strerror_r_proto" in
16944         ''|0) try='int strerror_r(int, char*, size_t);'
16945         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
16946         esac
16947         case "$strerror_r_proto" in
16948         ''|0) try='int strerror_r(int, char*, int);'
16949         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
16950         esac
16951         case "$strerror_r_proto" in
16952         ''|0) try='char* strerror_r(int, char*, size_t);'
16953         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
16954         esac
16955         case "$strerror_r_proto" in
16956         ''|0)   d_strerror_r=undef
16957                 strerror_r_proto=0
16958                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
16959         * )     case "$strerror_r_proto" in
16960                 REENTRANT_PROTO*) ;;
16961                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
16962                 esac
16963                 echo "Prototype: $try" ;;
16964         esac
16965         ;;
16966         *)      case "$usethreads" in
16967                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
16968                 esac
16969                 d_strerror_r=undef
16970                 strerror_r_proto=0
16971                 ;;
16972         esac
16973         ;;
16974 *)      strerror_r_proto=0
16975         ;;
16976 esac
16977
16978 : see if strftime exists
16979 set strftime d_strftime
16980 eval $inlibc
16981
16982 : see if strlcat exists
16983 set strlcat d_strlcat
16984 eval $inlibc
16985
16986 : see if strlcpy exists
16987 set strlcpy d_strlcpy
16988 eval $inlibc
16989
16990 : see if strtod exists
16991 set strtod d_strtod
16992 eval $inlibc
16993
16994 : see if strtol exists
16995 set strtol d_strtol
16996 eval $inlibc
16997
16998 : see if strtold exists
16999 set strtold d_strtold
17000 eval $inlibc
17001
17002 : see if strtoll exists
17003 set strtoll d_strtoll
17004 eval $inlibc
17005
17006 case "$d_longlong-$d_strtoll" in
17007 "$define-$define")
17008         $cat <<EOM
17009 Checking whether your strtoll() works okay...
17010 EOM
17011         $cat >try.c <<'EOCP'
17012 #include <errno.h>
17013 #ifdef __hpux
17014 #define strtoll __strtoll
17015 #endif
17016 #ifdef __EMX__
17017 #define strtoll _strtoll
17018 #endif
17019 #include <stdio.h>
17020 extern long long int strtoll(char *s, char **, int); 
17021 static int bad = 0;
17022 int check(char *s, long long ell, int een) {
17023         long long gll;
17024         errno = 0;
17025         gll = strtoll(s, 0, 10);
17026         if (!((gll == ell) && (errno == een)))
17027                 bad++;
17028 }
17029 int main() {
17030         check(" 1",                                      1LL, 0);
17031         check(" 0",                                      0LL, 0);
17032         check("-1",                                     -1LL, 0);
17033         check("-9223372036854775808", -9223372036854775808LL, 0);
17034         check("-9223372036854775808", -9223372036854775808LL, 0);
17035         check(" 9223372036854775807",  9223372036854775807LL, 0);
17036         check("-9223372036854775808", -9223372036854775808LL, 0);
17037         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17038         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17039         if (!bad)
17040                 printf("ok\n");
17041 }
17042 EOCP
17043         set try
17044         if eval $compile; then
17045                 yyy=`$run ./try`
17046                 case "$yyy" in
17047                 ok) echo "Your strtoll() seems to be working okay." ;;
17048                 *) cat <<EOM >&4
17049 Your strtoll() doesn't seem to be working okay.
17050 EOM
17051                    d_strtoll="$undef"
17052                    ;;
17053                 esac
17054         else
17055                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17056                 d_strtoll="$undef"
17057         fi
17058         ;;
17059 esac
17060
17061 : see if strtoq exists
17062 set strtoq d_strtoq
17063 eval $inlibc
17064
17065 : see if strtoul exists
17066 set strtoul d_strtoul
17067 eval $inlibc
17068
17069 case "$d_strtoul" in
17070 "$define")
17071         $cat <<EOM
17072 Checking whether your strtoul() works okay...
17073 EOM
17074         $cat >try.c <<'EOCP'
17075 #include <errno.h>
17076 #include <stdio.h>
17077 extern unsigned long int strtoul(char *s, char **, int); 
17078 static int bad = 0;
17079 void check(char *s, unsigned long eul, int een) {
17080         unsigned long gul;
17081         errno = 0;
17082         gul = strtoul(s, 0, 10);
17083         if (!((gul == eul) && (errno == een)))
17084                 bad++;
17085 }
17086 int main() {
17087         check(" 1", 1L, 0);
17088         check(" 0", 0L, 0);
17089 EOCP
17090         case "$longsize" in
17091         8)
17092             $cat >>try.c <<'EOCP'
17093         check("18446744073709551615", 18446744073709551615UL, 0);
17094         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17095 #if 0 /* strtoul() for /^-/ strings is undefined. */
17096         check("-1", 18446744073709551615UL, 0);
17097         check("-18446744073709551614", 2, 0);
17098         check("-18446744073709551615", 1, 0);
17099         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17100         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17101 #endif
17102 EOCP
17103                 ;;
17104         4)
17105                     $cat >>try.c <<'EOCP'
17106         check("4294967295", 4294967295UL, 0);
17107         check("4294967296", 4294967295UL, ERANGE);
17108 #if 0 /* strtoul() for /^-/ strings is undefined. */
17109         check("-1", 4294967295UL, 0);
17110         check("-4294967294", 2, 0);
17111         check("-4294967295", 1, 0);
17112         check("-4294967296", 4294967295UL, ERANGE);
17113         check("-4294967297", 4294967295UL, ERANGE);
17114 #endif
17115 EOCP
17116                 ;;
17117         *)
17118 : Should we write these tests to be more portable by sprintf-ing
17119 : ~0 and then manipulating that char string as input for strtol?
17120                 ;;
17121         esac
17122         $cat >>try.c <<'EOCP'
17123         if (!bad)
17124                 printf("ok\n");
17125         return 0;
17126 }
17127 EOCP
17128         set try
17129         if eval $compile; then
17130                 case "`$run ./try`" in
17131                 ok) echo "Your strtoul() seems to be working okay." ;;
17132                 *) cat <<EOM >&4
17133 Your strtoul() doesn't seem to be working okay.
17134 EOM
17135                    d_strtoul="$undef"
17136                    ;;
17137                 esac
17138         fi
17139         ;;
17140 esac
17141
17142 : see if strtoull exists
17143 set strtoull d_strtoull
17144 eval $inlibc
17145
17146 case "$d_longlong-$d_strtoull" in
17147 "$define-$define")
17148         $cat <<EOM
17149 Checking whether your strtoull() works okay...
17150 EOM
17151         $cat >try.c <<'EOCP'
17152 #include <errno.h>
17153 #ifdef __hpux
17154 #define strtoull __strtoull
17155 #endif
17156 #include <stdio.h>
17157 extern unsigned long long int strtoull(char *s, char **, int); 
17158 static int bad = 0;
17159 int check(char *s, long long eull, int een) {
17160         long long gull;
17161         errno = 0;
17162         gull = strtoull(s, 0, 10);
17163         if (!((gull == eull) && (errno == een)))
17164                 bad++;
17165 }
17166 int main() {
17167         check(" 1",                                        1LL, 0);
17168         check(" 0",                                        0LL, 0);
17169         check("18446744073709551615",  18446744073709551615ULL, 0);
17170         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17171 #if 0 /* strtoull() for /^-/ strings is undefined. */
17172         check("-1",                    18446744073709551615ULL, 0);
17173         check("-18446744073709551614",                     2LL, 0);
17174         check("-18446744073709551615",                     1LL, 0);
17175         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17176         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17177 #endif
17178         if (!bad)
17179                 printf("ok\n");
17180 }
17181 EOCP
17182         set try
17183         if eval $compile; then
17184                 case "`$run ./try`" in
17185                 ok) echo "Your strtoull() seems to be working okay." ;;
17186                 *) cat <<EOM >&4
17187 Your strtoull() doesn't seem to be working okay.
17188 EOM
17189                    d_strtoull="$undef"
17190                    ;;
17191                 esac
17192         fi
17193         ;;
17194 esac
17195
17196 : see if strtouq exists
17197 set strtouq d_strtouq
17198 eval $inlibc
17199
17200 case "$d_strtouq" in
17201 "$define")
17202         $cat <<EOM
17203 Checking whether your strtouq() works okay...
17204 EOM
17205         $cat >try.c <<'EOCP'
17206 #include <errno.h>
17207 #include <stdio.h>
17208 extern unsigned long long int strtouq(char *s, char **, int); 
17209 static int bad = 0;
17210 void check(char *s, unsigned long long eull, int een) {
17211         unsigned long long gull;
17212         errno = 0;
17213         gull = strtouq(s, 0, 10);
17214         if (!((gull == eull) && (errno == een)))
17215                 bad++;
17216 }
17217 int main() {
17218         check(" 1",                                        1LL, 0);
17219         check(" 0",                                        0LL, 0);
17220         check("18446744073709551615",  18446744073709551615ULL, 0);
17221         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17222 #if 0 /* strtouq() for /^-/ strings is undefined. */
17223         check("-1",                    18446744073709551615ULL, 0);
17224         check("-18446744073709551614",                     2LL, 0);
17225         check("-18446744073709551615",                     1LL, 0);
17226         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17227         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17228 #endif
17229         if (!bad)
17230                 printf("ok\n");
17231         return 0;
17232 }
17233 EOCP
17234         set try
17235         if eval $compile; then
17236                 case "`$run ./try`" in
17237                 ok) echo "Your strtouq() seems to be working okay." ;;
17238                 *) cat <<EOM >&4
17239 Your strtouq() doesn't seem to be working okay.
17240 EOM
17241                    d_strtouq="$undef"
17242                    ;;
17243                 esac
17244         fi
17245         ;;
17246 esac
17247
17248 : see if strxfrm exists
17249 set strxfrm d_strxfrm
17250 eval $inlibc
17251
17252 : see if symlink exists
17253 set symlink d_symlink
17254 eval $inlibc
17255
17256 : see if syscall exists
17257 set syscall d_syscall
17258 eval $inlibc
17259
17260 : see if prototype for syscall is available
17261 echo " "
17262 set d_syscallproto syscall $i_unistd unistd.h
17263 eval $hasproto
17264
17265 : see if sysconf exists
17266 set sysconf d_sysconf
17267 eval $inlibc
17268
17269 : see if system exists
17270 set system d_system
17271 eval $inlibc
17272
17273 : see if tcgetpgrp exists
17274 set tcgetpgrp d_tcgetpgrp
17275 eval $inlibc
17276
17277 : see if tcsetpgrp exists
17278 set tcsetpgrp d_tcsetpgrp
17279 eval $inlibc
17280
17281 : see if prototype for telldir is available
17282 echo " "
17283 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17284 eval $hasproto
17285
17286 : see if time exists
17287 echo " "
17288 if test "X$d_time" = X -o X"$timetype" = X; then
17289     if set time val -f d_time; eval $csym; $val; then
17290                 echo 'time() found.' >&4
17291                 val="$define"
17292                 rp="What is the type returned by time() on this system?"
17293                 set time_t timetype long stdio.h sys/types.h
17294                 eval $typedef_ask
17295     else
17296                 echo 'time() not found, hope that will do.' >&4
17297                 val="$undef"
17298                 timetype='int';
17299     fi
17300     set d_time
17301     eval $setvar
17302 fi
17303
17304 : see if this is a sys/times.h system
17305 set sys/times.h i_systimes
17306 eval $inhdr
17307
17308 : see if times exists
17309 echo " "
17310 if set times val -f d_times; eval $csym; $val; then
17311         echo 'times() found.' >&4
17312         d_times="$define"
17313         inc=''
17314         case "$i_systimes" in
17315         "$define") inc='sys/times.h';;
17316         esac
17317         rp="What is the type returned by times() on this system?"
17318         set clock_t clocktype long stdio.h sys/types.h $inc
17319         eval $typedef_ask
17320 else
17321         echo 'times() NOT found, hope that will do.' >&4
17322         d_times="$undef"
17323         clocktype='int'
17324 fi
17325
17326 : see if tmpnam_r exists
17327 set tmpnam_r d_tmpnam_r
17328 eval $inlibc
17329 case "$d_tmpnam_r" in
17330 "$define")
17331         hdrs="$i_systypes sys/types.h define stdio.h "
17332         case "$d_tmpnam_r_proto:$usethreads" in
17333         ":define")      d_tmpnam_r_proto=define
17334                 set d_tmpnam_r_proto tmpnam_r $hdrs
17335                 eval $hasproto ;;
17336         *)      ;;
17337         esac
17338         case "$d_tmpnam_r_proto" in
17339         define)
17340         case "$tmpnam_r_proto" in
17341         ''|0) try='char* tmpnam_r(char*);'
17342         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17343         esac
17344         case "$tmpnam_r_proto" in
17345         ''|0)   d_tmpnam_r=undef
17346                 tmpnam_r_proto=0
17347                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17348         * )     case "$tmpnam_r_proto" in
17349                 REENTRANT_PROTO*) ;;
17350                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17351                 esac
17352                 echo "Prototype: $try" ;;
17353         esac
17354         ;;
17355         *)      case "$usethreads" in
17356                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17357                 esac
17358                 d_tmpnam_r=undef
17359                 tmpnam_r_proto=0
17360                 ;;
17361         esac
17362         ;;
17363 *)      tmpnam_r_proto=0
17364         ;;
17365 esac
17366
17367 : see if truncate exists
17368 set truncate d_truncate
17369 eval $inlibc
17370
17371 : see if ttyname_r exists
17372 set ttyname_r d_ttyname_r
17373 eval $inlibc
17374 case "$d_ttyname_r" in
17375 "$define")
17376         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17377         case "$d_ttyname_r_proto:$usethreads" in
17378         ":define")      d_ttyname_r_proto=define
17379                 set d_ttyname_r_proto ttyname_r $hdrs
17380                 eval $hasproto ;;
17381         *)      ;;
17382         esac
17383         case "$d_ttyname_r_proto" in
17384         define)
17385         case "$ttyname_r_proto" in
17386         ''|0) try='int ttyname_r(int, char*, size_t);'
17387         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17388         esac
17389         case "$ttyname_r_proto" in
17390         ''|0) try='int ttyname_r(int, char*, int);'
17391         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17392         esac
17393         case "$ttyname_r_proto" in
17394         ''|0) try='char* ttyname_r(int, char*, int);'
17395         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17396         esac
17397         case "$ttyname_r_proto" in
17398         ''|0)   d_ttyname_r=undef
17399                 ttyname_r_proto=0
17400                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17401         * )     case "$ttyname_r_proto" in
17402                 REENTRANT_PROTO*) ;;
17403                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17404                 esac
17405                 echo "Prototype: $try" ;;
17406         esac
17407         ;;
17408         *)      case "$usethreads" in
17409                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17410                 esac
17411                 d_ttyname_r=undef
17412                 ttyname_r_proto=0
17413                 ;;
17414         esac
17415         ;;
17416 *)      ttyname_r_proto=0
17417         ;;
17418 esac
17419
17420 : see if tzname[] exists
17421 echo " "
17422 if set tzname val -a d_tzname; eval $csym; $val; then
17423         val="$define"
17424         echo 'tzname[] found.' >&4
17425 else
17426         val="$undef"
17427         echo 'tzname[] NOT found.' >&4
17428 fi
17429 set d_tzname
17430 eval $setvar
17431
17432 case "$osname" in
17433 next|rhapsody|darwin) multiarch="$define" ;;
17434 esac
17435 case "$multiarch" in
17436 ''|[nN]*) multiarch="$undef" ;;
17437 esac
17438
17439 : check for ordering of bytes in a UV
17440 echo " "
17441 case "$usecrosscompile$multiarch" in
17442 *$define*)
17443         $cat <<EOM
17444 You seem to be either cross-compiling or doing a multiarchitecture build,
17445 skipping the byteorder check.
17446
17447 EOM
17448         byteorder='ffff'
17449         ;;
17450 *)
17451         case "$byteorder" in
17452         '')
17453                 $cat <<'EOM'
17454 In the following, larger digits indicate more significance.  A big-endian
17455 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17456 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17457 machines may have weird orders like 3412.  A Cray will report 87654321,
17458 an Alpha will report 12345678. If the test program works the default is
17459 probably right.
17460 I'm now running the test program...
17461 EOM
17462                 $cat >try.c <<EOCP
17463 #include <stdio.h>
17464 #$i_stdlib I_STDLIB
17465 #ifdef I_STDLIB
17466 #include <stdlib.h>
17467 #endif
17468 #include <sys/types.h>
17469 typedef $uvtype UV;
17470 int main()
17471 {
17472         int i;
17473         union {
17474                 UV l;
17475                 char c[$uvsize];
17476         } u;
17477
17478         if ($uvsize > 4)
17479                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17480         else
17481                 u.l = (UV)0x04030201;
17482         for (i = 0; i < $uvsize; i++)
17483                 printf("%c", u.c[i]+'0');
17484         printf("\n");
17485         exit(0);
17486 }
17487 EOCP
17488                 xxx_prompt=y
17489                 set try
17490                 if eval $compile && ./try > /dev/null; then
17491                         dflt=`$run ./try`
17492                         case "$dflt" in
17493                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17494                                 echo "(The test program ran ok.)"
17495                                 echo "byteorder=$dflt"
17496                                 xxx_prompt=n
17497                         ;;
17498                         ????|????????) echo "(The test program ran ok.)" ;;
17499                         *) echo "(The test program didn't run right for some reason.)" ;;
17500                         esac
17501                 else
17502                         dflt='4321'
17503                         cat <<'EOM'
17504 (I can't seem to compile the test program.  Guessing big-endian...)
17505 EOM
17506                 fi
17507                 case "$xxx_prompt" in
17508                 y)
17509                         rp="What is the order of bytes in $uvtype?"
17510                         . ./myread
17511                         byteorder="$ans"
17512                         ;;
17513                 *)      byteorder=$dflt
17514                         ;;
17515                 esac
17516                 ;;
17517         esac
17518         $rm -f try.c try
17519         ;;
17520 esac
17521
17522
17523 $cat <<EOM
17524
17525 Checking to see whether you can access character data unalignedly...
17526 EOM
17527 case "$d_u32align" in
17528 '')   $cat >try.c <<EOCP
17529 #include <stdio.h>
17530 #$i_stdlib I_STDLIB
17531 #ifdef I_STDLIB
17532 #include <stdlib.h>
17533 #endif
17534 #define U32 $u32type
17535 #define BYTEORDER 0x$byteorder
17536 #define U8 $u8type
17537 #include <signal.h>
17538 #ifdef SIGBUS
17539 $signal_t bletch(s) int s; { exit(4); }
17540 #endif
17541 int main() {
17542 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
17543     U8 buf[8];
17544     U32 *up;
17545     int i;
17546
17547     if (sizeof(U32) != 4) {
17548         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
17549         exit(1);
17550     }
17551
17552     fflush(stdout);
17553
17554 #ifdef SIGBUS
17555     signal(SIGBUS, bletch);
17556 #endif
17557
17558     buf[0] = 0;
17559     buf[1] = 0;
17560     buf[2] = 0;
17561     buf[3] = 1;
17562     buf[4] = 0;
17563     buf[5] = 0;
17564     buf[6] = 0;
17565     buf[7] = 1;
17566
17567     for (i = 0; i < 4; i++) {
17568         up = (U32*)(buf + i);
17569         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
17570                (*up == 1 << (8*(3-i)))  /* little-endian */
17571               )
17572            )
17573         {
17574             printf("read failed (%x)\n", *up);
17575             exit(2);
17576         }
17577     }
17578
17579     /* write test */
17580     for (i = 0; i < 4; i++) {
17581         up = (U32*)(buf + i);
17582         *up = 0xBeef;
17583         if (*up != 0xBeef) {
17584             printf("write failed (%x)\n", *up);
17585             exit(3);
17586         }
17587     }
17588
17589     exit(0);
17590 #else
17591     printf("1\n");
17592     exit(1);
17593 #endif
17594     return 0;
17595 }
17596 EOCP
17597 set try
17598 if eval $compile_ok; then
17599         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
17600         $run ./try 2>&1 >/dev/null
17601         case "$?" in
17602         0)      cat >&4 <<EOM
17603 You can access character data pretty unalignedly.
17604 EOM
17605                 d_u32align="$undef"
17606                 ;;
17607         *)      cat >&4 <<EOM
17608 It seems that you must access character data in an aligned manner.
17609 EOM
17610                 d_u32align="$define"
17611                 ;;
17612         esac
17613 else
17614         rp='Can you access character data at unaligned addresses?'
17615         dflt='n'
17616         . ./myread
17617         case "$ans" in
17618         [yY]*)  d_u32align="$undef"  ;;
17619         *)      d_u32align="$define" ;;
17620         esac
17621 fi
17622 $rm -f core core.try.* try.core
17623 ;;
17624 esac
17625
17626 : see if ualarm exists
17627 set ualarm d_ualarm
17628 eval $inlibc
17629
17630 : see if umask exists
17631 set umask d_umask
17632 eval $inlibc
17633
17634 : see if unordered exists
17635 set unordered d_unordered
17636 eval $inlibc
17637
17638 : see if unsetenv exists
17639 set unsetenv d_unsetenv
17640 eval $inlibc
17641
17642 : see if usleep exists
17643 set usleep d_usleep
17644 eval $inlibc
17645
17646 : see if prototype for usleep is available
17647 echo " "
17648 set d_usleepproto usleep $i_unistd unistd.h
17649 eval $hasproto
17650
17651 : see if ustat exists
17652 set ustat d_ustat
17653 eval $inlibc
17654
17655 : backward compatibility for d_hvfork
17656 if test X$d_hvfork != X; then
17657         d_vfork="$d_hvfork"
17658         d_hvfork=''
17659 fi
17660 : see if there is a vfork
17661 val=''
17662 set vfork val
17663 eval $inlibc
17664
17665 : Ok, but do we want to use it. vfork is reportedly unreliable in 
17666 : perl on Solaris 2.x, and probably elsewhere.
17667 case "$val" in
17668 $define)
17669         echo " "
17670         case "$usevfork" in
17671         false) dflt='n';;
17672         *) dflt='y';;
17673         esac
17674         cat <<'EOM'
17675  
17676 Perl can only use a vfork() that doesn't suffer from strict
17677 restrictions on calling functions or modifying global data in
17678 the child.  For example, glibc-2.1 contains such a vfork()
17679 that is unsuitable.  If your system provides a proper fork()
17680 call, chances are that you do NOT want perl to use vfork().
17681
17682 EOM
17683         rp="Do you still want to use vfork()?"
17684         . ./myread
17685         case "$ans" in
17686         y|Y) ;;
17687         *)
17688                 echo "Ok, we won't use vfork()."
17689                 val="$undef"
17690                 ;;
17691         esac
17692         ;;
17693 esac
17694 set d_vfork
17695 eval $setvar
17696 case "$d_vfork" in
17697 $define) usevfork='true';;
17698 *) usevfork='false';;
17699 esac
17700
17701 : see if closedir exists
17702 set closedir d_closedir
17703 eval $inlibc
17704
17705 case "$d_closedir" in
17706 "$define")
17707         echo " "
17708         echo "Checking whether closedir() returns a status..." >&4
17709         cat > try.c <<EOM
17710 #$i_dirent I_DIRENT             /**/
17711 #$i_sysdir I_SYS_DIR            /**/
17712 #$i_sysndir I_SYS_NDIR          /**/
17713 #$i_systypes I_SYS_TYPES        /**/
17714
17715 #if defined(I_SYS_TYPES)
17716 #include <sys/types.h>
17717 #endif
17718 #if defined(I_DIRENT)
17719 #include <dirent.h>
17720 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
17721 #include <sys/dir.h>
17722 #endif
17723 #else
17724 #ifdef I_SYS_NDIR
17725 #include <sys/ndir.h>
17726 #else
17727 #ifdef I_SYS_DIR
17728 #ifdef hp9000s500
17729 #include <ndir.h>       /* may be wrong in the future */
17730 #else
17731 #include <sys/dir.h>
17732 #endif
17733 #endif
17734 #endif
17735 #endif 
17736 int main() { return closedir(opendir(".")); }
17737 EOM
17738         set try
17739         if eval $compile_ok; then
17740                 if $run ./try > /dev/null 2>&1 ; then
17741                         echo "Yes, it does."
17742                         val="$undef"
17743                 else
17744                         echo "No, it doesn't."
17745                         val="$define"
17746                 fi
17747         else
17748                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17749                 val="$define"
17750         fi
17751         ;;
17752 *)
17753         val="$undef";
17754         ;;
17755 esac
17756 set d_void_closedir
17757 eval $setvar
17758 $rm -f try try.*
17759 : see if there is a wait4
17760 set wait4 d_wait4
17761 eval $inlibc
17762
17763 : see if waitpid exists
17764 set waitpid d_waitpid
17765 eval $inlibc
17766
17767 : see if wcstombs exists
17768 set wcstombs d_wcstombs
17769 eval $inlibc
17770
17771 : see if wctomb exists
17772 set wctomb d_wctomb
17773 eval $inlibc
17774
17775 : see if writev exists
17776 set writev d_writev
17777 eval $inlibc
17778
17779 : preserve RCS keywords in files with variable substitution, grrr
17780 Date='$Date'
17781 Id='$Id'
17782 Log='$Log'
17783 RCSfile='$RCSfile'
17784 Revision='$Revision'
17785
17786 : check for alignment requirements
17787 echo " "
17788 case "$usecrosscompile$multiarch" in
17789 *$define*)
17790         $cat <<EOM
17791 You seem to be either cross-compiling or doing a multiarchitecture build,
17792 skipping the memory alignment check.
17793
17794 EOM
17795         case "$alignbytes" in
17796         '') alignbytes=8 ;;
17797         esac
17798         ;;
17799 *)
17800         case "$alignbytes" in
17801         '') echo "Checking alignment constraints..." >&4
17802                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
17803                         $cat >try.c <<'EOCP'
17804 typedef long double NV;
17805 EOCP
17806                 else
17807                         $cat >try.c <<'EOCP'
17808 typedef double NV;
17809 EOCP
17810                 fi
17811                 $cat >>try.c <<'EOCP'
17812 #include <stdio.h>
17813 struct foobar {
17814         char foo;
17815         NV bar;
17816 } try_algn;
17817 int main()
17818 {
17819     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
17820     return(0);
17821 }
17822 EOCP
17823                 set try
17824                 if eval $compile_ok; then
17825                         dflt=`$run ./try`
17826                 else
17827                         dflt='8'
17828                         echo "(I can't seem to compile the test program...)"
17829                 fi
17830                 ;;
17831         *) dflt="$alignbytes"
17832                 ;;
17833         esac
17834         rp="Doubles must be aligned on a how-many-byte boundary?"
17835         . ./myread
17836         alignbytes="$ans"
17837         $rm -f try.c try
17838         ;;
17839 esac
17840
17841
17842 : set the base revision
17843 baserev=5.0
17844
17845 : how do we concatenate cpp tokens here?
17846 echo " "
17847 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
17848 $cat >cpp_stuff.c <<'EOCP'
17849 #define RCAT(a,b)a/**/b
17850 #define ACAT(a,b)a ## b
17851 RCAT(Rei,ser)
17852 ACAT(Cir,cus)
17853 EOCP
17854 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
17855 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
17856         echo "Oh!  Smells like ANSI's been here." >&4
17857         echo "We can catify or stringify, separately or together!"
17858         cpp_stuff=42
17859 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
17860         echo "Ah, yes!  The good old days!" >&4
17861         echo "However, in the good old days we don't know how to stringify and"
17862         echo "catify at the same time."
17863         cpp_stuff=1
17864 else
17865         $cat >&4 <<EOM
17866 Hmm, I don't seem to be able to concatenate tokens with your cpp.
17867 You're going to have to edit the values of CAT[2-5] in config.h...
17868 EOM
17869         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
17870 fi
17871 $rm -f cpp_stuff.*
17872
17873 : see if this is a db.h system
17874 set db.h i_db
17875 eval $inhdr
17876
17877 case "$i_db" in
17878 $define)
17879         : Check db version.
17880         echo " "
17881         echo "Checking Berkeley DB version ..." >&4
17882         $cat >try.c <<EOCP
17883 #$d_const HASCONST
17884 #ifndef HASCONST
17885 #define const
17886 #endif
17887 #include <sys/types.h>
17888 #include <stdio.h>
17889 #$i_stdlib I_STDLIB
17890 #ifdef I_STDLIB
17891 #include <stdlib.h>
17892 #endif
17893 #include <db.h>
17894 int main(int argc, char *argv[])
17895 {
17896 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
17897     int Major, Minor, Patch ;
17898     unsigned long Version ;
17899     (void)db_version(&Major, &Minor, &Patch) ;
17900     if (argc == 2) {
17901         printf("%d %d %d %d %d %d\n",
17902                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
17903                Major, Minor, Patch);
17904         exit(0);
17905     }
17906     printf("You have Berkeley DB Version 2 or greater.\n");
17907
17908     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
17909                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
17910     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
17911                 Major, Minor, Patch) ;
17912
17913     /* check that db.h & libdb are compatible */
17914     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
17915         printf("db.h and libdb are incompatible.\n") ;
17916         exit(3);        
17917     }
17918
17919     printf("db.h and libdb are compatible.\n") ;
17920
17921     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
17922                 + DB_VERSION_PATCH ;
17923
17924     /* needs to be >= 2.3.4 */
17925     if (Version < 2003004) {
17926     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
17927         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
17928         exit(2);        
17929     }
17930
17931     exit(0);
17932 #else
17933 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
17934     if (argc == 2) {
17935         printf("1 0 0\n");
17936         exit(0);
17937     }
17938     printf("You have Berkeley DB Version 1.\n");
17939     exit(0);    /* DB version < 2: the coast is clear. */
17940 #else
17941     exit(1);    /* <db.h> not Berkeley DB? */
17942 #endif
17943 #endif
17944 }
17945 EOCP
17946         set try
17947         if eval $compile_ok && $run ./try; then
17948                 echo 'Looks OK.' >&4
17949                 set `$run ./try 1`
17950                 db_version_major=$1
17951                 db_version_minor=$2
17952                 db_version_patch=$3
17953         else
17954                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
17955                 i_db=$undef
17956                 case " $libs " in
17957                 *"-ldb "*)
17958                         : Remove db from list of libraries to use
17959                         echo "Removing unusable -ldb from library list" >&4
17960                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
17961                         shift
17962                         libs="$*"
17963                         echo "libs = $libs" >&4
17964                         ;;
17965                 esac
17966         fi
17967         $rm -f try.*
17968         ;;
17969 esac
17970
17971 case "$i_db" in
17972 define)
17973         : Check the return type needed for hash 
17974         echo " "
17975         echo "Checking return type needed for hash for Berkeley DB ..." >&4
17976         $cat >try.c <<EOCP
17977 #$d_const HASCONST
17978 #ifndef HASCONST
17979 #define const
17980 #endif
17981 #include <sys/types.h>
17982 #include <db.h>
17983
17984 #ifndef DB_VERSION_MAJOR
17985 u_int32_t hash_cb (ptr, size)
17986 const void *ptr;
17987 size_t size;
17988 {
17989 }
17990 HASHINFO info;
17991 int main()
17992 {
17993         info.hash = hash_cb;
17994 }
17995 #endif
17996 EOCP
17997         if $cc $ccflags -c try.c >try.out 2>&1 ; then
17998                 if $contains warning try.out >>/dev/null 2>&1 ; then
17999                         db_hashtype='int'
18000                 else
18001                         db_hashtype='u_int32_t'
18002                 fi
18003         else
18004                 : XXX Maybe we should just give up here.
18005                 db_hashtype=u_int32_t
18006                 $cat try.out >&4
18007                 echo "Help:  I can't seem to compile the db test program." >&4
18008                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18009         fi
18010         $rm -f try.*
18011         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18012         ;;
18013 *)      db_hashtype=u_int32_t
18014         ;;
18015 esac
18016 case "$i_db" in
18017 define)
18018         : Check the return type needed for prefix 
18019         echo " "
18020         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18021         cat >try.c <<EOCP
18022 #$d_const HASCONST
18023 #ifndef HASCONST
18024 #define const
18025 #endif
18026 #include <sys/types.h>
18027 #include <db.h>
18028
18029 #ifndef DB_VERSION_MAJOR
18030 size_t prefix_cb (key1, key2)
18031 const DBT *key1;
18032 const DBT *key2;
18033 {
18034 }
18035 BTREEINFO info;
18036 int main()
18037 {
18038         info.prefix = prefix_cb;
18039 }
18040 #endif
18041 EOCP
18042         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18043                 if $contains warning try.out >>/dev/null 2>&1 ; then
18044                         db_prefixtype='int'
18045                 else
18046                         db_prefixtype='size_t'
18047                 fi
18048         else
18049                 db_prefixtype='size_t'
18050                 : XXX Maybe we should just give up here.
18051                 $cat try.out >&4
18052                 echo "Help:  I can't seem to compile the db test program." >&4
18053                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18054         fi
18055         $rm -f try.*
18056         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18057         ;;
18058 *)      db_prefixtype='size_t'
18059         ;;
18060 esac
18061
18062
18063 : How can we generate normalized random numbers ?
18064 echo " "
18065 echo "Looking for a random number function..." >&4
18066 case "$randfunc" in
18067 '')
18068         if set drand48 val -f; eval $csym; $val; then
18069                 dflt="drand48"
18070                 echo "Good, found drand48()." >&4
18071         elif set random val -f; eval $csym; $val; then
18072                 dflt="random"
18073                 echo "OK, found random()." >&4
18074         else
18075                 dflt="rand"
18076                 echo "Yick, looks like I have to use rand()." >&4
18077         fi
18078         echo " "
18079         ;;
18080 *)
18081         dflt="$randfunc"
18082         ;;
18083 esac
18084 cont=true
18085
18086 case "$ccflags" in
18087 *-Dmy_rand=*|*-Dmy_srand=*)
18088         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18089         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18090         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18091         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18092         ;;
18093 esac
18094
18095 while $test "$cont"; do
18096         rp="Use which function to generate random numbers?"
18097         . ./myread
18098         if $test "$ans" = "$dflt"; then
18099                 : null
18100         else
18101                 randbits=''
18102         fi
18103         randfunc="$ans"
18104         if set $ans val -f; eval $csym; $val; then
18105                 cont=''
18106         else
18107                 dflt=y
18108                 rp="I cannot find function $ans. Use that name anyway?"
18109                 . ./myread
18110                 dflt=rand
18111                 case "$ans" in
18112                         [yY]*) cont='';;
18113                 esac
18114         fi
18115         case "$cont" in
18116         '')
18117                 case "$randfunc" in
18118                 drand48)
18119                         drand01="drand48()"
18120                         seedfunc="srand48"
18121                         randbits=48
18122                         randseedtype=long
18123                         ;;
18124                 rand|random)
18125                         case "$randbits" in
18126                         '')
18127 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18128                                 $cat >try.c <<EOCP
18129 #$i_unistd I_UNISTD
18130 #$i_stdlib I_STDLIB
18131 #include <stdio.h>
18132 #ifdef I_UNISTD
18133 #  include <unistd.h>
18134 #endif
18135 #ifdef I_STDLIB
18136 #  include <stdlib.h>
18137 #endif
18138 int main()
18139 {
18140         register int i;
18141         register unsigned long tmp;
18142         register unsigned long max = 0L;
18143
18144         for (i = 1000; i; i--) {
18145                 tmp = (unsigned long) $randfunc();
18146                 if (tmp > max) max = tmp;
18147         }
18148         for (i = 0; max; i++)
18149                 max /= 2;
18150         printf("%d\n",i);
18151 }
18152 EOCP
18153                                 set try
18154                                 if eval $compile_ok; then
18155                                         dflt=`try`
18156                                 else
18157                                         dflt='?'
18158                                         echo "(I can't seem to compile the test program...)"
18159                                 fi
18160                                 ;;
18161                         *)
18162                                 dflt="$randbits"
18163                                 ;;
18164                         esac
18165                         rp="How many bits does your $randfunc() function produce?"
18166                         . ./myread
18167                         randbits="$ans"
18168                         $rm -f try.c try
18169                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18170                         seedfunc="s$randfunc"
18171                         randseedtype=unsigned
18172                         ;;
18173                 *)
18174                         dflt="31"
18175                         rp="How many bits does your $randfunc() function produce?"
18176                         . ./myread
18177                         randbits="$ans"
18178                         seedfunc="s$randfunc"
18179                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18180                         if set $seedfunc val -f; eval $csym; $val; then
18181                                 echo "(Using $seedfunc() to seed random generator)"
18182                         else
18183                                 echo "(Warning: no $seedfunc() to seed random generator)"
18184                                 seedfunc=rand
18185                         fi
18186                         randseedtype=unsigned
18187                         ;;
18188                 esac
18189                 ;;
18190         esac
18191 done
18192
18193 echo " "
18194 echo "Determining whether or not we are on an EBCDIC system..." >&4
18195 $cat >try.c <<'EOM'
18196 int main()
18197 {
18198   if ('M'==0xd4) return 0;
18199   return 1;
18200 }
18201 EOM
18202
18203 val=$undef
18204 set try
18205 if eval $compile_ok; then
18206         if $run ./try; then
18207                 echo "You seem to speak EBCDIC." >&4
18208                 val="$define"
18209         else
18210                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18211         fi
18212 else
18213         echo "I'm unable to compile the test program." >&4
18214         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18215 fi
18216 $rm -f try try.*
18217 set ebcdic
18218 eval $setvar
18219
18220 echo " "
18221 $cat >&4 <<EOM
18222 Checking how to flush all pending stdio output...
18223 EOM
18224 # I only know how to find the first 32 possibly open files on SunOS.
18225 # See also hints/sunos_4_1.sh and util.c  --AD
18226 case "$osname" in
18227 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18228 esac
18229 $cat >>try.c <<EOCP
18230 #include <stdio.h>
18231 #$i_stdlib I_STDLIB
18232 #ifdef I_STDLIB
18233 #include <stdlib.h>
18234 #endif
18235 #$i_unistd I_UNISTD
18236 #ifdef I_UNISTD
18237 # include <unistd.h>
18238 #endif
18239 #$d_sysconf HAS_SYSCONF
18240 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18241 #ifdef HAS_STDIO_STREAM_ARRAY
18242 # define STDIO_STREAM_ARRAY $stdio_stream_array
18243 #endif
18244 int main() {
18245   FILE* p;
18246   unlink("try.out");
18247   p = fopen("try.out", "w");
18248 #ifdef TRY_FPUTC
18249   fputc('x', p);
18250 #else
18251 # ifdef TRY_FPRINTF
18252   fprintf(p, "x");
18253 # endif
18254 #endif
18255 #ifdef TRY_FFLUSH_NULL
18256   fflush(NULL);
18257 #endif
18258 #ifdef TRY_FFLUSH_ALL
18259   {
18260     long open_max = -1;
18261 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18262     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18263 # else
18264 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18265     open_max = sysconf(_SC_OPEN_MAX);
18266 #  else
18267 #   ifdef FOPEN_MAX
18268     open_max = FOPEN_MAX;
18269 #   else
18270 #    ifdef OPEN_MAX
18271     open_max = OPEN_MAX;
18272 #    else
18273 #     ifdef _NFILE
18274     open_max = _NFILE;
18275 #     endif
18276 #    endif
18277 #   endif
18278 #  endif
18279 # endif 
18280 # ifdef HAS_STDIO_STREAM_ARRAY
18281     if (open_max > 0) {
18282       long i;
18283       for (i = 0; i < open_max; i++)
18284             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18285                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18286                 STDIO_STREAM_ARRAY[i]._flag)
18287                 fflush(&STDIO_STREAM_ARRAY[i]);
18288     }   
18289   }
18290 # endif
18291 #endif
18292   _exit(42);
18293 }
18294 EOCP
18295 : first we have to find out how _not_ to flush
18296 $to try.c
18297 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18298     output=''
18299     set try -DTRY_FPUTC
18300     if eval $compile; then
18301             $run ./try 2>/dev/null
18302             code="$?"
18303             $from try.out
18304             if $test ! -s try.out -a "X$code" = X42; then
18305                 output=-DTRY_FPUTC
18306             fi
18307     fi
18308     case "$output" in
18309     '')
18310             set try -DTRY_FPRINTF
18311             if eval $compile; then
18312                     $run ./try 2>/dev/null
18313                     code="$?"
18314                     $from try.out
18315                     if $test ! -s try.out -a "X$code" = X42; then
18316                         output=-DTRY_FPRINTF
18317                     fi
18318             fi
18319         ;;
18320     esac
18321 fi
18322 : check for fflush NULL behaviour
18323 case "$fflushNULL" in
18324 '')     set try -DTRY_FFLUSH_NULL $output
18325         if eval $compile; then
18326                 $run ./try 2>/dev/null
18327                 code="$?"
18328                 $from try.out
18329                 if $test -s try.out -a "X$code" = X42; then
18330                         fflushNULL="`$cat try.out`"
18331                 else
18332                         if $test "X$code" != X42; then
18333                                 $cat >&4 <<EOM
18334 (If this test failed, don't worry, we'll try another method shortly.)
18335 EOM
18336                         fi
18337                 fi
18338         fi
18339         $rm -f core try.core core.try.*
18340         case "$fflushNULL" in
18341         x)      $cat >&4 <<EOM
18342 Your fflush(NULL) works okay for output streams.
18343 Let's see if it clobbers input pipes...
18344 EOM
18345 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18346 # bug that improperly flushes the input end of pipes.  So we avoid the
18347 # autoflush on fork/system/exec support for now. :-(
18348 $cat >tryp.c <<EOCP
18349 #include <stdio.h>
18350 int
18351 main(int argc, char **argv)
18352 {
18353     char buf[1024];
18354     int i;
18355     char *bp = buf;
18356     while (1) {
18357         while ((i = getc(stdin)) != -1
18358                && (*bp++ = i) != '\n'
18359                && bp < &buf[1024])
18360         /* DO NOTHING */ ;
18361         *bp = '\0';
18362         fprintf(stdout, "%s", buf);
18363         fflush(NULL);
18364         if (i == -1)
18365             return 0;
18366         bp = buf;
18367     }
18368 }
18369 EOCP
18370                 fflushNULL="$define"
18371                 set tryp
18372                 if eval $compile; then
18373                     $rm -f tryp.out
18374                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18375                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18376                        $cat >&4 <<EOM
18377 fflush(NULL) seems to behave okay with input streams.
18378 EOM
18379                         fflushNULL="$define"
18380                     else
18381                         $cat >&4 <<EOM
18382 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18383 EOM
18384                         fflushNULL="$undef"
18385                     fi
18386                 fi
18387                 $rm -f core tryp.c tryp.core core.tryp.*
18388                 ;;
18389         '')     $cat >&4 <<EOM
18390 Your fflush(NULL) isn't working (contrary to ANSI C).
18391 EOM
18392                 fflushNULL="$undef"
18393                 ;;
18394         *)      $cat >&4 <<EOM
18395 Cannot figure out whether your fflush(NULL) works or not.
18396 I'm assuming it doesn't (contrary to ANSI C).
18397 EOM
18398                 fflushNULL="$undef"
18399                 ;;
18400         esac
18401         ;;
18402 $define|true|[yY]*)
18403         fflushNULL="$define"
18404         ;;
18405 *)
18406         fflushNULL="$undef"
18407         ;;
18408 esac
18409 : check explicit looping only if NULL did not work, and if the pipe
18410 : bug does not show up on an explicit flush too
18411 case "$fflushNULL" in
18412 "$undef")
18413         $cat >tryp.c <<EOCP
18414 #include <stdio.h>
18415 int
18416 main(int argc, char **argv)
18417 {
18418     char buf[1024];
18419     int i;
18420     char *bp = buf;
18421     while (1) {
18422         while ((i = getc(stdin)) != -1
18423                && (*bp++ = i) != '\n'
18424                && bp < &buf[1024])
18425         /* DO NOTHING */ ;
18426         *bp = '\0';
18427         fprintf(stdout, "%s", buf);
18428         fflush(stdin);
18429         if (i == -1)
18430             return 0;
18431         bp = buf;
18432     }
18433 }
18434 EOCP
18435         set tryp
18436         if eval $compile; then
18437             $rm -f tryp.out
18438             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18439             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18440                $cat >&4 <<EOM
18441 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18442 EOM
18443                 : now check for fflushall behaviour
18444                 case "$fflushall" in
18445                 '')     set try -DTRY_FFLUSH_ALL $output
18446                         if eval $compile; then
18447                                 $cat >&4 <<EOM
18448 (Now testing the other method--but note that this also may fail.)
18449 EOM
18450                                 $run ./try 2>/dev/null
18451                                 code=$?
18452                                 $from try.out
18453                                 if $test -s try.out -a "X$code" = X42; then
18454                                         fflushall="`$cat try.out`"
18455                                 fi
18456                         fi
18457                         $rm -f core try.core core.try.*
18458                         case "$fflushall" in
18459                         x)      $cat >&4 <<EOM
18460 Whew. Flushing explicitly all the stdio streams works.
18461 EOM
18462                                 fflushall="$define"
18463                                 ;;
18464                         '')     $cat >&4 <<EOM
18465 Sigh. Flushing explicitly all the stdio streams doesn't work.
18466 EOM
18467                                 fflushall="$undef"
18468                                 ;;
18469                         *)      $cat >&4 <<EOM
18470 Cannot figure out whether flushing stdio streams explicitly works or not.
18471 I'm assuming it doesn't.
18472 EOM
18473                                 fflushall="$undef"
18474                                 ;;
18475                         esac
18476                         ;;
18477                 "$define"|true|[yY]*)
18478                         fflushall="$define"
18479                         ;;
18480                 *)
18481                         fflushall="$undef"
18482                         ;;
18483                 esac
18484             else
18485                 $cat >&4 <<EOM
18486 All is futile.  Even fflush(stdin) clobbers input pipes!
18487 EOM
18488                 fflushall="$undef"
18489             fi
18490         else
18491             fflushall="$undef"
18492         fi
18493         $rm -f core tryp.c tryp.core core.tryp.*
18494         ;;
18495 *)      fflushall="$undef"
18496         ;;
18497 esac
18498
18499 case "$fflushNULL$fflushall" in
18500 undefundef)
18501         $cat <<EOM
18502 OK, I give up.  I cannot figure out how to flush pending stdio output.
18503 We won't be flushing handles at all before fork/exec/popen.
18504 EOM
18505         ;;
18506 esac
18507 $rm -f try.* try$exe_ext
18508
18509 : Store the full pathname to the ar program for use in the C program
18510 : Respect a hint or command line value for full_ar.
18511 case "$full_ar" in
18512 '') full_ar=$ar ;;
18513 esac
18514
18515 : Store the full pathname to the sed program for use in the C program
18516 full_sed=$sed
18517
18518 : see what type gids are declared as in the kernel
18519 echo " "
18520 echo "Looking for the type for group ids returned by getgid()."
18521 set gid_t gidtype xxx stdio.h sys/types.h
18522 eval $typedef
18523 case "$gidtype" in
18524 xxx)
18525         xxx=`./findhdr sys/user.h`
18526         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18527         case $1 in
18528         unsigned) dflt="$1 $2" ;;
18529         *) dflt="$1" ;;
18530         esac
18531         ;;
18532 *) dflt="$gidtype";;
18533 esac
18534 case "$gidtype" in
18535 gid_t) echo "gid_t found." ;;
18536 *)      rp="What is the type for group ids returned by getgid()?"
18537         . ./myread
18538         gidtype="$ans"
18539         ;;
18540 esac
18541
18542 echo " "
18543 case "$gidtype" in
18544 *_t) zzz="$gidtype"     ;;
18545 *)   zzz="gid"          ;;
18546 esac
18547 echo "Checking the size of $zzz..." >&4 
18548 cat > try.c <<EOCP
18549 #include <sys/types.h>
18550 #include <stdio.h>
18551 #$i_stdlib I_STDLIB
18552 #ifdef I_STDLIB
18553 #include <stdlib.h>
18554 #endif
18555 int main() {
18556     printf("%d\n", (int)sizeof($gidtype));
18557     exit(0);
18558 }
18559 EOCP
18560 set try
18561 if eval $compile_ok; then
18562         yyy=`$run ./try`
18563         case "$yyy" in
18564         '')     gidsize=4
18565                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18566                 ;;
18567         *)      gidsize=$yyy
18568                 echo "Your $zzz is $gidsize bytes long."
18569                 ;;
18570         esac
18571 else
18572         gidsize=4
18573         echo "(I can't compile the test program--guessing $gidsize.)" >&4
18574 fi
18575
18576
18577 echo " "
18578 case "$gidtype" in
18579 *_t) zzz="$gidtype"     ;;
18580 *)   zzz="gid"          ;;
18581 esac
18582 echo "Checking the sign of $zzz..." >&4 
18583 cat > try.c <<EOCP
18584 #include <sys/types.h>
18585 #include <stdio.h>
18586 int main() {
18587         $gidtype foo = -1;
18588         if (foo < 0)
18589                 printf("-1\n");
18590         else
18591                 printf("1\n");
18592 }
18593 EOCP
18594 set try
18595 if eval $compile; then
18596         yyy=`$run ./try`
18597         case "$yyy" in
18598         '')     gidsign=1
18599                 echo "(I can't execute the test program--guessing unsigned.)" >&4
18600                 ;;
18601         *)      gidsign=$yyy
18602                 case "$gidsign" in
18603                  1) echo "Your $zzz is unsigned." ;;
18604                 -1) echo "Your $zzz is signed."   ;;
18605                 esac
18606                 ;;
18607         esac
18608 else
18609         gidsign=1
18610         echo "(I can't compile the test program--guessing unsigned.)" >&4
18611 fi
18612
18613
18614 echo " "
18615
18616 if $test X"$quadtype" != X; then
18617
18618 echo "Checking how to print 64-bit integers..." >&4
18619
18620 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
18621         $cat >try.c <<'EOCP'
18622 #include <sys/types.h>
18623 #include <stdio.h>
18624 int main() {
18625   int q = 12345678901;
18626   printf("%ld\n", q);
18627 }
18628 EOCP
18629         set try
18630         if eval $compile; then
18631                 yyy=`$run ./try`
18632                 case "$yyy" in
18633                 12345678901)
18634                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
18635                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
18636                         echo "We will use %d."
18637                         ;;
18638                 esac
18639         fi
18640 fi
18641
18642 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
18643         $cat >try.c <<'EOCP'
18644 #include <sys/types.h>
18645 #include <stdio.h>
18646 int main() {
18647   long q = 12345678901;
18648   printf("%ld\n", q);
18649 }
18650 EOCP
18651         set try
18652         if eval $compile; then
18653                 yyy=`$run ./try`
18654                 case "$yyy" in
18655                 12345678901)
18656                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
18657                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
18658                         echo "We will use %ld."
18659                         ;;
18660                 esac
18661         fi
18662 fi
18663
18664 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
18665         $cat >try.c <<'EOCP'
18666 #include <sys/types.h>
18667 #include <inttypes.h>
18668 #include <stdio.h>
18669 int main() {
18670   int64_t q = 12345678901;
18671   printf("%" PRId64 "\n", q);
18672 }
18673 EOCP
18674         set try
18675         if eval $compile; then
18676                 yyy=`$run ./try`
18677                 case "$yyy" in
18678                 12345678901)
18679                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
18680                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
18681                         echo "We will use the C9X style."
18682                         ;;
18683                 esac
18684         fi
18685 fi
18686
18687 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18688         $cat >try.c <<EOCP
18689 #include <sys/types.h>
18690 #include <stdio.h>
18691 int main() {
18692   $quadtype q = 12345678901;
18693   printf("%Ld\n", q);
18694 }
18695 EOCP
18696         set try
18697         if eval $compile; then
18698                 yyy=`$run ./try`
18699                 case "$yyy" in
18700                 12345678901)
18701                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
18702                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
18703                         echo "We will use %Ld."
18704                         ;;
18705                 esac
18706         fi
18707 fi
18708
18709 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
18710         $cat >try.c <<'EOCP'
18711 #include <sys/types.h>
18712 #include <stdio.h>
18713 int main() {
18714   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
18715   printf("%lld\n", q);
18716 }
18717 EOCP
18718         set try
18719         if eval $compile; then
18720                 yyy=`$run ./try`
18721                 case "$yyy" in
18722                 12345678901)
18723                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
18724                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
18725                         echo "We will use the %lld style."
18726                         ;;
18727                 esac
18728         fi
18729 fi
18730
18731 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
18732         $cat >try.c <<EOCP
18733 #include <sys/types.h>
18734 #include <stdio.h>
18735 int main() {
18736   $quadtype q = 12345678901;
18737   printf("%qd\n", q);
18738 }
18739 EOCP
18740         set try
18741         if eval $compile; then
18742                 yyy=`$run ./try`
18743                 case "$yyy" in
18744                 12345678901)
18745                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
18746                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
18747                         echo "We will use %qd."
18748                         ;;
18749                 esac
18750         fi
18751 fi
18752
18753 if $test X"$sPRId64" = X; then
18754         echo "Cannot figure out how to print 64-bit integers." >&4
18755 fi
18756
18757 $rm -f try try.*
18758
18759 fi
18760
18761 case "$sPRId64" in
18762 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
18763         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
18764         ;;
18765 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
18766         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
18767         ;;
18768 esac
18769
18770
18771 echo " "
18772 $echo "Checking the format strings to be used for Perl's internal types..." >&4
18773
18774 if $test X"$ivsize" = X8; then
18775         ivdformat="$sPRId64"
18776         uvuformat="$sPRIu64"
18777         uvoformat="$sPRIo64"
18778         uvxformat="$sPRIx64"
18779         uvXUformat="$sPRIXU64"
18780 else
18781         if $test X"$ivsize" = X"$longsize"; then
18782                 ivdformat='"ld"'
18783                 uvuformat='"lu"'
18784                 uvoformat='"lo"'
18785                 uvxformat='"lx"'
18786                 uvXUformat='"lX"'
18787         else
18788                 if $test X"$ivsize" = X"$intsize"; then
18789                         ivdformat='"d"'
18790                         uvuformat='"u"'
18791                         uvoformat='"o"'
18792                         uvxformat='"x"'
18793                         uvXUformat='"X"'
18794                 else
18795                         : far out
18796                         if $test X"$ivsize" = X"$shortsize"; then
18797                                 ivdformat='"hd"'
18798                                 uvuformat='"hu"'
18799                                 uvoformat='"ho"'
18800                                 uvxformat='"hx"'
18801                                 uvXUformat='"hX"'
18802                         fi
18803                 fi
18804         fi
18805 fi
18806
18807 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
18808         nveformat="$sPRIeldbl"
18809         nvfformat="$sPRIfldbl"
18810         nvgformat="$sPRIgldbl"
18811         nvEUformat="$sPRIEUldbl"
18812         nvFUformat="$sPRIFUldbl"
18813         nvGUformat="$sPRIGUldbl"
18814 else
18815         nveformat='"e"'
18816         nvfformat='"f"'
18817         nvgformat='"g"'
18818         nvEUformat='"E"'
18819         nvFUformat='"F"'
18820         nvGUformat='"G"'
18821 fi
18822
18823 case "$ivdformat" in
18824 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
18825     exit 1
18826     ;;
18827 esac
18828
18829
18830 echo " "
18831 $echo "Checking the format string to be used for gids..." >&4
18832
18833 case "$gidsign" in
18834 -1)     if $test X"$gidsize" = X"$ivsize"; then
18835                 gidformat="$ivdformat"
18836         else
18837                 if $test X"$gidsize" = X"$longsize"; then
18838                         gidformat='"ld"'
18839                 else
18840                         if $test X"$gidsize" = X"$intsize"; then
18841                                 gidformat='"d"'
18842                         else
18843                                 if $test X"$gidsize" = X"$shortsize"; then
18844                                         gidformat='"hd"'
18845                                 fi
18846                         fi
18847                 fi
18848         fi
18849         ;;
18850 *)      if $test X"$gidsize" = X"$uvsize"; then
18851                 gidformat="$uvuformat"
18852         else
18853                 if $test X"$gidsize" = X"$longsize"; then
18854                         gidformat='"lu"'
18855                 else
18856                         if $test X"$gidsize" = X"$intsize"; then
18857                                 gidformat='"u"'
18858                         else
18859                                 if $test X"$gidsize" = X"$shortsize"; then
18860                                         gidformat='"hu"'
18861                                 fi
18862                         fi
18863                 fi
18864         fi
18865         ;;
18866 esac
18867
18868 : see if getgroups exists
18869 set getgroups d_getgrps
18870 eval $inlibc
18871
18872 : see if setgroups exists
18873 set setgroups d_setgrps
18874 eval $inlibc
18875
18876
18877 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
18878 echo " "
18879 case "$d_getgrps$d_setgrps" in
18880 *define*)
18881         case "$groupstype" in
18882         '') dflt="$gidtype" ;;
18883         *)  dflt="$groupstype" ;;
18884         esac
18885         $cat <<EOM
18886 What type of pointer is the second argument to getgroups() and setgroups()?
18887 Usually this is the same as group ids, $gidtype, but not always.
18888
18889 EOM
18890         rp='What type pointer is the second argument to getgroups() and setgroups()?'
18891         . ./myread
18892         groupstype="$ans"
18893         ;;
18894 *)  groupstype="$gidtype";;
18895 esac
18896
18897
18898 case "$mad" in
18899 $define|true|[yY]*)     dflt='y' ;;
18900 *)                      dflt='n' ;;
18901 esac
18902 cat <<EOM
18903
18904 Would you like to build with Misc Attribute Decoration? This is development
18905 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
18906 overhead on the interpreter.
18907
18908 If this doesn't make any sense to you, just accept the default '$dflt'.
18909 EOM
18910 rp='Build Perl with MAD?'
18911 . ./myread
18912 case "$ans" in
18913 y|Y)    val="$define"
18914         madlyh='madly.h madly.act madly.tab'
18915         madlysrc='madly.c'
18916         madlyobj="madly$_o" ;;
18917 *)      val="$undef"
18918         madlyh=''
18919         madlysrc=''
18920         madlyobj='' ;;
18921 esac
18922 set mad
18923 eval $setvar
18924
18925 echo " "
18926 echo "Checking if your $make program sets \$(MAKE)..." >&4
18927 case "$make_set_make" in
18928 '')
18929         $sed 's/^X //' > testmake.mak << 'EOF'
18930 Xall:
18931 X       @echo 'maketemp="$(MAKE)"'
18932 EOF
18933         case "`$make -f testmake.mak 2>/dev/null`" in
18934         *maketemp=*) make_set_make='#' ;;
18935         *)      make_set_make="MAKE=$make" ;;
18936         esac
18937         $rm -f testmake.mak
18938         ;;
18939 esac
18940 case "$make_set_make" in
18941 '#') echo "Yup, it does.";;
18942 *) echo "Nope, it doesn't.";;
18943 esac
18944
18945 : see what type is used for mode_t
18946 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
18947 set mode_t modetype int stdio.h sys/types.h
18948 eval $typedef_ask
18949
18950 : see if stdarg is available
18951 echo " "
18952 if $test `./findhdr stdarg.h`; then
18953         echo "<stdarg.h> found." >&4
18954         valstd="$define"
18955 else
18956         echo "<stdarg.h> NOT found." >&4
18957         valstd="$undef"
18958 fi
18959
18960 : see if varags is available
18961 echo " "
18962 if $test `./findhdr varargs.h`; then
18963         echo "<varargs.h> found." >&4
18964 else
18965         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
18966 fi
18967
18968 : set up the varargs testing programs
18969 $cat > varargs.c <<EOP
18970 #ifdef I_STDARG
18971 #include <stdarg.h>
18972 #endif
18973 #ifdef I_VARARGS
18974 #include <varargs.h>
18975 #endif
18976
18977 #ifdef I_STDARG
18978 int f(char *p, ...)
18979 #else
18980 int f(va_alist)
18981 va_dcl
18982 #endif
18983 {
18984         va_list ap;
18985 #ifndef I_STDARG
18986         char *p;
18987 #endif
18988 #ifdef I_STDARG
18989         va_start(ap,p);
18990 #else
18991         va_start(ap);
18992         p = va_arg(ap, char *);
18993 #endif
18994         va_end(ap);
18995 }
18996 EOP
18997 $cat > varargs <<EOP
18998 $startsh
18999 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
19000         echo "true"
19001 else
19002         echo "false"
19003 fi
19004 $rm -f varargs$_o
19005 EOP
19006 chmod +x varargs
19007
19008 : now check which varargs header should be included
19009 echo " "
19010 i_varhdr=''
19011 case "$valstd" in
19012 "$define")
19013         if `./varargs I_STDARG`; then
19014                 val='stdarg.h'
19015         elif `./varargs I_VARARGS`; then
19016                 val='varargs.h'
19017         fi
19018         ;;
19019 *)
19020         if `./varargs I_VARARGS`; then
19021                 val='varargs.h'
19022         fi
19023         ;;
19024 esac
19025 case "$val" in
19026 '')
19027 echo "I could not find the definition for va_dcl... You have problems..." >&4
19028         val="$undef"; set i_stdarg; eval $setvar
19029         val="$undef"; set i_varargs; eval $setvar
19030         ;;
19031 *) 
19032         set i_varhdr
19033         eval $setvar
19034         case "$i_varhdr" in
19035         stdarg.h)
19036                 val="$define"; set i_stdarg; eval $setvar
19037                 val="$undef"; set i_varargs; eval $setvar
19038                 ;;
19039         varargs.h)
19040                 val="$undef"; set i_stdarg; eval $setvar
19041                 val="$define"; set i_varargs; eval $setvar
19042                 ;;
19043         esac
19044         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
19045 esac
19046 $rm -f varargs*
19047
19048 : see if we need va_copy
19049 echo " "
19050 case "$i_stdarg" in
19051 "$define")
19052         $cat >try.c <<EOCP
19053 #include <stdarg.h>
19054 #include <stdio.h>
19055 #$i_stdlib I_STDLIB
19056 #ifdef I_STDLIB
19057 #include <stdlib.h>
19058 #endif
19059 #include <signal.h>
19060
19061 int
19062 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19063 {
19064   return vfprintf(f, fmt, *valp);
19065 }
19066  
19067 int    
19068 myvfprintf(FILE *f, const  char *fmt, va_list val)
19069 {
19070   return ivfprintf(f, fmt, &val);
19071 }
19072       
19073 int
19074 myprintf(char *fmt, ...) 
19075 {
19076   va_list val;
19077   va_start(val, fmt);
19078   return myvfprintf(stdout, fmt, val); 
19079 }         
19080
19081 int
19082 main(int ac, char **av)
19083 {
19084   signal(SIGSEGV, exit);
19085
19086   myprintf("%s%cs all right, then\n", "that", '\'');                            
19087   exit(0);      
19088 }
19089 EOCP
19090         set try
19091         if eval $compile && $run ./try 2>&1 >/dev/null; then
19092                 case "`$run ./try`" in
19093                 "that's all right, then")
19094                         okay=yes
19095                         ;;
19096                 esac
19097         fi
19098         case "$okay" in
19099         yes)    echo "It seems that you don't need va_copy()." >&4
19100                 need_va_copy="$undef"
19101                 ;;
19102         *)      echo "It seems that va_copy() or similar will be needed." >&4
19103                 need_va_copy="$define"
19104                 ;;
19105         esac
19106         $rm -f try.* core core.* *.core *.core.*
19107         ;;
19108 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19109         ;;
19110 esac
19111
19112 : see what type is used for size_t
19113 rp="What is the type used for the length parameter for string functions?"
19114 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19115 eval $typedef_ask
19116
19117 : check for type of arguments to gethostbyaddr. 
19118 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19119         case "$d_gethbyaddr" in
19120         $define)
19121                 $cat <<EOM
19122
19123 Checking to see what type of arguments are accepted by gethostbyaddr().
19124 EOM
19125                 hdrs="$define sys/types.h
19126                         $d_socket sys/socket.h 
19127                         $i_niin netinet/in.h 
19128                         $i_netdb netdb.h
19129                         $i_unistd unistd.h"
19130                 : The first arg can 'char *' or 'void *'
19131                 : The second arg is some of integral type
19132                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19133                         for yyy in size_t long int; do
19134                                 case "$netdb_host_type" in
19135                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19136                                         if ./protochk "$try" $hdrs; then
19137                                                 echo "Your system accepts $xxx for the first arg."
19138                                                 echo "...and $yyy for the second arg."
19139                                                 netdb_host_type="$xxx"
19140                                                 netdb_hlen_type="$yyy"
19141                                         fi
19142                                         ;;
19143                                 esac
19144                         done
19145                 done
19146                 : In case none of those worked, prompt the user.
19147                 case "$netdb_host_type" in
19148                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19149                         dflt='char *'
19150                         . ./myread
19151                         netdb_host_type=$ans
19152                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19153                         dflt="$sizetype"
19154                         . ./myread
19155                         netdb_hlen_type=$ans
19156                         ;;
19157                 esac
19158                 ;;
19159         *)      : no gethostbyaddr, so pick harmless defaults
19160                 netdb_host_type='char *'
19161                 netdb_hlen_type="$sizetype"
19162                 ;;
19163         esac
19164         # Remove the "const" if needed. -- but then we'll have a 
19165         # prototype clash!
19166         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19167 fi
19168
19169 : check for type of argument to gethostbyname. 
19170 if test "X$netdb_name_type" = X ; then
19171         case "$d_gethbyname" in
19172         $define)
19173                 $cat <<EOM
19174
19175 Checking to see what type of argument is accepted by gethostbyname().
19176 EOM
19177                 hdrs="$define sys/types.h
19178                         $d_socket sys/socket.h 
19179                         $i_niin netinet/in.h 
19180                         $i_netdb netdb.h
19181                         $i_unistd unistd.h"
19182                 for xxx in "const char *" "char *"; do
19183                         case "$netdb_name_type" in
19184                         '')     try="extern struct hostent *gethostbyname($xxx);"
19185                                 if ./protochk "$try" $hdrs; then
19186                                         echo "Your system accepts $xxx."
19187                                         netdb_name_type="$xxx"
19188                                 fi
19189                                 ;;
19190                         esac
19191                 done
19192                 : In case none of those worked, prompt the user.
19193                 case "$netdb_name_type" in
19194                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19195                         dflt='char *'
19196                         . ./myread
19197                         netdb_name_type=$ans
19198                         ;;
19199                 esac
19200                 ;;
19201         *)      : no gethostbyname, so pick harmless default
19202                 netdb_name_type='char *'
19203                 ;;
19204         esac
19205 fi
19206
19207 : check for type of 1st argument to getnetbyaddr. 
19208 if test "X$netdb_net_type" = X ; then
19209         case "$d_getnbyaddr" in
19210         $define)
19211                 $cat <<EOM
19212
19213 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19214 EOM
19215                 hdrs="$define sys/types.h
19216                         $d_socket sys/socket.h 
19217                         $i_niin netinet/in.h 
19218                         $i_netdb netdb.h
19219                         $i_unistd unistd.h"
19220                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19221                         case "$netdb_net_type" in
19222                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19223                                 if ./protochk "$try" $hdrs; then
19224                                         echo "Your system accepts $xxx."
19225                                         netdb_net_type="$xxx"
19226                                 fi
19227                                 ;;
19228                         esac
19229                 done
19230                 : In case none of those worked, prompt the user.
19231                 case "$netdb_net_type" in
19232                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19233                         dflt='long'
19234                         . ./myread
19235                         netdb_net_type=$ans
19236                         ;;
19237                 esac
19238                 ;;
19239         *)      : no getnetbyaddr, so pick harmless default
19240                 netdb_net_type='long'
19241                 ;;
19242         esac
19243 fi
19244 : locate the preferred pager for this system
19245 fn=f/
19246 case "$pager" in
19247 '')
19248         dflt=''
19249         case "$pg" in
19250         /*) dflt=$pg;;
19251         [a-zA-Z]:/*) dflt=$pg;;
19252         esac
19253         case "$more" in
19254         /*) dflt=$more;;
19255         [a-zA-Z]:/*) dflt=$more;;
19256         esac
19257         case "$less" in
19258         /*) dflt=$less;;
19259         [a-zA-Z]:/*) dflt=$less;;
19260         esac
19261         case "$dflt" in
19262         '') dflt=/usr/ucb/more;;
19263         esac
19264         ;;
19265 *)      dflt="$pager"
19266         : Instruct ./getfile to trust the hinted or previous pager value,
19267         : even if it does not begin with a slash.  For example, on os2,
19268         : pager might be cmd /c more.  See comments in UU/getfile.
19269         fn="f/($pager)"
19270         ;;
19271 esac
19272 echo " "
19273 rp='What pager is used on your system?'
19274 . ./getfile
19275 pager="$ans"
19276
19277 : see what type pids are declared as in the kernel
19278 rp="What is the type of process ids on this system?"
19279 set pid_t pidtype int stdio.h sys/types.h
19280 eval $typedef_ask
19281
19282 : see if ar generates random libraries by itself
19283 echo " "
19284 echo "Checking how to generate random libraries on your machine..." >&4
19285 echo 'int bar1() { return bar2(); }' > bar1.c
19286 echo 'int bar2() { return 2; }' > bar2.c
19287 $cat > foo.c <<EOP
19288 #$i_stdlib I_STDLIB
19289 #ifdef I_STDLIB
19290 #include <stdlib.h>
19291 #endif
19292 int main() { printf("%d\n", bar1()); exit(0); }
19293 EOP
19294 $cc $ccflags -c bar1.c >/dev/null 2>&1
19295 $cc $ccflags -c bar2.c >/dev/null 2>&1
19296 $cc $ccflags -c foo.c >/dev/null 2>&1
19297 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19298 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19299         $run ./foobar >/dev/null 2>&1; then
19300         echo "$ar appears to generate random libraries itself."
19301         orderlib=false
19302         if [ "X$ranlib" = "X" ]; then
19303             ranlib=":"
19304         fi
19305 elif $ar s bar$_a >/dev/null 2>&1 &&
19306         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19307         $run ./foobar >/dev/null 2>&1; then
19308                 echo "a table of contents needs to be added with '$ar s'."
19309                 orderlib=false
19310                 ranlib="$ar s"
19311 elif $ar ts bar$_a >/dev/null 2>&1 &&
19312         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19313         $run ./foobar >/dev/null 2>&1; then
19314                 echo "a table of contents needs to be added with '$ar ts'."
19315                 orderlib=false
19316                 ranlib="$ar ts"
19317 else
19318         case "$ranlib" in
19319         :) ranlib='';;
19320         '')
19321                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19322                 $test -f $ranlib || ranlib=''
19323                 ;;
19324         esac
19325         if $test -n "$ranlib"; then
19326                 echo "your system has '$ranlib'; we'll use that."
19327                 orderlib=false
19328         else
19329                 echo "your system doesn't seem to support random libraries"
19330                 echo "so we'll use lorder and tsort to order the libraries."
19331                 orderlib=true
19332                 ranlib=":"
19333         fi
19334 fi
19335 $rm -f foo* bar*
19336
19337 : check for type of arguments to select. 
19338 case "$selecttype" in
19339 '') case "$d_select" in
19340         $define)
19341                 echo " "
19342                 $cat <<EOM
19343 Checking to see what type of arguments are accepted by select().
19344 EOM
19345                 hdrs="$define sys/types.h
19346                         $i_systime sys/time.h 
19347                         $i_sysselct sys/select.h
19348                         $d_socket sys/socket.h"
19349                 : The first arg can be int, unsigned, or size_t
19350                 : The last arg may or may not be 'const'
19351                 val=''
19352                 : void pointer has been seen but using that
19353                 : breaks the selectminbits test
19354                 for xxx in 'fd_set *' 'int *'; do
19355                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19356                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19357                                         case "$val" in
19358                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19359                                                 if ./protochk "$try" $hdrs; then
19360                                                         echo "Your system accepts $xxx."
19361                                                         val="$xxx"
19362                                                 fi
19363                                                 ;;
19364                                         esac
19365                                 done
19366                         done
19367                 done
19368                 case "$val" in
19369                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19370                         case "$d_fd_set" in
19371                                 $define) dflt="fd_set *" ;;
19372                                 *)              dflt="int *" ;;
19373                         esac
19374                         . ./myread
19375                         val=$ans
19376                         ;;
19377                 esac
19378                 selecttype="$val"
19379                 ;;
19380         *)      : no select, so pick a harmless default
19381                 selecttype='int *'
19382                 ;;
19383         esac
19384         ;;
19385 esac
19386
19387 : check for the select 'width'
19388 case "$selectminbits" in
19389 '') safebits=`expr $ptrsize \* 8`
19390     case "$d_select" in
19391         $define)
19392                 $cat <<EOM
19393
19394 Checking to see on how many bits at a time your select() operates...
19395 EOM
19396                 $cat >try.c <<EOCP
19397 #include <sys/types.h>
19398 #$i_time I_TIME
19399 #$i_systime I_SYS_TIME
19400 #$i_systimek I_SYS_TIME_KERNEL
19401 #ifdef I_TIME
19402 #   include <time.h>
19403 #endif
19404 #ifdef I_SYS_TIME
19405 #   ifdef I_SYS_TIME_KERNEL
19406 #       define KERNEL
19407 #   endif
19408 #   include <sys/time.h>
19409 #   ifdef I_SYS_TIME_KERNEL
19410 #       undef KERNEL
19411 #   endif
19412 #endif
19413 #$i_sysselct I_SYS_SELECT
19414 #ifdef I_SYS_SELECT
19415 #include <sys/select.h>
19416 #endif
19417 #$d_socket HAS_SOCKET
19418 #ifdef HAS_SOCKET
19419 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19420 #endif
19421 #include <stdio.h>
19422 #$i_stdlib I_STDLIB
19423 #ifdef I_STDLIB
19424 #include <stdlib.h>
19425 #endif
19426 $selecttype b;
19427 #define S sizeof(*(b))
19428 #define MINBITS 64
19429 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19430 #define NBITS  (NBYTES * 8)
19431 int main() {
19432     char *s = malloc(NBYTES);
19433     struct timeval t;
19434     int i;
19435     FILE* fp;
19436     int fd;
19437
19438     if (!s)
19439         exit(1);
19440     fclose(stdin);
19441     fp = fopen("try.c", "r");
19442     if (fp == 0)
19443       exit(2);
19444     fd = fileno(fp);
19445     if (fd < 0)
19446       exit(3);
19447     b = ($selecttype)s;
19448     for (i = 0; i < NBITS; i++)
19449         FD_SET(i, b);
19450     t.tv_sec  = 0;
19451     t.tv_usec = 0;
19452     select(fd + 1, b, 0, 0, &t);
19453     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19454     free(s);
19455     printf("%d\n", i + 1);
19456     return 0;
19457 }
19458 EOCP
19459                 set try
19460                 if eval $compile_ok; then
19461                         selectminbits=`$run ./try`
19462                         case "$selectminbits" in
19463                         '')     cat >&4 <<EOM
19464 Cannot figure out on how many bits at a time your select() operates.
19465 I'll play safe and guess it is $safebits bits.
19466 EOM
19467                                 selectminbits=$safebits
19468                                 bits="$safebits bits"
19469                                 ;;
19470                         1)      bits="1 bit" ;;
19471                         *)      bits="$selectminbits bits" ;;
19472                         esac
19473                         echo "Your select() operates on $bits at a time." >&4
19474                 else
19475                         rp='What is the minimum number of bits your select() operates on?'
19476                         case "$byteorder" in
19477                         12345678)       dflt=64 ;;
19478                         1234)           dflt=32 ;;
19479                         *)              dflt=1  ;;
19480                         esac
19481                         . ./myread
19482                         val=$ans
19483                         selectminbits="$val"
19484                 fi
19485                 $rm -f try.* try
19486                 ;;
19487         *)      : no select, so pick a harmless default
19488                 selectminbits=$safebits
19489                 ;;
19490         esac
19491         ;;
19492 esac
19493
19494 : Trace out the files included by signal.h, then look for SIGxxx names.
19495 : Remove SIGARRAYSIZE used by HPUX.
19496 : Remove SIGSTKSIZE used by Linux.
19497 : Remove SIGSTKSZ used by Posix.
19498 : Remove SIGTYP void lines used by OS2.
19499 : Some cpps, like os390, dont give the file name anywhere
19500 if [ "X$fieldn" = X ]; then
19501         : Just make some guesses.  We check them later.
19502         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19503 else
19504         xxx=`echo '#include <signal.h>' |
19505         $cppstdin $cppminus $cppflags 2>/dev/null |
19506         $grep '^[       ]*#.*include' | 
19507         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19508 fi
19509 : Check this list of files to be sure we have parsed the cpp output ok.
19510 : This will also avoid potentially non-existent files, such 
19511 : as ../foo/bar.h
19512 xxxfiles=''
19513 for xx in $xxx /dev/null ; do
19514         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19515 done
19516 : If we have found no files, at least try signal.h
19517 case "$xxxfiles" in
19518 '')     xxxfiles=`./findhdr signal.h` ;;
19519 esac
19520 xxx=`awk '
19521 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19522         print substr($2, 4, 20)
19523 }
19524 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19525         print substr($3, 4, 20)
19526 }' $xxxfiles`
19527 : Append some common names just in case the awk scan failed.
19528 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19529 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19530 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19531 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19532 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19533
19534 : generate a few handy files for later
19535 $cat > signal.c <<EOCP
19536 #include <sys/types.h>
19537 #include <signal.h>
19538 #$i_stdlib I_STDLIB
19539 #ifdef I_STDLIB
19540 #include <stdlib.h>
19541 #endif
19542 #include <stdio.h>
19543 int main() {
19544
19545 /* Strange style to avoid deeply-nested #if/#else/#endif */
19546 #ifndef NSIG
19547 #  ifdef _NSIG
19548 #    define NSIG (_NSIG)
19549 #  endif
19550 #endif
19551
19552 #ifndef NSIG
19553 #  ifdef SIGMAX
19554 #    define NSIG (SIGMAX+1)
19555 #  endif
19556 #endif
19557
19558 #ifndef NSIG
19559 #  ifdef SIG_MAX
19560 #    define NSIG (SIG_MAX+1)
19561 #  endif
19562 #endif
19563
19564 #ifndef NSIG
19565 #  ifdef _SIG_MAX
19566 #    define NSIG (_SIG_MAX+1)
19567 #  endif
19568 #endif
19569
19570 #ifndef NSIG
19571 #  ifdef MAXSIG
19572 #    define NSIG (MAXSIG+1)
19573 #  endif
19574 #endif
19575
19576 #ifndef NSIG
19577 #  ifdef MAX_SIG
19578 #    define NSIG (MAX_SIG+1)
19579 #  endif
19580 #endif
19581
19582 #ifndef NSIG
19583 #  ifdef SIGARRAYSIZE
19584 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19585 #  endif
19586 #endif
19587
19588 #ifndef NSIG
19589 #  ifdef _sys_nsig
19590 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19591 #  endif
19592 #endif
19593
19594 /* Default to some arbitrary number that's big enough to get most
19595    of the common signals.
19596 */
19597 #ifndef NSIG
19598 #    define NSIG 50
19599 #endif
19600
19601 printf("NSIG %d\n", NSIG);
19602
19603 #ifndef JUST_NSIG
19604
19605 EOCP
19606
19607 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19608 {
19609         printf "#ifdef SIG"; printf $1; printf "\n"
19610         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19611         printf $1; printf ");\n"
19612         printf "#endif\n"
19613 }
19614 END {
19615         printf "#endif /* JUST_NSIG */\n";
19616         printf "exit(0);\n}\n";
19617 }
19618 ' >>signal.c
19619 $cat >signal.awk <<'EOP'
19620 BEGIN { ndups = 0 }
19621 $1 ~ /^NSIG$/ { nsig = $2 }
19622 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19623     if ($2 > maxsig) { maxsig = $2 }
19624     if (sig_name[$2]) {
19625         dup_name[ndups] = $1
19626         dup_num[ndups] = $2
19627         ndups++ 
19628     }
19629     else {
19630         sig_name[$2] = $1
19631         sig_num[$2] = $2
19632     }
19633 }
19634 END { 
19635     if (nsig == 0) {
19636         nsig = maxsig + 1
19637     }
19638     printf("NSIG %d\n", nsig);
19639     for (n = 1; n < nsig; n++) {
19640         if (sig_name[n]) {
19641             printf("%s %d\n", sig_name[n], sig_num[n])
19642         }
19643         else {
19644             printf("NUM%d %d\n", n, n) 
19645         }
19646     }
19647     for (n = 0; n < ndups; n++) {
19648         printf("%s %d\n", dup_name[n], dup_num[n])
19649     }
19650 }
19651 EOP
19652 $cat >signal_cmd <<EOS
19653 $startsh
19654 if $test -s signal.lst; then
19655     echo "Using your existing signal.lst file"
19656         exit 0
19657 fi
19658 xxx="$xxx"
19659 EOS
19660 $cat >>signal_cmd <<'EOS'
19661
19662 set signal
19663 if eval $compile_ok; then
19664         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
19665 else
19666         echo "(I can't seem be able to compile the whole test program)" >&4
19667         echo "(I'll try it in little pieces.)" >&4
19668         set signal -DJUST_NSIG
19669         if eval $compile_ok; then
19670                 $run ./signal$_exe > signal.nsg
19671                 $cat signal.nsg
19672         else
19673                 echo "I can't seem to figure out how many signals you have." >&4
19674                 echo "Guessing 50." >&4
19675                 echo 'NSIG 50' > signal.nsg
19676         fi
19677         : Now look at all the signal names, one at a time.
19678         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
19679                 $cat > signal.c <<EOCP
19680 #include <sys/types.h>
19681 #include <signal.h>
19682 #include <stdio.h>
19683 int main() {
19684 printf("$xx %d\n", SIG${xx});
19685 return 0;
19686 }
19687 EOCP
19688                 set signal
19689                 if eval $compile; then
19690                         echo "SIG${xx} found."
19691                         $run ./signal$_exe  >> signal.ls1
19692                 else
19693                         echo "SIG${xx} NOT found."
19694                 fi
19695         done
19696         if $test -s signal.ls1; then
19697                 $cat signal.nsg signal.ls1 |
19698                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
19699         fi
19700
19701 fi
19702 if $test -s signal.lst; then
19703         :
19704 else
19705         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
19706         echo 'kill -l' >signal
19707         set X `csh -f <signal`
19708         $rm -f signal
19709         shift
19710         case $# in
19711         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
19712         esac
19713         echo $@ | $tr ' ' $trnl | \
19714             $awk '{ printf "%s %d\n", $1, ++s; }
19715                   END { printf "NSIG %d\n", ++s }' >signal.lst
19716 fi
19717 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
19718 EOS
19719 chmod a+x signal_cmd
19720 $eunicefix signal_cmd
19721
19722 : generate list of signal names
19723 echo " "
19724 case "$sig_name_init" in
19725 '') doinit=yes ;;
19726 *)  case "$sig_num_init" in
19727     ''|*,*) doinit=yes ;;
19728     esac ;;
19729 esac
19730 case "$doinit" in
19731 yes)
19732         echo "Generating a list of signal names and numbers..." >&4
19733         . ./signal_cmd
19734         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
19735         sig_name=`$awk 'BEGIN { printf "ZERO " }
19736                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
19737         sig_num=`$awk  'BEGIN { printf "0 " }
19738                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
19739         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
19740                              !/^NSIG/   { printf "\"%s\", ", $1 }
19741                              END        { printf "0\n" }' signal.lst`
19742         sig_num_init=`$awk  'BEGIN      { printf "0, " }
19743                              !/^NSIG/   { printf "%d, ", $2}
19744                              END        { printf "0\n"}' signal.lst`
19745         ;;
19746 esac
19747 echo "The following $sig_count signals are available:"
19748 echo " "
19749 echo $sig_name | $awk \
19750 'BEGIN { linelen = 0 }
19751 {
19752         for (i = 1; i <= NF; i++) {
19753                 name = "SIG" $i " "
19754                 linelen = linelen + length(name)
19755                 if (linelen > 70) {
19756                         printf "\n"
19757                         linelen = length(name)
19758                 }
19759                 printf "%s", name
19760         }
19761         printf "\n"
19762 }'
19763 sig_size=`echo $sig_name | awk '{print NF}'`
19764 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
19765
19766 echo " "
19767 case "$sizetype" in
19768 *_t) zzz="$sizetype"    ;;
19769 *)   zzz="filesize"     ;;
19770 esac
19771 echo "Checking the size of $zzz..." >&4 
19772 cat > try.c <<EOCP
19773 #include <sys/types.h>
19774 #include <stdio.h>
19775 #$i_stdlib I_STDLIB
19776 #ifdef I_STDLIB
19777 #include <stdlib.h>
19778 #endif
19779 int main() {
19780     printf("%d\n", (int)sizeof($sizetype));
19781     exit(0);
19782 }
19783 EOCP
19784 set try
19785 if eval $compile_ok; then
19786         yyy=`$run ./try`
19787         case "$yyy" in
19788         '')     sizesize=4
19789                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
19790                 ;;
19791         *)      sizesize=$yyy
19792                 echo "Your $zzz size is $sizesize bytes."
19793                 ;;
19794         esac
19795 else
19796         sizesize=4
19797         echo "(I can't compile the test program--guessing $sizesize.)" >&4
19798 fi
19799
19800
19801 : check for socklen_t
19802 echo " "
19803 echo "Checking to see if you have socklen_t..." >&4
19804 $cat >try.c <<EOCP
19805 #include <sys/types.h>
19806 #$d_socket HAS_SOCKET
19807 #ifdef HAS_SOCKET
19808 #include <sys/socket.h>
19809 #endif
19810 int main() { socklen_t x = 16; }
19811 EOCP
19812 set try
19813 if eval $compile; then
19814         val="$define"
19815         echo "You have socklen_t."
19816 else
19817         val="$undef"
19818         echo "You do not have socklen_t."
19819         case "$sizetype" in
19820         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
19821         esac
19822 fi
19823 $rm -f try try.*
19824 set d_socklen_t
19825 eval $setvar
19826
19827 : see if this is a socks.h system
19828 set socks.h i_socks
19829 eval $inhdr
19830
19831 : check for type of the size argument to socket calls
19832 case "$d_socket" in
19833 "$define")
19834         $cat <<EOM
19835
19836 Checking to see what type is the last argument of accept().
19837 EOM
19838         yyy=''
19839         case "$d_socklen_t" in
19840         "$define") yyy="$yyy socklen_t"
19841         esac
19842         yyy="$yyy $sizetype int long unsigned"
19843         for xxx in $yyy; do
19844                 case "$socksizetype" in
19845                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
19846                         case "$usesocks" in
19847                         "$define")
19848                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
19849                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19850                                         socksizetype="$xxx"
19851                                 fi
19852                                 ;;
19853                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
19854                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
19855                                         socksizetype="$xxx"
19856                                 fi
19857                                 ;;
19858                         esac
19859                         ;;
19860                 esac
19861         done
19862 : In case none of those worked, prompt the user.
19863         case "$socksizetype" in
19864         '')     rp='What is the type for socket address structure sizes?'
19865                 dflt='int'
19866                 . ./myread
19867                 socksizetype=$ans
19868                 ;;
19869         esac
19870         ;;
19871 *)      : no sockets, so pick relatively harmless default
19872         socksizetype='int'
19873         ;;
19874 esac
19875
19876 : see what type is used for signed size_t
19877 set ssize_t ssizetype int stdio.h sys/types.h
19878 eval $typedef
19879 dflt="$ssizetype"
19880 $cat > try.c <<EOM
19881 #include <stdio.h>
19882 #$i_stdlib I_STDLIB
19883 #ifdef I_STDLIB
19884 #include <stdlib.h>
19885 #endif
19886 #include <sys/types.h>
19887 #define Size_t $sizetype
19888 #define SSize_t $dflt
19889 int main()
19890 {
19891         if (sizeof(Size_t) == sizeof(SSize_t))
19892                 printf("$dflt\n");
19893         else if (sizeof(Size_t) == sizeof(int))
19894                 printf("int\n");
19895         else 
19896                 printf("long\n");
19897         exit(0);
19898 }
19899 EOM
19900 echo " "
19901 set try
19902 if eval $compile_ok && $run ./try > /dev/null; then
19903         ssizetype=`$run ./try`
19904         echo "I'll be using $ssizetype for functions returning a byte count." >&4
19905 else
19906         $cat >&4 <<EOM
19907 Help! I can't compile and run the ssize_t test program: please enlighten me!
19908 (This is probably a misconfiguration in your system or libraries, and
19909 you really ought to fix it.  Still, I'll try anyway.)
19910
19911 I need a type that is the same size as $sizetype, but is guaranteed to
19912 be signed.  Common values are ssize_t, int and long.
19913
19914 EOM
19915         rp="What signed type is the same size as $sizetype?"
19916         . ./myread
19917         ssizetype="$ans"
19918 fi
19919 $rm -f try try.*
19920
19921 : see what type of char stdio uses.
19922 echo " "
19923 echo '#include <stdio.h>' > stdio.c
19924 $cppstdin $cppminus < stdio.c > stdioh
19925 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
19926         echo "Your stdio uses unsigned chars." >&4
19927         stdchar="unsigned char"
19928 else
19929         echo "Your stdio uses signed chars." >&4
19930         stdchar="char"
19931 fi
19932 $rm -f stdio.* stdioh
19933
19934 : see what type uids are declared as in the kernel
19935 echo " "
19936 echo "Looking for the type for user ids returned by getuid()."
19937 set uid_t uidtype xxx stdio.h sys/types.h
19938 eval $typedef
19939 case "$uidtype" in
19940 xxx)
19941         xxx=`./findhdr sys/user.h`
19942         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
19943         case $1 in
19944         unsigned) dflt="$1 $2" ;;
19945         *) dflt="$1" ;;
19946         esac
19947         ;;
19948 *) dflt="$uidtype";;
19949 esac
19950 case "$uidtype" in
19951 uid_t)  echo "uid_t found." ;;
19952 *)      rp="What is the type for user ids returned by getuid()?"
19953         . ./myread
19954         uidtype="$ans"
19955         ;;
19956 esac
19957
19958 echo " "
19959 case "$uidtype" in
19960 *_t) zzz="$uidtype"     ;;
19961 *)   zzz="uid"          ;;
19962 esac
19963 echo "Checking the size of $zzz..." >&4 
19964 cat > try.c <<EOCP
19965 #include <sys/types.h>
19966 #include <stdio.h>
19967 #$i_stdlib I_STDLIB
19968 #ifdef I_STDLIB
19969 #include <stdlib.h>
19970 #endif
19971 int main() {
19972     printf("%d\n", (int)sizeof($uidtype));
19973     exit(0);
19974 }
19975 EOCP
19976 set try
19977 if eval $compile_ok; then
19978         yyy=`$run ./try`
19979         case "$yyy" in
19980         '')     uidsize=4
19981                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
19982                 ;;
19983         *)      uidsize=$yyy
19984                 echo "Your $zzz is $uidsize bytes long."
19985                 ;;
19986         esac
19987 else
19988         uidsize=4
19989         echo "(I can't compile the test program--guessing $uidsize.)" >&4
19990 fi
19991
19992 echo " "
19993 case "$uidtype" in
19994 *_t) zzz="$uidtype"     ;;
19995 *)   zzz="uid"          ;;
19996 esac
19997 echo "Checking the sign of $zzz..." >&4
19998 cat > try.c <<EOCP
19999 #include <sys/types.h>
20000 #include <stdio.h>
20001 int main() {
20002         $uidtype foo = -1;
20003         if (foo < 0)
20004                 printf("-1\n");
20005         else
20006                 printf("1\n");
20007 }
20008 EOCP
20009 set try
20010 if eval $compile; then
20011         yyy=`$run ./try`
20012         case "$yyy" in
20013         '')     uidsign=1
20014                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20015                 ;;
20016         *)      uidsign=$yyy
20017                 case "$uidsign" in
20018                  1) echo "Your $zzz is unsigned." ;;
20019                 -1) echo "Your $zzz is signed."   ;;
20020                 esac
20021                 ;;
20022         esac
20023 else
20024         uidsign=1
20025         echo "(I can't compile the test program--guessing unsigned.)" >&4
20026 fi
20027
20028
20029
20030 echo " "
20031 $echo "Checking the format string to be used for uids..." >&4
20032
20033 case "$uidsign" in
20034 -1)     if $test X"$uidsize" = X"$ivsize"; then
20035                 uidformat="$ivdformat"
20036         else
20037                 if $test X"$uidsize" = X"$longsize"; then
20038                         uidformat='"ld"'
20039                 else
20040                         if $test X"$uidsize" = X"$intsize"; then
20041                                 uidformat='"d"'
20042                         else
20043                                 if $test X"$uidsize" = X"$shortsize"; then
20044                                         uidformat='"hd"'
20045                                 fi
20046                         fi
20047                 fi
20048         fi
20049         ;;
20050 *)      if $test X"$uidsize" = X"$uvsize"; then
20051                 uidformat="$uvuformat"
20052         else
20053                 if $test X"$uidsize" = X"$longsize"; then
20054                         uidformat='"lu"'
20055                 else
20056                         if $test X"$uidsize" = X"$intsize"; then
20057                                 uidformat='"u"'
20058                         else
20059                                 if $test X"$uidsize" = X"$shortsize"; then
20060                                         uidformat='"hu"'
20061                                 fi
20062                         fi
20063                 fi
20064         fi
20065         ;;
20066 esac
20067
20068
20069 case "$usesitecustomize" in
20070     $define|true|[Yy]*)
20071         usesitecustomize="$define"
20072         ;;
20073     *)
20074         usesitecustomize="$undef"
20075         ;;
20076     esac
20077
20078 : determine compiler compiler
20079 case "$yacc" in
20080 '')
20081         dflt=yacc;;
20082 *)
20083         dflt="$yacc";;
20084 esac
20085 echo " "
20086 comp='yacc'
20087 if $test -f "$byacc$_exe"; then
20088         dflt="$byacc"
20089         comp="byacc or $comp"
20090 fi
20091 if $test -f "$bison$_exe"; then
20092         comp="$comp or bison -y"
20093 fi
20094 rp="Which compiler compiler ($comp) shall I use?"
20095 . ./myread
20096 yacc="$ans"
20097 case "$yacc" in
20098 *bis*)
20099         case "$yacc" in
20100         *-y*) ;;
20101         *)
20102                 yacc="$yacc -y"
20103                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20104                 ;;
20105         esac
20106         ;;
20107 esac
20108
20109 : see if this is a fp.h system
20110 set fp.h i_fp
20111 eval $inhdr
20112
20113 : see if this is a fp_class.h system
20114 set fp_class.h i_fp_class
20115 eval $inhdr
20116
20117 : see if this is a ieeefp.h system
20118 case "$i_ieeefp" in
20119 '' ) set ieeefp.h i_ieeefp
20120      eval $inhdr
20121      ;;
20122 esac
20123
20124 : see if this is a libutil.h system
20125 set libutil.h i_libutil
20126 eval $inhdr
20127
20128 : see if mach cthreads are available
20129 if test "X$usethreads" = "X$define"; then
20130         set mach/cthreads.h i_machcthr
20131         eval $inhdr
20132 else
20133         i_machcthr="$undef"
20134 fi
20135
20136
20137
20138 : see if this is a mntent.h system
20139 set mntent.h i_mntent
20140 eval $inhdr
20141
20142 : see if ndbm.h is available
20143 set ndbm.h t_ndbm
20144 eval $inhdr
20145
20146 case "$t_ndbm" in
20147 $undef)
20148     # Some Linux distributions such as RedHat 7.1 put the
20149     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20150     if $test -f /usr/include/gdbm/ndbm.h; then
20151         echo '<gdbm/ndbm.h> found.'
20152         ccflags="$ccflags -I/usr/include/gdbm"
20153         cppflags="$cppflags -I/usr/include/gdbm"
20154         t_ndbm=$define
20155     fi
20156     ;;
20157 esac
20158
20159 case "$t_ndbm" in
20160 $define)
20161         : see if dbm_open exists
20162         set dbm_open d_dbm_open
20163         eval $inlibc
20164         case "$d_dbm_open" in
20165         $undef)
20166                 t_ndbm="$undef"
20167                 echo "We won't be including <ndbm.h>"
20168                 ;;
20169         esac
20170         ;;
20171 esac
20172 val="$t_ndbm"
20173 set i_ndbm
20174 eval $setvar
20175
20176 : see if net/errno.h is available
20177 val=''
20178 set net/errno.h val
20179 eval $inhdr
20180
20181 : Unfortunately, it causes problems on some systems.  Arrgh.
20182 case "$val" in
20183 $define)
20184         cat > try.c <<'EOM'
20185 #include <stdio.h>
20186 #include <errno.h>
20187 #include <net/errno.h>
20188 int func()
20189 {
20190         return ENOTSOCK;
20191 }
20192 EOM
20193         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20194                 echo "We'll be including <net/errno.h>." >&4
20195         else
20196                 echo "We won't be including <net/errno.h>." >&4
20197                 val="$undef"
20198         fi
20199         $rm -f try.* try
20200         ;;
20201 esac
20202 set i_neterrno
20203 eval $setvar
20204
20205 : see if netinet/tcp.h is available
20206 set netinet/tcp.h i_netinettcp
20207 eval $inhdr
20208
20209 : see if this is a poll.h system
20210 set poll.h i_poll
20211 eval $inhdr
20212
20213 : see if this is a prot.h system
20214 set prot.h i_prot
20215 eval $inhdr
20216
20217 echo " "
20218 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20219 $cat <<'EOSH' > Cppsym.know
20220 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20221 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20222 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20223 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20224 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20225 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20226 bull c cadmus clipper CMU COFF COMPILER_VERSION
20227 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20228 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20229 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20230 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20231 GLIBC GLIBC_MINOR
20232 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20233 H3050R H3050RX hbullx20 hcx host_mips
20234 hp200 hp300 hp700 HP700 hp800 hp9000
20235 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20236 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20237 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20238 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20239 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20240 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20241 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20242 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20243 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20244 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20245 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20246 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20247 MATH_HAS_NO_SIDE_EFFECTS
20248 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20249 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20250 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20251 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20252 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20253 NetBSD news1500 news1700 news1800 news1900 news3700
20254 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20255 ns32016 ns32332 ns32k nsc32000
20256 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20257 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20258 pc532 pdp11 PGC PIC plexus PORTAR posix
20259 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20260 POSIX_C_SOURCE POSIX_SOURCE POWER
20261 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20262 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20263 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20264 sony sony_news sonyrisc sparc sparclite spectrum
20265 stardent stdc STDC_EXT stratos sun sun3 sun386
20266 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20267 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20268 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20269 sysV68 sysV88 Tek4132 Tek4300 titan
20270 TM3200 TM5400 TM5600
20271 tower tower32 tower32_200 tower32_600 tower32_700
20272 tower32_800 tower32_850 tss
20273 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20274 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20275 unix UNIX95 UNIX99 unixpc unos
20276 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20277 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20278 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20279 USGr4 USGr4_2
20280 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20281 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20282 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20283 z8000
20284 EOSH
20285 # Maybe put other stuff here too.
20286 cat <<EOSH >>Cppsym.know
20287 $osname
20288 EOSH
20289 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20290 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20291 $cat Cppsym.know > Cppsym.c
20292 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20293 $rm -f Cppsym.a Cppsym.b Cppsym.c
20294 cat <<EOSH > Cppsym
20295 $startsh
20296 if $test \$# -gt 0; then
20297     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20298     if $test -s Cppsym.got; then
20299         $rm -f Cppsym.got
20300         exit 0
20301     fi
20302     $rm -f Cppsym.got
20303     exit 1
20304 else
20305     $tr " " "$trnl" | ./Cppsym.try
20306     exit 0
20307 fi
20308 EOSH
20309 chmod +x Cppsym
20310 $eunicefix Cppsym
20311 cat <<EOSH > Cppsym.try
20312 $startsh
20313 cat <<'EOCP' > try.c
20314 #include <stdio.h>
20315 #if cpp_stuff == 1
20316 #define STRINGIFY(a)    "a"
20317 #endif
20318 #if cpp_stuff == 42
20319 #define StGiFy(a)  #a
20320 #define STRINGIFY(a)    StGiFy(a)
20321 #endif
20322 #if $cpp_stuff != 1 && $cpp_stuff != 42
20323 #   include "Bletch: How does this C preprocessor stringify macros?"
20324 #endif
20325 int main() {
20326 EOCP
20327 $awk \\
20328 EOSH
20329 cat <<'EOSH' >> Cppsym.try
20330 'length($1) > 0 {
20331     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20332     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20333     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20334     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20335 }'       >> try.c
20336 echo 'return 0;}' >> try.c
20337 EOSH
20338 cat <<EOSH >> Cppsym.try
20339 ccflags="$ccflags"
20340 case "$osname-$gccversion" in
20341 irix-) ccflags="\$ccflags -woff 1178" ;;
20342 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20343 esac
20344 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20345 EOSH
20346 chmod +x Cppsym.try
20347 $eunicefix Cppsym.try
20348 ./Cppsym < Cppsym.know > Cppsym.true
20349 : Add in any linux cpp "predefined macros":
20350 case "$osname::$gccversion" in
20351   *linux*::*.*)
20352     tHdrH=_tmpHdr
20353     rm -f $tHdrH'.h' $tHdrH
20354     touch $tHdrH'.h'
20355     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20356        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20357        if [ -s $tHdrH'_cppsym.real' ]; then
20358           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20359        fi
20360     fi
20361     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20362   ;;
20363 esac
20364 : now check the C compiler for additional symbols
20365 postprocess_cc_v=''
20366 case "$osname" in
20367 aix) postprocess_cc_v="|$tr , ' '" ;;
20368 esac
20369 $cat >ccsym <<EOS
20370 $startsh
20371 $cat >tmp.c <<EOF
20372 extern int foo;
20373 EOF
20374 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20375 do
20376         case "\$i" in
20377         -D*) echo "\$i" | $sed 's/^-D//';;
20378         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20379         esac
20380 done
20381 $rm -f try.c
20382 EOS
20383 postprocess_cc_v=''
20384 chmod +x ccsym
20385 $eunicefix ccsym
20386 ./ccsym > ccsym1.raw
20387 if $test -s ccsym1.raw; then
20388        $sort ccsym1.raw | $uniq >ccsym.raw
20389 else
20390        mv ccsym1.raw ccsym.raw
20391 fi
20392
20393 $awk '/\=/ { print $0; next }
20394         { print $0"=1" }' ccsym.raw >ccsym.list
20395 $comm -13 Cppsym.true ccsym.list >ccsym.own
20396 $comm -12 Cppsym.true ccsym.list >ccsym.com
20397 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20398 also=''
20399 if $test -z ccsym.raw; then
20400         echo "Your C compiler doesn't seem to define any symbols!" >&4
20401         echo " "
20402         echo "However, your C preprocessor defines the following symbols:"
20403         $cat Cppsym.true
20404         ccsymbols=''
20405         cppsymbols=`$cat Cppsym.true`
20406         cppsymbols=`echo $cppsymbols`
20407         cppccsymbols="$cppsymbols"
20408 else
20409         if $test -s ccsym.com; then
20410                 echo "Your C compiler and pre-processor define these symbols:"
20411                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20412                 also='also '
20413                 symbols='ones'
20414                 cppccsymbols=`$cat ccsym.com`
20415                 cppccsymbols=`echo $cppccsymbols`
20416                 $test "$silent" || sleep 1
20417         fi
20418         if $test -s ccsym.cpp; then
20419                 $test "$also" && echo " "
20420                 echo "Your C pre-processor ${also}defines the following symbols:"
20421                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20422                 also='further '
20423                 cppsymbols=`$cat ccsym.cpp`
20424                 cppsymbols=`echo $cppsymbols`
20425                 $test "$silent" || sleep 1
20426         fi
20427         if $test -s ccsym.own; then
20428                 $test "$also" && echo " "
20429                 echo "Your C compiler ${also}defines the following cpp symbols:"
20430                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20431                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20432                 ccsymbols=`$cat ccsym.own`
20433                 ccsymbols=`echo $ccsymbols`
20434                 $test "$silent" || sleep 1
20435         fi
20436 fi
20437
20438 : see if this is a termio system
20439 val="$undef"
20440 val2="$undef"
20441 val3="$undef"
20442 if $test `./findhdr termios.h`; then
20443         set tcsetattr i_termios
20444         eval $inlibc
20445         val3="$i_termios"
20446 fi
20447 echo " "
20448 case "$val3" in
20449 "$define") echo "You have POSIX termios.h... good!" >&4;;
20450 *) if ./Cppsym pyr; then
20451                 case "`/bin/universe`" in
20452                 ucb) if $test `./findhdr sgtty.h`; then
20453                                 val2="$define"
20454                                 echo "<sgtty.h> found." >&4
20455                         else
20456                                 echo "System is pyramid with BSD universe."
20457                                 echo "<sgtty.h> not found--you could have problems." >&4
20458                         fi;;
20459                 *) if $test `./findhdr termio.h`; then
20460                                 val="$define"
20461                                 echo "<termio.h> found." >&4
20462                         else
20463                                 echo "System is pyramid with USG universe."
20464                                 echo "<termio.h> not found--you could have problems." >&4
20465                         fi;;
20466                 esac
20467         elif ./usg; then
20468                 if $test `./findhdr termio.h`; then
20469                         echo "<termio.h> found." >&4
20470                         val="$define"
20471                 elif $test `./findhdr sgtty.h`; then
20472                         echo "<sgtty.h> found." >&4
20473                         val2="$define"
20474                 else
20475 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20476                 fi
20477         else
20478                 if $test `./findhdr sgtty.h`; then
20479                         echo "<sgtty.h> found." >&4
20480                         val2="$define"
20481                 elif $test `./findhdr termio.h`; then
20482                         echo "<termio.h> found." >&4
20483                         val="$define"
20484                 else
20485 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20486                 fi
20487         fi;;
20488 esac
20489 set i_termio; eval $setvar
20490 val=$val2; set i_sgtty; eval $setvar
20491 val=$val3; set i_termios; eval $setvar
20492
20493 : see if stddef is available
20494 set stddef.h i_stddef
20495 eval $inhdr
20496
20497 : see if this is a sunmath.h system
20498 set sunmath.h i_sunmath
20499 eval $inhdr
20500
20501 : see if sys/access.h is available
20502 set sys/access.h i_sysaccess
20503 eval $inhdr
20504
20505 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20506 set sys/filio.h i_sysfilio
20507 eval $inhdr
20508 echo " "
20509 if $test `./findhdr sys/ioctl.h`; then
20510         val="$define"
20511         echo '<sys/ioctl.h> found.' >&4
20512 else
20513         val="$undef"
20514         if $test $i_sysfilio = "$define"; then
20515             echo '<sys/ioctl.h> NOT found.' >&4
20516         else
20517                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20518                 $test $i_termio = "$define" && xxx="termio.h"
20519                 $test $i_termios = "$define" && xxx="termios.h"
20520 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20521         fi
20522 fi
20523 set i_sysioctl
20524 eval $setvar
20525
20526 : see if socket ioctl defs are in sys/sockio.h
20527 echo " "
20528 xxx=`./findhdr sys/sockio.h`
20529 if $test "$xxx"; then
20530         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20531                 val="$define"
20532                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20533         else
20534                 val="$undef"
20535                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20536         fi
20537 else
20538         val="$undef"
20539         $cat <<EOM
20540 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20541 EOM
20542 fi
20543 set i_syssockio
20544 eval $setvar
20545
20546
20547 : see if this is a syslog.h system
20548 set syslog.h i_syslog
20549 eval $inhdr
20550
20551
20552 : see if this is a sys/mode.h system
20553 set sys/mode.h i_sysmode
20554 eval $inhdr
20555
20556 : see if sys/resource.h has to be included
20557 set sys/resource.h i_sysresrc
20558 eval $inhdr
20559
20560 : see if sys/security.h is available
20561 set sys/security.h i_syssecrt
20562 eval $inhdr
20563
20564 : see if this is a sys/statvfs.h system
20565 set sys/statvfs.h i_sysstatvfs
20566 eval $inhdr
20567
20568 : see if this is a sys/un.h system
20569 set sys/un.h i_sysun
20570 eval $inhdr
20571
20572
20573 : see if this is a sys/utsname.h system
20574 set sys/utsname.h i_sysutsname
20575 eval $inhdr
20576
20577 : see if this is a syswait system
20578 set sys/wait.h i_syswait
20579 eval $inhdr
20580
20581 : see if this is a ustat.h system
20582 set ustat.h i_ustat
20583 eval $inhdr
20584
20585 : see if this is an utime system
20586 set utime.h i_utime
20587 eval $inhdr
20588
20589 : see if this is a values.h system
20590 set values.h i_values
20591 eval $inhdr
20592
20593 : see if this is a vfork system
20594 case "$d_vfork" in
20595 "$define")
20596         set vfork.h i_vfork
20597         eval $inhdr
20598         ;;
20599 *)
20600         i_vfork="$undef"
20601         ;;
20602 esac
20603
20604 : see if gdbm.h is available
20605 set gdbm.h t_gdbm
20606 eval $inhdr
20607 case "$t_gdbm" in
20608 $define)
20609         : see if gdbm_open exists
20610         set gdbm_open d_gdbm_open
20611         eval $inlibc
20612         case "$d_gdbm_open" in
20613         $undef)
20614                 t_gdbm="$undef"
20615                 echo "We won't be including <gdbm.h>"
20616                 ;;
20617         esac
20618         ;;
20619 esac
20620 val="$t_gdbm"
20621 set i_gdbm
20622 eval $setvar
20623
20624 echo " "
20625 echo "Looking for extensions..." >&4
20626 : If we are using the old config.sh, known_extensions may contain
20627 : old or inaccurate or duplicate values.
20628 known_extensions=''
20629 nonxs_extensions=''
20630 : We do not use find because it might not be available.
20631 : We do not just use MANIFEST because the user may have dropped
20632 : some additional extensions into the source tree and expect them
20633 : to be built.
20634
20635 : Function to recursively find available extensions, ignoring DynaLoader
20636 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20637 find_extensions='
20638     for xxx in *; do
20639        case "$xxx" in
20640            DynaLoader|dynaload) ;;
20641            *)
20642            if $test -f $xxx/$xxx.xs; then
20643                known_extensions="$known_extensions $1$xxx";
20644            elif $test -f $xxx/Makefile.PL; then
20645                nonxs_extensions="$nonxs_extensions $1$xxx";
20646            else
20647                if $test -d $xxx -a $# -lt 10; then
20648                    set $1$xxx/ $*;
20649                    cd "$xxx";
20650                    eval $find_extensions;
20651                    cd ..;
20652                    shift;
20653                fi;
20654            fi
20655            ;;
20656        esac;
20657     done'
20658 tdir=`pwd`
20659 cd "$rsrc/ext"
20660 set X
20661 shift
20662 eval $find_extensions
20663 # Special case:  Add in threads/shared since it is not picked up by the
20664 # recursive find above (and adding in general recursive finding breaks
20665 # SDBM_File/sdbm).  A.D.  10/25/2001.
20666 known_extensions="$known_extensions threads/shared"
20667 set X $nonxs_extensions
20668 shift
20669 nonxs_extensions="$*"
20670 set X $known_extensions
20671 shift
20672 known_extensions="$*"
20673 cd "$tdir"
20674
20675 : Now see which are supported on this system.
20676 avail_ext=''
20677 for xxx in $known_extensions ; do
20678         case "$xxx" in
20679         DB_File|db_file)
20680                 case "$i_db" in
20681                 $define) avail_ext="$avail_ext $xxx" ;;
20682                 esac
20683                 ;;
20684         GDBM_File|gdbm_fil)
20685                 case "$i_gdbm" in 
20686                 $define) avail_ext="$avail_ext $xxx" ;;
20687                 esac
20688                 ;;
20689         I18N/Langinfo|i18n_lan)
20690                 case "$i_langinfo$d_nl_langinfo" in 
20691                 $define$define) avail_ext="$avail_ext $xxx" ;;
20692                 esac
20693                 ;;
20694         NDBM_File|ndbm_fil)
20695                 case "$i_ndbm" in
20696                 $define)
20697                     case "$osname-$use64bitint" in
20698                     hpux-define)
20699                         case "$libs" in
20700                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
20701                         esac
20702                         ;;
20703                     *) avail_ext="$avail_ext $xxx" ;;
20704                     esac
20705                     ;;
20706                 esac
20707                 ;;
20708         ODBM_File|odbm_fil) 
20709                 case "${i_dbm}${i_rpcsvcdbm}" in
20710                 *"${define}"*)
20711                     case "$osname-$use64bitint" in
20712                     hpux-define)
20713                         case "$libs" in
20714                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
20715                         esac
20716                         ;;
20717                     *) avail_ext="$avail_ext $xxx" ;;
20718                     esac
20719                     ;;
20720                 esac
20721                 ;;
20722         POSIX|posix)
20723                 case "$useposix" in
20724                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20725                 esac
20726                 ;;
20727         Opcode|opcode)
20728                 case "$useopcode" in
20729                 true|define|y) avail_ext="$avail_ext $xxx" ;;
20730                 esac
20731                 ;;
20732         Socket|socket)
20733                 case "$d_socket" in 
20734                 true|$define|y)
20735                     case "$osname" in
20736                     beos) ;; # not unless BONE
20737                     *) avail_ext="$avail_ext $xxx" ;;
20738                     esac
20739                     ;;
20740                 esac
20741                 ;;
20742         Sys/Syslog|sys/syslog)
20743                 : XXX syslog requires socket
20744                 case "$d_socket" in 
20745                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
20746                 esac
20747                 ;;
20748         Thread|thread)
20749                 case "$usethreads" in
20750                 true|$define|y)
20751                         case "$useithreads" in
20752                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
20753                         esac
20754                 esac
20755                 ;;
20756         XS/APItest|xs/apitest)
20757                 # This is just for testing.  Skip it unless we have dynamic loading.
20758
20759                 case "$usedl" in
20760                 $define) avail_ext="$avail_ext $xxx" ;;
20761                 esac
20762                 ;;
20763         XS/Typemap|xs/typemap)
20764                 # This is just for testing.  Skip it unless we have dynamic loading.
20765                 case "$usedl" in
20766                 $define) avail_ext="$avail_ext $xxx" ;;
20767                 esac
20768                 ;;
20769         threads|threads/shared)
20770                 # threads and threads::shared are special cases.
20771                 # To stop people from asking "Perl 5.8.0 was supposed
20772                 # to have this new fancy threads implementation but my
20773                 # perl doesn't have it" and from people trying to
20774                 # (re)install the threads module using CPAN.pm and
20775                 # CPAN.pm then offering to reinstall Perl 5.8.0,
20776                 # the threads.pm and threads/shared.pm will always be
20777                 # there, croaking informatively ("you need to rebuild
20778                 # all of Perl with threads, sorry") when threads haven't
20779                 # been compiled in.
20780                 # --jhi
20781                 avail_ext="$avail_ext $xxx"
20782                 ;;
20783         IPC/SysV|ipc/sysv)
20784                 : XXX Do we need a useipcsysv variable here
20785                 case "${d_msg}${d_sem}${d_shm}" in 
20786                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
20787                 esac
20788                 ;;
20789         *)      avail_ext="$avail_ext $xxx"
20790                 ;;
20791         esac
20792 done
20793
20794 set X $avail_ext
20795 shift
20796 avail_ext="$*"
20797
20798 case "$onlyextensions" in
20799 '') ;;
20800 *)  keepextensions=''
20801     echo "You have requested that only certains extensions be included..." >&4
20802     for i in $onlyextensions; do
20803         case " $avail_ext " in
20804         *" $i "*)
20805             echo "Keeping extension $i."
20806             keepextensions="$keepextensions $i"
20807             ;;
20808         *) echo "Ignoring extension $i." ;;
20809         esac
20810     done
20811     avail_ext="$keepextensions"
20812     ;;
20813 esac
20814
20815 case "$noextensions" in
20816 '') ;;
20817 *)  keepextensions=''
20818     echo "You have requested that certain extensions be ignored..." >&4
20819     for i in $avail_ext; do
20820         case " $noextensions " in
20821         *" $i "*) echo "Ignoring extension $i." ;;
20822         *) echo "Keeping extension $i.";
20823            keepextensions="$keepextensions $i"
20824            ;;
20825         esac
20826     done
20827     avail_ext="$keepextensions"
20828     ;;
20829 esac
20830
20831 : Now see which nonxs extensions are supported on this system.
20832 : For now assume all are.
20833 nonxs_ext=''
20834 for xxx in $nonxs_extensions ; do
20835         case "$xxx" in
20836         *)      nonxs_ext="$nonxs_ext $xxx"
20837                 ;;
20838         esac
20839 done
20840
20841 set X $nonxs_ext
20842 shift
20843 nonxs_ext="$*"
20844
20845 case $usedl in
20846 $define)
20847         $cat <<EOM
20848 A number of extensions are supplied with $package.  You may choose to
20849 compile these extensions for dynamic loading (the default), compile
20850 them into the $package executable (static loading), or not include
20851 them at all.  Answer "none" to include no extensions.
20852 Note that DynaLoader is always built and need not be mentioned here.
20853
20854 EOM
20855         case "$dynamic_ext" in
20856         '')
20857                 : Exclude those listed in static_ext
20858                 dflt=''
20859                 for xxx in $avail_ext; do
20860                         case " $static_ext " in
20861                         *" $xxx "*) ;;
20862                         *) dflt="$dflt $xxx" ;;
20863                         esac
20864                 done
20865                 set X $dflt
20866                 shift
20867                 dflt="$*"
20868                 ;;
20869         *)      dflt="$dynamic_ext"
20870                 # Perhaps we are reusing an old out-of-date config.sh.
20871                 case "$hint" in
20872                 previous)
20873                         if test X"$dynamic_ext" != X"$avail_ext"; then
20874                                 $cat <<EOM
20875 NOTICE:  Your previous config.sh list may be incorrect. 
20876 The extensions now available to you are 
20877         ${avail_ext}
20878 but the default list from your previous config.sh is
20879         ${dynamic_ext} 
20880
20881 EOM
20882                         fi
20883                         ;;
20884                 esac
20885                 ;;
20886         esac
20887         case "$dflt" in
20888         '')     dflt=none;;
20889         esac
20890         rp="What extensions do you wish to load dynamically?"
20891         . ./myread
20892         case "$ans" in
20893         none) dynamic_ext=' ' ;;
20894         *) dynamic_ext="$ans" ;;
20895         esac
20896
20897         case "$static_ext" in
20898         '')
20899                 : Exclude those already listed in dynamic linking
20900                 dflt=''
20901                 for xxx in $avail_ext; do
20902                         case " $dynamic_ext " in
20903                         *" $xxx "*) ;;
20904                         *) dflt="$dflt $xxx" ;;
20905                         esac
20906                 done
20907                 set X $dflt
20908                 shift
20909                 dflt="$*"
20910                 ;;
20911         *)  dflt="$static_ext" 
20912                 ;;
20913         esac
20914
20915         case "$dflt" in
20916         '')     dflt=none;;
20917         esac
20918         rp="What extensions do you wish to load statically?"
20919         . ./myread
20920         case "$ans" in
20921         none) static_ext=' ' ;;
20922         *) static_ext="$ans" ;;
20923         esac
20924         ;;
20925 *)
20926         $cat <<EOM
20927 A number of extensions are supplied with $package.  Answer "none" 
20928 to include no extensions. 
20929 Note that DynaLoader is always built and need not be mentioned here.
20930
20931 EOM
20932         case "$static_ext" in
20933         '') dflt="$avail_ext" ;;
20934         *)      dflt="$static_ext"
20935                 # Perhaps we are reusing an old out-of-date config.sh.
20936                 case "$hint" in
20937                 previous)
20938                         if test X"$static_ext" != X"$avail_ext"; then
20939                                 $cat <<EOM
20940 NOTICE:  Your previous config.sh list may be incorrect. 
20941 The extensions now available to you are 
20942         ${avail_ext}
20943 but the default list from your previous config.sh is
20944         ${static_ext} 
20945
20946 EOM
20947                         fi
20948                         ;;
20949                 esac
20950                 ;;
20951         esac
20952         : Exclude those that are not xs extensions
20953         case "$dflt" in
20954         '')     dflt=none;;
20955         esac
20956         rp="What extensions do you wish to include?"
20957         . ./myread
20958         case "$ans" in
20959         none) static_ext=' ' ;;
20960         *) static_ext="$ans" ;;
20961         esac
20962         ;;
20963 esac
20964 #        
20965 # Encode is a special case.  If we are building Encode as a static
20966 # extension, we need to explicitly list its subextensions as well.
20967 # For other nested extensions, this is handled automatically by
20968 # the appropriate Makefile.PL.
20969 case " $static_ext " in
20970         *" Encode "*) # Add the subextensions of Encode
20971         cd "$rsrc/ext"
20972         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
20973                 static_ext="$static_ext Encode/$xxx"
20974         done
20975         cd "$tdir"
20976         ;;
20977 esac
20978
20979 set X $dynamic_ext $static_ext $nonxs_ext
20980 shift
20981 extensions="$*"
20982
20983 # Sanity check:  We require an extension suitable for use with
20984 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
20985 # should show up as failures in the test suite, but it's helpful to
20986 # catch them now.) The 'extensions' list is normally sorted
20987 # alphabetically, so we need to accept either
20988 #    DB_File ... Fcntl ... IO  ....
20989 # or something like
20990 #    Fcntl ... NDBM_File ... IO  ....
20991 case " $extensions"  in
20992 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
20993 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
20994 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
20995 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
20996    echo "WARNING: The Perl you are building will be quite crippled." >& 4
20997    ;;
20998 esac
20999
21000 : Remove libraries needed only for extensions
21001 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21002 : The exception is SunOS 4.x, which needs them.
21003 case "${osname}X${osvers}" in
21004 sunos*X4*)
21005     perllibs="$libs"
21006     ;;
21007 *) case "$usedl" in
21008     $define|true|[yY]*)
21009             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21010             shift
21011             perllibs="$*"
21012             ;;
21013     *)  perllibs="$libs"
21014             ;;
21015     esac
21016     ;;
21017 esac
21018
21019 : Remove build directory name from cppstdin so it can be used from
21020 : either the present location or the final installed location.
21021 echo " "
21022 : Get out of the UU directory to get correct path name.
21023 cd ..
21024 case "$cppstdin" in
21025 `pwd`/cppstdin)
21026         echo "Stripping down cppstdin path name"
21027         cppstdin=cppstdin
21028         ;;
21029 esac
21030 cd UU
21031
21032 : end of configuration questions
21033 echo " "
21034 echo "End of configuration questions."
21035 echo " "
21036
21037 : back to where it started
21038 if test -d ../UU; then
21039         cd ..
21040 fi
21041
21042 : configuration may be patched via a 'config.arch' file
21043 if $test -f config.arch; then
21044         echo "I see a config.arch file, loading it."
21045         . ./config.arch
21046 fi
21047
21048 : configuration may be patched via a 'config.over' file
21049 if $test -f config.over; then
21050         echo " "
21051         dflt=y
21052         rp='I see a config.over file.  Do you wish to load it?'
21053         . UU/myread
21054         case "$ans" in
21055         n*) echo "OK, I'll ignore it.";;
21056         *)      . ./config.over
21057                 echo "Configuration override changes have been loaded."
21058                 ;;
21059         esac
21060 fi
21061
21062 : in case they want portability, strip down executable paths
21063 case "$d_portable" in
21064 "$define")
21065         echo " "
21066         echo "Stripping down executable paths..." >&4
21067         for file in $loclist $trylist; do
21068                 eval temp=\$$file
21069                 eval $file=`basename $temp`
21070         done
21071         ;;
21072 esac
21073
21074 : create config.sh file
21075 echo " "
21076 echo "Creating config.sh..." >&4
21077 $spitshell <<EOT >config.sh
21078 $startsh
21079 #
21080 # This file was produced by running the Configure script. It holds all the
21081 # definitions figured out by Configure. Should you modify one of these values,
21082 # do not forget to propagate your changes by running "Configure -der". You may
21083 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21084 #
21085
21086 # Package name      : $package
21087 # Source directory  : $src
21088 # Configuration time: $cf_time
21089 # Configured by     : $cf_by
21090 # Target system     : $myuname
21091
21092 Author='$Author'
21093 Date='$Date'
21094 Header='$Header'
21095 Id='$Id'
21096 Locker='$Locker'
21097 Log='$Log'
21098 Mcc='$Mcc'
21099 RCSfile='$RCSfile'
21100 Revision='$Revision'
21101 Source='$Source'
21102 State='$State'
21103 _a='$_a'
21104 _exe='$_exe'
21105 _o='$_o'
21106 afs='$afs'
21107 afsroot='$afsroot'
21108 alignbytes='$alignbytes'
21109 ansi2knr='$ansi2knr'
21110 aphostname='$aphostname'
21111 api_revision='$api_revision'
21112 api_subversion='$api_subversion'
21113 api_version='$api_version'
21114 api_versionstring='$api_versionstring'
21115 ar='$ar'
21116 archlib='$archlib'
21117 archlibexp='$archlibexp'
21118 archname64='$archname64'
21119 archname='$archname'
21120 archobjs='$archobjs'
21121 asctime_r_proto='$asctime_r_proto'
21122 awk='$awk'
21123 baserev='$baserev'
21124 bash='$bash'
21125 bin='$bin'
21126 binexp='$binexp'
21127 bison='$bison'
21128 byacc='$byacc'
21129 byteorder='$byteorder'
21130 c='$c'
21131 castflags='$castflags'
21132 cat='$cat'
21133 cc='$cc'
21134 cccdlflags='$cccdlflags'
21135 ccdlflags='$ccdlflags'
21136 ccflags='$ccflags'
21137 ccflags_uselargefiles='$ccflags_uselargefiles'
21138 ccname='$ccname'
21139 ccsymbols='$ccsymbols'
21140 ccversion='$ccversion'
21141 cf_by='$cf_by'
21142 cf_email='$cf_email'
21143 cf_time='$cf_time'
21144 charsize='$charsize'
21145 chgrp='$chgrp'
21146 chmod='$chmod'
21147 chown='$chown'
21148 clocktype='$clocktype'
21149 comm='$comm'
21150 compress='$compress'
21151 contains='$contains'
21152 cp='$cp'
21153 cpio='$cpio'
21154 cpp='$cpp'
21155 cpp_stuff='$cpp_stuff'
21156 cppccsymbols='$cppccsymbols'
21157 cppflags='$cppflags'
21158 cpplast='$cpplast'
21159 cppminus='$cppminus'
21160 cpprun='$cpprun'
21161 cppstdin='$cppstdin'
21162 cppsymbols='$cppsymbols'
21163 crypt_r_proto='$crypt_r_proto'
21164 cryptlib='$cryptlib'
21165 csh='$csh'
21166 ctermid_r_proto='$ctermid_r_proto'
21167 ctime_r_proto='$ctime_r_proto'
21168 d_Gconvert='$d_Gconvert'
21169 d_PRIEUldbl='$d_PRIEUldbl'
21170 d_PRIFUldbl='$d_PRIFUldbl'
21171 d_PRIGUldbl='$d_PRIGUldbl'
21172 d_PRIXU64='$d_PRIXU64'
21173 d_PRId64='$d_PRId64'
21174 d_PRIeldbl='$d_PRIeldbl'
21175 d_PRIfldbl='$d_PRIfldbl'
21176 d_PRIgldbl='$d_PRIgldbl'
21177 d_PRIi64='$d_PRIi64'
21178 d_PRIo64='$d_PRIo64'
21179 d_PRIu64='$d_PRIu64'
21180 d_PRIx64='$d_PRIx64'
21181 d_SCNfldbl='$d_SCNfldbl'
21182 d__fwalk='$d__fwalk'
21183 d_access='$d_access'
21184 d_accessx='$d_accessx'
21185 d_aintl='$d_aintl'
21186 d_alarm='$d_alarm'
21187 d_archlib='$d_archlib'
21188 d_asctime_r='$d_asctime_r'
21189 d_atolf='$d_atolf'
21190 d_atoll='$d_atoll'
21191 d_attribute_format='$d_attribute_format'
21192 d_attribute_malloc='$d_attribute_malloc'
21193 d_attribute_nonnull='$d_attribute_nonnull'
21194 d_attribute_noreturn='$d_attribute_noreturn'
21195 d_attribute_pure='$d_attribute_pure'
21196 d_attribute_unused='$d_attribute_unused'
21197 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21198 d_bcmp='$d_bcmp'
21199 d_bcopy='$d_bcopy'
21200 d_bsd='$d_bsd'
21201 d_bsdgetpgrp='$d_bsdgetpgrp'
21202 d_bsdsetpgrp='$d_bsdsetpgrp'
21203 d_builtin_choose_expr='$d_builtin_choose_expr'
21204 d_builtin_expect='$d_builtin_expect'
21205 d_bzero='$d_bzero'
21206 d_casti32='$d_casti32'
21207 d_castneg='$d_castneg'
21208 d_charvspr='$d_charvspr'
21209 d_chown='$d_chown'
21210 d_chroot='$d_chroot'
21211 d_chsize='$d_chsize'
21212 d_class='$d_class'
21213 d_clearenv='$d_clearenv'
21214 d_closedir='$d_closedir'
21215 d_cmsghdr_s='$d_cmsghdr_s'
21216 d_const='$d_const'
21217 d_copysignl='$d_copysignl'
21218 d_crypt='$d_crypt'
21219 d_crypt_r='$d_crypt_r'
21220 d_csh='$d_csh'
21221 d_ctermid_r='$d_ctermid_r'
21222 d_ctime_r='$d_ctime_r'
21223 d_cuserid='$d_cuserid'
21224 d_dbl_dig='$d_dbl_dig'
21225 d_dbminitproto='$d_dbminitproto'
21226 d_difftime='$d_difftime'
21227 d_dirfd='$d_dirfd'
21228 d_dirnamlen='$d_dirnamlen'
21229 d_dlerror='$d_dlerror'
21230 d_dlopen='$d_dlopen'
21231 d_dlsymun='$d_dlsymun'
21232 d_dosuid='$d_dosuid'
21233 d_drand48_r='$d_drand48_r'
21234 d_drand48proto='$d_drand48proto'
21235 d_dup2='$d_dup2'
21236 d_eaccess='$d_eaccess'
21237 d_endgrent='$d_endgrent'
21238 d_endgrent_r='$d_endgrent_r'
21239 d_endhent='$d_endhent'
21240 d_endhostent_r='$d_endhostent_r'
21241 d_endnent='$d_endnent'
21242 d_endnetent_r='$d_endnetent_r'
21243 d_endpent='$d_endpent'
21244 d_endprotoent_r='$d_endprotoent_r'
21245 d_endpwent='$d_endpwent'
21246 d_endpwent_r='$d_endpwent_r'
21247 d_endsent='$d_endsent'
21248 d_endservent_r='$d_endservent_r'
21249 d_eofnblk='$d_eofnblk'
21250 d_eunice='$d_eunice'
21251 d_faststdio='$d_faststdio'
21252 d_fchdir='$d_fchdir'
21253 d_fchmod='$d_fchmod'
21254 d_fchown='$d_fchown'
21255 d_fcntl='$d_fcntl'
21256 d_fcntl_can_lock='$d_fcntl_can_lock'
21257 d_fd_macros='$d_fd_macros'
21258 d_fd_set='$d_fd_set'
21259 d_fds_bits='$d_fds_bits'
21260 d_fgetpos='$d_fgetpos'
21261 d_finite='$d_finite'
21262 d_finitel='$d_finitel'
21263 d_flexfnam='$d_flexfnam'
21264 d_flock='$d_flock'
21265 d_flockproto='$d_flockproto'
21266 d_fork='$d_fork'
21267 d_fp_class='$d_fp_class'
21268 d_fpathconf='$d_fpathconf'
21269 d_fpclass='$d_fpclass'
21270 d_fpclassify='$d_fpclassify'
21271 d_fpclassl='$d_fpclassl'
21272 d_fpos64_t='$d_fpos64_t'
21273 d_frexpl='$d_frexpl'
21274 d_fs_data_s='$d_fs_data_s'
21275 d_fseeko='$d_fseeko'
21276 d_fsetpos='$d_fsetpos'
21277 d_fstatfs='$d_fstatfs'
21278 d_fstatvfs='$d_fstatvfs'
21279 d_fsync='$d_fsync'
21280 d_ftello='$d_ftello'
21281 d_ftime='$d_ftime'
21282 d_futimes='$d_futimes'
21283 d_getcwd='$d_getcwd'
21284 d_getespwnam='$d_getespwnam'
21285 d_getfsstat='$d_getfsstat'
21286 d_getgrent='$d_getgrent'
21287 d_getgrent_r='$d_getgrent_r'
21288 d_getgrgid_r='$d_getgrgid_r'
21289 d_getgrnam_r='$d_getgrnam_r'
21290 d_getgrps='$d_getgrps'
21291 d_gethbyaddr='$d_gethbyaddr'
21292 d_gethbyname='$d_gethbyname'
21293 d_gethent='$d_gethent'
21294 d_gethname='$d_gethname'
21295 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21296 d_gethostbyname_r='$d_gethostbyname_r'
21297 d_gethostent_r='$d_gethostent_r'
21298 d_gethostprotos='$d_gethostprotos'
21299 d_getitimer='$d_getitimer'
21300 d_getlogin='$d_getlogin'
21301 d_getlogin_r='$d_getlogin_r'
21302 d_getmnt='$d_getmnt'
21303 d_getmntent='$d_getmntent'
21304 d_getnbyaddr='$d_getnbyaddr'
21305 d_getnbyname='$d_getnbyname'
21306 d_getnent='$d_getnent'
21307 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21308 d_getnetbyname_r='$d_getnetbyname_r'
21309 d_getnetent_r='$d_getnetent_r'
21310 d_getnetprotos='$d_getnetprotos'
21311 d_getpagsz='$d_getpagsz'
21312 d_getpbyname='$d_getpbyname'
21313 d_getpbynumber='$d_getpbynumber'
21314 d_getpent='$d_getpent'
21315 d_getpgid='$d_getpgid'
21316 d_getpgrp2='$d_getpgrp2'
21317 d_getpgrp='$d_getpgrp'
21318 d_getppid='$d_getppid'
21319 d_getprior='$d_getprior'
21320 d_getprotobyname_r='$d_getprotobyname_r'
21321 d_getprotobynumber_r='$d_getprotobynumber_r'
21322 d_getprotoent_r='$d_getprotoent_r'
21323 d_getprotoprotos='$d_getprotoprotos'
21324 d_getprpwnam='$d_getprpwnam'
21325 d_getpwent='$d_getpwent'
21326 d_getpwent_r='$d_getpwent_r'
21327 d_getpwnam_r='$d_getpwnam_r'
21328 d_getpwuid_r='$d_getpwuid_r'
21329 d_getsbyname='$d_getsbyname'
21330 d_getsbyport='$d_getsbyport'
21331 d_getsent='$d_getsent'
21332 d_getservbyname_r='$d_getservbyname_r'
21333 d_getservbyport_r='$d_getservbyport_r'
21334 d_getservent_r='$d_getservent_r'
21335 d_getservprotos='$d_getservprotos'
21336 d_getspnam='$d_getspnam'
21337 d_getspnam_r='$d_getspnam_r'
21338 d_gettimeod='$d_gettimeod'
21339 d_gmtime_r='$d_gmtime_r'
21340 d_gnulibc='$d_gnulibc'
21341 d_grpasswd='$d_grpasswd'
21342 d_hasmntopt='$d_hasmntopt'
21343 d_htonl='$d_htonl'
21344 d_ilogbl='$d_ilogbl'
21345 d_index='$d_index'
21346 d_inetaton='$d_inetaton'
21347 d_int64_t='$d_int64_t'
21348 d_isascii='$d_isascii'
21349 d_isfinite='$d_isfinite'
21350 d_isinf='$d_isinf'
21351 d_isnan='$d_isnan'
21352 d_isnanl='$d_isnanl'
21353 d_killpg='$d_killpg'
21354 d_lchown='$d_lchown'
21355 d_ldbl_dig='$d_ldbl_dig'
21356 d_libm_lib_version='$d_libm_lib_version'
21357 d_link='$d_link'
21358 d_localtime_r='$d_localtime_r'
21359 d_locconv='$d_locconv'
21360 d_lockf='$d_lockf'
21361 d_longdbl='$d_longdbl'
21362 d_longlong='$d_longlong'
21363 d_lseekproto='$d_lseekproto'
21364 d_lstat='$d_lstat'
21365 d_madvise='$d_madvise'
21366 d_malloc_good_size='$d_malloc_good_size'
21367 d_malloc_size='$d_malloc_size'
21368 d_mblen='$d_mblen'
21369 d_mbstowcs='$d_mbstowcs'
21370 d_mbtowc='$d_mbtowc'
21371 d_memchr='$d_memchr'
21372 d_memcmp='$d_memcmp'
21373 d_memcpy='$d_memcpy'
21374 d_memmove='$d_memmove'
21375 d_memset='$d_memset'
21376 d_mkdir='$d_mkdir'
21377 d_mkdtemp='$d_mkdtemp'
21378 d_mkfifo='$d_mkfifo'
21379 d_mkstemp='$d_mkstemp'
21380 d_mkstemps='$d_mkstemps'
21381 d_mktime='$d_mktime'
21382 d_mmap='$d_mmap'
21383 d_modfl='$d_modfl'
21384 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21385 d_modflproto='$d_modflproto'
21386 d_mprotect='$d_mprotect'
21387 d_msg='$d_msg'
21388 d_msg_ctrunc='$d_msg_ctrunc'
21389 d_msg_dontroute='$d_msg_dontroute'
21390 d_msg_oob='$d_msg_oob'
21391 d_msg_peek='$d_msg_peek'
21392 d_msg_proxy='$d_msg_proxy'
21393 d_msgctl='$d_msgctl'
21394 d_msgget='$d_msgget'
21395 d_msghdr_s='$d_msghdr_s'
21396 d_msgrcv='$d_msgrcv'
21397 d_msgsnd='$d_msgsnd'
21398 d_msync='$d_msync'
21399 d_munmap='$d_munmap'
21400 d_mymalloc='$d_mymalloc'
21401 d_nice='$d_nice'
21402 d_nl_langinfo='$d_nl_langinfo'
21403 d_nv_preserves_uv='$d_nv_preserves_uv'
21404 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21405 d_off64_t='$d_off64_t'
21406 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21407 d_oldpthreads='$d_oldpthreads'
21408 d_oldsock='$d_oldsock'
21409 d_open3='$d_open3'
21410 d_pathconf='$d_pathconf'
21411 d_pause='$d_pause'
21412 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21413 d_phostname='$d_phostname'
21414 d_pipe='$d_pipe'
21415 d_poll='$d_poll'
21416 d_portable='$d_portable'
21417 d_procselfexe='$d_procselfexe'
21418 d_pthread_atfork='$d_pthread_atfork'
21419 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21420 d_pthread_yield='$d_pthread_yield'
21421 d_pwage='$d_pwage'
21422 d_pwchange='$d_pwchange'
21423 d_pwclass='$d_pwclass'
21424 d_pwcomment='$d_pwcomment'
21425 d_pwexpire='$d_pwexpire'
21426 d_pwgecos='$d_pwgecos'
21427 d_pwpasswd='$d_pwpasswd'
21428 d_pwquota='$d_pwquota'
21429 d_qgcvt='$d_qgcvt'
21430 d_quad='$d_quad'
21431 d_random_r='$d_random_r'
21432 d_readdir64_r='$d_readdir64_r'
21433 d_readdir='$d_readdir'
21434 d_readdir_r='$d_readdir_r'
21435 d_readlink='$d_readlink'
21436 d_readv='$d_readv'
21437 d_recvmsg='$d_recvmsg'
21438 d_rename='$d_rename'
21439 d_rewinddir='$d_rewinddir'
21440 d_rmdir='$d_rmdir'
21441 d_safebcpy='$d_safebcpy'
21442 d_safemcpy='$d_safemcpy'
21443 d_sanemcmp='$d_sanemcmp'
21444 d_sbrkproto='$d_sbrkproto'
21445 d_scalbnl='$d_scalbnl'
21446 d_sched_yield='$d_sched_yield'
21447 d_scm_rights='$d_scm_rights'
21448 d_seekdir='$d_seekdir'
21449 d_select='$d_select'
21450 d_sem='$d_sem'
21451 d_semctl='$d_semctl'
21452 d_semctl_semid_ds='$d_semctl_semid_ds'
21453 d_semctl_semun='$d_semctl_semun'
21454 d_semget='$d_semget'
21455 d_semop='$d_semop'
21456 d_sendmsg='$d_sendmsg'
21457 d_setegid='$d_setegid'
21458 d_seteuid='$d_seteuid'
21459 d_setgrent='$d_setgrent'
21460 d_setgrent_r='$d_setgrent_r'
21461 d_setgrps='$d_setgrps'
21462 d_sethent='$d_sethent'
21463 d_sethostent_r='$d_sethostent_r'
21464 d_setitimer='$d_setitimer'
21465 d_setlinebuf='$d_setlinebuf'
21466 d_setlocale='$d_setlocale'
21467 d_setlocale_r='$d_setlocale_r'
21468 d_setnent='$d_setnent'
21469 d_setnetent_r='$d_setnetent_r'
21470 d_setpent='$d_setpent'
21471 d_setpgid='$d_setpgid'
21472 d_setpgrp2='$d_setpgrp2'
21473 d_setpgrp='$d_setpgrp'
21474 d_setprior='$d_setprior'
21475 d_setproctitle='$d_setproctitle'
21476 d_setprotoent_r='$d_setprotoent_r'
21477 d_setpwent='$d_setpwent'
21478 d_setpwent_r='$d_setpwent_r'
21479 d_setregid='$d_setregid'
21480 d_setresgid='$d_setresgid'
21481 d_setresuid='$d_setresuid'
21482 d_setreuid='$d_setreuid'
21483 d_setrgid='$d_setrgid'
21484 d_setruid='$d_setruid'
21485 d_setsent='$d_setsent'
21486 d_setservent_r='$d_setservent_r'
21487 d_setsid='$d_setsid'
21488 d_setvbuf='$d_setvbuf'
21489 d_sfio='$d_sfio'
21490 d_shm='$d_shm'
21491 d_shmat='$d_shmat'
21492 d_shmatprototype='$d_shmatprototype'
21493 d_shmctl='$d_shmctl'
21494 d_shmdt='$d_shmdt'
21495 d_shmget='$d_shmget'
21496 d_sigaction='$d_sigaction'
21497 d_sigprocmask='$d_sigprocmask'
21498 d_sigsetjmp='$d_sigsetjmp'
21499 d_snprintf='$d_snprintf'
21500 d_sockatmark='$d_sockatmark'
21501 d_sockatmarkproto='$d_sockatmarkproto'
21502 d_socket='$d_socket'
21503 d_socklen_t='$d_socklen_t'
21504 d_sockpair='$d_sockpair'
21505 d_socks5_init='$d_socks5_init'
21506 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21507 d_sqrtl='$d_sqrtl'
21508 d_srand48_r='$d_srand48_r'
21509 d_srandom_r='$d_srandom_r'
21510 d_sresgproto='$d_sresgproto'
21511 d_sresuproto='$d_sresuproto'
21512 d_statblks='$d_statblks'
21513 d_statfs_f_flags='$d_statfs_f_flags'
21514 d_statfs_s='$d_statfs_s'
21515 d_statvfs='$d_statvfs'
21516 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21517 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21518 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21519 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21520 d_stdio_stream_array='$d_stdio_stream_array'
21521 d_stdiobase='$d_stdiobase'
21522 d_stdstdio='$d_stdstdio'
21523 d_strchr='$d_strchr'
21524 d_strcoll='$d_strcoll'
21525 d_strctcpy='$d_strctcpy'
21526 d_strerrm='$d_strerrm'
21527 d_strerror='$d_strerror'
21528 d_strerror_r='$d_strerror_r'
21529 d_strftime='$d_strftime'
21530 d_strlcat='$d_strlcat'
21531 d_strlcpy='$d_strlcpy'
21532 d_strtod='$d_strtod'
21533 d_strtol='$d_strtol'
21534 d_strtold='$d_strtold'
21535 d_strtoll='$d_strtoll'
21536 d_strtoq='$d_strtoq'
21537 d_strtoul='$d_strtoul'
21538 d_strtoull='$d_strtoull'
21539 d_strtouq='$d_strtouq'
21540 d_strxfrm='$d_strxfrm'
21541 d_suidsafe='$d_suidsafe'
21542 d_symlink='$d_symlink'
21543 d_syscall='$d_syscall'
21544 d_syscallproto='$d_syscallproto'
21545 d_sysconf='$d_sysconf'
21546 d_sysernlst='$d_sysernlst'
21547 d_syserrlst='$d_syserrlst'
21548 d_system='$d_system'
21549 d_tcgetpgrp='$d_tcgetpgrp'
21550 d_tcsetpgrp='$d_tcsetpgrp'
21551 d_telldir='$d_telldir'
21552 d_telldirproto='$d_telldirproto'
21553 d_time='$d_time'
21554 d_times='$d_times'
21555 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21556 d_tm_tm_zone='$d_tm_tm_zone'
21557 d_tmpnam_r='$d_tmpnam_r'
21558 d_truncate='$d_truncate'
21559 d_ttyname_r='$d_ttyname_r'
21560 d_tzname='$d_tzname'
21561 d_u32align='$d_u32align'
21562 d_ualarm='$d_ualarm'
21563 d_umask='$d_umask'
21564 d_uname='$d_uname'
21565 d_union_semun='$d_union_semun'
21566 d_unordered='$d_unordered'
21567 d_unsetenv='$d_unsetenv'
21568 d_usleep='$d_usleep'
21569 d_usleepproto='$d_usleepproto'
21570 d_ustat='$d_ustat'
21571 d_vendorarch='$d_vendorarch'
21572 d_vendorbin='$d_vendorbin'
21573 d_vendorlib='$d_vendorlib'
21574 d_vendorscript='$d_vendorscript'
21575 d_vfork='$d_vfork'
21576 d_void_closedir='$d_void_closedir'
21577 d_voidsig='$d_voidsig'
21578 d_voidtty='$d_voidtty'
21579 d_volatile='$d_volatile'
21580 d_vprintf='$d_vprintf'
21581 d_vsnprintf='$d_vsnprintf'
21582 d_wait4='$d_wait4'
21583 d_waitpid='$d_waitpid'
21584 d_wcstombs='$d_wcstombs'
21585 d_wctomb='$d_wctomb'
21586 d_writev='$d_writev'
21587 d_xenix='$d_xenix'
21588 date='$date'
21589 db_hashtype='$db_hashtype'
21590 db_prefixtype='$db_prefixtype'
21591 db_version_major='$db_version_major'
21592 db_version_minor='$db_version_minor'
21593 db_version_patch='$db_version_patch'
21594 defvoidused='$defvoidused'
21595 direntrytype='$direntrytype'
21596 dlext='$dlext'
21597 dlsrc='$dlsrc'
21598 doublesize='$doublesize'
21599 drand01='$drand01'
21600 drand48_r_proto='$drand48_r_proto'
21601 dynamic_ext='$dynamic_ext'
21602 eagain='$eagain'
21603 ebcdic='$ebcdic'
21604 echo='$echo'
21605 egrep='$egrep'
21606 emacs='$emacs'
21607 endgrent_r_proto='$endgrent_r_proto'
21608 endhostent_r_proto='$endhostent_r_proto'
21609 endnetent_r_proto='$endnetent_r_proto'
21610 endprotoent_r_proto='$endprotoent_r_proto'
21611 endpwent_r_proto='$endpwent_r_proto'
21612 endservent_r_proto='$endservent_r_proto'
21613 eunicefix='$eunicefix'
21614 exe_ext='$exe_ext'
21615 expr='$expr'
21616 extensions='$extensions'
21617 extras='$extras'
21618 fflushNULL='$fflushNULL'
21619 fflushall='$fflushall'
21620 find='$find'
21621 firstmakefile='$firstmakefile'
21622 flex='$flex'
21623 fpossize='$fpossize'
21624 fpostype='$fpostype'
21625 freetype='$freetype'
21626 from='$from'
21627 full_ar='$full_ar'
21628 full_csh='$full_csh'
21629 full_sed='$full_sed'
21630 gccansipedantic='$gccansipedantic'
21631 gccosandvers='$gccosandvers'
21632 gccversion='$gccversion'
21633 getgrent_r_proto='$getgrent_r_proto'
21634 getgrgid_r_proto='$getgrgid_r_proto'
21635 getgrnam_r_proto='$getgrnam_r_proto'
21636 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21637 gethostbyname_r_proto='$gethostbyname_r_proto'
21638 gethostent_r_proto='$gethostent_r_proto'
21639 getlogin_r_proto='$getlogin_r_proto'
21640 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21641 getnetbyname_r_proto='$getnetbyname_r_proto'
21642 getnetent_r_proto='$getnetent_r_proto'
21643 getprotobyname_r_proto='$getprotobyname_r_proto'
21644 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21645 getprotoent_r_proto='$getprotoent_r_proto'
21646 getpwent_r_proto='$getpwent_r_proto'
21647 getpwnam_r_proto='$getpwnam_r_proto'
21648 getpwuid_r_proto='$getpwuid_r_proto'
21649 getservbyname_r_proto='$getservbyname_r_proto'
21650 getservbyport_r_proto='$getservbyport_r_proto'
21651 getservent_r_proto='$getservent_r_proto'
21652 getspnam_r_proto='$getspnam_r_proto'
21653 gidformat='$gidformat'
21654 gidsign='$gidsign'
21655 gidsize='$gidsize'
21656 gidtype='$gidtype'
21657 glibpth='$glibpth'
21658 gmake='$gmake'
21659 gmtime_r_proto='$gmtime_r_proto'
21660 gnulibc_version='$gnulibc_version'
21661 grep='$grep'
21662 groupcat='$groupcat'
21663 groupstype='$groupstype'
21664 gzip='$gzip'
21665 h_fcntl='$h_fcntl'
21666 h_sysfile='$h_sysfile'
21667 hint='$hint'
21668 hostcat='$hostcat'
21669 html1dir='$html1dir'
21670 html1direxp='$html1direxp'
21671 html3dir='$html3dir'
21672 html3direxp='$html3direxp'
21673 i16size='$i16size'
21674 i16type='$i16type'
21675 i32size='$i32size'
21676 i32type='$i32type'
21677 i64size='$i64size'
21678 i64type='$i64type'
21679 i8size='$i8size'
21680 i8type='$i8type'
21681 i_arpainet='$i_arpainet'
21682 i_bsdioctl='$i_bsdioctl'
21683 i_crypt='$i_crypt'
21684 i_db='$i_db'
21685 i_dbm='$i_dbm'
21686 i_dirent='$i_dirent'
21687 i_dld='$i_dld'
21688 i_dlfcn='$i_dlfcn'
21689 i_fcntl='$i_fcntl'
21690 i_float='$i_float'
21691 i_fp='$i_fp'
21692 i_fp_class='$i_fp_class'
21693 i_gdbm='$i_gdbm'
21694 i_grp='$i_grp'
21695 i_ieeefp='$i_ieeefp'
21696 i_inttypes='$i_inttypes'
21697 i_langinfo='$i_langinfo'
21698 i_libutil='$i_libutil'
21699 i_limits='$i_limits'
21700 i_locale='$i_locale'
21701 i_machcthr='$i_machcthr'
21702 i_malloc='$i_malloc'
21703 i_math='$i_math'
21704 i_memory='$i_memory'
21705 i_mntent='$i_mntent'
21706 i_ndbm='$i_ndbm'
21707 i_netdb='$i_netdb'
21708 i_neterrno='$i_neterrno'
21709 i_netinettcp='$i_netinettcp'
21710 i_niin='$i_niin'
21711 i_poll='$i_poll'
21712 i_prot='$i_prot'
21713 i_pthread='$i_pthread'
21714 i_pwd='$i_pwd'
21715 i_rpcsvcdbm='$i_rpcsvcdbm'
21716 i_sfio='$i_sfio'
21717 i_sgtty='$i_sgtty'
21718 i_shadow='$i_shadow'
21719 i_socks='$i_socks'
21720 i_stdarg='$i_stdarg'
21721 i_stddef='$i_stddef'
21722 i_stdlib='$i_stdlib'
21723 i_string='$i_string'
21724 i_sunmath='$i_sunmath'
21725 i_sysaccess='$i_sysaccess'
21726 i_sysdir='$i_sysdir'
21727 i_sysfile='$i_sysfile'
21728 i_sysfilio='$i_sysfilio'
21729 i_sysin='$i_sysin'
21730 i_sysioctl='$i_sysioctl'
21731 i_syslog='$i_syslog'
21732 i_sysmman='$i_sysmman'
21733 i_sysmode='$i_sysmode'
21734 i_sysmount='$i_sysmount'
21735 i_sysndir='$i_sysndir'
21736 i_sysparam='$i_sysparam'
21737 i_sysresrc='$i_sysresrc'
21738 i_syssecrt='$i_syssecrt'
21739 i_sysselct='$i_sysselct'
21740 i_syssockio='$i_syssockio'
21741 i_sysstat='$i_sysstat'
21742 i_sysstatfs='$i_sysstatfs'
21743 i_sysstatvfs='$i_sysstatvfs'
21744 i_systime='$i_systime'
21745 i_systimek='$i_systimek'
21746 i_systimes='$i_systimes'
21747 i_systypes='$i_systypes'
21748 i_sysuio='$i_sysuio'
21749 i_sysun='$i_sysun'
21750 i_sysutsname='$i_sysutsname'
21751 i_sysvfs='$i_sysvfs'
21752 i_syswait='$i_syswait'
21753 i_termio='$i_termio'
21754 i_termios='$i_termios'
21755 i_time='$i_time'
21756 i_unistd='$i_unistd'
21757 i_ustat='$i_ustat'
21758 i_utime='$i_utime'
21759 i_values='$i_values'
21760 i_varargs='$i_varargs'
21761 i_varhdr='$i_varhdr'
21762 i_vfork='$i_vfork'
21763 ignore_versioned_solibs='$ignore_versioned_solibs'
21764 inc_version_list='$inc_version_list'
21765 inc_version_list_init='$inc_version_list_init'
21766 incpath='$incpath'
21767 inews='$inews'
21768 installarchlib='$installarchlib'
21769 installbin='$installbin'
21770 installhtml1dir='$installhtml1dir'
21771 installhtml3dir='$installhtml3dir'
21772 installman1dir='$installman1dir'
21773 installman3dir='$installman3dir'
21774 installprefix='$installprefix'
21775 installprefixexp='$installprefixexp'
21776 installprivlib='$installprivlib'
21777 installscript='$installscript'
21778 installsitearch='$installsitearch'
21779 installsitebin='$installsitebin'
21780 installsitehtml1dir='$installsitehtml1dir'
21781 installsitehtml3dir='$installsitehtml3dir'
21782 installsitelib='$installsitelib'
21783 installsiteman1dir='$installsiteman1dir'
21784 installsiteman3dir='$installsiteman3dir'
21785 installsitescript='$installsitescript'
21786 installstyle='$installstyle'
21787 installusrbinperl='$installusrbinperl'
21788 installvendorarch='$installvendorarch'
21789 installvendorbin='$installvendorbin'
21790 installvendorhtml1dir='$installvendorhtml1dir'
21791 installvendorhtml3dir='$installvendorhtml3dir'
21792 installvendorlib='$installvendorlib'
21793 installvendorman1dir='$installvendorman1dir'
21794 installvendorman3dir='$installvendorman3dir'
21795 installvendorscript='$installvendorscript'
21796 intsize='$intsize'
21797 issymlink='$issymlink'
21798 ivdformat='$ivdformat'
21799 ivsize='$ivsize'
21800 ivtype='$ivtype'
21801 known_extensions='$known_extensions'
21802 ksh='$ksh'
21803 ld='$ld'
21804 lddlflags='$lddlflags'
21805 ldflags='$ldflags'
21806 ldflags_uselargefiles='$ldflags_uselargefiles'
21807 ldlibpthname='$ldlibpthname'
21808 less='$less'
21809 lib_ext='$lib_ext'
21810 libc='$libc'
21811 libperl='$libperl'
21812 libpth='$libpth'
21813 libs='$libs'
21814 libsdirs='$libsdirs'
21815 libsfiles='$libsfiles'
21816 libsfound='$libsfound'
21817 libspath='$libspath'
21818 libswanted='$libswanted'
21819 libswanted_uselargefiles='$libswanted_uselargefiles'
21820 line='$line'
21821 lint='$lint'
21822 lkflags='$lkflags'
21823 ln='$ln'
21824 lns='$lns'
21825 localtime_r_proto='$localtime_r_proto'
21826 locincpth='$locincpth'
21827 loclibpth='$loclibpth'
21828 longdblsize='$longdblsize'
21829 longlongsize='$longlongsize'
21830 longsize='$longsize'
21831 lp='$lp'
21832 lpr='$lpr'
21833 ls='$ls'
21834 lseeksize='$lseeksize'
21835 lseektype='$lseektype'
21836 mad='$mad'
21837 mail='$mail'
21838 mailx='$mailx'
21839 make='$make'
21840 make_set_make='$make_set_make'
21841 mallocobj='$mallocobj'
21842 mallocsrc='$mallocsrc'
21843 madlyh='$madlyh'
21844 madlyobj='$madlyobj'
21845 madlysrc='$madlysrc'
21846 malloctype='$malloctype'
21847 man1dir='$man1dir'
21848 man1direxp='$man1direxp'
21849 man1ext='$man1ext'
21850 man3dir='$man3dir'
21851 man3direxp='$man3direxp'
21852 man3ext='$man3ext'
21853 mips_type='$mips_type'
21854 mistrustnm='$mistrustnm'
21855 mkdir='$mkdir'
21856 mmaptype='$mmaptype'
21857 modetype='$modetype'
21858 more='$more'
21859 multiarch='$multiarch'
21860 mv='$mv'
21861 myarchname='$myarchname'
21862 mydomain='$mydomain'
21863 myhostname='$myhostname'
21864 myuname='$myuname'
21865 n='$n'
21866 need_va_copy='$need_va_copy'
21867 netdb_hlen_type='$netdb_hlen_type'
21868 netdb_host_type='$netdb_host_type'
21869 netdb_name_type='$netdb_name_type'
21870 netdb_net_type='$netdb_net_type'
21871 nm='$nm'
21872 nm_opt='$nm_opt'
21873 nm_so_opt='$nm_so_opt'
21874 nonxs_ext='$nonxs_ext'
21875 nroff='$nroff'
21876 nvEUformat='$nvEUformat'
21877 nvFUformat='$nvFUformat'
21878 nvGUformat='$nvGUformat'
21879 nv_preserves_uv_bits='$nv_preserves_uv_bits'
21880 nveformat='$nveformat'
21881 nvfformat='$nvfformat'
21882 nvgformat='$nvgformat'
21883 nvsize='$nvsize'
21884 nvtype='$nvtype'
21885 o_nonblock='$o_nonblock'
21886 obj_ext='$obj_ext'
21887 old_pthread_create_joinable='$old_pthread_create_joinable'
21888 optimize='$optimize'
21889 orderlib='$orderlib'
21890 osname='$osname'
21891 osvers='$osvers'
21892 otherlibdirs='$otherlibdirs'
21893 package='$package'
21894 pager='$pager'
21895 passcat='$passcat'
21896 patchlevel='$patchlevel'
21897 path_sep='$path_sep'
21898 perl5='$perl5'
21899 perl='$perl'
21900 perl_patchlevel='$perl_patchlevel'
21901 perladmin='$perladmin'
21902 perllibs='$perllibs'
21903 perlpath='$perlpath'
21904 pg='$pg'
21905 phostname='$phostname'
21906 pidtype='$pidtype'
21907 plibpth='$plibpth'
21908 pmake='$pmake'
21909 pr='$pr'
21910 prefix='$prefix'
21911 prefixexp='$prefixexp'
21912 privlib='$privlib'
21913 privlibexp='$privlibexp'
21914 procselfexe='$procselfexe'
21915 prototype='$prototype'
21916 ptrsize='$ptrsize'
21917 quadkind='$quadkind'
21918 quadtype='$quadtype'
21919 randbits='$randbits'
21920 randfunc='$randfunc'
21921 random_r_proto='$random_r_proto'
21922 randseedtype='$randseedtype'
21923 ranlib='$ranlib'
21924 rd_nodata='$rd_nodata'
21925 readdir64_r_proto='$readdir64_r_proto'
21926 readdir_r_proto='$readdir_r_proto'
21927 revision='$revision'
21928 rm='$rm'
21929 rmail='$rmail'
21930 run='$run'
21931 runnm='$runnm'
21932 sPRIEUldbl='$sPRIEUldbl'
21933 sPRIFUldbl='$sPRIFUldbl'
21934 sPRIGUldbl='$sPRIGUldbl'
21935 sPRIXU64='$sPRIXU64'
21936 sPRId64='$sPRId64'
21937 sPRIeldbl='$sPRIeldbl'
21938 sPRIfldbl='$sPRIfldbl'
21939 sPRIgldbl='$sPRIgldbl'
21940 sPRIi64='$sPRIi64'
21941 sPRIo64='$sPRIo64'
21942 sPRIu64='$sPRIu64'
21943 sPRIx64='$sPRIx64'
21944 sSCNfldbl='$sSCNfldbl'
21945 sched_yield='$sched_yield'
21946 scriptdir='$scriptdir'
21947 scriptdirexp='$scriptdirexp'
21948 sed='$sed'
21949 seedfunc='$seedfunc'
21950 selectminbits='$selectminbits'
21951 selecttype='$selecttype'
21952 sendmail='$sendmail'
21953 setgrent_r_proto='$setgrent_r_proto'
21954 sethostent_r_proto='$sethostent_r_proto'
21955 setlocale_r_proto='$setlocale_r_proto'
21956 setnetent_r_proto='$setnetent_r_proto'
21957 setprotoent_r_proto='$setprotoent_r_proto'
21958 setpwent_r_proto='$setpwent_r_proto'
21959 setservent_r_proto='$setservent_r_proto'
21960 sh='$sh'
21961 shar='$shar'
21962 sharpbang='$sharpbang'
21963 shmattype='$shmattype'
21964 shortsize='$shortsize'
21965 shrpenv='$shrpenv'
21966 shsharp='$shsharp'
21967 sig_count='$sig_count'
21968 sig_name='$sig_name'
21969 sig_name_init='$sig_name_init'
21970 sig_num='$sig_num'
21971 sig_num_init='$sig_num_init'
21972 sig_size='$sig_size'
21973 signal_t='$signal_t'
21974 sitearch='$sitearch'
21975 sitearchexp='$sitearchexp'
21976 sitebin='$sitebin'
21977 sitebinexp='$sitebinexp'
21978 sitehtml1dir='$sitehtml1dir'
21979 sitehtml1direxp='$sitehtml1direxp'
21980 sitehtml3dir='$sitehtml3dir'
21981 sitehtml3direxp='$sitehtml3direxp'
21982 sitelib='$sitelib'
21983 sitelib_stem='$sitelib_stem'
21984 sitelibexp='$sitelibexp'
21985 siteman1dir='$siteman1dir'
21986 siteman1direxp='$siteman1direxp'
21987 siteman3dir='$siteman3dir'
21988 siteman3direxp='$siteman3direxp'
21989 siteprefix='$siteprefix'
21990 siteprefixexp='$siteprefixexp'
21991 sitescript='$sitescript'
21992 sitescriptexp='$sitescriptexp'
21993 sizesize='$sizesize'
21994 sizetype='$sizetype'
21995 sleep='$sleep'
21996 smail='$smail'
21997 so='$so'
21998 sockethdr='$sockethdr'
21999 socketlib='$socketlib'
22000 socksizetype='$socksizetype'
22001 sort='$sort'
22002 spackage='$spackage'
22003 spitshell='$spitshell'
22004 srand48_r_proto='$srand48_r_proto'
22005 srandom_r_proto='$srandom_r_proto'
22006 src='$src'
22007 ssizetype='$ssizetype'
22008 startperl='$startperl'
22009 startsh='$startsh'
22010 static_ext='$static_ext'
22011 stdchar='$stdchar'
22012 stdio_base='$stdio_base'
22013 stdio_bufsiz='$stdio_bufsiz'
22014 stdio_cnt='$stdio_cnt'
22015 stdio_filbuf='$stdio_filbuf'
22016 stdio_ptr='$stdio_ptr'
22017 stdio_stream_array='$stdio_stream_array'
22018 strerror_r_proto='$strerror_r_proto'
22019 strings='$strings'
22020 submit='$submit'
22021 subversion='$subversion'
22022 sysman='$sysman'
22023 tail='$tail'
22024 tar='$tar'
22025 targetarch='$targetarch'
22026 tbl='$tbl'
22027 tee='$tee'
22028 test='$test'
22029 timeincl='$timeincl'
22030 timetype='$timetype'
22031 tmpnam_r_proto='$tmpnam_r_proto'
22032 to='$to'
22033 touch='$touch'
22034 tr='$tr'
22035 trnl='$trnl'
22036 troff='$troff'
22037 ttyname_r_proto='$ttyname_r_proto'
22038 u16size='$u16size'
22039 u16type='$u16type'
22040 u32size='$u32size'
22041 u32type='$u32type'
22042 u64size='$u64size'
22043 u64type='$u64type'
22044 u8size='$u8size'
22045 u8type='$u8type'
22046 uidformat='$uidformat'
22047 uidsign='$uidsign'
22048 uidsize='$uidsize'
22049 uidtype='$uidtype'
22050 uname='$uname'
22051 uniq='$uniq'
22052 uquadtype='$uquadtype'
22053 use5005threads='$use5005threads'
22054 use64bitall='$use64bitall'
22055 use64bitint='$use64bitint'
22056 usecrosscompile='$usecrosscompile'
22057 usedl='$usedl'
22058 usefaststdio='$usefaststdio'
22059 useithreads='$useithreads'
22060 uselargefiles='$uselargefiles'
22061 uselongdouble='$uselongdouble'
22062 usemallocwrap='$usemallocwrap'
22063 usemorebits='$usemorebits'
22064 usemultiplicity='$usemultiplicity'
22065 usemymalloc='$usemymalloc'
22066 usenm='$usenm'
22067 useopcode='$useopcode'
22068 useperlio='$useperlio'
22069 useposix='$useposix'
22070 usereentrant='$usereentrant'
22071 initialinstalllocation="$initialinstalllocation"
22072 userelocatableinc='$userelocatableinc'
22073 usesfio='$usesfio'
22074 useshrplib='$useshrplib'
22075 usesitecustomize='$usesitecustomize'
22076 usesocks='$usesocks'
22077 usethreads='$usethreads'
22078 usevendorprefix='$usevendorprefix'
22079 usevfork='$usevfork'
22080 usrinc='$usrinc'
22081 uuname='$uuname'
22082 uvXUformat='$uvXUformat'
22083 uvoformat='$uvoformat'
22084 uvsize='$uvsize'
22085 uvtype='$uvtype'
22086 uvuformat='$uvuformat'
22087 uvxformat='$uvxformat'
22088 vendorarch='$vendorarch'
22089 vendorarchexp='$vendorarchexp'
22090 vendorbin='$vendorbin'
22091 vendorbinexp='$vendorbinexp'
22092 vendorhtml1dir='$vendorhtml1dir'
22093 vendorhtml1direxp='$vendorhtml1direxp'
22094 vendorhtml3dir='$vendorhtml3dir'
22095 vendorhtml3direxp='$vendorhtml3direxp'
22096 vendorlib='$vendorlib'
22097 vendorlib_stem='$vendorlib_stem'
22098 vendorlibexp='$vendorlibexp'
22099 vendorman1dir='$vendorman1dir'
22100 vendorman1direxp='$vendorman1direxp'
22101 vendorman3dir='$vendorman3dir'
22102 vendorman3direxp='$vendorman3direxp'
22103 vendorprefix='$vendorprefix'
22104 vendorprefixexp='$vendorprefixexp'
22105 vendorscript='$vendorscript'
22106 vendorscriptexp='$vendorscriptexp'
22107 version='$version'
22108 version_patchlevel_string='$version_patchlevel_string'
22109 versiononly='$versiononly'
22110 vi='$vi'
22111 voidflags='$voidflags'
22112 xlibpth='$xlibpth'
22113 yacc='$yacc'
22114 yaccflags='$yaccflags'
22115 zcat='$zcat'
22116 zip='$zip'
22117 EOT
22118
22119 : Add in command line options if available
22120 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22121
22122 : add special variables
22123 $test -f $src/patchlevel.h && \
22124 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22125 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22126 echo "PERL_CONFIG_SH=true" >>config.sh
22127
22128 : propagate old symbols
22129 if $test -f UU/config.sh; then
22130         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22131         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22132         $sort | $uniq -u >UU/oldsyms
22133         set X `cat UU/oldsyms`
22134         shift
22135         case $# in
22136         0) ;;
22137         *)
22138                 cat <<EOM
22139 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22140 EOM
22141                 echo "# Variables propagated from previous config.sh file." >>config.sh
22142                 for sym in `cat UU/oldsyms`; do
22143                         echo "    Propagating $hint variable "'$'"$sym..."
22144                         eval 'tmp="$'"${sym}"'"'
22145                         echo "$tmp" | \
22146                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22147                 done
22148                 ;;
22149         esac
22150 fi
22151
22152 : Finish up by extracting the .SH files
22153 case "$alldone" in
22154 exit)
22155         $rm -rf UU
22156         echo "Extraction done."
22157         exit 0
22158         ;;
22159 cont)
22160         ;;
22161 '')
22162         dflt=''
22163         nostick=true
22164         $cat <<EOM
22165
22166 If you'd like to make any changes to the config.sh file before I begin
22167 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22168
22169 EOM
22170         rp="Press return or use a shell escape to edit config.sh:"
22171         . UU/myread
22172         nostick=''
22173         case "$ans" in
22174         '') ;;
22175         *) : in case they cannot read
22176                 sh 1>&4 -c "$ans";;
22177         esac
22178         ;;
22179 esac
22180
22181 : if this fails, just run all the .SH files by hand
22182 . ./config.sh
22183
22184 echo " "
22185 exec 1>&4
22186 pwd=`pwd`
22187 . ./UU/extract
22188 cd "$pwd"
22189
22190 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22191         dflt=y
22192         case "$silent" in
22193         true) ;;
22194         *)
22195                 $cat <<EOM
22196
22197 Now you need to generate make dependencies by running "$make depend".
22198 You might prefer to run it in background: "$make depend > makedepend.out &"
22199 It can take a while, so you might not want to run it right now.
22200
22201 EOM
22202                 ;;
22203         esac
22204         rp="Run $make depend now?"
22205         . UU/myread
22206         case "$ans" in
22207         y*)
22208                 $make depend && echo "Now you must run '$make'."
22209                 ;;
22210         *)
22211                 echo "You must run '$make depend' then '$make'."
22212                 ;;
22213         esac
22214 elif test -f [Mm]akefile; then
22215         echo " "
22216         echo "Now you must run a $make."
22217 else
22218         echo "Configure done."
22219 fi
22220
22221 if $test -f Policy.sh; then
22222     $cat <<EOM
22223
22224 If you compile $package on a different machine or from a different object
22225 directory, copy the Policy.sh file from this object directory to the
22226 new one before you run Configure -- this will help you with most of
22227 the policy defaults.
22228
22229 EOM
22230 fi
22231 if $test -f config.msg; then
22232     echo "Hmm.  I also noted the following information while running:"
22233     echo " "
22234     $cat config.msg >&4
22235     $rm -f config.msg
22236 fi
22237 $rm -f kit*isdone ark*isdone
22238 $rm -rf UU
22239
22240 : End of Configure
22241