Better documentation for SVf_UTF8. Including SvPV() 1st, SvUTF() 2nd.
[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 Tue Dec  5 15:35:51 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 if test ! -c /dev/null ; then
69         cat >&4 <<EOF
70 ***
71 *** I'm sorry, but /dev/null appears to be a file rather than a device.
72 *** Please consult your operating sytem's notes for making a device
73 *** in /dev.
74 *** Cannot continue, aborting.
75 ***
76 EOF
77         exit 1
78 fi
79
80 : compute my invocation name
81 me=$0
82 case "$0" in
83 */*)
84         me=`echo $0 | sed -e 's!.*/\(.*\)!\1!' 2>/dev/null`
85         test "$me" || me=$0
86         ;;
87 esac
88
89 : Proper separator for the PATH environment variable
90 p_=:
91 : On OS/2 this directory should exist if this is not floppy only system :-]
92 if test -d c:/. || ( uname -a | grep -i 'os\(/\|\)2' ) 2>&1 >/dev/null ; then
93     if test -n "$OS2_SHELL"; then
94                 p_=\;
95                 PATH=`cmd /c "echo %PATH%" | tr '\\\\' / `
96                 OS2_SHELL=`cmd /c "echo %OS2_SHELL%" | tr '\\\\' / | tr '[A-Z]' '[a-z]'`
97                 is_os2=yes
98         elif test -n "$DJGPP"; then
99                 case "X${MACHTYPE:-nonesuchmach}" in
100                 *cygwin) ;;
101                 *) p_=\; ;;
102                 esac
103         fi
104 fi
105
106 : Proper PATH setting
107 paths='/bin /usr/bin /usr/local/bin /usr/ucb /usr/local /usr/lbin'
108 paths="$paths /opt/bin /opt/local/bin /opt/local /opt/lbin"
109 paths="$paths /usr/5bin /etc /usr/gnu/bin /usr/new /usr/new/bin /usr/nbin"
110 paths="$paths /opt/gnu/bin /opt/new /opt/new/bin /opt/nbin"
111 paths="$paths /sys5.3/bin /sys5.3/usr/bin /bsd4.3/bin /bsd4.3/usr/ucb"
112 paths="$paths /bsd4.3/usr/bin /usr/bsd /bsd43/bin /opt/ansic/bin /usr/ccs/bin"
113 paths="$paths /etc /usr/lib /usr/ucblib /lib /usr/ccs/lib"
114 paths="$paths /sbin /usr/sbin /usr/libexec"
115 paths="$paths /system/gnu_library/bin"
116
117 for p in $paths
118 do
119         case "$p_$PATH$p_" in
120         *$p_$p$p_*) ;;
121         *) test -d $p && PATH=$PATH$p_$p ;;
122         esac
123 done
124
125 PATH=.$p_$PATH
126 export PATH
127
128 : shall we be using ksh?
129 inksh=''
130 needksh=''
131 avoidksh=''
132 newsh=/bin/ksh
133 changesh=''
134 if (PATH=.; alias -x) >/dev/null 2>&1; then
135                 inksh=true
136 fi
137 if test -f /hp-ux -a -f /bin/ksh; then
138         needksh='to avoid sh bug in "here document" expansion'
139 fi
140 if test -d /usr/lpp -a -f /usr/bin/bsh -a -f /usr/bin/uname; then
141         if test X`/usr/bin/uname -v` = X4; then
142                 avoidksh="to avoid AIX 4's /bin/sh"
143                 newsh=/usr/bin/bsh
144         fi
145 fi
146 if test -f /osf_boot -a -f /usr/sbin/setld; then
147         if test X`/usr/bin/uname -s` = XOSF1; then
148                 avoidksh="to avoid Digital UNIX' ksh"
149                 newsh=/bin/sh
150                 unset BIN_SH # if this is 'xpg4' sh will start up ksh
151         fi
152 fi
153 case "$inksh/$needksh" in
154 /[a-z]*)
155                 ENV=''
156                 changesh=true
157                 reason="$needksh"
158         ;;
159 esac
160 case "$inksh/$avoidksh" in
161 true/[a-z]*)
162         changesh=true
163         reason="$avoidksh"
164         ;;
165 esac
166 case "$inksh/$needksh-$avoidksh-" in
167 true/--)
168                 cat <<EOM
169 (I see you are using the Korn shell.  Some ksh's blow up on $me,
170 mainly on older exotic systems.  If yours does, try the Bourne shell instead.)
171 EOM
172         ;;
173 esac
174 case "$changesh" in
175 true)
176         export newsh
177         echo "(Feeding myself to $newsh $reason.)"
178         case "$0" in
179         Configure|*/Configure) exec $newsh $0 "$@";;
180         *) exec $newsh Configure "$@";;
181         esac
182         ;;
183 esac
184
185 : if needed set CDPATH to a harmless value that is not chatty
186 : avoid bash 2.02 problems with empty CDPATH.
187 case "$CDPATH" in
188 '')     ;;
189 *)      case "$SHELL" in
190         *bash*) CDPATH='.' ;;
191         *)              CDPATH='' ;;
192         esac
193         ;;
194 esac
195 : Configure runs within the UU subdirectory
196 test -d UU || mkdir UU
197 cd UU && rm -f ./*
198
199 ccname=''
200 ccversion=''
201 ccsymbols=''
202 cppccsymbols=''
203 cppsymbols=''
204 from=''
205 run=''
206 targetarch=''
207 to=''
208 usecrosscompile=''
209 mistrustnm=''
210 perllibs=''
211 dynamic_ext=''
212 extensions=''
213 known_extensions=''
214 nonxs_ext=''
215 static_ext=''
216 useopcode=''
217 useposix=''
218 extras=''
219 d_bsd=''
220 d_eunice=''
221 d_xenix=''
222 eunicefix=''
223 Mcc=''
224 ar=''
225 awk=''
226 bash=''
227 bison=''
228 byacc=''
229 cat=''
230 chgrp=''
231 chmod=''
232 chown=''
233 comm=''
234 compress=''
235 cp=''
236 cpio=''
237 cpp=''
238 csh=''
239 date=''
240 echo=''
241 egrep=''
242 emacs=''
243 expr=''
244 find=''
245 flex=''
246 gmake=''
247 grep=''
248 gzip=''
249 inews=''
250 ksh=''
251 less=''
252 line=''
253 lint=''
254 ln=''
255 lp=''
256 lpr=''
257 ls=''
258 mail=''
259 mailx=''
260 make=''
261 mkdir=''
262 more=''
263 mv=''
264 nm=''
265 nroff=''
266 perl=''
267 pg=''
268 pmake=''
269 pr=''
270 rm=''
271 rmail=''
272 sed=''
273 sendmail=''
274 shar=''
275 sleep=''
276 smail=''
277 sort=''
278 submit=''
279 tail=''
280 tar=''
281 tbl=''
282 tee=''
283 test=''
284 touch=''
285 tr=''
286 troff=''
287 uname=''
288 uniq=''
289 uuname=''
290 vi=''
291 zcat=''
292 zip=''
293 full_ar=''
294 full_sed=''
295 libswanted=''
296 hint=''
297 myuname=''
298 osname=''
299 osvers=''
300 Author=''
301 Date=''
302 Header=''
303 Id=''
304 Locker=''
305 Log=''
306 RCSfile=''
307 Revision=''
308 Source=''
309 State=''
310 _a=''
311 _exe=''
312 _o=''
313 archobjs=''
314 exe_ext=''
315 firstmakefile=''
316 lib_ext=''
317 obj_ext=''
318 path_sep=''
319 afs=''
320 afsroot=''
321 alignbytes=''
322 ansi2knr=''
323 archlib=''
324 archlibexp=''
325 d_archlib=''
326 installarchlib=''
327 archname=''
328 myarchname=''
329 d_atolf=''
330 d_atoll=''
331 baserev=''
332 bin=''
333 binexp=''
334 initialinstalllocation=''
335 installbin=''
336 userelocatableinc=''
337 byteorder=''
338 cc=''
339 ccflags=''
340 cppflags=''
341 ldflags=''
342 lkflags=''
343 locincpth=''
344 optimize=''
345 cf_email=''
346 cf_by=''
347 cf_time=''
348 charsize=''
349 contains=''
350 cpp_stuff=''
351 cpplast=''
352 cppminus=''
353 cpprun=''
354 cppstdin=''
355 d__fwalk=''
356 d_access=''
357 d_accessx=''
358 d_aintl=''
359 d_alarm=''
360 asctime_r_proto=''
361 d_asctime_r=''
362 d_attribute_format=''
363 d_attribute_malloc=''
364 d_attribute_nonnull=''
365 d_attribute_noreturn=''
366 d_attribute_pure=''
367 d_attribute_unused=''
368 d_attribute_warn_unused_result=''
369 d_printf_format_null=''
370 d_bcmp=''
371 d_bcopy=''
372 d_builtin_choose_expr=''
373 d_builtin_expect=''
374 d_bzero=''
375 d_c99_variadic_macros=''
376 d_casti32=''
377 castflags=''
378 d_castneg=''
379 d_chown=''
380 d_chroot=''
381 d_chsize=''
382 d_class=''
383 d_clearenv=''
384 d_closedir=''
385 d_void_closedir=''
386 d_cmsghdr_s=''
387 d_const=''
388 d_copysignl=''
389 d_cplusplus=''
390 cryptlib=''
391 d_crypt=''
392 crypt_r_proto=''
393 d_crypt_r=''
394 d_csh=''
395 full_csh=''
396 d_ctermid=''
397 ctermid_r_proto=''
398 d_ctermid_r=''
399 ctime_r_proto=''
400 d_ctime_r=''
401 d_cuserid=''
402 d_dbl_dig=''
403 d_dbminitproto=''
404 d_difftime=''
405 d_dir_dd_fd=''
406 d_dirfd=''
407 d_dlerror=''
408 d_dlopen=''
409 d_dlsymun=''
410 d_dosuid=''
411 d_suidsafe=''
412 d_drand48_r=''
413 drand48_r_proto=''
414 d_drand48proto=''
415 d_dup2=''
416 d_eaccess=''
417 d_endgrent=''
418 d_endgrent_r=''
419 endgrent_r_proto=''
420 d_endhent=''
421 d_endhostent_r=''
422 endhostent_r_proto=''
423 d_endnent=''
424 d_endnetent_r=''
425 endnetent_r_proto=''
426 d_endpent=''
427 d_endprotoent_r=''
428 endprotoent_r_proto=''
429 d_endpwent=''
430 d_endpwent_r=''
431 endpwent_r_proto=''
432 d_endsent=''
433 d_endservent_r=''
434 endservent_r_proto=''
435 d_faststdio=''
436 d_fchdir=''
437 d_fchmod=''
438 d_fchown=''
439 d_fcntl=''
440 d_fcntl_can_lock=''
441 d_fd_macros=''
442 d_fd_set=''
443 d_fds_bits=''
444 d_fgetpos=''
445 d_finite=''
446 d_finitel=''
447 d_flexfnam=''
448 d_flock=''
449 d_flockproto=''
450 d_fork=''
451 d_fp_class=''
452 d_fpclass=''
453 d_fpclassify=''
454 d_fpclassl=''
455 d_fpos64_t=''
456 d_frexpl=''
457 d_fs_data_s=''
458 d_fseeko=''
459 d_fsetpos=''
460 d_fstatfs=''
461 d_fsync=''
462 d_ftello=''
463 d_ftime=''
464 d_gettimeod=''
465 d_futimes=''
466 d_Gconvert=''
467 d_getcwd=''
468 d_getespwnam=''
469 d_getfsstat=''
470 d_getgrent=''
471 d_getgrent_r=''
472 getgrent_r_proto=''
473 d_getgrgid_r=''
474 getgrgid_r_proto=''
475 d_getgrnam_r=''
476 getgrnam_r_proto=''
477 d_getgrps=''
478 d_gethbyaddr=''
479 d_gethbyname=''
480 d_gethent=''
481 aphostname=''
482 d_gethname=''
483 d_phostname=''
484 d_uname=''
485 d_gethostbyaddr_r=''
486 gethostbyaddr_r_proto=''
487 d_gethostbyname_r=''
488 gethostbyname_r_proto=''
489 d_gethostent_r=''
490 gethostent_r_proto=''
491 d_gethostprotos=''
492 d_getitimer=''
493 d_getlogin=''
494 d_getlogin_r=''
495 getlogin_r_proto=''
496 d_getmnt=''
497 d_getmntent=''
498 d_getnbyaddr=''
499 d_getnbyname=''
500 d_getnent=''
501 d_getnetbyaddr_r=''
502 getnetbyaddr_r_proto=''
503 d_getnetbyname_r=''
504 getnetbyname_r_proto=''
505 d_getnetent_r=''
506 getnetent_r_proto=''
507 d_getnetprotos=''
508 d_getpagsz=''
509 d_getpent=''
510 d_getpgid=''
511 d_getpgrp2=''
512 d_bsdgetpgrp=''
513 d_getpgrp=''
514 d_getppid=''
515 d_getprior=''
516 d_getpbyname=''
517 d_getpbynumber=''
518 d_getprotobyname_r=''
519 getprotobyname_r_proto=''
520 d_getprotobynumber_r=''
521 getprotobynumber_r_proto=''
522 d_getprotoent_r=''
523 getprotoent_r_proto=''
524 d_getprotoprotos=''
525 d_getprpwnam=''
526 d_getpwent=''
527 d_getpwent_r=''
528 getpwent_r_proto=''
529 d_getpwnam_r=''
530 getpwnam_r_proto=''
531 d_getpwuid_r=''
532 getpwuid_r_proto=''
533 d_getsent=''
534 d_getservbyname_r=''
535 getservbyname_r_proto=''
536 d_getservbyport_r=''
537 getservbyport_r_proto=''
538 d_getservent_r=''
539 getservent_r_proto=''
540 d_getservprotos=''
541 d_getspnam=''
542 d_getspnam_r=''
543 getspnam_r_proto=''
544 d_getsbyname=''
545 d_getsbyport=''
546 d_gmtime_r=''
547 gmtime_r_proto=''
548 d_gnulibc=''
549 gnulibc_version=''
550 d_hasmntopt=''
551 d_htonl=''
552 d_ilogbl=''
553 d_inetaton=''
554 d_int64_t=''
555 d_isascii=''
556 d_isfinite=''
557 d_isinf=''
558 d_isnan=''
559 d_isnanl=''
560 d_killpg=''
561 d_lchown=''
562 d_ldbl_dig=''
563 d_libm_lib_version=''
564 d_link=''
565 d_localtime_r=''
566 d_localtime_r_needs_tzset=''
567 localtime_r_proto=''
568 d_locconv=''
569 d_lockf=''
570 d_longdbl=''
571 longdblsize=''
572 d_longlong=''
573 longlongsize=''
574 d_lseekproto=''
575 d_lstat=''
576 d_madvise=''
577 d_malloc_good_size=''
578 d_malloc_size=''
579 d_mblen=''
580 d_mbstowcs=''
581 d_mbtowc=''
582 d_memchr=''
583 d_memcmp=''
584 d_memcpy=''
585 d_memmove=''
586 d_memset=''
587 d_mkdir=''
588 d_mkdtemp=''
589 d_mkfifo=''
590 d_mkstemp=''
591 d_mkstemps=''
592 d_mktime=''
593 d_mmap=''
594 mmaptype=''
595 d_modfl=''
596 d_modfl_pow32_bug=''
597 d_modflproto=''
598 d_mprotect=''
599 d_msg=''
600 d_msgctl=''
601 d_msgget=''
602 d_msghdr_s=''
603 d_msgrcv=''
604 d_msgsnd=''
605 d_msync=''
606 d_munmap=''
607 d_nice=''
608 d_nl_langinfo=''
609 d_off64_t=''
610 d_open3=''
611 d_fpathconf=''
612 d_pathconf=''
613 d_pause=''
614 d_pipe=''
615 d_poll=''
616 d_portable=''
617 d_procselfexe=''
618 procselfexe=''
619 d_old_pthread_create_joinable=''
620 old_pthread_create_joinable=''
621 d_pthread_atfork=''
622 d_pthread_attr_setscope=''
623 d_pthread_yield=''
624 d_sched_yield=''
625 sched_yield=''
626 d_qgcvt=''
627 d_random_r=''
628 random_r_proto=''
629 d_readdir64_r=''
630 readdir64_r_proto=''
631 d_readdir=''
632 d_rewinddir=''
633 d_seekdir=''
634 d_telldir=''
635 d_readdir_r=''
636 readdir_r_proto=''
637 d_readlink=''
638 d_readv=''
639 d_recvmsg=''
640 d_rename=''
641 d_rmdir=''
642 d_safebcpy=''
643 d_safemcpy=''
644 d_sanemcmp=''
645 d_sbrkproto=''
646 d_scalbnl=''
647 d_select=''
648 d_sem=''
649 d_semctl=''
650 d_semget=''
651 d_semop=''
652 d_sendmsg=''
653 d_setegid=''
654 d_seteuid=''
655 d_setgrent=''
656 d_setgrent_r=''
657 setgrent_r_proto=''
658 d_setgrps=''
659 d_sethent=''
660 d_sethostent_r=''
661 sethostent_r_proto=''
662 d_setitimer=''
663 d_setlinebuf=''
664 d_setlocale=''
665 d_setlocale_r=''
666 setlocale_r_proto=''
667 d_setnent=''
668 d_setnetent_r=''
669 setnetent_r_proto=''
670 d_setpent=''
671 d_setpgid=''
672 d_setpgrp2=''
673 d_bsdsetpgrp=''
674 d_setpgrp=''
675 d_setprior=''
676 d_setproctitle=''
677 d_setprotoent_r=''
678 setprotoent_r_proto=''
679 d_setpwent=''
680 d_setpwent_r=''
681 setpwent_r_proto=''
682 d_setregid=''
683 d_setresgid=''
684 d_setresuid=''
685 d_setreuid=''
686 d_setrgid=''
687 d_setruid=''
688 d_setsent=''
689 d_setservent_r=''
690 setservent_r_proto=''
691 d_setsid=''
692 d_setvbuf=''
693 d_sfio=''
694 usesfio=''
695 d_shm=''
696 d_shmat=''
697 d_shmatprototype=''
698 shmattype=''
699 d_shmctl=''
700 d_shmdt=''
701 d_shmget=''
702 d_sigaction=''
703 d_sigprocmask=''
704 d_sigsetjmp=''
705 usesitecustomize=''
706 d_snprintf=''
707 d_vsnprintf=''
708 d_sockatmark=''
709 d_sockatmarkproto=''
710 d_msg_ctrunc=''
711 d_msg_dontroute=''
712 d_msg_oob=''
713 d_msg_peek=''
714 d_msg_proxy=''
715 d_oldsock=''
716 d_scm_rights=''
717 d_socket=''
718 d_sockpair=''
719 sockethdr=''
720 socketlib=''
721 d_socklen_t=''
722 d_socks5_init=''
723 d_sprintf_returns_strlen=''
724 d_sqrtl=''
725 d_srand48_r=''
726 srand48_r_proto=''
727 d_srandom_r=''
728 srandom_r_proto=''
729 d_sresgproto=''
730 d_sresuproto=''
731 d_statblks=''
732 d_statfs_f_flags=''
733 d_statfs_s=''
734 d_fstatvfs=''
735 d_statvfs=''
736 d_stdio_cnt_lval=''
737 d_stdio_ptr_lval=''
738 d_stdio_ptr_lval_nochange_cnt=''
739 d_stdio_ptr_lval_sets_cnt=''
740 d_stdiobase=''
741 d_stdstdio=''
742 stdio_base=''
743 stdio_bufsiz=''
744 stdio_cnt=''
745 stdio_filbuf=''
746 stdio_ptr=''
747 d_index=''
748 d_strchr=''
749 d_strcoll=''
750 d_strctcpy=''
751 d_strerrm=''
752 d_strerror=''
753 d_sysernlst=''
754 d_syserrlst=''
755 d_strerror_r=''
756 strerror_r_proto=''
757 d_strftime=''
758 d_strlcat=''
759 d_strlcpy=''
760 d_strtod=''
761 d_strtol=''
762 d_strtold=''
763 d_strtoll=''
764 d_strtoq=''
765 d_strtoul=''
766 d_strtoull=''
767 d_strtouq=''
768 d_strxfrm=''
769 d_symlink=''
770 d_syscall=''
771 d_syscallproto=''
772 d_sysconf=''
773 d_system=''
774 d_tcgetpgrp=''
775 d_tcsetpgrp=''
776 d_telldirproto=''
777 d_time=''
778 timetype=''
779 clocktype=''
780 d_times=''
781 d_tmpnam_r=''
782 tmpnam_r_proto=''
783 d_truncate=''
784 d_ttyname_r=''
785 ttyname_r_proto=''
786 d_tzname=''
787 d_u32align=''
788 d_ualarm=''
789 d_umask=''
790 d_semctl_semid_ds=''
791 d_semctl_semun=''
792 d_union_semun=''
793 d_unordered=''
794 d_unsetenv=''
795 d_usleep=''
796 d_usleepproto=''
797 d_ustat=''
798 d_pseudofork=''
799 d_vfork=''
800 usevfork=''
801 d_voidsig=''
802 signal_t=''
803 d_volatile=''
804 d_charvspr=''
805 d_vprintf=''
806 d_wait4=''
807 d_waitpid=''
808 d_wcstombs=''
809 d_wctomb=''
810 d_writev=''
811 dlext=''
812 cccdlflags=''
813 ccdlflags=''
814 dlsrc=''
815 ld=''
816 lddlflags=''
817 usedl=''
818 doublesize=''
819 ebcdic=''
820 fflushNULL=''
821 fflushall=''
822 fpossize=''
823 fpostype=''
824 gccansipedantic=''
825 gccosandvers=''
826 gccversion=''
827 gidformat=''
828 gidsign=''
829 gidsize=''
830 gidtype=''
831 groupstype=''
832 h_fcntl=''
833 h_sysfile=''
834 html1dir=''
835 html1direxp=''
836 installhtml1dir=''
837 html3dir=''
838 html3direxp=''
839 installhtml3dir=''
840 i_arpainet=''
841 i_crypt=''
842 db_hashtype=''
843 db_prefixtype=''
844 db_version_major=''
845 db_version_minor=''
846 db_version_patch=''
847 i_db=''
848 i_dbm=''
849 i_rpcsvcdbm=''
850 d_dirnamlen=''
851 direntrytype=''
852 i_dirent=''
853 i_dld=''
854 i_dlfcn=''
855 i_fcntl=''
856 i_float=''
857 i_fp=''
858 i_fp_class=''
859 i_gdbm=''
860 d_grpasswd=''
861 i_grp=''
862 i_ieeefp=''
863 i_inttypes=''
864 i_langinfo=''
865 i_libutil=''
866 i_limits=''
867 i_locale=''
868 i_machcthr=''
869 i_malloc=''
870 i_math=''
871 i_memory=''
872 i_mntent=''
873 i_ndbm=''
874 i_netdb=''
875 i_neterrno=''
876 i_netinettcp=''
877 i_niin=''
878 i_sysin=''
879 i_poll=''
880 i_prot=''
881 i_pthread=''
882 d_pwage=''
883 d_pwchange=''
884 d_pwclass=''
885 d_pwcomment=''
886 d_pwexpire=''
887 d_pwgecos=''
888 d_pwpasswd=''
889 d_pwquota=''
890 i_pwd=''
891 i_sfio=''
892 i_shadow=''
893 i_socks=''
894 i_stddef=''
895 i_stdlib=''
896 i_string=''
897 strings=''
898 i_sunmath=''
899 i_sysaccess=''
900 i_sysdir=''
901 i_sysfile=''
902 d_voidtty=''
903 i_bsdioctl=''
904 i_sysfilio=''
905 i_sysioctl=''
906 i_syssockio=''
907 i_syslog=''
908 i_sysmman=''
909 i_sysmode=''
910 i_sysmount=''
911 i_sysndir=''
912 i_sysparam=''
913 i_sysresrc=''
914 i_syssecrt=''
915 i_sysselct=''
916 i_sysstat=''
917 i_sysstatfs=''
918 i_sysstatvfs=''
919 i_systimes=''
920 i_systypes=''
921 i_sysuio=''
922 i_sysun=''
923 i_sysutsname=''
924 i_sysvfs=''
925 i_syswait=''
926 i_sgtty=''
927 i_termio=''
928 i_termios=''
929 d_tm_tm_gmtoff=''
930 d_tm_tm_zone=''
931 i_systime=''
932 i_systimek=''
933 i_time=''
934 timeincl=''
935 i_unistd=''
936 i_ustat=''
937 i_utime=''
938 i_values=''
939 i_stdarg=''
940 i_varargs=''
941 i_varhdr=''
942 i_vfork=''
943 d_inc_version_list=''
944 inc_version_list=''
945 inc_version_list_init=''
946 installprefix=''
947 installprefixexp=''
948 installstyle=''
949 installusrbinperl=''
950 intsize=''
951 longsize=''
952 shortsize=''
953 issymlink=''
954 libc=''
955 ldlibpthname=''
956 libperl=''
957 shrpenv=''
958 useshrplib=''
959 glibpth=''
960 libpth=''
961 loclibpth=''
962 plibpth=''
963 xlibpth=''
964 ignore_versioned_solibs=''
965 libs=''
966 libsdirs=''
967 libsfiles=''
968 libsfound=''
969 libspath=''
970 lns=''
971 d_PRIEUldbl=''
972 d_PRIFUldbl=''
973 d_PRIGUldbl=''
974 d_PRIeldbl=''
975 d_PRIfldbl=''
976 d_PRIgldbl=''
977 d_SCNfldbl=''
978 sPRIEUldbl=''
979 sPRIFUldbl=''
980 sPRIGUldbl=''
981 sPRIeldbl=''
982 sPRIfldbl=''
983 sPRIgldbl=''
984 sSCNfldbl=''
985 lseeksize=''
986 lseektype=''
987 mad=''
988 madlyh=''
989 madlyobj=''
990 madlysrc=''
991 make_set_make=''
992 d_mymalloc=''
993 freetype=''
994 mallocobj=''
995 mallocsrc=''
996 malloctype=''
997 usemallocwrap=''
998 usemymalloc=''
999 installman1dir=''
1000 man1dir=''
1001 man1direxp=''
1002 man1ext=''
1003 installman3dir=''
1004 man3dir=''
1005 man3direxp=''
1006 man3ext=''
1007 modetype=''
1008 multiarch=''
1009 mydomain=''
1010 myhostname=''
1011 phostname=''
1012 c=''
1013 n=''
1014 d_eofnblk=''
1015 eagain=''
1016 o_nonblock=''
1017 rd_nodata=''
1018 need_va_copy=''
1019 netdb_hlen_type=''
1020 netdb_host_type=''
1021 netdb_name_type=''
1022 netdb_net_type=''
1023 groupcat=''
1024 hostcat=''
1025 passcat=''
1026 orderlib=''
1027 ranlib=''
1028 d_perl_otherlibdirs=''
1029 otherlibdirs=''
1030 package=''
1031 spackage=''
1032 pager=''
1033 api_revision=''
1034 api_subversion=''
1035 api_version=''
1036 api_versionstring=''
1037 patchlevel=''
1038 perl_patchlevel=''
1039 revision=''
1040 subversion=''
1041 version=''
1042 version_patchlevel_string=''
1043 perl5=''
1044 perladmin=''
1045 perlpath=''
1046 d_nv_preserves_uv=''
1047 d_nv_zero_is_allbits_zero=''
1048 i16size=''
1049 i16type=''
1050 i32size=''
1051 i32type=''
1052 i64size=''
1053 i64type=''
1054 i8size=''
1055 i8type=''
1056 ivsize=''
1057 ivtype=''
1058 nv_preserves_uv_bits=''
1059 nvsize=''
1060 nvtype=''
1061 u16size=''
1062 u16type=''
1063 u32size=''
1064 u32type=''
1065 u64size=''
1066 u64type=''
1067 u8size=''
1068 u8type=''
1069 uvsize=''
1070 uvtype=''
1071 ivdformat=''
1072 nvEUformat=''
1073 nvFUformat=''
1074 nvGUformat=''
1075 nveformat=''
1076 nvfformat=''
1077 nvgformat=''
1078 uvXUformat=''
1079 uvoformat=''
1080 uvuformat=''
1081 uvxformat=''
1082 pidtype=''
1083 prefix=''
1084 prefixexp=''
1085 installprivlib=''
1086 privlib=''
1087 privlibexp=''
1088 prototype=''
1089 ptrsize=''
1090 d_PRIXU64=''
1091 d_PRId64=''
1092 d_PRIi64=''
1093 d_PRIo64=''
1094 d_PRIu64=''
1095 d_PRIx64=''
1096 sPRIXU64=''
1097 sPRId64=''
1098 sPRIi64=''
1099 sPRIo64=''
1100 sPRIu64=''
1101 sPRIx64=''
1102 d_quad=''
1103 quadkind=''
1104 quadtype=''
1105 uquadtype=''
1106 drand01=''
1107 randbits=''
1108 randfunc=''
1109 randseedtype=''
1110 seedfunc=''
1111 installscript=''
1112 scriptdir=''
1113 scriptdirexp=''
1114 selectminbits=''
1115 selecttype=''
1116 sh=''
1117 sig_count=''
1118 sig_name=''
1119 sig_name_init=''
1120 sig_num=''
1121 sig_num_init=''
1122 sig_size=''
1123 d_sitearch=''
1124 installsitearch=''
1125 sitearch=''
1126 sitearchexp=''
1127 installsitebin=''
1128 sitebin=''
1129 sitebinexp=''
1130 installsitehtml1dir=''
1131 sitehtml1dir=''
1132 sitehtml1direxp=''
1133 installsitehtml3dir=''
1134 sitehtml3dir=''
1135 sitehtml3direxp=''
1136 installsitelib=''
1137 sitelib=''
1138 sitelib_stem=''
1139 sitelibexp=''
1140 installsiteman1dir=''
1141 siteman1dir=''
1142 siteman1direxp=''
1143 installsiteman3dir=''
1144 siteman3dir=''
1145 siteman3direxp=''
1146 siteprefix=''
1147 siteprefixexp=''
1148 installsitescript=''
1149 sitescript=''
1150 sitescriptexp=''
1151 sizesize=''
1152 sizetype=''
1153 so=''
1154 socksizetype=''
1155 sharpbang=''
1156 shsharp=''
1157 spitshell=''
1158 src=''
1159 ssizetype=''
1160 startperl=''
1161 startsh=''
1162 stdchar=''
1163 d_stdio_stream_array=''
1164 stdio_stream_array=''
1165 sysman=''
1166 trnl=''
1167 uidformat=''
1168 uidsign=''
1169 uidsize=''
1170 uidtype=''
1171 archname64=''
1172 use64bitall=''
1173 use64bitint=''
1174 usefaststdio=''
1175 ccflags_uselargefiles=''
1176 ldflags_uselargefiles=''
1177 libswanted_uselargefiles=''
1178 uselargefiles=''
1179 uselongdouble=''
1180 usemorebits=''
1181 usemultiplicity=''
1182 nm_opt=''
1183 nm_so_opt=''
1184 runnm=''
1185 usenm=''
1186 useperlio=''
1187 usesocks=''
1188 d_oldpthreads=''
1189 use5005threads=''
1190 useithreads=''
1191 usereentrant=''
1192 usethreads=''
1193 incpath=''
1194 mips_type=''
1195 usrinc=''
1196 d_vendorarch=''
1197 installvendorarch=''
1198 vendorarch=''
1199 vendorarchexp=''
1200 d_vendorbin=''
1201 installvendorbin=''
1202 vendorbin=''
1203 vendorbinexp=''
1204 installvendorhtml1dir=''
1205 vendorhtml1dir=''
1206 vendorhtml1direxp=''
1207 installvendorhtml3dir=''
1208 vendorhtml3dir=''
1209 vendorhtml3direxp=''
1210 d_vendorlib=''
1211 installvendorlib=''
1212 vendorlib=''
1213 vendorlib_stem=''
1214 vendorlibexp=''
1215 installvendorman1dir=''
1216 vendorman1dir=''
1217 vendorman1direxp=''
1218 installvendorman3dir=''
1219 vendorman3dir=''
1220 vendorman3direxp=''
1221 usevendorprefix=''
1222 vendorprefix=''
1223 vendorprefixexp=''
1224 d_vendorscript=''
1225 installvendorscript=''
1226 vendorscript=''
1227 vendorscriptexp=''
1228 versiononly=''
1229 defvoidused=''
1230 voidflags=''
1231 yacc=''
1232 yaccflags=''
1233 CONFIG=''
1234
1235 define='define'
1236 undef='undef'
1237 smallmach='pdp11 i8086 z8000 i80286 iAPX286'
1238 rmlist=''
1239
1240 : We must find out about Eunice early
1241 eunicefix=':'
1242 if test -f /etc/unixtovms; then
1243         eunicefix=/etc/unixtovms
1244 fi
1245 if test -f /etc/unixtovms.exe; then
1246         eunicefix=/etc/unixtovms.exe
1247 fi
1248
1249 : Set executable suffix now -- needed before hints available
1250 if test -f "/libs/version.library"; then
1251 : Amiga OS
1252     _exe=""
1253 elif test -f "/system/gnu_library/bin/ar.pm"; then
1254 : Stratus VOS
1255     _exe=".pm"
1256 elif test -n "$DJGPP"; then
1257 : DOS DJGPP
1258     _exe=".exe"
1259 elif test -d c:/. -o -n "$is_os2" ; then
1260 : OS/2 or cygwin
1261     _exe=".exe"
1262 fi
1263
1264 i_whoami=''
1265 ccname=''
1266 ccversion=''
1267 perllibs=''
1268 : set useposix=false in your hint file to disable the POSIX extension.
1269 useposix=true
1270 : set useopcode=false in your hint file to disable the Opcode extension.
1271 useopcode=true
1272 : Trailing extension.  Override this in a hint file, if needed.
1273 : Extra object files, if any, needed on this platform.
1274 archobjs=''
1275 archname=''
1276 : Possible local include directories to search.
1277 : Set locincpth to "" in a hint file to defeat local include searches.
1278 locincpth="/usr/local/include /opt/local/include /usr/gnu/include"
1279 locincpth="$locincpth /opt/gnu/include /usr/GNU/include /opt/GNU/include"
1280 :
1281 : no include file wanted by default
1282 inclwanted=''
1283
1284 : Enable -DEBUGGING and -DDEBUGGING from the command line
1285 EBUGGING=''
1286 DEBUGGING=old
1287
1288 groupstype=''
1289 libnames=''
1290 : change the next line if compiling for Xenix/286 on Xenix/386
1291 xlibpth='/usr/lib/386 /lib/386'
1292 : Possible local library directories to search.
1293 loclibpth="/usr/local/lib /opt/local/lib /usr/gnu/lib"
1294 loclibpth="$loclibpth /opt/gnu/lib /usr/GNU/lib /opt/GNU/lib"
1295
1296 : general looking path for locating libraries
1297 glibpth="/lib /usr/lib $xlibpth"
1298 glibpth="$glibpth /usr/ccs/lib /usr/ucblib /usr/local/lib"
1299 test -f /usr/shlib/libc.so && glibpth="/usr/shlib $glibpth"
1300 test -f /shlib/libc.so     && glibpth="/shlib $glibpth"
1301
1302 : Private path used by Configure to find libraries.  Its value
1303 : is prepended to libpth. This variable takes care of special
1304 : machines, like the mips.  Usually, it should be empty.
1305 plibpth=''
1306
1307 : default library list
1308 libswanted=''
1309 : some systems want to use only the non-versioned libso:s
1310 ignore_versioned_solibs=''
1311 siteman1dir=''
1312 siteman3dir=''
1313 sitescript=''
1314 archname64=''
1315 ccflags_uselargefiles=''
1316 ldflags_uselargefiles=''
1317 libswanted_uselargefiles=''
1318 : set usemultiplicity on the Configure command line to enable multiplicity.
1319 : set usesocks on the Configure command line to enable socks.
1320 : set usethreads on the Configure command line to enable threads.
1321 usereentrant='undef'
1322 : full support for void wanted by default
1323 defvoidused=15
1324
1325 : List of libraries we want.
1326 : If anyone needs extra -lxxx, put those in a hint file.
1327 libswanted="sfio socket bind inet nsl nm ndbm gdbm dbm db malloc dl dld ld sun"
1328 libswanted="$libswanted m crypt sec util c cposix posix ucb bsd BSD"
1329 : We probably want to search /usr/shlib before most other libraries.
1330 : This is only used by the lib/ExtUtils/MakeMaker.pm routine extliblist.
1331 glibpth=`echo " $glibpth " | sed -e 's! /usr/shlib ! !'`
1332 glibpth="/usr/shlib $glibpth"
1333 : Do not use vfork unless overridden by a hint file.
1334 usevfork=false
1335
1336 : Find the basic shell for Bourne shell scripts
1337 case "$sh" in
1338 '')
1339         case "$SYSTYPE" in
1340         *bsd*|sys5*) xxx="/$SYSTYPE/bin/sh";;
1341         *) xxx='/bin/sh';;
1342         esac
1343         if test -f "$xxx"; then
1344                 sh="$xxx"
1345         else
1346                 : Build up a list and do a single loop so we can 'break' out.
1347                 pth=`echo $PATH | sed -e "s/$p_/ /g"`
1348                 for xxx in sh bash ksh pdksh ash; do
1349                         for p in $pth; do
1350                                 try="$try ${p}/${xxx}"
1351                         done
1352                 done
1353                 for xxx in $try; do
1354                         if test -f "$xxx"; then
1355                                 sh="$xxx";
1356                                 break
1357                         elif test "X$_exe" != X -a -f "$xxx$_exe"; then
1358                                 sh="$xxx";
1359                                 break
1360                         elif test -f "$xxx.exe"; then
1361                                 sh="$xxx";
1362                                 break
1363                         fi
1364                 done
1365         fi
1366         ;;
1367 esac
1368
1369 case "$sh" in
1370 '')     cat >&2 <<EOM
1371 $me:  Fatal Error:  I can't find a Bourne Shell anywhere.  
1372
1373 Usually it's in /bin/sh.  How did you even get this far?
1374 Please contact me (Perl Maintainers) at perlbug@perl.org and 
1375 we'll try to straighten this all out.
1376 EOM
1377         exit 1
1378         ;;
1379 esac
1380
1381 : see if sh knows # comments
1382 if `$sh -c '#' >/dev/null 2>&1`; then
1383         shsharp=true
1384         spitshell=cat
1385         xcat=/bin/cat
1386         test -f $xcat$_exe || xcat=/usr/bin/cat
1387         if test ! -f $xcat$_exe; then
1388                 for p in `echo $PATH | sed -e "s/$p_/ /g"` $paths; do
1389                         if test -f $p/cat$_exe; then
1390                                 xcat=$p/cat
1391                                 break
1392                         fi
1393                 done
1394                 if test ! -f $xcat$_exe; then
1395                         echo "Can't find cat anywhere!"
1396                         exit 1
1397                 fi
1398         fi
1399         echo "#!$xcat" >sharp
1400         $eunicefix sharp
1401         chmod +x sharp
1402         ./sharp > today
1403         if test -s today; then
1404                 sharpbang='#!'
1405         else
1406                 echo "#! $xcat" > sharp
1407                 $eunicefix sharp
1408                 chmod +x sharp
1409                 ./sharp > today
1410                 if test -s today; then
1411                         sharpbang='#! '
1412                 else
1413                         sharpbang=': use '
1414                 fi
1415         fi
1416 else
1417         echo " "
1418         echo "Your $sh doesn't grok # comments--I will strip them later on."
1419         shsharp=false
1420         cd ..
1421         echo "exec grep -v '^[  ]*#'" >spitshell
1422         chmod +x spitshell
1423         $eunicefix spitshell
1424         spitshell=`pwd`/spitshell
1425         cd UU
1426         echo "I presume that if # doesn't work, #! won't work either!"
1427         sharpbang=': use '
1428 fi
1429 rm -f sharp today
1430
1431 : figure out how to guarantee sh startup
1432 case "$startsh" in
1433 '') startsh=${sharpbang}${sh} ;;
1434 *)
1435 esac
1436 cat >sharp <<EOSS
1437 $startsh
1438 set abc
1439 test "$?abc" != 1
1440 EOSS
1441
1442 chmod +x sharp
1443 $eunicefix sharp
1444 if ./sharp; then
1445         : echo "Yup, it does."
1446 else
1447         echo "Hmm... '$startsh' does not guarantee sh startup..."
1448         echo "You may have to fix up the shell scripts to make sure $sh runs them."
1449 fi
1450 rm -f sharp
1451
1452
1453 : Save command line options in file UU/cmdline.opt for later use in
1454 : generating config.sh.
1455 cat > cmdline.opt <<EOSH
1456 # Configure command line arguments.
1457 config_arg0='$0'
1458 config_args='$*'
1459 config_argc=$#
1460 EOSH
1461 argn=1
1462 args_exp=''
1463 args_sep=''
1464 for arg in "$@"; do
1465         cat >>cmdline.opt <<EOSH
1466 config_arg$argn='$arg'
1467 EOSH
1468         # Extreme backslashitis: replace each ' by '"'"'
1469         cat <<EOC | sed -e "s/'/'"'"'"'"'"'"'/g" > cmdl.opt
1470 $arg
1471 EOC
1472         arg_exp=`cat cmdl.opt`
1473         args_exp="$args_exp$args_sep'$arg_exp'"
1474         argn=`expr $argn + 1`
1475         args_sep=' '
1476 done
1477 # args_exp is good for restarting self: eval "set X $args_exp"; shift; $0 "$@"
1478 # used by ./hints/os2.sh
1479 rm -f cmdl.opt
1480
1481 : produce awk script to parse command line options
1482 cat >options.awk <<'EOF'
1483 BEGIN {
1484         optstr = "A:dD:eEf:hKOrsSU:V";  # getopt-style specification
1485
1486         len = length(optstr);
1487         for (i = 1; i <= len; i++) {
1488                 c = substr(optstr, i, 1);
1489                 if (i < len) a = substr(optstr, i + 1, 1); else a = "";
1490                 if (a == ":") {
1491                         arg[c] = 1;
1492                         i++;
1493                 }
1494                 opt[c] = 1;
1495         }
1496 }
1497 {
1498         expect = 0;
1499         str = $0;
1500         if (substr(str, 1, 1) != "-") {
1501                 printf("'%s'\n", str);
1502                 next;
1503         }
1504         len = length($0);
1505         for (i = 2; i <= len; i++) {
1506                 c = substr(str, i, 1);
1507                 if (!opt[c]) {
1508                         printf("-%s\n", substr(str, i));
1509                         next;
1510                 }
1511                 printf("-%s\n", c);
1512                 if (arg[c]) {
1513                         if (i < len)
1514                                 printf("'%s'\n", substr(str, i + 1));
1515                         else
1516                                 expect = 1;
1517                         next;
1518                 }
1519         }
1520 }
1521 END {
1522         if (expect)
1523                 print "?";
1524 }
1525 EOF
1526
1527 : process the command line options
1528 set X `for arg in "$@"; do echo "X$arg"; done |
1529         sed -e s/X// | awk -f options.awk`
1530 eval "set $*"
1531 shift
1532 rm -f options.awk
1533
1534 : set up default values
1535 fastread=''
1536 reuseval=false
1537 config_sh=''
1538 alldone=''
1539 error=''
1540 silent=''
1541 extractsh=''
1542 override=''
1543 knowitall=''
1544 rm -f optdef.sh posthint.sh
1545 cat >optdef.sh <<EOS
1546 $startsh
1547 EOS
1548
1549
1550 : option parsing
1551 while test $# -gt 0; do
1552         case "$1" in
1553         -d) shift; fastread=yes;;
1554         -e) shift; alldone=cont;;
1555         -f)
1556                 shift
1557                 cd ..
1558                 if test -r "$1"; then
1559                         config_sh="$1"
1560                 else
1561                         echo "$me: cannot read config file $1." >&2
1562                         error=true
1563                 fi
1564                 cd UU
1565                 shift;;
1566         -h) shift; error=true;;
1567         -r) shift; reuseval=true;;
1568         -s) shift; silent=true; realsilent=true;;
1569         -E) shift; alldone=exit;;
1570         -K) shift; knowitall=true;;
1571         -O) shift; override=true;;
1572         -S) shift; silent=true; extractsh=true;;
1573         -D)
1574                 shift
1575                 case "$1" in
1576                 *=)
1577                         echo "$me: use '-U symbol=', not '-D symbol='." >&2
1578                         echo "$me: ignoring -D $1" >&2
1579                         ;;
1580                 *=*) echo "$1" | \
1581                                 sed -e "s/'/'\"'\"'/g" -e "s/=\(.*\)/='\1'/" >> optdef.sh;;
1582                 *) echo "$1='define'" >> optdef.sh;;
1583                 esac
1584                 shift
1585                 ;;
1586         -U)
1587                 shift
1588                 case "$1" in
1589                 *=) echo "$1" >> optdef.sh;;
1590                 *=*)
1591                         echo "$me: use '-D symbol=val', not '-U symbol=val'." >&2
1592                         echo "$me: ignoring -U $1" >&2
1593                         ;;
1594                 *) echo "$1='undef'" >> optdef.sh;;
1595                 esac
1596                 shift
1597                 ;;
1598         -A)
1599             shift
1600             xxx=''
1601             yyy="$1"
1602             zzz=''
1603             uuu=undef
1604             case "$yyy" in
1605             *=*) zzz=`echo "$yyy"|sed 's!=.*!!'`
1606                  case "$zzz" in
1607                  *:*) zzz='' ;;
1608                  *)   xxx=append
1609                       zzz=" "`echo "$yyy"|sed 's!^[^=]*=!!'` 
1610                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1611                  esac
1612                  ;;
1613             esac
1614             case "$xxx" in
1615             '')  case "$yyy" in
1616                  *:*) xxx=`echo "$yyy"|sed 's!:.*!!'`
1617                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'`
1618                       zzz=`echo "$yyy"|sed 's!^[^=]*=!!'`
1619                       yyy=`echo "$yyy"|sed 's!=.*!!'` ;;
1620                  *)   xxx=`echo "$yyy"|sed 's!:.*!!'`
1621                       yyy=`echo "$yyy"|sed 's!^[^:]*:!!'` ;;
1622                  esac
1623                  ;;       
1624             esac
1625             case "$xxx" in
1626             append)
1627                 echo "$yyy=\"\${$yyy}$zzz\""    >> posthint.sh ;;
1628             clear)
1629                 echo "$yyy=''"                  >> posthint.sh ;;
1630             define)
1631                 case "$zzz" in
1632                 '') zzz=define ;;
1633                 esac
1634                 echo "$yyy='$zzz'"              >> posthint.sh ;;
1635             eval)
1636                 echo "eval \"$yyy=$zzz\""       >> posthint.sh ;;
1637             prepend)
1638                 echo "$yyy=\"$zzz\${$yyy}\""    >> posthint.sh ;;
1639             undef)
1640                 case "$zzz" in
1641                 '') zzz="$uuu" ;;
1642                 esac
1643                 echo "$yyy=$zzz"                >> posthint.sh ;;
1644             *)  echo "$me: unknown -A command '$xxx', ignoring -A $1" >&2 ;;
1645             esac
1646             shift
1647             ;;
1648         -V) echo "$me generated by metaconfig 3.0 PL70." >&2
1649             exit 0;;
1650         --) break;;
1651         -*) echo "$me: unknown option $1" >&2; shift; error=true;;
1652         *) break;;
1653         esac
1654 done
1655
1656 case "$error" in
1657 true)
1658         cat >&2 <<EOM
1659 Usage: $me [-dehrsEKOSV] [-f config.sh] [-D symbol] [-D symbol=value]
1660                  [-U symbol] [-U symbol=] [-A command:symbol...]
1661   -d : use defaults for all answers.
1662   -e : go on without questioning past the production of config.sh.
1663   -f : specify an alternate default configuration file.
1664   -h : print this help message and exit (with an error status).
1665   -r : reuse C symbols value if possible (skips costly nm extraction).
1666   -s : silent mode, only echoes questions and essential information.
1667   -D : define symbol to have some value:
1668          -D symbol         symbol gets the value 'define'
1669          -D symbol=value   symbol gets the value 'value'
1670   -E : stop at the end of questions, after having produced config.sh.
1671   -K : do not use unless you know what you are doing.
1672   -O : let -D and -U override definitions from loaded configuration file.
1673   -S : perform variable substitutions on all .SH files (can mix with -f)
1674   -U : undefine symbol:
1675          -U symbol    symbol gets the value 'undef'
1676          -U symbol=   symbol gets completely empty
1677   -A : manipulate symbol after the platform specific hints have been applied:
1678          -A symbol=value                append " "value to symbol
1679          -A append:symbol=value         append value to symbol
1680          -A define:symbol=value         define symbol to have value
1681          -A clear:symbol                define symbol to be ''
1682          -A define:symbol               define symbol to be 'define'
1683          -A eval:symbol=value           define symbol to be eval of value
1684          -A prepend:symbol=value        prepend value to symbol
1685          -A undef:symbol                define symbol to be 'undef'
1686          -A undef:symbol=               define symbol to be ''
1687   -V : print version number and exit (with a zero status).
1688 EOM
1689         exit 1
1690         ;;
1691 esac
1692
1693 : Sanity checks
1694 case "$fastread$alldone" in
1695 yescont|yesexit) ;;
1696 *)
1697         case "$extractsh" in
1698         true) ;;
1699         *)
1700                 if test ! -t 0; then
1701                         echo "Say 'sh Configure', not 'sh <Configure'"
1702                         exit 1
1703                 fi
1704                 ;;
1705         esac
1706         ;;
1707 esac
1708
1709 exec 4>&1
1710 case "$silent" in
1711 true) exec 1>/dev/null;;
1712 esac
1713
1714 : run the defines and the undefines, if any, but leave the file out there...
1715 touch optdef.sh
1716 . ./optdef.sh
1717 : create the posthint manipulation script and leave the file out there...
1718 touch posthint.sh
1719
1720 : set package name
1721 package=perl5
1722 first=`echo $package | sed -e 's/^\(.\).*/\1/'`
1723 last=`echo $package | sed -e 's/^.\(.*\)/\1/'`
1724 case "`echo AbyZ | tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
1725 ABYZ) spackage=`echo $first | tr '[:lower:]' '[:upper:]'`$last;;
1726 *) spackage=`echo $first | tr '[a-z]' '[A-Z]'`$last;;
1727 esac
1728
1729 : Some greps do not return status, grrr.
1730 echo "grimblepritz" >grimble
1731 if grep blurfldyick grimble >/dev/null 2>&1 ; then
1732         contains=contains
1733 elif grep grimblepritz grimble >/dev/null 2>&1 ; then
1734         contains=grep
1735 else
1736         contains=contains
1737 fi
1738 rm -f grimble
1739 : the following should work in any shell
1740 case "$contains" in
1741 contains*)
1742         echo " "
1743         echo "AGH!  Grep doesn't return a status.  Attempting remedial action."
1744         cat >contains <<'EOSS'
1745 grep "$1" "$2" >.greptmp && cat .greptmp && test -s .greptmp
1746 EOSS
1747 chmod +x contains
1748 esac
1749
1750 : Find the path to the source tree
1751 case "$src" in
1752 '') case "$0" in
1753     */*) src=`echo $0 | sed -e 's%/[^/][^/]*$%%'`
1754          case "$src" in
1755          /*)    ;;
1756          .)     ;;
1757          *)     src=`cd ../$src && pwd` ;;
1758          esac
1759          ;;
1760     *)   src='.';;
1761     esac;;
1762 esac
1763 case "$src" in
1764 '')     src=/
1765         rsrc=/
1766         ;;
1767 /*) rsrc="$src";;
1768 *) rsrc="../$src";;
1769 esac
1770 if test -f $rsrc/Configure && \
1771         $contains "^package=$package$" $rsrc/Configure >/dev/null 2>&1
1772 then
1773    : found it, so we are ok.
1774 else
1775         rsrc=''
1776         for src in . .. ../.. ../../.. ../../../..; do
1777                 if test -f ../$src/Configure && \
1778                         $contains "^package=$package$" ../$src/Configure >/dev/null 2>&1
1779                 then
1780                         rsrc=../$src
1781                         break
1782                 fi
1783         done
1784 fi
1785 case "$rsrc" in
1786 '')
1787         cat <<EOM >&4
1788
1789 Sorry, I can't seem to locate the source dir for $package.  Please start
1790 Configure with an explicit path -- i.e. /some/path/Configure.
1791
1792 EOM
1793         exit 1
1794         ;;
1795 ../.)   rsrc='..';;
1796 *)
1797         echo " "
1798         echo "Sources for $package found in \"$src\"." >&4
1799         ;;
1800 esac
1801
1802 : script used to extract .SH files with variable substitutions
1803 cat >extract <<'EOS'
1804 PERL_CONFIG_SH=true
1805 echo "Doing variable substitutions on .SH files..."
1806 if test -f MANIFEST; then
1807         set x `awk '{print $1}' < MANIFEST | grep '\.SH$'`
1808 else
1809         echo "(Looking for .SH files under the source directory.)"
1810         set x `(cd "$src"; find . -name "*.SH" -print)`
1811 fi
1812 shift
1813 case $# in
1814 0) set x `(cd "$src"; echo *.SH)`; shift;;
1815 esac
1816 if test ! -f "$src/$1"; then
1817         shift
1818 fi
1819 mkdir_p='
1820 name=$1;
1821 create="";
1822 while test $name; do
1823         if test ! -d "$name"; then
1824                 create="$name $create";
1825                 name=`echo $name | sed -e "s|^[^/]*$||"`;
1826                 name=`echo $name | sed -e "s|\(.*\)/.*|\1|"`;
1827         else
1828                 name="";
1829         fi;
1830 done;
1831 for file in $create; do
1832         mkdir $file;
1833 done
1834 '
1835 for file in $*; do
1836         case "$src" in
1837         ".")
1838                 case "$file" in
1839                 */*)
1840                         dir=`expr X$file : 'X\(.*\)/'`
1841                         file=`expr X$file : 'X.*/\(.*\)'`
1842                         (cd "$dir" && . ./$file)
1843                         ;;
1844                 *)
1845                         . ./$file
1846                         ;;
1847                 esac
1848                 ;;
1849         *)
1850                 case "$file" in
1851                 */*)
1852                         dir=`expr X$file : 'X\(.*\)/'`
1853                         file=`expr X$file : 'X.*/\(.*\)'`
1854                         (set x $dir; shift; eval $mkdir_p)
1855                         sh <"$src/$dir/$file"
1856                         ;;
1857                 *)
1858                         sh <"$src/$file"
1859                         ;;
1860                 esac
1861                 ;;
1862         esac
1863 done
1864 if test -f "$src/config_h.SH"; then
1865         if test ! -f config.h; then
1866         : oops, they left it out of MANIFEST, probably, so do it anyway.
1867         . "$src/config_h.SH"
1868         fi
1869 fi
1870 EOS
1871
1872 : extract files and exit if asked to do so
1873 case "$extractsh" in
1874 true)
1875         case "$realsilent" in
1876         true) ;;
1877         *) exec 1>&4;;
1878         esac
1879         case "$config_sh" in
1880         '') config_sh='config.sh';;
1881         esac
1882         echo " "
1883         echo "Fetching answers from $config_sh..."
1884         cd ..
1885         . $config_sh
1886         test "$override" && . ./optdef.sh
1887         echo " "
1888         . UU/extract
1889         rm -rf UU
1890         echo "Extraction done."
1891         exit 0
1892         ;;
1893 esac
1894
1895 : Eunice requires " " instead of "", can you believe it
1896 echo " "
1897 : Here we go...
1898 echo "Beginning of configuration questions for $package."
1899
1900 trap 'echo " "; test -d ../UU && rm -rf X $rmlist; exit 1' 1 2 3 15
1901
1902 : first determine how to suppress newline on echo command
1903 echo " "
1904 echo "Checking echo to see how to suppress newlines..."
1905 (echo "hi there\c" ; echo " ") >.echotmp
1906 if $contains c .echotmp >/dev/null 2>&1 ; then
1907         echo "...using -n."
1908         n='-n'
1909         c=''
1910 else
1911         cat <<'EOM'
1912 ...using \c
1913 EOM
1914         n=''
1915         c='\c'
1916 fi
1917 echo $n "The star should be here-->$c"
1918 echo '*'
1919 rm -f .echotmp
1920
1921 : Now test for existence of everything in MANIFEST
1922 echo " "
1923 if test -f "$rsrc/MANIFEST"; then
1924         echo "First let's make sure your kit is complete.  Checking..." >&4
1925         awk '$1 !~ /PACK[A-Z]+/ {print $1}' "$rsrc/MANIFEST" | (split -l 50 2>/dev/null || split -50)
1926         rm -f missing
1927         tmppwd=`pwd`
1928         for filelist in x??; do
1929                 (cd "$rsrc"; ls `cat "$tmppwd/$filelist"` >/dev/null 2>>"$tmppwd/missing")
1930         done
1931         if test -s missing; then
1932                 cat missing >&4
1933                 cat >&4 <<'EOM'
1934
1935 THIS PACKAGE SEEMS TO BE INCOMPLETE.
1936
1937 You have the option of continuing the configuration process, despite the
1938 distinct possibility that your kit is damaged, by typing 'y'es.  If you
1939 do, don't blame me if something goes wrong.  I advise you to type 'n'o
1940 and contact the author (perlbug@perl.org).
1941
1942 EOM
1943                 echo $n "Continue? [n] $c" >&4
1944                 read ans
1945                 case "$ans" in
1946                 y*)
1947                         echo "Continuing..." >&4
1948                         rm -f missing
1949                         ;;
1950                 *)
1951                         echo "ABORTING..." >&4
1952                         kill $$
1953                         ;;
1954                 esac
1955         else
1956                 echo "Looks good..."
1957         fi
1958 else
1959         echo "There is no MANIFEST file.  I hope your kit is complete !"
1960 fi
1961 rm -f missing x??
1962
1963 echo " "
1964 : Find the appropriate value for a newline for tr
1965 if test -n "$DJGPP"; then
1966        trnl='\012'
1967 fi
1968 if test X"$trnl" = X; then
1969         case "`echo foo|tr '\n' x 2>/dev/null`" in
1970         foox) trnl='\n' ;;
1971         esac
1972 fi
1973 if test X"$trnl" = X; then
1974         case "`echo foo|tr '\012' x 2>/dev/null`" in
1975         foox) trnl='\012' ;;
1976         esac
1977 fi
1978 if test X"$trnl" = X; then
1979        case "`echo foo|tr '\r\n' xy 2>/dev/null`" in
1980        fooxy) trnl='\n\r' ;;
1981        esac
1982 fi
1983 if test X"$trnl" = X; then
1984         cat <<EOM >&2
1985
1986 $me: Fatal Error: cannot figure out how to translate newlines with 'tr'.
1987
1988 EOM
1989         exit 1
1990 fi
1991
1992 : compute the number of columns on the terminal for proper question formatting
1993 case "$COLUMNS" in
1994 '') COLUMNS='80';;
1995 esac
1996
1997 : set up the echo used in my read
1998 myecho="case \"\$xxxm\" in
1999 '') echo $n \"\$rp $c\" >&4;;
2000 *) case \"\$rp\" in
2001         '') echo $n \"[\$xxxm] $c\";;
2002         *)
2003                 if test \`echo \"\$rp [\$xxxm]  \" | wc -c\` -ge $COLUMNS; then
2004                         echo \"\$rp\" >&4
2005                         echo $n \"[\$xxxm] $c\" >&4
2006                 else
2007                         echo $n \"\$rp [\$xxxm] $c\" >&4
2008                 fi
2009                 ;;
2010         esac;;
2011 esac"
2012
2013 : now set up to do reads with possible shell escape and default assignment
2014 cat <<EOSC >myread
2015 $startsh
2016 xxxm=\$dflt
2017 $myecho
2018 ans='!'
2019 case "\$fastread" in
2020 yes) case "\$dflt" in
2021         '') ;;
2022         *) ans='';
2023                 case "\$silent-\$rp" in
2024                 true-) ;;
2025                 *) echo " " >&4;;
2026                 esac;;
2027         esac;;
2028 *) case "\$silent" in
2029         true) case "\$rp" in
2030                 '') ans='';;
2031                 esac;;
2032         esac;;
2033 esac
2034 while expr "X\$ans" : "X!" >/dev/null; do
2035         read answ
2036         set x \$xxxm
2037         shift
2038         aok=''; eval "ans=\\"\$answ\\"" && aok=y
2039         case  "\$answ" in
2040         "!")
2041                 sh 1>&4
2042                 echo " "
2043                 $myecho
2044                 ;;
2045         !*)
2046                 set x \`expr "X\$ans" : "X!\(.*\)\$"\`
2047                 shift
2048                 sh 1>&4 -c "\$*"
2049                 echo " "
2050                 $myecho
2051                 ;;
2052         "\$ans")
2053                 case "\$ans" in
2054                 \\&*)
2055                         set x \`expr "X\$ans" : "X&\(.*\)\$"\`
2056                         shift
2057                         case "\$1" in
2058                         -d)
2059                                 fastread=yes
2060                                 echo "(OK, I'll run with -d after this question.)" >&4
2061                                 ;;
2062                         -*)
2063                                 echo "*** Sorry, \$1 not supported yet." >&4
2064                                 ;;
2065                         esac
2066                         $myecho
2067                         ans=!
2068                         ;;
2069                 esac;;
2070         *)
2071                 case "\$aok" in
2072                 y)
2073                         echo "*** Substitution done -- please confirm."
2074                         xxxm="\$ans"
2075                         ans=\`echo $n "\$ans$c" | tr '$trnl' ' '\`
2076                         xxxm="\$ans"
2077                         ans=!
2078                         ;;
2079                 *)
2080                         echo "*** Error -- try again."
2081                         ans=!
2082                         ;;
2083                 esac
2084                 $myecho
2085                 ;;
2086         esac
2087         case "\$ans\$xxxm\$nostick" in
2088         '')
2089                 ans=!
2090                 $myecho
2091                 ;;
2092         esac
2093 done
2094 case "\$ans" in
2095 '') ans="\$xxxm";;
2096 esac
2097 EOSC
2098
2099 : create .config dir to save info across Configure sessions
2100 test -d ../.config || mkdir ../.config
2101 cat >../.config/README <<EOF
2102 This directory created by Configure to save information that should
2103 persist across sessions for $package.
2104
2105 You may safely delete it if you wish.
2106 EOF
2107
2108 xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
2109 case "$usedevel" in
2110 $define|true|[yY]*) ;;
2111 *) case "$xversion" in
2112    *[13579])
2113         cat >&4 <<EOH
2114 *** WHOA THERE!!! ***
2115
2116     This is an UNSTABLE DEVELOPMENT release.
2117     The version of this $package distribution is $xversion, that is, odd,
2118     (as opposed to even) and that signifies a development release.
2119     If you want a maintenance release, you want an even-numbered version.
2120
2121     Do ***NOT*** install this into production use.
2122     Data corruption and crashes are possible.
2123
2124     It is most seriously suggested that you do not continue any further
2125     unless you want to help in developing and debugging Perl.
2126
2127     If you *still* want to build perl, you can answer 'y' now,
2128     or pass -Dusedevel to Configure.
2129
2130 EOH
2131         rp='Do you really want to continue?'
2132         dflt='n'
2133         . ./myread
2134         case "$ans" in
2135         [yY]) echo >&4 "Okay, continuing."
2136               usedevel="$define" ;;
2137         *) echo >&4 "Okay, bye."
2138            exit 1
2139            ;;
2140         esac
2141         ;;
2142     esac
2143     ;;
2144 esac
2145 case "$usedevel" in
2146 $define|true|[yY]*)
2147         case "$versiononly" in
2148         '') versiononly="$define" ;;
2149         esac
2150         case "$installusrbinperl" in
2151         '') installusrbinperl="$undef" ;;
2152         esac
2153         ;;
2154 esac
2155
2156 : general instructions
2157 needman=true
2158 firsttime=true
2159 user=`(logname) 2>/dev/null`
2160 case "$user" in
2161 '') user=`whoami 2>&1`;;
2162 esac
2163 if $contains "^$user\$" ../.config/instruct >/dev/null 2>&1; then
2164         firsttime=false
2165         echo " "
2166         rp='Would you like to see the instructions?'
2167         dflt=n
2168         . ./myread
2169         case "$ans" in
2170         [yY]*) ;;
2171         *) needman=false;;
2172         esac
2173 fi
2174 if $needman; then
2175         cat <<EOH
2176
2177 This installation shell script will examine your system and ask you questions
2178 to determine how the perl5 package should be installed. If you get
2179 stuck on a question, you may use a ! shell escape to start a subshell or
2180 execute a command.  Many of the questions will have default answers in square
2181 brackets; typing carriage return will give you the default.
2182
2183 On some of the questions which ask for file or directory names you are allowed
2184 to use the ~name construct to specify the login directory belonging to "name",
2185 even if you don't have a shell which knows about that.  Questions where this is
2186 allowed will be marked "(~name ok)".
2187
2188 EOH
2189         rp=''
2190         dflt='Type carriage return to continue'
2191         . ./myread
2192         cat <<'EOH'
2193
2194 The prompter used in this script allows you to use shell variables and
2195 backticks in your answers.  You may use $1, $2, etc...  to refer to the words
2196 in the default answer, as if the default line was a set of arguments given to a
2197 script shell.  This means you may also use $* to repeat the whole default line,
2198 so you do not have to re-type everything to add something to the default.
2199
2200 Everytime there is a substitution, you will have to confirm.  If there is an
2201 error (e.g. an unmatched backtick), the default answer will remain unchanged
2202 and you will be prompted again.
2203
2204 If you are in a hurry, you may run 'Configure -d'.  This will bypass nearly all
2205 the questions and use the computed defaults (or the previous answers if there
2206 was already a config.sh file). Type 'Configure -h' for a list of options.
2207 You may also start interactively and then answer '& -d' at any prompt to turn
2208 on the non-interactive behaviour for the remainder of the execution.
2209
2210 EOH
2211         . ./myread
2212         cat <<EOH
2213
2214 Much effort has been expended to ensure that this shell script will run on any
2215 Unix system.  If despite that it blows up on yours, your best bet is to edit
2216 Configure and run it again.  If you can't run Configure for some reason,
2217 you'll have to generate a config.sh file by hand.  Whatever problems you
2218 have, let me (perlbug@perl.org) know how I blew it.
2219
2220 This installation script affects things in two ways:
2221
2222 1) it may do direct variable substitutions on some of the files included
2223    in this kit.
2224 2) it builds a config.h file for inclusion in C programs.  You may edit
2225    any of these files as the need arises after running this script.
2226
2227 If you make a mistake on a question, there is no easy way to back up to it
2228 currently.  The easiest thing to do is to edit config.sh and rerun all the SH
2229 files.  Configure will offer to let you do this before it runs the SH files.
2230
2231 EOH
2232         dflt='Type carriage return to continue'
2233         . ./myread
2234         case "$firsttime" in
2235         true) echo $user >>../.config/instruct;;
2236         esac
2237 fi
2238
2239 : find out where common programs are
2240 echo " "
2241 echo "Locating common programs..." >&4
2242 cat <<EOSC >loc
2243 $startsh
2244 case \$# in
2245 0) exit 1;;
2246 esac
2247 thing=\$1
2248 shift
2249 dflt=\$1
2250 shift
2251 for dir in \$*; do
2252         case "\$thing" in
2253         .)
2254         if test -d \$dir/\$thing; then
2255                 echo \$dir
2256                 exit 0
2257         fi
2258         ;;
2259         *)
2260         for thisthing in \$dir/\$thing; do
2261                 : just loop through to pick last item
2262         done
2263         if test -f \$thisthing; then
2264                 echo \$thisthing
2265                 exit 0
2266         elif test "X$_exe" != X -a -f \$thisthing$_exe; then
2267                 echo \$thisthing
2268                 exit 0
2269         elif test -f \$dir/\$thing.exe; then
2270                 if test -n "$DJGPP"; then
2271                         echo \$dir/\$thing.exe
2272                 elif test "$eunicefix" != ":"; then
2273                         : on Eunice apparently
2274                         echo \$dir/\$thing
2275                         exit 0
2276                 fi
2277                 exit 0
2278         fi
2279         ;;
2280         esac
2281 done
2282 echo \$dflt
2283 exit 1
2284 EOSC
2285 chmod +x loc
2286 $eunicefix loc
2287 loclist="
2288 awk
2289 cat
2290 chmod
2291 comm
2292 cp
2293 echo
2294 expr
2295 grep
2296 ls
2297 mkdir
2298 rm
2299 sed
2300 sort
2301 touch
2302 tr
2303 uniq
2304 "
2305 trylist="
2306 Mcc
2307 ar
2308 bison
2309 byacc
2310 cpp
2311 csh
2312 date
2313 egrep
2314 gmake
2315 gzip
2316 less
2317 ln
2318 make
2319 more
2320 nm
2321 nroff
2322 pg
2323 test
2324 uname
2325 zip
2326 "
2327 pth=`echo $PATH | sed -e "s/$p_/ /g"`
2328 pth="$pth /lib /usr/lib"
2329 for file in $loclist; do
2330         eval xxx=\$$file
2331         case "$xxx" in
2332         /*|?:[\\/]*)
2333                 if test -f "$xxx"; then
2334                         : ok
2335                 else
2336                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2337                         xxx=`./loc $file $file $pth`
2338                 fi
2339                 ;;
2340         '') xxx=`./loc $file $file $pth`;;
2341         *) xxx=`./loc $xxx $xxx $pth`;;
2342         esac
2343         eval $file=$xxx$_exe
2344         eval _$file=$xxx
2345         case "$xxx" in
2346         /*)
2347                 echo $file is in $xxx.
2348                 ;;
2349         ?:[\\/]*)
2350                 echo $file is in $xxx.
2351                 ;;
2352         *)
2353                 echo "I don't know where '$file' is, and my life depends on it." >&4
2354                 echo "Go find a public domain implementation or fix your PATH setting!" >&4
2355                 exit 1
2356                 ;;
2357         esac
2358 done
2359 echo " "
2360 echo "Don't worry if any of the following aren't found..."
2361 say=offhand
2362 for file in $trylist; do
2363         eval xxx=\$$file
2364         case "$xxx" in
2365         /*|?:[\\/]*)
2366                 if test -f "$xxx"; then
2367                         : ok
2368                 else
2369                         echo "WARNING: no $xxx -- ignoring your setting for $file." >&4
2370                         xxx=`./loc $file $file $pth`
2371                 fi
2372                 ;;
2373         '') xxx=`./loc $file $file $pth`;;
2374         *) xxx=`./loc $xxx $xxx $pth`;;
2375         esac
2376         eval $file=$xxx$_exe
2377         eval _$file=$xxx
2378         case "$xxx" in
2379         /*)
2380                 echo $file is in $xxx.
2381                 ;;
2382         ?:[\\/]*)
2383                 echo $file is in $xxx.
2384                 ;;
2385         *)
2386                 echo "I don't see $file out there, $say."
2387                 say=either
2388                 ;;
2389         esac
2390 done
2391 case "$egrep" in
2392 egrep)
2393         echo "Substituting grep for egrep."
2394         egrep=$grep
2395         _egrep=$grep
2396         ;;
2397 esac
2398 case "$ln" in
2399 ln)
2400         echo "Substituting cp for ln."
2401         ln=$cp
2402         _ln=$cp
2403         ;;
2404 esac
2405 case "$make" in
2406 make)   
2407         case "$gmake" in
2408         gmake)
2409         echo "I can't find make or gmake, and my life depends on it." >&4
2410         echo "Go find a public domain implementation or fix your PATH setting!" >&4
2411         exit 1
2412         ;;
2413         esac
2414         ;;
2415 esac    
2416 case "$gmake" in
2417 gmake)  ;;
2418 *)      # We can't have osname yet.
2419         if test -f "/system/gnu_library/bin/ar.pm"; then # Stratus VOS
2420                 # Assume that gmake, if found, is definitely GNU make
2421                 # and prefer it over the system make.
2422                 echo "Substituting gmake for make."
2423                 make=$gmake
2424                 _make=$gmake
2425         fi
2426         ;;
2427 esac
2428 case "$test" in
2429 test)
2430         echo "Hopefully test is built into your sh."
2431         ;;
2432 *)
2433         if `sh -c "PATH= test true" >/dev/null 2>&1`; then
2434                 echo "Using the test built into your sh."
2435                 test=test
2436                 _test=test
2437         fi
2438         ;;
2439 esac
2440 case "$echo" in
2441 echo)
2442         echo "Hopefully echo is built into your sh."
2443         ;;
2444 '') ;;
2445 *)
2446         echo " "
2447 echo "Checking compatibility between $echo and builtin echo (if any)..." >&4
2448         $echo $n "hi there$c" >foo1
2449         echo $n "hi there$c" >foo2
2450         if cmp foo1 foo2 >/dev/null 2>&1; then
2451                 echo "They are compatible.  In fact, they may be identical."
2452         else
2453                 case "$n" in
2454                 '-n') n='' c='\c';;
2455                 *) n='-n' c='';;
2456                 esac
2457                 cat <<FOO
2458 They are not compatible!  You are probably running ksh on a non-USG system.
2459 I'll have to use $echo instead of the builtin, since Bourne shell doesn't
2460 have echo built in and we may have to run some Bourne shell scripts.  That
2461 means I'll have to use '$n$c' to suppress newlines now.  Life is ridiculous.
2462
2463 FOO
2464                 $echo $n "The star should be here-->$c"
2465                 $echo "*"
2466         fi
2467         $rm -f foo1 foo2
2468         ;;
2469 esac
2470
2471 cat <<EOS >trygcc
2472 $startsh
2473 EOS
2474 cat <<'EOSC' >>trygcc
2475 case "$cc" in
2476 '') ;;
2477 *)  $rm -f try try.*
2478     $cat >try.c <<EOM
2479 int main(int argc, char *argv[]) {
2480   return 0;
2481 }
2482 EOM
2483     if $cc -o try $ccflags $ldflags try.c; then
2484        :
2485     else
2486         echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2487         despair=yes
2488         trygcc=yes
2489         case "$cc" in
2490         *gcc*) trygcc=no ;;
2491         esac
2492         case "`$cc -v -c try.c 2>&1`" in
2493         *gcc*) trygcc=no ;;
2494         esac
2495         if $test X"$trygcc" = Xyes; then
2496             if gcc -o try -c try.c; then
2497                 echo " "
2498                 echo "You seem to have a working gcc, though." >&4
2499                 rp="Would you like to use it?"
2500                 dflt=y
2501                 if $test -f myread; then
2502                     . ./myread
2503                 else
2504                     if $test -f UU/myread; then
2505                         . ./UU/myread
2506                     else
2507                         echo "Cannot find myread, sorry.  Aborting." >&2
2508                         exit 1
2509                     fi
2510                 fi  
2511                 case "$ans" in
2512                 [yY]*) cc=gcc; ccname=gcc; ccflags=''; despair=no;
2513                        if $test -f usethreads.cbu; then
2514                            $cat >&4 <<EOM 
2515
2516 *** However, any setting of the C compiler flags (e.g. for thread support)
2517 *** has been lost.  It may be necessary to pass -Dcc=gcc to Configure
2518 *** (together with e.g. -Dusethreads).
2519
2520 EOM
2521                        fi;;
2522                 esac
2523             fi
2524         fi
2525     fi
2526     $rm -f try try.*
2527     ;;
2528 esac
2529 EOSC
2530
2531 cat <<EOS >checkcc
2532 $startsh
2533 EOS
2534 cat <<'EOSC' >>checkcc
2535 case "$cc" in        
2536 '') ;;
2537 *)  $rm -f try try.*              
2538     $cat >try.c <<EOM
2539 int main(int argc, char *argv[]) {
2540   return 0;
2541 }
2542 EOM
2543     if $cc -o try $ccflags $ldflags try.c; then
2544        :
2545     else
2546         if $test X"$despair" = Xyes; then
2547            echo "Uh-oh, the C compiler '$cc' doesn't seem to be working." >&4
2548         fi
2549         $cat >&4 <<EOM         
2550 You need to find a working C compiler.
2551 Either (purchase and) install the C compiler supplied by your OS vendor,
2552 or for a free C compiler try http://gcc.gnu.org/
2553 I cannot continue any further, aborting.
2554 EOM
2555         exit 1
2556     fi
2557     $rm -f try try.*
2558     ;;
2559 esac
2560 EOSC
2561
2562 : determine whether symbolic links are supported
2563 echo " "
2564 $touch blurfl
2565 if $ln -s blurfl sym > /dev/null 2>&1 ; then
2566         echo "Symbolic links are supported." >&4
2567         lns="$ln -s"
2568 else
2569         echo "Symbolic links are NOT supported." >&4
2570         lns="$ln"
2571 fi
2572 $rm -f blurfl sym
2573
2574 : determine whether symbolic links are supported
2575 echo " "
2576 case "$lns" in
2577 *"ln"*" -s")
2578         echo "Checking how to test for symbolic links..." >&4
2579         $lns blurfl sym
2580         if $test "X$issymlink" = X; then
2581                 case "$newsh" in
2582                 '') sh     -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2583                 *)  $newsh -c "PATH= test -h sym" >/dev/null 2>&1 ;;
2584                 esac
2585                 if test $? = 0; then
2586                         issymlink="test -h"
2587                 else
2588                         echo "Your builtin 'test -h' may be broken." >&4
2589                         case "$test" in
2590                         /*)     ;;
2591                         *)      pth=`echo $PATH | sed -e "s/$p_/ /g"`
2592                                 for p in $pth
2593                                 do
2594                                         if test -f "$p/$test"; then
2595                                                 test="$p/$test"
2596                                                 break
2597                                         fi
2598                                 done
2599                                 ;;
2600                         esac
2601                         case "$test" in
2602                         /*)
2603                                 echo "Trying external '$test -h'." >&4
2604                                 issymlink="$test -h"
2605                                 if $test ! -h sym >/dev/null 2>&1; then
2606                                         echo "External '$test -h' is broken, too." >&4
2607                                         issymlink=''
2608                                 fi
2609                                 ;;
2610                         *)      issymlink='' ;;
2611                         esac
2612                 fi              
2613         fi
2614         if $test "X$issymlink" = X; then
2615                 if $test -L sym 2>/dev/null; then
2616                         issymlink="$test -L"
2617                         echo "The builtin '$test -L' worked." >&4
2618                 fi
2619         fi
2620         if $test "X$issymlink" != X; then
2621                 echo "You can test for symbolic links with '$issymlink'." >&4
2622         else
2623                 echo "I do not know how you can test for symbolic links." >&4
2624         fi
2625         $rm -f blurfl sym
2626         ;;
2627 *)      echo "No symbolic links, so not testing for their testing..." >&4
2628         ;;
2629 esac
2630 echo " "
2631
2632
2633 case "$mksymlinks" in
2634 $define|true|[yY]*)
2635         case "$src" in
2636         ''|'.') echo "Cannot create symlinks in the original directory." >&4
2637                 exit 1
2638                 ;;
2639         *)      case "$lns:$issymlink" in
2640                 *"ln"*" -s:"*"test -"?)
2641                         echo "Creating the symbolic links..." >&4
2642                         echo "(First creating the subdirectories...)" >&4
2643                         cd ..
2644                         awk '{print $1}' $src/MANIFEST | grep / | sed 's:/[^/]*$::' | sort -u | while true; do
2645                                 read directory
2646                                 test -z "$directory" && break
2647                                 mkdir -p $directory
2648                         done
2649                         # Sanity check 1.
2650                         if test ! -d t/base; then
2651                                 echo "Failed to create the subdirectories.  Aborting." >&4
2652                                 exit 1
2653                         fi
2654                         echo "(Then creating the symlinks...)" >&4
2655                         awk '{print $1}' $src/MANIFEST | while true; do
2656                                 read filename
2657                                 test -z "$filename" && break
2658                                 if test -f $filename; then
2659                                         if $issymlink $filename; then
2660                                                 rm -f $filename
2661                                         fi
2662                                 fi
2663                                 if test -f $filename; then
2664                                         echo "$filename already exists, not symlinking."
2665                                 else
2666                                         ln -s $src/$filename $filename
2667                                 fi
2668                         done
2669                         # Sanity check 2.
2670                         if test ! -f t/base/lex.t; then
2671                                 echo "Failed to create the symlinks (t/base/lex.t missing).  Aborting." >&4
2672                                 exit 1
2673                         fi
2674                         cd UU
2675                         ;;
2676                 *)      echo "(I cannot figure out how to do symbolic links, ignoring mksymlinks)." >&4
2677                         ;;
2678                 esac
2679                 ;;
2680         esac
2681         ;;
2682 esac
2683
2684
2685 case "$usecrosscompile" in
2686 $define|true|[yY]*)
2687         $echo "Cross-compiling..."
2688         croak=''
2689         case "$cc" in
2690         *-*-gcc) # A cross-compiling gcc, probably.
2691             targetarch=`$echo $cc|$sed 's/-gcc$//'`
2692             ar=$targetarch-ar
2693             # leave out ld, choosing it is more complex
2694             nm=$targetarch-nm
2695             ranlib=$targetarch-ranlib
2696             $echo 'extern int foo;' > try.c
2697             set X `$cc -v -E try.c 2>&1 | $awk '/^#include </,/^End of search /'|$grep '/include'`
2698             shift
2699             if $test $# -gt 0; then
2700                 incpth="$incpth $*"
2701                 incpth="`$echo $incpth|$sed 's/^ //'`"
2702                 echo "Guessing incpth '$incpth'." >&4
2703                 for i in $*; do
2704                     j="`$echo $i|$sed 's,/include$,/lib,'`"
2705                     if $test -d $j; then
2706                         libpth="$libpth $j"
2707                     fi
2708                 done   
2709                 libpth="`$echo $libpth|$sed 's/^ //'`"
2710                 echo "Guessing libpth '$libpth'." >&4
2711             fi
2712             $rm -f try.c
2713             ;;
2714         esac
2715         case "$targetarch" in
2716         '') echo "Targetarch not defined." >&4; croak=y ;;
2717         *)  echo "Using targetarch $targetarch." >&4 ;;
2718         esac
2719         case "$incpth" in
2720         '') echo "Incpth not defined." >&4; croak=y ;;
2721         *)  echo "Using incpth '$incpth'." >&4 ;;
2722         esac
2723         case "$libpth" in
2724         '') echo "Libpth not defined." >&4; croak=y ;;
2725         *)  echo "Using libpth '$libpth'." >&4 ;;
2726         esac
2727         case "$usrinc" in
2728         '') for i in $incpth; do
2729                 if $test -f $i/errno.h -a -f $i/stdio.h -a -f $i/time.h; then
2730                     usrinc=$i
2731                     echo "Guessing usrinc $usrinc." >&4
2732                     break
2733                 fi
2734             done
2735             case "$usrinc" in
2736             '') echo "Usrinc not defined." >&4; croak=y ;;
2737             esac
2738             ;;
2739         *)  echo "Using usrinc $usrinc." >&4 ;;
2740         esac
2741         case "$targethost" in
2742         '') echo "Targethost not defined." >&4; croak=y ;;
2743         *)  echo "Using targethost $targethost." >&4
2744         esac
2745         locincpth=' '
2746         loclibpth=' '
2747         case "$croak" in
2748         y) echo "Cannot continue, aborting." >&4; exit 1 ;;
2749         esac
2750         case "$src" in
2751         /*) run=$src/Cross/run
2752             targetmkdir=$src/Cross/mkdir
2753             to=$src/Cross/to
2754             from=$src/Cross/from
2755             ;;
2756         *)  pwd=`$test -f ../Configure & cd ..; pwd`
2757             run=$pwd/Cross/run
2758             targetmkdir=$pwd/Cross/mkdir
2759             to=$pwd/Cross/to
2760             from=$pwd/Cross/from
2761             ;;
2762         esac
2763         case "$targetrun" in
2764         '') targetrun=ssh ;;
2765         esac
2766         case "$targetto" in
2767         '') targetto=scp ;;
2768         esac
2769         case "$targetfrom" in
2770         '') targetfrom=scp ;;
2771         esac
2772         run=$run-$targetrun
2773         to=$to-$targetto
2774         from=$from-$targetfrom
2775         case "$targetdir" in
2776         '')  targetdir=/tmp
2777              echo "Guessing targetdir $targetdir." >&4
2778              ;;
2779         esac
2780         case "$targetuser" in
2781         '')  targetuser=root
2782              echo "Guessing targetuser $targetuser." >&4
2783              ;;
2784         esac
2785         case "$targetfrom" in
2786         scp)    q=-q ;;
2787         *)      q='' ;;
2788         esac
2789         case "$targetrun" in
2790         ssh|rsh)
2791             cat >$run <<EOF
2792 #!/bin/sh
2793 case "\$1" in
2794 -cwd)
2795   shift
2796   cwd=\$1
2797   shift
2798   ;;
2799 esac
2800 case "\$cwd" in
2801 '') cwd=$targetdir ;;
2802 esac
2803 exe=\$1
2804 shift
2805 if $test ! -f \$exe.xok; then
2806   $to \$exe
2807   $touch \$exe.xok
2808 fi
2809 $targetrun -l $targetuser $targethost "cd \$cwd && ./\$exe \$@"
2810 EOF
2811             ;;
2812         *)  echo "Unknown targetrun '$targetrun'" >&4
2813             exit 1
2814             ;;
2815         esac
2816         case "$targetmkdir" in
2817         */Cross/mkdir)
2818             cat >$targetmkdir <<EOF
2819 #!/bin/sh
2820 $targetrun -l $targetuser $targethost "mkdir -p \$@"
2821 EOF
2822             $chmod a+rx $targetmkdir
2823             ;;
2824         *)  echo "Unknown targetmkdir '$targetmkdir'" >&4
2825             exit 1
2826             ;;
2827         esac
2828         case "$targetto" in
2829         scp|rcp)
2830             cat >$to <<EOF
2831 #!/bin/sh
2832 for f in \$@
2833 do
2834   case "\$f" in
2835   /*)
2836     $targetmkdir \`dirname \$f\`
2837     $targetto $q \$f $targetuser@$targethost:\$f            || exit 1
2838     ;;
2839   *)
2840     $targetmkdir $targetdir/\`dirname \$f\`
2841     $targetto $q \$f $targetuser@$targethost:$targetdir/\$f || exit 1
2842     ;;
2843   esac
2844 done
2845 exit 0
2846 EOF
2847             ;;
2848         cp) cat >$to <<EOF
2849 #!/bin/sh
2850 for f in \$@
2851 do
2852   case "\$f" in
2853   /*)
2854     $mkdir -p $targetdir/\`dirname \$f\`
2855     $cp \$f $targetdir/\$f || exit 1
2856     ;;
2857   *)
2858     $targetmkdir $targetdir/\`dirname \$f\`
2859     $cp \$f $targetdir/\$f || exit 1
2860     ;;
2861   esac
2862 done
2863 exit 0
2864 EOF
2865             ;;
2866         *)  echo "Unknown targetto '$targetto'" >&4
2867             exit 1
2868             ;;
2869         esac
2870         case "$targetfrom" in
2871         scp|rcp)
2872           cat >$from <<EOF
2873 #!/bin/sh
2874 for f in \$@
2875 do
2876   $rm -f \$f
2877   $targetfrom $q $targetuser@$targethost:$targetdir/\$f . || exit 1
2878 done
2879 exit 0
2880 EOF
2881             ;;
2882         cp) cat >$from <<EOF
2883 #!/bin/sh
2884 for f in \$@
2885 do
2886   $rm -f \$f
2887   cp $targetdir/\$f . || exit 1
2888 done
2889 exit 0
2890 EOF
2891             ;;
2892         *)  echo "Unknown targetfrom '$targetfrom'" >&4
2893             exit 1
2894             ;;
2895         esac
2896         if $test ! -f $run; then
2897             echo "Target 'run' script '$run' not found." >&4
2898         else
2899             $chmod a+rx $run
2900         fi
2901         if $test ! -f $to; then
2902             echo "Target 'to' script '$to' not found." >&4
2903         else
2904             $chmod a+rx $to
2905         fi
2906         if $test ! -f $from; then
2907             echo "Target 'from' script '$from' not found." >&4
2908         else
2909             $chmod a+rx $from
2910         fi
2911         if $test ! -f $run -o ! -f $to -o ! -f $from; then
2912             exit 1
2913         fi
2914         cat >&4 <<EOF
2915 Using '$run' for remote execution,
2916 and '$from' and '$to'
2917 for remote file transfer.
2918 EOF
2919         ;;
2920 *)      run=''
2921         to=:
2922         from=:
2923         usecrosscompile='undef'
2924         targetarch=''
2925         ;;
2926 esac
2927
2928 : see whether [:lower:] and [:upper:] are supported character classes
2929 echo " "
2930 case "`echo AbyZ | $tr '[:lower:]' '[:upper:]' 2>/dev/null`" in
2931 ABYZ)
2932         echo "Good, your tr supports [:lower:] and [:upper:] to convert case." >&4
2933         up='[:upper:]'
2934         low='[:lower:]'
2935         ;;
2936 *)      # There is a discontinuity in EBCDIC between 'R' and 'S'
2937         # (0xd9 and 0xe2), therefore that is a nice testing point.
2938         if test "X$up" = X -o "X$low" = X; then
2939             case "`echo RS | $tr '[R-S]' '[r-s]' 2>/dev/null`" in
2940             rs) up='[A-Z]'
2941                 low='[a-z]'
2942                 ;;
2943             esac
2944         fi
2945         if test "X$up" = X -o "X$low" = X; then
2946             case "`echo RS | $tr R-S r-s 2>/dev/null`" in
2947             rs) up='A-Z'
2948                 low='a-z'
2949                 ;;
2950             esac
2951         fi
2952         if test "X$up" = X -o "X$low" = X; then
2953             case "`echo RS | od -x 2>/dev/null`" in
2954             *D9E2*|*d9e2*)
2955                 echo "Hey, this might be EBCDIC." >&4
2956                 if test "X$up" = X -o "X$low" = X; then
2957                     case "`echo RS | $tr '[A-IJ-RS-Z]' '[a-ij-rs-z]' 2>/dev/null`" in
2958                     rs) up='[A-IJ-RS-Z]'
2959                         low='[a-ij-rs-z]'
2960                         ;;
2961                     esac
2962                 fi
2963                 if test "X$up" = X -o "X$low" = X; then
2964                     case "`echo RS | $tr A-IJ-RS-Z a-ij-rs-z 2>/dev/null`" in
2965                     rs) up='A-IJ-RS-Z'
2966                         low='a-ij-rs-z'
2967                         ;;
2968                     esac
2969                 fi
2970                 ;;
2971             esac
2972         fi
2973 esac
2974 case "`echo RS | $tr \"$up\" \"$low\" 2>/dev/null`" in
2975 rs)
2976     echo "Using $up and $low to convert case." >&4
2977     ;;
2978 *)
2979     echo "I don't know how to translate letters from upper to lower case." >&4
2980     echo "Your tr is not acting any way I know of." >&4
2981     exit 1
2982     ;;
2983 esac
2984 : set up the translation script tr, must be called with ./tr of course
2985 cat >tr <<EOSC
2986 $startsh
2987 case "\$1\$2" in
2988 '[A-Z][a-z]') exec $tr '$up' '$low';;
2989 '[a-z][A-Z]') exec $tr '$low' '$up';;
2990 esac
2991 exec $tr "\$@"
2992 EOSC
2993 chmod +x tr
2994 $eunicefix tr
2995
2996 : Try to determine whether config.sh was made on this system
2997 case "$config_sh" in
2998 '')
2999 myuname=`$uname -a 2>/dev/null`
3000 $test -z "$myuname" && myuname=`hostname 2>/dev/null`
3001 # tr '[A-Z]' '[a-z]' would not work in EBCDIC
3002 # because the A-Z/a-z are not consecutive.
3003 myuname=`echo $myuname | $sed -e 's/^[^=]*=//' -e 's/\///g' | \
3004         ./tr '[A-Z]' '[a-z]' | $tr $trnl ' '`
3005 newmyuname="$myuname"
3006 dflt=n
3007 case "$knowitall" in
3008 '')
3009         if test -f ../config.sh; then
3010                 if $contains myuname= ../config.sh >/dev/null 2>&1; then
3011                         eval "`grep myuname= ../config.sh`"
3012                 fi
3013                 if test "X$myuname" = "X$newmyuname"; then
3014                         dflt=y
3015                 fi
3016         fi
3017         ;;
3018 *) dflt=y;;
3019 esac
3020
3021 : Get old answers from old config file if Configure was run on the
3022 : same system, otherwise use the hints.
3023 hint=default
3024 cd ..
3025 if test -f config.sh; then
3026         echo " "
3027         rp="I see a config.sh file.  Shall I use it to set the defaults?"
3028         . UU/myread
3029         case "$ans" in
3030         n*|N*) echo "OK, I'll ignore it."
3031                 mv config.sh config.sh.old
3032                 myuname="$newmyuname"
3033                 ;;
3034         *)  echo "Fetching default answers from your old config.sh file..." >&4
3035                 tmp_n="$n"
3036                 tmp_c="$c"
3037                 tmp_sh="$sh"
3038                 . ./config.sh
3039                 cp config.sh UU
3040                 n="$tmp_n"
3041                 c="$tmp_c"
3042                 : Older versions did not always set $sh.  Catch re-use of such
3043                 : an old config.sh.
3044                 case "$sh" in
3045                 '') sh="$tmp_sh" ;;
3046                 esac
3047                 hint=previous
3048                 ;;
3049         esac
3050 fi
3051 . ./UU/checkcc
3052 if test ! -f config.sh; then
3053         $cat <<EOM
3054
3055 First time through, eh?  I have some defaults handy for some systems
3056 that need some extra help getting the Configure answers right:
3057
3058 EOM
3059         (cd $src/hints; ls -C *.sh) | $sed 's/\.sh/   /g' >&4
3060         dflt=''
3061         : Half the following guesses are probably wrong... If you have better
3062         : tests or hints, please send them to perlbug@perl.org
3063         : The metaconfig authors would also appreciate a copy...
3064         $test -f /irix && osname=irix
3065         $test -f /xenix && osname=sco_xenix
3066         $test -f /dynix && osname=dynix
3067         $test -f /dnix && osname=dnix
3068         $test -f /lynx.os && osname=lynxos
3069         $test -f /unicos && osname=unicos && osvers=`$uname -r`
3070         $test -f /unicosmk && osname=unicosmk && osvers=`$uname -r`
3071         $test -f /unicosmk.ar && osname=unicosmk && osvers=`$uname -r`
3072         $test -f /bin/mips && /bin/mips && osname=mips
3073         $test -d /NextApps && set X `hostinfo | grep 'NeXT Mach.*:' | \
3074                 $sed -e 's/://' -e 's/\./_/'` && osname=next && osvers=$4
3075         $test -d /usr/apollo/bin && osname=apollo
3076         $test -f /etc/saf/_sactab && osname=svr4
3077         $test -d /usr/include/minix && osname=minix
3078         $test -f /system/gnu_library/bin/ar.pm && osname=vos
3079         if $test -d /MachTen -o -d /MachTen_Folder; then
3080                 osname=machten
3081                 if $test -x /sbin/version; then
3082                         osvers=`/sbin/version | $awk '{print $2}' |
3083                         $sed -e 's/[A-Za-z]$//'`
3084                 elif $test -x /usr/etc/version; then
3085                         osvers=`/usr/etc/version | $awk '{print $2}' |
3086                         $sed -e 's/[A-Za-z]$//'`
3087                 else
3088                         osvers="$2.$3"
3089                 fi
3090         fi
3091
3092         $test -f /sys/posix.dll &&
3093                 $test -f /usr/bin/what &&
3094                 set X `/usr/bin/what /sys/posix.dll` &&
3095                 $test "$3" = UWIN &&
3096                 osname=uwin &&
3097                 osvers="$5"
3098
3099         if $test -f $uname; then
3100                 set X $myuname
3101                 shift
3102
3103                 case "$5" in
3104                 fps*) osname=fps ;;
3105                 mips*)
3106                         case "$4" in
3107                         umips) osname=umips ;;
3108                         *) osname=mips ;;
3109                         esac;;
3110                 [23]100) osname=mips ;;
3111                 next*) osname=next ;;
3112                 i386*)
3113                         tmp=`/bin/uname -X 2>/dev/null|awk '/3\.2v[45]/{ print $(NF) }'`
3114                         if $test "$tmp" != "" -a "$3" = "3.2" -a -f '/etc/systemid'; then
3115                                 osname='sco'
3116                                 osvers=$tmp
3117                         elif $test -f /etc/kconfig; then
3118                                 osname=isc
3119                                 if test "$lns" = "$ln -s"; then
3120                                         osvers=4
3121                                 elif $contains _SYSV3 /usr/include/stdio.h > /dev/null 2>&1 ; then
3122                                         osvers=3
3123                                 elif $contains _POSIX_SOURCE /usr/include/stdio.h > /dev/null 2>&1 ; then
3124                                         osvers=2
3125                                 fi
3126                         fi
3127                         tmp=''
3128                         ;;
3129                 pc*)
3130                         if test -n "$DJGPP"; then
3131                                 osname=dos
3132                                 osvers=djgpp
3133                         fi
3134                         ;;
3135                 esac
3136
3137                 case "$1" in
3138                 aix) osname=aix
3139                         tmp=`( (oslevel) 2>/dev/null || echo "not found") 2>&1`
3140                         case "$tmp" in
3141                         # oslevel can fail with:
3142                         # oslevel: Unable to acquire lock.
3143                         *not\ found) osvers="$4"."$3" ;;
3144                         '<3240'|'<>3240') osvers=3.2.0 ;;
3145                         '=3240'|'>3240'|'<3250'|'<>3250') osvers=3.2.4 ;;
3146                         '=3250'|'>3250') osvers=3.2.5 ;;
3147                         *) osvers=$tmp;;
3148                         esac
3149                         ;;
3150                 bsd386) osname=bsd386
3151                         osvers=`$uname -r`
3152                         ;;
3153                 cygwin*) osname=cygwin
3154                         osvers="$3"
3155                         ;;
3156                 *dc.osx) osname=dcosx
3157                         osvers="$3"
3158                         ;;
3159                 dnix) osname=dnix
3160                         osvers="$3"
3161                         ;;
3162                 domainos) osname=apollo
3163                         osvers="$3"
3164                         ;;
3165                 dgux)   osname=dgux
3166                         osvers="$3"
3167                         ;;
3168                 dragonfly) osname=dragonfly
3169                         osvers="$3"
3170                         ;;
3171                 dynixptx*) osname=dynixptx
3172                         osvers=`echo "$4"|sed 's/^v//'`
3173                         ;;
3174                 freebsd) osname=freebsd
3175                         osvers="$3" ;;
3176                 genix)  osname=genix ;;
3177                 gnu)    osname=gnu
3178                         osvers="$3" ;;
3179                 hp*)    osname=hpux
3180                         osvers=`echo "$3" | $sed 's,.*\.\([0-9]*\.[0-9]*\),\1,'`
3181                         ;;
3182                 irix*)  osname=irix
3183                         case "$3" in
3184                         4*) osvers=4 ;;
3185                         5*) osvers=5 ;;
3186                         *)      osvers="$3" ;;
3187                         esac
3188                         ;;
3189                 linux)  osname=linux
3190                         case "$3" in
3191                         *)      osvers="$3" ;;
3192                         esac
3193                         ;;
3194                 MiNT)   osname=mint
3195                         ;;
3196                 netbsd*) osname=netbsd
3197                         osvers="$3"
3198                         ;;
3199                 news-os) osvers="$3"
3200                         case "$3" in
3201                         4*) osname=newsos4 ;;
3202                         *) osname=newsos ;;
3203                         esac
3204                         ;;
3205                 next*) osname=next ;;
3206                 nonstop-ux) osname=nonstopux ;;
3207                 openbsd) osname=openbsd
3208                         osvers="$3"
3209                         ;;
3210                 os2)    osname=os2
3211                         osvers="$4"
3212                         ;;
3213                 POSIX-BC | posix-bc ) osname=posix-bc
3214                         osvers="$3"
3215                         ;;
3216                 powerux | power_ux | powermax_os | powermaxos | \
3217                 powerunix | power_unix) osname=powerux
3218                         osvers="$3"
3219                         ;;
3220                 qnx) osname=qnx
3221                         osvers="$4"
3222                         ;;
3223                 solaris) osname=solaris
3224                         case "$3" in
3225                         5*) osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3226                         *)      osvers="$3" ;;
3227                         esac
3228                         ;;
3229                 sunos) osname=sunos
3230                         case "$3" in
3231                         5*) osname=solaris
3232                                 osvers=`echo $3 | $sed 's/^5/2/g'` ;;
3233                         *)      osvers="$3" ;;
3234                         esac
3235                         ;;
3236                 titanos) osname=titanos
3237                         case "$3" in
3238                         1*) osvers=1 ;;
3239                         2*) osvers=2 ;;
3240                         3*) osvers=3 ;;
3241                         4*) osvers=4 ;;
3242                         *)      osvers="$3" ;;
3243                         esac
3244                         ;;
3245                 ultrix) osname=ultrix
3246                         osvers="$3"
3247                         ;;
3248                 osf1|mls+)      case "$5" in
3249                                 alpha)
3250                                         osname=dec_osf
3251                                         osvers=`sizer -v | awk -FUNIX '{print $2}' | awk '{print $1}' |  tr '[A-Z]' '[a-z]' | sed 's/^[xvt]//'`
3252                                         case "$osvers" in
3253                                         [1-9].[0-9]*) ;;
3254                                         *) osvers=`echo "$3" | sed 's/^[xvt]//'` ;;
3255                                         esac
3256                                         ;;
3257                         hp*)    osname=hp_osf1  ;;
3258                         mips)   osname=mips_osf1 ;;
3259                         esac
3260                         ;;
3261                 # UnixWare 7.1.2 is known as Open UNIX 8
3262                 openunix|unixware) osname=svr5
3263                         osvers="$4"
3264                         ;;
3265                 uts)    osname=uts
3266                         osvers="$3"
3267                         ;;
3268                 vos) osvers="$3"
3269                         ;;
3270                 $2) case "$osname" in
3271                         *isc*) ;;
3272                         *freebsd*) ;;
3273                         svr*)
3274                                 : svr4.x or possibly later
3275                                 case "svr$3" in
3276                                 ${osname}*)
3277                                         osname=svr$3
3278                                         osvers=$4
3279                                         ;;
3280                                 esac
3281                                 case "$osname" in
3282                                 svr4.0)
3283                                         : Check for ESIX
3284                                         if test -f /stand/boot ; then
3285                                                 eval `grep '^INITPROG=[a-z/0-9]*$' /stand/boot`
3286                                                 if test -n "$INITPROG" -a -f "$INITPROG"; then
3287                         isesix=`strings -a $INITPROG|grep 'ESIX SYSTEM V/386 Release 4.0'`
3288                                                         if test -n "$isesix"; then
3289                                                                 osname=esix4
3290                                                         fi
3291                                                 fi
3292                                         fi
3293                                         ;;
3294                                 esac
3295                                 ;;
3296                         *)      if test -f /etc/systemid; then
3297                                         osname=sco
3298                                         set `echo $3 | $sed 's/\./ /g'` $4
3299                                         if $test -f $src/hints/sco_$1_$2_$3.sh; then
3300                                                 osvers=$1.$2.$3
3301                                         elif $test -f $src/hints/sco_$1_$2.sh; then
3302                                                 osvers=$1.$2
3303                                         elif $test -f $src/hints/sco_$1.sh; then
3304                                                 osvers=$1
3305                                         fi
3306                                 else
3307                                         case "$osname" in
3308                                         '') : Still unknown.  Probably a generic Sys V.
3309                                                 osname="sysv"
3310                                                 osvers="$3"
3311                                                 ;;
3312                                         esac
3313                                 fi
3314                                 ;;
3315                         esac
3316                         ;;
3317                 *)      case "$osname" in
3318                         '') : Still unknown.  Probably a generic BSD.
3319                                 osname="$1"
3320                                 osvers="$3"
3321                                 ;;
3322                         esac
3323                         ;;
3324                 esac
3325         else
3326                 if test -f /vmunix -a -f $src/hints/news_os.sh; then
3327                         (what /vmunix | UU/tr '[A-Z]' '[a-z]') > UU/kernel.what 2>&1
3328                         if $contains news-os UU/kernel.what >/dev/null 2>&1; then
3329                                 osname=news_os
3330                         fi
3331                         $rm -f UU/kernel.what
3332                 elif test -d c:/. -o -n "$is_os2" ; then
3333                         set X $myuname
3334                         osname=os2
3335                         osvers="$5"
3336                 fi
3337         fi
3338
3339         case "$targetarch" in
3340         '') ;;
3341         *)  hostarch=$osname
3342             osname=`echo $targetarch|sed 's,^[^-]*-,,'`
3343             osvers=''
3344             ;;
3345         esac
3346
3347         : Now look for a hint file osname_osvers, unless one has been
3348         : specified already.
3349         case "$hintfile" in
3350         ''|' ')
3351                 file=`echo "${osname}_${osvers}" | $sed -e 's%\.%_%g' -e 's%_$%%'`
3352                 : Also try without trailing minor version numbers.
3353                 xfile=`echo $file | $sed -e 's%_[^_]*$%%'`
3354                 xxfile=`echo $xfile | $sed -e 's%_[^_]*$%%'`
3355                 xxxfile=`echo $xxfile | $sed -e 's%_[^_]*$%%'`
3356                 xxxxfile=`echo $xxxfile | $sed -e 's%_[^_]*$%%'`
3357                 case "$file" in
3358                 '') dflt=none ;;
3359                 *)  case "$osvers" in
3360                         '') dflt=$file
3361                                 ;;
3362                         *)  if $test -f $src/hints/$file.sh ; then
3363                                         dflt=$file
3364                                 elif $test -f $src/hints/$xfile.sh ; then
3365                                         dflt=$xfile
3366                                 elif $test -f $src/hints/$xxfile.sh ; then
3367                                         dflt=$xxfile
3368                                 elif $test -f $src/hints/$xxxfile.sh ; then
3369                                         dflt=$xxxfile
3370                                 elif $test -f $src/hints/$xxxxfile.sh ; then
3371                                         dflt=$xxxxfile
3372                                 elif $test -f "$src/hints/${osname}.sh" ; then
3373                                         dflt="${osname}"
3374                                 else
3375                                         dflt=none
3376                                 fi
3377                                 ;;
3378                         esac
3379                         ;;
3380                 esac
3381                 if $test -f Policy.sh ; then
3382                         case "$dflt" in
3383                         *Policy*) ;;
3384                         none) dflt="Policy" ;;
3385                         *) dflt="Policy $dflt" ;;
3386                         esac
3387                 fi
3388                 ;;
3389         *)
3390                 dflt=`echo $hintfile | $sed 's/\.sh$//'`
3391                 ;;
3392         esac
3393
3394         if $test -f Policy.sh ; then
3395                 $cat <<EOM
3396
3397 There's also a Policy hint file available, which should make the
3398 site-specific (policy) questions easier to answer.
3399 EOM
3400
3401         fi
3402
3403         $cat <<EOM
3404
3405 You may give one or more space-separated answers, or "none" if appropriate.
3406 If you have a handcrafted Policy.sh file or a Policy.sh file generated by a
3407 previous run of Configure, you may specify it as well as or instead of
3408 OS-specific hints.  If hints are provided for your OS, you should use them:
3409 although Perl can probably be built without hints on many platforms, using
3410 hints often improve performance and may enable features that Configure can't
3411 set up on its own. If there are no hints that match your OS, specify "none";
3412 DO NOT give a wrong version or a wrong OS.
3413
3414 EOM
3415
3416         rp="Which of these apply, if any?"
3417         . UU/myread
3418         tans=$ans
3419         for file in $tans; do
3420                 if $test X$file = XPolicy -a -f Policy.sh; then
3421                         . Policy.sh
3422                         $cat Policy.sh >> UU/config.sh
3423                 elif $test -f $src/hints/$file.sh; then
3424                         . $src/hints/$file.sh
3425                         $cat $src/hints/$file.sh >> UU/config.sh
3426                 elif $test X"$tans" = X -o X"$tans" = Xnone ; then
3427                         : nothing
3428                 else
3429                         : Give one chance to correct a possible typo.
3430                         echo "$file.sh does not exist"
3431                         dflt=$file
3432                         rp="hint to use instead?"
3433                         . UU/myread
3434                         for file in $ans; do
3435                                 if $test -f "$src/hints/$file.sh"; then
3436                                         . $src/hints/$file.sh
3437                                         $cat $src/hints/$file.sh >> UU/config.sh
3438                                 elif $test X$ans = X -o X$ans = Xnone ; then
3439                                         : nothing
3440                                 else
3441                                         echo "$file.sh does not exist -- ignored."
3442                                 fi
3443                         done
3444                 fi
3445         done
3446
3447         hint=recommended
3448         : Remember our hint file for later.
3449         if $test -f "$src/hints/$file.sh" ; then
3450                 hintfile="$file"
3451         else
3452                 hintfile=''
3453         fi
3454 fi
3455 cd UU
3456 ;;
3457 *)
3458         echo " "
3459         echo "Fetching default answers from $config_sh..." >&4
3460         tmp_n="$n"
3461         tmp_c="$c"
3462         cd ..
3463         cp $config_sh config.sh 2>/dev/null
3464         chmod +w config.sh
3465         . ./config.sh
3466         cd UU
3467         cp ../config.sh .
3468         n="$tmp_n"
3469         c="$tmp_c"
3470         hint=previous
3471         ;;
3472 esac
3473 test "$override" && . ./optdef.sh
3474
3475 : Restore computed paths
3476 for file in $loclist $trylist; do
3477         eval $file="\$_$file"
3478 done
3479
3480 cat << EOM
3481
3482 Configure uses the operating system name and version to set some defaults.
3483 The default value is probably right if the name rings a bell. Otherwise,
3484 since spelling matters for me, either accept the default or answer "none"
3485 to leave it blank.
3486
3487 EOM
3488 case "$osname" in
3489         ''|' ')
3490                 case "$hintfile" in
3491                 ''|' '|none) dflt=none ;;
3492                 *)  dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/_.*$//'` ;;
3493                 esac
3494                 ;;
3495         *) dflt="$osname" ;;
3496 esac
3497 rp="Operating system name?"
3498 . ./myread
3499 case "$ans" in
3500 none)  osname='' ;;
3501 *) osname=`echo "$ans" | $sed -e 's/[   ][      ]*/_/g' | ./tr '[A-Z]' '[a-z]'`;;
3502 esac
3503 echo " "
3504 case "$osvers" in
3505         ''|' ')
3506                 case "$hintfile" in
3507                 ''|' '|none) dflt=none ;;
3508                 *)      dflt=`echo $hintfile | $sed -e 's/\.sh$//' -e 's/^[^_]*//'`
3509                         dflt=`echo $dflt | $sed -e 's/^_//' -e 's/_/./g'`
3510                         case "$dflt" in
3511                         ''|' ') dflt=none ;;
3512                         esac
3513                         ;;
3514                 esac
3515                 ;;
3516         *) dflt="$osvers" ;;
3517 esac
3518 rp="Operating system version?"
3519 . ./myread
3520 case "$ans" in
3521 none)  osvers='' ;;
3522 *) osvers="$ans" ;;
3523 esac
3524
3525
3526 . ./posthint.sh
3527
3528 : who configured the system
3529 cf_time=`LC_ALL=C; LANGUAGE=C; export LC_ALL; export LANGUAGE; $date 2>&1`
3530 case "$cf_by" in
3531 "")
3532         cf_by=`(logname) 2>/dev/null`
3533         case "$cf_by" in
3534         "")
3535                 cf_by=`(whoami) 2>/dev/null`
3536                 case "$cf_by" in
3537                 "") cf_by=unknown ;;
3538                 esac ;;
3539         esac ;;
3540 esac
3541
3542 : decide how portable to be.  Allow command line overrides.
3543 case "$d_portable" in
3544 "$undef") ;;
3545 *)      d_portable="$define" ;;
3546 esac
3547
3548 : set up shell script to do ~ expansion
3549 cat >filexp <<EOSS
3550 $startsh
3551 : expand filename
3552 case "\$1" in
3553  ~/*|~)
3554         echo \$1 | $sed "s|~|\${HOME-\$LOGDIR}|"
3555         ;;
3556  ~*)
3557         if $test -f /bin/csh; then
3558                 /bin/csh -f -c "glob \$1"
3559                 failed=\$?
3560                 echo ""
3561                 exit \$failed
3562         else
3563                 name=\`$expr x\$1 : '..\([^/]*\)'\`
3564                 dir=\`$sed -n -e "/^\${name}:/{s/^[^:]*:[^:]*:[^:]*:[^:]*:[^:]*:\([^:]*\).*"'\$'"/\1/" -e p -e q -e '}' </etc/passwd\`
3565                 if $test ! -d "\$dir"; then
3566                         me=\`basename \$0\`
3567                         echo "\$me: can't locate home directory for: \$name" >&2
3568                         exit 1
3569                 fi
3570                 case "\$1" in
3571                 */*)
3572                         echo \$dir/\`$expr x\$1 : '..[^/]*/\(.*\)'\`
3573                         ;;
3574                 *)
3575                         echo \$dir
3576                         ;;
3577                 esac
3578         fi
3579         ;;
3580 *)
3581         echo \$1
3582         ;;
3583 esac
3584 EOSS
3585 chmod +x filexp
3586 $eunicefix filexp
3587
3588 : now set up to get a file name
3589 cat <<EOS >getfile
3590 $startsh
3591 EOS
3592 cat <<'EOSC' >>getfile
3593 tilde=''
3594 fullpath=''
3595 already=''
3596 skip=''
3597 none_ok=''
3598 exp_file=''
3599 nopath_ok=''
3600 orig_rp="$rp"
3601 orig_dflt="$dflt"
3602 case "$gfpth" in
3603 '') gfpth='.' ;;
3604 esac
3605
3606 case "$fn" in
3607 *\(*)
3608         : getfile will accept an answer from the comma-separated list
3609         : enclosed in parentheses even if it does not meet other criteria.
3610         expr "$fn" : '.*(\(.*\)).*' | $tr ',' $trnl >getfile.ok
3611         fn=`echo $fn | sed 's/(.*)//'`
3612         ;;
3613 esac
3614
3615 case "$fn" in
3616 *:*)
3617         loc_file=`expr $fn : '.*:\(.*\)'`
3618         fn=`expr $fn : '\(.*\):.*'`
3619         ;;
3620 esac
3621
3622 case "$fn" in
3623 *~*) tilde=true;;
3624 esac
3625 case "$fn" in
3626 */*) fullpath=true;;
3627 esac
3628 case "$fn" in
3629 *+*) skip=true;;
3630 esac
3631 case "$fn" in
3632 *n*) none_ok=true;;
3633 esac
3634 case "$fn" in
3635 *e*) exp_file=true;;
3636 esac
3637 case "$fn" in
3638 *p*) nopath_ok=true;;
3639 esac
3640
3641 case "$fn" in
3642 *f*) type='File';;
3643 *d*) type='Directory';;
3644 *l*) type='Locate';;
3645 esac
3646
3647 what="$type"
3648 case "$what" in
3649 Locate) what='File';;
3650 esac
3651
3652 case "$exp_file" in
3653 '')
3654         case "$d_portable" in
3655         "$define") ;;
3656         *) exp_file=true;;
3657         esac
3658         ;;
3659 esac
3660
3661 cd ..
3662 while test "$type"; do
3663         redo=''
3664         rp="$orig_rp"
3665         dflt="$orig_dflt"
3666         case "$tilde" in
3667         true) rp="$rp (~name ok)";;
3668         esac
3669         . UU/myread
3670         if test -f UU/getfile.ok && \
3671                 $contains "^$ans\$" UU/getfile.ok >/dev/null 2>&1
3672         then
3673                 value="$ans"
3674                 ansexp="$ans"
3675                 break
3676         fi
3677         case "$ans" in
3678         none)
3679                 value=''
3680                 ansexp=''
3681                 case "$none_ok" in
3682                 true) type='';;
3683                 esac
3684                 ;;
3685         *)
3686                 case "$tilde" in
3687                 '') value="$ans"
3688                         ansexp="$ans";;
3689                 *)
3690                         value=`UU/filexp $ans`
3691                         case $? in
3692                         0)
3693                                 if test "$ans" != "$value"; then
3694                                         echo "(That expands to $value on this system.)"
3695                                 fi
3696                                 ;;
3697                         *) value="$ans";;
3698                         esac
3699                         ansexp="$value"
3700                         case "$exp_file" in
3701                         '') value="$ans";;
3702                         esac
3703                         ;;
3704                 esac
3705                 case "$fullpath" in
3706                 true)
3707                         case "$ansexp" in
3708                         /*) value="$ansexp" ;;
3709                         [a-zA-Z]:/*) value="$ansexp" ;;
3710                         *)
3711                                 redo=true
3712                                 case "$already" in
3713                                 true)
3714                                 echo "I shall only accept a full path name, as in /bin/ls." >&4
3715                                 echo "Use a ! shell escape if you wish to check pathnames." >&4
3716                                         ;;
3717                                 *)
3718                                 echo "Please give a full path name, starting with slash." >&4
3719                                         case "$tilde" in
3720                                         true)
3721                                 echo "Note that using ~name is ok provided it expands well." >&4
3722                                                 already=true
3723                                                 ;;
3724                                         esac
3725                                 esac
3726                                 ;;
3727                         esac
3728                         ;;
3729                 esac
3730                 case "$redo" in
3731                 '')
3732                         case "$type" in
3733                         File)
3734                                 for fp in $gfpth; do
3735                                         if test "X$fp" = X.; then
3736                                             pf="$ansexp"
3737                                         else    
3738                                             pf="$fp/$ansexp"
3739                                         fi
3740                                         if test -f "$pf"; then
3741                                                 type=''
3742                                         elif test -r "$pf" || (test -h "$pf") >/dev/null 2>&1
3743                                         then
3744                                                 echo "($value is not a plain file, but that's ok.)"
3745                                                 type=''
3746                                         fi
3747                                         if test X"$type" = X; then
3748                                             value="$pf"
3749                                             break
3750                                         fi
3751                                 done
3752                                 ;;
3753                         Directory)
3754                                 for fp in $gfpth; do
3755                                         if test "X$fp" = X.; then
3756                                             dir="$ans"
3757                                             direxp="$ansexp"
3758                                         else    
3759                                             dir="$fp/$ansexp"
3760                                             direxp="$fp/$ansexp"
3761                                         fi
3762                                         if test -d "$direxp"; then
3763                                                 type=''
3764                                                 value="$dir"
3765                                                 break
3766                                         fi
3767                                 done
3768                                 ;;
3769                         Locate)
3770                                 if test -d "$ansexp"; then
3771                                         echo "(Looking for $loc_file in directory $value.)"
3772                                         value="$value/$loc_file"
3773                                         ansexp="$ansexp/$loc_file"
3774                                 fi
3775                                 if test -f "$ansexp"; then
3776                                         type=''
3777                                 fi
3778                                 case "$nopath_ok" in
3779                                 true)   case "$value" in
3780                                         */*) ;;
3781                                         *)      echo "Assuming $value will be in people's path."
3782                                                 type=''
3783                                                 ;;
3784                                         esac
3785                                         ;;
3786                                 esac
3787                                 ;;
3788                         esac
3789
3790                         case "$skip" in
3791                         true) type='';
3792                         esac
3793
3794                         case "$type" in
3795                         '') ;;
3796                         *)
3797                                 if test "$fastread" = yes; then
3798                                         dflt=y
3799                                 else
3800                                         dflt=n
3801                                 fi
3802                                 rp="$what $value doesn't exist.  Use that name anyway?"
3803                                 . UU/myread
3804                                 dflt=''
3805                                 case "$ans" in
3806                                 y*) type='';;
3807                                 *) echo " ";;
3808                                 esac
3809                                 ;;
3810                         esac
3811                         ;;
3812                 esac
3813                 ;;
3814         esac
3815 done
3816 cd UU
3817 ans="$value"
3818 rp="$orig_rp"
3819 dflt="$orig_dflt"
3820 rm -f getfile.ok
3821 test "X$gfpthkeep" != Xy && gfpth=""
3822 EOSC
3823
3824 : determine root of directory hierarchy where package will be installed.
3825 case "$prefix" in
3826 '')
3827         dflt=`./loc . /usr/local /usr/local /local /opt /usr`
3828         ;;
3829 *?/)
3830         dflt=`echo "$prefix" | sed 's/.$//'`
3831         ;;
3832 *)
3833         dflt="$prefix"
3834         ;;
3835 esac
3836 $cat <<EOM
3837
3838 By default, $package will be installed in $dflt/bin, manual pages
3839 under $dflt/man, etc..., i.e. with $dflt as prefix for all
3840 installation directories. Typically this is something like /usr/local.
3841 If you wish to have binaries under /usr/bin but other parts of the
3842 installation under /usr/local, that's ok: you will be prompted
3843 separately for each of the installation directories, the prefix being
3844 only used to set the defaults.
3845
3846 EOM
3847 fn=d~
3848 rp='Installation prefix to use?'
3849 . ./getfile
3850 oldprefix=''
3851 case "$prefix" in
3852 '') ;;
3853 *)
3854         case "$ans" in
3855         "$prefix") ;;
3856         *) oldprefix="$prefix";;
3857         esac
3858         ;;
3859 esac
3860 prefix="$ans"
3861 prefixexp="$ansexp"
3862
3863 case "$afsroot" in
3864 '')     afsroot=/afs ;;
3865 *)      afsroot=$afsroot ;;
3866 esac
3867
3868 : is AFS running?
3869 echo " "
3870 case "$afs" in
3871 $define|true)   afs=true ;;
3872 $undef|false)   afs=false ;;
3873 *)      if test -d $afsroot; then
3874                 afs=true
3875         else
3876                 afs=false
3877         fi
3878         ;;
3879 esac
3880 if $afs; then
3881         echo "AFS may be running... I'll be extra cautious then..." >&4
3882 else
3883         echo "AFS does not seem to be running..." >&4
3884 fi
3885
3886 : determine installation prefix for where package is to be installed.
3887 if $afs; then 
3888 $cat <<EOM
3889
3890 Since you are running AFS, I need to distinguish the directory in which
3891 files will reside from the directory in which they are installed (and from
3892 which they are presumably copied to the former directory by occult means).
3893
3894 EOM
3895         case "$installprefix" in
3896         '') dflt=`echo $prefix | sed 's#^/afs/#/afs/.#'`;;
3897         *) dflt="$installprefix";;
3898         esac
3899 else
3900 $cat <<EOM
3901
3902 In some special cases, particularly when building $package for distribution,
3903 it is convenient to distinguish the directory in which files should be
3904 installed from the directory ($prefix) in which they will
3905 eventually reside.  For most users, these two directories are the same.
3906
3907 EOM
3908         case "$installprefix" in
3909         '') dflt=$prefix ;;
3910         *) dflt=$installprefix;;
3911         esac
3912 fi
3913 fn=d~
3914 rp='What installation prefix should I use for installing files?'
3915 . ./getfile
3916 installprefix="$ans"
3917 installprefixexp="$ansexp"
3918
3919 : Perform the prefixexp/installprefixexp correction if necessary
3920 cat <<EOS >installprefix
3921 $startsh
3922 EOS
3923 cat <<'EOSC' >>installprefix
3924 : Change installation prefix, if necessary.
3925 if $test X"$prefix" != X"$installprefix"; then
3926     eval "install${prefixvar}=\`echo \$${prefixvar}exp | sed \"s#^\$prefixexp#\$installprefixexp#\"\`"
3927 else
3928     eval "install${prefixvar}=\"\$${prefixvar}exp\""
3929 fi
3930 EOSC
3931 chmod +x installprefix
3932 $eunicefix installprefix
3933
3934 : Set variables such as privlib and privlibexp from the output of ./getfile
3935 : performing the prefixexp/installprefixexp correction if necessary.
3936 cat <<EOS >setprefixvar
3937 $startsh
3938 EOS
3939 cat <<'EOSC' >>setprefixvar
3940 eval "${prefixvar}=\"\$ans\""
3941 eval "${prefixvar}exp=\"\$ansexp\""
3942 . ./installprefix
3943 EOSC
3944 chmod +x setprefixvar
3945 $eunicefix setprefixvar
3946
3947 : set up the script used to warn in case of inconsistency
3948 cat <<EOS >whoa
3949 $startsh
3950 EOS
3951 cat <<'EOSC' >>whoa
3952 dflt=y
3953 case "$hint" in
3954     recommended)
3955         case "$hintfile" in
3956         '')     echo "The $hint value for \$$var on this machine was \"$was\"!" >&4
3957                 ;;
3958         *)      echo "Hmm.  Based on the hints in hints/$hintfile.sh, " >&4
3959                 echo "the $hint value for \$$var on this machine was \"$was\"!" >&4
3960                 ;;
3961         esac
3962         ;;
3963     *)  echo " "
3964         echo "*** WHOA THERE!!! ***" >&4
3965         echo "    The $hint value for \$$var on this machine was \"$was\"!" >&4
3966         ;;
3967 esac
3968 rp="    Keep the $hint value?"
3969 . ./myread
3970 case "$ans" in
3971 y) td=$was; tu=$was;;
3972 esac
3973 EOSC
3974
3975 : function used to set $1 to $val
3976 setvar='var=$1; eval "was=\$$1"; td=$define; tu=$undef;
3977 case "$val$was" in
3978 $define$undef) . ./whoa; eval "$var=\$td";;
3979 $undef$define) . ./whoa; eval "$var=\$tu";;
3980 *) eval "$var=$val";;
3981 esac'
3982
3983 case "$usesocks" in
3984 $define|true|[yY]*)     dflt='y';;
3985 *) dflt='n';;
3986 esac
3987 cat <<EOM
3988
3989 Perl can be built to use the SOCKS proxy protocol library.  To do so,
3990 Configure must be run with -Dusesocks.  If you use SOCKS you also need
3991 to use the PerlIO abstraction layer, this will be implicitly selected.
3992
3993 If this doesn't make any sense to you, just accept the default '$dflt'.
3994 EOM
3995 rp='Build Perl for SOCKS?'
3996 . ./myread
3997 case "$ans" in
3998 y|Y)    val="$define" ;;     
3999 *)      val="$undef" ;;
4000 esac
4001 set usesocks
4002 eval $setvar
4003
4004 case "$usesocks" in
4005 $define|true|[yY]*) useperlio="$define";;
4006 esac
4007
4008 case "$useperlio" in
4009 $define|true|[yY]*|'')  dflt='y';;
4010 *) dflt='n';;
4011 esac
4012 cat <<EOM
4013
4014 Previous version of $package used the standard IO mechanisms as
4015 defined in <stdio.h>.  Versions 5.003_02 and later of $package allow
4016 alternate IO mechanisms via the PerlIO abstraction layer, but the
4017 stdio mechanism is still available if needed.  The abstraction layer
4018 can use AT&T's sfio (if you already have sfio installed) or regular stdio.
4019 Using PerlIO with sfio may cause problems with some extension modules.
4020
4021 If this doesn't make any sense to you, just accept the default '$dflt'.
4022 EOM
4023 rp='Use the PerlIO abstraction layer?'
4024 . ./myread
4025 case "$ans" in
4026 y|Y) 
4027         val="$define"
4028         ;;
4029 *)      
4030         echo "Ok, doing things the stdio way."
4031         val="$undef"
4032         ;;
4033 esac
4034 set useperlio
4035 eval $setvar 
4036
4037 case "$usesocks" in
4038 $define|true|[yY]*)
4039         case "$useperlio" in
4040         $define|true|[yY]*) ;;
4041         *)      cat >&4 <<EOM
4042
4043 You are using the SOCKS proxy protocol library which means that you
4044 should also use the PerlIO layer.  You may be headed for trouble.
4045
4046 EOM
4047                 ;;
4048         esac
4049         ;;
4050 esac
4051
4052         
4053 : get the patchlevel
4054 echo " "
4055 echo "Getting the current patchlevel..." >&4
4056 if $test -r $rsrc/patchlevel.h;then
4057         revision=`awk '/define[         ]+PERL_REVISION/ {print $3}' $rsrc/patchlevel.h`
4058         patchlevel=`awk '/define[       ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
4059         subversion=`awk '/define[       ]+PERL_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4060         api_revision=`awk '/define[     ]+PERL_API_REVISION/ {print $3}' $rsrc/patchlevel.h`
4061         api_version=`awk '/define[      ]+PERL_API_VERSION/ {print $3}' $rsrc/patchlevel.h`
4062         api_subversion=`awk '/define[   ]+PERL_API_SUBVERSION/ {print $3}' $rsrc/patchlevel.h`
4063         perl_patchlevel=`egrep 'define PERL_PATCHNUM [0-9][0-9]|,"MAINT[0-9][0-9]*"' $rsrc/patchlevel.h|sed 's/[^0-9]//g'`
4064 else
4065         revision=0
4066         patchlevel=0
4067         subversion=0
4068         api_revision=0
4069         api_version=0
4070         api_subversion=0
4071         perl_patchlevel=0
4072         $echo "(You do not have patchlevel.h.  Eek.)"
4073 fi
4074 if $test -r $rsrc/.patch ; then
4075         if $test "X$perl_patchlevel" = "X" || $test "`cat $rsrc/.patch`" -gt "$perl_patchlevel" ; then
4076                 perl_patchlevel=`cat $rsrc/.patch`
4077         fi
4078 fi
4079 : Define a handy string here to avoid duplication in myconfig.SH and configpm.
4080 version_patchlevel_string="version $patchlevel subversion $subversion"
4081 case "$perl_patchlevel" in
4082 0|'') ;;
4083 *) version_patchlevel_string="$version_patchlevel_string patch $perl_patchlevel" ;;
4084 esac
4085
4086 $echo "(You have $package $version_patchlevel_string.)"
4087
4088 case "$osname" in
4089 dos|vms)
4090         : XXX Should be a Configure test for double-dots in filenames.
4091         version=`echo $revision $patchlevel $subversion | \
4092                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4093         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4094                  $awk '{ printf "%d_%d_%d\n", $1, $2, $3 }'`
4095         ;;
4096 *)
4097         version=`echo $revision $patchlevel $subversion | \
4098                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4099         api_versionstring=`echo $api_revision $api_version $api_subversion | \
4100                  $awk '{ printf "%d.%d.%d\n", $1, $2, $3 }'`
4101         ;;
4102 esac
4103 : Special case the 5.005_xx maintenance series, which used 5.005
4104 : without any subversion label as a subdirectory in $sitelib
4105 if test "${api_revision}${api_version}${api_subversion}" = "550"; then
4106         api_versionstring='5.005'
4107 fi
4108
4109 case "$usethreads" in
4110 $define|true|[yY]*)     dflt='y';;
4111 *)     # Catch case where user specified ithreads or 5005threads but
4112        # forgot -Dusethreads (A.D. 4/2002)
4113        case "$useithreads$use5005threads" in
4114        *$define*)      
4115                 case "$useperlio" in
4116                 "$define")      dflt='y' ;;
4117                 *)              dflt='n' ;;
4118                 esac
4119                 ;;
4120        *)       dflt='n';;
4121        esac
4122        ;;
4123 esac
4124 cat <<EOM
4125
4126 Perl can be built to take advantage of threads on some systems.
4127 To do so, Configure can be run with -Dusethreads.
4128
4129 Note that Perl built with threading support runs slightly slower
4130 and uses more memory than plain Perl. The current implementation
4131 is believed to be stable, but it is fairly new, and so should be
4132 treated with caution.
4133
4134 If this doesn't make any sense to you, just accept the default '$dflt'.
4135 EOM
4136 rp='Build a threading Perl?'
4137 . ./myread
4138 case "$ans" in
4139 y|Y)    val="$define" ;;
4140 *)      val="$undef" ;;
4141 esac
4142 set usethreads
4143 eval $setvar
4144
4145 if $test $patchlevel -lt 9; then
4146     case "$usethreads" in
4147     $define)
4148         $cat <<EOM
4149
4150 Since release 5.6, Perl has had two different threading implementations,
4151 the newer interpreter-based version (ithreads) with one interpreter per
4152 thread, and the older 5.005 version (5005threads).
4153 The 5005threads version is effectively unmaintained and will probably be
4154 removed in Perl 5.10, so there should be no need to build a Perl using it
4155 unless needed for backwards compatibility with some existing 5.005threads
4156 code.
4157
4158 EOM
4159         : Default to ithreads unless overridden on command line or with
4160         : old config.sh
4161         dflt='y'
4162         case "$use5005threads" in
4163                 $define|true|[yY]*) dflt='n';;
4164         esac
4165         case "$useithreads" in
4166                 $undef|false|[nN]*) dflt='n';;
4167         esac
4168         rp='Use the newer interpreter-based ithreads?'
4169         . ./myread
4170         case "$ans" in
4171         y|Y)    val="$define" ;;
4172         *)      val="$undef" ;;
4173         esac
4174         set useithreads
4175         eval $setvar
4176         : Now set use5005threads to the opposite value.
4177         case "$useithreads" in
4178         $define) val="$undef" ;;
4179         *) val="$define" ;;
4180         esac
4181         set use5005threads
4182         eval $setvar
4183         ;;
4184     *)
4185         useithreads="$undef"
4186         use5005threads="$undef"
4187         ;;
4188     esac
4189
4190     case "$useithreads$use5005threads" in
4191     "$define$define")
4192         $cat >&4 <<EOM
4193
4194 You cannot have both the ithreads and the 5.005 threads enabled
4195 at the same time.  Disabling the 5.005 threads since they are
4196 much less stable than the ithreads.
4197
4198 EOM
4199         use5005threads="$undef"
4200         ;;
4201     esac
4202
4203 else
4204 : perl-5.9.x and later
4205
4206     use5005threads="$undef"
4207     case "$usethreads" in
4208     $define)
4209         : Default to ithreads unless overridden on command line or with
4210         : old config.sh
4211         dflt='y'
4212         case "$useithreads" in
4213                 $undef|false|[nN]*) dflt='n';;
4214         esac
4215         rp='Use the newer interpreter-based ithreads?'
4216         . ./myread
4217         case "$ans" in
4218         y|Y)    val="$define" ;;
4219         *)      val="$undef" ;;
4220         esac
4221         set useithreads
4222         eval $setvar
4223         ;;
4224     *)
4225         useithreads="$undef"
4226         ;;
4227     esac
4228
4229 fi
4230
4231 if test X"$usethreads" = "X$define" -a "X$useperlio" = "Xundef"; then
4232         cat >&4 <<EOF
4233 ***
4234 *** To build with ithreads you must also use the PerlIO layer.
4235 *** Cannot continue, aborting.
4236 ***
4237 EOF
4238         exit 1
4239 fi
4240
4241 case "$d_oldpthreads" in
4242 '')     : Configure tests would be welcome here.  For now, assume undef.
4243         val="$undef" ;;
4244 *)      val="$d_oldpthreads" ;;
4245 esac
4246 set d_oldpthreads
4247 eval $setvar
4248
4249
4250 : Look for a hint-file generated 'call-back-unit'.  If the
4251 : user has specified that a threading perl is to be built,
4252 : we may need to set or change some other defaults.
4253 if $test -f usethreads.cbu; then
4254     echo "Your platform has some specific hints regarding threaded builds, using them..."
4255     . ./usethreads.cbu
4256 else
4257     case "$usethreads" in
4258         "$define"|true|[yY]*)
4259                 $cat <<EOM
4260 (Your platform does not have any specific hints for threaded builds.
4261  Assuming POSIX threads, then.)
4262 EOM
4263         ;;
4264     esac
4265 fi
4266
4267 cat <<EOM
4268
4269 Perl can be built so that multiple Perl interpreters can coexist
4270 within the same Perl executable.
4271 EOM
4272
4273 case "$useithreads" in
4274 $define)
4275         cat <<EOM
4276 This multiple interpreter support is required for interpreter-based threads.
4277 EOM
4278         val="$define"
4279         ;;
4280 *)      case "$usemultiplicity" in
4281         $define|true|[yY]*)     dflt='y';;
4282         *) dflt='n';;
4283         esac
4284         echo " "
4285         echo "If this doesn't make any sense to you, just accept the default '$dflt'."
4286         rp='Build Perl for multiplicity?'
4287         . ./myread
4288         case "$ans" in
4289         y|Y)    val="$define" ;;
4290         *)      val="$undef" ;;
4291         esac
4292         ;;
4293 esac
4294 set usemultiplicity
4295 eval $setvar
4296
4297
4298 case "$usemorebits" in
4299 "$define"|true|[yY]*)
4300         use64bitint="$define"
4301         uselongdouble="$define"
4302         usemorebits="$define"
4303         ;;
4304 *)      usemorebits="$undef"
4305         ;;
4306 esac
4307
4308 : make some quick guesses about what we are up against
4309 echo " "
4310 $echo $n "Hmm...  $c"
4311 echo exit 1 >bsd
4312 echo exit 1 >usg
4313 echo exit 1 >v7
4314 echo exit 1 >osf1
4315 echo exit 1 >eunice
4316 echo exit 1 >xenix
4317 echo exit 1 >venix
4318 echo exit 1 >os2
4319 d_bsd="$undef"
4320 $cat /usr/include/signal.h /usr/include/sys/signal.h >foo 2>/dev/null
4321 if test -f /osf_boot || $contains 'OSF/1' /usr/include/ctype.h >/dev/null 2>&1
4322 then
4323         echo "Looks kind of like an OSF/1 system, but we'll see..."
4324         echo exit 0 >osf1
4325 elif test `echo abc | $tr a-z A-Z` = Abc ; then
4326         xxx=`./loc addbib blurfl $pth`
4327         if $test -f $xxx; then
4328         echo "Looks kind of like a USG system with BSD features, but we'll see..."
4329                 echo exit 0 >bsd
4330                 echo exit 0 >usg
4331         else
4332                 if $contains SIGTSTP foo >/dev/null 2>&1 ; then
4333                         echo "Looks kind of like an extended USG system, but we'll see..."
4334                 else
4335                         echo "Looks kind of like a USG system, but we'll see..."
4336                 fi
4337                 echo exit 0 >usg
4338         fi
4339 elif $contains SIGTSTP foo >/dev/null 2>&1 ; then
4340         echo "Looks kind of like a BSD system, but we'll see..."
4341         d_bsd="$define"
4342         echo exit 0 >bsd
4343 else
4344         echo "Looks kind of like a Version 7 system, but we'll see..."
4345         echo exit 0 >v7
4346 fi
4347 case "$eunicefix" in
4348 *unixtovms*)
4349         $cat <<'EOI'
4350 There is, however, a strange, musty smell in the air that reminds me of
4351 something...hmm...yes...I've got it...there's a VMS nearby, or I'm a Blit.
4352 EOI
4353         echo exit 0 >eunice
4354         d_eunice="$define"
4355 : it so happens the Eunice I know will not run shell scripts in Unix format
4356         ;;
4357 *)
4358         echo " "
4359         echo "Congratulations.  You aren't running Eunice."
4360         d_eunice="$undef"
4361         ;;
4362 esac
4363 : Detect OS2.  The p_ variable is set above in the Head.U unit.
4364 : Note that this also -- wrongly -- detects e.g. dos-djgpp, which also uses
4365 : semicolon as a patch separator
4366 case "$p_" in
4367 :) ;;
4368 *)
4369         $cat <<'EOI'
4370 I have the feeling something is not exactly right, however...don't tell me...
4371 lemme think...does HAL ring a bell?...no, of course, you're only running OS/2!
4372 (Or you may be running DOS with DJGPP.)
4373 EOI
4374         echo exit 0 >os2
4375         ;;
4376 esac
4377 if test -f /xenix; then
4378         echo "Actually, this looks more like a XENIX system..."
4379         echo exit 0 >xenix
4380         d_xenix="$define"
4381 else
4382         echo " "
4383         echo "It's not Xenix..."
4384         d_xenix="$undef"
4385 fi
4386 chmod +x xenix
4387 $eunicefix xenix
4388 if test -f /venix; then
4389         echo "Actually, this looks more like a VENIX system..."
4390         echo exit 0 >venix
4391 else
4392         echo " "
4393         if ./xenix; then
4394                 : null
4395         else
4396                 echo "Nor is it Venix..."
4397         fi
4398 fi
4399 chmod +x bsd usg v7 osf1 eunice xenix venix os2
4400 $eunicefix bsd usg v7 osf1 eunice xenix venix os2
4401 $rm -f foo
4402
4403 case "$cc" in
4404 '') dflt=cc;;
4405 *) dflt="$cc";;
4406 esac
4407 rp="Use which C compiler?"
4408 . ./myread
4409 cc="$ans"
4410
4411 : See if they have not cc but they do have gcc
4412 . ./trygcc
4413 : Look for a hint-file generated 'call-back-unit'.  Now that the
4414 : user has specified the compiler, we may need to set or change some
4415 : other defaults.
4416 if $test -f cc.cbu; then
4417     . ./cc.cbu
4418 fi
4419 . ./checkcc
4420
4421 echo " "
4422 echo "Checking for GNU cc in disguise and/or its version number..." >&4
4423 $cat >try.c <<EOM
4424 #include <stdio.h>
4425 int main() {
4426 #if defined(__GNUC__) && !defined(__INTEL_COMPILER)
4427 #ifdef __VERSION__
4428         printf("%s\n", __VERSION__);
4429 #else
4430         printf("%s\n", "1");
4431 #endif
4432 #endif
4433         return(0);
4434 }
4435 EOM
4436 if $cc -o try $ccflags $ldflags try.c; then
4437         gccversion=`$run ./try`
4438         case "$gccversion" in
4439         '') echo "You are not using GNU cc." ;;
4440         *)  echo "You are using GNU cc $gccversion."
4441             ccname=gcc
4442             ;;
4443         esac
4444 else
4445         echo " "
4446         echo "*** WHOA THERE!!! ***" >&4
4447         echo "    Your C compiler \"$cc\" doesn't seem to be working!" >&4
4448         case "$knowitall" in
4449         '')
4450         echo "    You'd better start hunting for one and let me know about it." >&4
4451                 exit 1
4452                 ;;
4453         esac
4454 fi
4455 $rm -f try try.*
4456 case "$gccversion" in
4457 1*) cpp=`./loc gcc-cpp $cpp $pth` ;;
4458 esac
4459 case "$gccversion" in
4460 '') gccosandvers='' ;;
4461 *) gccshortvers=`echo "$gccversion"|sed 's/ .*//'`
4462    gccosandvers=`$cc -v 2>&1|grep '/specs$'|sed "s!.*/[^-/]*-[^-/]*-\([^-/]*\)/$gccshortvers/specs!\1!"`
4463    gccshortvers=''
4464    case "$gccosandvers" in
4465    $osname) gccosandvers='' ;; # linux gccs seem to have no linux osvers, grr
4466    $osname$osvers) ;; # looking good
4467    $osname*) cat <<EOM >&4
4468
4469 *** WHOA THERE!!! ***
4470
4471     Your gcc has not been compiled for the exact release of
4472     your operating system ($gccosandvers versus $osname$osvers).
4473
4474     In general it is a good idea to keep gcc synchronized with
4475     the operating system because otherwise serious problems
4476     may ensue when trying to compile software, like Perl.
4477
4478     I'm trying to be optimistic here, though, and will continue.
4479     If later during the configuration and build icky compilation
4480     problems appear (headerfile conflicts being the most common
4481     manifestation), I suggest reinstalling the gcc to match
4482     your operating system release.
4483
4484 EOM
4485       ;;
4486    *) gccosandvers='' ;; # failed to parse, better be silent
4487    esac
4488    ;;
4489 esac
4490 case "$ccname" in
4491 '') ccname="$cc" ;;
4492 esac
4493
4494 # gcc 3.* complain about adding -Idirectories that they already know about,
4495 # so we will take those off from locincpth.
4496 case "$gccversion" in
4497 3*)
4498     echo "main(){}">try.c
4499     for incdir in $locincpth; do
4500        warn=`$cc $ccflags -I$incdir -c try.c 2>&1 | \
4501              grep '^c[cp]p*[01]: warning: changing search order '`
4502        if test "X$warn" != X; then
4503            locincpth=`echo " $locincpth " | sed "s! $incdir ! !"`
4504        fi
4505     done
4506     $rm -f try try.*
4507 esac
4508
4509 : What should the include directory be ?
4510 echo " "
4511 $echo $n "Hmm...  $c"
4512 dflt='/usr/include'
4513 incpath=''
4514 mips_type=''
4515 if $test -f /bin/mips && /bin/mips; then
4516         echo "Looks like a MIPS system..."
4517         $cat >usr.c <<'EOCP'
4518 #ifdef SYSTYPE_BSD43
4519 /bsd43
4520 #endif
4521 EOCP
4522         if cc -E usr.c > usr.out && $contains / usr.out >/dev/null 2>&1; then
4523                 dflt='/bsd43/usr/include'
4524                 incpath='/bsd43'
4525                 mips_type='BSD 4.3'
4526         else
4527                 mips_type='System V'
4528         fi
4529         $rm -f usr.c usr.out
4530         echo "and you're compiling with the $mips_type compiler and libraries."
4531         xxx_prompt=y
4532         echo "exit 0" >mips
4533 else
4534         echo "Doesn't look like a MIPS system."
4535         xxx_prompt=n
4536         echo "exit 1" >mips
4537 fi
4538 chmod +x mips
4539 $eunicefix mips
4540 case "$usrinc" in
4541 '') ;;
4542 *) dflt="$usrinc";;
4543 esac
4544 case "$xxx_prompt" in
4545 y)      fn=d/
4546         echo " "
4547         rp='Where are the include files you want to use?'
4548         . ./getfile
4549         usrinc="$ans"
4550         ;;
4551 *)      usrinc="$dflt"
4552         ;;
4553 esac
4554
4555 : see how we invoke the C preprocessor
4556 echo " "
4557 echo "Now, how can we feed standard input to your C preprocessor..." >&4
4558 cat <<'EOT' >testcpp.c
4559 #define ABC abc
4560 #define XYZ xyz
4561 ABC.XYZ
4562 EOT
4563 cd ..
4564 if test ! -f cppstdin; then
4565         if test "X$osname" = "Xaix" -a "X$gccversion" = X; then
4566                 # AIX cc -E doesn't show the absolute headerfile
4567                 # locations but we'll cheat by using the -M flag.
4568                 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
4569         else
4570                 echo 'cat >.$$.c; '"$cc"' -E ${1+"$@"} .$$.c; rm .$$.c' >cppstdin
4571         fi
4572 else
4573         echo "Keeping your $hint cppstdin wrapper."
4574 fi
4575 chmod 755 cppstdin
4576 wrapper=`pwd`/cppstdin
4577 ok='false'
4578 cd UU
4579
4580 if $test "X$cppstdin" != "X" && \
4581         $cppstdin $cppminus <testcpp.c >testcpp.out 2>&1 && \
4582         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4583 then
4584         echo "You used to use $cppstdin $cppminus so we'll use that again."
4585         case "$cpprun" in
4586         '') echo "But let's see if we can live without a wrapper..." ;;
4587         *)
4588                 if $cpprun $cpplast <testcpp.c >testcpp.out 2>&1 && \
4589                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4590                 then
4591                         echo "(And we'll use $cpprun $cpplast to preprocess directly.)"
4592                         ok='true'
4593                 else
4594                         echo "(However, $cpprun $cpplast does not work, let's see...)"
4595                 fi
4596                 ;;
4597         esac
4598 else
4599         case "$cppstdin" in
4600         '') ;;
4601         *)
4602                 echo "Good old $cppstdin $cppminus does not seem to be of any help..."
4603                 ;;
4604         esac
4605 fi
4606
4607 if $ok; then
4608         : nothing
4609 elif echo 'Maybe "'"$cc"' -E" will work...'; \
4610         $cc -E <testcpp.c >testcpp.out 2>&1; \
4611         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4612         echo "Yup, it does."
4613         x_cpp="$cc -E"
4614         x_minus='';
4615 elif echo 'Nope...maybe "'"$cc"' -E -" will work...'; \
4616         $cc -E - <testcpp.c >testcpp.out 2>&1; \
4617         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4618         echo "Yup, it does."
4619         x_cpp="$cc -E"
4620         x_minus='-';
4621 elif echo 'Nope...maybe "'"$cc"' -P" will work...'; \
4622         $cc -P <testcpp.c >testcpp.out 2>&1; \
4623         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4624         echo "Yipee, that works!"
4625         x_cpp="$cc -P"
4626         x_minus='';
4627 elif echo 'Nope...maybe "'"$cc"' -P -" will work...'; \
4628         $cc -P - <testcpp.c >testcpp.out 2>&1; \
4629         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4630         echo "At long last!"
4631         x_cpp="$cc -P"
4632         x_minus='-';
4633 elif echo 'No such luck, maybe "'$cpp'" will work...'; \
4634         $cpp <testcpp.c >testcpp.out 2>&1; \
4635         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4636         echo "It works!"
4637         x_cpp="$cpp"
4638         x_minus='';
4639 elif echo 'Nixed again...maybe "'$cpp' -" will work...'; \
4640         $cpp - <testcpp.c >testcpp.out 2>&1; \
4641         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4642         echo "Hooray, it works!  I was beginning to wonder."
4643         x_cpp="$cpp"
4644         x_minus='-';
4645 elif echo 'Uh-uh.  Time to get fancy.  Trying a wrapper...'; \
4646         $wrapper <testcpp.c >testcpp.out 2>&1; \
4647         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4648         x_cpp="$wrapper"
4649         x_minus=''
4650         echo "Eureka!"
4651 else
4652         dflt=''
4653         rp="No dice.  I can't find a C preprocessor.  Name one:"
4654         . ./myread
4655         x_cpp="$ans"
4656         x_minus=''
4657         $x_cpp <testcpp.c >testcpp.out 2>&1
4658         if $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1 ; then
4659                 echo "OK, that will do." >&4
4660         else
4661 echo "Sorry, I can't get that to work.  Go find one and rerun Configure." >&4
4662                 exit 1
4663         fi
4664 fi
4665
4666 case "$ok" in
4667 false)
4668         cppstdin="$x_cpp"
4669         cppminus="$x_minus"
4670         cpprun="$x_cpp"
4671         cpplast="$x_minus"
4672         set X $x_cpp
4673         shift
4674         case "$1" in
4675         "$cpp")
4676                 echo "Perhaps can we force $cc -E using a wrapper..."
4677                 if $wrapper <testcpp.c >testcpp.out 2>&1; \
4678                         $contains 'abc.*xyz' testcpp.out >/dev/null 2>&1
4679                 then
4680                         echo "Yup, we can."
4681                         cppstdin="$wrapper"
4682                         cppminus='';
4683                 else
4684                         echo "Nope, we'll have to live without it..."
4685                 fi
4686                 ;;
4687         esac
4688         case "$cpprun" in
4689         "$wrapper")
4690                 cpprun=''
4691                 cpplast=''
4692                 ;;
4693         esac
4694         ;;
4695 esac
4696
4697 case "$cppstdin" in
4698 "$wrapper"|'cppstdin') ;;
4699 *) $rm -f $wrapper;;
4700 esac
4701 $rm -f testcpp.c testcpp.out
4702
4703 : Set private lib path
4704 case "$plibpth" in
4705 '') if ./mips; then
4706                 plibpth="$incpath/usr/lib /usr/local/lib /usr/ccs/lib"
4707         fi;;
4708 esac
4709 case "$libpth" in
4710 ' ') dlist='';;
4711 '') dlist="$loclibpth $plibpth $glibpth";;
4712 *) dlist="$libpth";;
4713 esac
4714
4715 : Now check and see which directories actually exist, avoiding duplicates
4716 libpth=''
4717 for xxx in $dlist
4718 do
4719     if $test -d $xxx; then
4720                 case " $libpth " in
4721                 *" $xxx "*) ;;
4722                 *) libpth="$libpth $xxx";;
4723                 esac
4724     fi
4725 done
4726 $cat <<'EOM'
4727
4728 Some systems have incompatible or broken versions of libraries.  Among
4729 the directories listed in the question below, please remove any you
4730 know not to be holding relevant libraries, and add any that are needed.
4731 Say "none" for none.
4732
4733 EOM
4734 case "$libpth" in
4735 '') dflt='none';;
4736 *)
4737         set X $libpth
4738         shift
4739         dflt=${1+"$@"}
4740         ;;
4741 esac
4742 rp="Directories to use for library searches?"
4743 . ./myread
4744 case "$ans" in
4745 none) libpth=' ';;
4746 *) libpth="$ans";;
4747 esac
4748
4749 : compute shared library extension
4750 case "$so" in
4751 '')
4752         if xxx=`./loc libc.sl X $libpth`; $test -f "$xxx"; then
4753                 dflt='sl'
4754         else
4755                 dflt='so'
4756         fi
4757         ;;
4758 *) dflt="$so";;
4759 esac
4760 $cat <<EOM
4761
4762 On some systems, shared libraries may be available.  Answer 'none' if
4763 you want to suppress searching of shared libraries for the remainder
4764 of this configuration.
4765
4766 EOM
4767 rp='What is the file extension used for shared libraries?'
4768 . ./myread
4769 so="$ans"
4770
4771 : Define several unixisms.
4772 : Hints files or command line option can be used to override them.
4773 : The convoluted testing is in case hints files set either the old
4774 : or the new name.
4775 case "$_exe" in
4776 '')     case "$exe_ext" in
4777         '')     ;;
4778         *)      _exe="$exe_ext" ;;
4779         esac
4780         ;;
4781 esac
4782 case "$_a" in
4783 '')     case "$lib_ext" in
4784     '') _a='.a';;
4785         *)      _a="$lib_ext" ;;
4786         esac
4787         ;;
4788 esac
4789 case "$_o" in
4790 '') case "$obj_ext" in
4791         '')     _o='.o';;
4792         *)      _o="$obj_ext";;
4793         esac
4794         ;;
4795 esac
4796 case "$p_" in
4797 '') case "$path_sep" in
4798         '')     p_=':';;
4799         *)      p_="$path_sep";;
4800         esac
4801         ;;
4802 esac
4803 exe_ext=$_exe
4804 lib_ext=$_a
4805 obj_ext=$_o
4806 path_sep=$p_
4807
4808 : Which makefile gets called first.  This is used by make depend.
4809 case "$firstmakefile" in
4810 '') firstmakefile='makefile';;
4811 esac
4812
4813 case "$ccflags" in
4814 *-DUSE_LONG_DOUBLE*|*-DUSE_MORE_BITS*) uselongdouble="$define" ;;
4815 esac
4816
4817 case "$uselongdouble" in
4818 $define|true|[yY]*)     dflt='y';;
4819 *) dflt='n';;
4820 esac
4821 cat <<EOM
4822
4823 Perl can be built to take advantage of long doubles which
4824 (if available) may give more accuracy and range for floating point numbers.
4825
4826 If this doesn't make any sense to you, just accept the default '$dflt'.
4827 EOM
4828 rp='Try to use long doubles if available?'
4829 . ./myread
4830 case "$ans" in
4831 y|Y)    val="$define"   ;;
4832 *)      val="$undef"    ;;
4833 esac
4834 set uselongdouble
4835 eval $setvar
4836
4837 case "$uselongdouble" in
4838 true|[yY]*) uselongdouble="$define" ;;
4839 esac
4840
4841 : Look for a hint-file generated 'call-back-unit'.  If the
4842 : user has specified that long doubles should be used,
4843 : we may need to set or change some other defaults.
4844 if $test -f uselongdouble.cbu; then
4845     echo "Your platform has some specific hints regarding long doubles, using them..."
4846     . ./uselongdouble.cbu
4847 else
4848     case "$uselongdouble" in
4849         $define)
4850                 $cat <<EOM
4851 (Your platform does not have any specific hints for long doubles.)
4852 EOM
4853         ;;
4854     esac
4855 fi
4856
4857 : Looking for optional libraries
4858 echo " "
4859 echo "Checking for optional libraries..." >&4
4860 case "$libs" in
4861 ' '|'') dflt='';;
4862 *) dflt="$libs";;
4863 esac
4864 case "$libswanted" in
4865 '') libswanted='c_s';;
4866 esac
4867 case "$usesocks" in
4868 "$define") libswanted="$libswanted socks5 socks5_sh" ;;
4869 esac
4870 libsfound=''
4871 libsfiles=''
4872 libsdirs=''
4873 libspath=''
4874 for thisdir in $libpth $xlibpth; do
4875   test -d $thisdir && libspath="$libspath $thisdir"
4876 done
4877 for thislib in $libswanted; do
4878         for thisdir in $libspath; do
4879             xxx=''
4880             if $test ! -f "$xxx" -a "X$ignore_versioned_solibs" = "X"; then
4881                 xxx=`ls $thisdir/lib$thislib.$so.[0-9] 2>/dev/null|sed -n '$p'`
4882                 $test -f "$xxx" && eval $libscheck
4883                 $test -f "$xxx" && libstyle=shared
4884             fi
4885             if test ! -f "$xxx"; then
4886                 xxx=$thisdir/lib$thislib.$so
4887                 $test -f "$xxx" && eval $libscheck
4888                 $test -f "$xxx" && libstyle=shared
4889             fi  
4890             if test ! -f "$xxx"; then
4891                 xxx=$thisdir/lib$thislib$_a
4892                 $test -f "$xxx" && eval $libscheck
4893                 $test -f "$xxx" && libstyle=static
4894             fi
4895             if test ! -f "$xxx"; then
4896                 xxx=$thisdir/$thislib$_a
4897                 $test -f "$xxx" && eval $libscheck
4898                 $test -f "$xxx" && libstyle=static
4899             fi
4900             if test ! -f "$xxx"; then
4901                 xxx=$thisdir/lib${thislib}_s$_a
4902                 $test -f "$xxx" && eval $libscheck
4903                 $test -f "$xxx" && libstyle=static
4904                 $test -f "$xxx" && thislib=${thislib}_s
4905             fi
4906             if test ! -f "$xxx"; then
4907                 xxx=$thisdir/Slib$thislib$_a
4908                 $test -f "$xxx" && eval $libscheck
4909                 $test -f "$xxx" && libstyle=static
4910             fi
4911             if $test -f "$xxx"; then
4912                 case "$libstyle" in
4913                 shared) echo "Found -l$thislib (shared)." ;;
4914                 static) echo "Found -l$thislib." ;;
4915                 *)      echo "Found -l$thislib ($libstyle)." ;;
4916                 esac
4917                 case " $dflt " in
4918                 *"-l$thislib "*);;
4919                 *) dflt="$dflt -l$thislib"
4920                    libsfound="$libsfound $xxx"
4921                    yyy=`basename $xxx`
4922                    libsfiles="$libsfiles $yyy"
4923                    yyy=`echo $xxx|$sed -e "s%/$yyy\\$%%"`
4924                    case " $libsdirs " in
4925                    *" $yyy "*) ;;
4926                    *) libsdirs="$libsdirs $yyy" ;;
4927                    esac
4928                    ;;
4929                 esac
4930                 break
4931             fi  
4932         done
4933         if $test ! -f "$xxx"; then
4934             echo "No -l$thislib."
4935         fi
4936 done
4937 set X $dflt
4938 shift
4939 dflt="$*"
4940 case "$libs" in
4941 '') dflt="$dflt";;
4942 *) dflt="$libs";;
4943 esac
4944 case "$dflt" in
4945 ' '|'') dflt='none';;
4946 esac
4947
4948 $cat <<EOM
4949
4950 In order to compile $package on your machine, a number of libraries
4951 are usually needed.  Include any other special libraries here as well.
4952 Say "none" for none.  The default list is almost always right.
4953 EOM
4954
4955 echo " "
4956 rp="What libraries to use?"
4957 . ./myread
4958 case "$ans" in
4959 none) libs=' ';;
4960 *) libs="$ans";;
4961 esac
4962
4963 : determine optimization, if desired, or use for debug flag also
4964 case "$optimize" in
4965 ' '|$undef) dflt='none';;
4966 '') dflt='-O';;
4967 *) dflt="$optimize";;
4968 esac
4969 $cat <<EOH
4970
4971 By default, $package compiles with the -O flag to use the optimizer.
4972 Alternately, you might want to use the symbolic debugger, which uses
4973 the -g flag (on traditional Unix systems).  Either flag can be
4974 specified here.  To use neither flag, specify the word "none".
4975
4976 EOH
4977 rp="What optimizer/debugger flag should be used?"
4978 . ./myread
4979 optimize="$ans"
4980 case "$optimize" in
4981 'none') optimize=" ";;
4982 esac
4983
4984 : Check what DEBUGGING is required from the command line
4985 : -DEBUGGING      or -DDEBUGGING or
4986 : -DEBUGGING=both                       = -g + -DDEBUGGING
4987 : -DEBUGGING=-g   or -Doptimize=-g      = -g
4988 : -DEBUGGING=none or -UDEBUGGING        =
4989 : -DEBUGGING=old  or -DEBUGGING=default = ? $optimize
4990 case "$EBUGGING" in
4991 '')     ;;
4992 *)      DEBUGGING=$EBUGGING ;;
4993 esac
4994
4995 case "$DEBUGGING" in
4996 -g|both|$define)
4997     case "$optimize" in
4998         *-g*) ;;
4999         *)    optimize="$optimize -g" ;;
5000     esac ;;
5001 none|$undef)
5002     case "$optimize" in
5003         *-g*)   set `echo "X $optimize " | sed 's/ -g / /'`
5004                 shift
5005                 optimize="$*"
5006                 ;;
5007     esac ;;
5008 esac
5009
5010 dflt=''
5011 case "$DEBUGGING" in
5012 both|$define) dflt='-DDEBUGGING'
5013 esac
5014
5015 : We will not override a previous value, but we might want to
5016 : augment a hint file
5017 case "$hint" in
5018 default|recommended)
5019         case "$gccversion" in
5020         1*) dflt="$dflt -fpcc-struct-return" ;;
5021         esac
5022         case "$optimize:$DEBUGGING" in
5023         *-g*:old) dflt="$dflt -DDEBUGGING";;
5024         esac
5025         case "$gccversion" in
5026         2*) if test -d /etc/conf/kconfig.d &&
5027                         $contains _POSIX_VERSION $usrinc/sys/unistd.h >/dev/null 2>&1
5028                 then
5029                         # Interactive Systems (ISC) POSIX mode.
5030                         dflt="$dflt -posix"
5031                 fi
5032                 ;;
5033         esac
5034         case "$gccversion" in
5035         1*) ;;
5036         2.[0-8]*) ;;
5037         ?*)     echo " "
5038                 echo "Checking if your compiler accepts -fno-strict-aliasing" 2>&1
5039                 echo 'int main(void) { return 0; }' > gcctest.c
5040                 if $cc -O2 -fno-strict-aliasing -o gcctest gcctest.c; then
5041                         echo "Yes, it does." 2>&1
5042                         case "$ccflags" in
5043                         *strict-aliasing*)
5044                                 echo "Leaving current flags $ccflags alone." 2>&1
5045                                 ;;
5046                         *) dflt="$dflt -fno-strict-aliasing" ;;
5047                         esac
5048                 else
5049                         echo "Nope, it doesn't, but that's ok." 2>&1
5050                 fi
5051                 ;;
5052         esac
5053         # For gcc, adding -pipe speeds up compilations for some, but apparently
5054         # some assemblers can't read from stdin.  (It also slows down compilations
5055         # in other cases, but those are apparently rarer these days.)  AD 5/2004.
5056         case "$gccversion" in
5057         ?*)     echo " "
5058                 echo "Checking if your compiler accepts -pipe" 2>&1
5059                 echo 'int main(void) { return 0; }' > gcctest.c
5060                 if $cc -pipe -o gcctest gcctest.c; then
5061                         echo "Yes, it does." 2>&1
5062                         case "$ccflags" in
5063                         *-pipe*)
5064                                 echo "Leaving current flags $ccflags alone." 2>&1
5065                                 ;;
5066                         *) dflt="$dflt -pipe" ;;
5067                         esac
5068                 else
5069                         echo "Nope, it doesn't, but that's ok." 2>&1
5070                 fi
5071                 ;;
5072         esac
5073         ;;
5074 esac
5075
5076 case "$mips_type" in
5077 *BSD*|'') inclwanted="$locincpth $usrinc";;
5078 *) inclwanted="$locincpth $inclwanted $usrinc/bsd";;
5079 esac
5080 for thisincl in $inclwanted; do
5081         if $test -d $thisincl; then
5082                 if $test x$thisincl != x$usrinc; then
5083                         case "$dflt" in
5084                         *" -I$thisincl "*);;
5085                         *) dflt="$dflt -I$thisincl ";;
5086                         esac
5087                 fi
5088         fi
5089 done
5090
5091 inctest='if $contains $2 $usrinc/$1 >/dev/null 2>&1; then
5092         xxx=true;
5093 elif $contains $2 $usrinc/sys/$1 >/dev/null 2>&1; then
5094         xxx=true;
5095 else
5096         xxx=false;
5097 fi;
5098 if $xxx; then
5099         case "$dflt" in
5100         *$2*);;
5101         *) dflt="$dflt -D$2";;
5102         esac;
5103 fi'
5104
5105 set signal.h LANGUAGE_C; eval $inctest
5106
5107 case "$usesocks" in
5108 $define)
5109         ccflags="$ccflags -DSOCKS"
5110         ;;
5111 esac
5112
5113 case "$hint" in
5114 default|recommended) dflt="$ccflags $dflt" ;;
5115 *) dflt="$ccflags";;
5116 esac
5117
5118 case "$dflt" in
5119 ''|' ') dflt=none;;
5120 esac
5121
5122 $cat <<EOH
5123
5124 Your C compiler may want other flags.  For this question you should include
5125 -I/whatever and -DWHATEVER flags and any other flags used by the C compiler,
5126 but you should NOT include libraries or ld flags like -lwhatever.  If you
5127 want $package to honor its debug switch, you should include -DDEBUGGING here.
5128 Your C compiler might also need additional flags, such as -D_POSIX_SOURCE.
5129
5130 To use no flags, specify the word "none".
5131
5132 EOH
5133 set X $dflt
5134 shift
5135 dflt=${1+"$@"}
5136 rp="Any additional cc flags?"
5137 . ./myread
5138 case "$ans" in
5139 none) ccflags='';;
5140 *) ccflags="$ans";;
5141 esac
5142
5143 : the following weeds options from ccflags that are of no interest to cpp
5144 case "$cppflags" in
5145 '') cppflags="$ccflags" ;;
5146 *)  cppflags="$cppflags $ccflags" ;;
5147 esac
5148 case "$gccversion" in
5149 1*) cppflags="$cppflags -D__GNUC__"
5150 esac
5151 case "$mips_type" in
5152 '');;
5153 *BSD*) cppflags="$cppflags -DSYSTYPE_BSD43";;
5154 esac
5155 case "$cppflags" in
5156 '');;
5157 *)
5158         echo " "
5159         echo "Let me guess what the preprocessor flags are..." >&4
5160         set X $cppflags
5161         shift
5162         cppflags=''
5163         $cat >cpp.c <<'EOM'
5164 #define BLURFL foo
5165
5166 BLURFL xx LFRULB
5167 EOM
5168         previous=''
5169         for flag in $*
5170         do
5171                 case "$flag" in
5172                 -*) ftry="$flag";;
5173                 *) ftry="$previous $flag";;
5174                 esac
5175                 if $cppstdin -DLFRULB=bar $cppflags $ftry $cppminus <cpp.c \
5176                         >cpp1.out 2>/dev/null && \
5177                         $cpprun -DLFRULB=bar $cppflags $ftry $cpplast <cpp.c \
5178                         >cpp2.out 2>/dev/null && \
5179                         $contains 'foo.*xx.*bar' cpp1.out >/dev/null 2>&1 && \
5180                         $contains 'foo.*xx.*bar' cpp2.out >/dev/null 2>&1
5181                 then
5182                         cppflags="$cppflags $ftry"
5183                         previous=''
5184                 else
5185                         previous="$flag"
5186                 fi
5187         done
5188         set X $cppflags
5189         shift
5190         cppflags=${1+"$@"}
5191         case "$cppflags" in
5192         *-*)  echo "They appear to be: $cppflags";;
5193         esac
5194         $rm -f cpp.c cpp?.out
5195         ;;
5196 esac
5197
5198 : flags used in final linking phase
5199 case "$ldflags" in
5200 '') if ./venix; then
5201                 dflt='-i -z'
5202         else
5203                 dflt=''
5204         fi
5205         case "$ccflags" in
5206         *-posix*) dflt="$dflt -posix" ;;
5207         esac
5208         ;;
5209 *) dflt="$ldflags";;
5210 esac
5211
5212 : Try to guess additional flags to pick up local libraries.
5213 for thislibdir in $libpth; do
5214         case " $loclibpth " in
5215         *" $thislibdir "*)
5216                 case "$dflt " in
5217                 *"-L$thislibdir "*) ;;
5218                 *)  dflt="$dflt -L$thislibdir" ;;
5219                 esac
5220                 ;;
5221         esac
5222 done
5223
5224 case "$dflt" in
5225 '') dflt='none' ;;
5226 esac
5227
5228 $cat <<EOH
5229
5230 Your C linker may need flags.  For this question you should
5231 include -L/whatever and any other flags used by the C linker, but you
5232 should NOT include libraries like -lwhatever.
5233
5234 Make sure you include the appropriate -L/path flags if your C linker
5235 does not normally search all of the directories you specified above,
5236 namely
5237         $libpth
5238 To use no flags, specify the word "none".
5239
5240 EOH
5241
5242 rp="Any additional ld flags (NOT including libraries)?"
5243 . ./myread
5244 case "$ans" in
5245 none) ldflags='';;
5246 *) ldflags="$ans";;
5247 esac
5248 rmlist="$rmlist pdp11"
5249
5250 : coherency check
5251 echo " "
5252 echo "Checking your choice of C compiler and flags for coherency..." >&4
5253 $cat > try.c <<'EOF'
5254 #include <stdio.h>
5255 int main() { printf("Ok\n"); return(0); }
5256 EOF
5257 set X $cc -o try $optimize $ccflags $ldflags try.c $libs
5258 shift
5259 $cat >try.msg <<'EOM'
5260 I've tried to compile and run the following simple program:
5261
5262 EOM
5263 $cat try.c >> try.msg
5264
5265 $cat >> try.msg <<EOM
5266
5267 I used the command:
5268
5269         $*
5270         $run ./try
5271
5272 and I got the following output:
5273
5274 EOM
5275 dflt=y
5276 if $sh -c "$cc -o try $optimize $ccflags $ldflags try.c $libs" >>try.msg 2>&1; then
5277         if $sh -c "$run ./try" >>try.msg 2>&1; then
5278                 xxx=`$run ./try`
5279                 case "$xxx" in
5280                 "Ok") dflt=n ;;
5281                 *)      echo 'The program compiled OK, but produced no output.' >> try.msg
5282                         case " $libs " in
5283                         *" -lsfio "*)
5284                                 cat >> try.msg <<'EOQS'
5285 If $libs contains -lsfio, and sfio is mis-configured, then it
5286 sometimes (apparently) runs and exits with a 0 status, but with no
5287 output!  It may have to do with sfio's use of _exit vs. exit.
5288
5289 EOQS
5290                                 rp="You have a big problem.  Shall I abort Configure"
5291                                 dflt=y
5292                                 ;;
5293                         esac
5294                         ;;
5295                 esac
5296         else
5297                 echo "The program compiled OK, but exited with status $?." >>try.msg
5298                 rp="You have a problem.  Shall I abort Configure"
5299                 dflt=y
5300         fi
5301 else
5302         echo "I can't compile the test program." >>try.msg
5303         rp="You have a BIG problem.  Shall I abort Configure"
5304         dflt=y
5305 fi
5306 case "$dflt" in
5307 y)
5308         $cat try.msg >&4
5309         case "$knowitall" in
5310         '')
5311                 echo "(The supplied flags or libraries might be incorrect.)"
5312                 ;;
5313         *) dflt=n;;
5314         esac
5315         echo " "
5316         . ./myread
5317         case "$ans" in
5318         n*|N*) ;;
5319         *)      echo "Ok.  Stopping Configure." >&4
5320                 exit 1
5321                 ;;
5322         esac
5323         ;;
5324 n) echo "OK, that should do.";;
5325 esac
5326 $rm -f try try.* core
5327
5328 : define a shorthand compile call
5329 compile='
5330 mc_file=$1;
5331 shift;
5332 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs > /dev/null 2>&1;'
5333 : define a shorthand compile call for compilations that should be ok.
5334 compile_ok='
5335 mc_file=$1;
5336 shift;
5337 $cc -o ${mc_file} $optimize $ccflags $ldflags $* ${mc_file}.c $libs;'
5338
5339 : determine filename position in cpp output
5340 echo " "
5341 echo "Computing filename position in cpp output for #include directives..." >&4
5342 case "$osname" in
5343 vos) testaccess=-e ;;
5344 *)   testaccess=-r ;;
5345 esac
5346 echo '#include <stdio.h>' > foo.c
5347 $cat >fieldn <<EOF
5348 $startsh
5349 $cppstdin $cppflags $cppminus <foo.c 2>/dev/null | \
5350 $grep '^[       ]*#.*stdio\.h' | \
5351 while read cline; do
5352         pos=1
5353         set \$cline
5354         while $test \$# -gt 0; do
5355                 if $test $testaccess \`echo \$1 | $tr -d '"'\`; then
5356                         echo "\$pos"
5357                         exit 0
5358                 fi
5359                 shift
5360                 pos=\`expr \$pos + 1\`
5361         done
5362 done
5363 EOF
5364 chmod +x fieldn
5365 fieldn=`./fieldn`
5366 $rm -f foo.c fieldn
5367 case $fieldn in
5368 '') pos='???';;
5369 1) pos=first;;
5370 2) pos=second;;
5371 3) pos=third;;
5372 *) pos="${fieldn}th";;
5373 esac
5374 echo "Your cpp writes the filename in the $pos field of the line."
5375
5376 case "$osname" in
5377 vos) cppfilter="tr '\\\\>' '/' |" ;; # path component separator is >
5378 os2) cppfilter="sed -e 's|\\\\\\\\|/|g' |" ;; # path component separator is \
5379 *)   cppfilter='' ;;
5380 esac
5381 : locate header file
5382 $cat >findhdr <<EOF
5383 $startsh
5384 wanted=\$1
5385 name=''
5386 for usrincdir in $usrinc
5387 do
5388         if test -f \$usrincdir/\$wanted; then
5389                 echo "\$usrincdir/\$wanted"
5390                 exit 0
5391         fi
5392 done
5393 awkprg='{ print \$$fieldn }'
5394 echo "#include <\$wanted>" > foo\$\$.c
5395 $cppstdin $cppminus $cppflags < foo\$\$.c 2>/dev/null | \
5396 $cppfilter $grep "^[    ]*#.*\$wanted" | \
5397 while read cline; do
5398         name=\`echo \$cline | $awk "\$awkprg" | $tr -d '"'\`
5399         case "\$name" in
5400         *[/\\\\]\$wanted) echo "\$name"; exit 1;;
5401         *[\\\\/]\$wanted) echo "\$name"; exit 1;;
5402         *) exit 2;;
5403         esac;
5404 done;
5405 #
5406 # status = 0: grep returned 0 lines, case statement not executed
5407 # status = 1: headerfile found
5408 # status = 2: while loop executed, no headerfile found
5409 #
5410 status=\$?
5411 $rm -f foo\$\$.c;
5412 if test \$status -eq 1; then
5413         exit 0;
5414 fi
5415 exit 1
5416 EOF
5417 chmod +x findhdr
5418
5419 : define an alternate in-header-list? function
5420 inhdr='echo " "; td=$define; tu=$undef; yyy=$@;
5421 cont=true; xxf="echo \"<\$1> found.\" >&4";
5422 case $# in 2) xxnf="echo \"<\$1> NOT found.\" >&4";;
5423 *) xxnf="echo \"<\$1> NOT found, ...\" >&4";;
5424 esac;
5425 case $# in 4) instead=instead;; *) instead="at last";; esac;
5426 while $test "$cont"; do
5427         xxx=`./findhdr $1`
5428         var=$2; eval "was=\$$2";
5429         if $test "$xxx" && $test -r "$xxx";
5430         then eval $xxf;
5431         eval "case \"\$$var\" in $undef) . ./whoa; esac"; eval "$var=\$td";
5432                 cont="";
5433         else eval $xxnf;
5434         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu"; fi;
5435         set $yyy; shift; shift; yyy=$@;
5436         case $# in 0) cont="";;
5437         2) xxf="echo \"but I found <\$1> $instead.\" >&4";
5438                 xxnf="echo \"and I did not find <\$1> either.\" >&4";;
5439         *) xxf="echo \"but I found <\$1\> instead.\" >&4";
5440                 xxnf="echo \"there is no <\$1>, ...\" >&4";;
5441         esac;
5442 done;
5443 while $test "$yyy";
5444 do set $yyy; var=$2; eval "was=\$$2";
5445         eval "case \"\$$var\" in $define) . ./whoa; esac"; eval "$var=\$tu";
5446         set $yyy; shift; shift; yyy=$@;
5447 done'
5448
5449 : see if stdlib is available
5450 set stdlib.h i_stdlib
5451 eval $inhdr
5452
5453 : check for lengths of integral types
5454 echo " "
5455 case "$intsize" in
5456 '')
5457         echo "Checking to see how big your integers are..." >&4
5458         $cat >try.c <<EOCP
5459 #include <stdio.h>
5460 #$i_stdlib I_STDLIB
5461 #ifdef I_STDLIB
5462 #include <stdlib.h>
5463 #endif
5464 int main()
5465 {
5466         printf("intsize=%d;\n", (int)sizeof(int));
5467         printf("longsize=%d;\n", (int)sizeof(long));
5468         printf("shortsize=%d;\n", (int)sizeof(short));
5469         exit(0);
5470 }
5471 EOCP
5472         set try
5473         if eval $compile_ok && $run ./try > /dev/null; then
5474                 eval `$run ./try`
5475                 echo "Your integers are $intsize bytes long."
5476                 echo "Your long integers are $longsize bytes long."
5477                 echo "Your short integers are $shortsize bytes long."
5478         else
5479                 $cat >&4 <<EOM
5480 !
5481 Help! I can't compile and run the intsize test program: please enlighten me!
5482 (This is probably a misconfiguration in your system or libraries, and
5483 you really ought to fix it.  Still, I'll try anyway.)
5484 !
5485 EOM
5486                 dflt=4
5487                 rp="What is the size of an integer (in bytes)?"
5488                 . ./myread
5489                 intsize="$ans"
5490                 dflt=$intsize
5491                 rp="What is the size of a long integer (in bytes)?"
5492                 . ./myread
5493                 longsize="$ans"
5494                 dflt=2
5495                 rp="What is the size of a short integer (in bytes)?"
5496                 . ./myread
5497                 shortsize="$ans"
5498         fi
5499         ;;
5500 esac
5501 $rm -f try try.*
5502
5503 : check for long long
5504 echo " "
5505 echo "Checking to see if you have long long..." >&4
5506 echo 'int main() { long long x = 7; return 0; }' > try.c
5507 set try
5508 if eval $compile; then
5509         val="$define"
5510         echo "You have long long."
5511 else
5512         val="$undef"
5513         echo "You do not have long long."
5514 fi
5515 $rm try.*
5516 set d_longlong
5517 eval $setvar
5518
5519 : check for length of long long
5520 case "${d_longlong}${longlongsize}" in
5521 $define)
5522         echo " "
5523         echo "Checking to see how big your long longs are..." >&4
5524         $cat >try.c <<'EOCP'
5525 #include <stdio.h>
5526 int main()
5527 {
5528     printf("%d\n", (int)sizeof(long long));
5529     return(0);
5530 }
5531 EOCP
5532         set try
5533         if eval $compile_ok; then
5534                 longlongsize=`$run ./try`
5535                 echo "Your long longs are $longlongsize bytes long."
5536         else
5537                 dflt='8'
5538                 echo " "
5539                 echo "(I can't seem to compile the test program.  Guessing...)"
5540                 rp="What is the size of a long long (in bytes)?"
5541                 . ./myread
5542                 longlongsize="$ans"
5543         fi
5544         if $test "X$longsize" = "X$longlongsize"; then
5545                 echo "(That isn't any different from an ordinary long.)"
5546         fi      
5547         ;;
5548 esac
5549 $rm -f try.* try
5550
5551 : see if inttypes.h is available
5552 : we want a real compile instead of Inhdr because some systems
5553 : have an inttypes.h which includes non-existent headers
5554 echo " "
5555 $cat >try.c <<EOCP
5556 #include <inttypes.h>
5557 int main() {
5558         static int32_t foo32 = 0x12345678;
5559 }
5560 EOCP
5561 set try
5562 if eval $compile; then
5563         echo "<inttypes.h> found." >&4
5564         val="$define"
5565 else
5566         echo "<inttypes.h> NOT found." >&4
5567         val="$undef"
5568 fi
5569 $rm -f try.c try
5570 set i_inttypes
5571 eval $setvar
5572
5573 : check for int64_t
5574 echo " "
5575 echo "Checking to see if you have int64_t..." >&4
5576 $cat >try.c <<EOCP
5577 #include <sys/types.h>
5578 #$i_inttypes I_INTTYPES
5579 #ifdef I_INTTYPES
5580 #include <inttypes.h>
5581 #endif
5582 int main() { int64_t x = 7; }
5583 EOCP
5584 set try
5585 if eval $compile; then
5586         val="$define"
5587         echo "You have int64_t."
5588 else
5589         val="$undef"
5590         echo "You do not have int64_t."
5591 fi
5592 $rm -f try try.*
5593 set d_int64_t
5594 eval $setvar
5595
5596
5597 echo " "
5598 echo "Checking which 64-bit integer type we could use..." >&4
5599
5600 case "$intsize" in
5601 8) val=int
5602    set quadtype
5603    eval $setvar
5604    val='"unsigned int"'
5605    set uquadtype
5606    eval $setvar
5607    quadkind=1
5608    ;;
5609 *) case "$longsize" in
5610    8) val=long
5611       set quadtype
5612       eval $setvar
5613       val='"unsigned long"'
5614       set uquadtype
5615       eval $setvar
5616       quadkind=2
5617       ;;
5618    *) case "$d_longlong:$longlongsize" in
5619       define:8)
5620         val='"long long"'
5621         set quadtype
5622         eval $setvar
5623         val='"unsigned long long"'
5624         set uquadtype
5625         eval $setvar
5626         quadkind=3
5627         ;;
5628       *) case "$d_int64_t" in
5629          define)
5630            val=int64_t
5631            set quadtype
5632            eval $setvar
5633            val=uint64_t
5634            set uquadtype
5635            eval $setvar
5636            quadkind=4
5637            ;;
5638          esac
5639          ;;
5640       esac
5641       ;;
5642    esac
5643    ;;
5644 esac
5645
5646 case "$quadtype" in
5647 '')     echo "Alas, no 64-bit integer types in sight." >&4
5648         d_quad="$undef"
5649         ;;
5650 *)      echo "We could use '$quadtype' for 64-bit integers." >&4
5651         d_quad="$define"
5652         ;;
5653 esac
5654
5655
5656 case "$uselonglong" in
5657 "$define"|true|[yY]*)
5658         cat <<EOM >&4
5659
5660 *** Configure -Duselonglong is deprecated, using -Duse64bitint instead.
5661 EOM
5662         use64bitint="$define"
5663         ;;
5664 esac                          
5665 case "$use64bits" in
5666 "$define"|true|[yY]*)
5667         cat <<EOM >&4
5668
5669 *** Configure -Duse64bits is deprecated, using -Duse64bitint instead.
5670 EOM
5671         use64bitint="$define"
5672         ;;
5673 esac                          
5674 case "$use64bitints" in
5675 "$define"|true|[yY]*)
5676         cat <<EOM >&4
5677
5678 *** There is no Configure -Duse64bitints, using -Duse64bitint instead.
5679 EOM
5680         use64bitint="$define"
5681         ;;
5682 esac                          
5683 case "$use64bitsint" in
5684 "$define"|true|[yY]*)
5685         cat <<EOM >&4
5686
5687 *** There is no Configure -Duse64bitsint, using -Duse64bitint instead.
5688 EOM
5689         use64bitint="$define"
5690         ;;
5691 esac                          
5692 case "$uselonglongs" in
5693 "$define"|true|[yY]*)
5694         cat <<EOM >&4
5695
5696 *** There is no Configure -Duselonglongs, using -Duse64bitint instead.
5697 EOM
5698         use64bitint="$define"
5699         ;;
5700 esac                          
5701 case "$use64bitsall" in
5702 "$define"|true|[yY]*)
5703         cat <<EOM >&4
5704
5705 *** There is no Configure -Duse64bitsall, using -Duse64bitall instead.
5706 EOM
5707         use64bitall="$define"
5708         ;;
5709 esac                          
5710
5711 case "$ccflags" in
5712 *-DUSE_LONG_LONG*|*-DUSE_64_BIT_INT*|*-DUSE_64_BIT_ALL*) use64bitint="$define";;
5713 esac
5714 case "$use64bitall" in
5715 "$define"|true|[yY]*) use64bitint="$define" ;;
5716 esac
5717
5718 case "$longsize" in
5719 8) cat <<EOM
5720
5721 You have natively 64-bit long integers.
5722 EOM
5723    val="$define"
5724    ;;
5725 *) case "$use64bitint" in
5726    "$define"|true|[yY]*) dflt='y';;
5727    *) dflt='n';;
5728    esac
5729    case "$d_quad" in
5730    "$define") ;;
5731    *) dflt='n' ;;
5732    esac
5733    cat <<EOM
5734
5735 Perl can be built to take advantage of 64-bit integer types
5736 on some systems.  To do so, Configure can be run with -Duse64bitint.
5737 Choosing this option will most probably introduce binary incompatibilities.
5738
5739 If this doesn't make any sense to you, just accept the default '$dflt'.
5740 (The default has been chosen based on your configuration.)
5741 EOM
5742    rp='Try to use 64-bit integers, if available?'
5743    . ./myread
5744    case "$ans" in
5745    [yY]*) val="$define" ;;
5746    *)     val="$undef"  ;;
5747    esac
5748    ;;
5749 esac
5750 set use64bitint
5751 eval $setvar
5752
5753 case "$use64bitall" in
5754 "$define"|true|[yY]*) dflt='y' ;;
5755 *) case "$longsize" in
5756    8) dflt='y' ;;
5757    *) dflt='n' ;;
5758    esac
5759    ;;
5760 esac    
5761 cat <<EOM
5762
5763 You may also choose to try maximal 64-bitness.  It means using as much
5764 64-bitness as possible on the platform.  This in turn means even more
5765 binary incompatibilities.  On the other hand, your platform may not
5766 have any more 64-bitness available than what you already have chosen.
5767
5768 If this doesn't make any sense to you, just accept the default '$dflt'.
5769 (The default has been chosen based on your configuration.)
5770 EOM
5771 rp='Try to use maximal 64-bit support, if available?'
5772 . ./myread
5773 case "$ans" in
5774 [yY]*) val="$define" ;;
5775 *)     val="$undef"  ;;
5776 esac
5777 set use64bitall
5778 eval $setvar
5779 case "$use64bitall" in
5780 "$define")
5781         case "$use64bitint" in
5782         "$undef")
5783                 cat <<EOM
5784
5785 Since you have chosen a maximally 64-bit build, I'm also turning on
5786 the use of 64-bit integers.
5787 EOM
5788                 use64bitint="$define" ;;
5789         esac
5790         ;;
5791 esac
5792
5793 : Look for a hint-file generated 'call-back-unit'.  If the
5794 : user has specified that a 64-bit perl is to be built,
5795 : we may need to set or change some other defaults.
5796 if $test -f use64bitint.cbu; then
5797         echo "Your platform has some specific hints regarding 64-bit integers, using them..."
5798         . ./use64bitint.cbu
5799 fi
5800 case "$use64bitint" in
5801 "$define"|true|[yY]*)
5802         case "$longsize" in
5803         4) case "$archname64" in
5804            '') archname64=64int ;;
5805            esac
5806            ;;
5807         esac
5808         ;;
5809 esac
5810
5811 : Look for a hint-file generated 'call-back-unit'.  If the
5812 : user has specified that a maximally 64-bit perl is to be built,
5813 : we may need to set or change some other defaults.
5814 if $test -f use64bitall.cbu; then
5815         echo "Your platform has some specific hints regarding 64-bit builds, using them..."
5816         . ./use64bitall.cbu
5817 fi
5818 case "$use64bitall" in
5819 "$define"|true|[yY]*)
5820         case "$longsize" in
5821         4) case "$archname64" in
5822            ''|64int) archname64=64all ;;
5823            esac
5824            ;;
5825         esac
5826         ;;
5827 esac
5828
5829 case "$d_quad:$use64bitint" in
5830 $undef:$define)
5831         cat >&4 <<EOF
5832
5833 *** You have chosen to use 64-bit integers,
5834 *** but none can be found.
5835 *** Please rerun Configure without -Duse64bitint and/or -Dusemorebits.
5836 *** Cannot continue, aborting.
5837
5838 EOF
5839         exit 1
5840         ;;
5841 esac
5842
5843 : check for length of double
5844 echo " "
5845 case "$doublesize" in
5846 '')
5847         echo "Checking to see how big your double precision numbers are..." >&4
5848         $cat >try.c <<EOCP
5849 #include <stdio.h>
5850 #$i_stdlib I_STDLIB
5851 #ifdef I_STDLIB
5852 #include <stdlib.h>
5853 #endif
5854 int main()
5855 {
5856     printf("%d\n", (int)sizeof(double));
5857     exit(0);
5858 }
5859 EOCP
5860         set try
5861         if eval $compile_ok; then
5862                 doublesize=`$run ./try`
5863                 echo "Your double is $doublesize bytes long."
5864         else
5865                 dflt='8'
5866                 echo "(I can't seem to compile the test program.  Guessing...)"
5867                 rp="What is the size of a double precision number (in bytes)?"
5868                 . ./myread
5869                 doublesize="$ans"
5870         fi
5871         ;;
5872 esac
5873 $rm -f try.c try
5874
5875 : check for long doubles
5876 echo " "
5877 echo "Checking to see if you have long double..." >&4
5878 echo 'int main() { long double x = 7.0; }' > try.c
5879 set try
5880 if eval $compile; then
5881         val="$define"
5882         echo "You have long double."
5883 else
5884         val="$undef"
5885         echo "You do not have long double."
5886 fi
5887 $rm try.*
5888 set d_longdbl
5889 eval $setvar
5890
5891 : check for length of long double
5892 case "${d_longdbl}${longdblsize}" in
5893 $define)
5894         echo " "
5895         echo "Checking to see how big your long doubles are..." >&4
5896         $cat >try.c <<'EOCP'
5897 #include <stdio.h>
5898 int main()
5899 {
5900         printf("%d\n", sizeof(long double));
5901 }
5902 EOCP
5903         set try
5904         set try
5905         if eval $compile; then
5906                 longdblsize=`$run ./try`
5907                 echo "Your long doubles are $longdblsize bytes long."
5908         else
5909                 dflt='8'
5910                 echo " "
5911                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
5912                 rp="What is the size of a long double (in bytes)?"
5913                 . ./myread
5914                 longdblsize="$ans"
5915         fi
5916         if $test "X$doublesize" = "X$longdblsize"; then
5917                 echo "That isn't any different from an ordinary double."
5918                 echo "I'll keep your setting anyway, but you may see some"
5919                 echo "harmless compilation warnings."
5920         fi      
5921         ;;
5922 esac
5923 $rm -f try.* try
5924
5925 : determine the architecture name
5926 echo " "
5927 if xxx=`./loc arch blurfl $pth`; $test -f "$xxx"; then
5928         tarch=`arch`"-$osname"
5929 elif xxx=`./loc uname blurfl $pth`; $test -f "$xxx" ; then
5930         if uname -m > tmparch 2>&1 ; then
5931                 tarch=`$sed -e 's/ *$//' -e 's/ /_/g' \
5932                         -e 's/$/'"-$osname/" tmparch`
5933         else
5934                 tarch="$osname"
5935         fi
5936         $rm -f tmparch
5937 else
5938         tarch="$osname"
5939 fi
5940 case "$myarchname" in
5941 ''|"$tarch") ;;
5942 *)
5943         echo "(Your architecture name used to be $myarchname.)"
5944         archname=''
5945         ;;
5946 esac
5947 case "$targetarch" in
5948 '') ;;
5949 *)  archname=`echo $targetarch|sed 's,^[^-]*-,,'` ;;
5950 esac
5951 myarchname="$tarch"
5952 case "$archname" in
5953 '') dflt="$tarch";;
5954 *) dflt="$archname";;
5955 esac
5956 rp='What is your architecture name'
5957 . ./myread
5958 archname="$ans"
5959 case "$usethreads" in
5960 $define)
5961         echo "Threads selected." >&4
5962         case "$archname" in
5963         *-thread*) echo "...and architecture name already has -thread." >&4
5964                 ;;
5965         *)      archname="$archname-thread"
5966                 echo "...setting architecture name to $archname." >&4
5967                 ;;
5968         esac
5969         ;;
5970 esac
5971 case "$usemultiplicity" in
5972 $define)
5973         echo "Multiplicity selected." >&4
5974         case "$archname" in
5975         *-multi*) echo "...and architecture name already has -multi." >&4
5976                 ;;
5977         *)      archname="$archname-multi"
5978                 echo "...setting architecture name to $archname." >&4
5979                 ;;
5980         esac
5981         ;;
5982 esac
5983 case "$use64bitint$use64bitall" in
5984 *"$define"*)
5985         case "$archname64" in
5986         '')
5987                 echo "This architecture is naturally 64-bit, not changing architecture name." >&4
5988                 ;;
5989         *)
5990                 case "$use64bitint" in
5991                 "$define") echo "64 bit integers selected." >&4 ;;
5992                 esac
5993                 case "$use64bitall" in
5994                 "$define") echo "Maximal 64 bitness selected." >&4 ;;
5995                 esac
5996                 case "$archname" in
5997                 *-$archname64*) echo "...and architecture name already has $archname64." >&4
5998                         ;;
5999                 *)      archname="$archname-$archname64"
6000                         echo "...setting architecture name to $archname." >&4
6001                         ;;
6002                 esac
6003                 ;;
6004         esac
6005 esac
6006 case "$uselongdouble" in
6007 $define)
6008         echo "Long doubles selected." >&4
6009         case "$longdblsize" in
6010         $doublesize)
6011                 echo "...but long doubles are equal to doubles, not changing architecture name." >&4
6012                 ;;
6013         *)
6014                 case "$archname" in
6015                 *-ld*) echo "...and architecture name already has -ld." >&4
6016                         ;;
6017                 *)      archname="$archname-ld"
6018                         echo "...setting architecture name to $archname." >&4
6019                         ;;
6020                 esac
6021                 ;;
6022         esac
6023         ;;
6024 esac
6025 case "$useperlio" in
6026 $define)
6027         echo "Perlio selected." >&4
6028         ;;
6029 *)
6030         echo "Perlio not selected, using stdio." >&4
6031         case "$archname" in
6032         *-stdio*) echo "...and architecture name already has -stdio." >&4
6033                 ;;
6034         *)      archname="$archname-stdio"
6035                 echo "...setting architecture name to $archname." >&4
6036                 ;;
6037         esac
6038         ;;
6039 esac
6040 if $test -f archname.cbu; then
6041         echo "Your platform has some specific hints for architecture name, using them..."
6042         . ./archname.cbu
6043 fi
6044
6045 : set the prefixit variable, to compute a suitable default value
6046 prefixit='case "$3" in
6047 ""|none)
6048         case "$oldprefix" in
6049         "") eval "$1=\"\$$2\"";;
6050         *)
6051                 case "$3" in
6052                 "") eval "$1=";;
6053                 none)
6054                         eval "tp=\"\$$2\"";
6055                         case "$tp" in
6056                         ""|" ") eval "$1=\"\$$2\"";;
6057                         *) eval "$1=";;
6058                         esac;;
6059                 esac;;
6060         esac;;
6061 *)
6062         eval "tp=\"$oldprefix-\$$2-\""; eval "tp=\"$tp\"";
6063         case "$tp" in
6064         --|/*--|\~*--) eval "$1=\"$prefix/$3\"";;
6065         /*-$oldprefix/*|\~*-$oldprefix/*)
6066                 eval "$1=\`echo \$$2 | sed \"s,^$oldprefix,$prefix,\"\`";;
6067         *) eval "$1=\"\$$2\"";;
6068         esac;;
6069 esac'
6070
6071 : determine installation style
6072 : For now, try to deduce it from prefix unless it is already set.
6073 : Reproduce behavior of 5.005 and earlier, maybe drop that in 5.7.
6074 case "$installstyle" in
6075 '')     case "$prefix" in
6076                 *perl*) dflt='lib';;
6077                 *) dflt='lib/perl5' ;;
6078         esac
6079         ;;
6080 *)      dflt="$installstyle" ;;
6081 esac
6082 : Probably not worth prompting for this since we prompt for all
6083 : the directories individually, and the prompt would be too long and
6084 : confusing anyway.
6085 installstyle=$dflt
6086
6087 : determine where public executables go
6088 echo " "
6089 set dflt bin bin
6090 eval $prefixit
6091 fn=d~
6092 rp='Pathname where the public executables will reside?'
6093 . ./getfile
6094 if $test "X$ansexp" != "X$binexp"; then
6095         installbin=''
6096 fi
6097 prefixvar=bin
6098 : XXX Bug? -- ignores Configure -Dinstallprefix setting.
6099 : XXX If this is fixed, also fix the "start perl" hunk below, which relies on
6100 :     this via initialinstalllocation
6101 . ./setprefixvar
6102
6103 case "$userelocatableinc" in
6104 $define|true|[yY]*)     dflt='y' ;;
6105 *)                      dflt='n' ;;
6106 esac
6107 cat <<EOM
6108
6109 Would you like to build Perl so that the installation is relocatable, so that
6110 library paths in @INC are determined relative to the path of the perl binary?
6111 This is not advised for system Perl installs, or if you need to run setid
6112 scripts or scripts under taint mode.
6113
6114 If this doesn't make any sense to you, just accept the default '$dflt'.
6115 EOM
6116 rp='Use relocatable @INC?'
6117 . ./myread
6118 case "$ans" in
6119 y|Y)    val="$define" ;;
6120 *)      val="$undef"  ;;
6121 esac
6122 set userelocatableinc
6123 eval $setvar
6124
6125 initialinstalllocation="$binexp"
6126 : Default prefix is now "up one level from where the binaries are"
6127 case "$userelocatableinc" in
6128 $define|true|[yY]*)
6129     bin=".../"
6130     binexp=".../"
6131     prefix=".../.."
6132     prefixexp=".../.."
6133     installprefixexp=".../.."
6134     ;;
6135 esac
6136
6137 : determine where private library files go
6138 : Usual default is /usr/local/lib/perl5/$version.
6139 : Also allow things like /opt/perl/lib/$version, since
6140 : /opt/perl/lib/perl5... would be redundant.
6141 : The default "style" setting is made in installstyle.U
6142 case "$installstyle" in
6143 *lib/perl5*) set dflt privlib lib/$package/$version ;;
6144 *)       set dflt privlib lib/$version ;;
6145 esac
6146 eval $prefixit
6147 $cat <<EOM
6148
6149 There are some auxiliary files for $package that need to be put into a
6150 private library directory that is accessible by everyone.
6151
6152 EOM
6153 fn=$binexp
6154 fn=d~+
6155 rp='Pathname where the private library files will reside?'
6156 . ./getfile
6157 prefixvar=privlib
6158 . ./setprefixvar
6159
6160 : set the prefixup variable, to restore leading tilda escape
6161 prefixup='case "$prefixexp" in
6162 "$prefix") ;;
6163 *) eval "$1=\`echo \$$1 | sed \"s,^$prefixexp,$prefix,\"\`";;
6164 esac'
6165
6166 : determine where public architecture dependent libraries go
6167 set archlib archlib
6168 eval $prefixit
6169 : privlib default is /usr/local/lib/$package/$version
6170 : archlib default is /usr/local/lib/$package/$version/$archname
6171 : privlib may have an optional trailing /share.
6172 tdflt=`echo $privlib | $sed 's,/share$,,'`
6173 tdflt=$tdflt/$archname
6174 case "$archlib" in
6175 '')     dflt=$tdflt
6176         ;;
6177 *)      dflt="$archlib"
6178     ;;
6179 esac
6180 $cat <<EOM
6181
6182 $spackage contains architecture-dependent library files.  If you are
6183 sharing libraries in a heterogeneous environment, you might store
6184 these files in a separate location.  Otherwise, you can just include
6185 them with the rest of the public library files.
6186
6187 EOM
6188 fn=$binexp
6189 fn=d+~
6190 rp='Where do you want to put the public architecture-dependent libraries?'
6191 . ./getfile
6192 prefixvar=archlib
6193 . ./setprefixvar
6194 if $test X"$archlib" = X"$privlib"; then
6195         d_archlib="$undef"
6196 else
6197         d_archlib="$define"
6198 fi
6199
6200 : see if setuid scripts can be secure
6201 $cat <<EOM
6202
6203 Some kernels have a bug that prevents setuid #! scripts from being
6204 secure.  Some sites have disabled setuid #! scripts because of this.
6205
6206 First let's decide if your kernel supports secure setuid #! scripts.
6207 (If setuid #! scripts would be secure but have been disabled anyway,
6208 don't say that they are secure if asked.)
6209
6210 EOM
6211
6212 val="$undef"
6213 if $test -d /dev/fd; then
6214         echo "#!$ls" >reflect
6215         chmod +x,u+s reflect
6216         ./reflect >flect 2>&1
6217         if $contains "/dev/fd" flect >/dev/null; then
6218                 echo "Congratulations, your kernel has secure setuid scripts!" >&4
6219                 val="$define"
6220         else
6221                 $cat <<EOM
6222 If you are not sure if they are secure, I can check but I'll need a
6223 username and password different from the one you are using right now.
6224 If you don't have such a username or don't want me to test, simply
6225 enter 'none'.
6226
6227 EOM
6228                 rp='Other username to test security of setuid scripts with?'
6229                 dflt='none'
6230                 . ./myread
6231                 case "$ans" in
6232                 n|none)
6233                         case "$d_suidsafe" in
6234                         '')     echo "I'll assume setuid scripts are *not* secure." >&4
6235                                 dflt=n;;
6236                         "$undef")
6237                                 echo "Well, the $hint value is *not* secure." >&4
6238                                 dflt=n;;
6239                         *)      echo "Well, the $hint value *is* secure." >&4
6240                                 dflt=y;;
6241                         esac
6242                         ;;
6243                 *)
6244                         $rm -f reflect flect
6245                         echo "#!$ls" >reflect
6246                         chmod +x,u+s reflect
6247                         echo >flect
6248                         chmod a+w flect
6249                         echo '"su" will (probably) prompt you for '"$ans's password."
6250                         su $ans -c './reflect >flect'
6251                         if $contains "/dev/fd" flect >/dev/null; then
6252                                 echo "Okay, it looks like setuid scripts are secure." >&4
6253                                 dflt=y
6254                         else
6255                                 echo "I don't think setuid scripts are secure." >&4
6256                                 dflt=n
6257                         fi
6258                         ;;
6259                 esac
6260                 rp='Does your kernel have *secure* setuid scripts?'
6261                 . ./myread
6262                 case "$ans" in
6263                 [yY]*)  val="$define";;
6264                 *)      val="$undef";;
6265                 esac
6266         fi
6267 else
6268         echo "I don't think setuid scripts are secure (no /dev/fd directory)." >&4
6269         echo "(That's for file descriptors, not floppy disks.)"
6270         val="$undef"
6271 fi
6272 set d_suidsafe
6273 eval $setvar
6274
6275 $rm -f reflect flect
6276
6277 : now see if they want to do setuid emulation
6278 echo " "
6279 val="$undef"
6280 case "$d_suidsafe" in
6281 "$define")
6282         val="$undef"
6283         echo "No need to emulate SUID scripts since they are secure here." >&4
6284         ;;
6285 *)
6286         $cat <<EOM
6287 Some systems have disabled setuid scripts, especially systems where
6288 setuid scripts cannot be secure.  On systems where setuid scripts have
6289 been disabled, the setuid/setgid bits on scripts are currently
6290 useless.  It is possible for $package to detect those bits and emulate
6291 setuid/setgid in a secure fashion.  This emulation will only work if
6292 setuid scripts have been disabled in your kernel.
6293
6294 EOM
6295         case "$d_dosuid" in
6296         "$define") dflt=y ;;
6297         *) dflt=n ;;
6298         esac
6299         rp="Do you want to do setuid/setgid emulation?"
6300         . ./myread
6301         case "$ans" in
6302         [yY]*)  val="$define";;
6303         *)      val="$undef";;
6304         esac
6305         ;;
6306 esac
6307 set d_dosuid
6308 eval $setvar
6309
6310 : Find perl5.005 or later.
6311 echo "Looking for a previously installed perl5.005 or later... "
6312 case "$perl5" in
6313 '')     for tdir in `echo "$binexp$path_sep$PATH" | $sed "s/$path_sep/ /g"`; do
6314                 : Check if this perl is recent and can load a simple module
6315                 if $test -x $tdir/perl$exe_ext && $tdir/perl -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6316                         perl5=$tdir/perl
6317                         break;
6318                 elif $test -x $tdir/perl5$exe_ext && $tdir/perl5 -Mless -e 'use 5.005;' >/dev/null 2>&1; then
6319                         perl5=$tdir/perl5
6320                         break;
6321                 fi
6322         done
6323         ;;
6324 *)      perl5="$perl5"
6325         ;;
6326 esac
6327 case "$perl5" in
6328 '')     echo "None found.  That's ok.";;
6329 *)      echo "Using $perl5." ;;
6330 esac
6331
6332 $cat <<EOM
6333
6334 After $package is installed, you may wish to install various
6335 add-on modules and utilities.  Typically, these add-ons will
6336 be installed under $prefix with the rest
6337 of this package.  However, you may wish to install such add-ons
6338 elsewhere under a different prefix.
6339
6340 If you do not wish to put everything under a single prefix, that's
6341 ok.  You will be prompted for the individual locations; this siteprefix
6342 is only used to suggest the defaults.
6343
6344 The default should be fine for most people.
6345
6346 EOM
6347 fn=d~+
6348 rp='Installation prefix to use for add-on modules and utilities?'
6349 : XXX Here might be another good place for an installstyle setting.
6350 case "$siteprefix" in
6351 '') dflt=$prefix ;;
6352 *)  dflt=$siteprefix ;;
6353 esac
6354 . ./getfile
6355 : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6356 oldsiteprefix=''
6357 case "$siteprefix" in
6358 '') ;;
6359 *)      case "$ans" in
6360         "$prefix") ;;
6361         *) oldsiteprefix="$prefix";;
6362         esac
6363         ;;
6364 esac
6365 siteprefix="$ans"
6366 siteprefixexp="$ansexp"
6367
6368 : determine where site specific libraries go.
6369 : Usual default is /usr/local/lib/perl5/site_perl/$version
6370 : The default "style" setting is made in installstyle.U
6371 : XXX No longer works with Prefixit stuff.
6372 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6373 case "$sitelib" in
6374 '') case "$installstyle" in
6375         *lib/perl5*) dflt=$siteprefix/lib/$package/site_$prog/$version ;;
6376         *)       dflt=$siteprefix/lib/site_$prog/$version ;;
6377         esac
6378         ;;
6379 *)      dflt="$sitelib"
6380         ;;
6381 esac
6382 $cat <<EOM
6383
6384 The installation process will create a directory for
6385 site-specific extensions and modules.  Most users find it convenient
6386 to place all site-specific files in this directory rather than in the
6387 main distribution directory.
6388
6389 EOM
6390 fn=d~+
6391 rp='Pathname for the site-specific library files?'
6392 . ./getfile
6393 prefixvar=sitelib
6394 . ./setprefixvar
6395 sitelib_stem=`echo "$sitelibexp" | sed "s,/$version$,,"`
6396
6397 : Determine list of previous versions to include in @INC
6398 $cat > getverlist <<EOPL
6399 #!$perl5 -w
6400 use File::Basename;
6401 \$api_versionstring = "$api_versionstring";
6402 \$version = "$version";
6403 \$stem = "$sitelib_stem";
6404 \$archname = "$archname";
6405 EOPL
6406         $cat >> getverlist <<'EOPL'
6407 # The list found is store twice for each entry: the original name, and
6408 # the binary broken down version as pack "sss", so sorting is easy and
6409 # unambiguous. This will work for all versions that have a maximum of
6410 # three digit groups, separate by '.'s or '_'s. Names are extended with
6411 # ".0.0" to ensure at least three elements for the pack.
6412 #                                       -- H.Merijn Brand (m)'06 23-10-2006
6413
6414 # Can't have leading @ because metaconfig interprets it as a command!
6415 ;@inc_version_list=();
6416 # XXX Redo to do opendir/readdir?
6417 if (-d $stem) {
6418     chdir($stem);
6419     ;@candidates = map {
6420         [ $_, pack "sss", split m/[._]/, "$_.0.0" ] } glob("5.*");
6421 }
6422 else {
6423     ;@candidates = ();
6424 }
6425
6426 ($pversion, $aversion, $vsn5005) = map {
6427     pack "sss", split m/[._]/, "$_.0.0" } $version, $api_versionstring, "5.005";
6428 foreach $d (@candidates) {
6429     if ($d->[1] lt $pversion) {
6430         if ($d->[1] ge $aversion) {
6431             unshift(@inc_version_list, grep { -d } $d->[0]."/$archname", $d->[0]);
6432         }
6433         elsif ($d->[1] ge $vsn5005) {
6434             unshift(@inc_version_list, grep { -d } $d->[0]);
6435         }
6436     }
6437     else {
6438         # Skip newer version.  I.e. don't look in
6439         # 5.7.0 if we're installing 5.6.1.
6440     }
6441 }
6442
6443 if (@inc_version_list) {
6444     print join(' ', @inc_version_list);
6445 }
6446 else {
6447     # Blank space to preserve value for next Configure run.
6448     print " ";
6449 }
6450 EOPL
6451 chmod +x getverlist
6452 case "$inc_version_list" in
6453 '')     if test -x "$perl5$exe_ext"; then
6454                 dflt=`$perl5 getverlist`
6455         else
6456                 dflt='none'
6457         fi
6458         ;;
6459 $undef) dflt='none' ;;
6460 *)  eval dflt=\"$inc_version_list\" ;;
6461 esac
6462 case "$dflt" in
6463 ''|' ') dflt=none ;;
6464 esac
6465 case "$dflt" in
6466 5.005) dflt=none ;;
6467 esac
6468 $cat <<EOM
6469
6470 In order to ease the process of upgrading, this version of perl
6471 can be configured to use modules built and installed with earlier
6472 versions of perl that were installed under $prefix.  Specify here
6473 the list of earlier versions that this version of perl should check.
6474 If Configure detected no earlier versions of perl installed under
6475 $prefix, then the list will be empty.  Answer 'none' to tell perl
6476 to not search earlier versions.
6477
6478 The default should almost always be sensible, so if you're not sure,
6479 just accept the default.
6480 EOM
6481
6482 rp='List of earlier versions to include in @INC?'
6483 . ./myread
6484 case "$ans" in
6485 [Nn]one|''|' '|$undef) inc_version_list=' ' ;;
6486 *) inc_version_list="$ans" ;;
6487 esac
6488 case "$inc_version_list" in
6489 ''|' ')
6490         inc_version_list_init='0'
6491         d_inc_version_list="$undef"
6492         ;;
6493 *)      inc_version_list_init=`echo $inc_version_list |
6494                 $sed -e 's/^/"/' -e 's/ /","/g' -e 's/$/",0/'`
6495         d_inc_version_list="$define"
6496         ;;
6497 esac
6498 $rm -f getverlist
6499
6500 : see if this is a malloc.h system
6501 : we want a real compile instead of Inhdr because some systems have a
6502 : malloc.h that just gives a compile error saying to use stdlib.h instead
6503 echo " "
6504 $cat >try.c <<EOCP
6505 #include <stdlib.h>
6506 #include <malloc.h>
6507 int main () { return 0; }
6508 EOCP
6509 set try
6510 if eval $compile; then
6511     echo "<malloc.h> found." >&4
6512     val="$define"
6513 else
6514     echo "<malloc.h> NOT found." >&4
6515     val="$undef"
6516 fi
6517 $rm -f try.c try
6518 set i_malloc
6519 eval $setvar
6520
6521 : check for void type
6522 echo " "
6523 echo "Checking to see how well your C compiler groks the void type..." >&4
6524 case "$voidflags" in
6525 '')
6526         $cat >try.c <<EOCP
6527 #$i_stdlib I_STDLIB
6528 #ifdef I_STDLIB
6529 #include <stdlib.h>
6530 #endif
6531 #if TRY & 1
6532 void sub() {
6533 #else
6534 sub() {
6535 #endif
6536         extern void moo();      /* function returning void */
6537         void (*goo)();          /* ptr to func returning void */
6538 #if TRY & 8
6539         void *hue;              /* generic ptr */
6540 #endif
6541 #if TRY & 2
6542         void (*foo[10])();
6543 #endif
6544
6545 #if TRY & 4
6546         if(goo == moo) {
6547                 exit(0);
6548         }
6549 #endif
6550         exit(0);
6551 }
6552 int main() { sub(); }
6553 EOCP
6554         if $cc $ccflags -c -DTRY=$defvoidused try.c >.out 2>&1 ; then
6555                 voidflags=$defvoidused
6556         echo "Good.  It appears to support void to the level $package wants.">&4
6557                 if $contains warning .out >/dev/null 2>&1; then
6558                         echo "However, you might get some warnings that look like this:"
6559                         $cat .out
6560                 fi
6561         else
6562 echo "Hmm, your compiler has some difficulty with void. Checking further..." >&4
6563                 if $cc $ccflags -c -DTRY=1 try.c >/dev/null 2>&1; then
6564                         echo "It supports 1..."
6565                         if $cc $ccflags -c -DTRY=3 try.c >/dev/null 2>&1; then
6566                                 echo "It also supports 2..."
6567                                 if $cc $ccflags -c -DTRY=7 try.c >/dev/null 2>&1; then
6568                                         voidflags=7
6569                                         echo "And it supports 4 but not 8 definitely."
6570                                 else
6571                                         echo "It doesn't support 4..."
6572                                         if $cc $ccflags -c -DTRY=11 try.c >/dev/null 2>&1; then
6573                                                 voidflags=11
6574                                                 echo "But it supports 8."
6575                                         else
6576                                                 voidflags=3
6577                                                 echo "Neither does it support 8."
6578                                         fi
6579                                 fi
6580                         else
6581                                 echo "It does not support 2..."
6582                                 if $cc $ccflags -c -DTRY=13 try.c >/dev/null 2>&1; then
6583                                         voidflags=13
6584                                         echo "But it supports 4 and 8."
6585                                 else
6586                                         if $cc $ccflags -c -DTRY=5 try.c >/dev/null 2>&1; then
6587                                                 voidflags=5
6588                                                 echo "And it supports 4 but has not heard about 8."
6589                                         else
6590                                                 echo "However it supports 8 but not 4."
6591                                         fi
6592                                 fi
6593                         fi
6594                 else
6595                         echo "There is no support at all for void."
6596                         voidflags=0
6597                 fi
6598         fi
6599 esac
6600 case "$voidflags" in
6601 "$defvoidused") ;;
6602 *)      $cat >&4 <<'EOM'
6603   Support flag bits are:
6604     1: basic void declarations.
6605     2: arrays of pointers to functions returning void.
6606     4: operations between pointers to and addresses of void functions.
6607     8: generic void pointers.
6608 EOM
6609         dflt="$voidflags";
6610         rp="Your void support flags add up to what?"
6611         . ./myread
6612         voidflags="$ans"
6613         ;;
6614 esac
6615 $rm -f try.* .out
6616
6617 : check for length of pointer
6618 echo " "
6619 case "$ptrsize" in
6620 '')
6621         echo "Checking to see how big your pointers are..." >&4
6622         if test "$voidflags" -gt 7; then
6623                 echo '#define VOID_PTR char *' > try.c
6624         else
6625                 echo '#define VOID_PTR void *' > try.c
6626         fi
6627         $cat >>try.c <<EOCP
6628 #include <stdio.h>
6629 #$i_stdlib I_STDLIB
6630 #ifdef I_STDLIB
6631 #include <stdlib.h>
6632 #endif
6633 int main()
6634 {
6635     printf("%d\n", (int)sizeof(VOID_PTR));
6636     exit(0);
6637 }
6638 EOCP
6639         set try
6640         if eval $compile_ok; then
6641                 ptrsize=`$run ./try`
6642                 echo "Your pointers are $ptrsize bytes long."
6643         else
6644                 dflt='4'
6645                 echo "(I can't seem to compile the test program.  Guessing...)" >&4
6646                 rp="What is the size of a pointer (in bytes)?"
6647                 . ./myread
6648                 ptrsize="$ans"
6649         fi
6650         ;;
6651 esac
6652 $rm -f try.c try
6653 case "$use64bitall" in
6654 "$define"|true|[yY]*)
6655         case "$ptrsize" in
6656         4)      cat <<EOM >&4
6657
6658 *** You have chosen a maximally 64-bit build,
6659 *** but your pointers are only 4 bytes wide.
6660 *** Please rerun Configure without -Duse64bitall.
6661 EOM
6662                 case "$d_quad" in
6663                 define)
6664                         cat <<EOM >&4
6665 *** Since you have quads, you could possibly try with -Duse64bitint.
6666 EOM
6667                         ;;
6668                 esac
6669                 cat <<EOM >&4
6670 *** Cannot continue, aborting.
6671
6672 EOM
6673
6674                 exit 1
6675                 ;;
6676         esac
6677         ;;
6678 esac
6679
6680
6681 : determine whether to use malloc wrapping
6682 echo " "
6683 case "$usemallocwrap" in
6684 [yY]*|true|$define)     dflt='y' ;;
6685 [nN]*|false|$undef)     dflt='n' ;;
6686 *)      case "$usedevel" in
6687         [yY]*|true|$define)     dflt='y' ;;
6688         *) dflt='n' ;;
6689         esac
6690         ;;
6691 esac
6692 rp="Do you wish to wrap malloc calls to protect against potential overflows?"
6693 . ./myread
6694 usemallocwrap="$ans"
6695 case "$ans" in
6696 y*|true)
6697         usemallocwrap="$define" ;;
6698 *)
6699         usemallocwrap="$undef" ;;
6700 esac
6701
6702 : determine which malloc to compile in
6703 echo " "
6704 case "$usemymalloc" in
6705 [yY]*|true|$define)     dflt='y' ;;
6706 [nN]*|false|$undef)     dflt='n' ;;
6707 *)      case "$ptrsize" in
6708         4) dflt='y' ;;
6709         *) dflt='n' ;;
6710         esac
6711         ;;
6712 esac
6713 rp="Do you wish to attempt to use the malloc that comes with $package?"
6714 . ./myread
6715 usemymalloc="$ans"
6716 case "$ans" in
6717 y*|true)
6718         usemymalloc='y'
6719         mallocsrc='malloc.c'
6720         mallocobj="malloc$_o"
6721         d_mymalloc="$define"
6722         case "$libs" in
6723         *-lmalloc*)
6724                 : Remove malloc from list of libraries to use
6725                 echo "Removing unneeded -lmalloc from library list" >&4
6726                 set `echo X $libs | $sed -e 's/-lmalloc / /' -e 's/-lmalloc$//'`
6727                 shift
6728                 libs="$*"
6729                 echo "libs = $libs" >&4
6730                 ;;
6731         esac
6732         ;;
6733 *)
6734         usemymalloc='n'
6735         mallocsrc=''
6736         mallocobj=''
6737         d_mymalloc="$undef"
6738         ;;
6739 esac
6740
6741 : compute the return types of malloc and free
6742 echo " "
6743 $cat >malloc.c <<END
6744 #$i_malloc I_MALLOC
6745 #$i_stdlib I_STDLIB
6746 #include <stdio.h>
6747 #include <sys/types.h>
6748 #ifdef I_MALLOC
6749 #include <malloc.h>
6750 #endif
6751 #ifdef I_STDLIB
6752 #include <stdlib.h>
6753 #endif
6754 #ifdef TRY_MALLOC
6755 void *malloc();
6756 #endif
6757 #ifdef TRY_FREE
6758 void free();
6759 #endif
6760 END
6761 case "$malloctype" in
6762 '')
6763         if $cc $ccflags -c -DTRY_MALLOC malloc.c >/dev/null 2>&1; then
6764                 malloctype='void *'
6765         else
6766                 malloctype='char *'
6767         fi
6768         ;;
6769 esac
6770 echo "Your system wants malloc to return '$malloctype', it would seem." >&4
6771
6772 case "$freetype" in
6773 '')
6774         if $cc $ccflags -c -DTRY_FREE malloc.c >/dev/null 2>&1; then
6775                 freetype='void'
6776         else
6777                 freetype='int'
6778         fi
6779         ;;
6780 esac
6781 echo "Your system uses $freetype free(), it would seem." >&4
6782 $rm -f malloc.[co]
6783 : determine where site specific architecture-dependent libraries go.
6784 : sitelib  default is /usr/local/lib/perl5/site_perl/$version
6785 : sitearch default is /usr/local/lib/perl5/site_perl/$version/$archname
6786 : sitelib may have an optional trailing /share.
6787 case "$sitearch" in
6788 '')     dflt=`echo $sitelib | $sed 's,/share$,,'`
6789         dflt="$dflt/$archname"
6790         ;;
6791 *)      dflt="$sitearch"
6792         ;;
6793 esac
6794 set sitearch sitearch none
6795 eval $prefixit
6796 $cat <<EOM
6797
6798 The installation process will also create a directory for
6799 architecture-dependent site-specific extensions and modules.
6800
6801 EOM
6802 fn=d~+
6803 rp='Pathname for the site-specific architecture-dependent library files?'
6804 . ./getfile
6805 prefixvar=sitearch
6806 . ./setprefixvar
6807 if $test X"$sitearch" = X"$sitelib"; then
6808         d_sitearch="$undef"
6809 else
6810         d_sitearch="$define"
6811 fi
6812
6813 $cat <<EOM
6814
6815 The installation process will also create a directory for
6816 vendor-supplied add-ons.  Vendors who supply perl with their system
6817 may find it convenient to place all vendor-supplied files in this
6818 directory rather than in the main distribution directory.  This will
6819 ease upgrades between binary-compatible maintenance versions of perl.
6820
6821 Of course you may also use these directories in whatever way you see
6822 fit.  For example, you might use them to access modules shared over a
6823 company-wide network.
6824
6825 The default answer should be fine for most people.
6826 This causes further questions about vendor add-ons to be skipped
6827 and no vendor-specific directories will be configured for perl.
6828
6829 EOM
6830 rp='Do you want to configure vendor-specific add-on directories?'
6831 case "$usevendorprefix" in
6832 define|true|[yY]*) dflt=y ;;
6833 *)      : User may have set vendorprefix directly on Configure command line.
6834         case "$vendorprefix" in
6835         ''|' ') dflt=n ;;
6836         *)      dflt=y ;;
6837         esac
6838         ;;
6839 esac
6840 . ./myread
6841 case "$ans" in
6842 [yY]*)  fn=d~+
6843         rp='Installation prefix to use for vendor-supplied add-ons?'
6844         case "$vendorprefix" in
6845         '') dflt='' ;;
6846         *)  dflt=$vendorprefix ;;
6847         esac
6848         . ./getfile
6849         : XXX Prefixit unit does not yet support siteprefix and vendorprefix
6850         oldvendorprefix=''
6851         case "$vendorprefix" in
6852         '') ;;
6853         *)      case "$ans" in
6854                 "$prefix") ;;
6855                 *) oldvendorprefix="$prefix";;
6856                 esac
6857                 ;;
6858         esac
6859         usevendorprefix="$define"
6860         vendorprefix="$ans"
6861         vendorprefixexp="$ansexp"
6862         ;;
6863 *)      usevendorprefix="$undef"
6864         vendorprefix=''
6865         vendorprefixexp=''
6866         ;;
6867 esac
6868
6869 case "$vendorprefix" in
6870 '')     d_vendorlib="$undef"
6871         vendorlib=''
6872         vendorlibexp=''
6873         ;;
6874 *)      d_vendorlib="$define"
6875         : determine where vendor-supplied modules go.
6876         : Usual default is /usr/local/lib/perl5/vendor_perl/$version
6877         case "$vendorlib" in
6878         '')
6879                 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
6880                 case "$installstyle" in
6881                 *lib/perl5*) dflt=$vendorprefix/lib/$package/vendor_$prog/$version ;;
6882                 *)           dflt=$vendorprefix/lib/vendor_$prog/$version ;;
6883                 esac
6884                 ;;
6885         *)      dflt="$vendorlib"
6886                 ;;
6887         esac
6888         fn=d~+
6889         rp='Pathname for the vendor-supplied library files?'
6890         . ./getfile
6891         vendorlib="$ans"
6892         vendorlibexp="$ansexp"
6893         ;;
6894 esac
6895 vendorlib_stem=`echo "$vendorlibexp" | sed "s,/$version$,,"`
6896 prefixvar=vendorlib
6897 . ./installprefix
6898
6899 case "$vendorprefix" in
6900 '')     d_vendorarch="$undef"
6901         vendorarch=''
6902         vendorarchexp=''
6903         ;;
6904 *)      d_vendorarch="$define"
6905         : determine where vendor-supplied architecture-dependent libraries go.
6906         : vendorlib  default is /usr/local/lib/perl5/vendor_perl/$version
6907         : vendorarch default is /usr/local/lib/perl5/vendor_perl/$version/$archname
6908         : vendorlib may have an optional trailing /share.
6909         case "$vendorarch" in
6910         '')     dflt=`echo $vendorlib | $sed 's,/share$,,'`
6911                 dflt="$dflt/$archname"
6912                 ;;
6913         *)      dflt="$vendorarch" ;;
6914         esac
6915         fn=d~+
6916         rp='Pathname for vendor-supplied architecture-dependent files?'
6917         . ./getfile
6918         vendorarch="$ans"
6919         vendorarchexp="$ansexp"
6920         ;;
6921 esac
6922 prefixvar=vendorarch
6923 . ./installprefix
6924
6925 : Final catch-all directories to search
6926 $cat <<EOM
6927
6928 Lastly, you can have perl look in other directories for extensions and
6929 modules in addition to those already specified.
6930 These directories will be searched after 
6931         $sitearch 
6932         $sitelib 
6933 EOM
6934 test X"$vendorlib" != "X" && echo '     ' $vendorlib
6935 test X"$vendorarch" != "X" && echo '    ' $vendorarch
6936 echo ' '
6937 case "$otherlibdirs" in
6938 ''|' ') dflt='none' ;;
6939 *)      dflt="$otherlibdirs" ;;
6940 esac
6941 $cat <<EOM
6942 Enter a colon-separated set of extra paths to include in perl's @INC
6943 search path, or enter 'none' for no extra paths.
6944
6945 EOM
6946
6947 rp='Colon-separated list of additional directories for perl to search?'
6948 . ./myread
6949 case "$ans" in
6950 ' '|''|none)    otherlibdirs=' ' ;;     
6951 *)      otherlibdirs="$ans" ;;
6952 esac
6953 case "$otherlibdirs" in
6954 ' ') val=$undef ;;
6955 *)      val=$define ;;
6956 esac
6957 set d_perl_otherlibdirs
6958 eval $setvar
6959
6960 : Cruising for prototypes
6961 echo " "
6962 echo "Checking out function prototypes..." >&4
6963 $cat >prototype.c <<EOCP
6964 #$i_stdlib I_STDLIB
6965 #ifdef I_STDLIB
6966 #include <stdlib.h>
6967 #endif
6968 int main(int argc, char *argv[]) {
6969         exit(0);}
6970 EOCP
6971 if $cc $ccflags -c prototype.c >prototype.out 2>&1 ; then
6972         echo "Your C compiler appears to support function prototypes."
6973         val="$define"
6974 else
6975         echo "Your C compiler doesn't seem to understand function prototypes."
6976         val="$undef"
6977 fi
6978 set prototype
6979 eval $setvar
6980 $rm -f prototype*
6981
6982 case "$prototype" in
6983 "$define") ;;
6984 *)      ansi2knr='ansi2knr'
6985         echo " "
6986         cat <<EOM >&4
6987
6988 $me:  FATAL ERROR:
6989 This version of $package can only be compiled by a compiler that 
6990 understands function prototypes.  Unfortunately, your C compiler 
6991         $cc $ccflags
6992 doesn't seem to understand them.  Sorry about that.
6993
6994 If GNU cc is available for your system, perhaps you could try that instead.  
6995
6996 Eventually, we hope to support building Perl with pre-ANSI compilers.
6997 If you would like to help in that effort, please contact <perlbug@perl.org>.
6998
6999 Aborting Configure now.
7000 EOM
7001         exit 2
7002         ;;
7003 esac
7004
7005 echo " "
7006 case "$extras" in
7007 '') dflt='n';;
7008 *) dflt='y';;
7009 esac
7010 cat <<EOM
7011 Perl can be built with extra modules or bundles of modules which
7012 will be fetched from the CPAN and installed alongside Perl.
7013
7014 Notice that you will need access to the CPAN; either via the Internet,
7015 or a local copy, for example a CD-ROM or a local CPAN mirror.  (You will
7016 be asked later to configure the CPAN.pm module which will in turn do
7017 the installation of the rest of the extra modules or bundles.)
7018
7019 Notice also that if the modules require any external software such as
7020 libraries and headers (the libz library and the zlib.h header for the
7021 Compress::Zlib module, for example) you MUST have any such software
7022 already installed, this configuration process will NOT install such
7023 things for you.
7024
7025 If this doesn't make any sense to you, just accept the default '$dflt'.
7026 EOM
7027 rp='Install any extra modules (y or n)?'
7028 . ./myread
7029 case "$ans" in
7030 y|Y)
7031         cat <<EOM
7032
7033 Please list any extra modules or bundles to be installed from CPAN,
7034 with spaces between the names.  The names can be in any format the
7035 'install' command of CPAN.pm will understand.  (Answer 'none',
7036 without the quotes, to install no extra modules or bundles.)
7037 EOM
7038         rp='Extras?'
7039         dflt="$extras"
7040         . ./myread
7041         extras="$ans"
7042 esac
7043 case "$extras" in
7044 ''|'none')
7045         val=''
7046         $rm -f ../extras.lst
7047         ;;
7048 *)      echo "(Saving the list of extras for later...)"
7049         echo "$extras" > ../extras.lst
7050         val="'$extras'"
7051         ;;
7052 esac
7053 set extras
7054 eval $setvar
7055 echo " "
7056
7057 : determine where html pages for programs go
7058 set html1dir html1dir none
7059 eval $prefixit
7060 $cat <<EOM
7061
7062 If you wish to install html files for programs in $spackage, indicate
7063 the appropriate directory here.  To skip installing html files,
7064 answer "none".
7065 EOM
7066 case "$html1dir" in
7067 ''|none|$undef|' ') dflt=none ;;
7068 *) dflt=$html1dir ;;
7069 esac
7070 fn=dn+~
7071 rp="Directory for the main $spackage html pages?"
7072 . ./getfile
7073 prefixvar=html1dir
7074 . ./setprefixvar
7075 : Use ' ' for none so value is preserved next time through Configure
7076 $test X"$html1dir" = "X" && html1dir=' '
7077
7078 : determine where html pages for libraries and modules go
7079 set html3dir html3dir none
7080 eval $prefixit
7081 $cat <<EOM
7082
7083 If you wish to install html files for modules associated with $spackage,
7084 indicate the appropriate directory here.  To skip installing html files,
7085 answer "none".
7086 EOM
7087 : There is no obvious default.  If they have specified html1dir, then
7088 : try to key off that, possibly changing .../html1 into .../html3.
7089 case "$html3dir" in
7090 '') html3dir=`echo "$html1dir" | $sed 's/1$/3$/'` ;;
7091 *) dflt=$html3dir ;;
7092 esac
7093 fn=dn+~
7094 rp="Directory for the $spackage module html pages?"
7095 . ./getfile
7096 prefixvar=html3dir
7097 . ./setprefixvar
7098 : Use ' ' for none so value is preserved next time through Configure
7099 $test X"$html3dir" = "X" && html3dir=' '
7100
7101 : determine whether to install perl also as /usr/bin/perl
7102
7103 echo " "
7104 if $test -d /usr/bin -a "X$installbin" != X/usr/bin; then
7105         $cat <<EOM
7106 Many scripts expect perl to be installed as /usr/bin/perl.
7107
7108 If you want to, I can install the perl you are about to compile
7109 as /usr/bin/perl (in addition to $bin/perl).
7110 EOM
7111         if test -f /usr/bin/perl; then
7112             $cat <<EOM
7113
7114 However, please note that because you already have a /usr/bin/perl,
7115 overwriting that with a new Perl would very probably cause problems.
7116 Therefore I'm assuming you don't want to do that (unless you insist).
7117
7118 EOM
7119             case "$installusrbinperl" in
7120             "$define"|[yY]*)    dflt='y';;
7121             *)                  dflt='n';;
7122             esac
7123         else
7124             $cat <<EOM
7125
7126 Since you don't have a /usr/bin/perl I'm assuming creating one is okay.
7127
7128 EOM
7129             case "$installusrbinperl" in
7130             "$undef"|[nN]*)     dflt='n';;
7131             *)                  dflt='y';;
7132             esac
7133         fi
7134         rp="Do you want to install perl as /usr/bin/perl?"
7135         . ./myread
7136         case "$ans" in
7137         [yY]*)  val="$define";;
7138         *)      val="$undef" ;;
7139         esac
7140 else
7141         val="$undef"
7142 fi
7143 set installusrbinperl
7144 eval $setvar
7145
7146 echo " "
7147 echo "Checking for GNU C Library..." >&4
7148 cat >try.c <<'EOCP'
7149 /* Find out version of GNU C library.  __GLIBC__ and __GLIBC_MINOR__
7150    alone are insufficient to distinguish different versions, such as
7151    2.0.6 and 2.0.7.  The function gnu_get_libc_version() appeared in
7152    libc version 2.1.0.      A. Dougherty,  June 3, 2002.
7153 */
7154 #include <stdio.h>
7155 int main(void)
7156 {
7157 #ifdef __GLIBC__
7158 #   ifdef __GLIBC_MINOR__
7159 #       if __GLIBC__ >= 2 && __GLIBC_MINOR__ >= 1 && !defined(__cplusplus)
7160 #           include <gnu/libc-version.h>
7161             printf("%s\n",  gnu_get_libc_version());
7162 #       else
7163             printf("%d.%d\n",  __GLIBC__, __GLIBC_MINOR__);
7164 #       endif
7165 #   else
7166         printf("%d\n",  __GLIBC__);
7167 #   endif
7168     return 0;
7169 #else
7170     return 1;
7171 #endif
7172 }
7173 EOCP
7174 set try
7175 if eval $compile_ok && $run ./try > glibc.ver; then
7176         val="$define"
7177         gnulibc_version=`$cat glibc.ver`
7178         echo "You are using the GNU C Library version $gnulibc_version"
7179 else
7180         val="$undef"
7181         gnulibc_version=''
7182         echo "You are not using the GNU C Library"
7183 fi
7184 $rm -f try try.* glibc.ver
7185 set d_gnulibc
7186 eval $setvar
7187
7188 : see if nm is to be used to determine whether a symbol is defined or not
7189 case "$usenm" in
7190 '')
7191         dflt=''
7192         case "$d_gnulibc" in
7193         "$define")
7194                 echo " "
7195                 echo "nm probably won't work on the GNU C Library." >&4
7196                 dflt=n
7197                 ;;
7198         esac
7199         case "$dflt" in
7200         '') 
7201                 if $test "$osname" = aix -a "X$PASE" != "Xdefine" -a ! -f /lib/syscalls.exp; then
7202                         echo " "
7203                         echo "Whoops!  This is an AIX system without /lib/syscalls.exp!" >&4
7204                         echo "'nm' won't be sufficient on this sytem." >&4
7205                         dflt=n
7206                 fi
7207                 ;;
7208         esac
7209         case "$dflt" in
7210         '') dflt=`$egrep 'inlibc|csym' $rsrc/Configure | wc -l 2>/dev/null`
7211                 if $test $dflt -gt 20; then
7212                         dflt=y
7213                 else
7214                         dflt=n
7215                 fi
7216                 ;;
7217         esac
7218         ;;
7219 *)
7220         case "$usenm" in
7221         true|$define) dflt=y;;
7222         *) dflt=n;;
7223         esac
7224         ;;
7225 esac
7226 $cat <<EOM
7227
7228 I can use $nm to extract the symbols from your C libraries. This
7229 is a time consuming task which may generate huge output on the disk (up
7230 to 3 megabytes) but that should make the symbols extraction faster. The
7231 alternative is to skip the 'nm' extraction part and to compile a small
7232 test program instead to determine whether each symbol is present. If
7233 you have a fast C compiler and/or if your 'nm' output cannot be parsed,
7234 this may be the best solution.
7235
7236 You probably shouldn't let me use 'nm' if you are using the GNU C Library.
7237
7238 EOM
7239 rp="Shall I use $nm to extract C symbols from the libraries?"
7240 . ./myread
7241 case "$ans" in
7242 [Nn]*) usenm=false;;
7243 *) usenm=true;;
7244 esac
7245
7246 runnm=$usenm
7247 case "$reuseval" in
7248 true) runnm=false;;
7249 esac
7250
7251 : nm options which may be necessary
7252 case "$nm_opt" in
7253 '') if $test -f /mach_boot; then
7254                 nm_opt=''       # Mach
7255         elif $test -d /usr/ccs/lib; then
7256                 nm_opt='-p'     # Solaris (and SunOS?)
7257         elif $test -f /dgux; then
7258                 nm_opt='-p'     # DG-UX
7259         elif $test -f /lib64/rld; then
7260                 nm_opt='-p'     # 64-bit Irix
7261         else
7262                 nm_opt=''
7263         fi;;
7264 esac
7265
7266 : nm options which may be necessary for shared libraries but illegal
7267 : for archive libraries.  Thank you, Linux.
7268 case "$nm_so_opt" in
7269 '')     case "$myuname" in
7270         *linux*|gnu*)
7271                 if $nm --help | $grep 'dynamic' > /dev/null 2>&1; then
7272                         nm_so_opt='--dynamic'
7273                 fi
7274                 ;;
7275         esac
7276         ;;
7277 esac
7278
7279 case "$runnm" in
7280 true)
7281 : get list of predefined functions in a handy place
7282 echo " "
7283 case "$libc" in
7284 '') libc=unknown
7285         case "$libs" in
7286         *-lc_s*) libc=`./loc libc_s$_a $libc $libpth`
7287         esac
7288         ;;
7289 esac
7290 case "$libs" in
7291 '') ;;
7292 *)  for thislib in $libs; do
7293         case "$thislib" in
7294         -lc|-lc_s)
7295                 : Handle C library specially below.
7296                 ;;
7297         -l*)
7298                 thislib=`echo $thislib | $sed -e 's/^-l//'`
7299                 if try=`./loc lib$thislib.$so.'*' X $libpth`; $test -f "$try"; then
7300                         :
7301                 elif try=`./loc lib$thislib.$so X $libpth`; $test -f "$try"; then
7302                         :
7303                 elif try=`./loc lib$thislib$_a X $libpth`; $test -f "$try"; then
7304                         :
7305                 elif try=`./loc $thislib$_a X $libpth`; $test -f "$try"; then
7306                         :
7307                 elif try=`./loc lib$thislib X $libpth`; $test -f "$try"; then
7308                         :
7309                 elif try=`./loc $thislib X $libpth`; $test -f "$try"; then
7310                         :
7311                 elif try=`./loc Slib$thislib$_a X $xlibpth`; $test -f "$try"; then
7312                         :
7313                 else
7314                         try=''
7315                 fi
7316                 libnames="$libnames $try"
7317                 ;;
7318         *) libnames="$libnames $thislib" ;;
7319         esac
7320         done
7321         ;;
7322 esac
7323 xxx=normal
7324 case "$libc" in
7325 unknown)
7326         set /lib/libc.$so
7327         for xxx in $libpth; do
7328                 $test -r $1 || set $xxx/libc.$so
7329                 : The messy sed command sorts on library version numbers.
7330                 $test -r $1 || \
7331                         set `echo blurfl; echo $xxx/libc.$so.[0-9]* | \
7332                         tr ' ' $trnl | egrep -v '\.[A-Za-z]*$' | $sed -e '
7333                                 h
7334                                 s/[0-9][0-9]*/0000&/g
7335                                 s/0*\([0-9][0-9][0-9][0-9][0-9]\)/\1/g
7336                                 G
7337                                 s/\n/ /' | \
7338                          $sort | $sed -e 's/^.* //'`
7339                 eval set \$$#
7340         done
7341         $test -r $1 || set /usr/ccs/lib/libc.$so
7342         $test -r $1 || set /lib/libsys_s$_a
7343         ;;
7344 *)
7345         set blurfl
7346         ;;
7347 esac
7348 if $test -r "$1"; then
7349         echo "Your (shared) C library seems to be in $1."
7350         libc="$1"
7351 elif $test -r /lib/libc && $test -r /lib/clib; then
7352         echo "Your C library seems to be in both /lib/clib and /lib/libc."
7353         xxx=apollo
7354         libc='/lib/clib /lib/libc'
7355         if $test -r /lib/syslib; then
7356                 echo "(Your math library is in /lib/syslib.)"
7357                 libc="$libc /lib/syslib"
7358         fi
7359 elif $test -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7360         echo "Your C library seems to be in $libc, as you said before."
7361 elif $test -r $incpath/usr/lib/libc$_a; then
7362         libc=$incpath/usr/lib/libc$_a;
7363         echo "Your C library seems to be in $libc.  That's fine."
7364 elif $test -r /lib/libc$_a; then
7365         libc=/lib/libc$_a;
7366         echo "Your C library seems to be in $libc.  You're normal."
7367 else
7368         if tans=`./loc libc$_a blurfl/dyick $libpth`; $test -r "$tans"; then
7369                 :
7370         elif tans=`./loc libc blurfl/dyick $libpth`; $test -r "$tans"; then
7371                 libnames="$libnames "`./loc clib blurfl/dyick $libpth`
7372         elif tans=`./loc clib blurfl/dyick $libpth`; $test -r "$tans"; then
7373                 :
7374         elif tans=`./loc Slibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7375                 :
7376         elif tans=`./loc Mlibc$_a blurfl/dyick $xlibpth`; $test -r "$tans"; then
7377                 :
7378         else
7379                 tans=`./loc Llibc$_a blurfl/dyick $xlibpth`
7380         fi
7381         if $test -r "$tans"; then
7382                 echo "Your C library seems to be in $tans, of all places."
7383                 libc=$tans
7384         else
7385                 libc='blurfl'
7386         fi
7387 fi
7388 if $test $xxx = apollo -o -r "$libc" || (test -h "$libc") >/dev/null 2>&1; then
7389         dflt="$libc"
7390         cat <<EOM
7391
7392 If the guess above is wrong (which it might be if you're using a strange
7393 compiler, or your machine supports multiple models), you can override it here.
7394
7395 EOM
7396 else
7397         dflt=''
7398         echo $libpth | $tr ' ' $trnl | $sort | $uniq > libpath
7399         cat >&4 <<EOM
7400 I can't seem to find your C library.  I've looked in the following places:
7401
7402 EOM
7403         $sed 's/^/      /' libpath
7404         cat <<EOM
7405
7406 None of these seems to contain your C library. I need to get its name...
7407
7408 EOM
7409 fi
7410 fn=f
7411 rp='Where is your C library?'
7412 . ./getfile
7413 libc="$ans"
7414
7415 echo " "
7416 echo $libc $libnames | $tr ' ' $trnl | $sort | $uniq > libnames
7417 set X `cat libnames`
7418 shift
7419 xxx=files
7420 case $# in 1) xxx=file; esac
7421 echo "Extracting names from the following $xxx for later perusal:" >&4
7422 echo " "
7423 $sed 's/^/      /' libnames >&4
7424 echo " "
7425 $echo $n "This may take a while...$c" >&4
7426
7427 for file in $*; do
7428         case $file in
7429         *$so*) $nm $nm_so_opt $nm_opt $file 2>/dev/null;;
7430         *) $nm $nm_opt $file 2>/dev/null;;
7431         esac
7432 done >libc.tmp
7433
7434 $echo $n ".$c"
7435 $grep fprintf libc.tmp > libc.ptf
7436 xscan='eval "<libc.ptf $com >libc.list"; $echo $n ".$c" >&4'
7437 xrun='eval "<libc.tmp $com >libc.list"; echo "done." >&4'
7438 xxx='[ADTSIW]'
7439 if com="$sed -n -e 's/__IO//' -e 's/^.* $xxx  *//p'";\
7440         eval $xscan;\
7441         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7442                 eval $xrun
7443 elif com="$sed -n -e 's/^__*//' -e 's/^\([a-zA-Z_0-9$]*\).*xtern.*/\1/p'";\
7444         eval $xscan;\
7445         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7446                 eval $xrun
7447 elif com="$sed -n -e '/|UNDEF/d' -e '/FUNC..GL/s/^.*|__*//p'";\
7448         eval $xscan;\
7449         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7450                 eval $xrun
7451 elif com="$sed -n -e 's/^.* D __*//p' -e 's/^.* D //p'";\
7452         eval $xscan;\
7453         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7454                 eval $xrun
7455 elif com="$sed -n -e 's/^_//' -e 's/^\([a-zA-Z_0-9]*\).*xtern.*text.*/\1/p'";\
7456         eval $xscan;\
7457         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7458                 eval $xrun
7459 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p'";\
7460         eval $xscan;\
7461         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7462                 eval $xrun
7463 elif com="$grep '|' | $sed -n -e '/|COMMON/d' -e '/|DATA/d' \
7464                                 -e '/ file/d' -e 's/^\([^       ]*\).*/\1/p'";\
7465         eval $xscan;\
7466         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7467                 eval $xrun
7468 elif com="$sed -n -e 's/^.*|FUNC |GLOB .*|//p' -e 's/^.*|FUNC |WEAK .*|//p'";\
7469         eval $xscan;\
7470         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7471                 eval $xrun
7472 elif com="$sed -n -e 's/^__//' -e '/|Undef/d' -e '/|Proc/s/ .*//p'";\
7473         eval $xscan;\
7474         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7475                 eval $xrun
7476 elif com="$sed -n -e 's/^.*|Proc .*|Text *| *//p'";\
7477         eval $xscan;\
7478         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7479                 eval $xrun
7480 elif com="$sed -n -e '/Def. Text/s/.* \([^ ]*\)\$/\1/p'";\
7481         eval $xscan;\
7482         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7483                 eval $xrun
7484 elif com="$sed -n -e 's/^[-0-9a-f ]*_\(.*\)=.*/\1/p'";\
7485         eval $xscan;\
7486         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7487                 eval $xrun
7488 elif com="$sed -n -e 's/.*\.text n\ \ \ \.//p'";\
7489         eval $xscan;\
7490         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7491                 eval $xrun
7492 elif com="sed -n -e 's/^__.*//' -e 's/[       ]*D[    ]*[0-9]*.*//p'";\
7493         eval $xscan;\
7494         $contains '^fprintf$' libc.list >/dev/null 2>&1; then
7495                 eval $xrun
7496 else
7497         $nm -p $* 2>/dev/null >libc.tmp
7498         $grep fprintf libc.tmp > libc.ptf
7499         if com="$sed -n -e 's/^.* [ADTSIW]  *_[_.]*//p' -e 's/^.* [ADTSIW] //p'";\
7500                 eval $xscan; $contains '^fprintf$' libc.list >/dev/null 2>&1
7501         then
7502                 nm_opt='-p'
7503                 eval $xrun
7504         else
7505                 echo " "
7506                 echo "$nm didn't seem to work right. Trying $ar instead..." >&4
7507                 com=''
7508                 if $ar t $libc > libc.tmp && $contains '^fprintf$' libc.tmp >/dev/null 2>&1; then
7509                         for thisname in $libnames $libc; do
7510                                 $ar t $thisname >>libc.tmp
7511                         done
7512                         $sed -e "s/\\$_o\$//" < libc.tmp > libc.list
7513                         echo "Ok." >&4
7514                 elif test "X$osname" = "Xos2" && $ar tv $libc > libc.tmp; then
7515                         # Repeat libc to extract forwarders to DLL entries too
7516                         for thisname in $libnames $libc; do
7517                                 $ar tv $thisname >>libc.tmp
7518                                 # Revision 50 of EMX has bug in $ar.
7519                                 # it will not extract forwarders to DLL entries
7520                                 # Use emximp which will extract exactly them.
7521                                 emximp -o tmp.imp $thisname \
7522                                     2>/dev/null && \
7523                                     $sed -e 's/^\([_a-zA-Z0-9]*\) .*$/\1/p' \
7524                                     < tmp.imp >>libc.tmp
7525                                 $rm tmp.imp
7526                         done
7527                         $sed -e "s/\\$_o\$//" -e 's/^ \+//' < libc.tmp > libc.list
7528                         echo "Ok." >&4
7529                 else
7530                         echo "$ar didn't seem to work right." >&4
7531                         echo "Maybe this is a Cray...trying bld instead..." >&4
7532                         if bld t $libc | $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" > libc.list
7533                         then
7534                                 for thisname in $libnames; do
7535                                         bld t $libnames | \
7536                                         $sed -e 's/.*\///' -e "s/\\$_o:.*\$//" >>libc.list
7537                                         $ar t $thisname >>libc.tmp
7538                                 done
7539                                 echo "Ok." >&4
7540                         else
7541                                 echo "That didn't work either.  Giving up." >&4
7542                                 exit 1
7543                         fi
7544                 fi
7545         fi
7546 fi
7547 nm_extract="$com"
7548 case "$PASE" in
7549 define)
7550     echo " "
7551     echo "Since you are compiling for PASE, extracting more symbols from libc.a ...">&4
7552     dump -Tv /lib/libc.a | awk '$7 == "/unix" {print $5 " " $8}' | grep "^SV" | awk '{print $2}' >> libc.list
7553     ;;
7554 *)  if $test -f /lib/syscalls.exp; then
7555         echo " "
7556         echo "Also extracting names from /lib/syscalls.exp for good ole AIX..." >&4
7557         $sed -n 's/^\([^        ]*\)[   ]*syscall[0-9]*[        ]*$/\1/p' /lib/syscalls.exp >>libc.list
7558     fi
7559     ;;
7560 esac
7561 ;;
7562 esac
7563 $rm -f libnames libpath
7564
7565 : see if dld is available
7566 set dld.h i_dld
7567 eval $inhdr
7568
7569 : is a C symbol defined?
7570 csym='tlook=$1;
7571 case "$3" in
7572 -v) tf=libc.tmp; tdc="";;
7573 -a) tf=libc.tmp; tdc="[]";;
7574 *) tlook="^$1\$"; tf=libc.list; tdc="()";;
7575 esac;
7576 tx=yes;
7577 case "$reuseval-$4" in
7578 true-) ;;
7579 true-*) tx=no; eval "tval=\$$4"; case "$tval" in "") tx=yes;; esac;;
7580 esac;
7581 case "$tx" in
7582 yes)
7583         tval=false;
7584         if $test "$runnm" = true; then
7585                 if $contains $tlook $tf >/dev/null 2>&1; then
7586                         tval=true;
7587                 elif $test "$mistrustnm" = compile -o "$mistrustnm" = run; then
7588                         echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7589                         $cc -o try $optimize $ccflags $ldflags try.c >/dev/null 2>&1 $libs && tval=true;
7590                         $test "$mistrustnm" = run -a -x try && { $run ./try$_exe >/dev/null 2>&1 || tval=false; };
7591                         $rm -f try$_exe try.c core core.* try.core;
7592                 fi;
7593         else
7594                 echo "void *(*(p()))$tdc { extern void *$1$tdc; return &$1; } int main() { if(p()) return(0); else return(1); }"> try.c;
7595                 $cc -o try $optimize $ccflags $ldflags try.c $libs >/dev/null 2>&1 && tval=true;
7596                 $rm -f try$_exe try.c;
7597         fi;
7598         ;;
7599 *)
7600         case "$tval" in
7601         $define) tval=true;;
7602         *) tval=false;;
7603         esac;
7604         ;;
7605 esac;
7606 eval "$2=$tval"'
7607
7608 : define an is-in-libc? function
7609 inlibc='echo " "; td=$define; tu=$undef;
7610 sym=$1; var=$2; eval "was=\$$2";
7611 tx=yes;
7612 case "$reuseval$was" in
7613 true) ;;
7614 true*) tx=no;;
7615 esac;
7616 case "$tx" in
7617 yes)
7618         set $sym tres -f;
7619         eval $csym;
7620         case "$tres" in
7621         true)
7622                 echo "$sym() found." >&4;
7623                 case "$was" in $undef) . ./whoa; esac; eval "$var=\$td";;
7624         *)
7625                 echo "$sym() NOT found." >&4;
7626                 case "$was" in $define) . ./whoa; esac; eval "$var=\$tu";;
7627         esac;;
7628 *)
7629         case "$was" in
7630         $define) echo "$sym() found." >&4;;
7631         *) echo "$sym() NOT found." >&4;;
7632         esac;;
7633 esac'
7634
7635
7636 echo " "
7637 echo "Checking for C++..." >&4
7638 cat >try.c <<'EOCP'
7639 #include <stdio.h>
7640 int main(void)
7641 {
7642 #ifdef __cplusplus
7643     printf("define\n");
7644 #else
7645     printf("undef\n");
7646 #endif
7647     return 0;
7648 }
7649 EOCP
7650 set try
7651 if eval $compile_ok && $run ./try >cplusplus$$; then
7652         val=`$cat cplusplus$$`
7653         echo "You are using a C++ compiler."
7654 else
7655         val="$undef"
7656         echo "You are not using a C++ compiler."
7657 fi
7658 $rm -f try try.* cplusplus$$
7659 set d_cplusplus
7660 eval $setvar
7661
7662 : see if dlopen exists
7663 xxx_runnm="$runnm"
7664 xxx_ccflags="$ccflags"
7665 runnm=false
7666 : with g++ one needs -shared to get is-in-libc to work for dlopen
7667 case "$gccversion" in
7668 '')     ;;
7669 *)      case "$d_cplusplus" in
7670         "$define") ccflags="$ccflags -shared" ;;
7671         esac
7672         ;;
7673 esac
7674 set dlopen d_dlopen
7675 eval $inlibc
7676 runnm="$xxx_runnm"
7677 ccflags="$xxx_ccflags"
7678
7679 : see if this is a unistd.h system
7680 set unistd.h i_unistd
7681 eval $inhdr
7682
7683 : determine which dynamic loading, if any, to compile in
7684 echo " "
7685 dldir="ext/DynaLoader"
7686 case "$usedl" in
7687 $define|y|true)
7688         dflt='y'
7689         usedl="$define"
7690         ;;
7691 $undef|n|false)
7692         dflt='n'
7693         usedl="$undef"
7694         ;;
7695 *) 
7696         dflt='n'
7697         case "$d_dlopen" in
7698             $define) dflt='y' ;;
7699         esac
7700         case "$i_dld" in
7701             $define) dflt='y' ;;
7702         esac
7703         : Does a dl_xxx.xs file exist for this operating system
7704         $test -f $rsrc/$dldir/dl_${osname}.xs && dflt='y'
7705         ;;
7706 esac
7707 rp="Do you wish to use dynamic loading?"
7708 . ./myread
7709 usedl="$ans"
7710 case "$ans" in
7711 y*) usedl="$define"
7712         case "$dlsrc" in
7713         '')
7714                 if $test -f $rsrc/$dldir/dl_${osname}.xs ; then
7715                         dflt="$dldir/dl_${osname}.xs"
7716                 elif $test "$d_dlopen" = "$define" ; then
7717                         dflt="$dldir/dl_dlopen.xs"
7718                 elif $test "$i_dld" = "$define" ; then
7719                         dflt="$dldir/dl_dld.xs"
7720                 else
7721                         dflt=''
7722                 fi
7723                 ;;
7724         *)      dflt="$dldir/$dlsrc"
7725                 ;;
7726         esac
7727     echo "The following dynamic loading files are available:"
7728         : Can not go over to $dldir because getfile has path hard-coded in.
7729         tdir=`pwd`; cd "$rsrc"; $ls -C $dldir/dl*.xs; cd "$tdir"
7730         rp="Source file to use for dynamic loading"
7731         fn="fne"
7732         gfpth="$src"
7733         . ./getfile
7734         usedl="$define"
7735         : emulate basename
7736         dlsrc=`echo $ans | $sed -e 's%.*/\([^/]*\)$%\1%'`
7737
7738         $cat << EOM
7739
7740 Some systems may require passing special flags to $cc -c to
7741 compile modules that will be used to create a shared library.
7742 To use no flags, say "none".
7743
7744 EOM
7745     case "$cccdlflags" in
7746     '') case "$gccversion" in
7747                 '') case "$osname" in
7748                         hpux)   dflt='+z' ;;
7749                         next)   dflt='none' ;;
7750                         irix*)  dflt='-KPIC' ;;
7751                         svr4*|esix*|solaris|nonstopux) dflt='-KPIC' ;;
7752                         sunos)  dflt='-pic' ;;
7753                         *)      dflt='none' ;;
7754                     esac
7755                         ;;
7756                 *)  case "$osname" in
7757                         darwin) dflt='none' ;;
7758                         svr4*|esix*|solaris|nonstopux) dflt='-fPIC' ;;
7759                         *)      dflt='-fpic' ;;
7760                     esac ;;
7761             esac ;;
7762         ' ') dflt='none' ;;
7763     *)  dflt="$cccdlflags" ;;
7764     esac
7765     rp="Any special flags to pass to $cc -c to compile shared library modules?"
7766     . ./myread
7767     case "$ans" in
7768     none) cccdlflags=' ' ;;
7769     *) cccdlflags="$ans" ;;
7770     esac
7771
7772     cat << EOM
7773
7774 Some systems use ld to create libraries that can be dynamically loaded,
7775 while other systems (such as those using ELF) use $cc.
7776
7777 EOM
7778         case "$ld" in
7779         '')     $cat >try.c <<EOM
7780 /* Test for whether ELF binaries are produced */
7781 #include <fcntl.h>
7782 #$i_stdlib I_STDLIB
7783 #ifdef I_STDLIB
7784 #include <stdlib.h>
7785 #endif
7786 #$i_unistd I_UNISTD
7787 #ifdef I_UNISTD
7788 #include <unistd.h>
7789 #endif
7790 int main() {
7791         char b[4];
7792         int i = open("a.out",O_RDONLY);
7793         if(i == -1) 
7794                 exit(1); /* fail */
7795         if(read(i,b,4)==4 && b[0]==127 && b[1]=='E' && b[2]=='L' && b[3]=='F')
7796                 exit(0); /* succeed (yes, it's ELF) */
7797         else
7798                 exit(1); /* fail */
7799 }
7800 EOM
7801                 if $cc $ccflags $ldflags try.c >/dev/null 2>&1 && $run ./a.out; then
7802                         cat <<EOM
7803 You appear to have ELF support.  I'll use $cc to build dynamic libraries.
7804 EOM
7805                         dflt="$cc"
7806                 else
7807                         echo "I'll use ld to build dynamic libraries."
7808                         dflt='ld'
7809                 fi
7810                 rm -f try.c a.out
7811                 ;;
7812         *)      dflt="$ld"
7813                 ;;
7814         esac
7815
7816     rp="What command should be used to create dynamic libraries?"
7817     . ./myread
7818         ld="$ans"
7819
7820     cat << EOM
7821
7822 Some systems may require passing special flags to $ld to create a
7823 library that can be dynamically loaded.  If your ld flags include
7824 -L/other/path options to locate libraries outside your loader's normal
7825 search path, you may need to specify those -L options here as well.  To
7826 use no flags, say "none".
7827
7828 EOM
7829     case "$lddlflags" in
7830     '') case "$osname" in
7831                         beos) dflt='-nostart' ;;
7832                         hpux) dflt='-b';
7833                               case "$gccversion" in
7834                               '') dflt="$dflt +vnocompatwarnings" ;;
7835                               esac
7836                               ;;        
7837                         linux|irix*|gnu*)       dflt='-shared' ;;
7838                         next)  dflt='none' ;;
7839                         solaris) dflt='-G' ;;
7840                         sunos) dflt='-assert nodefinitions' ;;
7841                         svr4*|esix*|nonstopux) dflt="-G $ldflags" ;;
7842                 *)     dflt='none' ;;
7843                         esac
7844                         ;;
7845     *) dflt="$lddlflags" ;;
7846     esac
7847
7848         : Try to guess additional flags to pick up local libraries.
7849         : Be careful not to append to a plain 'none'
7850         case "$dflt" in
7851         none) dflt='' ;;
7852         esac
7853         for thisflag in $ldflags; do
7854                 case "$thisflag" in
7855                 -L*|-R*|-Wl,-R*)
7856                         case " $dflt " in
7857                         *" $thisflag "*) ;;
7858                         *) dflt="$dflt $thisflag" ;;
7859                         esac
7860                         ;;
7861                 esac
7862         done
7863
7864         case "$dflt" in
7865         ''|' ') dflt='none' ;;
7866         esac
7867
7868     rp="Any special flags to pass to $ld to create a dynamically loaded library?"
7869     . ./myread
7870     case "$ans" in
7871     none) lddlflags=' ' ;;
7872     *) lddlflags="$ans" ;;
7873     esac
7874
7875         cat <<EOM
7876
7877 Some systems may require passing special flags to $cc to indicate that
7878 the resulting executable will use dynamic linking.  To use no flags,
7879 say "none".
7880
7881 EOM
7882     case "$ccdlflags" in
7883     '') case "$osname" in
7884             linux|hpux|gnu*)    dflt='-Wl,-E' ;;
7885             next|sunos) dflt='none' ;;
7886             *)          dflt='none' ;;
7887             esac ;;
7888     ' ')  dflt='none' ;;
7889     *)  dflt="$ccdlflags" ;;
7890     esac
7891     rp="Any special flags to pass to $cc to use dynamic linking?"
7892     . ./myread
7893     case "$ans" in
7894     none) ccdlflags=' ' ;;
7895     *) ccdlflags="$ans" ;;
7896     esac
7897     ;;
7898 *)  usedl="$undef"
7899         ld='ld'
7900     dlsrc='dl_none.xs'
7901     lddlflags=''
7902     ccdlflags=''
7903     ;;
7904 esac
7905
7906 also=''
7907 case "$usedl" in
7908 $undef)
7909         # No dynamic loading being used, so don't bother even to prompt.
7910         useshrplib='false'
7911         ;;
7912 *)      case "$useshrplib" in
7913         '')     case "$osname" in
7914                 svr4*|nonstopux|dgux|dynixptx|esix|powerux|beos|cygwin*)
7915                         dflt=y
7916                         also='Building a shared libperl is required for dynamic loading to work on your system.'
7917                         ;;
7918                 next*)
7919                         case "$osvers" in
7920                         4*)     dflt=y
7921                                 also='Building a shared libperl is needed for MAB support.'
7922                                 ;;
7923                         *)      dflt=n
7924                                 ;;
7925                         esac
7926                         ;;
7927                 *)      dflt=n
7928                         ;;
7929                 esac
7930                 ;;
7931         $define|true|[Yy]*)
7932                 dflt=y
7933                 ;;
7934         *)      dflt=n
7935                 ;;
7936         esac
7937         $cat << EOM
7938
7939 The perl executable is normally obtained by linking perlmain.c with
7940 libperl${_a}, any static extensions (usually just DynaLoader), and
7941 any other libraries needed on this system (such as -lm, etc.).  Since
7942 your system supports dynamic loading, it is probably possible to build
7943 a shared libperl.$so.  If you will have more than one executable linked
7944 to libperl.$so, this will significantly reduce the size of each
7945 executable, but it may have a noticeable effect on performance.  The
7946 default is probably sensible for your system.
7947 $also
7948
7949 EOM
7950         rp="Build a shared libperl.$so (y/n)"
7951         . ./myread
7952         case "$ans" in
7953         true|$define|[Yy]*)
7954                 useshrplib='true'  ;;
7955         *)      useshrplib='false' ;;
7956         esac
7957         ;;
7958 esac
7959
7960 case "$useshrplib" in
7961 true)
7962         case "$libperl" in
7963         '')
7964                 # Figure out a good name for libperl.so.  Since it gets stored in
7965                 # a version-specific architecture-dependent library, the version
7966                 # number isn't really that important, except for making cc/ld happy.
7967                 #
7968                 # A name such as libperl.so.3.1
7969                 majmin="libperl.$so.$patchlevel.$subversion"
7970                 # A name such as libperl.so.301
7971                 majonly=`echo $patchlevel $subversion |
7972                         $awk '{printf "%d%02d", $1, $2}'`
7973                 majonly=libperl.$so.$majonly
7974                 # I'd prefer to keep the os-specific stuff here to a minimum, and
7975                 # rely on figuring it out from the naming of libc.
7976                 case "${osname}${osvers}" in
7977                 next4*)
7978                         dflt=libperl.5.$so
7979                         # XXX How handle the --version stuff for MAB?
7980                         ;;
7981                 linux*|gnu*)  # ld won't link with a bare -lperl otherwise.
7982                         dflt=libperl.$so
7983                         ;;
7984                 cygwin*) # ld links against an importlib
7985                         dflt=libperl$lib_ext
7986                         ;;
7987                 *)      # Try to guess based on whether libc has major.minor.
7988                         case "$libc" in
7989                         *libc.$so.[0-9]*.[0-9]*) dflt=$majmin ;;
7990                         *libc.$so.[0-9]*) dflt=$majonly ;;
7991                         *)      dflt=libperl.$so ;;
7992                         esac
7993                         ;;
7994                 esac
7995                 ;;
7996         *)      dflt=$libperl
7997                 ;;
7998         esac
7999         cat << EOM
8000
8001 I need to select a good name for the shared libperl.  If your system uses
8002 library names with major and minor numbers, then you might want something
8003 like $majmin.  Alternatively, if your system uses a single version
8004 number for shared libraries, then you might want to use $majonly.
8005 Or, your system might be quite happy with a simple libperl.$so.
8006
8007 Since the shared libperl will get installed into a version-specific
8008 architecture-dependent directory, the version number of the shared perl
8009 library probably isn't important, so the default should be o.k.
8010
8011 EOM
8012         rp='What name do you want to give to the shared libperl?'
8013         . ./myread
8014         libperl=$ans
8015         echo "Ok, I'll use $libperl"
8016         ;;
8017 *)
8018         libperl="libperl${_a}"
8019         ;;
8020 esac
8021
8022 # Detect old use of shrpdir via undocumented Configure -Dshrpdir
8023 case "$shrpdir" in
8024 '') ;;
8025 *)      $cat >&4 <<EOM
8026 WARNING:  Use of the shrpdir variable for the installation location of
8027 the shared $libperl is not supported.  It was never documented and
8028 will not work in this version.  Let me (perlbug@perl.org)
8029 know of any problems this may cause.
8030
8031 EOM
8032         case "$shrpdir" in
8033         "$archlibexp/CORE")
8034                 $cat >&4 <<EOM
8035 But your current setting of $shrpdir is
8036 the default anyway, so it's harmless.
8037 EOM
8038                 ;;
8039         *)
8040                 $cat >&4 <<EOM
8041 Further, your current attempted setting of $shrpdir
8042 conflicts with the value of $archlibexp/CORE
8043 that installperl will use.
8044 EOM
8045                 ;;
8046         esac
8047         ;;
8048 esac
8049
8050 # How will the perl executable find the installed shared $libperl?
8051 # Add $xxx to ccdlflags.
8052 # If we can't figure out a command-line option, use $shrpenv to
8053 # set env LD_RUN_PATH.  The main perl makefile uses this.
8054 shrpdir=$archlibexp/CORE
8055 xxx=''
8056 tmp_shrpenv=''
8057 if "$useshrplib"; then
8058     case "$osname" in 
8059         aix)
8060                 # We'll set it in Makefile.SH...
8061                 ;;
8062         solaris)
8063                 xxx="-R $shrpdir"
8064                 ;;
8065         freebsd|netbsd|openbsd|interix|dragonfly)
8066                 xxx="-Wl,-R$shrpdir"
8067                 ;;
8068         bsdos|linux|irix*|dec_osf|gnu*)
8069                 xxx="-Wl,-rpath,$shrpdir"
8070                 ;;
8071         next)
8072                 # next doesn't like the default...
8073                 ;;
8074         beos)
8075                 # beos doesn't like the default, either.
8076                 ;;
8077         hpux*)
8078                 # hpux doesn't like the default, either.
8079                 tmp_shrpenv="env LDOPTS=\"+s +b${shrpdir}\""
8080                 ;;
8081         *)
8082                 tmp_shrpenv="env LD_RUN_PATH=$shrpdir"
8083                 ;;
8084         esac
8085         case "$xxx" in
8086         '') ;;
8087         *)      
8088                 # Only add $xxx if it isn't already in ccdlflags.
8089                 case " $ccdlflags " in
8090                 *" $xxx "*)     ;;
8091                 *)      ccdlflags="$ccdlflags $xxx"
8092                         cat <<EOM >&4
8093
8094 Adding $xxx to the flags
8095 passed to $ld so that the perl executable will find the 
8096 installed shared $libperl.
8097
8098 EOM
8099                         ;;
8100                 esac
8101                 ;;
8102         esac
8103 fi
8104 # Fix ccdlflags in AIX for building external extensions.
8105 # (For building Perl itself bare -bE:perl.exp is needed,
8106 #  Makefile.SH takes care of this.)
8107 case "$osname" in
8108 aix) ccdlflags="$ccdlflags -bE:$installarchlib/CORE/perl.exp" ;;
8109 esac
8110 # Respect a hint or command-line value.
8111 case "$shrpenv" in
8112 '') shrpenv="$tmp_shrpenv" ;;
8113 esac
8114 case "$ldlibpthname" in
8115 '')     ldlibpthname=LD_LIBRARY_PATH ;;
8116 none)   ldlibpthname='' ;;
8117 esac
8118
8119 : determine where manual pages are on this system
8120 echo " "
8121 case "$sysman" in
8122 '') 
8123         syspath='/usr/share/man/man1 /usr/man/man1'
8124         syspath="$syspath /usr/man/mann /usr/man/manl /usr/man/local/man1"
8125         syspath="$syspath /usr/man/u_man/man1"
8126         syspath="$syspath /usr/catman/u_man/man1 /usr/man/l_man/man1"
8127         syspath="$syspath /usr/local/man/u_man/man1 /usr/local/man/l_man/man1"
8128         syspath="$syspath /usr/man/man.L /local/man/man1 /usr/local/man/man1"
8129         sysman=`./loc . /usr/man/man1 $syspath`
8130         ;;
8131 esac
8132 if $test -d "$sysman"; then
8133         echo "System manual is in $sysman." >&4
8134 else
8135         echo "Could not find manual pages in source form." >&4
8136 fi
8137
8138 : determine where manual pages go
8139 set man1dir man1dir none
8140 eval $prefixit
8141 $cat <<EOM
8142
8143 $spackage has manual pages available in source form.
8144 EOM
8145 case "$nroff" in
8146 nroff)
8147         echo "However, you don't have nroff, so they're probably useless to you."
8148         case "$man1dir" in
8149         '') man1dir="none";;
8150         esac;;
8151 esac
8152 echo "If you don't want the manual sources installed, answer 'none'."
8153 case "$man1dir" in
8154 ' ') dflt=none
8155         ;;
8156 '')
8157         lookpath="$prefixexp/share/man/man1"
8158         lookpath="$lookpath $prefixexp/man/man1 $prefixexp/man/l_man/man1"
8159         lookpath="$lookpath $prefixexp/man/p_man/man1"
8160         lookpath="$lookpath $prefixexp/man/u_man/man1"
8161         lookpath="$lookpath $prefixexp/man/man.1"
8162         case "$sysman" in
8163         */?_man*)       dflt=`./loc . $prefixexp/l_man/man1 $lookpath` ;;
8164         *)      dflt=`./loc . $prefixexp/man/man1 $lookpath` ;;
8165         esac
8166         set dflt
8167         eval $prefixup
8168         ;;
8169 *)  dflt="$man1dir"
8170         ;;
8171 esac
8172 echo " "
8173 fn=dn+~
8174 rp="Where do the main $spackage manual pages (source) go?"
8175 . ./getfile
8176 if $test "X$man1direxp" != "X$ansexp"; then
8177         installman1dir=''
8178 fi
8179 prefixvar=man1dir
8180 . ./setprefixvar
8181
8182 case "$man1dir" in
8183 '')     man1dir=' '
8184         installman1dir='';;
8185 esac
8186
8187 : What suffix to use on installed man pages
8188
8189 case "$man1dir" in
8190 ' ')
8191         man1ext='0'
8192         ;;
8193 *)
8194         rp="What suffix should be used for the main $spackage man pages?"
8195         case "$man1ext" in
8196         '')     case "$man1dir" in
8197                 *1)  dflt=1 ;;
8198                 *1p) dflt=1p ;;
8199                 *1pm) dflt=1pm ;;
8200                 *l) dflt=l;;
8201                 *n) dflt=n;;
8202                 *o) dflt=o;;
8203                 *p) dflt=p;;
8204                 *C) dflt=C;;
8205                 *L) dflt=L;;
8206                 *L1) dflt=L1;;
8207                 *) dflt=1;;
8208                 esac
8209                 ;;
8210         *)      dflt="$man1ext";;
8211         esac
8212         . ./myread
8213         man1ext="$ans"
8214         ;;
8215 esac
8216
8217 : see if we can have long filenames
8218 echo " "
8219 first=123456789abcdef
8220 $rm -f $first
8221 if (echo hi >$first) 2>/dev/null; then
8222         if $test -f 123456789abcde; then
8223                 echo 'You cannot have filenames longer than 14 characters.  Sigh.' >&4
8224                 val="$undef"
8225         else
8226                 echo 'You can have filenames longer than 14 characters.'>&4
8227                 val="$define"
8228         fi
8229 else
8230         $cat <<'EOM'
8231 You can't have filenames longer than 14 chars.
8232 You can't even think about them!
8233 EOM
8234         val="$undef"
8235 fi 
8236 set d_flexfnam
8237 eval $setvar
8238 $rm -rf 123456789abcde*
8239
8240 : determine where library module manual pages go
8241 set man3dir man3dir none
8242 eval $prefixit
8243 $cat <<EOM
8244
8245 $spackage has manual pages for many of the library modules.
8246 EOM
8247
8248 case "$nroff" in
8249 nroff)
8250         $cat <<'EOM'
8251 However, you don't have nroff, so they're probably useless to you.
8252 EOM
8253         case "$man3dir" in
8254         '') man3dir="none";;
8255         esac;;
8256 esac
8257
8258 case "$d_flexfnam" in
8259 undef)
8260         $cat <<'EOM'
8261 However, your system can't handle the long file names like File::Basename.3.
8262 EOM
8263         case "$man3dir" in
8264         '') man3dir="none";;
8265         esac;;
8266 esac
8267
8268 echo "If you don't want the manual sources installed, answer 'none'."
8269 prog=`echo $package | $sed 's/-*[0-9.]*$//'`
8270 case "$man3dir" in
8271 '')     dflt=`echo "$man1dir" | $sed -e 's/man1/man3/g' -e 's/man\.1/man\.3/g'`
8272         if $test -d "$privlib/man/man3"; then
8273                 cat <<EOM >&4
8274
8275 WARNING:  Previous versions of perl installed man3 pages into
8276 $privlib/man/man3.  This version will suggest a
8277 new default of $dflt.
8278 EOM
8279                 tdflt=$dflt
8280                 dflt='n'
8281                 rp='Do you wish to preserve the old behavior?(y/n)'
8282                 . ./myread
8283                 case "$ans" in
8284                 y*) dflt="$privlib/man/man3" ;;
8285                 *)  dflt=$tdflt ;;
8286                 esac
8287     fi
8288         ;;
8289 *)      dflt="$man3dir" ;;
8290 esac
8291 case "$dflt" in
8292 ' ') dflt=none ;;
8293 esac
8294 echo " "
8295 fn=dn+~
8296 rp="Where do the $package library man pages (source) go?"
8297 . ./getfile
8298 prefixvar=man3dir
8299 . ./setprefixvar
8300
8301 case "$man3dir" in
8302 '')     man3dir=' '
8303         installman3dir='';;
8304 esac
8305
8306 : What suffix to use on installed man pages
8307 case "$man3dir" in
8308 ' ')
8309         man3ext='0'
8310         ;;
8311 *)
8312         rp="What suffix should be used for the $package library man pages?"
8313         case "$man3ext" in
8314         '')     case "$man3dir" in
8315                 *3)  dflt=3 ;;
8316                 *3p) dflt=3p ;;
8317                 *3pm) dflt=3pm ;;
8318                 *l) dflt=l;;
8319                 *n) dflt=n;;
8320                 *o) dflt=o;;
8321                 *p) dflt=p;;
8322                 *C) dflt=C;;
8323                 *L) dflt=L;;
8324                 *L3) dflt=L3;;
8325                 *) dflt=3;;
8326                 esac
8327                 ;;
8328         *)      dflt="$man3ext";;
8329         esac
8330         . ./myread
8331         man3ext="$ans"
8332         ;;
8333 esac
8334
8335 : see if we have to deal with yellow pages, now NIS.
8336 if $test -d /usr/etc/yp || $test -d /etc/yp || $test -d /usr/lib/yp; then
8337         if $test -f /usr/etc/nibindd; then
8338                 echo " "
8339                 echo "I'm fairly confident you're on a NeXT."
8340                 echo " "
8341                 rp='Do you get the hosts file via NetInfo?'
8342                 dflt=y
8343                 case "$hostcat" in
8344                 nidump*) ;;
8345                 '') ;;
8346                 *) dflt=n;;
8347                 esac
8348                 . ./myread
8349                 case "$ans" in
8350                 y*) hostcat='nidump hosts .';;
8351                 *)      case "$hostcat" in
8352                         nidump*) hostcat='';;
8353                         esac
8354                         ;;
8355                 esac
8356         fi
8357         case "$hostcat" in
8358         nidump*) ;;
8359         *)
8360                 case "$hostcat" in
8361                 *ypcat*) dflt=y;;
8362                 '') if $contains '^\+' /etc/passwd >/dev/null 2>&1; then
8363                                 dflt=y
8364                         else
8365                                 dflt=n
8366                         fi;;
8367                 *) dflt=n;;
8368                 esac
8369                 echo " "
8370                 rp='Are you getting the hosts file via yellow pages?'
8371                 . ./myread
8372                 case "$ans" in
8373                 y*) hostcat='ypcat hosts';;
8374                 *) hostcat='cat /etc/hosts';;
8375                 esac
8376                 ;;
8377         esac
8378 fi
8379 case "$hostcat" in
8380 '') test -f /etc/hosts && hostcat='cat /etc/hosts';;
8381 esac
8382 case "$groupcat" in
8383 '') test -f /etc/group && groupcat='cat /etc/group';;
8384 esac
8385 case "$passcat" in
8386 '') test -f /etc/passwd && passcat='cat /etc/passwd';;
8387 esac
8388
8389 : now get the host name
8390 echo " "
8391 echo "Figuring out host name..." >&4
8392 case "$myhostname" in
8393 '') cont=true
8394         echo 'Maybe "hostname" will work...'
8395         if tans=`sh -c hostname 2>&1` ; then
8396                 myhostname=$tans
8397                 phostname=hostname
8398                 cont=''
8399         fi
8400         ;;
8401 *) cont='';;
8402 esac
8403 if $test "$cont"; then
8404         if ./xenix; then
8405                 echo 'Oh, dear.  Maybe "/etc/systemid" is the key...'
8406                 if tans=`cat /etc/systemid 2>&1` ; then
8407                         myhostname=$tans
8408                         phostname='cat /etc/systemid'
8409                         echo "Whadyaknow.  Xenix always was a bit strange..."
8410                         cont=''
8411                 fi
8412         elif $test -r /etc/systemid; then
8413                 echo "(What is a non-Xenix system doing with /etc/systemid?)"
8414         fi
8415 fi
8416 if $test "$cont"; then
8417         echo 'No, maybe "uuname -l" will work...'
8418         if tans=`sh -c 'uuname -l' 2>&1` ; then
8419                 myhostname=$tans
8420                 phostname='uuname -l'
8421         else
8422                 echo 'Strange.  Maybe "uname -n" will work...'
8423                 if tans=`sh -c 'uname -n' 2>&1` ; then
8424                         myhostname=$tans
8425                         phostname='uname -n'
8426                 else
8427                         echo 'Oh well, maybe I can mine it out of whoami.h...'
8428                         if tans=`sh -c $contains' sysname $usrinc/whoami.h' 2>&1` ; then
8429                                 myhostname=`echo "$tans" | $sed 's/^.*"\(.*\)"/\1/'`
8430                                 phostname="sed -n -e '"'/sysname/s/^.*\"\\(.*\\)\"/\1/{'"' -e p -e q -e '}' <$usrinc/whoami.h"
8431                         else
8432                                 case "$myhostname" in
8433                                 '') echo "Does this machine have an identity crisis or something?"
8434                                         phostname='';;
8435                                 *)
8436                                         echo "Well, you said $myhostname before..."
8437                                         phostname='echo $myhostname';;
8438                                 esac
8439                         fi
8440                 fi
8441         fi
8442 fi
8443 case "$myhostname" in
8444 '') myhostname=noname ;;
8445 esac
8446 : you do not want to know about this
8447 set $myhostname
8448 myhostname=$1
8449
8450 : verify guess
8451 if $test "$myhostname" ; then
8452         dflt=y
8453         rp='Your host name appears to be "'$myhostname'".'" Right?"
8454         . ./myread
8455         case "$ans" in
8456         y*) ;;
8457         *) myhostname='';;
8458         esac
8459 fi
8460
8461 : bad guess or no guess
8462 while $test "X$myhostname" = X ; do
8463         dflt=''
8464         rp="Please type the (one word) name of your host:"
8465         . ./myread
8466         myhostname="$ans"
8467 done
8468
8469 : translate upper to lower if necessary
8470 case "$myhostname" in
8471 *[A-Z]*)
8472         echo "(Normalizing case in your host name)"
8473         myhostname=`echo $myhostname | ./tr '[A-Z]' '[a-z]'`
8474         ;;
8475 esac
8476
8477 case "$myhostname" in
8478 *.*)
8479         dflt=`expr "X$myhostname" : "X[^.]*\(\..*\)"`
8480         myhostname=`expr "X$myhostname" : "X\([^.]*\)\."`
8481         echo "(Trimming domain name from host name--host name is now $myhostname)"
8482         ;;
8483 *) case "$mydomain" in
8484         '')
8485                 {
8486                         test "X$hostcat" = "Xypcat hosts" &&
8487                         ypmatch "$myhostname" hosts 2>/dev/null |\
8488                                 $sed -e 's/[     ]*#.*//; s/$/ /' > hosts && \
8489                         $test -s hosts
8490                 } || {
8491                         test "X$hostcat" != "X" &&
8492                         $hostcat | $sed -n -e "s/[       ]*#.*//; s/\$/ /
8493                                         /[       ]$myhostname[  . ]/p" > hosts
8494                 }
8495                 tmp_re="[       . ]"
8496                 if $test -f hosts; then
8497                         $test x`$awk "/[0-9].*[  ]$myhostname$tmp_re/ { sum++ }
8498                              END { print sum }" hosts` = x1 || tmp_re="[         ]"
8499                         dflt=.`$awk "/[0-9].*[   ]$myhostname$tmp_re/ {for(i=2; i<=NF;i++) print \\\$i}" \
8500                                 hosts | $sort | $uniq | \
8501                                 $sed -n -e "s/$myhostname\.\([-a-zA-Z0-9_.]\)/\1/p"`
8502                         case `$echo X$dflt` in
8503                         X*\ *)  echo "(Several hosts in the database matched hostname)"
8504                                 dflt=.
8505                                 ;;
8506                         X.) echo "(You do not have fully-qualified names in the hosts database)"
8507                                 ;;
8508                         esac
8509                 else
8510                         echo "(I cannot locate a hosts database anywhere)"
8511                         dflt=.
8512                 fi
8513                 case "$dflt" in
8514                 .)
8515                         tans=`./loc resolv.conf X /etc /usr/etc`
8516                         if $test -f "$tans"; then
8517                                 echo "(Attempting domain name extraction from $tans)"
8518                                 dflt=.`$sed -n -e 's/   / /g' \
8519                                   -e 's/^search  *\([^ ]*\).*/\1/p' $tans \
8520                                   | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8521                                 case "$dflt" in
8522                                 .) dflt=.`$sed -n -e 's/        / /g' \
8523                                      -e 's/^domain  *\([^ ]*\).*/\1/p' $tans \
8524                                      | ./tr '[A-Z]' '[a-z]' 2>/dev/null`
8525                                         ;;
8526                                 esac
8527                         fi
8528                         ;;
8529                 esac
8530                 case "$dflt" in
8531                 .) echo "(No help from resolv.conf either -- attempting clever guess)"
8532                         dflt=.`sh -c domainname 2>/dev/null`
8533                         case "$dflt" in
8534                         '') dflt='.';;
8535                         .nis.*|.yp.*|.main.*) dflt=`echo $dflt | $sed -e 's/^\.[^.]*//'`;;
8536                         esac
8537                         ;;
8538                 esac
8539                 case "$dflt$osname" in
8540                 .os390) echo "(Attempting domain name extraction from //'SYS1.TCPPARMS(TCPDATA)')"
8541                         dflt=.`awk '/^DOMAINORIGIN/ {print $2}' "//'SYS1.TCPPARMS(TCPDATA)'" 2>/dev/null`
8542                         ;;
8543                 esac
8544                 case "$dflt" in
8545                 .) echo "(Lost all hope -- silly guess then)"
8546                         dflt='.nonet'
8547                         ;;
8548                 esac
8549                 $rm -f hosts
8550                 ;;
8551         *) dflt="$mydomain";;
8552         esac;;
8553 esac
8554 echo " "
8555 rp="What is your domain name?"
8556 . ./myread
8557 tans="$ans"
8558 case "$ans" in
8559 '') ;;
8560 .*) ;;
8561 *) tans=".$tans";;
8562 esac
8563 mydomain="$tans"
8564
8565 : translate upper to lower if necessary
8566 case "$mydomain" in
8567 *[A-Z]*)
8568         echo "(Normalizing case in your domain name)"
8569         mydomain=`echo $mydomain | ./tr '[A-Z]' '[a-z]'`
8570         ;;
8571 esac
8572
8573 : a little sanity check here
8574 case "$phostname" in
8575 '') ;;
8576 *)
8577         case `$phostname | ./tr '[A-Z]' '[a-z]'` in
8578         $myhostname$mydomain|$myhostname) ;;
8579         *)
8580                 case "$phostname" in
8581                 sed*)
8582                         echo "(That doesn't agree with your whoami.h file, by the way.)"
8583                         ;;
8584                 *)
8585                         echo "(That doesn't agree with your $phostname command, by the way.)"
8586                         ;;
8587                 esac
8588         ;;
8589         esac
8590         ;;
8591 esac
8592
8593 $cat <<EOM
8594
8595 I need to get your e-mail address in Internet format if possible, i.e.
8596 something like user@host.domain. Please answer accurately since I have
8597 no easy means to double check it. The default value provided below
8598 is most probably close to reality but may not be valid from outside
8599 your organization...
8600
8601 EOM
8602 cont=x
8603 while test "$cont"; do
8604         case "$cf_email" in
8605         '') dflt="$cf_by@$myhostname$mydomain";;
8606         *) dflt="$cf_email";;
8607         esac
8608         rp='What is your e-mail address?'
8609         . ./myread
8610         cf_email="$ans"
8611         case "$cf_email" in
8612         *@*.*) cont='' ;;
8613         *)
8614                 rp='Address does not look like an Internet one.  Use it anyway?'
8615                 case "$fastread" in
8616                 yes) dflt=y ;;
8617                 *) dflt=n ;;
8618                 esac
8619                 . ./myread
8620                 case "$ans" in
8621                 y*) cont='' ;;
8622                 *) echo " " ;;
8623                 esac
8624                 ;;
8625         esac
8626 done
8627
8628 $cat <<EOM
8629
8630 If you or somebody else will be maintaining perl at your site, please
8631 fill in the correct e-mail address here so that they may be contacted
8632 if necessary. Currently, the "perlbug" program included with perl
8633 will send mail to this address in addition to perlbug@perl.org. You may
8634 enter "none" for no administrator.
8635
8636 EOM
8637 case "$perladmin" in
8638 '') dflt="$cf_email";;
8639 *) dflt="$perladmin";;
8640 esac
8641 rp='Perl administrator e-mail address'
8642 . ./myread
8643 perladmin="$ans"
8644
8645 : determine whether to only install version-specific parts.
8646 echo " "
8647 $cat <<EOM
8648 Do you want to install only the version-specific parts of the perl
8649 distribution?  Usually you do *not* want to do this.
8650 EOM
8651 case "$versiononly" in
8652 "$define"|[Yy]*|true) dflt='y' ;;
8653 *) dflt='n';
8654 esac
8655 rp="Do you want to install only the version-specific parts of perl?"
8656 . ./myread
8657 case "$ans" in
8658 [yY]*)  val="$define";;
8659 *)      val="$undef" ;;
8660 esac
8661 set versiononly
8662 eval $setvar
8663
8664 case "$versiononly" in
8665 "$define") inc_version_list=''
8666            inc_version_list_init=0
8667            ;;
8668 esac
8669
8670 : figure out how to guarantee perl startup
8671 : XXX Note that this currently takes advantage of the bug that binexp ignores
8672 :     the Configure -Dinstallprefix setting, which in turn means that under
8673 :     relocatable @INC, initialinstalllocation is what binexp started as.
8674 case "$startperl" in
8675 '')
8676         case "$sharpbang" in
8677         *!)
8678                 $cat <<EOH
8679
8680 I can use the #! construct to start perl on your system. This will
8681 make startup of perl scripts faster, but may cause problems if you
8682 want to share those scripts and perl is not in a standard place
8683 ($initialinstalllocation/perl) on all your platforms. The alternative
8684 is to force a shell by starting the script with a single ':' character.
8685
8686 EOH
8687                 case "$versiononly" in
8688                 "$define")      dflt="$initialinstalllocation/perl$version";;
8689                 *)              dflt="$initialinstalllocation/perl";;
8690                 esac
8691                 rp='What shall I put after the #! to start up perl ("none" to not use #!)?'
8692                 . ./myread
8693                 case "$ans" in
8694                 none)   startperl=": # use perl";;
8695                 *)      startperl="#!$ans"
8696                         if $test 30 -lt `echo "$ans" | wc -c`; then
8697                                 $cat >&4 <<EOM
8698
8699 WARNING:  Some systems limit the #! command to 32 characters.
8700 If you experience difficulty running Perl scripts with #!, try
8701 installing Perl in a directory with a shorter pathname.
8702
8703 EOM
8704                         fi ;;
8705                 esac
8706                 ;;
8707         *) startperl=": # use perl"
8708                 ;;
8709         esac
8710         ;;
8711 esac
8712 echo "I'll use $startperl to start perl scripts."
8713
8714 : figure best path for perl in scripts
8715 case "$perlpath" in
8716 '')
8717         case "$versiononly" in
8718         "$define")      perlpath="$initialinstalllocation/perl$version";;
8719         *)              perlpath="$initialinstalllocation/perl";;
8720         esac
8721         case "$startperl" in
8722         *!*) ;;
8723         *)
8724                 $cat <<EOH
8725
8726 I will use the "eval 'exec'" idiom to start Perl on your system.
8727 I can use the full path of your Perl binary for this purpose, but
8728 doing so may cause problems if you want to share those scripts and
8729 Perl is not always in a standard place ($initialinstalllocation/perl).
8730
8731 EOH
8732                 dflt="$initialinstalllocation/perl"
8733                 rp="What path shall I use in \"eval 'exec'\"?"
8734                 . ./myread
8735                 perlpath="$ans"
8736                 ;;
8737         esac
8738         ;;
8739 esac
8740 case "$startperl" in
8741 *!*)    ;;
8742 *)      echo "I'll use $perlpath in \"eval 'exec'\"" ;;
8743 esac
8744
8745 : determine where public executable scripts go
8746 set scriptdir scriptdir
8747 eval $prefixit
8748 case "$scriptdir" in
8749 '')
8750         dflt="$bin"
8751         : guess some guesses
8752         $test -d /usr/share/scripts && dflt=/usr/share/scripts
8753         $test -d /usr/share/bin     && dflt=/usr/share/bin
8754         $test -d /usr/local/script  && dflt=/usr/local/script
8755         $test -d /usr/local/scripts && dflt=/usr/local/scripts
8756         $test -d $prefixexp/script  && dflt=$prefixexp/script
8757         set dflt
8758         eval $prefixup
8759         ;;
8760 *)  dflt="$scriptdir"
8761         ;;
8762 esac
8763 $cat <<EOM
8764
8765 Some installations have a separate directory just for executable scripts so
8766 that they can mount it across multiple architectures but keep the scripts in
8767 one spot.  You might, for example, have a subdirectory of /usr/share for this.
8768 Or you might just lump your scripts in with all your other executables.
8769
8770 EOM
8771 fn=d~
8772 rp='Where do you keep publicly executable scripts?'
8773 . ./getfile
8774 if $test "X$ansexp" != "X$scriptdirexp"; then
8775         installscript=''
8776 fi
8777 installscriptdir=''
8778 prefixvar=scriptdir
8779 . ./setprefixvar
8780 : A little fix up for an irregularly named variable.
8781 installscript="$installscriptdir"
8782
8783 : determine where add-on public executables go
8784 case "$sitebin" in
8785 '')     dflt=$siteprefix/bin ;;
8786 *)      dflt=$sitebin ;;
8787 esac
8788 fn=d~
8789 rp='Pathname where the add-on public executables should be installed?'
8790 . ./getfile
8791 prefixvar=sitebin
8792 . ./setprefixvar
8793
8794 : determine where add-on html pages go
8795 : There is no standard location, so try to copy the previously-selected
8796 : directory structure for the core html pages.
8797 case "$sitehtml1dir" in
8798 '')    dflt=`echo "$html1dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8799 *)     dflt=$sitehtml1dir ;;
8800 esac
8801 case "$dflt" in
8802 ''|' ') dflt=none ;;
8803 esac
8804 fn=dn+~
8805 rp='Pathname where the site-specific html pages should be installed?'
8806 . ./getfile
8807 prefixvar=sitehtml1dir
8808 . ./setprefixvar
8809
8810 : determine where add-on library html pages go
8811 : There is no standard location, so try to copy the previously-selected
8812 : directory structure for the core html pages.
8813 case "$sitehtml3dir" in
8814 '')    dflt=`echo "$html3dir" | $sed "s#^$prefix#$siteprefix#"` ;;
8815 *)     dflt=$sitehtml3dir ;;
8816 esac
8817 case "$dflt" in
8818 ''|' ') dflt=none ;;
8819 esac
8820 fn=dn+~
8821 rp='Pathname where the site-specific library html pages should be installed?'
8822 . ./getfile
8823 prefixvar=sitehtml3dir
8824 . ./setprefixvar
8825
8826 : determine where add-on manual pages go
8827 case "$siteman1dir" in
8828 '')     dflt=`echo $man1dir | $sed "s#^$prefix#$siteprefix#"` ;;
8829 *)      dflt=$siteman1dir ;;
8830 esac
8831 case "$dflt" in
8832 ''|' ') dflt=none ;;
8833 esac
8834 fn=dn+~
8835 rp='Pathname where the site-specific manual pages should be installed?'
8836 . ./getfile
8837 prefixvar=siteman1dir
8838 . ./setprefixvar
8839
8840 : determine where add-on library man pages go
8841 case "$siteman3dir" in
8842 '')     dflt=`echo $man3dir | $sed "s#^$prefix#$siteprefix#"` ;;
8843 *)      dflt=$siteman3dir ;;
8844 esac
8845 case "$dflt" in
8846 ''|' ') dflt=none ;;
8847 esac
8848 fn=dn+~
8849 rp='Pathname where the site-specific library manual pages should be installed?'
8850 . ./getfile
8851 prefixvar=siteman3dir
8852 . ./setprefixvar
8853
8854 : determine where add-on public executable scripts go
8855 case "$sitescript" in
8856 '')     dflt=$siteprefix/script
8857         $test -d $dflt || dflt=$sitebin ;;
8858 *)  dflt="$sitescript" ;;
8859 esac
8860 fn=d~+
8861 rp='Pathname where add-on public executable scripts should be installed?'
8862 . ./getfile
8863 prefixvar=sitescript
8864 . ./setprefixvar
8865
8866 case "$usefaststdio" in
8867 $define|true|[yY]*|'')
8868         xversion=`awk '/define[         ]+PERL_VERSION/ {print $3}' $rsrc/patchlevel.h`
8869         case "$xversion" in
8870         [68])   dflt='y' ;;
8871         *)      dflt='n' ;;
8872         esac
8873         ;;
8874 *) dflt='n';;
8875 esac
8876 cat <<EOM
8877
8878 Perl can be built to use 'fast stdio', which means using the stdio
8879 library but also directly manipulating the stdio buffers to enable
8880 faster I/O.  Using stdio is better for backward compatibility (especially
8881 for Perl extensions), but on the other hand since Perl 5.8 the 'perlio'
8882 interface has been preferred instead of stdio.
8883
8884 If this doesn't make any sense to you, just accept the default '$dflt'.
8885 EOM
8886 rp='Use the "fast stdio" if available?'
8887 . ./myread
8888 case "$ans" in
8889 y|Y)    val="$define" ;;     
8890 *)      val="$undef" ;;
8891 esac
8892 set usefaststdio
8893 eval $setvar
8894
8895
8896 : define an is-a-typedef? function
8897 typedef='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8898 case "$inclist" in
8899 "") inclist="sys/types.h";;
8900 esac;
8901 eval "varval=\$$var";
8902 case "$varval" in
8903 "")
8904         $rm -f temp.c;
8905         for inc in $inclist; do
8906                 echo "#include <$inc>" >>temp.c;
8907         done;
8908         echo "#ifdef $type" >> temp.c;
8909         echo "printf(\"We have $type\");" >> temp.c;
8910         echo "#endif" >> temp.c;
8911         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8912         if $contains $type temp.E >/dev/null 2>&1; then
8913                 eval "$var=\$type";
8914         else
8915                 eval "$var=\$def";
8916         fi;
8917         $rm -f temp.?;;
8918 *) eval "$var=\$varval";;
8919 esac'
8920
8921 : define an is-a-typedef? function that prompts if the type is not available.
8922 typedef_ask='type=$1; var=$2; def=$3; shift; shift; shift; inclist=$@;
8923 case "$inclist" in
8924 "") inclist="sys/types.h";;
8925 esac;
8926 eval "varval=\$$var";
8927 case "$varval" in
8928 "")
8929         $rm -f temp.c;
8930         for inc in $inclist; do
8931                 echo "#include <$inc>" >>temp.c;
8932         done;
8933         echo "#ifdef $type" >> temp.c;
8934         echo "printf(\"We have $type\");" >> temp.c;
8935         echo "#endif" >> temp.c;
8936         $cppstdin $cppflags $cppminus < temp.c >temp.E 2>/dev/null;
8937         echo " " ;
8938         echo "$rp" | $sed -e "s/What is/Looking for/" -e "s/?/./";
8939         if $contains $type temp.E >/dev/null 2>&1; then
8940                 echo "$type found." >&4;
8941                 eval "$var=\$type";
8942         else
8943                 echo "$type NOT found." >&4;
8944                 dflt="$def";
8945                 . ./myread ;
8946                 eval "$var=\$ans";
8947         fi;
8948         $rm -f temp.?;;
8949 *) eval "$var=\$varval";;
8950 esac'
8951
8952 : see what type lseek is declared as in the kernel
8953 rp="What is the type used for lseek's offset on this system?"
8954 set off_t lseektype long stdio.h sys/types.h
8955 eval $typedef_ask
8956
8957 echo " "
8958 echo "Checking to see how big your file offsets are..." >&4
8959 $cat >try.c <<EOCP
8960 #include <sys/types.h>
8961 #include <stdio.h>
8962 int main()
8963 {
8964     printf("%d\n", (int)sizeof($lseektype));
8965     return(0); 
8966 }
8967 EOCP
8968 set try
8969 if eval $compile_ok; then
8970         lseeksize=`$run ./try`
8971         echo "Your file offsets are $lseeksize bytes long."
8972 else
8973         dflt=$longsize
8974         echo " "
8975         echo "(I can't seem to compile the test program.  Guessing...)"
8976         rp="What is the size of your file offsets (in bytes)?"
8977         . ./myread
8978         lseeksize="$ans"
8979 fi
8980 $rm -f try.c try
8981
8982 : see what type file positions are declared as in the library
8983 rp="What is the type for file position used by fsetpos()?"
8984 set fpos_t fpostype long stdio.h sys/types.h
8985 eval $typedef_ask
8986
8987 echo " "
8988 case "$fpostype" in
8989 *_t) zzz="$fpostype"    ;;
8990 *)   zzz="fpos_t"       ;;
8991 esac
8992 echo "Checking the size of $zzz..." >&4 
8993 cat > try.c <<EOCP
8994 #include <sys/types.h>
8995 #include <stdio.h>
8996 #$i_stdlib I_STDLIB
8997 #ifdef I_STDLIB
8998 #include <stdlib.h>
8999 #endif
9000 int main() {
9001     printf("%d\n", (int)sizeof($fpostype));
9002     exit(0);
9003 }
9004 EOCP
9005 set try
9006 if eval $compile_ok; then
9007         yyy=`$run ./try`
9008         case "$yyy" in
9009         '')     fpossize=4
9010                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9011                 ;;
9012         *)      fpossize=$yyy
9013                 echo "Your $zzz is $fpossize bytes long."
9014                 ;;
9015         esac
9016 else
9017         dflt="$longsize"
9018         echo " " >&4
9019         echo "(I can't compile the test program.  Guessing...)" >&4
9020         rp="What is the size of your file positions (in bytes)?"
9021         . ./myread
9022         fpossize="$ans"
9023 fi
9024
9025 # Backward compatibility (uselfs is deprecated).
9026 case "$uselfs" in
9027 "$define"|true|[yY]*)
9028         cat <<EOM >&4
9029
9030 *** Configure -Duselfs is deprecated, using -Duselargefiles instead.
9031 EOM
9032         uselargefiles="$define"
9033         ;;
9034 esac                          
9035
9036 case "$lseeksize:$fpossize" in
9037 8:8) cat <<EOM
9038
9039 You can have files larger than 2 gigabytes.
9040 EOM
9041    val="$define" ;;
9042 *)    case "$uselargefiles" in
9043    "$undef"|false|[nN]*) dflt='n' ;;
9044    *)   dflt='y' ;;
9045    esac
9046    cat <<EOM
9047
9048 Perl can be built to understand large files (files larger than 2 gigabytes)
9049 on some systems.  To do so, Configure can be run with -Duselargefiles.
9050
9051 If this doesn't make any sense to you, just accept the default '$dflt'.
9052 EOM
9053    rp='Try to understand large files, if available?'
9054    . ./myread
9055    case "$ans" in
9056    y|Y)         val="$define" ;;
9057    *)           val="$undef"  ;;
9058    esac
9059    ;;
9060 esac
9061 set uselargefiles
9062 eval $setvar
9063 : Look for a hint-file generated 'call-back-unit'.  If the
9064 : user has specified that a large files perl is to be built,
9065 : we may need to set or change some other defaults.
9066 if $test -f uselargefiles.cbu; then
9067         echo "Your platform has some specific hints regarding large file builds, using them..."
9068         . ./uselargefiles.cbu
9069 fi
9070 case "$uselargefiles" in
9071 "$define")
9072         if $test -f uselargefiles.cbu; then
9073                 echo " "
9074                 echo "Rechecking to see how big your file offsets are..." >&4
9075                 $cat >try.c <<EOCP
9076 #include <sys/types.h>
9077 #include <stdio.h>
9078 int main()
9079 {
9080     printf("%d\n", (int)sizeof($lseektype));
9081     return(0); 
9082 }
9083 EOCP
9084                 set try
9085                 if eval $compile_ok; then
9086                         lseeksize=`$run ./try`
9087                         $echo "Your file offsets are now $lseeksize bytes long."
9088                 else
9089                         dflt="$lseeksize"
9090                         echo " "
9091                         echo "(I can't seem to compile the test program.  Guessing...)"
9092                         rp="What is the size of your file offsets (in bytes)?"
9093                         . ./myread
9094                         lseeksize="$ans"
9095                 fi
9096                 case "$fpostype" in
9097                 *_t) zzz="$fpostype"    ;;
9098                 *)   zzz="fpos_t"       ;;
9099                 esac
9100                 $echo $n "Rechecking the size of $zzz...$c" >&4 
9101                 $cat > try.c <<EOCP
9102 #include <sys/types.h>
9103 #include <stdio.h>
9104 #$i_stdlib I_STDLIB
9105 #ifdef I_STDLIB
9106 #include <stdlib.h>
9107 #endif
9108 int main() {
9109     printf("%d\n", (int)sizeof($fpostype));
9110     return(0);
9111 }
9112 EOCP
9113                 set try
9114                 if eval $compile_ok; then
9115                         yyy=`$run ./try`
9116                         dflt="$lseeksize"
9117                         case "$yyy" in
9118                         '')     echo " "
9119                                 echo "(I can't execute the test program--guessing $fpossize.)" >&4
9120                                 ;;
9121                         *)      fpossize=$yyy
9122                                 echo " $fpossize bytes." >&4
9123                                 ;;
9124                         esac
9125                 else
9126                         dflt="$fpossize"
9127                         echo " "
9128                         echo "(I can't compile the test program.  Guessing...)" >&4
9129                         rp="What is the size of your file positions (in bytes)?"
9130                         . ./myread
9131                         fpossize="$ans"
9132                 fi
9133                 $rm -f try.c try
9134         fi
9135         ;;
9136 esac
9137
9138 case "$vendorprefix" in
9139 '')     d_vendorbin="$undef"
9140         vendorbin=''
9141         vendorbinexp=''
9142         ;;
9143 *)      d_vendorbin="$define"
9144         : determine where vendor-supplied executables go.
9145         case "$vendorbin" in
9146         '') dflt=$vendorprefix/bin ;;
9147         *)      dflt="$vendorbin" ;;
9148         esac
9149         fn=d~+
9150         rp='Pathname for the vendor-supplied executables directory?'
9151         . ./getfile
9152         vendorbin="$ans"
9153         vendorbinexp="$ansexp"
9154         ;;
9155 esac
9156 prefixvar=vendorbin
9157 . ./installprefix
9158
9159 case "$vendorprefix" in
9160 '')     vendorhtml1dir=''
9161         vendorhtml1direxp=''
9162         ;;
9163 *)      : determine where vendor-supplied html pages go.
9164         : There is no standard location, so try to copy the previously-selected
9165         : directory structure for the core html pages.
9166         : XXX Better default suggestions would be welcome.
9167         case "$vendorhtml1dir" in
9168         '')     dflt=`echo "$html1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9169         *)      dflt=$vendorhtml1dir ;;
9170         esac
9171         case "$dflt" in
9172         ''|' ') dflt=none ;;
9173         esac
9174         fn=dn+~
9175         rp='Pathname for the vendor-supplied html pages?'
9176         . ./getfile
9177         vendorhtml1dir="$ans"
9178         vendorhtml1direxp="$ansexp"
9179         ;;
9180 esac
9181 : Use ' ' for none so value is preserved next time through Configure
9182 $test X"$vendorhtml1dir" = "X" && vendorhtml1dir=' '
9183 prefixvar=vendorhtml1dir
9184 . ./installprefix
9185
9186 case "$vendorprefix" in
9187 '')     vendorhtml3dir=''
9188         vendorhtml3direxp=''
9189         ;;
9190 *)      : determine where vendor-supplied module html pages go.
9191         : There is no standard location, so try to copy the previously-selected
9192         : directory structure for the core html pages.
9193         : XXX Better default suggestions would be welcome.
9194         case "$vendorhtml3dir" in
9195         '')     dflt=`echo "$html3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9196         *)      dflt=$vendorhtml3dir ;;
9197         esac
9198         case "$dflt" in
9199         ''|' ') dflt=none ;;
9200         esac
9201         fn=dn+~
9202         rp='Pathname for the vendor-supplied html pages?'
9203         . ./getfile
9204         vendorhtml3dir="$ans"
9205         vendorhtml3direxp="$ansexp"
9206         ;;
9207 esac
9208 : Use ' ' for none so value is preserved next time through Configure
9209 $test X"$vendorhtml3dir" = "X" && vendorhtml3dir=' '
9210 prefixvar=vendorhtml3dir
9211 . ./installprefix
9212
9213 case "$vendorprefix" in
9214 '')     vendorman1dir=''
9215         vendorman1direxp=''
9216         ;;
9217 *)      : determine where vendor-supplied manual pages go.
9218         case "$vendorman1dir" in
9219         '') dflt=`echo "$man1dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9220         *)      dflt=$vendorman1dir ;;
9221         esac
9222         case "$dflt" in
9223         ''|' ') dflt=none ;;
9224         esac
9225         fn=nd~+
9226         rp='Pathname for the vendor-supplied manual section 1 pages?'
9227         . ./getfile
9228         vendorman1dir="$ans"
9229         vendorman1direxp="$ansexp"
9230         ;;
9231 esac
9232 : Use ' ' for none so value is preserved next time through Configure
9233 $test X"$vendorman1dir" = "X" && vendorman1dir=' '
9234 prefixvar=vendorman1dir
9235 . ./installprefix
9236
9237 case "$vendorprefix" in
9238 '')     vendorman3dir=''
9239         vendorman3direxp=''
9240         ;;
9241 *)      : determine where vendor-supplied module manual pages go.
9242         case "$vendorman3dir" in
9243         '') dflt=`echo "$man3dir" | $sed "s#^$prefix#$vendorprefix#"` ;;
9244         *)      dflt=$vendorman3dir ;;
9245         esac
9246         case "$dflt" in
9247         ''|' ') dflt=none ;;
9248         esac
9249         fn=nd~+
9250         rp='Pathname for the vendor-supplied manual section 3 pages?'
9251         . ./getfile
9252         vendorman3dir="$ans"
9253         vendorman3direxp="$ansexp"
9254         ;;
9255 esac
9256 : Use ' ' for none so value is preserved next time through Configure
9257 $test X"$vendorman3dir" = "X" && vendorman3dir=' '
9258 prefixvar=vendorman3dir
9259 . ./installprefix
9260
9261 case "$vendorprefix" in
9262 '')     d_vendorscript="$undef"
9263         vendorscript=''
9264         vendorscriptexp=''
9265         ;;
9266 *)      d_vendorscript="$define"
9267         : determine where vendor-supplied scripts go.
9268         case "$vendorscript" in
9269         '')     dflt=$vendorprefix/script
9270                 $test -d $dflt || dflt=$vendorbin ;;
9271         *)  dflt="$vendorscript" ;;
9272         esac
9273         $cat <<EOM
9274
9275 The installation process will create a directory for
9276 vendor-supplied scripts.
9277
9278 EOM
9279         fn=d~+
9280         rp='Pathname for the vendor-supplied scripts directory?'
9281         . ./getfile
9282         vendorscript="$ans"
9283         vendorscriptexp="$ansexp"
9284         ;;
9285 esac
9286 prefixvar=vendorscript
9287 . ./installprefix
9288
9289 : see if qgcvt exists
9290 set qgcvt d_qgcvt
9291 eval $inlibc
9292
9293 echo " "
9294
9295 if $test X"$d_longdbl" = X"$define"; then
9296
9297 echo "Checking how to print long doubles..." >&4
9298
9299 if $test X"$sPRIfldbl" = X -a X"$doublesize" = X"$longdblsize"; then
9300         $cat >try.c <<'EOCP'
9301 #include <sys/types.h>
9302 #include <stdio.h>
9303 int main() {
9304   double d = 123.456;
9305   printf("%.3f\n", d);
9306 }
9307 EOCP
9308         set try
9309         if eval $compile; then
9310                 yyy=`$run ./try`
9311                 case "$yyy" in
9312                 123.456)
9313                         sPRIfldbl='"f"'; sPRIgldbl='"g"'; sPRIeldbl='"e"';
9314                         sPRIFUldbl='"F"'; sPRIGUldbl='"G"'; sPRIEUldbl='"E"';
9315                         echo "We will use %f."
9316                         ;;
9317                 esac
9318         fi
9319 fi
9320
9321 if $test X"$sPRIfldbl" = X; then
9322         $cat >try.c <<'EOCP'
9323 #include <sys/types.h>
9324 #include <stdio.h>
9325 int main() {
9326   long double d = 123.456;
9327   printf("%.3Lf\n", d);
9328 }
9329 EOCP
9330         set try
9331         if eval $compile; then
9332                 yyy=`$run ./try`
9333                 case "$yyy" in
9334                 123.456)
9335                         sPRIfldbl='"Lf"'; sPRIgldbl='"Lg"'; sPRIeldbl='"Le"';
9336                         sPRIFUldbl='"LF"'; sPRIGUldbl='"LG"'; sPRIEUldbl='"LE"';
9337                         echo "We will use %Lf."
9338                         ;;
9339                 esac
9340         fi
9341 fi
9342
9343 if $test X"$sPRIfldbl" = X; then
9344         $cat >try.c <<'EOCP'
9345 #include <sys/types.h>
9346 #include <stdio.h>
9347 int main() {
9348   long double d = 123.456;
9349   printf("%.3llf\n", d);
9350 }
9351 EOCP
9352         set try
9353         if eval $compile; then
9354                 yyy=`$run ./try`
9355                 case "$yyy" in
9356                 123.456)
9357                         sPRIfldbl='"llf"'; sPRIgldbl='"llg"'; sPRIeldbl='"lle"';
9358                         sPRIFUldbl='"llF"'; sPRIGUldbl='"llG"'; sPRIEUldbl='"llE"';
9359                         echo "We will use %llf."
9360                         ;;
9361                 esac
9362         fi
9363 fi
9364
9365 if $test X"$sPRIfldbl" = X; then
9366         $cat >try.c <<'EOCP'
9367 #include <sys/types.h>
9368 #include <stdio.h>
9369 int main() {
9370   long double d = 123.456;
9371   printf("%.3lf\n", d);
9372 }
9373 EOCP
9374         set try
9375         if eval $compile; then
9376                 yyy=`$run ./try`
9377                 case "$yyy" in
9378                 123.456)
9379                         sPRIfldbl='"lf"'; sPRIgldbl='"lg"'; sPRIeldbl='"le"';
9380                         sPRIFUldbl='"lF"'; sPRIGUldbl='"lG"'; sPRIEUldbl='"lE"';
9381                         echo "We will use %lf."
9382                         ;;
9383                 esac
9384         fi
9385 fi
9386
9387 if $test X"$sPRIfldbl" = X; then
9388         echo "Cannot figure out how to print long doubles." >&4
9389 else
9390         sSCNfldbl=$sPRIfldbl    # expect consistency
9391 fi
9392
9393 $rm -f try try.*
9394
9395 fi # d_longdbl
9396
9397 case "$sPRIfldbl" in
9398 '')     d_PRIfldbl="$undef"; d_PRIgldbl="$undef"; d_PRIeldbl="$undef"; 
9399         d_PRIFUldbl="$undef"; d_PRIGUldbl="$undef"; d_PRIEUldbl="$undef"; 
9400         d_SCNfldbl="$undef";
9401         ;;
9402 *)      d_PRIfldbl="$define"; d_PRIgldbl="$define"; d_PRIeldbl="$define"; 
9403         d_PRIFUldbl="$define"; d_PRIGUldbl="$define"; d_PRIEUldbl="$define"; 
9404         d_SCNfldbl="$define";
9405         ;;
9406 esac
9407
9408 : Check how to convert floats to strings.
9409
9410 if test "X$d_Gconvert" = X; then
9411
9412 echo " "
9413 echo "Checking for an efficient way to convert floats to strings."
9414 echo " " > try.c
9415 case "$uselongdouble" in
9416 "$define") echo "#define USE_LONG_DOUBLE" >>try.c ;;
9417 esac
9418 case "$d_longdbl" in
9419 "$define") echo "#define HAS_LONG_DOUBLE" >>try.c ;;
9420 esac
9421 case "$d_PRIgldbl" in
9422 "$define") echo "#define HAS_PRIgldbl"    >>try.c ;;
9423 esac
9424 $cat >>try.c <<EOP
9425 #ifdef TRY_gconvert
9426 #define Gconvert(x,n,t,b) gconvert((x),(n),(t),(b))
9427 char *myname = "gconvert";
9428 #endif
9429 #ifdef TRY_gcvt
9430 #define Gconvert(x,n,t,b) gcvt((x),(n),(b))
9431 char *myname = "gcvt";
9432 #endif
9433 #ifdef TRY_qgcvt
9434 #define Gconvert(x,n,t,b) qgcvt((x),(n),(b))
9435 char *myname = "qgcvt";
9436 #define DOUBLETYPE long double
9437 #endif
9438 #ifdef TRY_sprintf
9439 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9440 #ifdef HAS_PRIgldbl
9441 #define Gconvert(x,n,t,b) sprintf((b),"%.*"$sPRIgldbl,(n),(x))
9442 #else
9443 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(double)(x))
9444 #endif
9445 #else
9446 #define Gconvert(x,n,t,b) sprintf((b),"%.*g",(n),(x))
9447 #endif
9448 char *myname = "sprintf";
9449 #endif
9450
9451 #ifndef DOUBLETYPE
9452 #if defined(USE_LONG_DOUBLE) && defined(HAS_LONG_DOUBLE)
9453 #define DOUBLETYPE long double
9454 #else
9455 #define DOUBLETYPE double
9456 #endif
9457 #endif
9458
9459 #include <stdio.h>
9460
9461 #define I_STDLIB $i_stdlib
9462 #ifdef I_STDLIB
9463 #include <stdlib.h>
9464 #endif
9465
9466 int
9467 checkit(expect, got)
9468 char *expect;
9469 char *got;
9470 {
9471     if (strcmp(expect, got)) {
9472                 printf("%s oddity:  Expected %s, got %s\n",
9473                         myname, expect, got);
9474                 exit(1);
9475         }
9476 }
9477
9478 int main()
9479
9480         char buf[64]; 
9481         buf[63] = '\0';
9482
9483         /* This must be 1st test on (which?) platform */
9484         /* Alan Burlison <AlanBurlsin@unn.unisys.com> */
9485         Gconvert((DOUBLETYPE)0.1, 8, 0, buf);
9486         checkit("0.1", buf);
9487
9488         Gconvert((DOUBLETYPE)0.01, 8, 0, buf); 
9489         checkit("0.01", buf);
9490
9491         Gconvert((DOUBLETYPE)0.001, 8, 0, buf); 
9492         checkit("0.001", buf);
9493
9494         Gconvert((DOUBLETYPE)0.0001, 8, 0, buf); 
9495         checkit("0.0001", buf);
9496
9497         Gconvert((DOUBLETYPE)0.00009, 8, 0, buf);
9498         if (strlen(buf) > 5)
9499             checkit("9e-005", buf); /* for Microsoft ?? */
9500         else
9501             checkit("9e-05", buf);
9502
9503         Gconvert((DOUBLETYPE)1.0, 8, 0, buf); 
9504         checkit("1", buf);
9505
9506         Gconvert((DOUBLETYPE)1.1, 8, 0, buf); 
9507         checkit("1.1", buf);
9508
9509         Gconvert((DOUBLETYPE)1.01, 8, 0, buf); 
9510         checkit("1.01", buf);
9511
9512         Gconvert((DOUBLETYPE)1.001, 8, 0, buf); 
9513         checkit("1.001", buf);
9514
9515         Gconvert((DOUBLETYPE)1.0001, 8, 0, buf); 
9516         checkit("1.0001", buf);
9517
9518         Gconvert((DOUBLETYPE)1.00001, 8, 0, buf); 
9519         checkit("1.00001", buf);
9520
9521         Gconvert((DOUBLETYPE)1.000001, 8, 0, buf); 
9522         checkit("1.000001", buf);
9523
9524         Gconvert((DOUBLETYPE)0.0, 8, 0, buf); 
9525         checkit("0", buf);
9526
9527         Gconvert((DOUBLETYPE)-1.0, 8, 0, buf); 
9528         checkit("-1", buf);
9529
9530         /* Some Linux gcvt's give 1.e+5 here. */
9531         Gconvert((DOUBLETYPE)100000.0, 8, 0, buf); 
9532         checkit("100000", buf);
9533         
9534         /* Some Linux gcvt's give -1.e+5 here. */
9535         Gconvert((DOUBLETYPE)-100000.0, 8, 0, buf); 
9536         checkit("-100000", buf);
9537
9538         Gconvert((DOUBLETYPE)123.456, 8, 0, buf); 
9539         checkit("123.456", buf);
9540
9541         /* Testing of 1e+129 in bigintpm.t must not get extra '.' here. */
9542         Gconvert((DOUBLETYPE)1e34, 8, 0, buf);
9543         /* 34 should be enough to scare even long double
9544          * places into using the e notation. */
9545         if (strlen(buf) > 5)
9546             checkit("1e+034", buf); /* for Microsoft */
9547         else
9548             checkit("1e+34", buf);
9549
9550         /* For Perl, if you add additional tests here, also add them to
9551          * t/base/num.t for benefit of platforms not using Configure or
9552          * overriding d_Gconvert */
9553
9554         exit(0);
9555 }
9556 EOP
9557 : first add preferred functions to our list
9558 xxx_list=""
9559 for xxx_convert in $gconvert_preference; do
9560     case $xxx_convert in
9561     gcvt|gconvert|sprintf) xxx_list="$xxx_list $xxx_convert" ;;
9562     *) echo "Discarding unrecognized gconvert_preference $xxx_convert" >&4 ;;
9563     esac 
9564 done
9565 : then add any others
9566 for xxx_convert in gconvert gcvt sprintf; do
9567     case "$xxx_list" in
9568     *$xxx_convert*) ;;
9569     *) xxx_list="$xxx_list $xxx_convert" ;;
9570     esac 
9571 done
9572
9573 case "$d_longdbl$uselongdouble" in
9574 "$define$define")
9575     : again, add prefered functions to our list first
9576     xxx_ld_list=""
9577     for xxx_convert in $gconvert_ld_preference; do
9578         case $xxx_convert in
9579         qgcvt|gcvt|gconvert|sprintf) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9580         *) echo "Discarding unrecognized gconvert_ld_preference $xxx_convert" ;;
9581         esac
9582     done
9583     : then add qgcvt, sprintf--then, in xxx_list order, gconvert and gcvt
9584     for xxx_convert in qgcvt sprintf $xxx_list; do
9585         case "$xxx_ld_list" in
9586         $xxx_convert*|*" $xxx_convert"*) ;;
9587         *) xxx_ld_list="$xxx_ld_list $xxx_convert" ;;
9588         esac
9589     done
9590     : if sprintf cannot do long doubles, move it to the end
9591     if test "$d_PRIgldbl" != "$define"; then
9592         xxx_ld_list="`echo $xxx_ld_list|sed s/sprintf//` sprintf"
9593     fi
9594     : if no qgcvt, remove it
9595     if test "$d_qgcvt" != "$define"; then
9596         xxx_ld_list="`echo $xxx_ld_list|sed s/qgcvt//`"
9597     fi
9598     : use the ld_list
9599     xxx_list="$xxx_ld_list"
9600     ;;
9601 esac
9602
9603 for xxx_convert in $xxx_list; do
9604         echo "Trying $xxx_convert..."
9605         $rm -f try try$_o
9606         set try -DTRY_$xxx_convert
9607         if eval $compile; then
9608                 echo "$xxx_convert() found." >&4
9609                 if $run ./try; then
9610                         echo "I'll use $xxx_convert to convert floats into a string." >&4
9611                         break;
9612                 else
9613                         echo "...But $xxx_convert didn't work as I expected."
9614                         xxx_convert=''
9615                 fi
9616         else
9617                 echo "$xxx_convert NOT found." >&4
9618         fi
9619 done
9620
9621 if test X$xxx_convert = X; then
9622     echo "*** WHOA THERE!!! ***" >&4
9623     echo "None of ($xxx_list)  seemed to work properly.  I'll use sprintf." >&4
9624     xxx_convert=sprintf
9625 fi
9626
9627 case "$xxx_convert" in
9628 gconvert) d_Gconvert='gconvert((x),(n),(t),(b))' ;;
9629 gcvt) d_Gconvert='gcvt((x),(n),(b))' ;;
9630 qgcvt) d_Gconvert='qgcvt((x),(n),(b))' ;;
9631 *) case "$uselongdouble$d_longdbl$d_PRIgldbl" in
9632    "$define$define$define")
9633       d_Gconvert="sprintf((b),\"%.*\"$sPRIgldbl,(n),(x))" ;;
9634    "$define$define$undef")
9635       d_Gconvert='sprintf((b),"%.*g",(n),(double)(x))' ;;
9636    *) d_Gconvert='sprintf((b),"%.*g",(n),(x))' ;;
9637    esac
9638    ;;  
9639 esac
9640
9641 fi
9642
9643 : see if _fwalk exists
9644 set fwalk d__fwalk
9645 eval $inlibc
9646
9647 : Initialize h_fcntl
9648 h_fcntl=false
9649
9650 : Initialize h_sysfile
9651 h_sysfile=false
9652
9653 : access call always available on UNIX
9654 set access d_access
9655 eval $inlibc
9656
9657 : locate the flags for 'access()'
9658 case "$d_access" in
9659 "$define")
9660         echo " "
9661         $cat >access.c <<EOCP
9662 #include <sys/types.h>
9663 #ifdef I_FCNTL
9664 #include <fcntl.h>
9665 #endif
9666 #ifdef I_SYS_FILE
9667 #include <sys/file.h>
9668 #endif
9669 #ifdef I_UNISTD
9670 #include <unistd.h>
9671 #endif
9672 #$i_stdlib I_STDLIB
9673 #ifdef I_STDLIB
9674 #include <stdlib.h>
9675 #endif
9676 int main() {
9677         exit(R_OK);
9678 }
9679 EOCP
9680         : check sys/file.h first, no particular reason here
9681         if $test `./findhdr sys/file.h` && \
9682                 $cc -o access $cppflags -DI_SYS_FILE access.c >/dev/null 2>&1 ; then
9683                 h_sysfile=true;
9684                 echo "<sys/file.h> defines the *_OK access constants." >&4
9685         elif $test `./findhdr fcntl.h` && \
9686                 $cc -o access $cppflags -DI_FCNTL access.c >/dev/null 2>&1 ; then
9687                 h_fcntl=true;
9688                 echo "<fcntl.h> defines the *_OK access constants." >&4
9689         elif $test `./findhdr unistd.h` && \
9690                 $cc -o access $cppflags -DI_UNISTD access.c >/dev/null 2>&1 ; then
9691                 echo "<unistd.h> defines the *_OK access constants." >&4
9692         else
9693                 echo "I can't find the four *_OK access constants--I'll use mine." >&4
9694         fi
9695         ;;
9696 esac
9697 $rm -f access*
9698
9699 : see if accessx exists
9700 set accessx d_accessx
9701 eval $inlibc
9702
9703 : see if aintl exists
9704 set aintl d_aintl
9705 eval $inlibc
9706
9707 : see if alarm exists
9708 set alarm d_alarm
9709 eval $inlibc
9710
9711 : see if POSIX threads are available
9712 set pthread.h i_pthread
9713 eval $inhdr
9714
9715 : define a fucntion to check prototypes
9716 $cat > protochk <<EOSH
9717 $startsh
9718 cc="$cc"
9719 optimize="$optimize"
9720 ccflags="$ccflags"
9721 prototype="$prototype"
9722 define="$define"
9723 rm=$rm
9724 usethreads=$usethreads
9725 i_pthread=$i_pthread
9726 pthread_h_first=$pthread_h_first
9727 EOSH
9728
9729 $cat >> protochk <<'EOSH'
9730
9731 $rm -f try.c
9732 foo="$1"
9733 shift
9734 while test $# -ge 2; do
9735         case "$1" in
9736                 $define) echo "#include <$2>" >> try.c ;;
9737                 literal) echo "$2" >> try.c ;;
9738         esac
9739     # Extra magic for the benefit of systems that need pthread.h
9740     # to be included early to correctly detect threadsafe functions.
9741     # Such functions must guarantee themselves, though, that the usethreads
9742     # and i_pthread have been defined, before calling protochk.
9743     if test "$usethreads" = "$define" -a "$i_pthread" = "$define" -a "$pthread_h_first" = "$define" -a "$pthread_h_done" = ""; then
9744         echo "#include <pthread.h>" >> try.c
9745         pthread_h_done=yes
9746     fi
9747     shift 2
9748 done
9749 test "$prototype" = "$define"  && echo '#define CAN_PROTOTYPE' >> try.c
9750 cat >> try.c <<'EOCP'
9751 #ifdef CAN_PROTOTYPE
9752 #define _(args) args
9753 #else
9754 #define _(args) ()
9755 #endif
9756 EOCP
9757 echo "$foo" >> try.c
9758 echo 'int no_real_function_has_this_name _((void)) { return 0; }' >> try.c
9759 $cc $optimize $ccflags -c try.c > /dev/null 2>&1
9760 status=$?
9761 $rm -f try.[co]
9762 exit $status
9763 EOSH
9764 chmod +x protochk
9765 $eunicefix protochk
9766
9767 hasproto='varname=$1; func=$2; shift; shift;
9768 while $test $# -ge 2; do
9769         case "$1" in
9770         $define) echo "#include <$2>";;
9771         esac ;
9772     shift 2;
9773 done > try.c;
9774 $cppstdin $cppflags $cppminus < try.c > tryout.c 2>/dev/null;
9775 if $contains "$func.*(" tryout.c >/dev/null 2>&1; then
9776         echo "$func() prototype found.";
9777         val="$define";
9778 else
9779         echo "$func() prototype NOT found.";
9780         val="$undef";
9781 fi;
9782 set $varname;
9783 eval $setvar;
9784 $rm -f try.c tryout.c'
9785
9786 : see if sys/types.h has to be included
9787 set sys/types.h i_systypes
9788 eval $inhdr
9789
9790 : see if sys/select.h has to be included
9791 set sys/select.h i_sysselct
9792 eval $inhdr
9793
9794 hasfield='varname=$1; struct=$2; field=$3; shift; shift; shift;
9795 while $test $# -ge 2; do
9796         case "$1" in
9797         $define) echo "#include <$2>";;
9798         esac ;
9799     shift 2;
9800 done > try.c;
9801 echo "int main () { struct $struct foo; char* bar; bar = (char*)foo.$field; }" >> try.c;
9802 set try;
9803 if eval $compile; then
9804         val="$define";
9805 else
9806         val="$undef";
9807 fi;
9808 set $varname;
9809 eval $setvar;
9810 $rm -f try.c try.o'
9811
9812 : see if we should include time.h, sys/time.h, or both
9813 echo " "
9814 if test "X$timeincl" = X; then
9815         echo "Testing to see if we should include <time.h>, <sys/time.h> or both." >&4
9816         $echo $n "I'm now running the test program...$c"
9817         $cat >try.c <<EOCP
9818 #include <sys/types.h>
9819 #ifdef I_TIME
9820 #include <time.h>
9821 #endif
9822 #ifdef I_SYSTIME
9823 #ifdef SYSTIMEKERNEL
9824 #define KERNEL
9825 #endif
9826 #include <sys/time.h>
9827 #endif
9828 #ifdef I_SYSSELECT
9829 #include <sys/select.h>
9830 #endif
9831 #$i_stdlib I_STDLIB
9832 #ifdef I_STDLIB
9833 #include <stdlib.h>
9834 #endif
9835 int main()
9836 {
9837         struct tm foo;
9838 #ifdef S_TIMEVAL
9839         struct timeval bar;
9840 #endif
9841 #ifdef S_TIMEZONE
9842         struct timezone tzp;
9843 #endif
9844         if (foo.tm_sec == foo.tm_sec)
9845                 exit(0);
9846 #ifdef S_TIMEVAL
9847         if (bar.tv_sec == bar.tv_sec)
9848                 exit(0);
9849 #endif
9850         exit(1);
9851 }
9852 EOCP
9853         flags=''
9854         for s_timezone in '-DS_TIMEZONE' ''; do
9855         sysselect=''
9856         for s_timeval in '-DS_TIMEVAL' ''; do
9857         for i_systimek in '' '-DSYSTIMEKERNEL'; do
9858         for i_time in '' '-DI_TIME'; do
9859         for i_systime in '-DI_SYSTIME' ''; do
9860                 case "$flags" in
9861                 '') $echo $n ".$c"
9862                         set try $i_time $i_systime $i_systimek $sysselect $s_timeval $s_timezone
9863                         if eval $compile; then
9864                                 set X $i_time $i_systime $i_systimek $sysselect $s_timeval
9865                                 shift
9866                                 flags="$*"
9867                                 echo " "
9868                                 $echo $n "Succeeded with $flags$c"
9869                         fi
9870                         ;;
9871                 esac
9872         done
9873         done
9874         done
9875         done
9876         done
9877         timeincl=''
9878         echo " "
9879         case "$flags" in
9880         *SYSTIMEKERNEL*) i_systimek="$define"
9881                 timeincl=`./findhdr sys/time.h`
9882                 echo "We'll include <sys/time.h> with KERNEL defined." >&4;;
9883         *) i_systimek="$undef";;
9884         esac
9885         case "$flags" in
9886         *I_TIME*) i_time="$define"
9887                 timeincl=`./findhdr time.h`" $timeincl"
9888                 echo "We'll include <time.h>." >&4;;
9889         *) i_time="$undef";;
9890         esac
9891         case "$flags" in
9892         *I_SYSTIME*) i_systime="$define"
9893                 timeincl=`./findhdr sys/time.h`" $timeincl"
9894                 echo "We'll include <sys/time.h>." >&4;;
9895         *) i_systime="$undef";;
9896         esac
9897         $rm -f try.c try
9898 fi
9899 : see if struct tm knows about tm_zone
9900 case "$i_systime$i_time" in
9901 *$define*) 
9902         echo " "
9903         echo "Checking to see if your struct tm has tm_zone field..." >&4
9904         set d_tm_tm_zone tm tm_zone $i_systime sys/time.h $i_time time.h
9905         eval $hasfield
9906         ;;
9907 *)      val="$undef"
9908         set d_tm_tm_zone
9909         eval $setvar
9910         ;;
9911 esac
9912 case "$d_tm_tm_zone" in
9913 "$define")      echo "Yes, it does."   ;;
9914 *)              echo "No, it doesn't." ;;
9915 esac
9916 : see if struct tm knows about tm_gmtoff
9917 case "$i_systime$i_time" in
9918 *$define*) 
9919         echo " "
9920         echo "Checking to see if your struct tm has tm_gmtoff field..." >&4
9921         set d_tm_tm_gmtoff tm tm_gmtoff $i_systime sys/time.h $i_time time.h
9922         eval $hasfield
9923         ;;
9924 *)      val="$undef"
9925         set d_tm_tm_gmtoff
9926         eval $setvar
9927         ;;
9928 esac
9929 case "$d_tm_tm_gmtoff" in
9930 "$define")      echo "Yes, it does."   ;;
9931 *)              echo "No, it doesn't." ;;
9932 esac
9933
9934 : see if asctime_r exists
9935 set asctime_r d_asctime_r
9936 eval $inlibc
9937 case "$d_asctime_r" in
9938 "$define")
9939         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
9940         case "$d_asctime_r_proto:$usethreads" in
9941         ":define")      d_asctime_r_proto=define
9942                 set d_asctime_r_proto asctime_r $hdrs
9943                 eval $hasproto ;;
9944         *)      ;;
9945         esac
9946         case "$d_asctime_r_proto" in
9947         define)
9948         case "$asctime_r_proto" in
9949         ''|0) try='char* asctime_r(const struct tm*, char*);'
9950         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SB ;;
9951         esac
9952         case "$asctime_r_proto" in
9953         ''|0) try='char* asctime_r(const struct tm*, char*, int);'
9954         ./protochk "extern $try" $hdrs && asctime_r_proto=B_SBI ;;
9955         esac
9956         case "$asctime_r_proto" in
9957         ''|0) try='int asctime_r(const struct tm*, char*);'
9958         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SB ;;
9959         esac
9960         case "$asctime_r_proto" in
9961         ''|0) try='int asctime_r(const struct tm*, char*, int);'
9962         ./protochk "extern $try" $hdrs && asctime_r_proto=I_SBI ;;
9963         esac
9964         case "$asctime_r_proto" in
9965         ''|0)   d_asctime_r=undef
9966                 asctime_r_proto=0
9967                 echo "Disabling asctime_r, cannot determine prototype." >&4 ;;
9968         * )     case "$asctime_r_proto" in
9969                 REENTRANT_PROTO*) ;;
9970                 *) asctime_r_proto="REENTRANT_PROTO_$asctime_r_proto" ;;
9971                 esac
9972                 echo "Prototype: $try" ;;
9973         esac
9974         ;;
9975         *)      case "$usethreads" in
9976                 define) echo "asctime_r has no prototype, not using it." >&4 ;;
9977                 esac
9978                 d_asctime_r=undef
9979                 asctime_r_proto=0
9980                 ;;
9981         esac
9982         ;;
9983 *)      asctime_r_proto=0
9984         ;;
9985 esac
9986
9987 : see if atolf exists
9988 set atolf d_atolf
9989 eval $inlibc
9990
9991 : see if atoll exists
9992 set atoll d_atoll
9993 eval $inlibc
9994
9995 : Look for GCC-style attribute format
9996 case "$d_attribute_format" in
9997 '')
9998 echo " "
9999 echo "Checking whether your compiler can handle __attribute__((format)) ..." >&4
10000 $cat >attrib.c <<'EOCP'
10001 #include <stdio.h>
10002 void my_special_printf(char* pat,...) __attribute__((__format__(__printf__,1,2)));
10003 EOCP
10004 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10005         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10006                 echo "Your C compiler doesn't support __attribute__((format))."
10007                 val="$undef"
10008         else
10009                 echo "Your C compiler supports __attribute__((format))."
10010                 val="$define"
10011         fi
10012 else
10013         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10014         val="$undef"
10015 fi
10016 ;;
10017 *) val="$d_attribute_format" ;;
10018 esac
10019 set d_attribute_format
10020 eval $setvar
10021 $rm -f attrib*
10022
10023 : Look for GCC-style attribute format with null format allowed
10024 case "$d_printf_format_null" in
10025 '') case "$d_attribute_format" in
10026     $define)
10027         echo " "
10028         echo "Checking whether your compiler allows __printf__ format to be null ..." >&4
10029 $cat >attrib.c <<EOCP
10030 #include <stdio.h>
10031 #$i_stdlib I_STDLIB
10032 #ifdef I_STDLIB
10033 #include <stdlib.h>
10034 #endif
10035 int null_printf (char* pat,...) __attribute__((__format__(__printf__,1,2)));
10036 int null_printf (char* pat,...) { return (int)pat; }
10037 int main () { exit(null_printf(NULL)); }
10038 EOCP
10039         if $cc $ccflags -o attrib attrib.c >attrib.out 2>&1 ; then
10040             : run the executable in case it produces a run-time warning
10041             if $run ./attrib >>attrib.out 2>&1; then
10042                 if $contains 'warning' attrib.out >/dev/null 2>&1; then
10043                     echo "Your C compiler doesn't allow __printf__ format to be null."
10044                     val="$undef"
10045                 else
10046                     echo "Your C compiler allows __printf__ format to be null."
10047                     val="$define"
10048                 fi
10049             else
10050             echo "Your C compiler executable failed with __printf__ format null."
10051             val="$undef"
10052         fi
10053     else
10054         echo "Your C compiler fails with __printf__ format null."
10055         val="$undef"
10056     fi
10057     ;;
10058     *)  val="$undef" ;;
10059     esac
10060 ;;
10061 *)  val="$d_printf_format_null" ;;
10062 esac
10063 set d_printf_format_null
10064 eval $setvar
10065 $rm -f attrib*
10066
10067 : Look for GCC-style attribute malloc
10068 case "$d_attribute_malloc" in
10069 '')
10070 echo " "
10071 echo "Checking whether your compiler can handle __attribute__((malloc)) ..." >&4
10072 $cat >attrib.c <<'EOCP'
10073 #include <stdio.h>
10074 char *go_get_some_memory( int how_many_bytes ) __attribute__((malloc));
10075 EOCP
10076 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10077         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10078                 echo "Your C compiler doesn't support __attribute__((malloc))."
10079                 val="$undef"
10080         else
10081                 echo "Your C compiler supports __attribute__((malloc))."
10082                 val="$define"
10083         fi
10084 else
10085         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10086         val="$undef"
10087 fi
10088 ;;
10089 *) val="$d_attribute_malloc" ;;
10090 esac
10091 set d_attribute_malloc
10092 eval $setvar
10093 $rm -f attrib*
10094
10095 : Look for GCC-style attribute nonnull
10096 case "$d_attribute_nonnull" in
10097 '')
10098 echo " "
10099 echo "Checking whether your compiler can handle __attribute__((nonnull(1))) ..." >&4
10100 $cat >attrib.c <<'EOCP'
10101 #include <stdio.h>
10102 void do_something (char *some_pointer,...) __attribute__((nonnull(1)));
10103 EOCP
10104 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10105         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10106                 echo "Your C compiler doesn't support __attribute__((nonnull))."
10107                 val="$undef"
10108         else
10109                 echo "Your C compiler supports __attribute__((nonnull))."
10110                 val="$define"
10111         fi
10112 else
10113         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10114         val="$undef"
10115 fi
10116 ;;
10117 *) val="$d_attribute_nonnull" ;;
10118 esac
10119 set d_attribute_nonnull
10120 eval $setvar
10121 $rm -f attrib*
10122
10123 : Look for GCC-style attribute noreturn
10124 case "$d_attribute_noreturn" in
10125 '')
10126 echo " "
10127 echo "Checking whether your compiler can handle __attribute__((noreturn)) ..." >&4
10128 $cat >attrib.c <<'EOCP'
10129 #include <stdio.h>
10130 void fall_over_dead( void ) __attribute__((noreturn));
10131 EOCP
10132 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10133         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10134                 echo "Your C compiler doesn't support __attribute__((noreturn))."
10135                 val="$undef"
10136         else
10137                 echo "Your C compiler supports __attribute__((noreturn))."
10138                 val="$define"
10139         fi
10140 else
10141         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10142         val="$undef"
10143 fi
10144 ;;
10145 *) val="$d_attribute_noreturn" ;;
10146 esac
10147 set d_attribute_noreturn
10148 eval $setvar
10149 $rm -f attrib*
10150
10151 : Look for GCC-style attribute pure
10152 case "$d_attribute_pure" in
10153 '')
10154 echo " "
10155 echo "Checking whether your compiler can handle __attribute__((pure)) ..." >&4
10156 $cat >attrib.c <<'EOCP'
10157 #include <stdio.h>
10158 int square( int n ) __attribute__((pure));
10159 EOCP
10160 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10161         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10162                 echo "Your C compiler doesn't support __attribute__((pure))."
10163                 val="$undef"
10164         else
10165                 echo "Your C compiler supports __attribute__((pure))."
10166                 val="$define"
10167         fi
10168 else
10169         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10170         val="$undef"
10171 fi
10172 ;;
10173 *) val="$d_attribute_pure" ;;
10174 esac
10175 set d_attribute_pure
10176 eval $setvar
10177 $rm -f attrib*
10178
10179 : Look for GCC-style attribute unused
10180 case "$d_attribute_unused" in
10181 '')
10182 echo " "
10183 echo "Checking whether your compiler can handle __attribute__((unused)) ..." >&4
10184 $cat >attrib.c <<'EOCP'
10185 #include <stdio.h>
10186 int do_something( int dummy __attribute__((unused)), int n );
10187 EOCP
10188 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10189         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10190                 echo "Your C compiler doesn't support __attribute__((unused))."
10191                 val="$undef"
10192         else
10193                 echo "Your C compiler supports __attribute__((unused))."
10194                 val="$define"
10195         fi
10196 else
10197         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10198         val="$undef"
10199 fi
10200 ;;
10201 *) val="$d_attribute_unused" ;;
10202 esac
10203 set d_attribute_unused
10204 eval $setvar
10205 $rm -f attrib*
10206
10207 : Look for GCC-style attribute warn_unused_result
10208 case "$d_attribute_warn_unused_result" in
10209 '')
10210 echo " "
10211 echo "Checking whether your compiler can handle __attribute__((warn_unused_result)) ..." >&4
10212 $cat >attrib.c <<'EOCP'
10213 #include <stdio.h>
10214 int I_will_not_be_ignored(void) __attribute__((warn_unused_result));
10215 EOCP
10216 if $cc $ccflags -c attrib.c >attrib.out 2>&1 ; then
10217         if $contains 'warning' attrib.out >/dev/null 2>&1; then
10218                 echo "Your C compiler doesn't support __attribute__((warn_unused_result))."
10219                 val="$undef"
10220         else
10221                 echo "Your C compiler supports __attribute__((warn_unused_result))."
10222                 val="$define"
10223         fi
10224 else
10225         echo "Your C compiler doesn't seem to understand __attribute__ at all."
10226         val="$undef"
10227 fi
10228 ;;
10229 *) val="$d_attribute_warn_unused_result" ;;
10230 esac
10231 set d_attribute_warn_unused_result
10232 eval $setvar
10233 $rm -f attrib*
10234
10235 : see if bcmp exists
10236 set bcmp d_bcmp
10237 eval $inlibc
10238
10239 : see if bcopy exists
10240 set bcopy d_bcopy
10241 eval $inlibc
10242
10243 : see if getpgrp exists
10244 set getpgrp d_getpgrp
10245 eval $inlibc
10246
10247 case "$d_getpgrp" in
10248 "$define")
10249         echo " "
10250         echo "Checking to see which flavor of getpgrp is in use..."
10251         $cat >try.c <<EOP
10252 #$i_unistd I_UNISTD
10253 #include <sys/types.h>
10254 #ifdef I_UNISTD
10255 #  include <unistd.h>
10256 #endif
10257 #$i_stdlib I_STDLIB
10258 #ifdef I_STDLIB
10259 #include <stdlib.h>
10260 #endif
10261 int main()
10262 {
10263         if (getuid() == 0) {
10264                 printf("(I see you are running Configure as super-user...)\n");
10265                 setuid(1);
10266         }
10267 #ifdef TRY_BSD_PGRP
10268         if (getpgrp(1) == 0)
10269                 exit(0);
10270 #else
10271         if (getpgrp() > 0)
10272                 exit(0);
10273 #endif
10274         exit(1);
10275 }
10276 EOP
10277         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10278                 echo "You have to use getpgrp(pid) instead of getpgrp()." >&4
10279                 val="$define"
10280         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10281                 echo "You have to use getpgrp() instead of getpgrp(pid)." >&4
10282                 val="$undef"
10283         else
10284                 echo "I can't seem to compile and run the test program."
10285                 if ./usg; then
10286                         xxx="a USG one, i.e. you use getpgrp()."
10287                 else
10288                         # SVR4 systems can appear rather BSD-ish.
10289                         case "$i_unistd" in
10290                         $undef)
10291                                 xxx="a BSD one, i.e. you use getpgrp(pid)."
10292                                 val="$define"
10293                                 ;;
10294                         $define)
10295                                 xxx="probably a USG one, i.e. you use getpgrp()."
10296                                 val="$undef"
10297                                 ;;
10298                         esac
10299                 fi
10300                 echo "Assuming your getpgrp is $xxx" >&4
10301         fi
10302         ;;
10303 *) val="$undef";;
10304 esac
10305 set d_bsdgetpgrp
10306 eval $setvar
10307 $rm -f try try.*
10308
10309 : see if setpgrp exists
10310 set setpgrp d_setpgrp
10311 eval $inlibc
10312
10313 case "$d_setpgrp" in
10314 "$define")
10315         echo " "
10316         echo "Checking to see which flavor of setpgrp is in use..."
10317         $cat >try.c <<EOP
10318 #$i_unistd I_UNISTD
10319 #include <sys/types.h>
10320 #ifdef I_UNISTD
10321 #  include <unistd.h>
10322 #endif
10323 #$i_stdlib I_STDLIB
10324 #ifdef I_STDLIB
10325 #include <stdlib.h>
10326 #endif
10327 int main()
10328 {
10329         if (getuid() == 0) {
10330                 printf("(I see you are running Configure as super-user...)\n");
10331                 setuid(1);
10332         }
10333 #ifdef TRY_BSD_PGRP
10334         if (-1 == setpgrp(1, 1))
10335                 exit(0);
10336 #else
10337         if (setpgrp() != -1)
10338                 exit(0);
10339 #endif
10340         exit(1);
10341 }
10342 EOP
10343         if $cc -o try -DTRY_BSD_PGRP $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10344                 echo 'You have to use setpgrp(pid,pgrp) instead of setpgrp().' >&4
10345                 val="$define"
10346         elif $cc -o try $ccflags $ldflags try.c $libs >/dev/null 2>&1 && $run ./try; then
10347                 echo 'You have to use setpgrp() instead of setpgrp(pid,pgrp).' >&4
10348                 val="$undef"
10349         else
10350                 echo "(I can't seem to compile and run the test program.)"
10351                 if ./usg; then
10352                         xxx="a USG one, i.e. you use setpgrp()."
10353                 else
10354                         # SVR4 systems can appear rather BSD-ish.
10355                         case "$i_unistd" in
10356                         $undef)
10357                                 xxx="a BSD one, i.e. you use setpgrp(pid,pgrp)."
10358                                 val="$define"
10359                                 ;;
10360                         $define)
10361                                 xxx="probably a USG one, i.e. you use setpgrp()."
10362                                 val="$undef"
10363                                 ;;
10364                         esac
10365                 fi
10366                 echo "Assuming your setpgrp is $xxx" >&4
10367         fi
10368         ;;
10369 *) val="$undef";;
10370 esac
10371 set d_bsdsetpgrp
10372 eval $setvar
10373 $rm -f try try.*
10374 : Look for GCC-style __builtin_choose_expr
10375 case "$d_builtin_choose_expr" in
10376 '')
10377     echo " "
10378     echo "Checking whether your compiler can handle __builtin_choose_expr ..." >&4
10379     $cat >try.c <<'EOCP'
10380 #include <assert.h>
10381 #include <stdlib.h>
10382 #include <stdio.h>
10383
10384 #define SYRINX(x) __builtin_choose_expr( x, (1056*2), (103*50) )
10385
10386 int main(void) {
10387     assert( SYRINX(1) == 2112 );
10388     assert( SYRINX(1) != 5150 );
10389     assert( SYRINX(0) == 5150 );
10390     assert( SYRINX(0) != 2112 );
10391     puts( "All good!" );
10392     exit(0);
10393 }
10394
10395 EOCP
10396     set try
10397     if eval $compile; then
10398         echo "Your C compiler supports __builtin_choose_expr."
10399         val="$define"
10400     else
10401         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10402         val="$undef"
10403     fi
10404 ;;
10405 *) val="$d_builtin_choose_expr" ;;
10406 esac
10407
10408 set d_builtin_choose_expr
10409 eval $setvar
10410 $rm -f try.* try core core.try.*
10411
10412 : Look for GCC-style __builtin_expect
10413 case "$d_builtin_expect" in
10414 '')
10415     echo " "
10416     echo "Checking whether your compiler can handle __builtin_expect ..." >&4
10417     $cat >builtin.c <<'EOCP'
10418 int main(void) {
10419     int n = 50;
10420     if ( __builtin_expect(n, 0) ) n = 1;
10421 }
10422 EOCP
10423     set try
10424     if eval $compile; then
10425         echo "Your C compiler supports __builtin_choose_expr."
10426         val="$define"
10427     else
10428         echo "Your C compiler doesn't seem to understand __builtin_choose_expr."
10429         val="$undef"
10430     fi
10431     ;;
10432 *) val="$d_builtin_expect" ;;
10433 esac
10434
10435 set d_builtin_expect
10436 eval $setvar
10437 $rm -f try.* try core core.try.*
10438
10439 : see if bzero exists
10440 set bzero d_bzero
10441 eval $inlibc
10442
10443 : see if stdarg is available
10444 echo " "
10445 if $test `./findhdr stdarg.h`; then
10446         echo "<stdarg.h> found." >&4
10447         valstd="$define"
10448 else
10449         echo "<stdarg.h> NOT found." >&4
10450         valstd="$undef"
10451 fi
10452
10453 : see if varags is available
10454 echo " "
10455 if $test `./findhdr varargs.h`; then
10456         echo "<varargs.h> found." >&4
10457 else
10458         echo "<varargs.h> NOT found, but that's ok (I hope)." >&4
10459 fi
10460
10461 : set up the varargs testing programs
10462 $cat > varargs.c <<EOP
10463 #ifdef I_STDARG
10464 #include <stdarg.h>
10465 #endif
10466 #ifdef I_VARARGS
10467 #include <varargs.h>
10468 #endif
10469
10470 #ifdef I_STDARG
10471 int f(char *p, ...)
10472 #else
10473 int f(va_alist)
10474 va_dcl
10475 #endif
10476 {
10477         va_list ap;
10478 #ifndef I_STDARG
10479         char *p;
10480 #endif
10481 #ifdef I_STDARG
10482         va_start(ap,p);
10483 #else
10484         va_start(ap);
10485         p = va_arg(ap, char *);
10486 #endif
10487         va_end(ap);
10488         return 0;
10489 }
10490 EOP
10491 $cat > varargs <<EOP
10492 $startsh
10493 if $cc -c $ccflags -D\$1 varargs.c >/dev/null 2>&1; then
10494         echo "true"
10495 else
10496         echo "false"
10497 fi
10498 $rm -f varargs$_o
10499 EOP
10500 chmod +x varargs
10501
10502 : now check which varargs header should be included
10503 echo " "
10504 i_varhdr=''
10505 case "$valstd" in
10506 "$define")
10507         if `./varargs I_STDARG`; then
10508                 val='stdarg.h'
10509         elif `./varargs I_VARARGS`; then
10510                 val='varargs.h'
10511         fi
10512         ;;
10513 *)
10514         if `./varargs I_VARARGS`; then
10515                 val='varargs.h'
10516         fi
10517         ;;
10518 esac
10519 case "$val" in
10520 '')
10521 echo "I could not find the definition for va_dcl... You have problems..." >&4
10522         val="$undef"; set i_stdarg; eval $setvar
10523         val="$undef"; set i_varargs; eval $setvar
10524         ;;
10525 *) 
10526         set i_varhdr
10527         eval $setvar
10528         case "$i_varhdr" in
10529         stdarg.h)
10530                 val="$define"; set i_stdarg; eval $setvar
10531                 val="$undef"; set i_varargs; eval $setvar
10532                 ;;
10533         varargs.h)
10534                 val="$undef"; set i_stdarg; eval $setvar
10535                 val="$define"; set i_varargs; eval $setvar
10536                 ;;
10537         esac
10538         echo "We'll include <$i_varhdr> to get va_dcl definition." >&4;;
10539 esac
10540 $rm -f varargs*
10541
10542 : see if the Compiler supports C99 variadic macros
10543 case "$i_stdarg$i_stdlib" in
10544     "$define$define")
10545     echo "You have <stdarg.h> and <stdlib.h>, so checking for C99 variadic macros." >&4
10546     $cat >try.c <<EOCP
10547 #include <stdio.h>
10548 #include <stdarg.h>
10549
10550 #define foo(buffer, format, ...) sprintf(buffer, format, __VA_ARGS__)
10551
10552 int main() {
10553   char buf[20];
10554   foo(buf, "%d %g %.*s", 123, 456.0, (int)3, "789fail");
10555   puts(buf);
10556   return 0;
10557 }
10558 EOCP
10559     set try
10560     if eval $compile && $run ./try 2>&1 >/dev/null; then
10561         case "`$run ./try`" in
10562             "123 456 789")
10563             echo "You have C99 variadic macros." >&4
10564             d_c99_variadic_macros="$define"
10565             ;;
10566             *)
10567             echo "You don't have functional C99 variadic macros." >&4
10568             d_c99_variadic_macros="$undef"
10569             ;;
10570         esac
10571     else
10572         echo "I couldn't compile and run the test program, so I assume that you don't have functional C99 variadic macros." >&4
10573         d_c99_variadic_macros="$undef"
10574     fi
10575     $rm -f try.* try core core.try.*
10576     ;;
10577     *)
10578     echo "You don't have <stdarg.h> and <stdlib.h>, so not checking for C99 variadic macros." >&4
10579     d_c99_variadic_macros="$undef"
10580     ;;
10581 esac
10582
10583 : see if signal is declared as pointer to function returning int or void
10584 echo " "
10585 xxx=`./findhdr signal.h`
10586 $test "$xxx" && $cppstdin $cppminus $cppflags < $xxx >$$.tmp 2>/dev/null
10587 if $contains 'int.*\*[  ]*signal' $$.tmp >/dev/null 2>&1 ; then
10588         echo "You have int (*signal())() instead of void." >&4
10589         val="$undef"
10590 elif $contains 'void.*\*[       ]*signal' $$.tmp >/dev/null 2>&1 ; then
10591         echo "You have void (*signal())()." >&4
10592         val="$define"
10593 elif $contains 'extern[         ]*[(\*]*signal' $$.tmp >/dev/null 2>&1 ; then
10594         echo "You have int (*signal())() instead of void." >&4
10595         val="$undef"
10596 elif $contains 'void.*\*.*sig' $$.tmp >/dev/null 2>&1 ; then
10597         echo "You have void (*signal())()." >&4
10598         val="$define"
10599 else
10600         case "$d_voidsig" in
10601         '')
10602         echo "I can't determine whether signal handler returns void or int..." >&4
10603                 dflt=void
10604                 rp="What type does your signal handler return?"
10605                 . ./myread
10606                 case "$ans" in
10607                 v*) val="$define";;
10608                 *) val="$undef";;
10609                 esac;;
10610         "$define")
10611                 echo "As you already told me, signal handler returns void." >&4
10612                 val="$define"
10613                 ;;
10614         *)      echo "As you already told me, signal handler returns int." >&4
10615                 val="$undef"
10616                 ;;
10617         esac
10618 fi
10619 set d_voidsig
10620 eval $setvar
10621 case "$d_voidsig" in
10622 "$define") signal_t="void";;
10623 *) signal_t="int";;
10624 esac
10625 $rm -f $$.tmp
10626
10627 : check for ability to cast large floats to 32-bit ints.
10628 echo " "
10629 echo 'Checking whether your C compiler can cast large floats to int32.' >&4
10630 if $test "$intsize" -ge 4; then
10631         xxx=int
10632 else
10633         xxx=long
10634 fi
10635 $cat >try.c <<EOCP
10636 #include <stdio.h>
10637 #$i_stdlib I_STDLIB
10638 #ifdef I_STDLIB
10639 #include <stdlib.h>
10640 #endif
10641 #include <sys/types.h>
10642 #include <signal.h>
10643 $signal_t blech(int s) { exit(3); }
10644 int main()
10645 {
10646         $xxx i32;
10647         double f, g;
10648         int result = 0;
10649         char str[16];
10650         signal(SIGFPE, blech);
10651
10652         /* Don't let compiler optimize the test away.  Store the number 
10653            in a writable string for gcc to pass to sscanf under HP/UX.
10654         */
10655         sprintf(str, "2147483647");
10656         sscanf(str, "%lf", &f); /* f = (double) 0x7fffffff; */
10657         g = 10 * f;
10658         i32  = ($xxx) g;
10659
10660         /* x86 processors will probably give 0x8000 0000, which is a
10661            sign change.  We don't want that.  We want to mimic SPARC
10662            behavior here, which is to preserve the sign and give
10663            back 0x7fff ffff.
10664         */
10665         if (i32 != ($xxx) f)
10666                 result |= 1;
10667         exit(result);
10668 }
10669 EOCP
10670 set try
10671 if eval $compile_ok; then
10672         $run ./try
10673         yyy=$?
10674 else
10675         echo "(I can't seem to compile the test program--assuming it can't)"
10676         yyy=1
10677 fi
10678 case "$yyy" in
10679 0)      val="$define"
10680         echo "Yup, it can."
10681         ;;
10682 *)      val="$undef"
10683         echo "Nope, it can't."
10684         ;;
10685 esac
10686 set d_casti32
10687 eval $setvar
10688 $rm -f try try.*
10689
10690 : check for ability to cast negative floats to unsigned
10691 echo " "
10692 echo 'Checking whether your C compiler can cast negative float to unsigned.' >&4
10693 $cat >try.c <<EOCP
10694 #include <stdio.h>
10695 #$i_stdlib I_STDLIB
10696 #ifdef I_STDLIB
10697 #include <stdlib.h>
10698 #endif
10699 #include <sys/types.h>
10700 #include <signal.h>
10701 $signal_t blech(int s) { exit(7); }
10702 $signal_t blech_in_list(int s) { exit(4); }
10703 unsigned long dummy_long(unsigned long p) { return p; }
10704 unsigned int dummy_int(unsigned int p) { return p; }
10705 unsigned short dummy_short(unsigned short p) { return p; }
10706 int main()
10707 {
10708         double f;
10709         unsigned long along;
10710         unsigned int aint;
10711         unsigned short ashort;
10712         int result = 0;
10713         char str[16];
10714         
10715         /* Frustrate gcc-2.7.2's optimizer which failed this test with
10716            a direct f = -123. assignment.  gcc-2.8.0 reportedly
10717            optimized the whole file away
10718         */
10719         /* Store the number in a writable string for gcc to pass to 
10720            sscanf under HP/UX.
10721         */
10722         sprintf(str, "-123");
10723         sscanf(str, "%lf", &f);  /* f = -123.; */
10724
10725         signal(SIGFPE, blech);
10726         along = (unsigned long)f;
10727         aint = (unsigned int)f;
10728         ashort = (unsigned short)f;
10729         if (along != (unsigned long)-123)
10730                 result |= 1;
10731         if (aint != (unsigned int)-123)
10732                 result |= 1;
10733         if (ashort != (unsigned short)-123)
10734                 result |= 1;
10735         sprintf(str, "1073741824.");
10736         sscanf(str, "%lf", &f); /* f = (double)0x40000000; */
10737         f = f + f;
10738         along = 0;
10739         along = (unsigned long)f;
10740         if (along != 0x80000000)
10741                 result |= 2;
10742         f -= 1.;
10743         along = 0;
10744         along = (unsigned long)f;
10745         if (along != 0x7fffffff)
10746                 result |= 1;
10747         f += 2.;
10748         along = 0;
10749         along = (unsigned long)f;
10750         if (along != 0x80000001)
10751                 result |= 2;
10752         if (result)
10753                 exit(result);
10754         signal(SIGFPE, blech_in_list);
10755         sprintf(str, "123.");
10756         sscanf(str, "%lf", &f);  /* f = 123.; */
10757         along = dummy_long((unsigned long)f);
10758         aint = dummy_int((unsigned int)f);
10759         ashort = dummy_short((unsigned short)f);
10760         if (along != (unsigned long)123)
10761                 result |= 4;
10762         if (aint != (unsigned int)123)
10763                 result |= 4;
10764         if (ashort != (unsigned short)123)
10765                 result |= 4;
10766         exit(result);
10767
10768 }
10769 EOCP
10770 set try
10771 if eval $compile_ok; then
10772         $run ./try
10773         castflags=$?
10774 else
10775         echo "(I can't seem to compile the test program--assuming it can't)"
10776         castflags=7
10777 fi
10778 case "$castflags" in
10779 0)      val="$define"
10780         echo "Yup, it can."
10781         ;;
10782 *)      val="$undef"
10783         echo "Nope, it can't."
10784         ;;
10785 esac
10786 set d_castneg
10787 eval $setvar
10788 $rm -f try.*
10789
10790 : see if vprintf exists
10791 echo " "
10792 if set vprintf val -f d_vprintf; eval $csym; $val; then
10793         echo 'vprintf() found.' >&4
10794         val="$define"
10795         $cat >try.c <<EOF
10796 #include <varargs.h>
10797 #$i_stdlib I_STDLIB
10798 #ifdef I_STDLIB
10799 #include <stdlib.h>
10800 #endif
10801
10802 int main() { xxx("foo"); }
10803
10804 xxx(va_alist)
10805 va_dcl
10806 {
10807         va_list args;
10808         char buf[10];
10809
10810         va_start(args);
10811         exit((unsigned long)vsprintf(buf,"%s",args) > 10L);
10812 }
10813 EOF
10814         set try
10815         if eval $compile && $run ./try; then
10816                 echo "Your vsprintf() returns (int)." >&4
10817                 val2="$undef"
10818         else
10819                 echo "Your vsprintf() returns (char*)." >&4
10820                 val2="$define"
10821         fi
10822 else
10823         echo 'vprintf() NOT found.' >&4
10824                 val="$undef"
10825                 val2="$undef"
10826 fi
10827 $rm -f try try.*
10828 set d_vprintf
10829 eval $setvar
10830 val=$val2
10831 set d_charvspr
10832 eval $setvar
10833
10834 : see if chown exists
10835 set chown d_chown
10836 eval $inlibc
10837
10838 : see if chroot exists
10839 set chroot d_chroot
10840 eval $inlibc
10841
10842 : see if chsize exists
10843 set chsize d_chsize
10844 eval $inlibc
10845
10846 : see if class exists
10847 set class d_class
10848 eval $inlibc
10849
10850 : see if clearenv exists
10851 set clearenv d_clearenv
10852 eval $inlibc
10853
10854 hasstruct='varname=$1; struct=$2; shift; shift;
10855 while $test $# -ge 2; do
10856         case "$1" in
10857         $define) echo "#include <$2>";;
10858         esac ;
10859     shift 2;
10860 done > try.c;
10861 echo "int main () { struct $struct foo; }" >> try.c;
10862 set try;
10863 if eval $compile; then
10864         val="$define";
10865 else
10866         val="$undef";
10867 fi;
10868 set $varname;
10869 eval $setvar;
10870 $rm -f try.c try.o'
10871
10872 socketlib=''
10873 sockethdr=''
10874 : see whether socket exists
10875 echo " "
10876 $echo $n "Hmm... $c" >&4
10877 if set socket val -f d_socket; eval $csym; $val; then
10878         echo "Looks like you have Berkeley networking support." >&4
10879         d_socket="$define"
10880         if set setsockopt val -f; eval $csym; $val; then
10881                 d_oldsock="$undef"
10882         else
10883                 echo "...but it uses the old BSD 4.1c interface, rather than 4.2." >&4
10884                 d_oldsock="$define"
10885         fi
10886 else
10887         if $contains socklib libc.list >/dev/null 2>&1; then
10888                 echo "Looks like you have Berkeley networking support." >&4
10889                 d_socket="$define"
10890                 : we will have to assume that it supports the 4.2 BSD interface
10891                 d_oldsock="$undef"
10892         else
10893                 echo "You don't have Berkeley networking in libc$_a..." >&4
10894                 if test "X$d_socket" = "X$define"; then
10895                    echo "...but you seem to believe that you have sockets." >&4
10896                 else
10897                         for net in net socket
10898                         do
10899                                 if test -f /usr/lib/lib$net$_a; then
10900                                         ( ($nm $nm_opt /usr/lib/lib$net$_a | eval $nm_extract) ||  \
10901                                         $ar t /usr/lib/lib$net$_a) 2>/dev/null >> libc.list
10902                                         if $contains socket libc.list >/dev/null 2>&1; then
10903                                                 d_socket="$define"
10904                                                 socketlib="-l$net"
10905                                                 case "$net" in
10906                                                 net)
10907                                                         echo "...but the Wollongong group seems to have hacked it in." >&4
10908                                                         sockethdr="-I/usr/netinclude"
10909                                                         ;;
10910                                                 esac
10911                                                 echo "Found Berkeley sockets interface in lib$net." >&4 
10912                                                 if $contains setsockopt libc.list >/dev/null 2>&1; then
10913                                                         d_oldsock="$undef"
10914                                                 else
10915                                                         echo "...using the old BSD 4.1c interface, rather than 4.2." >&4
10916                                                         d_oldsock="$define"
10917                                                 fi
10918                                                 break
10919                                         fi
10920                                 fi
10921                         done
10922                         if test "X$d_socket" != "X$define"; then
10923                            echo "or anywhere else I see." >&4
10924                            d_socket="$undef"
10925                            d_oldsock="$undef"
10926                         fi
10927                 fi
10928         fi
10929 fi
10930
10931 : see if socketpair exists
10932 set socketpair d_sockpair
10933 eval $inlibc
10934
10935
10936 echo " "
10937 echo "Checking the availability of certain socket constants..." >&4
10938 for ENUM in MSG_CTRUNC MSG_DONTROUTE MSG_OOB MSG_PEEK MSG_PROXY SCM_RIGHTS; do
10939         enum=`$echo $ENUM|./tr '[A-Z]' '[a-z]'`
10940         $cat >try.c <<EOF
10941 #include <sys/types.h>
10942 #include <sys/socket.h>
10943 int main() {
10944     int i = $ENUM;
10945 }
10946 EOF
10947         val="$undef"
10948         set try; if eval $compile; then
10949                 val="$define"
10950         fi
10951         set d_${enum}; eval $setvar
10952         $rm -f try.c try
10953 done
10954
10955 : see if this is a sys/uio.h system
10956 set sys/uio.h i_sysuio
10957 eval $inhdr
10958
10959
10960 echo " "
10961 echo "Checking to see if your system supports struct cmsghdr..." >&4
10962 set d_cmsghdr_s cmsghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
10963 eval $hasstruct
10964 case "$d_cmsghdr_s" in
10965 "$define")      echo "Yes, it does."   ;;
10966 *)              echo "No, it doesn't." ;;
10967 esac
10968
10969
10970 : check for const keyword
10971 echo " "
10972 echo 'Checking to see if your C compiler knows about "const"...' >&4
10973 $cat >const.c <<'EOCP'
10974 typedef struct spug { int drokk; } spug;
10975 int main()
10976 {
10977         const char *foo;
10978         const spug y = { 0 };
10979 }
10980 EOCP
10981 if $cc -c $ccflags const.c >/dev/null 2>&1 ; then
10982         val="$define"
10983         echo "Yup, it does."
10984 else
10985         val="$undef"
10986         echo "Nope, it doesn't."
10987 fi
10988 set d_const
10989 eval $setvar
10990
10991 : see if copysignl exists
10992 set copysignl d_copysignl
10993 eval $inlibc
10994
10995 : see if crypt exists
10996 echo " "
10997 set crypt d_crypt
10998 eval $inlibc
10999 case "$d_crypt" in
11000 $define) cryptlib='' ;;
11001 *)      if set crypt val -f d_crypt; eval $csym; $val; then
11002                 echo 'crypt() found.' >&4
11003                 val="$define"
11004                 cryptlib=''
11005         else
11006                 cryptlib=`./loc Slibcrypt$_a "" $xlibpth`
11007                 if $test -z "$cryptlib"; then
11008                         cryptlib=`./loc Mlibcrypt$_a "" $xlibpth`
11009                 else
11010                         cryptlib=-lcrypt
11011                 fi
11012                 if $test -z "$cryptlib"; then
11013                         cryptlib=`./loc Llibcrypt$_a "" $xlibpth`
11014                 else
11015                         cryptlib=-lcrypt
11016                 fi
11017                 if $test -z "$cryptlib"; then
11018                         cryptlib=`./loc libcrypt$_a "" $libpth`
11019                 else
11020                         cryptlib=-lcrypt
11021                 fi
11022                 if $test -z "$cryptlib"; then
11023                         echo 'crypt() NOT found.' >&4
11024                         val="$undef"
11025                 else
11026                         val="$define"
11027                 fi
11028         fi
11029         set d_crypt
11030         eval $setvar
11031         ;;
11032 esac
11033
11034 : see if this is a crypt.h system
11035 set crypt.h i_crypt
11036 eval $inhdr
11037
11038 : see if crypt_r exists
11039 set crypt_r d_crypt_r
11040 eval $inlibc
11041 case "$d_crypt_r" in
11042 "$define")
11043         hdrs="$i_systypes sys/types.h define stdio.h $i_crypt crypt.h"
11044         case "$d_crypt_r_proto:$usethreads" in
11045         ":define")      d_crypt_r_proto=define
11046                 set d_crypt_r_proto crypt_r $hdrs
11047                 eval $hasproto ;;
11048         *)      ;;
11049         esac
11050         case "$d_crypt_r_proto" in
11051         define)
11052         case "$crypt_r_proto" in
11053         ''|0) try='char* crypt_r(const char*, const char*, struct crypt_data*);'
11054         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCS ;;
11055         esac
11056         case "$crypt_r_proto" in
11057         ''|0) try='char* crypt_r(const char*, const char*, CRYPTD*);'
11058         ./protochk "extern $try" $hdrs && crypt_r_proto=B_CCD ;;
11059         esac
11060         case "$crypt_r_proto" in
11061         ''|0)   d_crypt_r=undef
11062                 crypt_r_proto=0
11063                 echo "Disabling crypt_r, cannot determine prototype." >&4 ;;
11064         * )     case "$crypt_r_proto" in
11065                 REENTRANT_PROTO*) ;;
11066                 *) crypt_r_proto="REENTRANT_PROTO_$crypt_r_proto" ;;
11067                 esac
11068                 echo "Prototype: $try" ;;
11069         esac
11070         ;;
11071         *)      case "$usethreads" in
11072                 define) echo "crypt_r has no prototype, not using it." >&4 ;;
11073                 esac
11074                 d_crypt_r=undef
11075                 crypt_r_proto=0
11076                 ;;
11077         esac
11078         ;;
11079 *)      crypt_r_proto=0
11080         ;;
11081 esac
11082
11083 : get csh whereabouts
11084 case "$csh" in
11085 'csh') val="$undef" ;;
11086 *) val="$define" ;;
11087 esac
11088 set d_csh
11089 eval $setvar
11090 : Respect a hint or command line value for full_csh.
11091 case "$full_csh" in
11092 '') full_csh=$csh ;;
11093 esac
11094
11095 : see if ctermid exists
11096 set ctermid d_ctermid
11097 eval $inlibc
11098
11099 : see if ctermid_r exists
11100 set ctermid_r d_ctermid_r
11101 eval $inlibc
11102 case "$d_ctermid_r" in
11103 "$define")
11104         hdrs="$i_systypes sys/types.h define stdio.h "
11105         case "$d_ctermid_r_proto:$usethreads" in
11106         ":define")      d_ctermid_r_proto=define
11107                 set d_ctermid_r_proto ctermid_r $hdrs
11108                 eval $hasproto ;;
11109         *)      ;;
11110         esac
11111         case "$d_ctermid_r_proto" in
11112         define)
11113         case "$ctermid_r_proto" in
11114         ''|0) try='char* ctermid_r(char*);'
11115         ./protochk "extern $try" $hdrs && ctermid_r_proto=B_B ;;
11116         esac
11117         case "$ctermid_r_proto" in
11118         ''|0)   d_ctermid_r=undef
11119                 ctermid_r_proto=0
11120                 echo "Disabling ctermid_r, cannot determine prototype." >&4 ;;
11121         * )     case "$ctermid_r_proto" in
11122                 REENTRANT_PROTO*) ;;
11123                 *) ctermid_r_proto="REENTRANT_PROTO_$ctermid_r_proto" ;;
11124                 esac
11125                 echo "Prototype: $try" ;;
11126         esac
11127         ;;
11128         *)      case "$usethreads" in
11129                 define) echo "ctermid_r has no prototype, not using it." >&4 ;;
11130                 esac
11131                 d_ctermid_r=undef
11132                 ctermid_r_proto=0
11133                 ;;
11134         esac
11135         ;;
11136 *)      ctermid_r_proto=0
11137         ;;
11138 esac
11139
11140 : see if ctime_r exists
11141 set ctime_r d_ctime_r
11142 eval $inlibc
11143 case "$d_ctime_r" in
11144 "$define")
11145         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
11146         case "$d_ctime_r_proto:$usethreads" in
11147         ":define")      d_ctime_r_proto=define
11148                 set d_ctime_r_proto ctime_r $hdrs
11149                 eval $hasproto ;;
11150         *)      ;;
11151         esac
11152         case "$d_ctime_r_proto" in
11153         define)
11154         case "$ctime_r_proto" in
11155         ''|0) try='char* ctime_r(const time_t*, char*);'
11156         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SB ;;
11157         esac
11158         case "$ctime_r_proto" in
11159         ''|0) try='char* ctime_r(const time_t*, char*, int);'
11160         ./protochk "extern $try" $hdrs && ctime_r_proto=B_SBI ;;
11161         esac
11162         case "$ctime_r_proto" in
11163         ''|0) try='int ctime_r(const time_t*, char*);'
11164         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SB ;;
11165         esac
11166         case "$ctime_r_proto" in
11167         ''|0) try='int ctime_r(const time_t*, char*, int);'
11168         ./protochk "extern $try" $hdrs && ctime_r_proto=I_SBI ;;
11169         esac
11170         case "$ctime_r_proto" in
11171         ''|0)   d_ctime_r=undef
11172                 ctime_r_proto=0
11173                 echo "Disabling ctime_r, cannot determine prototype." >&4 ;;
11174         * )     case "$ctime_r_proto" in
11175                 REENTRANT_PROTO*) ;;
11176                 *) ctime_r_proto="REENTRANT_PROTO_$ctime_r_proto" ;;
11177                 esac
11178                 echo "Prototype: $try" ;;
11179         esac
11180         ;;
11181         *)      case "$usethreads" in
11182                 define) echo "ctime_r has no prototype, not using it." >&4 ;;
11183                 esac
11184                 d_ctime_r=undef
11185                 ctime_r_proto=0
11186                 ;;
11187         esac
11188         ;;
11189 *)      ctime_r_proto=0
11190         ;;
11191 esac
11192
11193 : see if cuserid exists
11194 set cuserid d_cuserid
11195 eval $inlibc
11196
11197 : see if this is a limits.h system
11198 set limits.h i_limits
11199 eval $inhdr
11200
11201 : see if this is a float.h system
11202 set float.h i_float
11203 eval $inhdr
11204
11205 : See if number of significant digits in a double precision number is known
11206 echo " "
11207 $cat >dbl_dig.c <<EOM
11208 #$i_limits I_LIMITS
11209 #$i_float I_FLOAT
11210 #ifdef I_LIMITS
11211 #include <limits.h>
11212 #endif
11213 #ifdef I_FLOAT
11214 #include <float.h>
11215 #endif
11216 #ifdef DBL_DIG
11217 printf("Contains DBL_DIG");
11218 #endif
11219 EOM
11220 $cppstdin $cppflags $cppminus < dbl_dig.c >dbl_dig.E 2>/dev/null
11221 if $contains 'DBL_DIG' dbl_dig.E >/dev/null 2>&1; then
11222         echo "DBL_DIG found." >&4
11223         val="$define"
11224 else
11225         echo "DBL_DIG NOT found." >&4
11226         val="$undef"
11227 fi
11228 $rm -f dbl_dig.?
11229 set d_dbl_dig
11230 eval $setvar
11231
11232 : see if dbm.h is available
11233 : see if dbmclose exists
11234 set dbmclose d_dbmclose
11235 eval $inlibc
11236
11237 case "$d_dbmclose" in
11238 $define)
11239         set dbm.h i_dbm
11240         eval $inhdr
11241         case "$i_dbm" in
11242         $define)
11243                 val="$undef"
11244                 set i_rpcsvcdbm
11245                 eval $setvar
11246                 ;;
11247         *)      set rpcsvc/dbm.h i_rpcsvcdbm
11248                 eval $inhdr
11249                 ;;
11250         esac
11251         ;;
11252 *)      echo "We won't be including <dbm.h>"
11253         val="$undef"
11254         set i_dbm
11255         eval $setvar
11256         val="$undef"
11257         set i_rpcsvcdbm
11258         eval $setvar
11259         ;;
11260 esac
11261
11262 : see if prototype for dbminit is available
11263 echo " "
11264 set d_dbminitproto dbminit $i_dbm dbm.h
11265 eval $hasproto
11266
11267 : see if difftime exists
11268 set difftime d_difftime
11269 eval $inlibc
11270
11271 : see if this is a dirent system
11272 echo " "
11273 if xinc=`./findhdr dirent.h`; $test "$xinc"; then
11274         val="$define"
11275         echo "<dirent.h> found." >&4
11276 else
11277         val="$undef"
11278         if xinc=`./findhdr sys/dir.h`; $test "$xinc"; then
11279                 echo "<sys/dir.h> found." >&4
11280                 echo " "
11281         else
11282                 xinc=`./findhdr sys/ndir.h`
11283         fi
11284         echo "<dirent.h> NOT found." >&4
11285 fi
11286 set i_dirent
11287 eval $setvar
11288
11289 : Look for type of directory structure.
11290 echo " "
11291 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11292
11293 case "$direntrytype" in
11294 ''|' ')
11295         case "$i_dirent" in
11296         $define) guess1='struct dirent' ;;
11297         *) guess1='struct direct'  ;;
11298         esac
11299         ;;
11300 *)      guess1="$direntrytype"
11301         ;;
11302 esac
11303
11304 case "$guess1" in
11305 'struct dirent') guess2='struct direct' ;;
11306 *) guess2='struct dirent' ;;
11307 esac
11308                 
11309 if $contains "$guess1" try.c >/dev/null 2>&1; then
11310         direntrytype="$guess1"
11311         echo "Your directory entries are $direntrytype." >&4
11312 elif $contains "$guess2" try.c >/dev/null 2>&1; then
11313         direntrytype="$guess2"
11314         echo "Your directory entries seem to be $direntrytype." >&4
11315 else
11316         echo "I don't recognize your system's directory entries." >&4
11317         rp="What type is used for directory entries on this system?"
11318         dflt="$guess1"
11319         . ./myread
11320         direntrytype="$ans"
11321 fi
11322 $rm -f try.c
11323
11324
11325 : see if the directory entry stores field length
11326 echo " "
11327 $cppstdin $cppflags $cppminus < "$xinc" > try.c
11328 if $contains 'd_namlen' try.c >/dev/null 2>&1; then
11329         echo "Good, your directory entry keeps length information in d_namlen." >&4
11330         val="$define"
11331 else
11332         echo "Your directory entry does not know about the d_namlen field." >&4
11333         val="$undef"
11334 fi
11335 set d_dirnamlen
11336 eval $setvar
11337 $rm -f try.c
11338
11339 : Look for DIR.dd_fd
11340 case "$i_dirent" in
11341 "$define")
11342     echo "Checking to see if DIR has a dd_fd member variable" >&4
11343     $cat >try.c <<EOCP
11344 #$i_stdlib I_STDLIB
11345 #ifdef I_STDLIB
11346 #include <stdlib.h>
11347 #endif
11348 #include <dirent.h>
11349
11350 int main() {
11351     DIR dir;
11352     dir.dd_fd = 1;
11353     return 0;
11354 }
11355 EOCP
11356     val=$undef
11357     set try
11358     if eval $compile; then
11359         echo "Yes, it does."
11360         val="$define"
11361     else
11362         echo "No, it does not."
11363         val="$undef"
11364     fi
11365     ;;
11366 *)
11367     echo "You don't have a <dirent.h>, so not checking for dd_fd." >&4
11368     val="$undef"
11369     ;;
11370 esac
11371 set d_dir_dd_fd
11372 eval $setvar
11373 $rm -f try try.*
11374
11375 : see if this is an sysdir system
11376 set sys/dir.h i_sysdir
11377 eval $inhdr
11378
11379 : see if this is an sysndir system
11380 set sys/ndir.h i_sysndir
11381 eval $inhdr
11382
11383 : Look for dirfd
11384 echo " "
11385 $cat >dirfd.c <<EOM
11386 #include <stdio.h>
11387 #$i_stdlib I_STDLIB
11388 #ifdef I_STDLIB
11389 #include <stdlib.h>
11390 #endif
11391 #$i_dirent I_DIRENT             /**/
11392 #$i_sysdir I_SYS_DIR            /**/
11393 #$i_sysndir I_SYS_NDIR          /**/
11394 #$i_systypes I_SYS_TYPES        /**/
11395 #if defined(I_SYS_TYPES)
11396 #include <sys/types.h>
11397 #endif
11398 #if defined(I_DIRENT)
11399 #include <dirent.h>
11400 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
11401 #include <sys/dir.h>
11402 #endif
11403 #else
11404 #ifdef I_SYS_NDIR
11405 #include <sys/ndir.h>
11406 #else
11407 #ifdef I_SYS_DIR
11408 #ifdef hp9000s500
11409 #include <ndir.h>       /* may be wrong in the future */
11410 #else
11411 #include <sys/dir.h>
11412 #endif
11413 #endif
11414 #endif
11415 #endif 
11416 int main() {
11417         DIR *dirp = opendir(".");
11418         if (dirfd(dirp) >= 0)
11419                 exit(0);
11420         else
11421                 exit(1);
11422 }
11423 EOM
11424 val=$undef
11425 set dirfd
11426 if eval $compile; then
11427         val="$define"
11428 fi
11429 case "$val" in
11430 $define)        echo "dirfd() found." >&4       ;;
11431 *)              echo "dirfd() NOT found." >&4   ;;
11432 esac
11433 set d_dirfd
11434 eval $setvar
11435 $rm -f dirfd*
11436
11437 : see if dlerror exists
11438 xxx_runnm="$runnm"
11439 runnm=false
11440 set dlerror d_dlerror
11441 eval $inlibc
11442 runnm="$xxx_runnm"
11443
11444 : see if dlfcn is available
11445 set dlfcn.h i_dlfcn
11446 eval $inhdr
11447
11448 case "$usedl" in
11449 $define|y|true)
11450         $cat << EOM
11451
11452 On a few systems, the dynamically loaded modules that perl generates and uses
11453 will need a different extension than shared libs. The default will probably
11454 be appropriate.
11455
11456 EOM
11457         case "$dlext" in
11458         '')     dflt="$so" ;;
11459         *)      dflt="$dlext" ;;
11460         esac
11461         rp='What is the extension of dynamically loaded modules'
11462         . ./myread
11463         dlext="$ans"
11464         ;;
11465 *)
11466         dlext="none"
11467         ;;
11468 esac
11469
11470 : Check if dlsym need a leading underscore
11471 echo " "
11472 val="$undef"
11473
11474 case "$dlsrc" in
11475 dl_dlopen.xs)
11476         echo "Checking whether your dlsym() needs a leading underscore ..." >&4
11477         $cat >dyna.c <<'EOM'
11478 fred () { }
11479 EOM
11480
11481 $cat >fred.c<<EOM
11482
11483 #include <stdio.h>
11484 #$i_stdlib I_STDLIB
11485 #ifdef I_STDLIB
11486 #include <stdlib.h>
11487 #endif
11488 #$i_dlfcn I_DLFCN
11489 #ifdef I_DLFCN
11490 #include <dlfcn.h>      /* the dynamic linker include file for SunOS/Solaris */
11491 #else
11492 #include <sys/types.h>
11493 #include <nlist.h>
11494 #include <link.h>
11495 #endif
11496
11497 extern int fred() ;
11498
11499 int main()
11500 {
11501     void * handle ;
11502     void * symbol ;
11503 #ifndef RTLD_LAZY
11504     int mode = 1 ;
11505 #else
11506     int mode = RTLD_LAZY ;
11507 #endif
11508     handle = dlopen("./dyna.$dlext", mode) ;
11509     if (handle == NULL) {
11510         printf ("1\n") ;
11511         fflush (stdout) ;
11512         exit(0);
11513     }
11514     symbol = dlsym(handle, "fred") ;
11515     if (symbol == NULL) {
11516         /* try putting a leading underscore */
11517         symbol = dlsym(handle, "_fred") ;
11518         if (symbol == NULL) {
11519             printf ("2\n") ;
11520             fflush (stdout) ;
11521             exit(0);
11522         }
11523         printf ("3\n") ;
11524     }
11525     else
11526         printf ("4\n") ;
11527     fflush (stdout) ;
11528     exit(0);
11529 }
11530 EOM
11531         : Call the object file tmp-dyna.o in case dlext=o.
11532         if $cc $ccflags $cccdlflags -c dyna.c > /dev/null 2>&1 && 
11533                 mv dyna${_o} tmp-dyna${_o} > /dev/null 2>&1 && 
11534                 $ld -o dyna.$dlext $ldflags $lddlflags tmp-dyna${_o} > /dev/null 2>&1 && 
11535                 $cc -o fred $ccflags $ldflags $cccdlflags $ccdlflags fred.c $libs > /dev/null 2>&1 && $to dyna.$dlext; then
11536                 xxx=`$run ./fred`
11537                 case $xxx in
11538                 1)      echo "Test program failed using dlopen." >&4
11539                         echo "Perhaps you should not use dynamic loading." >&4;;
11540                 2)      echo "Test program failed using dlsym." >&4
11541                         echo "Perhaps you should not use dynamic loading." >&4;;
11542                 3)      echo "dlsym needs a leading underscore" >&4
11543                         val="$define" ;;
11544                 4)      echo "dlsym doesn't need a leading underscore." >&4;;
11545                 esac
11546         else
11547                 echo "I can't compile and run the test program." >&4
11548                 echo "I'm guessing that dlsym doesn't need a leading underscore." >&4
11549         fi
11550         ;;
11551 esac
11552                 
11553 $rm -f fred fred.* dyna.$dlext dyna.* tmp-dyna.*
11554
11555 set d_dlsymun
11556 eval $setvar
11557
11558 : see if drand48_r exists
11559 set drand48_r d_drand48_r
11560 eval $inlibc
11561 case "$d_drand48_r" in
11562 "$define")
11563         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
11564         case "$d_drand48_r_proto:$usethreads" in
11565         ":define")      d_drand48_r_proto=define
11566                 set d_drand48_r_proto drand48_r $hdrs
11567                 eval $hasproto ;;
11568         *)      ;;
11569         esac
11570         case "$d_drand48_r_proto" in
11571         define)
11572         case "$drand48_r_proto" in
11573         ''|0) try='int drand48_r(struct drand48_data*, double*);'
11574         ./protochk "extern $try" $hdrs && drand48_r_proto=I_ST ;;
11575         esac
11576         case "$drand48_r_proto" in
11577         ''|0)   d_drand48_r=undef
11578                 drand48_r_proto=0
11579                 echo "Disabling drand48_r, cannot determine prototype." >&4 ;;
11580         * )     case "$drand48_r_proto" in
11581                 REENTRANT_PROTO*) ;;
11582                 *) drand48_r_proto="REENTRANT_PROTO_$drand48_r_proto" ;;
11583                 esac
11584                 echo "Prototype: $try" ;;
11585         esac
11586         ;;
11587         *)      case "$usethreads" in
11588                 define) echo "drand48_r has no prototype, not using it." >&4 ;;
11589                 esac
11590                 d_drand48_r=undef
11591                 drand48_r_proto=0
11592                 ;;
11593         esac
11594         ;;
11595 *)      drand48_r_proto=0
11596         ;;
11597 esac
11598
11599 : see if prototype for drand48 is available
11600 echo " "
11601 set d_drand48proto drand48 $i_stdlib stdlib.h $i_unistd unistd.h
11602 eval $hasproto
11603
11604 : see if dup2 exists
11605 set dup2 d_dup2
11606 eval $inlibc
11607
11608 : see if eaccess exists
11609 set eaccess d_eaccess
11610 eval $inlibc
11611
11612 : see if endgrent exists
11613 set endgrent d_endgrent
11614 eval $inlibc
11615
11616 : see if this is an grp system
11617 set grp.h i_grp
11618 eval $inhdr
11619
11620 case "$i_grp" in
11621 $define)
11622         xxx=`./findhdr grp.h`
11623         $cppstdin $cppflags $cppminus < $xxx >$$.h
11624
11625         if $contains 'gr_passwd' $$.h >/dev/null 2>&1; then
11626                 val="$define"
11627         else
11628                 val="$undef"
11629         fi
11630         set d_grpasswd
11631         eval $setvar
11632
11633         $rm -f $$.h
11634         ;;
11635 *)
11636         val="$undef";
11637         set d_grpasswd; eval $setvar
11638         ;;
11639 esac
11640
11641 : see if endgrent_r exists
11642 set endgrent_r d_endgrent_r
11643 eval $inlibc
11644 case "$d_endgrent_r" in
11645 "$define")
11646         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
11647         case "$d_endgrent_r_proto:$usethreads" in
11648         ":define")      d_endgrent_r_proto=define
11649                 set d_endgrent_r_proto endgrent_r $hdrs
11650                 eval $hasproto ;;
11651         *)      ;;
11652         esac
11653         case "$d_endgrent_r_proto" in
11654         define)
11655         case "$endgrent_r_proto" in
11656         ''|0) try='int endgrent_r(FILE**);'
11657         ./protochk "extern $try" $hdrs && endgrent_r_proto=I_H ;;
11658         esac
11659         case "$endgrent_r_proto" in
11660         ''|0) try='void endgrent_r(FILE**);'
11661         ./protochk "extern $try" $hdrs && endgrent_r_proto=V_H ;;
11662         esac
11663         case "$endgrent_r_proto" in
11664         ''|0)   d_endgrent_r=undef
11665                 endgrent_r_proto=0
11666                 echo "Disabling endgrent_r, cannot determine prototype." >&4 ;;
11667         * )     case "$endgrent_r_proto" in
11668                 REENTRANT_PROTO*) ;;
11669                 *) endgrent_r_proto="REENTRANT_PROTO_$endgrent_r_proto" ;;
11670                 esac
11671                 echo "Prototype: $try" ;;
11672         esac
11673         ;;
11674         *)      case "$usethreads" in
11675                 define) echo "endgrent_r has no prototype, not using it." >&4 ;;
11676                 esac
11677                 d_endgrent_r=undef
11678                 endgrent_r_proto=0
11679                 ;;
11680         esac
11681         ;;
11682 *)      endgrent_r_proto=0
11683         ;;
11684 esac
11685
11686 : see if endhostent exists
11687 set endhostent d_endhent
11688 eval $inlibc
11689
11690 : see if this is a netdb.h system
11691 set netdb.h i_netdb
11692 eval $inhdr
11693
11694 : see if endhostent_r exists
11695 set endhostent_r d_endhostent_r
11696 eval $inlibc
11697 case "$d_endhostent_r" in
11698 "$define")
11699         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11700         case "$d_endhostent_r_proto:$usethreads" in
11701         ":define")      d_endhostent_r_proto=define
11702                 set d_endhostent_r_proto endhostent_r $hdrs
11703                 eval $hasproto ;;
11704         *)      ;;
11705         esac
11706         case "$d_endhostent_r_proto" in
11707         define)
11708         case "$endhostent_r_proto" in
11709         ''|0) try='int endhostent_r(struct hostent_data*);'
11710         ./protochk "extern $try" $hdrs && endhostent_r_proto=I_D ;;
11711         esac
11712         case "$endhostent_r_proto" in
11713         ''|0) try='void endhostent_r(struct hostent_data*);'
11714         ./protochk "extern $try" $hdrs && endhostent_r_proto=V_D ;;
11715         esac
11716         case "$endhostent_r_proto" in
11717         ''|0)   d_endhostent_r=undef
11718                 endhostent_r_proto=0
11719                 echo "Disabling endhostent_r, cannot determine prototype." >&4 ;;
11720         * )     case "$endhostent_r_proto" in
11721                 REENTRANT_PROTO*) ;;
11722                 *) endhostent_r_proto="REENTRANT_PROTO_$endhostent_r_proto" ;;
11723                 esac
11724                 echo "Prototype: $try" ;;
11725         esac
11726         ;;
11727         *)      case "$usethreads" in
11728                 define) echo "endhostent_r has no prototype, not using it." >&4 ;;
11729                 esac
11730                 d_endhostent_r=undef
11731                 endhostent_r_proto=0
11732                 ;;
11733         esac
11734         ;;
11735 *)      endhostent_r_proto=0
11736         ;;
11737 esac
11738
11739 : see if endnetent exists
11740 set endnetent d_endnent
11741 eval $inlibc
11742
11743 : see if endnetent_r exists
11744 set endnetent_r d_endnetent_r
11745 eval $inlibc
11746 case "$d_endnetent_r" in
11747 "$define")
11748         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11749         case "$d_endnetent_r_proto:$usethreads" in
11750         ":define")      d_endnetent_r_proto=define
11751                 set d_endnetent_r_proto endnetent_r $hdrs
11752                 eval $hasproto ;;
11753         *)      ;;
11754         esac
11755         case "$d_endnetent_r_proto" in
11756         define)
11757         case "$endnetent_r_proto" in
11758         ''|0) try='int endnetent_r(struct netent_data*);'
11759         ./protochk "extern $try" $hdrs && endnetent_r_proto=I_D ;;
11760         esac
11761         case "$endnetent_r_proto" in
11762         ''|0) try='void endnetent_r(struct netent_data*);'
11763         ./protochk "extern $try" $hdrs && endnetent_r_proto=V_D ;;
11764         esac
11765         case "$endnetent_r_proto" in
11766         ''|0)   d_endnetent_r=undef
11767                 endnetent_r_proto=0
11768                 echo "Disabling endnetent_r, cannot determine prototype." >&4 ;;
11769         * )     case "$endnetent_r_proto" in
11770                 REENTRANT_PROTO*) ;;
11771                 *) endnetent_r_proto="REENTRANT_PROTO_$endnetent_r_proto" ;;
11772                 esac
11773                 echo "Prototype: $try" ;;
11774         esac
11775         ;;
11776         *)      case "$usethreads" in
11777                 define) echo "endnetent_r has no prototype, not using it." >&4 ;;
11778                 esac
11779                 d_endnetent_r=undef
11780                 endnetent_r_proto=0
11781                 ;;
11782         esac
11783         ;;
11784 *)      endnetent_r_proto=0
11785         ;;
11786 esac
11787
11788 : see if endprotoent exists
11789 set endprotoent d_endpent
11790 eval $inlibc
11791
11792 : see if endprotoent_r exists
11793 set endprotoent_r d_endprotoent_r
11794 eval $inlibc
11795 case "$d_endprotoent_r" in
11796 "$define")
11797         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11798         case "$d_endprotoent_r_proto:$usethreads" in
11799         ":define")      d_endprotoent_r_proto=define
11800                 set d_endprotoent_r_proto endprotoent_r $hdrs
11801                 eval $hasproto ;;
11802         *)      ;;
11803         esac
11804         case "$d_endprotoent_r_proto" in
11805         define)
11806         case "$endprotoent_r_proto" in
11807         ''|0) try='int endprotoent_r(struct protoent_data*);'
11808         ./protochk "extern $try" $hdrs && endprotoent_r_proto=I_D ;;
11809         esac
11810         case "$endprotoent_r_proto" in
11811         ''|0) try='void endprotoent_r(struct protoent_data*);'
11812         ./protochk "extern $try" $hdrs && endprotoent_r_proto=V_D ;;
11813         esac
11814         case "$endprotoent_r_proto" in
11815         ''|0)   d_endprotoent_r=undef
11816                 endprotoent_r_proto=0
11817                 echo "Disabling endprotoent_r, cannot determine prototype." >&4 ;;
11818         * )     case "$endprotoent_r_proto" in
11819                 REENTRANT_PROTO*) ;;
11820                 *) endprotoent_r_proto="REENTRANT_PROTO_$endprotoent_r_proto" ;;
11821                 esac
11822                 echo "Prototype: $try" ;;
11823         esac
11824         ;;
11825         *)      case "$usethreads" in
11826                 define) echo "endprotoent_r has no prototype, not using it." >&4 ;;
11827                 esac
11828                 d_endprotoent_r=undef
11829                 endprotoent_r_proto=0
11830                 ;;
11831         esac
11832         ;;
11833 *)      endprotoent_r_proto=0
11834         ;;
11835 esac
11836
11837 : see if endpwent exists
11838 set endpwent d_endpwent
11839 eval $inlibc
11840
11841 : see if this is a pwd.h system
11842 set pwd.h i_pwd
11843 eval $inhdr
11844
11845 case "$i_pwd" in
11846 $define)
11847         xxx=`./findhdr pwd.h`
11848         $cppstdin $cppflags $cppminus < $xxx >$$.h
11849
11850         if $contains 'pw_quota' $$.h >/dev/null 2>&1; then
11851                 val="$define"
11852         else
11853                 val="$undef"
11854         fi
11855         set d_pwquota
11856         eval $setvar
11857
11858         if $contains 'pw_age' $$.h >/dev/null 2>&1; then
11859                 val="$define"
11860         else
11861                 val="$undef"
11862         fi
11863         set d_pwage
11864         eval $setvar
11865
11866         if $contains 'pw_change' $$.h >/dev/null 2>&1; then
11867                 val="$define"
11868         else
11869                 val="$undef"
11870         fi
11871         set d_pwchange
11872         eval $setvar
11873
11874         if $contains 'pw_class' $$.h >/dev/null 2>&1; then
11875                 val="$define"
11876         else
11877                 val="$undef"
11878         fi
11879         set d_pwclass
11880         eval $setvar
11881
11882         if $contains 'pw_expire' $$.h >/dev/null 2>&1; then
11883                 val="$define"
11884         else
11885                 val="$undef"
11886         fi
11887         set d_pwexpire
11888         eval $setvar
11889
11890         if $contains 'pw_comment' $$.h >/dev/null 2>&1; then
11891                 val="$define"
11892         else
11893                 val="$undef"
11894         fi
11895         set d_pwcomment
11896         eval $setvar
11897
11898         if $contains 'pw_gecos' $$.h >/dev/null 2>&1; then
11899                 val="$define"
11900         else
11901                 val="$undef"
11902         fi
11903         set d_pwgecos
11904         eval $setvar
11905
11906         if $contains 'pw_passwd' $$.h >/dev/null 2>&1; then
11907                 val="$define"
11908         else
11909                 val="$undef"
11910         fi
11911         set d_pwpasswd
11912         eval $setvar
11913
11914         $rm -f $$.h
11915         ;;
11916 *)
11917         val="$undef"; 
11918         set d_pwquota; eval $setvar
11919         set d_pwage; eval $setvar
11920         set d_pwchange; eval $setvar
11921         set d_pwclass; eval $setvar
11922         set d_pwexpire; eval $setvar
11923         set d_pwcomment; eval $setvar
11924         set d_pwgecos; eval $setvar
11925         set d_pwpasswd; eval $setvar
11926         ;;
11927 esac
11928
11929 : see if endpwent_r exists
11930 set endpwent_r d_endpwent_r
11931 eval $inlibc
11932 case "$d_endpwent_r" in
11933 "$define")
11934         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
11935         case "$d_endpwent_r_proto:$usethreads" in
11936         ":define")      d_endpwent_r_proto=define
11937                 set d_endpwent_r_proto endpwent_r $hdrs
11938                 eval $hasproto ;;
11939         *)      ;;
11940         esac
11941         case "$d_endpwent_r_proto" in
11942         define)
11943         case "$endpwent_r_proto" in
11944         ''|0) try='int endpwent_r(FILE**);'
11945         ./protochk "extern $try" $hdrs && endpwent_r_proto=I_H ;;
11946         esac
11947         case "$endpwent_r_proto" in
11948         ''|0) try='void endpwent_r(FILE**);'
11949         ./protochk "extern $try" $hdrs && endpwent_r_proto=V_H ;;
11950         esac
11951         case "$endpwent_r_proto" in
11952         ''|0)   d_endpwent_r=undef
11953                 endpwent_r_proto=0
11954                 echo "Disabling endpwent_r, cannot determine prototype." >&4 ;;
11955         * )     case "$endpwent_r_proto" in
11956                 REENTRANT_PROTO*) ;;
11957                 *) endpwent_r_proto="REENTRANT_PROTO_$endpwent_r_proto" ;;
11958                 esac
11959                 echo "Prototype: $try" ;;
11960         esac
11961         ;;
11962         *)      case "$usethreads" in
11963                 define) echo "endpwent_r has no prototype, not using it." >&4 ;;
11964                 esac
11965                 d_endpwent_r=undef
11966                 endpwent_r_proto=0
11967                 ;;
11968         esac
11969         ;;
11970 *)      endpwent_r_proto=0
11971         ;;
11972 esac
11973
11974 : see if endservent exists
11975 set endservent d_endsent
11976 eval $inlibc
11977
11978 : see if endservent_r exists
11979 set endservent_r d_endservent_r
11980 eval $inlibc
11981 case "$d_endservent_r" in
11982 "$define")
11983         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
11984         case "$d_endservent_r_proto:$usethreads" in
11985         ":define")      d_endservent_r_proto=define
11986                 set d_endservent_r_proto endservent_r $hdrs
11987                 eval $hasproto ;;
11988         *)      ;;
11989         esac
11990         case "$d_endservent_r_proto" in
11991         define)
11992         case "$endservent_r_proto" in
11993         ''|0) try='int endservent_r(struct servent_data*);'
11994         ./protochk "extern $try" $hdrs && endservent_r_proto=I_D ;;
11995         esac
11996         case "$endservent_r_proto" in
11997         ''|0) try='void endservent_r(struct servent_data*);'
11998         ./protochk "extern $try" $hdrs && endservent_r_proto=V_D ;;
11999         esac
12000         case "$endservent_r_proto" in
12001         ''|0)   d_endservent_r=undef
12002                 endservent_r_proto=0
12003                 echo "Disabling endservent_r, cannot determine prototype." >&4 ;;
12004         * )     case "$endservent_r_proto" in
12005                 REENTRANT_PROTO*) ;;
12006                 *) endservent_r_proto="REENTRANT_PROTO_$endservent_r_proto" ;;
12007                 esac
12008                 echo "Prototype: $try" ;;
12009         esac
12010         ;;
12011         *)      case "$usethreads" in
12012                 define) echo "endservent_r has no prototype, not using it." >&4 ;;
12013                 esac
12014                 d_endservent_r=undef
12015                 endservent_r_proto=0
12016                 ;;
12017         esac
12018         ;;
12019 *)      endservent_r_proto=0
12020         ;;
12021 esac
12022
12023 : Locate the flags for 'open()'
12024 echo " "
12025 $cat >try.c <<EOCP
12026 #include <sys/types.h>
12027 #ifdef I_FCNTL
12028 #include <fcntl.h>
12029 #endif
12030 #ifdef I_SYS_FILE
12031 #include <sys/file.h>
12032 #endif
12033 #$i_stdlib I_STDLIB
12034 #ifdef I_STDLIB
12035 #include <stdlib.h>
12036 #endif
12037 int main() {
12038         if(O_RDONLY);
12039 #ifdef O_TRUNC
12040         exit(0);
12041 #else
12042         exit(1);
12043 #endif
12044 }
12045 EOCP
12046 : check sys/file.h first to get FREAD on Sun
12047 if $test `./findhdr sys/file.h` && \
12048                 set try -DI_SYS_FILE && eval $compile; then
12049         h_sysfile=true;
12050         echo "<sys/file.h> defines the O_* constants..." >&4
12051         if $run ./try; then
12052                 echo "and you have the 3 argument form of open()." >&4
12053                 val="$define"
12054         else
12055                 echo "but not the 3 argument form of open().  Oh, well." >&4
12056                 val="$undef"
12057         fi
12058 elif $test `./findhdr fcntl.h` && \
12059                 set try -DI_FCNTL && eval $compile; then
12060         h_fcntl=true;
12061         echo "<fcntl.h> defines the O_* constants..." >&4
12062         if $run ./try; then
12063                 echo "and you have the 3 argument form of open()." >&4
12064                 val="$define"
12065         else
12066                 echo "but not the 3 argument form of open().  Oh, well." >&4
12067                 val="$undef"
12068         fi
12069 else
12070         val="$undef"
12071         echo "I can't find the O_* constant definitions!  You got problems." >&4
12072 fi
12073 set d_open3
12074 eval $setvar
12075 $rm -f try try.*
12076
12077 : see which of string.h or strings.h is needed
12078 echo " "
12079 strings=`./findhdr string.h`
12080 if $test "$strings" && $test -r "$strings"; then
12081         echo "Using <string.h> instead of <strings.h>." >&4
12082         val="$define"
12083 else
12084         val="$undef"
12085         strings=`./findhdr strings.h`
12086         if $test "$strings" && $test -r "$strings"; then
12087                 echo "Using <strings.h> instead of <string.h>." >&4
12088         else
12089                 echo "No string header found -- You'll surely have problems." >&4
12090         fi
12091 fi
12092 set i_string
12093 eval $setvar
12094 case "$i_string" in
12095 "$undef") strings=`./findhdr strings.h`;;
12096 *)        strings=`./findhdr string.h`;;
12097 esac
12098
12099 : see if this is a sys/file.h system
12100 val=''
12101 set sys/file.h val
12102 eval $inhdr
12103
12104 : do we need to include sys/file.h ?
12105 case "$val" in
12106 "$define")
12107         echo " "
12108         if $h_sysfile; then
12109                 val="$define"
12110                 echo "We'll be including <sys/file.h>." >&4
12111         else
12112                 val="$undef"
12113                 echo "We won't be including <sys/file.h>." >&4
12114         fi
12115         ;;
12116 *)
12117         h_sysfile=false
12118         ;;
12119 esac
12120 set i_sysfile
12121 eval $setvar
12122
12123 : see if fcntl.h is there
12124 val=''
12125 set fcntl.h val
12126 eval $inhdr
12127
12128 : see if we can include fcntl.h
12129 case "$val" in
12130 "$define")
12131         echo " "
12132         if $h_fcntl; then
12133                 val="$define"
12134                 echo "We'll be including <fcntl.h>." >&4
12135         else
12136                 val="$undef"
12137                 if $h_sysfile; then
12138         echo "We don't need to include <fcntl.h> if we include <sys/file.h>." >&4
12139                 else
12140                         echo "We won't be including <fcntl.h>." >&4
12141                 fi
12142         fi
12143         ;;
12144 *)
12145         h_fcntl=false
12146         val="$undef"
12147         ;;
12148 esac
12149 set i_fcntl
12150 eval $setvar
12151
12152 : check for non-blocking I/O stuff
12153 case "$h_sysfile" in
12154 true) echo "#include <sys/file.h>" > head.c;;
12155 *)
12156        case "$h_fcntl" in
12157        true) echo "#include <fcntl.h>" > head.c;;
12158        *) echo "#include <sys/fcntl.h>" > head.c;;
12159        esac
12160        ;;
12161 esac
12162 echo " "
12163 echo "Figuring out the flag used by open() for non-blocking I/O..." >&4
12164 case "$o_nonblock" in
12165 '')
12166         $cat head.c > try.c
12167         $cat >>try.c <<EOCP
12168 #include <stdio.h>
12169 #$i_stdlib I_STDLIB
12170 #ifdef I_STDLIB
12171 #include <stdlib.h>
12172 #endif
12173 #$i_fcntl I_FCNTL
12174 #ifdef I_FCNTL
12175 #include <fcntl.h>
12176 #endif
12177 int main() {
12178 #ifdef O_NONBLOCK
12179         printf("O_NONBLOCK\n");
12180         exit(0);
12181 #endif
12182 #ifdef O_NDELAY
12183         printf("O_NDELAY\n");
12184         exit(0);
12185 #endif
12186 #ifdef FNDELAY
12187         printf("FNDELAY\n");
12188         exit(0);
12189 #endif
12190         exit(0);
12191 }
12192 EOCP
12193         set try
12194         if eval $compile_ok; then
12195                 o_nonblock=`$run ./try`
12196                 case "$o_nonblock" in
12197                 '') echo "I can't figure it out, assuming O_NONBLOCK will do.";;
12198                 *) echo "Seems like we can use $o_nonblock.";;
12199                 esac
12200         else
12201                 echo "(I can't compile the test program; pray O_NONBLOCK is right!)"
12202         fi
12203         ;;
12204 *) echo "Using $hint value $o_nonblock.";;
12205 esac
12206 $rm -f try try.* .out core
12207
12208 echo " "
12209 echo "Let's see what value errno gets from read() on a $o_nonblock file..." >&4
12210 case "$eagain" in
12211 '')
12212         $cat head.c > try.c
12213         $cat >>try.c <<EOCP
12214 #include <errno.h>
12215 #include <sys/types.h>
12216 #include <signal.h>
12217 #include <stdio.h> 
12218 #$i_stdlib I_STDLIB
12219 #ifdef I_STDLIB
12220 #include <stdlib.h>
12221 #endif
12222 #$i_fcntl I_FCNTL
12223 #ifdef I_FCNTL
12224 #include <fcntl.h>
12225 #endif
12226 #define MY_O_NONBLOCK $o_nonblock
12227 #ifndef errno  /* XXX need better Configure test */
12228 extern int errno;
12229 #endif
12230 #$i_unistd I_UNISTD
12231 #ifdef I_UNISTD
12232 #include <unistd.h>
12233 #endif
12234 #$i_string I_STRING
12235 #ifdef I_STRING
12236 #include <string.h>
12237 #else
12238 #include <strings.h>
12239 #endif
12240 $signal_t blech(int x) { exit(3); }
12241 EOCP
12242         $cat >> try.c <<'EOCP'
12243 int main()
12244 {
12245         int pd[2];
12246         int pu[2];
12247         char buf[1];
12248         char string[100];
12249
12250         pipe(pd);       /* Down: child -> parent */
12251         pipe(pu);       /* Up: parent -> child */
12252         if (0 != fork()) {
12253                 int ret;
12254                 close(pd[1]);   /* Parent reads from pd[0] */
12255                 close(pu[0]);   /* Parent writes (blocking) to pu[1] */
12256 #ifdef F_SETFL
12257                 if (-1 == fcntl(pd[0], F_SETFL, MY_O_NONBLOCK))
12258                         exit(1);
12259 #else
12260                 exit(4);
12261 #endif
12262                 signal(SIGALRM, blech);
12263                 alarm(5);
12264                 if ((ret = read(pd[0], buf, 1)) > 0)    /* Nothing to read! */
12265                         exit(2);
12266                 sprintf(string, "%d\n", ret);
12267                 write(2, string, strlen(string));
12268                 alarm(0);
12269 #ifdef EAGAIN
12270                 if (errno == EAGAIN) {
12271                         printf("EAGAIN\n");
12272                         goto ok;
12273                 }
12274 #endif
12275 #ifdef EWOULDBLOCK
12276                 if (errno == EWOULDBLOCK)
12277                         printf("EWOULDBLOCK\n");
12278 #endif
12279         ok:
12280                 write(pu[1], buf, 1);   /* Unblocks child, tell it to close our pipe */
12281                 sleep(2);                               /* Give it time to close our pipe */
12282                 alarm(5);
12283                 ret = read(pd[0], buf, 1);      /* Should read EOF */
12284                 alarm(0);
12285                 sprintf(string, "%d\n", ret);
12286                 write(4, string, strlen(string));
12287                 exit(0);
12288         }
12289
12290         close(pd[0]);                   /* We write to pd[1] */
12291         close(pu[1]);                   /* We read from pu[0] */
12292         read(pu[0], buf, 1);    /* Wait for parent to signal us we may continue */
12293         close(pd[1]);                   /* Pipe pd is now fully closed! */
12294         exit(0);                                /* Bye bye, thank you for playing! */
12295 }
12296 EOCP
12297         set try
12298         if eval $compile_ok; then
12299                 echo "$startsh" >mtry
12300                 echo "$run ./try >try.out 2>try.ret 4>try.err || exit 4" >>mtry
12301                 chmod +x mtry
12302                 ./mtry >/dev/null 2>&1
12303                 case $? in
12304                 0) eagain=`$cat try.out`;;
12305                 1) echo "Could not perform non-blocking setting!";;
12306                 2) echo "I did a successful read() for something that was not there!";;
12307                 3) echo "Hmm... non-blocking I/O does not seem to be working!";;
12308                 4) echo "Could not find F_SETFL!";;
12309                 *) echo "Something terribly wrong happened during testing.";;
12310                 esac
12311                 rd_nodata=`$cat try.ret`
12312                 echo "A read() system call with no data present returns $rd_nodata."
12313                 case "$rd_nodata" in
12314                 0|-1) ;;
12315                 *)
12316                         echo "(That's peculiar, fixing that to be -1.)"
12317                         rd_nodata=-1
12318                         ;;
12319                 esac
12320                 case "$eagain" in
12321                 '')
12322                         echo "Forcing errno EAGAIN on read() with no data available."
12323                         eagain=EAGAIN
12324                         ;;
12325                 *)
12326                         echo "Your read() sets errno to $eagain when no data is available."
12327                         ;;
12328                 esac
12329                 status=`$cat try.err`
12330                 case "$status" in
12331                 0) echo "And it correctly returns 0 to signal EOF.";;
12332                 -1) echo "But it also returns -1 to signal EOF, so be careful!";;
12333                 *) echo "However, your read() returns '$status' on EOF??";;
12334                 esac
12335                 val="$define"
12336                 if test "$status" = "$rd_nodata"; then
12337                         echo "WARNING: you can't distinguish between EOF and no data!"
12338                         val="$undef"
12339                 fi
12340         else
12341                 echo "I can't compile the test program--assuming errno EAGAIN will do."
12342                 eagain=EAGAIN
12343         fi
12344         set d_eofnblk
12345         eval $setvar
12346         ;;
12347 *)
12348         echo "Using $hint value $eagain."
12349         echo "Your read() returns $rd_nodata when no data is present."
12350         case "$d_eofnblk" in
12351         "$define") echo "And you can see EOF because read() returns 0.";;
12352         "$undef") echo "But you can't see EOF status from read() returned value.";;
12353         *)
12354                 echo "(Assuming you can't see EOF status from read anyway.)"
12355                 d_eofnblk=$undef
12356                 ;;
12357         esac
12358         ;;
12359 esac
12360 $rm -f try try.* .out core head.c mtry
12361
12362 : see if _ptr and _cnt from stdio act std
12363 echo " "
12364
12365 if $contains '_lbfsize' `./findhdr stdio.h` >/dev/null 2>&1 ; then
12366         echo "(Looks like you have stdio.h from BSD.)"
12367         case "$stdio_ptr" in
12368         '') stdio_ptr='((fp)->_p)'
12369                 ptr_lval=$define
12370                 ;;
12371         *)      ptr_lval=$d_stdio_ptr_lval;;
12372         esac
12373         case "$stdio_cnt" in
12374         '') stdio_cnt='((fp)->_r)'
12375                 cnt_lval=$define
12376                 ;;
12377         *)      cnt_lval=$d_stdio_cnt_lval;;
12378         esac
12379         case "$stdio_base" in
12380         '') stdio_base='((fp)->_ub._base ? (fp)->_ub._base : (fp)->_bf._base)';;
12381         esac
12382         case "$stdio_bufsiz" in
12383         '') stdio_bufsiz='((fp)->_ub._base ? (fp)->_ub._size : (fp)->_bf._size)';;
12384         esac
12385 elif $contains '_IO_fpos_t' `./findhdr stdio.h` `./findhdr libio.h` >/dev/null 2>&1 ; then
12386         echo "(Looks like you have stdio.h from Linux.)"
12387         case "$stdio_ptr" in
12388         '') stdio_ptr='((fp)->_IO_read_ptr)'
12389                 ptr_lval=$define
12390                 ;;
12391         *)      ptr_lval=$d_stdio_ptr_lval;;
12392         esac
12393         case "$stdio_cnt" in
12394         '') stdio_cnt='((fp)->_IO_read_end - (fp)->_IO_read_ptr)'
12395                 cnt_lval=$undef
12396                 ;;
12397         *)      cnt_lval=$d_stdio_cnt_lval;;
12398         esac
12399         case "$stdio_base" in
12400         '') stdio_base='((fp)->_IO_read_base)';;
12401         esac
12402         case "$stdio_bufsiz" in
12403         '') stdio_bufsiz='((fp)->_IO_read_end - (fp)->_IO_read_base)';;
12404         esac
12405 else
12406         case "$stdio_ptr" in
12407         '') stdio_ptr='((fp)->_ptr)'
12408                 ptr_lval=$define
12409                 ;;
12410         *)      ptr_lval=$d_stdio_ptr_lval;;
12411         esac
12412         case "$stdio_cnt" in
12413         '') stdio_cnt='((fp)->_cnt)'
12414                 cnt_lval=$define
12415                 ;;
12416         *)      cnt_lval=$d_stdio_cnt_lval;;
12417         esac
12418         case "$stdio_base" in
12419         '') stdio_base='((fp)->_base)';;
12420         esac
12421         case "$stdio_bufsiz" in
12422         '') stdio_bufsiz='((fp)->_cnt + (fp)->_ptr - (fp)->_base)';;
12423         esac
12424 fi
12425
12426 : test whether _ptr and _cnt really work
12427 echo "Checking how std your stdio is..." >&4
12428 $cat >try.c <<EOP
12429 #include <stdio.h>
12430 #$i_stdlib I_STDLIB
12431 #ifdef I_STDLIB
12432 #include <stdlib.h>
12433 #endif
12434 #define FILE_ptr(fp)    $stdio_ptr
12435 #define FILE_cnt(fp)    $stdio_cnt
12436 int main() {
12437         FILE *fp = fopen("try.c", "r");
12438         char c = getc(fp);
12439         if (
12440                 18 <= FILE_cnt(fp) &&
12441                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12442         )
12443                 exit(0);
12444         exit(1);
12445 }
12446 EOP
12447 val="$undef"
12448 set try
12449 if eval $compile && $to try.c; then
12450         if $run ./try; then
12451                 echo "Your stdio acts pretty std."
12452                 val="$define"
12453         else
12454                 echo "Your stdio isn't very std."
12455         fi
12456 else
12457         echo "Your stdio doesn't appear very std."
12458 fi
12459 $rm -f try.c try
12460
12461 # glibc 2.2.90 and above apparently change stdio streams so Perl's
12462 # direct buffer manipulation no longer works.  The Configure tests
12463 # should be changed to correctly detect this, but until then,
12464 # the following check should at least let perl compile and run.
12465 # (This quick fix should be updated before 5.8.1.)
12466 # To be defensive, reject all unknown versions, and all versions  > 2.2.9.
12467 # A. Dougherty, June 3, 2002.
12468 case "$d_gnulibc" in
12469 $define)
12470         case "$gnulibc_version" in
12471         2.[01]*)  ;;
12472         2.2) ;;
12473         2.2.[0-9]) ;;
12474         *)  echo "But I will not snoop inside glibc $gnulibc_version stdio buffers."
12475                 val="$undef"
12476                 ;;
12477         esac
12478         ;;
12479 esac
12480 set d_stdstdio
12481 eval $setvar
12482
12483 : Can _ptr be used as an lvalue?
12484 case "$d_stdstdio$ptr_lval" in
12485 $define$define) val=$define ;;
12486 *) val=$undef ;;
12487 esac
12488 set d_stdio_ptr_lval
12489 eval $setvar
12490
12491 : Can _cnt be used as an lvalue?
12492 case "$d_stdstdio$cnt_lval" in
12493 $define$define) val=$define ;;
12494 *) val=$undef ;;
12495 esac
12496 set d_stdio_cnt_lval
12497 eval $setvar
12498
12499
12500 : test whether setting _ptr sets _cnt as a side effect
12501 d_stdio_ptr_lval_sets_cnt="$undef"
12502 d_stdio_ptr_lval_nochange_cnt="$undef"
12503 case "$d_stdio_ptr_lval$d_stdstdio" in
12504 $define$define)
12505         echo "Checking to see what happens if we set the stdio ptr..." >&4
12506 $cat >try.c <<EOP
12507 #include <stdio.h>
12508 /* Can we scream? */
12509 /* Eat dust sed :-) */
12510 /* In the buffer space, no one can hear you scream. */
12511 #$i_stdlib I_STDLIB
12512 #ifdef I_STDLIB
12513 #include <stdlib.h>
12514 #endif
12515 #define FILE_ptr(fp)    $stdio_ptr
12516 #define FILE_cnt(fp)    $stdio_cnt
12517 #include <sys/types.h>
12518 int main() {
12519         FILE *fp = fopen("try.c", "r");
12520         int c;
12521         char *ptr;
12522         size_t cnt;
12523         if (!fp) {
12524             puts("Fail even to read");
12525             exit(1);
12526         }
12527         c = getc(fp); /* Read away the first # */
12528         if (c == EOF) {
12529             puts("Fail even to read");
12530             exit(1);
12531         }
12532         if (!(
12533                 18 <= FILE_cnt(fp) &&
12534                 strncmp(FILE_ptr(fp), "include <stdio.h>\n", 18) == 0
12535         )) {
12536                 puts("Fail even to read");
12537                 exit (1);
12538         }
12539         ptr = (char*) FILE_ptr(fp);
12540         cnt = (size_t)FILE_cnt(fp);
12541
12542         FILE_ptr(fp) += 42;
12543
12544         if ((char*)FILE_ptr(fp) != (ptr + 42)) {
12545                 printf("Fail ptr check %p != %p", FILE_ptr(fp), (ptr + 42));
12546                 exit (1);
12547         }
12548         if (FILE_cnt(fp) <= 20) {
12549                 printf ("Fail (<20 chars to test)");
12550                 exit (1);
12551         }
12552         if (strncmp(FILE_ptr(fp), "Eat dust sed :-) */\n", 20) != 0) {
12553                 puts("Fail compare");
12554                 exit (1);
12555         }
12556         if (cnt == FILE_cnt(fp)) {
12557                 puts("Pass_unchanged");
12558                 exit (0);
12559         }       
12560         if (FILE_cnt(fp) == (cnt - 42)) {
12561                 puts("Pass_changed");
12562                 exit (0);
12563         }
12564         printf("Fail count was %d now %d\n", cnt, FILE_cnt(fp));
12565         return 1;
12566
12567 }
12568 EOP
12569         set try
12570         if eval $compile && $to try.c; then
12571                 case `$run ./try` in
12572                 Pass_changed)
12573                         echo "Increasing ptr in your stdio decreases cnt by the same amount.  Good." >&4
12574                         d_stdio_ptr_lval_sets_cnt="$define" ;;
12575                 Pass_unchanged)
12576                         echo "Increasing ptr in your stdio leaves cnt unchanged.  Good." >&4
12577                         d_stdio_ptr_lval_nochange_cnt="$define" ;;
12578                 Fail*)
12579                         echo "Increasing ptr in your stdio didn't do exactly what I expected.  We'll not be doing that then." >&4 ;;
12580                 *)
12581                         echo "It appears attempting to set ptr in your stdio is a bad plan." >&4 ;;
12582         esac
12583         else
12584                 echo "It seems we can't set ptr in your stdio.  Nevermind." >&4
12585         fi
12586         $rm -f try.c try
12587         ;;
12588 esac
12589
12590 : see if _base is also standard
12591 val="$undef"
12592 case "$d_stdstdio" in
12593 $define)
12594         $cat >try.c <<EOP
12595 #include <stdio.h>
12596 #$i_stdlib I_STDLIB
12597 #ifdef I_STDLIB
12598 #include <stdlib.h>
12599 #endif
12600 #define FILE_base(fp)   $stdio_base
12601 #define FILE_bufsiz(fp) $stdio_bufsiz
12602 int main() {
12603         FILE *fp = fopen("try.c", "r");
12604         char c = getc(fp);
12605         if (
12606                 19 <= FILE_bufsiz(fp) &&
12607                 strncmp(FILE_base(fp), "#include <stdio.h>\n", 19) == 0
12608         )
12609                 exit(0);
12610         exit(1);
12611 }
12612 EOP
12613         set try
12614         if eval $compile && $to try.c; then
12615                 if $run ./try; then
12616                         echo "And its _base field acts std."
12617                         val="$define"
12618                 else
12619                         echo "But its _base field isn't std."
12620                 fi
12621         else
12622                 echo "However, it seems to be lacking the _base field."
12623         fi
12624         $rm -f try.c try
12625         ;;
12626 esac
12627 set d_stdiobase
12628 eval $setvar
12629
12630 : see if fast_stdio exists
12631 val="$undef"
12632 case "$d_stdstdio:$d_stdio_ptr_lval" in
12633 "$define:$define")
12634         case "$d_stdio_cnt_lval$d_stdio_ptr_lval_sets_cnt" in
12635         *$define*)
12636                 echo "You seem to have 'fast stdio' to directly manipulate the stdio buffers." >& 4
12637                 val="$define"
12638                 ;;
12639         esac
12640         ;;
12641 esac
12642 set d_faststdio
12643 eval $setvar
12644
12645
12646
12647 : see if fchdir exists
12648 set fchdir d_fchdir
12649 eval $inlibc
12650
12651 : see if fchmod exists
12652 set fchmod d_fchmod
12653 eval $inlibc
12654
12655 : see if fchown exists
12656 set fchown d_fchown
12657 eval $inlibc
12658
12659 : see if this is an fcntl system
12660 set fcntl d_fcntl
12661 eval $inlibc
12662
12663 echo " "
12664 : See if fcntl-based locking works.
12665 $cat >try.c <<EOCP
12666 #$i_stdlib I_STDLIB
12667 #ifdef I_STDLIB
12668 #include <stdlib.h>
12669 #endif
12670 #include <unistd.h>
12671 #include <fcntl.h>
12672 #include <signal.h>
12673 $signal_t blech(int x) { exit(3); }
12674 int main() {
12675 #if defined(F_SETLK) && defined(F_SETLKW)
12676      struct flock flock;
12677      int retval, fd;
12678      fd = open("try.c", O_RDONLY);
12679      flock.l_type = F_RDLCK;
12680      flock.l_whence = SEEK_SET;
12681      flock.l_start = flock.l_len = 0;
12682      signal(SIGALRM, blech);
12683      alarm(10);
12684      retval = fcntl(fd, F_SETLK, &flock);
12685      close(fd);
12686      (retval < 0 ? exit(2) : exit(0));
12687 #else
12688      exit(2);
12689 #endif
12690 }
12691 EOCP
12692 echo "Checking if fcntl-based file locking works... "
12693 case "$d_fcntl" in
12694 "$define")
12695         set try
12696         if eval $compile_ok; then
12697                 if $run ./try; then
12698                         echo "Yes, it seems to work."
12699                         val="$define"
12700                 else
12701                         echo "Nope, it didn't work."
12702                         val="$undef"
12703                         case "$?" in
12704                         3) $cat >&4 <<EOM
12705 ***
12706 *** I had to forcibly timeout from fcntl(..., F_SETLK, ...).
12707 *** This is (almost) impossible.
12708 *** If your NFS lock daemons are not feeling well, something like
12709 *** this may happen, please investigate.  Cannot continue, aborting.
12710 ***
12711 EOM
12712                                 exit 1
12713                                 ;;
12714                         esac
12715                 fi
12716         else
12717                 echo "I'm unable to compile the test program, so I'll assume not."
12718                 val="$undef"
12719         fi
12720         ;;
12721 *) val="$undef";
12722         echo "Nope, since you don't even have fcntl()."
12723         ;;
12724 esac
12725 set d_fcntl_can_lock
12726 eval $setvar
12727 $rm -f try*
12728
12729
12730 : check for fd_set items
12731 $cat <<EOM
12732
12733 Checking to see how well your C compiler handles fd_set and friends ...
12734 EOM
12735 $cat >try.c <<EOCP
12736 #$i_stdlib I_STDLIB
12737 #ifdef I_STDLIB
12738 #include <stdlib.h>
12739 #endif
12740 #$i_systime I_SYS_TIME
12741 #$i_sysselct I_SYS_SELECT
12742 #$d_socket HAS_SOCKET
12743 #include <sys/types.h>
12744 #ifdef HAS_SOCKET
12745 #include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
12746 #endif
12747 #ifdef I_SYS_TIME
12748 #include <sys/time.h>
12749 #endif
12750 #ifdef I_SYS_SELECT
12751 #include <sys/select.h>
12752 #endif
12753 int main() {
12754         fd_set fds;
12755
12756 #ifdef TRYBITS
12757         if(fds.fds_bits);
12758 #endif
12759
12760 #if defined(FD_SET) && defined(FD_CLR) && defined(FD_ISSET) && defined(FD_ZERO)
12761         exit(0);
12762 #else
12763         exit(1);
12764 #endif
12765 }
12766 EOCP
12767 set try -DTRYBITS
12768 if eval $compile; then
12769         d_fds_bits="$define"
12770         d_fd_set="$define"
12771         echo "Well, your system knows about the normal fd_set typedef..." >&4
12772         if $run ./try; then
12773                 echo "and you have the normal fd_set macros (just as I'd expect)." >&4
12774                 d_fd_macros="$define"
12775         else
12776                 $cat >&4 <<'EOM'
12777 but not the normal fd_set macros!  Gaaack!  I'll have to cover for you.
12778 EOM
12779                 d_fd_macros="$undef"
12780         fi
12781 else
12782         $cat <<'EOM'
12783 Hmm, your compiler has some difficulty with fd_set.  Checking further...
12784 EOM
12785         set try
12786         if eval $compile; then
12787                 d_fds_bits="$undef"
12788                 d_fd_set="$define"
12789                 echo "Well, your system has some sort of fd_set available..." >&4
12790                 if $run ./try; then
12791                         echo "and you have the normal fd_set macros." >&4
12792                         d_fd_macros="$define"
12793                 else
12794                         $cat <<'EOM'
12795 but not the normal fd_set macros!  Gross!  More work for me...
12796 EOM
12797                         d_fd_macros="$undef"
12798                 fi
12799         else
12800         echo "Well, you got zip.  That's OK, I can roll my own fd_set stuff." >&4
12801                 d_fd_set="$undef"
12802                 d_fds_bits="$undef"
12803                 d_fd_macros="$undef"
12804         fi
12805 fi
12806 $rm -f try try.*
12807
12808 : see if fgetpos exists
12809 set fgetpos d_fgetpos
12810 eval $inlibc
12811
12812 : see if finite exists
12813 set finite d_finite
12814 eval $inlibc
12815
12816 : see if finitel exists
12817 set finitel d_finitel
12818 eval $inlibc
12819
12820 : see if flock exists
12821 set flock d_flock
12822 eval $inlibc
12823
12824 : see if prototype for flock is available
12825 echo " "
12826 set d_flockproto flock $i_sysfile sys/file.h
12827 eval $hasproto
12828
12829 : see if fork exists
12830 set fork d_fork
12831 eval $inlibc
12832
12833 : see if fp_class exists
12834 set fp_class d_fp_class
12835 eval $inlibc
12836
12837 : see if pathconf exists
12838 set pathconf d_pathconf
12839 eval $inlibc
12840
12841 : see if fpathconf exists
12842 set fpathconf d_fpathconf
12843 eval $inlibc
12844
12845 : see if fpclass exists
12846 set fpclass d_fpclass
12847 eval $inlibc
12848
12849 : see if fpclassify exists
12850 set fpclassify d_fpclassify
12851 eval $inlibc
12852
12853 : see if fpclassl exists
12854 set fpclassl d_fpclassl
12855 eval $inlibc
12856
12857
12858 : check for fpos64_t
12859 echo " "
12860 echo "Checking to see if you have fpos64_t..." >&4
12861 $cat >try.c <<EOCP
12862 #include <stdio.h>
12863 int main() { fpos64_t x = 7; }
12864 EOCP
12865 set try
12866 if eval $compile; then
12867         val="$define"
12868         echo "You have fpos64_t."
12869 else
12870         val="$undef"
12871         echo "You do not have fpos64_t."
12872         case "$fpossize" in
12873         8) echo "(Your fpos_t is 64 bits, so you could use that.)" ;;
12874         esac
12875 fi
12876 $rm -f try.* try
12877 set d_fpos64_t
12878 eval $setvar
12879
12880 : see if frexpl exists
12881 set frexpl d_frexpl
12882 eval $inlibc
12883
12884 : see if this is a sys/param system
12885 set sys/param.h i_sysparam
12886 eval $inhdr
12887
12888 : see if this is a sys/mount.h system
12889 set sys/mount.h i_sysmount
12890 eval $inhdr
12891
12892
12893 echo " "
12894 echo "Checking to see if your system supports struct fs_data..." >&4
12895 set d_fs_data_s fs_data $i_systypes sys/types.h $i_sysparam sys/param.h $i_sysmount sys/mount.h
12896 eval $hasstruct
12897 case "$d_fs_data_s" in
12898 "$define")      echo "Yes, it does."   ;;
12899 *)              echo "No, it doesn't." ;;
12900 esac
12901
12902 : see if fseeko exists
12903 set fseeko d_fseeko
12904 eval $inlibc
12905 case "$longsize" in
12906 8) echo "(Your long is 64 bits, so you could use fseek.)" ;;
12907 esac
12908
12909 : see if fsetpos exists
12910 set fsetpos d_fsetpos
12911 eval $inlibc
12912
12913
12914 : see if fstatfs exists
12915 set fstatfs d_fstatfs
12916 eval $inlibc
12917
12918
12919 : see if statvfs exists
12920 set statvfs d_statvfs
12921 eval $inlibc
12922
12923 : see if fstatvfs exists
12924 set fstatvfs d_fstatvfs
12925 eval $inlibc
12926
12927
12928 : see if fsync exists
12929 set fsync d_fsync
12930 eval $inlibc
12931
12932 : see if ftello exists
12933 set ftello d_ftello
12934 eval $inlibc
12935 case "$longsize" in
12936 8) echo "(Your long is 64 bits, so you could use ftell.)" ;;
12937 esac
12938
12939 d_futimes="$undef"
12940 : check for a working futimes
12941 echo " "
12942 echo "Checking for a working futimes()" >&4
12943 $cat >try.c <<EOCP
12944 #include <stdio.h>
12945 #include <sys/time.h>
12946 #include <errno.h>
12947 #include <fcntl.h>
12948
12949 int main ()
12950 {
12951     int fd, rv;
12952     fd = open ("try.c", O_RDWR);
12953     if (-1 == fd) exit (1);
12954     rv = futimes (fd, NULL);
12955     exit (rv == -1 ? errno : 0);
12956 }
12957 EOCP
12958 set try
12959 if eval $compile; then
12960     `$run ./try`
12961     rc=$?
12962     case "$rc" in
12963         0)  echo "Yes, it does" >&4
12964             d_futimes="$define"
12965             ;;
12966         *)  echo "No, it has futimes, but it isn't working ($rc) (probably harmless)\n" >&4
12967             ;;
12968     esac
12969 else
12970     echo "No, it does not (probably harmless)\n" >&4
12971 fi
12972 $rm -f try.* try core core.try.*
12973
12974 : see if getcwd exists
12975 set getcwd d_getcwd
12976 eval $inlibc
12977
12978 : see if getespwnam exists
12979 set getespwnam d_getespwnam
12980 eval $inlibc
12981
12982
12983 : see if getfsstat exists
12984 set getfsstat d_getfsstat
12985 eval $inlibc
12986
12987 : see if getgrent exists
12988 set getgrent d_getgrent
12989 eval $inlibc
12990
12991 : see if getgrent_r exists
12992 set getgrent_r d_getgrent_r
12993 eval $inlibc
12994 case "$d_getgrent_r" in
12995 "$define")
12996         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
12997         case "$d_getgrent_r_proto:$usethreads" in
12998         ":define")      d_getgrent_r_proto=define
12999                 set d_getgrent_r_proto getgrent_r $hdrs
13000                 eval $hasproto ;;
13001         *)      ;;
13002         esac
13003         case "$d_getgrent_r_proto" in
13004         define)
13005         case "$getgrent_r_proto" in
13006         ''|0) try='int getgrent_r(struct group*, char*, size_t, struct group**);'
13007         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBWR ;;
13008         esac
13009         case "$getgrent_r_proto" in
13010         ''|0) try='int getgrent_r(struct group*, char*, int, struct group**);'
13011         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIR ;;
13012         esac
13013         case "$getgrent_r_proto" in
13014         ''|0) try='struct group* getgrent_r(struct group*, char*, size_t);'
13015         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBW ;;
13016         esac
13017         case "$getgrent_r_proto" in
13018         ''|0) try='struct group* getgrent_r(struct group*, char*, int);'
13019         ./protochk "extern $try" $hdrs && getgrent_r_proto=S_SBI ;;
13020         esac
13021         case "$getgrent_r_proto" in
13022         ''|0) try='int getgrent_r(struct group*, char*, int);'
13023         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBI ;;
13024         esac
13025         case "$getgrent_r_proto" in
13026         ''|0) try='int getgrent_r(struct group*, char*, int, FILE**);'
13027         ./protochk "extern $try" $hdrs && getgrent_r_proto=I_SBIH ;;
13028         esac
13029         case "$getgrent_r_proto" in
13030         ''|0)   d_getgrent_r=undef
13031                 getgrent_r_proto=0
13032                 echo "Disabling getgrent_r, cannot determine prototype." >&4 ;;
13033         * )     case "$getgrent_r_proto" in
13034                 REENTRANT_PROTO*) ;;
13035                 *) getgrent_r_proto="REENTRANT_PROTO_$getgrent_r_proto" ;;
13036                 esac
13037                 echo "Prototype: $try" ;;
13038         esac
13039         ;;
13040         *)      case "$usethreads" in
13041                 define) echo "getgrent_r has no prototype, not using it." >&4 ;;
13042                 esac
13043                 d_getgrent_r=undef
13044                 getgrent_r_proto=0
13045                 ;;
13046         esac
13047         ;;
13048 *)      getgrent_r_proto=0
13049         ;;
13050 esac
13051
13052 : see if getgrgid_r exists
13053 set getgrgid_r d_getgrgid_r
13054 eval $inlibc
13055 case "$d_getgrgid_r" in
13056 "$define")
13057         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13058         case "$d_getgrgid_r_proto:$usethreads" in
13059         ":define")      d_getgrgid_r_proto=define
13060                 set d_getgrgid_r_proto getgrgid_r $hdrs
13061                 eval $hasproto ;;
13062         *)      ;;
13063         esac
13064         case "$d_getgrgid_r_proto" in
13065         define)
13066         case "$getgrgid_r_proto" in
13067         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, size_t, struct group**);'
13068         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBWR ;;
13069         esac
13070         case "$getgrgid_r_proto" in
13071         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int, struct group**);'
13072         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBIR ;;
13073         esac
13074         case "$getgrgid_r_proto" in
13075         ''|0) try='int getgrgid_r(gid_t, struct group*, char*, int);'
13076         ./protochk "extern $try" $hdrs && getgrgid_r_proto=I_TSBI ;;
13077         esac
13078         case "$getgrgid_r_proto" in
13079         ''|0) try='struct group* getgrgid_r(gid_t, struct group*, char*, int);'
13080         ./protochk "extern $try" $hdrs && getgrgid_r_proto=S_TSBI ;;
13081         esac
13082         case "$getgrgid_r_proto" in
13083         ''|0)   d_getgrgid_r=undef
13084                 getgrgid_r_proto=0
13085                 echo "Disabling getgrgid_r, cannot determine prototype." >&4 ;;
13086         * )     case "$getgrgid_r_proto" in
13087                 REENTRANT_PROTO*) ;;
13088                 *) getgrgid_r_proto="REENTRANT_PROTO_$getgrgid_r_proto" ;;
13089                 esac
13090                 echo "Prototype: $try" ;;
13091         esac
13092         ;;
13093         *)      case "$usethreads" in
13094                 define) echo "getgrgid_r has no prototype, not using it." >&4 ;;
13095                 esac
13096                 d_getgrgid_r=undef
13097                 getgrgid_r_proto=0
13098                 ;;
13099         esac
13100         ;;
13101 *)      getgrgid_r_proto=0
13102         ;;
13103 esac
13104
13105 : see if getgrnam_r exists
13106 set getgrnam_r d_getgrnam_r
13107 eval $inlibc
13108 case "$d_getgrnam_r" in
13109 "$define")
13110         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
13111         case "$d_getgrnam_r_proto:$usethreads" in
13112         ":define")      d_getgrnam_r_proto=define
13113                 set d_getgrnam_r_proto getgrnam_r $hdrs
13114                 eval $hasproto ;;
13115         *)      ;;
13116         esac
13117         case "$d_getgrnam_r_proto" in
13118         define)
13119         case "$getgrnam_r_proto" in
13120         ''|0) try='int getgrnam_r(const char*, struct group*, char*, size_t, struct group**);'
13121         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBWR ;;
13122         esac
13123         case "$getgrnam_r_proto" in
13124         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int, struct group**);'
13125         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBIR ;;
13126         esac
13127         case "$getgrnam_r_proto" in
13128         ''|0) try='struct group* getgrnam_r(const char*, char*, int);'
13129         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CBI ;;
13130         esac
13131         case "$getgrnam_r_proto" in
13132         ''|0) try='int getgrnam_r(const char*, struct group*, char*, int);'
13133         ./protochk "extern $try" $hdrs && getgrnam_r_proto=I_CSBI ;;
13134         esac
13135         case "$getgrnam_r_proto" in
13136         ''|0) try='struct group* getgrnam_r(const char*, struct group*, char*, int);'
13137         ./protochk "extern $try" $hdrs && getgrnam_r_proto=S_CSBI ;;
13138         esac
13139         case "$getgrnam_r_proto" in
13140         ''|0)   d_getgrnam_r=undef
13141                 getgrnam_r_proto=0
13142                 echo "Disabling getgrnam_r, cannot determine prototype." >&4 ;;
13143         * )     case "$getgrnam_r_proto" in
13144                 REENTRANT_PROTO*) ;;
13145                 *) getgrnam_r_proto="REENTRANT_PROTO_$getgrnam_r_proto" ;;
13146                 esac
13147                 echo "Prototype: $try" ;;
13148         esac
13149         ;;
13150         *)      case "$usethreads" in
13151                 define) echo "getgrnam_r has no prototype, not using it." >&4 ;;
13152                 esac
13153                 d_getgrnam_r=undef
13154                 getgrnam_r_proto=0
13155                 ;;
13156         esac
13157         ;;
13158 *)      getgrnam_r_proto=0
13159         ;;
13160 esac
13161
13162 : see if gethostbyaddr exists
13163 set gethostbyaddr d_gethbyaddr
13164 eval $inlibc
13165
13166 : see if gethostbyname exists
13167 set gethostbyname d_gethbyname
13168 eval $inlibc
13169
13170 : see if gethostent exists
13171 set gethostent d_gethent
13172 eval $inlibc
13173
13174 : see how we will look up host name
13175 echo " "
13176 call=''
13177 if set gethostname val -f d_gethname; eval $csym; $val; then
13178         echo 'gethostname() found.' >&4
13179         d_gethname="$define"
13180         call=gethostname
13181 fi
13182 if set uname val -f d_uname; eval $csym; $val; then
13183         if ./xenix; then
13184                 $cat <<'EOM'
13185 uname() was found, but you're running xenix, and older versions of xenix
13186 have a broken uname(). If you don't really know whether your xenix is old
13187 enough to have a broken system call, use the default answer.
13188
13189 EOM
13190                 dflt=y
13191                 case "$d_uname" in
13192                 "$define") dflt=n;;
13193                 esac
13194                 rp='Is your uname() broken?'
13195                 . ./myread
13196                 case "$ans" in
13197                 n*) d_uname="$define"; call=uname;;
13198                 esac
13199         else
13200                 echo 'uname() found.' >&4
13201                 d_uname="$define"
13202                 case "$call" in
13203                 '') call=uname ;;
13204                 esac
13205         fi
13206 fi
13207 case "$d_gethname" in
13208 '') d_gethname="$undef";;
13209 esac
13210 case "$d_uname" in
13211 '') d_uname="$undef";;
13212 esac
13213 case "$d_uname$d_gethname" in
13214 *define*)
13215         dflt=n
13216         cat <<EOM
13217  
13218 Every now and then someone has a $call() that lies about the hostname
13219 but can't be fixed for political or economic reasons.  If you wish, I can
13220 pretend $call() isn't there and maybe compute hostname at run-time
13221 thanks to the '$phostname' command.
13222
13223 EOM
13224         rp="Shall I ignore $call() from now on?"
13225         . ./myread
13226         case "$ans" in
13227         y*) d_uname="$undef" d_gethname="$undef"; $echo $n "Okay...$c";;
13228         esac;;
13229 esac
13230 case "$phostname" in
13231 '') aphostname='';;
13232 *) case "$aphostname" in
13233         /*) ;;
13234         *) set X $phostname
13235                 shift
13236                 file=$1
13237                 shift
13238                 file=`./loc $file $file $pth`
13239                 aphostname=`echo $file $*`
13240                 ;;
13241         esac
13242         ;;
13243 esac
13244 case "$d_uname$d_gethname" in
13245 *define*) ;;
13246 *)
13247         case "$phostname" in
13248         '')
13249                 echo "There will be no way for $package to get your hostname." >&4;;
13250         *)
13251         echo "I'll use 'popen("'"'$aphostname'", "r")'"' to get your hostname." >&4
13252                 ;;
13253         esac;;
13254 esac
13255 case "$d_phostname" in
13256 '') d_phostname="$undef";;
13257 esac
13258
13259 : see if gethostbyaddr_r exists
13260 set gethostbyaddr_r d_gethostbyaddr_r
13261 eval $inlibc
13262 case "$d_gethostbyaddr_r" in
13263 "$define")
13264         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13265         case "$d_gethostbyaddr_r_proto:$usethreads" in
13266         ":define")      d_gethostbyaddr_r_proto=define
13267                 set d_gethostbyaddr_r_proto gethostbyaddr_r $hdrs
13268                 eval $hasproto ;;
13269         *)      ;;
13270         esac
13271         case "$d_gethostbyaddr_r_proto" in
13272         define)
13273         case "$gethostbyaddr_r_proto" in
13274         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13275         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISBWRE ;;
13276         esac
13277         case "$gethostbyaddr_r_proto" in
13278         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, size_t, int, int*);'
13279         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBWIE ;;
13280         esac
13281         case "$gethostbyaddr_r_proto" in
13282         ''|0) try='struct hostent* gethostbyaddr_r(const char*, size_t, int, struct hostent*, char*, int, int*);'
13283         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CWISBIE ;;
13284         esac
13285         case "$gethostbyaddr_r_proto" in
13286         ''|0) try='struct hostent* gethostbyaddr_r(const void*, size_t, int, struct hostent*, char*, int, int*);'
13287         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TWISBIE ;;
13288         esac
13289         case "$gethostbyaddr_r_proto" in
13290         ''|0) try='struct hostent* gethostbyaddr_r(const char*, int, int, struct hostent*, char*, int, int*);'
13291         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CIISBIE ;;
13292         esac
13293         case "$gethostbyaddr_r_proto" in
13294         ''|0) try='struct hostent* gethostbyaddr_r(const char*, struct hostent*, char*, int, int*);'
13295         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_CSBIE ;;
13296         esac
13297         case "$gethostbyaddr_r_proto" in
13298         ''|0) try='struct hostent* gethostbyaddr_r(const void*, struct hostent*, char*, int, int*);'
13299         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=S_TSBIE ;;
13300         esac
13301         case "$gethostbyaddr_r_proto" in
13302         ''|0) try='int gethostbyaddr_r(const char*, size_t, int, struct hostent*, struct hostent_data*);'
13303         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CWISD ;;
13304         esac
13305         case "$gethostbyaddr_r_proto" in
13306         ''|0) try='int gethostbyaddr_r(const char*, int, int, struct hostent*, struct hostent_data*);'
13307         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CIISD ;;
13308         esac
13309         case "$gethostbyaddr_r_proto" in
13310         ''|0) try='int gethostbyaddr_r(const char*, int, int);'
13311         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_CII ;;
13312         esac
13313         case "$gethostbyaddr_r_proto" in
13314         ''|0) try='int gethostbyaddr_r(const void*, socklen_t, int, struct hostent*, char*, size_t, struct hostent**, int*);'
13315         ./protochk "extern $try" $hdrs && gethostbyaddr_r_proto=I_TsISBWRE ;;
13316         esac
13317         case "$gethostbyaddr_r_proto" in
13318         ''|0)   d_gethostbyaddr_r=undef
13319                 gethostbyaddr_r_proto=0
13320                 echo "Disabling gethostbyaddr_r, cannot determine prototype." >&4 ;;
13321         * )     case "$gethostbyaddr_r_proto" in
13322                 REENTRANT_PROTO*) ;;
13323                 *) gethostbyaddr_r_proto="REENTRANT_PROTO_$gethostbyaddr_r_proto" ;;
13324                 esac
13325                 echo "Prototype: $try" ;;
13326         esac
13327         ;;
13328         *)      case "$usethreads" in
13329                 define) echo "gethostbyaddr_r has no prototype, not using it." >&4 ;;
13330                 esac
13331                 d_gethostbyaddr_r=undef
13332                 gethostbyaddr_r_proto=0
13333                 ;;
13334         esac
13335         ;;
13336 *)      gethostbyaddr_r_proto=0
13337         ;;
13338 esac
13339
13340 : see if gethostbyname_r exists
13341 set gethostbyname_r d_gethostbyname_r
13342 eval $inlibc
13343 case "$d_gethostbyname_r" in
13344 "$define")
13345         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13346         case "$d_gethostbyname_r_proto:$usethreads" in
13347         ":define")      d_gethostbyname_r_proto=define
13348                 set d_gethostbyname_r_proto gethostbyname_r $hdrs
13349                 eval $hasproto ;;
13350         *)      ;;
13351         esac
13352         case "$d_gethostbyname_r_proto" in
13353         define)
13354         case "$gethostbyname_r_proto" in
13355         ''|0) try='int gethostbyname_r(const char*, struct hostent*, char*, size_t, struct hostent**, int*);'
13356         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSBWRE ;;
13357         esac
13358         case "$gethostbyname_r_proto" in
13359         ''|0) try='struct hostent* gethostbyname_r(const char*, struct hostent*, char*, int, int*);'
13360         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=S_CSBIE ;;
13361         esac
13362         case "$gethostbyname_r_proto" in
13363         ''|0) try='int gethostbyname_r(const char*, struct hostent*, struct hostent_data*);'
13364         ./protochk "extern $try" $hdrs && gethostbyname_r_proto=I_CSD ;;
13365         esac
13366         case "$gethostbyname_r_proto" in
13367         ''|0)   d_gethostbyname_r=undef
13368                 gethostbyname_r_proto=0
13369                 echo "Disabling gethostbyname_r, cannot determine prototype." >&4 ;;
13370         * )     case "$gethostbyname_r_proto" in
13371                 REENTRANT_PROTO*) ;;
13372                 *) gethostbyname_r_proto="REENTRANT_PROTO_$gethostbyname_r_proto" ;;
13373                 esac
13374                 echo "Prototype: $try" ;;
13375         esac
13376         ;;
13377         *)      case "$usethreads" in
13378                 define) echo "gethostbyname_r has no prototype, not using it." >&4 ;;
13379                 esac
13380                 d_gethostbyname_r=undef
13381                 gethostbyname_r_proto=0
13382                 ;;
13383         esac
13384         ;;
13385 *)      gethostbyname_r_proto=0
13386         ;;
13387 esac
13388
13389 : see if gethostent_r exists
13390 set gethostent_r d_gethostent_r
13391 eval $inlibc
13392 case "$d_gethostent_r" in
13393 "$define")
13394         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13395         case "$d_gethostent_r_proto:$usethreads" in
13396         ":define")      d_gethostent_r_proto=define
13397                 set d_gethostent_r_proto gethostent_r $hdrs
13398                 eval $hasproto ;;
13399         *)      ;;
13400         esac
13401         case "$d_gethostent_r_proto" in
13402         define)
13403         case "$gethostent_r_proto" in
13404         ''|0) try='int gethostent_r(struct hostent*, char*, size_t, struct hostent**, int*);'
13405         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBWRE ;;
13406         esac
13407         case "$gethostent_r_proto" in
13408         ''|0) try='int gethostent_r(struct hostent*, char*, int, int*);'
13409         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBIE ;;
13410         esac
13411         case "$gethostent_r_proto" in
13412         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int, int*);'
13413         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBIE ;;
13414         esac
13415         case "$gethostent_r_proto" in
13416         ''|0) try='struct hostent* gethostent_r(struct hostent*, char*, int);'
13417         ./protochk "extern $try" $hdrs && gethostent_r_proto=S_SBI ;;
13418         esac
13419         case "$gethostent_r_proto" in
13420         ''|0) try='int gethostent_r(struct hostent*, char*, int);'
13421         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SBI ;;
13422         esac
13423         case "$gethostent_r_proto" in
13424         ''|0) try='int gethostent_r(struct hostent*, struct hostent_data*);'
13425         ./protochk "extern $try" $hdrs && gethostent_r_proto=I_SD ;;
13426         esac
13427         case "$gethostent_r_proto" in
13428         ''|0)   d_gethostent_r=undef
13429                 gethostent_r_proto=0
13430                 echo "Disabling gethostent_r, cannot determine prototype." >&4 ;;
13431         * )     case "$gethostent_r_proto" in
13432                 REENTRANT_PROTO*) ;;
13433                 *) gethostent_r_proto="REENTRANT_PROTO_$gethostent_r_proto" ;;
13434                 esac
13435                 echo "Prototype: $try" ;;
13436         esac
13437         ;;
13438         *)      case "$usethreads" in
13439                 define) echo "gethostent_r has no prototype, not using it." >&4 ;;
13440                 esac
13441                 d_gethostent_r=undef
13442                 gethostent_r_proto=0
13443                 ;;
13444         esac
13445         ;;
13446 *)      gethostent_r_proto=0
13447         ;;
13448 esac
13449
13450 : see if prototypes for various gethostxxx netdb.h functions are available
13451 echo " "
13452 set d_gethostprotos gethostent $i_netdb netdb.h
13453 eval $hasproto
13454
13455 : see if getitimer exists
13456 set getitimer d_getitimer
13457 eval $inlibc
13458
13459 : see if getlogin exists
13460 set getlogin d_getlogin
13461 eval $inlibc
13462
13463 : see if getlogin_r exists
13464 set getlogin_r d_getlogin_r
13465 eval $inlibc
13466 case "$d_getlogin_r" in
13467 "$define")
13468         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
13469         case "$d_getlogin_r_proto:$usethreads" in
13470         ":define")      d_getlogin_r_proto=define
13471                 set d_getlogin_r_proto getlogin_r $hdrs
13472                 eval $hasproto ;;
13473         *)      ;;
13474         esac
13475         case "$d_getlogin_r_proto" in
13476         define)
13477         case "$getlogin_r_proto" in
13478         ''|0) try='int getlogin_r(char*, size_t);'
13479         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BW ;;
13480         esac
13481         case "$getlogin_r_proto" in
13482         ''|0) try='int getlogin_r(char*, int);'
13483         ./protochk "extern $try" $hdrs && getlogin_r_proto=I_BI ;;
13484         esac
13485         case "$getlogin_r_proto" in
13486         ''|0) try='char* getlogin_r(char*, size_t);'
13487         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BW ;;
13488         esac
13489         case "$getlogin_r_proto" in
13490         ''|0) try='char* getlogin_r(char*, int);'
13491         ./protochk "extern $try" $hdrs && getlogin_r_proto=B_BI ;;
13492         esac
13493         case "$getlogin_r_proto" in
13494         ''|0)   d_getlogin_r=undef
13495                 getlogin_r_proto=0
13496                 echo "Disabling getlogin_r, cannot determine prototype." >&4 ;;
13497         * )     case "$getlogin_r_proto" in
13498                 REENTRANT_PROTO*) ;;
13499                 *) getlogin_r_proto="REENTRANT_PROTO_$getlogin_r_proto" ;;
13500                 esac
13501                 echo "Prototype: $try" ;;
13502         esac
13503         ;;
13504         *)      case "$usethreads" in
13505                 define) echo "getlogin_r has no prototype, not using it." >&4 ;;
13506                 esac
13507                 d_getlogin_r=undef
13508                 getlogin_r_proto=0
13509                 ;;
13510         esac
13511         ;;
13512 *)      getlogin_r_proto=0
13513         ;;
13514 esac
13515
13516 : see if getmnt exists
13517 set getmnt d_getmnt
13518 eval $inlibc
13519
13520 : see if getmntent exists
13521 set getmntent d_getmntent
13522 eval $inlibc
13523
13524 : see if getnetbyaddr exists
13525 set getnetbyaddr d_getnbyaddr
13526 eval $inlibc
13527
13528 : see if getnetbyname exists
13529 set getnetbyname d_getnbyname
13530 eval $inlibc
13531
13532 : see if getnetent exists
13533 set getnetent d_getnent
13534 eval $inlibc
13535
13536 : see if getnetbyaddr_r exists
13537 set getnetbyaddr_r d_getnetbyaddr_r
13538 eval $inlibc
13539 case "$d_getnetbyaddr_r" in
13540 "$define")
13541         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13542         case "$d_getnetbyaddr_r_proto:$usethreads" in
13543         ":define")      d_getnetbyaddr_r_proto=define
13544                 set d_getnetbyaddr_r_proto getnetbyaddr_r $hdrs
13545                 eval $hasproto ;;
13546         *)      ;;
13547         esac
13548         case "$d_getnetbyaddr_r_proto" in
13549         define)
13550         case "$getnetbyaddr_r_proto" in
13551         ''|0) try='int getnetbyaddr_r(unsigned long, int, struct netent*, char*, size_t, struct netent**, int*);'
13552         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_UISBWRE ;;
13553         esac
13554         case "$getnetbyaddr_r_proto" in
13555         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, char*, int);'
13556         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISBI ;;
13557         esac
13558         case "$getnetbyaddr_r_proto" in
13559         ''|0) try='struct netent* getnetbyaddr_r(in_addr_t, int, struct netent*, char*, int);'
13560         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_TISBI ;;
13561         esac
13562         case "$getnetbyaddr_r_proto" in
13563         ''|0) try='struct netent* getnetbyaddr_r(long, int, struct netent*, char*, int);'
13564         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=S_LISBI ;;
13565         esac
13566         case "$getnetbyaddr_r_proto" in
13567         ''|0) try='int getnetbyaddr_r(in_addr_t, int, struct netent*, struct netent_data*);'
13568         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_TISD ;;
13569         esac
13570         case "$getnetbyaddr_r_proto" in
13571         ''|0) try='int getnetbyaddr_r(long, int, struct netent*, struct netent_data*);'
13572         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_LISD ;;
13573         esac
13574         case "$getnetbyaddr_r_proto" in
13575         ''|0) try='int getnetbyaddr_r(int, int, struct netent*, struct netent_data*);'
13576         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_IISD ;;
13577         esac
13578         case "$getnetbyaddr_r_proto" in
13579         ''|0) try='int getnetbyaddr_r(uint32_t, int, struct netent*, char*, size_t, struct netent**, int*);'
13580         ./protochk "extern $try" $hdrs && getnetbyaddr_r_proto=I_uISBWRE ;;
13581         esac
13582         case "$getnetbyaddr_r_proto" in
13583         ''|0)   d_getnetbyaddr_r=undef
13584                 getnetbyaddr_r_proto=0
13585                 echo "Disabling getnetbyaddr_r, cannot determine prototype." >&4 ;;
13586         * )     case "$getnetbyaddr_r_proto" in
13587                 REENTRANT_PROTO*) ;;
13588                 *) getnetbyaddr_r_proto="REENTRANT_PROTO_$getnetbyaddr_r_proto" ;;
13589                 esac
13590                 echo "Prototype: $try" ;;
13591         esac
13592         ;;
13593         *)      case "$usethreads" in
13594                 define) echo "getnetbyaddr_r has no prototype, not using it." >&4 ;;
13595                 esac
13596                 d_getnetbyaddr_r=undef
13597                 getnetbyaddr_r_proto=0
13598                 ;;
13599         esac
13600         ;;
13601 *)      getnetbyaddr_r_proto=0
13602         ;;
13603 esac
13604
13605 : see if getnetbyname_r exists
13606 set getnetbyname_r d_getnetbyname_r
13607 eval $inlibc
13608 case "$d_getnetbyname_r" in
13609 "$define")
13610         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13611         case "$d_getnetbyname_r_proto:$usethreads" in
13612         ":define")      d_getnetbyname_r_proto=define
13613                 set d_getnetbyname_r_proto getnetbyname_r $hdrs
13614                 eval $hasproto ;;
13615         *)      ;;
13616         esac
13617         case "$d_getnetbyname_r_proto" in
13618         define)
13619         case "$getnetbyname_r_proto" in
13620         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, size_t, struct netent**, int*);'
13621         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBWRE ;;
13622         esac
13623         case "$getnetbyname_r_proto" in
13624         ''|0) try='int getnetbyname_r(const char*, struct netent*, char*, int);'
13625         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSBI ;;
13626         esac
13627         case "$getnetbyname_r_proto" in
13628         ''|0) try='struct netent* getnetbyname_r(const char*, struct netent*, char*, int);'
13629         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=S_CSBI ;;
13630         esac
13631         case "$getnetbyname_r_proto" in
13632         ''|0) try='int getnetbyname_r(const char*, struct netent*, struct netent_data*);'
13633         ./protochk "extern $try" $hdrs && getnetbyname_r_proto=I_CSD ;;
13634         esac
13635         case "$getnetbyname_r_proto" in
13636         ''|0)   d_getnetbyname_r=undef
13637                 getnetbyname_r_proto=0
13638                 echo "Disabling getnetbyname_r, cannot determine prototype." >&4 ;;
13639         * )     case "$getnetbyname_r_proto" in
13640                 REENTRANT_PROTO*) ;;
13641                 *) getnetbyname_r_proto="REENTRANT_PROTO_$getnetbyname_r_proto" ;;
13642                 esac
13643                 echo "Prototype: $try" ;;
13644         esac
13645         ;;
13646         *)      case "$usethreads" in
13647                 define) echo "getnetbyname_r has no prototype, not using it." >&4 ;;
13648                 esac
13649                 d_getnetbyname_r=undef
13650                 getnetbyname_r_proto=0
13651                 ;;
13652         esac
13653         ;;
13654 *)      getnetbyname_r_proto=0
13655         ;;
13656 esac
13657
13658 : see if getnetent_r exists
13659 set getnetent_r d_getnetent_r
13660 eval $inlibc
13661 case "$d_getnetent_r" in
13662 "$define")
13663         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13664         case "$d_getnetent_r_proto:$usethreads" in
13665         ":define")      d_getnetent_r_proto=define
13666                 set d_getnetent_r_proto getnetent_r $hdrs
13667                 eval $hasproto ;;
13668         *)      ;;
13669         esac
13670         case "$d_getnetent_r_proto" in
13671         define)
13672         case "$getnetent_r_proto" in
13673         ''|0) try='int getnetent_r(struct netent*, char*, size_t, struct netent**, int*);'
13674         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBWRE ;;
13675         esac
13676         case "$getnetent_r_proto" in
13677         ''|0) try='int getnetent_r(struct netent*, char*, int, int*);'
13678         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBIE ;;
13679         esac
13680         case "$getnetent_r_proto" in
13681         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int, int*);'
13682         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBIE ;;
13683         esac
13684         case "$getnetent_r_proto" in
13685         ''|0) try='struct netent* getnetent_r(struct netent*, char*, int);'
13686         ./protochk "extern $try" $hdrs && getnetent_r_proto=S_SBI ;;
13687         esac
13688         case "$getnetent_r_proto" in
13689         ''|0) try='int getnetent_r(struct netent*, char*, int);'
13690         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SBI ;;
13691         esac
13692         case "$getnetent_r_proto" in
13693         ''|0) try='int getnetent_r(struct netent*, struct netent_data*);'
13694         ./protochk "extern $try" $hdrs && getnetent_r_proto=I_SD ;;
13695         esac
13696         case "$getnetent_r_proto" in
13697         ''|0)   d_getnetent_r=undef
13698                 getnetent_r_proto=0
13699                 echo "Disabling getnetent_r, cannot determine prototype." >&4 ;;
13700         * )     case "$getnetent_r_proto" in
13701                 REENTRANT_PROTO*) ;;
13702                 *) getnetent_r_proto="REENTRANT_PROTO_$getnetent_r_proto" ;;
13703                 esac
13704                 echo "Prototype: $try" ;;
13705         esac
13706         ;;
13707         *)      case "$usethreads" in
13708                 define) echo "getnetent_r has no prototype, not using it." >&4 ;;
13709                 esac
13710                 d_getnetent_r=undef
13711                 getnetent_r_proto=0
13712                 ;;
13713         esac
13714         ;;
13715 *)      getnetent_r_proto=0
13716         ;;
13717 esac
13718
13719 : see if prototypes for various getnetxxx netdb.h functions are available
13720 echo " "
13721 set d_getnetprotos getnetent $i_netdb netdb.h
13722 eval $hasproto
13723
13724 : see if getpagesize exists
13725 set getpagesize d_getpagsz
13726 eval $inlibc
13727
13728
13729 : see if getprotobyname exists
13730 set getprotobyname d_getpbyname
13731 eval $inlibc
13732
13733 : see if getprotobynumber exists
13734 set getprotobynumber d_getpbynumber
13735 eval $inlibc
13736
13737 : see if getprotoent exists
13738 set getprotoent d_getpent
13739 eval $inlibc
13740
13741 : see if getpgid exists
13742 set getpgid d_getpgid
13743 eval $inlibc
13744
13745 : see if getpgrp2 exists
13746 set getpgrp2 d_getpgrp2
13747 eval $inlibc
13748
13749 : see if getppid exists
13750 set getppid d_getppid
13751 eval $inlibc
13752
13753 : see if getpriority exists
13754 set getpriority d_getprior
13755 eval $inlibc
13756
13757 : see if getprotobyname_r exists
13758 set getprotobyname_r d_getprotobyname_r
13759 eval $inlibc
13760 case "$d_getprotobyname_r" in
13761 "$define")
13762         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13763         case "$d_getprotobyname_r_proto:$usethreads" in
13764         ":define")      d_getprotobyname_r_proto=define
13765                 set d_getprotobyname_r_proto getprotobyname_r $hdrs
13766                 eval $hasproto ;;
13767         *)      ;;
13768         esac
13769         case "$d_getprotobyname_r_proto" in
13770         define)
13771         case "$getprotobyname_r_proto" in
13772         ''|0) try='int getprotobyname_r(const char*, struct protoent*, char*, size_t, struct protoent**);'
13773         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSBWR ;;
13774         esac
13775         case "$getprotobyname_r_proto" in
13776         ''|0) try='struct protoent* getprotobyname_r(const char*, struct protoent*, char*, int);'
13777         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=S_CSBI ;;
13778         esac
13779         case "$getprotobyname_r_proto" in
13780         ''|0) try='int getprotobyname_r(const char*, struct protoent*, struct protoent_data*);'
13781         ./protochk "extern $try" $hdrs && getprotobyname_r_proto=I_CSD ;;
13782         esac
13783         case "$getprotobyname_r_proto" in
13784         ''|0)   d_getprotobyname_r=undef
13785                 getprotobyname_r_proto=0
13786                 echo "Disabling getprotobyname_r, cannot determine prototype." >&4 ;;
13787         * )     case "$getprotobyname_r_proto" in
13788                 REENTRANT_PROTO*) ;;
13789                 *) getprotobyname_r_proto="REENTRANT_PROTO_$getprotobyname_r_proto" ;;
13790                 esac
13791                 echo "Prototype: $try" ;;
13792         esac
13793         ;;
13794         *)      case "$usethreads" in
13795                 define) echo "getprotobyname_r has no prototype, not using it." >&4 ;;
13796                 esac
13797                 d_getprotobyname_r=undef
13798                 getprotobyname_r_proto=0
13799                 ;;
13800         esac
13801         ;;
13802 *)      getprotobyname_r_proto=0
13803         ;;
13804 esac
13805
13806 : see if getprotobynumber_r exists
13807 set getprotobynumber_r d_getprotobynumber_r
13808 eval $inlibc
13809 case "$d_getprotobynumber_r" in
13810 "$define")
13811         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13812         case "$d_getprotobynumber_r_proto:$usethreads" in
13813         ":define")      d_getprotobynumber_r_proto=define
13814                 set d_getprotobynumber_r_proto getprotobynumber_r $hdrs
13815                 eval $hasproto ;;
13816         *)      ;;
13817         esac
13818         case "$d_getprotobynumber_r_proto" in
13819         define)
13820         case "$getprotobynumber_r_proto" in
13821         ''|0) try='int getprotobynumber_r(int, struct protoent*, char*, size_t, struct protoent**);'
13822         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISBWR ;;
13823         esac
13824         case "$getprotobynumber_r_proto" in
13825         ''|0) try='struct protoent* getprotobynumber_r(int, struct protoent*, char*, int);'
13826         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=S_ISBI ;;
13827         esac
13828         case "$getprotobynumber_r_proto" in
13829         ''|0) try='int getprotobynumber_r(int, struct protoent*, struct protoent_data*);'
13830         ./protochk "extern $try" $hdrs && getprotobynumber_r_proto=I_ISD ;;
13831         esac
13832         case "$getprotobynumber_r_proto" in
13833         ''|0)   d_getprotobynumber_r=undef
13834                 getprotobynumber_r_proto=0
13835                 echo "Disabling getprotobynumber_r, cannot determine prototype." >&4 ;;
13836         * )     case "$getprotobynumber_r_proto" in
13837                 REENTRANT_PROTO*) ;;
13838                 *) getprotobynumber_r_proto="REENTRANT_PROTO_$getprotobynumber_r_proto" ;;
13839                 esac
13840                 echo "Prototype: $try" ;;
13841         esac
13842         ;;
13843         *)      case "$usethreads" in
13844                 define) echo "getprotobynumber_r has no prototype, not using it." >&4 ;;
13845                 esac
13846                 d_getprotobynumber_r=undef
13847                 getprotobynumber_r_proto=0
13848                 ;;
13849         esac
13850         ;;
13851 *)      getprotobynumber_r_proto=0
13852         ;;
13853 esac
13854
13855 : see if getprotoent_r exists
13856 set getprotoent_r d_getprotoent_r
13857 eval $inlibc
13858 case "$d_getprotoent_r" in
13859 "$define")
13860         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
13861         case "$d_getprotoent_r_proto:$usethreads" in
13862         ":define")      d_getprotoent_r_proto=define
13863                 set d_getprotoent_r_proto getprotoent_r $hdrs
13864                 eval $hasproto ;;
13865         *)      ;;
13866         esac
13867         case "$d_getprotoent_r_proto" in
13868         define)
13869         case "$getprotoent_r_proto" in
13870         ''|0) try='int getprotoent_r(struct protoent*, char*, size_t, struct protoent**);'
13871         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBWR ;;
13872         esac
13873         case "$getprotoent_r_proto" in
13874         ''|0) try='int getprotoent_r(struct protoent*, char*, int);'
13875         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SBI ;;
13876         esac
13877         case "$getprotoent_r_proto" in
13878         ''|0) try='struct protoent* getprotoent_r(struct protoent*, char*, int);'
13879         ./protochk "extern $try" $hdrs && getprotoent_r_proto=S_SBI ;;
13880         esac
13881         case "$getprotoent_r_proto" in
13882         ''|0) try='int getprotoent_r(struct protoent*, struct protoent_data*);'
13883         ./protochk "extern $try" $hdrs && getprotoent_r_proto=I_SD ;;
13884         esac
13885         case "$getprotoent_r_proto" in
13886         ''|0)   d_getprotoent_r=undef
13887                 getprotoent_r_proto=0
13888                 echo "Disabling getprotoent_r, cannot determine prototype." >&4 ;;
13889         * )     case "$getprotoent_r_proto" in
13890                 REENTRANT_PROTO*) ;;
13891                 *) getprotoent_r_proto="REENTRANT_PROTO_$getprotoent_r_proto" ;;
13892                 esac
13893                 echo "Prototype: $try" ;;
13894         esac
13895         ;;
13896         *)      case "$usethreads" in
13897                 define) echo "getprotoent_r has no prototype, not using it." >&4 ;;
13898                 esac
13899                 d_getprotoent_r=undef
13900                 getprotoent_r_proto=0
13901                 ;;
13902         esac
13903         ;;
13904 *)      getprotoent_r_proto=0
13905         ;;
13906 esac
13907
13908 : see if prototypes for various getprotoxxx netdb.h functions are available
13909 echo " "
13910 set d_getprotoprotos getprotoent $i_netdb netdb.h
13911 eval $hasproto
13912
13913 : see if getprpwnam exists
13914 set getprpwnam d_getprpwnam
13915 eval $inlibc
13916
13917 : see if getpwent exists
13918 set getpwent d_getpwent
13919 eval $inlibc
13920
13921 : see if getpwent_r exists
13922 set getpwent_r d_getpwent_r
13923 eval $inlibc
13924 case "$d_getpwent_r" in
13925 "$define")
13926         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13927         case "$d_getpwent_r_proto:$usethreads" in
13928         ":define")      d_getpwent_r_proto=define
13929                 set d_getpwent_r_proto getpwent_r $hdrs
13930                 eval $hasproto ;;
13931         *)      ;;
13932         esac
13933         case "$d_getpwent_r_proto" in
13934         define)
13935         case "$getpwent_r_proto" in
13936         ''|0) try='int getpwent_r(struct passwd*, char*, size_t, struct passwd**);'
13937         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBWR ;;
13938         esac
13939         case "$getpwent_r_proto" in
13940         ''|0) try='int getpwent_r(struct passwd*, char*, int, struct passwd**);'
13941         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIR ;;
13942         esac
13943         case "$getpwent_r_proto" in
13944         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, size_t);'
13945         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBW ;;
13946         esac
13947         case "$getpwent_r_proto" in
13948         ''|0) try='struct passwd* getpwent_r(struct passwd*, char*, int);'
13949         ./protochk "extern $try" $hdrs && getpwent_r_proto=S_SBI ;;
13950         esac
13951         case "$getpwent_r_proto" in
13952         ''|0) try='int getpwent_r(struct passwd*, char*, int);'
13953         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBI ;;
13954         esac
13955         case "$getpwent_r_proto" in
13956         ''|0) try='int getpwent_r(struct passwd*, char*, int, FILE**);'
13957         ./protochk "extern $try" $hdrs && getpwent_r_proto=I_SBIH ;;
13958         esac
13959         case "$getpwent_r_proto" in
13960         ''|0)   d_getpwent_r=undef
13961                 getpwent_r_proto=0
13962                 echo "Disabling getpwent_r, cannot determine prototype." >&4 ;;
13963         * )     case "$getpwent_r_proto" in
13964                 REENTRANT_PROTO*) ;;
13965                 *) getpwent_r_proto="REENTRANT_PROTO_$getpwent_r_proto" ;;
13966                 esac
13967                 echo "Prototype: $try" ;;
13968         esac
13969         ;;
13970         *)      case "$usethreads" in
13971                 define) echo "getpwent_r has no prototype, not using it." >&4 ;;
13972                 esac
13973                 d_getpwent_r=undef
13974                 getpwent_r_proto=0
13975                 ;;
13976         esac
13977         ;;
13978 *)      getpwent_r_proto=0
13979         ;;
13980 esac
13981
13982 : see if getpwnam_r exists
13983 set getpwnam_r d_getpwnam_r
13984 eval $inlibc
13985 case "$d_getpwnam_r" in
13986 "$define")
13987         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
13988         case "$d_getpwnam_r_proto:$usethreads" in
13989         ":define")      d_getpwnam_r_proto=define
13990                 set d_getpwnam_r_proto getpwnam_r $hdrs
13991                 eval $hasproto ;;
13992         *)      ;;
13993         esac
13994         case "$d_getpwnam_r_proto" in
13995         define)
13996         case "$getpwnam_r_proto" in
13997         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, size_t, struct passwd**);'
13998         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBWR ;;
13999         esac
14000         case "$getpwnam_r_proto" in
14001         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int, struct passwd**);'
14002         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBIR ;;
14003         esac
14004         case "$getpwnam_r_proto" in
14005         ''|0) try='struct passwd* getpwnam_r(const char*, struct passwd*, char*, int);'
14006         ./protochk "extern $try" $hdrs && getpwnam_r_proto=S_CSBI ;;
14007         esac
14008         case "$getpwnam_r_proto" in
14009         ''|0) try='int getpwnam_r(const char*, struct passwd*, char*, int);'
14010         ./protochk "extern $try" $hdrs && getpwnam_r_proto=I_CSBI ;;
14011         esac
14012         case "$getpwnam_r_proto" in
14013         ''|0)   d_getpwnam_r=undef
14014                 getpwnam_r_proto=0
14015                 echo "Disabling getpwnam_r, cannot determine prototype." >&4 ;;
14016         * )     case "$getpwnam_r_proto" in
14017                 REENTRANT_PROTO*) ;;
14018                 *) getpwnam_r_proto="REENTRANT_PROTO_$getpwnam_r_proto" ;;
14019                 esac
14020                 echo "Prototype: $try" ;;
14021         esac
14022         ;;
14023         *)      case "$usethreads" in
14024                 define) echo "getpwnam_r has no prototype, not using it." >&4 ;;
14025                 esac
14026                 d_getpwnam_r=undef
14027                 getpwnam_r_proto=0
14028                 ;;
14029         esac
14030         ;;
14031 *)      getpwnam_r_proto=0
14032         ;;
14033 esac
14034
14035 : see if getpwuid_r exists
14036 set getpwuid_r d_getpwuid_r
14037 eval $inlibc
14038 case "$d_getpwuid_r" in
14039 "$define")
14040         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
14041         case "$d_getpwuid_r_proto:$usethreads" in
14042         ":define")      d_getpwuid_r_proto=define
14043                 set d_getpwuid_r_proto getpwuid_r $hdrs
14044                 eval $hasproto ;;
14045         *)      ;;
14046         esac
14047         case "$d_getpwuid_r_proto" in
14048         define)
14049         case "$getpwuid_r_proto" in
14050         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, size_t, struct passwd**);'
14051         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBWR ;;
14052         esac
14053         case "$getpwuid_r_proto" in
14054         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int, struct passwd**);'
14055         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBIR ;;
14056         esac
14057         case "$getpwuid_r_proto" in
14058         ''|0) try='int getpwuid_r(uid_t, struct passwd*, char*, int);'
14059         ./protochk "extern $try" $hdrs && getpwuid_r_proto=I_TSBI ;;
14060         esac
14061         case "$getpwuid_r_proto" in
14062         ''|0) try='struct passwd* getpwuid_r(uid_t, struct passwd*, char*, int);'
14063         ./protochk "extern $try" $hdrs && getpwuid_r_proto=S_TSBI ;;
14064         esac
14065         case "$getpwuid_r_proto" in
14066         ''|0)   d_getpwuid_r=undef
14067                 getpwuid_r_proto=0
14068                 echo "Disabling getpwuid_r, cannot determine prototype." >&4 ;;
14069         * )     case "$getpwuid_r_proto" in
14070                 REENTRANT_PROTO*) ;;
14071                 *) getpwuid_r_proto="REENTRANT_PROTO_$getpwuid_r_proto" ;;
14072                 esac
14073                 echo "Prototype: $try" ;;
14074         esac
14075         ;;
14076         *)      case "$usethreads" in
14077                 define) echo "getpwuid_r has no prototype, not using it." >&4 ;;
14078                 esac
14079                 d_getpwuid_r=undef
14080                 getpwuid_r_proto=0
14081                 ;;
14082         esac
14083         ;;
14084 *)      getpwuid_r_proto=0
14085         ;;
14086 esac
14087
14088
14089 : see if getservbyname exists
14090 set getservbyname d_getsbyname
14091 eval $inlibc
14092
14093 : see if getservbyport exists
14094 set getservbyport d_getsbyport
14095 eval $inlibc
14096
14097 : see if getservent exists
14098 set getservent d_getsent
14099 eval $inlibc
14100
14101 : see if getservbyname_r exists
14102 set getservbyname_r d_getservbyname_r
14103 eval $inlibc
14104 case "$d_getservbyname_r" in
14105 "$define")
14106         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14107         case "$d_getservbyname_r_proto:$usethreads" in
14108         ":define")      d_getservbyname_r_proto=define
14109                 set d_getservbyname_r_proto getservbyname_r $hdrs
14110                 eval $hasproto ;;
14111         *)      ;;
14112         esac
14113         case "$d_getservbyname_r_proto" in
14114         define)
14115         case "$getservbyname_r_proto" in
14116         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, char*, size_t, struct servent**);'
14117         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSBWR ;;
14118         esac
14119         case "$getservbyname_r_proto" in
14120         ''|0) try='struct servent* getservbyname_r(const char*, const char*, struct servent*, char*, int);'
14121         ./protochk "extern $try" $hdrs && getservbyname_r_proto=S_CCSBI ;;
14122         esac
14123         case "$getservbyname_r_proto" in
14124         ''|0) try='int getservbyname_r(const char*, const char*, struct servent*, struct servent_data*);'
14125         ./protochk "extern $try" $hdrs && getservbyname_r_proto=I_CCSD ;;
14126         esac
14127         case "$getservbyname_r_proto" in
14128         ''|0)   d_getservbyname_r=undef
14129                 getservbyname_r_proto=0
14130                 echo "Disabling getservbyname_r, cannot determine prototype." >&4 ;;
14131         * )     case "$getservbyname_r_proto" in
14132                 REENTRANT_PROTO*) ;;
14133                 *) getservbyname_r_proto="REENTRANT_PROTO_$getservbyname_r_proto" ;;
14134                 esac
14135                 echo "Prototype: $try" ;;
14136         esac
14137         ;;
14138         *)      case "$usethreads" in
14139                 define) echo "getservbyname_r has no prototype, not using it." >&4 ;;
14140                 esac
14141                 d_getservbyname_r=undef
14142                 getservbyname_r_proto=0
14143                 ;;
14144         esac
14145         ;;
14146 *)      getservbyname_r_proto=0
14147         ;;
14148 esac
14149
14150 : see if getservbyport_r exists
14151 set getservbyport_r d_getservbyport_r
14152 eval $inlibc
14153 case "$d_getservbyport_r" in
14154 "$define")
14155         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14156         case "$d_getservbyport_r_proto:$usethreads" in
14157         ":define")      d_getservbyport_r_proto=define
14158                 set d_getservbyport_r_proto getservbyport_r $hdrs
14159                 eval $hasproto ;;
14160         *)      ;;
14161         esac
14162         case "$d_getservbyport_r_proto" in
14163         define)
14164         case "$getservbyport_r_proto" in
14165         ''|0) try='int getservbyport_r(int, const char*, struct servent*, char*, size_t, struct servent**);'
14166         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSBWR ;;
14167         esac
14168         case "$getservbyport_r_proto" in
14169         ''|0) try='struct servent* getservbyport_r(int, const char*, struct servent*, char*, int);'
14170         ./protochk "extern $try" $hdrs && getservbyport_r_proto=S_ICSBI ;;
14171         esac
14172         case "$getservbyport_r_proto" in
14173         ''|0) try='int getservbyport_r(int, const char*, struct servent*, struct servent_data*);'
14174         ./protochk "extern $try" $hdrs && getservbyport_r_proto=I_ICSD ;;
14175         esac
14176         case "$getservbyport_r_proto" in
14177         ''|0)   d_getservbyport_r=undef
14178                 getservbyport_r_proto=0
14179                 echo "Disabling getservbyport_r, cannot determine prototype." >&4 ;;
14180         * )     case "$getservbyport_r_proto" in
14181                 REENTRANT_PROTO*) ;;
14182                 *) getservbyport_r_proto="REENTRANT_PROTO_$getservbyport_r_proto" ;;
14183                 esac
14184                 echo "Prototype: $try" ;;
14185         esac
14186         ;;
14187         *)      case "$usethreads" in
14188                 define) echo "getservbyport_r has no prototype, not using it." >&4 ;;
14189                 esac
14190                 d_getservbyport_r=undef
14191                 getservbyport_r_proto=0
14192                 ;;
14193         esac
14194         ;;
14195 *)      getservbyport_r_proto=0
14196         ;;
14197 esac
14198
14199 : see if getservent_r exists
14200 set getservent_r d_getservent_r
14201 eval $inlibc
14202 case "$d_getservent_r" in
14203 "$define")
14204         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
14205         case "$d_getservent_r_proto:$usethreads" in
14206         ":define")      d_getservent_r_proto=define
14207                 set d_getservent_r_proto getservent_r $hdrs
14208                 eval $hasproto ;;
14209         *)      ;;
14210         esac
14211         case "$d_getservent_r_proto" in
14212         define)
14213         case "$getservent_r_proto" in
14214         ''|0) try='int getservent_r(struct servent*, char*, size_t, struct servent**);'
14215         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBWR ;;
14216         esac
14217         case "$getservent_r_proto" in
14218         ''|0) try='int getservent_r(struct servent*, char*, int);'
14219         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SBI ;;
14220         esac
14221         case "$getservent_r_proto" in
14222         ''|0) try='struct servent* getservent_r(struct servent*, char*, int);'
14223         ./protochk "extern $try" $hdrs && getservent_r_proto=S_SBI ;;
14224         esac
14225         case "$getservent_r_proto" in
14226         ''|0) try='int getservent_r(struct servent*, struct servent_data*);'
14227         ./protochk "extern $try" $hdrs && getservent_r_proto=I_SD ;;
14228         esac
14229         case "$getservent_r_proto" in
14230         ''|0)   d_getservent_r=undef
14231                 getservent_r_proto=0
14232                 echo "Disabling getservent_r, cannot determine prototype." >&4 ;;
14233         * )     case "$getservent_r_proto" in
14234                 REENTRANT_PROTO*) ;;
14235                 *) getservent_r_proto="REENTRANT_PROTO_$getservent_r_proto" ;;
14236                 esac
14237                 echo "Prototype: $try" ;;
14238         esac
14239         ;;
14240         *)      case "$usethreads" in
14241                 define) echo "getservent_r has no prototype, not using it." >&4 ;;
14242                 esac
14243                 d_getservent_r=undef
14244                 getservent_r_proto=0
14245                 ;;
14246         esac
14247         ;;
14248 *)      getservent_r_proto=0
14249         ;;
14250 esac
14251
14252 : see if prototypes for various getservxxx netdb.h functions are available
14253 echo " "
14254 set d_getservprotos getservent $i_netdb netdb.h
14255 eval $hasproto
14256
14257 : see if getspnam exists
14258 set getspnam d_getspnam
14259 eval $inlibc
14260
14261 : see if this is a shadow.h system
14262 set shadow.h i_shadow
14263 eval $inhdr
14264
14265 : see if getspnam_r exists
14266 set getspnam_r d_getspnam_r
14267 eval $inlibc
14268 case "$d_getspnam_r" in
14269 "$define")
14270         hdrs="$i_systypes sys/types.h define stdio.h $i_shadow shadow.h"
14271         case "$d_getspnam_r_proto:$usethreads" in
14272         ":define")      d_getspnam_r_proto=define
14273                 set d_getspnam_r_proto getspnam_r $hdrs
14274                 eval $hasproto ;;
14275         *)      ;;
14276         esac
14277         case "$d_getspnam_r_proto" in
14278         define)
14279         case "$getspnam_r_proto" in
14280         ''|0) try='int getspnam_r(const char*, struct spwd*, char*, size_t, struct spwd**);'
14281         ./protochk "extern $try" $hdrs && getspnam_r_proto=I_CSBWR ;;
14282         esac
14283         case "$getspnam_r_proto" in
14284         ''|0) try='struct spwd* getspnam_r(const char*, struct spwd*, char*, int);'
14285         ./protochk "extern $try" $hdrs && getspnam_r_proto=S_CSBI ;;
14286         esac
14287         case "$getspnam_r_proto" in
14288         ''|0)   d_getspnam_r=undef
14289                 getspnam_r_proto=0
14290                 echo "Disabling getspnam_r, cannot determine prototype." >&4 ;;
14291         * )     case "$getspnam_r_proto" in
14292                 REENTRANT_PROTO*) ;;
14293                 *) getspnam_r_proto="REENTRANT_PROTO_$getspnam_r_proto" ;;
14294                 esac
14295                 echo "Prototype: $try" ;;
14296         esac
14297         ;;
14298         *)      case "$usethreads" in
14299                 define) echo "getspnam_r has no prototype, not using it." >&4 ;;
14300                 esac
14301                 d_getspnam_r=undef
14302                 getspnam_r_proto=0
14303                 ;;
14304         esac
14305         ;;
14306 *)      getspnam_r_proto=0
14307         ;;
14308 esac
14309
14310 : see if gettimeofday or ftime exists
14311 set gettimeofday d_gettimeod
14312 eval $inlibc
14313 case "$d_gettimeod" in
14314 "$undef")
14315         set ftime d_ftime 
14316         eval $inlibc
14317         ;;
14318 *)
14319         val="$undef"; set d_ftime; eval $setvar
14320         ;;
14321 esac
14322 case "$d_gettimeod$d_ftime" in
14323 "$undef$undef")
14324         echo " "
14325         echo 'No ftime() nor gettimeofday() -- timing may be less accurate.' >&4
14326         ;;
14327 esac
14328
14329 : see if gmtime_r exists
14330 set gmtime_r d_gmtime_r
14331 eval $inlibc
14332 case "$d_gmtime_r" in
14333 "$define")
14334         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14335         case "$d_gmtime_r_proto:$usethreads" in
14336         ":define")      d_gmtime_r_proto=define
14337                 set d_gmtime_r_proto gmtime_r $hdrs
14338                 eval $hasproto ;;
14339         *)      ;;
14340         esac
14341         case "$d_gmtime_r_proto" in
14342         define)
14343         case "$gmtime_r_proto" in
14344         ''|0) try='struct tm* gmtime_r(const time_t*, struct tm*);'
14345         ./protochk "extern $try" $hdrs && gmtime_r_proto=S_TS ;;
14346         esac
14347         case "$gmtime_r_proto" in
14348         ''|0) try='int gmtime_r(const time_t*, struct tm*);'
14349         ./protochk "extern $try" $hdrs && gmtime_r_proto=I_TS ;;
14350         esac
14351         case "$gmtime_r_proto" in
14352         ''|0)   d_gmtime_r=undef
14353                 gmtime_r_proto=0
14354                 echo "Disabling gmtime_r, cannot determine prototype." >&4 ;;
14355         * )     case "$gmtime_r_proto" in
14356                 REENTRANT_PROTO*) ;;
14357                 *) gmtime_r_proto="REENTRANT_PROTO_$gmtime_r_proto" ;;
14358                 esac
14359                 echo "Prototype: $try" ;;
14360         esac
14361         ;;
14362         *)      case "$usethreads" in
14363                 define) echo "gmtime_r has no prototype, not using it." >&4 ;;
14364                 esac
14365                 d_gmtime_r=undef
14366                 gmtime_r_proto=0
14367                 ;;
14368         esac
14369         ;;
14370 *)      gmtime_r_proto=0
14371         ;;
14372 esac
14373
14374 : see if hasmntopt exists
14375 set hasmntopt d_hasmntopt
14376 eval $inlibc
14377
14378 : see if this is a netinet/in.h or sys/in.h system
14379 set netinet/in.h i_niin sys/in.h i_sysin
14380 eval $inhdr
14381
14382 : see if arpa/inet.h has to be included
14383 set arpa/inet.h i_arpainet
14384 eval $inhdr
14385
14386 : see if htonl --and friends-- exists
14387 val=''
14388 set htonl val
14389 eval $inlibc
14390
14391 : Maybe they are macros.
14392 case "$val" in
14393 $undef)
14394         $cat >htonl.c <<EOM
14395 #include <stdio.h>
14396 #include <sys/types.h>
14397 #$i_niin I_NETINET_IN
14398 #$i_sysin I_SYS_IN
14399 #$i_arpainet I_ARPA_INET
14400 #ifdef I_NETINET_IN
14401 #include <netinet/in.h>
14402 #endif
14403 #ifdef I_SYS_IN
14404 #include <sys/in.h>
14405 #endif
14406 #ifdef I_ARPA_INET
14407 #include <arpa/inet.h>
14408 #endif
14409 #ifdef htonl
14410 printf("Defined as a macro.");
14411 #endif
14412 EOM
14413         $cppstdin $cppflags $cppminus < htonl.c >htonl.E 2>/dev/null
14414         if $contains 'Defined as a macro' htonl.E >/dev/null 2>&1; then
14415                 val="$define"
14416                 echo "But it seems to be defined as a macro." >&4
14417         fi
14418         $rm -f htonl.?
14419         ;;
14420 esac
14421 set d_htonl
14422 eval $setvar
14423
14424 : see if ilogbl exists
14425 set ilogbl d_ilogbl
14426 eval $inlibc
14427
14428 : index or strchr
14429 echo " "
14430 if set index val -f; eval $csym; $val; then
14431         if set strchr val -f d_strchr; eval $csym; $val; then
14432                 if $contains strchr "$strings" >/dev/null 2>&1 ; then
14433                         val="$define"
14434                         vali="$undef"
14435                         echo "strchr() found." >&4
14436                 else
14437                         val="$undef"
14438                         vali="$define"
14439                         echo "index() found." >&4
14440                 fi
14441         else
14442                 val="$undef"
14443                 vali="$define"
14444                 echo "index() found." >&4
14445         fi
14446 else
14447         if set strchr val -f d_strchr; eval $csym; $val; then
14448                 val="$define"
14449                 vali="$undef"
14450                 echo "strchr() found." >&4
14451         else
14452                 echo "No index() or strchr() found!" >&4
14453                 val="$undef"
14454                 vali="$undef"
14455         fi
14456 fi
14457 set d_strchr; eval $setvar
14458 val="$vali"
14459 set d_index; eval $setvar
14460
14461 : check whether inet_aton exists
14462 set inet_aton d_inetaton
14463 eval $inlibc
14464
14465 : Look for isascii
14466 echo " "
14467 $cat >isascii.c <<EOCP
14468 #include <stdio.h>
14469 #include <ctype.h>
14470 #$i_stdlib I_STDLIB
14471 #ifdef I_STDLIB
14472 #include <stdlib.h>
14473 #endif
14474 int main() {
14475         int c = 'A';
14476         if (isascii(c))
14477                 exit(0);
14478         else
14479                 exit(1);
14480 }
14481 EOCP
14482 set isascii
14483 if eval $compile; then
14484         echo "isascii() found." >&4
14485         val="$define"
14486 else
14487         echo "isascii() NOT found." >&4
14488         val="$undef"
14489 fi
14490 set d_isascii
14491 eval $setvar
14492 $rm -f isascii*
14493
14494 : see if isfinite exists
14495 set isfinite d_isfinite
14496 eval $inlibc
14497
14498 : see if isinf exists
14499 set isinf d_isinf
14500 eval $inlibc
14501
14502 : see if isnan exists
14503 set isnan d_isnan
14504 eval $inlibc
14505
14506 : see if isnanl exists
14507 set isnanl d_isnanl
14508 eval $inlibc
14509
14510 : see if killpg exists
14511 set killpg d_killpg
14512 eval $inlibc
14513
14514 : see if lchown exists
14515 echo " "
14516 $cat > try.c <<'EOCP'
14517 /* System header to define __stub macros and hopefully few prototypes,
14518     which can conflict with char lchown(); below.  */
14519 #include <assert.h>
14520 /* Override any gcc2 internal prototype to avoid an error.  */
14521 /* We use char because int might match the return type of a gcc2
14522    builtin and then its argument prototype would still apply.  */
14523 char lchown();
14524 int main() {
14525     /*  The GNU C library defines this for functions which it implements
14526         to always fail with ENOSYS.  Some functions are actually named
14527         something starting with __ and the normal name is an alias.  */
14528 #if defined (__stub_lchown) || defined (__stub___lchown)
14529 choke me
14530 #else
14531 lchown();
14532 #endif
14533 ; return 0; }
14534 EOCP
14535 set try
14536 if eval $compile; then
14537     $echo "lchown() found." >&4
14538     val="$define"
14539 else
14540     $echo "lchown() NOT found." >&4
14541     val="$undef"
14542 fi
14543 set d_lchown
14544 eval $setvar
14545
14546 : See if number of significant digits in a double precision number is known
14547 echo " "
14548 $cat >ldbl_dig.c <<EOM
14549 #$i_limits I_LIMITS
14550 #$i_float I_FLOAT
14551 #ifdef I_LIMITS
14552 #include <limits.h>
14553 #endif
14554 #ifdef I_FLOAT
14555 #include <float.h>
14556 #endif
14557 #ifdef LDBL_DIG
14558 printf("Contains LDBL_DIG");
14559 #endif
14560 EOM
14561 $cppstdin $cppflags $cppminus < ldbl_dig.c >ldbl_dig.E 2>/dev/null
14562 if $contains 'LDBL_DIG' ldbl_dig.E >/dev/null 2>&1; then
14563         echo "LDBL_DIG found." >&4
14564         val="$define"
14565 else
14566         echo "LDBL_DIG NOT found." >&4
14567         val="$undef"
14568 fi
14569 $rm -f ldbl_dig.?
14570 set d_ldbl_dig
14571 eval $setvar
14572
14573 : see if this is a math.h system
14574 set math.h i_math
14575 eval $inhdr
14576
14577 d_libm_lib_version="$undef"
14578 case $i_math in
14579     $define)
14580         : check to see if math.h defines _LIB_VERSION
14581         echo " "
14582         echo "Checking to see if your libm supports _LIB_VERSION..." >&4
14583         $cat >try.c <<EOCP
14584 #include <unistd.h>
14585 #include <math.h>
14586 int main (int argc, char *argv[])
14587 {
14588     printf ("%d\n", _LIB_VERSION);
14589     return (0);
14590     } /* main */
14591 EOCP
14592         set try
14593         if eval $compile; then
14594             foo=`$run ./try`
14595             echo "Yes, it does ($foo)" >&4
14596             d_libm_lib_version="$define"
14597         else
14598             echo "No, it does not (probably harmless)\n" >&4
14599             fi
14600         $rm -f try.* try core core.try.*
14601         ;;
14602
14603     esac
14604
14605 : see if link exists
14606 set link d_link
14607 eval $inlibc
14608
14609 : see if localtime_r exists
14610 set localtime_r d_localtime_r
14611 eval $inlibc
14612 case "$d_localtime_r" in
14613 "$define")
14614         hdrs="$i_systypes sys/types.h define stdio.h $i_time time.h $i_systime sys/time.h"
14615         case "$d_localtime_r_proto:$usethreads" in
14616         ":define")      d_localtime_r_proto=define
14617                 set d_localtime_r_proto localtime_r $hdrs
14618                 eval $hasproto ;;
14619         *)      ;;
14620         esac
14621         case "$d_localtime_r_proto" in
14622         define)
14623         case "$localtime_r_proto" in
14624         ''|0) try='struct tm* localtime_r(const time_t*, struct tm*);'
14625         ./protochk "extern $try" $hdrs && localtime_r_proto=S_TS ;;
14626         esac
14627         case "$localtime_r_proto" in
14628         ''|0) try='int localtime_r(const time_t*, struct tm*);'
14629         ./protochk "extern $try" $hdrs && localtime_r_proto=I_TS ;;
14630         esac
14631         case "$localtime_r_proto" in
14632         ''|0)   d_localtime_r=undef
14633                 localtime_r_proto=0
14634                 echo "Disabling localtime_r, cannot determine prototype." >&4 ;;
14635         * )     case "$localtime_r_proto" in
14636                 REENTRANT_PROTO*) ;;
14637                 *) localtime_r_proto="REENTRANT_PROTO_$localtime_r_proto" ;;
14638                 esac
14639                 echo "Prototype: $try" ;;
14640         esac
14641         ;;
14642         *)      case "$usethreads" in
14643                 define) echo "localtime_r has no prototype, not using it." >&4 ;;
14644                 esac
14645                 d_localtime_r=undef
14646                 localtime_r_proto=0
14647                 ;;
14648         esac
14649         ;;
14650 *)      localtime_r_proto=0
14651         ;;
14652 esac
14653
14654 : see if localtime_r calls tzset
14655 case "$localtime_r_proto" in
14656 REENTRANT_PROTO*)
14657         $cat >try.c <<EOCP
14658 /*  Does our libc's localtime_r call tzset ?
14659  *  return 0 if so, 1 otherwise.
14660  */
14661 #include <sys/types.h>
14662 #include <unistd.h>
14663 #include <time.h>
14664 #include <string.h>
14665 #include <malloc.h>
14666 int main()
14667 {
14668     time_t t = time(0L);
14669     char w_tz[]="TZ" "=GMT+5",
14670          e_tz[]="TZ" "=GMT-5",
14671         *tz_e = (char*)malloc(16),
14672         *tz_w = (char*)malloc(16);
14673     struct tm tm_e, tm_w;
14674     memset(&tm_e,'\0',sizeof(struct tm));
14675     memset(&tm_w,'\0',sizeof(struct tm));
14676     strcpy(tz_e,e_tz);
14677     strcpy(tz_w,w_tz);
14678
14679     putenv(tz_e);
14680     localtime_r(&t, &tm_e);
14681
14682     putenv(tz_w);
14683     localtime_r(&t, &tm_w);
14684
14685     if( memcmp(&tm_e, &tm_w, sizeof(struct tm)) == 0 )
14686         return 1;
14687     return 0;
14688 }
14689 EOCP
14690         set try
14691         if eval $compile; then
14692             if ./try; then
14693                 d_localtime_r_needs_tzset=undef;
14694             else
14695                 d_localtime_r_needs_tzset=define;
14696             fi;
14697         else
14698             d_localtime_r_needs_tzset=undef;
14699         fi;
14700      ;;
14701   *)
14702      d_localtime_r_needs_tzset=undef;
14703      ;;
14704 esac
14705 $rm -f try try.* core
14706
14707 : see if localeconv exists
14708 set localeconv d_locconv
14709 eval $inlibc
14710
14711 : see if lockf exists
14712 set lockf d_lockf
14713 eval $inlibc
14714
14715 : see if prototype for lseek is available
14716 echo " "
14717 set d_lseekproto lseek $i_systypes sys/types.h $i_unistd unistd.h
14718 eval $hasproto
14719
14720 : see if lstat exists
14721 set lstat d_lstat
14722 eval $inlibc
14723
14724 : see if madvise exists
14725 set madvise d_madvise
14726 eval $inlibc
14727
14728 : see if malloc_size exists
14729 set malloc_size d_malloc_size
14730 eval $inlibc
14731
14732 : see if malloc_size_good exists
14733 set malloc_good_size d_malloc_good_size
14734 eval $inlibc
14735
14736 : see if mblen exists
14737 set mblen d_mblen
14738 eval $inlibc
14739
14740 : see if mbstowcs exists
14741 set mbstowcs d_mbstowcs
14742 eval $inlibc
14743
14744 : see if mbtowc exists
14745 set mbtowc d_mbtowc
14746 eval $inlibc
14747
14748 : see if memchr exists
14749 set memchr d_memchr
14750 eval $inlibc
14751
14752 : see if memcmp exists
14753 set memcmp d_memcmp
14754 eval $inlibc
14755
14756 : see if memcpy exists
14757 set memcpy d_memcpy
14758 eval $inlibc
14759
14760 : see if memmove exists
14761 set memmove d_memmove
14762 eval $inlibc
14763
14764 : see if memset exists
14765 set memset d_memset
14766 eval $inlibc
14767
14768 : see if mkdir exists
14769 set mkdir d_mkdir
14770 eval $inlibc
14771
14772 : see if mkdtemp exists
14773 set mkdtemp d_mkdtemp
14774 eval $inlibc
14775
14776 : see if mkfifo exists
14777 set mkfifo d_mkfifo
14778 eval $inlibc
14779
14780 : see if mkstemp exists
14781 set mkstemp d_mkstemp
14782 eval $inlibc
14783
14784 : see if mkstemps exists
14785 set mkstemps d_mkstemps
14786 eval $inlibc
14787
14788 : see if mktime exists
14789 set mktime d_mktime
14790 eval $inlibc
14791
14792 : see if this is a sys/mman.h system
14793 set sys/mman.h i_sysmman
14794 eval $inhdr
14795
14796 : see if mmap exists
14797 set mmap d_mmap
14798 eval $inlibc
14799 : see what shmat returns
14800 : default to something harmless
14801 mmaptype='void *'
14802 case "$i_sysmman$d_mmap" in
14803 "$define$define")
14804         $cat >mmap.c <<'END'
14805 #include <sys/mman.h>
14806 void *mmap();
14807 END
14808         if $cc $ccflags -c mmap.c >/dev/null 2>&1; then
14809                 mmaptype='void *'
14810         else
14811                 mmaptype='caddr_t'
14812         fi
14813         echo "and it returns ($mmaptype)." >&4
14814         ;;
14815 esac
14816
14817
14818
14819 : see if sqrtl exists
14820 set sqrtl d_sqrtl
14821 eval $inlibc
14822
14823 : see if scalbnl exists
14824 set scalbnl d_scalbnl
14825 eval $inlibc
14826
14827 : see if modfl exists
14828 set modfl d_modfl
14829 eval $inlibc
14830
14831 : see if prototype for modfl is available
14832 echo " "
14833 set d_modflproto modfl $i_math math.h
14834 eval $hasproto
14835
14836 d_modfl_pow32_bug="$undef"
14837
14838 case "$d_longdbl$d_modfl" in
14839 $define$define)
14840         $cat <<EOM
14841 Checking to see whether your modfl() is okay for large values...
14842 EOM
14843 $cat >try.c <<EOCP
14844 #include <math.h> 
14845 #include <stdio.h>
14846 EOCP
14847 if $test "X$d_modflproto" != "X$define"; then
14848         $cat >>try.c <<EOCP
14849 /* Sigh. many current glibcs provide the function, but do not prototype it.  */ 
14850 long double modfl (long double, long double *);
14851 EOCP
14852 fi
14853 $cat >>try.c <<EOCP
14854 int main() {
14855     long double nv = 4294967303.15;
14856     long double v, w;
14857     v = modfl(nv, &w);         
14858 #ifdef __GLIBC__
14859     printf("glibc");
14860 #endif
14861     printf(" %"$sPRIfldbl" %"$sPRIfldbl" %"$sPRIfldbl"\n", nv, v, w);
14862     return 0;
14863 }
14864 EOCP
14865         case "$osname:$gccversion" in
14866         aix:)   saveccflags="$ccflags"
14867                 ccflags="$ccflags -qlongdouble" ;; # to avoid core dump
14868         esac
14869         set try
14870         if eval $compile; then
14871                 foo=`$run ./try`
14872                 case "$foo" in
14873                 *" 4294967303.150000 1.150000 4294967302.000000")
14874                         echo >&4 "Your modfl() is broken for large values."
14875                         d_modfl_pow32_bug="$define"
14876                         case "$foo" in
14877                         glibc)  echo >&4 "You should upgrade your glibc to at least 2.2.2 to get a fixed modfl()."
14878                         ;;
14879                         esac
14880                         ;;
14881                 *" 4294967303.150000 0.150000 4294967303.000000")
14882                         echo >&4 "Your modfl() seems okay for large values."
14883                         ;;
14884                 *)      echo >&4 "I don't understand your modfl() at all."
14885                         d_modfl="$undef"
14886                         ;;
14887                 esac
14888                 $rm -f try.* try core core.try.*
14889         else
14890                 echo "I cannot figure out whether your modfl() is okay, assuming it isn't."
14891                 d_modfl="$undef"
14892         fi
14893         case "$osname:$gccversion" in
14894         aix:)   ccflags="$saveccflags" ;; # restore
14895         esac
14896         ;;
14897 esac
14898
14899 if $test "$uselongdouble" = "$define"; then
14900     message=""
14901     if $test "$d_sqrtl" != "$define"; then
14902         message="$message sqrtl"
14903     fi
14904     if $test "$d_modfl" != "$define"; then
14905         if $test "$d_aintl:$d_copysignl" = "$define:$define"; then
14906             echo "You have both aintl and copysignl, so I can emulate modfl."
14907         else
14908             message="$message modfl"
14909         fi
14910     fi
14911     if $test "$d_frexpl" != "$define"; then
14912         if $test "$d_ilogbl:$d_scalbnl" = "$define:$define"; then
14913             echo "You have both ilogbl and scalbnl, so I can emulate frexpl."
14914         else
14915             message="$message frexpl"
14916         fi
14917     fi
14918
14919     if $test "$message" != ""; then
14920         $cat <<EOM >&4
14921
14922 *** You requested the use of long doubles but you do not seem to have
14923 *** the following mathematical functions needed for long double support:
14924 ***    $message
14925 *** Please rerun Configure without -Duselongdouble and/or -Dusemorebits.
14926 *** Cannot continue, aborting.
14927
14928 EOM
14929
14930         exit 1
14931     fi
14932 fi
14933
14934 : see if mprotect exists
14935 set mprotect d_mprotect
14936 eval $inlibc
14937
14938 : see if msgctl exists
14939 set msgctl d_msgctl
14940 eval $inlibc
14941
14942 : see if msgget exists
14943 set msgget d_msgget
14944 eval $inlibc
14945
14946 : see if msgsnd exists
14947 set msgsnd d_msgsnd
14948 eval $inlibc
14949
14950 : see if msgrcv exists
14951 set msgrcv d_msgrcv
14952 eval $inlibc
14953
14954 : see how much of the 'msg*(2)' library is present.
14955 h_msg=true
14956 echo " "
14957 case "$d_msgctl$d_msgget$d_msgsnd$d_msgrcv" in
14958 *"$undef"*) h_msg=false;;
14959 esac
14960 case "$osname" in
14961 freebsd)
14962     case "`ipcs 2>&1`" in
14963     "SVID messages"*"not configured"*)
14964         echo "Your $osname does not have the msg*(2) configured." >&4
14965         h_msg=false
14966         val="$undef"
14967         set msgctl d_msgctl
14968         eval $setvar
14969         set msgget d_msgget
14970         eval $setvar
14971         set msgsnd d_msgsnd
14972         eval $setvar
14973         set msgrcv d_msgrcv
14974         eval $setvar
14975         ;;
14976     esac
14977     ;;
14978 esac
14979 : we could also check for sys/ipc.h ...
14980 if $h_msg && $test `./findhdr sys/msg.h`; then
14981         echo "You have the full msg*(2) library." >&4
14982         val="$define"
14983 else
14984         echo "You don't have the full msg*(2) library." >&4
14985         val="$undef"
14986 fi
14987 set d_msg
14988 eval $setvar
14989
14990
14991 echo " "
14992 echo "Checking to see if your system supports struct msghdr..." >&4
14993 set d_msghdr_s msghdr $i_systypes sys/types.h $d_socket sys/socket.h $i_sysuio sys/uio.h
14994 eval $hasstruct
14995 case "$d_msghdr_s" in
14996 "$define")      echo "Yes, it does."   ;;
14997 *)              echo "No, it doesn't." ;;
14998 esac
14999
15000
15001 : see if msync exists
15002 set msync d_msync
15003 eval $inlibc
15004
15005 : see if munmap exists
15006 set munmap d_munmap
15007 eval $inlibc
15008
15009 : see if nice exists
15010 set nice d_nice
15011 eval $inlibc
15012
15013 : see if this is a langinfo.h system
15014 set langinfo.h i_langinfo
15015 eval $inhdr
15016
15017 : see if nl_langinfo exists
15018 set nl_langinfo d_nl_langinfo
15019 eval $inlibc
15020
15021 : check for length of character
15022 echo " "
15023 case "$charsize" in
15024 '')
15025         echo "Checking to see how big your characters are (hey, you never know)..." >&4
15026         $cat >try.c <<EOCP
15027 #include <stdio.h>
15028 #$i_stdlib I_STDLIB
15029 #ifdef I_STDLIB
15030 #include <stdlib.h>
15031 #endif
15032 int main()
15033 {
15034     printf("%d\n", (int)sizeof(char));
15035     exit(0);
15036 }
15037 EOCP
15038         set try
15039         if eval $compile_ok; then
15040                 dflt=`$run ./try`
15041         else
15042                 dflt='1'
15043                 echo "(I can't seem to compile the test program.  Guessing...)"
15044         fi
15045         ;;
15046 *)
15047         dflt="$charsize"
15048         ;;
15049 esac
15050 rp="What is the size of a character (in bytes)?"
15051 . ./myread
15052 charsize="$ans"
15053 $rm -f try.c try
15054
15055 : check for volatile keyword
15056 echo " "
15057 echo 'Checking to see if your C compiler knows about "volatile"...' >&4
15058 $cat >try.c <<'EOCP'
15059 int main()
15060 {
15061         typedef struct _goo_struct goo_struct;
15062         goo_struct * volatile goo = ((goo_struct *)0);
15063         struct _goo_struct {
15064                 long long_int;
15065                 int reg_int;
15066                 char char_var;
15067         };
15068         typedef unsigned short foo_t;
15069         char *volatile foo;
15070         volatile int bar;
15071         volatile foo_t blech;
15072         foo = foo;
15073 }
15074 EOCP
15075 if $cc -c $ccflags try.c >/dev/null 2>&1 ; then
15076         val="$define"
15077         echo "Yup, it does."
15078 else
15079         val="$undef"
15080         echo "Nope, it doesn't."
15081 fi
15082 set d_volatile
15083 eval $setvar
15084 $rm -f try.*
15085
15086
15087 echo " "
15088 $echo "Choosing the C types to be used for Perl's internal types..." >&4
15089
15090 case "$use64bitint:$d_quad:$quadtype" in
15091 define:define:?*)
15092         ivtype="$quadtype"
15093         uvtype="$uquadtype"
15094         ivsize=8
15095         uvsize=8
15096         ;;
15097 *)      ivtype="long"
15098         uvtype="unsigned long"
15099         ivsize=$longsize
15100         uvsize=$longsize
15101         ;;
15102 esac
15103
15104 case "$uselongdouble:$d_longdbl" in
15105 define:define)
15106         nvtype="long double"
15107         nvsize=$longdblsize
15108         ;;
15109 *)      nvtype=double
15110         nvsize=$doublesize
15111         ;;
15112 esac
15113
15114 $echo "(IV will be "$ivtype", $ivsize bytes)"
15115 $echo "(UV will be "$uvtype", $uvsize bytes)"
15116 $echo "(NV will be "$nvtype", $nvsize bytes)"
15117
15118 $cat >try.c <<EOCP
15119 #$i_inttypes I_INTTYPES
15120 #ifdef I_INTTYPES
15121 #include <inttypes.h>
15122 #endif
15123 #include <stdio.h>
15124 int main() {
15125 #ifdef INT8
15126    int8_t i =  INT8_MAX;
15127   uint8_t u = UINT8_MAX;
15128   printf("int8_t\n");
15129 #endif
15130 #ifdef INT16
15131    int16_t i =  INT16_MAX;
15132   uint16_t i = UINT16_MAX;
15133   printf("int16_t\n");
15134 #endif
15135 #ifdef INT32
15136    int32_t i =  INT32_MAX;
15137   uint32_t u = UINT32_MAX;
15138   printf("int32_t\n");
15139 #endif
15140 }
15141 EOCP
15142
15143 case "$i8type" in
15144 '')     case "$charsize" in
15145         1)      i8type=char
15146                 u8type="unsigned char"
15147                 i8size=$charsize
15148                 u8size=$charsize
15149                 ;;
15150         esac
15151         ;;
15152 esac
15153 case "$i8type" in
15154 '')     set try -DINT8
15155         if eval $compile; then
15156                 case "`$run ./try`" in
15157                 int8_t) i8type=int8_t
15158                         u8type=uint8_t
15159                         i8size=1
15160                         u8size=1
15161                         ;;
15162                 esac
15163         fi
15164         ;;
15165 esac
15166 case "$i8type" in
15167 '')     if $test $charsize -ge 1; then
15168                 i8type=char
15169                 u8type="unsigned char"
15170                 i8size=$charsize
15171                 u8size=$charsize
15172         fi
15173         ;;
15174 esac
15175
15176 case "$i16type" in
15177 '')     case "$shortsize" in
15178         2)      i16type=short
15179                 u16type="unsigned short"
15180                 i16size=$shortsize
15181                 u16size=$shortsize
15182                 ;;
15183         esac
15184         ;;
15185 esac
15186 case "$i16type" in
15187 '')     set try -DINT16
15188         if eval $compile; then
15189                 case "`$run ./try`" in
15190                 int16_t)
15191                         i16type=int16_t
15192                         u16type=uint16_t
15193                         i16size=2
15194                         u16size=2
15195                         ;;
15196                 esac
15197         fi
15198         ;;
15199 esac
15200 case "$i16type" in
15201 '')     if $test $shortsize -ge 2; then
15202                 i16type=short
15203                 u16type="unsigned short"
15204                 i16size=$shortsize
15205                 u16size=$shortsize
15206         fi
15207         ;;
15208 esac
15209
15210 case "$i32type" in
15211 '')     case "$longsize" in
15212         4)      i32type=long
15213                 u32type="unsigned long"
15214                 i32size=$longsize
15215                 u32size=$longsize
15216                 ;;
15217         *)      case "$intsize" in
15218                 4)      i32type=int
15219                         u32type="unsigned int"
15220                         i32size=$intsize
15221                         u32size=$intsize
15222                         ;;
15223                 esac
15224                 ;;
15225         esac
15226         ;;
15227 esac
15228 case "$i32type" in
15229 '')     set try -DINT32
15230         if eval $compile; then
15231                 case "`$run ./try`" in
15232                 int32_t)
15233                         i32type=int32_t
15234                         u32type=uint32_t
15235                         i32size=4
15236                         u32size=4
15237                         ;;
15238                 esac
15239         fi
15240         ;;
15241 esac
15242 case "$i32type" in
15243 '')     if $test $intsize -ge 4; then
15244                 i32type=int
15245                 u32type="unsigned int"
15246                 i32size=$intsize
15247                 u32size=$intsize
15248         fi
15249         ;;
15250 esac
15251
15252 case "$i64type" in
15253 '')     case "$d_quad:$quadtype" in
15254         define:?*)
15255                 i64type="$quadtype"
15256                 u64type="$uquadtype"
15257                 i64size=8
15258                 u64size=8
15259                 ;;
15260         esac
15261         ;;
15262 esac
15263
15264 $echo "Checking how many bits of your UVs your NVs can preserve..." >&4
15265 : volatile so that the compiler has to store it out to memory.
15266 if test X"$d_volatile" = X"$define"; then
15267         volatile=volatile
15268 fi
15269 $cat <<EOP >try.c
15270 #include <stdio.h>
15271 #$i_stdlib I_STDLIB
15272 #ifdef I_STDLIB
15273 #include <stdlib.h>
15274 #endif
15275 #include <sys/types.h>
15276 #include <signal.h>
15277 #ifdef SIGFPE
15278 $volatile int bletched = 0;
15279 $signal_t blech(int s) { bletched = 1; }
15280 #endif
15281 int main() {
15282     $uvtype u = 0;
15283     $nvtype d;
15284     int     n = 8 * $uvsize;
15285     int     i;
15286 #ifdef SIGFPE
15287     signal(SIGFPE, blech);
15288 #endif
15289
15290     for (i = 0; i < n; i++) {
15291       u = u << 1 | ($uvtype)1;
15292       d = ($nvtype)u;
15293       if (($uvtype)d != u)
15294         break;
15295       if (d <= 0)
15296         break;
15297       d = ($nvtype)(u - 1);
15298       if (($uvtype)d != (u - 1))
15299         break;
15300 #ifdef SIGFPE
15301       if (bletched) {
15302         break;
15303 #endif
15304       } 
15305     }
15306     printf("%d\n", ((i == n) ? -n : i));
15307     exit(0);
15308 }
15309 EOP
15310 set try
15311
15312 d_nv_preserves_uv="$undef"
15313 if eval $compile; then
15314         nv_preserves_uv_bits="`$run ./try`"
15315 fi
15316 case "$nv_preserves_uv_bits" in
15317 \-[1-9]*)       
15318         nv_preserves_uv_bits=`expr 0 - $nv_preserves_uv_bits`
15319         $echo "Your NVs can preserve all $nv_preserves_uv_bits bits of your UVs."  2>&1
15320         d_nv_preserves_uv="$define"
15321         ;;
15322 [1-9]*) $echo "Your NVs can preserve only $nv_preserves_uv_bits bits of your UVs."  2>&1
15323         d_nv_preserves_uv="$undef" ;;
15324 *)      $echo "Can't figure out how many bits your NVs preserve." 2>&1
15325         nv_preserves_uv_bits="$undef" ;;
15326 esac
15327
15328 $rm -f try.* try
15329
15330 $echo "Checking whether NV 0.0 is all bits zero in memory..." >&4
15331 : volatile so that the compiler has to store it out to memory.
15332 if test X"$d_volatile" = X"$define"; then
15333         volatile=volatile
15334 fi
15335 $cat <<EOP >try.c
15336 #include <stdio.h>
15337 #$i_stdlib I_STDLIB
15338 #ifdef I_STDLIB
15339 #include <stdlib.h>
15340 #endif
15341 #$i_string I_STRING
15342 #ifdef I_STRING
15343 #  include <string.h>
15344 #else
15345 #  include <strings.h>
15346 #endif
15347 #include <sys/types.h>
15348 #include <signal.h>
15349 #ifdef SIGFPE
15350 $volatile int bletched = 0;
15351 $signal_t blech(int s) { bletched = 1; }
15352 #endif
15353
15354 int checkit($nvtype d, char *where) {
15355     unsigned char *p = (char *)&d;
15356     unsigned char *end = p + sizeof(d);
15357     int fail = 0;
15358
15359     while (p < end)
15360         fail += *p++;
15361
15362     if (!fail)
15363         return 0;
15364
15365     p = (char *)&d;
15366     printf("No - %s: 0x", where);
15367     while (p < end)
15368         printf ("%02X", *p++);
15369     printf("\n");
15370     return 1;
15371 }
15372
15373 int main(int argc, char **argv) {
15374     $nvtype d = 0.0;
15375     int fail = 0;
15376     fail += checkit(d, "0.0");
15377
15378     /* The compiler shouldn't be assuming that bletched is 0  */
15379     d = bletched;
15380
15381     fail += checkit(d, "bleched");
15382
15383 #ifdef SIGFPE
15384     signal(SIGFPE, blech);
15385 #endif
15386
15387     /* Paranoia - the compiler should have no way of knowing that ANSI says
15388        that argv[argc] will always be NULL.  Actually, if it did assume this it
15389        would be buggy, as this is C and main() can be called from elsewhere in
15390        the program.  */
15391     d = argv[argc] ? 1 : 0;
15392
15393     if (d) {
15394         printf("Odd argv[argc]=%p, d=%g\n", argv[argc], d);
15395     }
15396
15397     fail += checkit(d, "ternary");
15398
15399     memset(&d, sizeof(d), argv[argc] ? 1 : 0);
15400
15401     if (d != 0.0) {
15402         printf("No - memset doesn't give 0.0\n");
15403         /* This might just blow up:  */
15404         printf("(gives %g)\n", d);
15405         return 1;
15406     }
15407     
15408 #ifdef SIGFPE
15409     if (bletched) {
15410         printf("No - something bleched\n");
15411         return 1;
15412     }
15413 #endif
15414     if (fail) {
15415       printf("No - %d fail(s)\n", fail);
15416       return 1;
15417     }
15418     printf("Yes\n");
15419     return 0;
15420 }
15421 EOP
15422 set try
15423
15424 d_nv_zero_is_allbits_zero="$undef"
15425 if eval $compile; then
15426     xxx="`$run ./try`"
15427     case "$?" in
15428         0)
15429             case "$xxx" in
15430                 Yes)  cat >&4 <<EOM
15431 0.0 is represented as all bits zero in memory
15432 EOM
15433                     d_nv_zero_is_allbits_zero="$define"
15434                     ;;
15435                 *)  cat >&4 <<EOM
15436 0.0 is not represented as all bits zero in memory
15437 EOM
15438                     d_nv_zero_is_allbits_zero="$undef"
15439                     ;;
15440             esac
15441             ;;
15442         *)  cat >&4 <<EOM
15443 0.0 is not represented as all bits zero in memory
15444 EOM
15445             d_nv_zero_is_allbits_zero="$undef"
15446             ;;
15447     esac
15448 fi
15449
15450 $rm -f try.* try
15451
15452
15453 : check for off64_t
15454 echo " "
15455 echo "Checking to see if you have off64_t..." >&4
15456 $cat >try.c <<EOCP
15457 #include <sys/types.h>
15458 #include <unistd.h>
15459 int main() { off64_t x = 7; }
15460 EOCP
15461 set try
15462 if eval $compile; then
15463         val="$define"
15464         echo "You have off64_t."
15465 else
15466         val="$undef"
15467         echo "You do not have off64_t."
15468         case "$lseeksize" in
15469         8) echo "(Your off_t is 64 bits, so you could use that.)" ;;
15470         esac
15471 fi
15472 $rm -f try.* try
15473 set d_off64_t
15474 eval $setvar
15475
15476 : how to create joinable pthreads
15477 if test "X$usethreads" = "X$define" -a "X$i_pthread" = "X$define"; then
15478         echo " "
15479         echo "Checking what constant to use for creating joinable pthreads..." >&4 
15480         $cat >try.c <<'EOCP'
15481 #include <pthread.h>
15482 int main() {
15483     int detachstate = JOINABLE;
15484 }
15485 EOCP
15486         set try -DJOINABLE=PTHREAD_CREATE_JOINABLE
15487         if eval $compile; then
15488                 echo "You seem to use PTHREAD_CREATE_JOINABLE." >&4
15489                 val="$undef" # Yes, undef.
15490                 set d_old_pthread_create_joinable
15491                 eval $setvar
15492                 val=""
15493                 set old_pthread_create_joinable
15494                 eval $setvar
15495         else
15496                 set try -DJOINABLE=PTHREAD_CREATE_UNDETACHED
15497                 if eval $compile; then
15498                         echo "You seem to use PTHREAD_CREATE_UNDETACHED." >&4
15499                         val="$define"
15500                         set d_old_pthread_create_joinable
15501                         eval $setvar
15502                         val=PTHREAD_CREATE_UNDETACHED
15503                         set old_pthread_create_joinable
15504                         eval $setvar
15505                 else            
15506                         set try -DJOINABLE=__UNDETACHED
15507                         if eval $compile; then
15508                                 echo "You seem to use __UNDETACHED." >&4
15509                                 val="$define"
15510                                 set d_old_pthread_create_joinable
15511                                 eval $setvar
15512                                 val=__UNDETACHED
15513                                 set old_pthread_create_joinable
15514                                 eval $setvar
15515                         else
15516                                 echo "Egads, nothing obvious found.  Guessing that you use 0." >&4
15517                                 val="$define"
15518                                 set d_old_pthread_create_joinable
15519                                 eval $setvar
15520                                 val=0
15521                                 set old_pthread_create_joinable
15522                                 eval $setvar
15523                         fi
15524                 fi
15525         fi
15526         $rm -f try try.*
15527 else
15528     d_old_pthread_create_joinable="$undef"
15529     old_pthread_create_joinable=""
15530 fi
15531
15532 : see if pause exists
15533 set pause d_pause
15534 eval $inlibc
15535
15536 : see if pipe exists
15537 set pipe d_pipe
15538 eval $inlibc
15539
15540 : see if poll exists
15541 set poll d_poll
15542 eval $inlibc
15543
15544 : see if readlink exists
15545 set readlink d_readlink
15546 eval $inlibc
15547
15548 echo " "
15549 procselfexe=''
15550 val="$undef"
15551 case "$d_readlink" in
15552 "$define")
15553         if $issymlink /proc/self/exe ; then
15554                 $ls -l /proc/self/exe > reflect
15555                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15556                         echo "You have Linux-like /proc/self/exe."
15557                         procselfexe='"/proc/self/exe"'
15558                         val="$define"
15559                 fi
15560         fi
15561         if $issymlink /proc/curproc/file ; then
15562                 $ls -l /proc/curproc/file > reflect
15563                 if $contains /`basename $ls` reflect >/dev/null 2>&1; then
15564                         echo "You have BSD-like /proc/curproc/file."
15565                         procselfexe='"/proc/curproc/file"'
15566                         val="$define"
15567                 fi
15568         fi
15569         ;;
15570 esac
15571 $rm -f reflect
15572 set d_procselfexe
15573 eval $setvar
15574
15575 : backward compatibility for d_hvfork
15576 if test X$d_hvfork != X; then
15577         d_vfork="$d_hvfork"
15578         d_hvfork=''
15579 fi
15580 : see if there is a vfork
15581 val=''
15582 set vfork val
15583 eval $inlibc
15584
15585 d_pseudofork=$undef
15586
15587 : Ok, but do we want to use it. vfork is reportedly unreliable in
15588 : perl on Solaris 2.x, and probably elsewhere.
15589 case "$val" in
15590 $define)
15591         echo " "
15592         case "$usevfork" in
15593         false) dflt='n';;
15594         *) dflt='y';;
15595         esac
15596         cat <<'EOM'
15597
15598 Perl can only use a vfork() that doesn't suffer from strict
15599 restrictions on calling functions or modifying global data in
15600 the child.  For example, glibc-2.1 contains such a vfork()
15601 that is unsuitable.  If your system provides a proper fork()
15602 call, chances are that you do NOT want perl to use vfork().
15603
15604 EOM
15605         rp="Do you still want to use vfork()?"
15606         . ./myread
15607         case "$ans" in
15608         y|Y) ;;
15609         *)
15610                 echo "Ok, we won't use vfork()."
15611                 val="$undef"
15612                 ;;
15613         esac
15614         ;;
15615 esac
15616 set d_vfork
15617 eval $setvar
15618 case "$d_vfork" in
15619 $define) usevfork='true';;
15620 *) usevfork='false';;
15621 esac
15622
15623 : see whether the pthread_atfork exists
15624 $cat >try.c <<EOP
15625 #include <pthread.h>
15626 #include <stdio.h>
15627 int main() {
15628 #ifdef  PTHREAD_ATFORK
15629         pthread_atfork(NULL,NULL,NULL);
15630 #endif
15631 }
15632 EOP
15633
15634 : see if pthread_atfork exists
15635 set try -DPTHREAD_ATFORK
15636 if eval $compile; then
15637     val="$define"
15638 else
15639     val="$undef"
15640 fi
15641 case "$usethreads" in
15642 $define)
15643         case "$val" in
15644         $define) echo 'pthread_atfork found.' >&4        ;;
15645         *)       echo 'pthread_atfork NOT found.' >&4    ;;
15646         esac
15647 esac
15648 set d_pthread_atfork
15649 eval $setvar
15650
15651 : see if pthread_attr_setscope exists
15652 set pthread_attr_setscope d_pthread_attr_setscope
15653 eval $inlibc
15654
15655
15656 : see whether the various POSIXish _yields exist
15657 $cat >try.c <<EOP
15658 #include <pthread.h>
15659 #include <stdio.h>
15660 int main() {
15661 #ifdef SCHED_YIELD
15662         sched_yield();
15663 #else
15664 #ifdef PTHREAD_YIELD
15665         pthread_yield();
15666 #else
15667 #ifdef PTHREAD_YIELD_NULL
15668         pthread_yield(NULL);
15669 #endif
15670 #endif
15671 #endif
15672 }
15673 EOP
15674 : see if sched_yield exists
15675 set try -DSCHED_YIELD
15676 if eval $compile; then
15677     val="$define"
15678     sched_yield='sched_yield()'
15679 else
15680     val="$undef"
15681 fi
15682 case "$usethreads" in
15683 $define)
15684         case "$val" in
15685         $define) echo 'sched_yield() found.' >&4        ;;
15686         *)       echo 'sched_yield() NOT found.' >&4    ;;
15687         esac
15688 esac
15689 set d_sched_yield
15690 eval $setvar
15691
15692 : see if pthread_yield exists
15693 set try -DPTHREAD_YIELD
15694 if eval $compile; then
15695     val="$define"
15696     case "$sched_yield" in
15697     '') sched_yield='pthread_yield()' ;;
15698     esac
15699 else
15700     set try -DPTHREAD_YIELD_NULL
15701     if eval $compile; then
15702         val="$define"
15703         case "$sched_yield" in
15704         '') sched_yield='pthread_yield(NULL)' ;;
15705         esac
15706     else
15707         val="$undef"
15708     fi
15709 fi
15710 case "$usethreads" in
15711 $define)
15712         case "$val" in
15713         $define) echo 'pthread_yield() found.' >&4      ;;
15714         *)       echo 'pthread_yield() NOT found.' >&4  ;;
15715         esac
15716         ;;
15717 esac
15718 set d_pthread_yield
15719 eval $setvar
15720
15721 case "$sched_yield" in
15722 '') sched_yield=undef ;;
15723 esac
15724
15725 $rm -f try try.*
15726
15727 : see if random_r exists
15728 set random_r d_random_r
15729 eval $inlibc
15730 case "$d_random_r" in
15731 "$define")
15732         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
15733         case "$d_random_r_proto:$usethreads" in
15734         ":define")      d_random_r_proto=define
15735                 set d_random_r_proto random_r $hdrs
15736                 eval $hasproto ;;
15737         *)      ;;
15738         esac
15739         case "$d_random_r_proto" in
15740         define)
15741         case "$random_r_proto" in
15742         ''|0) try='int random_r(int*, struct random_data*);'
15743         ./protochk "extern $try" $hdrs && random_r_proto=I_iS ;;
15744         esac
15745         case "$random_r_proto" in
15746         ''|0) try='int random_r(long*, struct random_data*);'
15747         ./protochk "extern $try" $hdrs && random_r_proto=I_lS ;;
15748         esac
15749         case "$random_r_proto" in
15750         ''|0) try='int random_r(struct random_data*, int32_t*);'
15751         ./protochk "extern $try" $hdrs && random_r_proto=I_St ;;
15752         esac
15753         case "$random_r_proto" in
15754         ''|0)   d_random_r=undef
15755                 random_r_proto=0
15756                 echo "Disabling random_r, cannot determine prototype." >&4 ;;
15757         * )     case "$random_r_proto" in
15758                 REENTRANT_PROTO*) ;;
15759                 *) random_r_proto="REENTRANT_PROTO_$random_r_proto" ;;
15760                 esac
15761                 echo "Prototype: $try" ;;
15762         esac
15763         ;;
15764         *)      case "$usethreads" in
15765                 define) echo "random_r has no prototype, not using it." >&4 ;;
15766                 esac
15767                 d_random_r=undef
15768                 random_r_proto=0
15769                 ;;
15770         esac
15771         ;;
15772 *)      random_r_proto=0
15773         ;;
15774 esac
15775
15776 : see if readdir and friends exist
15777 set readdir d_readdir
15778 eval $inlibc
15779 set seekdir d_seekdir
15780 eval $inlibc
15781 set telldir d_telldir
15782 eval $inlibc
15783 set rewinddir d_rewinddir
15784 eval $inlibc
15785
15786 : see if readdir64_r exists
15787 set readdir64_r d_readdir64_r
15788 eval $inlibc
15789 case "$d_readdir64_r" in
15790 "$define")
15791         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15792         case "$d_readdir64_r_proto:$usethreads" in
15793         ":define")      d_readdir64_r_proto=define
15794                 set d_readdir64_r_proto readdir64_r $hdrs
15795                 eval $hasproto ;;
15796         *)      ;;
15797         esac
15798         case "$d_readdir64_r_proto" in
15799         define)
15800         case "$readdir64_r_proto" in
15801         ''|0) try='int readdir64_r(DIR*, struct dirent64*, struct dirent64**);'
15802         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TSR ;;
15803         esac
15804         case "$readdir64_r_proto" in
15805         ''|0) try='int readdir64_r(DIR*, struct dirent64*);'
15806         ./protochk "extern $try" $hdrs && readdir64_r_proto=I_TS ;;
15807         esac
15808         case "$readdir64_r_proto" in
15809         ''|0)   d_readdir64_r=undef
15810                 readdir64_r_proto=0
15811                 echo "Disabling readdir64_r, cannot determine prototype." >&4 ;;
15812         * )     case "$readdir64_r_proto" in
15813                 REENTRANT_PROTO*) ;;
15814                 *) readdir64_r_proto="REENTRANT_PROTO_$readdir64_r_proto" ;;
15815                 esac
15816                 echo "Prototype: $try" ;;
15817         esac
15818         ;;
15819         *)      case "$usethreads" in
15820                 define) echo "readdir64_r has no prototype, not using it." >&4 ;;
15821                 esac
15822                 d_readdir64_r=undef
15823                 readdir64_r_proto=0
15824                 ;;
15825         esac
15826         ;;
15827 *)      readdir64_r_proto=0
15828         ;;
15829 esac
15830
15831 : see if readdir_r exists
15832 set readdir_r d_readdir_r
15833 eval $inlibc
15834 case "$d_readdir_r" in
15835 "$define")
15836         hdrs="$i_systypes sys/types.h define stdio.h $i_dirent dirent.h"
15837         case "$d_readdir_r_proto:$usethreads" in
15838         ":define")      d_readdir_r_proto=define
15839                 set d_readdir_r_proto readdir_r $hdrs
15840                 eval $hasproto ;;
15841         *)      ;;
15842         esac
15843         case "$d_readdir_r_proto" in
15844         define)
15845         case "$readdir_r_proto" in
15846         ''|0) try='int readdir_r(DIR*, struct dirent*, struct dirent**);'
15847         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TSR ;;
15848         esac
15849         case "$readdir_r_proto" in
15850         ''|0) try='int readdir_r(DIR*, struct dirent*);'
15851         ./protochk "extern $try" $hdrs && readdir_r_proto=I_TS ;;
15852         esac
15853         case "$readdir_r_proto" in
15854         ''|0)   d_readdir_r=undef
15855                 readdir_r_proto=0
15856                 echo "Disabling readdir_r, cannot determine prototype." >&4 ;;
15857         * )     case "$readdir_r_proto" in
15858                 REENTRANT_PROTO*) ;;
15859                 *) readdir_r_proto="REENTRANT_PROTO_$readdir_r_proto" ;;
15860                 esac
15861                 echo "Prototype: $try" ;;
15862         esac
15863         ;;
15864         *)      case "$usethreads" in
15865                 define) echo "readdir_r has no prototype, not using it." >&4 ;;
15866                 esac
15867                 d_readdir_r=undef
15868                 readdir_r_proto=0
15869                 ;;
15870         esac
15871         ;;
15872 *)      readdir_r_proto=0
15873         ;;
15874 esac
15875
15876 : see if readv exists
15877 set readv d_readv
15878 eval $inlibc
15879
15880 : see if recvmsg exists
15881 set recvmsg d_recvmsg
15882 eval $inlibc
15883
15884 : see if rename exists
15885 set rename d_rename
15886 eval $inlibc
15887
15888 : see if rmdir exists
15889 set rmdir d_rmdir
15890 eval $inlibc
15891
15892 : see if memory.h is available.
15893 val=''
15894 set memory.h val
15895 eval $inhdr
15896
15897 : See if it conflicts with string.h
15898 case "$val" in
15899 $define)
15900         case "$strings" in
15901         '') ;;
15902         *)
15903                 $cppstdin $cppflags $cppminus < $strings > mem.h
15904                 if $contains 'memcpy' mem.h >/dev/null 2>&1; then
15905                         echo " "
15906                         echo "We won't be including <memory.h>."
15907                         val="$undef"
15908                 fi
15909                 $rm -f mem.h
15910                 ;;
15911         esac
15912 esac
15913 set i_memory
15914 eval $setvar
15915
15916 : can bcopy handle overlapping blocks?
15917 echo " "
15918 val="$undef"
15919 case "$d_memmove" in
15920 "$define") echo "I'll use memmove() instead of bcopy() for overlapping copies." ;;
15921 *)      case "$d_bcopy" in
15922         "$define")
15923                 echo "Checking to see if bcopy() can do overlapping copies..." >&4
15924                 $cat >try.c <<EOCP
15925 #$i_memory I_MEMORY
15926 #$i_stdlib I_STDLIB
15927 #$i_string I_STRING
15928 #$i_unistd I_UNISTD
15929 EOCP
15930         $cat >>try.c <<'EOCP'
15931 #include <stdio.h>
15932 #ifdef I_MEMORY
15933 #  include <memory.h>
15934 #endif
15935 #ifdef I_STDLIB
15936 #  include <stdlib.h>
15937 #endif
15938 #ifdef I_STRING
15939 #  include <string.h>
15940 #else
15941 #  include <strings.h>
15942 #endif
15943 #ifdef I_UNISTD
15944 #  include <unistd.h>  /* Needed for NetBSD */
15945 #endif
15946 int main()
15947 {
15948 char buf[128], abc[128];
15949 char *b;
15950 int len;
15951 int off;
15952 int align;
15953
15954 /* Copy "abcde..." string to char abc[] so that gcc doesn't
15955    try to store the string in read-only memory. */
15956 bcopy("abcdefghijklmnopqrstuvwxyz0123456789", abc, 36);
15957
15958 for (align = 7; align >= 0; align--) {
15959         for (len = 36; len; len--) {
15960                 b = buf+align;
15961                 bcopy(abc, b, len);
15962                 for (off = 1; off <= len; off++) {
15963                         bcopy(b, b+off, len);
15964                         bcopy(b+off, b, len);
15965                         if (bcmp(b, abc, len))
15966                                 exit(1);
15967                 }
15968         }
15969 }
15970 exit(0);
15971 }
15972 EOCP
15973                 set try
15974                 if eval $compile_ok; then
15975                         if ./try 2>/dev/null; then
15976                                 echo "Yes, it can."
15977                                 val="$define"
15978                         else
15979                                 echo "It can't, sorry."
15980                         fi
15981                 else
15982                         echo "(I can't compile the test program, so we'll assume not...)"
15983                 fi
15984                 ;;
15985         esac
15986         $rm -f try.* try core
15987         ;;
15988 esac
15989 set d_safebcpy
15990 eval $setvar
15991
15992 : can memcpy handle overlapping blocks?
15993 echo " "
15994 val="$undef"
15995 case "$d_memmove" in
15996 "$define") echo "I'll use memmove() instead of memcpy() for overlapping copies." ;;
15997 *)      case "$d_memcpy" in
15998         "$define")
15999                 echo "Checking to see if memcpy() can do overlapping copies..." >&4
16000                 $cat >try.c <<EOCP
16001 #$i_memory I_MEMORY
16002 #$i_stdlib I_STDLIB
16003 #$i_string I_STRING
16004 #$i_unistd I_UNISTD
16005 EOCP
16006         $cat >>try.c <<'EOCP'
16007 #include <stdio.h>
16008 #ifdef I_MEMORY
16009 #  include <memory.h>
16010 #endif
16011 #ifdef I_STDLIB
16012 #  include <stdlib.h>
16013 #endif
16014 #ifdef I_STRING
16015 #  include <string.h>
16016 #else
16017 #  include <strings.h>
16018 #endif
16019 #ifdef I_UNISTD
16020 #  include <unistd.h>  /* Needed for NetBSD */
16021 #endif
16022 int main()
16023 {
16024 char buf[128], abc[128];
16025 char *b;
16026 int len;
16027 int off;
16028 int align;
16029
16030 /* Copy "abcde..." string to char abc[] so that gcc doesn't
16031    try to store the string in read-only memory. */
16032 memcpy(abc, "abcdefghijklmnopqrstuvwxyz0123456789", 36);
16033
16034 for (align = 7; align >= 0; align--) {
16035         for (len = 36; len; len--) {
16036                 b = buf+align;
16037                 memcpy(b, abc, len);
16038                 for (off = 1; off <= len; off++) {
16039                         memcpy(b+off, b, len);
16040                         memcpy(b, b+off, len);
16041                         if (memcmp(b, abc, len))
16042                                 exit(1);
16043                 }
16044         }
16045 }
16046 exit(0);
16047 }
16048 EOCP
16049                 set try
16050                 if eval $compile_ok; then
16051                         if ./try 2>/dev/null; then
16052                                 echo "Yes, it can."
16053                                 val="$define"
16054                         else
16055                                 echo "It can't, sorry."
16056                         fi
16057                 else
16058                         echo "(I can't compile the test program, so we'll assume not...)"
16059                 fi
16060                 ;;
16061         esac
16062         $rm -f try.* try core
16063         ;;
16064 esac
16065 set d_safemcpy
16066 eval $setvar
16067
16068 : can memcmp be trusted to compare relative magnitude?
16069 val="$undef"
16070 case "$d_memcmp" in
16071 "$define")
16072         echo " "
16073         echo "Checking if your memcmp() can compare relative magnitude..." >&4
16074         $cat >try.c <<EOCP
16075 #$i_memory I_MEMORY
16076 #$i_stdlib I_STDLIB
16077 #$i_string I_STRING
16078 #$i_unistd I_UNISTD
16079 EOCP
16080         $cat >>try.c <<'EOCP'
16081 #include <stdio.h>
16082 #ifdef I_MEMORY
16083 #  include <memory.h>
16084 #endif
16085 #ifdef I_STDLIB
16086 #  include <stdlib.h>
16087 #endif
16088 #ifdef I_STRING
16089 #  include <string.h>
16090 #else
16091 #  include <strings.h>
16092 #endif
16093 #ifdef I_UNISTD
16094 #  include <unistd.h>  /* Needed for NetBSD */
16095 #endif
16096 int main()
16097 {
16098 char a = -1;
16099 char b = 0;
16100 if ((a < b) && memcmp(&a, &b, 1) < 0)
16101         exit(1);
16102 exit(0);
16103 }
16104 EOCP
16105         set try
16106         if eval $compile_ok; then
16107                 if $run ./try 2>/dev/null; then
16108                         echo "Yes, it can."
16109                         val="$define"
16110                 else
16111                         echo "No, it can't (it uses signed chars)."
16112                 fi
16113         else
16114                 echo "(I can't compile the test program, so we'll assume not...)"
16115         fi
16116         ;;
16117 esac
16118 $rm -f try.* try core
16119 set d_sanemcmp
16120 eval $setvar
16121
16122 : see if prototype for sbrk is available
16123 echo " "
16124 set d_sbrkproto sbrk $i_unistd unistd.h
16125 eval $hasproto
16126
16127 : see if select exists
16128 set select d_select
16129 eval $inlibc
16130
16131 : see if semctl exists
16132 set semctl d_semctl
16133 eval $inlibc
16134
16135 : see if semget exists
16136 set semget d_semget
16137 eval $inlibc
16138
16139 : see if semop exists
16140 set semop d_semop
16141 eval $inlibc
16142
16143 : see how much of the 'sem*(2)' library is present.
16144 h_sem=true
16145 echo " "
16146 case "$d_semctl$d_semget$d_semop" in
16147 *"$undef"*) h_sem=false;;
16148 esac
16149 case "$osname" in
16150 freebsd)
16151     case "`ipcs 2>&1`" in
16152     "SVID messages"*"not configured"*)
16153         echo "Your $osname does not have the sem*(2) configured." >&4
16154         h_sem=false
16155         val="$undef"
16156         set semctl d_semctl
16157         eval $setvar
16158         set semget d_semget
16159         eval $setvar
16160         set semop d_semop
16161         eval $setvar
16162         ;;
16163     esac
16164     ;;
16165 esac
16166 : we could also check for sys/ipc.h ...
16167 if $h_sem && $test `./findhdr sys/sem.h`; then
16168         echo "You have the full sem*(2) library." >&4
16169         val="$define"
16170 else
16171         echo "You don't have the full sem*(2) library." >&4
16172         val="$undef"
16173 fi
16174 set d_sem
16175 eval $setvar
16176
16177 : see whether sys/sem.h defines union semun
16178 echo " "
16179 $cat > try.c <<'END'
16180 #include <sys/types.h>
16181 #include <sys/ipc.h>
16182 #include <sys/sem.h>
16183 int main () { union semun semun; semun.buf = 0; }
16184 END
16185 set try
16186 if eval $compile; then
16187     echo "You have union semun in <sys/sem.h>." >&4
16188     val="$define"
16189 else
16190     echo "You do not have union semun in <sys/sem.h>." >&4
16191     val="$undef"
16192 fi
16193 $rm -f try try.c
16194 set d_union_semun
16195 eval $setvar
16196
16197 : see how to do semctl IPC_STAT
16198 case "$d_sem" in
16199 $define)
16200     echo " "
16201     $cat > try.h <<END
16202 #ifndef S_IRUSR
16203 #   ifdef S_IREAD
16204 #       define S_IRUSR S_IREAD
16205 #       define S_IWUSR S_IWRITE
16206 #       define S_IXUSR S_IEXEC
16207 #   else
16208 #       define S_IRUSR 0400
16209 #       define S_IWUSR 0200
16210 #       define S_IXUSR 0100
16211 #   endif
16212 #   define S_IRGRP (S_IRUSR>>3)
16213 #   define S_IWGRP (S_IWUSR>>3)
16214 #   define S_IXGRP (S_IXUSR>>3)
16215 #   define S_IROTH (S_IRUSR>>6)
16216 #   define S_IWOTH (S_IWUSR>>6)
16217 #   define S_IXOTH (S_IXUSR>>6)
16218 #endif
16219 #ifndef S_IRWXU
16220 #   define S_IRWXU (S_IRUSR|S_IWUSR|S_IXUSR)
16221 #   define S_IRWXG (S_IRGRP|S_IWGRP|S_IXGRP)
16222 #   define S_IRWXO (S_IROTH|S_IWOTH|S_IXOTH)
16223 #endif
16224 END
16225     : see whether semctl IPC_STAT can use union semun
16226     case "$d_semctl_semun" in
16227     '')
16228       val="$undef"
16229       $cat > try.c <<END
16230 #include <sys/types.h>
16231 #include <sys/ipc.h>
16232 #include <sys/sem.h>
16233 #include <sys/stat.h>
16234 #include <stdio.h>
16235 #include <errno.h>
16236 #include "try.h"
16237 #ifndef errno
16238 extern int errno;
16239 #endif
16240 #$d_union_semun HAS_UNION_SEMUN
16241 int main() {
16242     union semun
16243 #ifndef HAS_UNION_SEMUN
16244     {
16245         int val;
16246         struct semid_ds *buf;
16247         unsigned short *array;
16248     }
16249 #endif
16250     arg;
16251     int sem, st;
16252
16253 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) && defined(S_IRWXO) && defined(IPC_CREAT)
16254     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16255     if (sem > -1) {
16256         struct semid_ds argbuf;
16257         arg.buf = &argbuf;
16258 #       ifdef IPC_STAT
16259         st = semctl(sem, 0, IPC_STAT, arg);
16260         if (st == 0)
16261             printf("semun\n");
16262         else
16263 #       endif /* IPC_STAT */
16264             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16265 #       ifdef IPC_RMID
16266         if (semctl(sem, 0, IPC_RMID, arg) != 0)
16267 #       endif /* IPC_RMID */
16268             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16269     } else
16270 #endif /* IPC_PRIVATE && ... */
16271         printf("semget failed: errno = %d\n", errno);
16272   return 0;
16273 }
16274 END
16275       set try
16276       if eval $compile; then
16277           xxx=`$run ./try`
16278           case "$xxx" in
16279           semun) val="$define" ;;
16280           esac
16281       fi
16282       $rm -f try try.c
16283       set d_semctl_semun
16284       eval $setvar
16285       ;;
16286     esac
16287     case "$d_semctl_semun" in
16288     $define)
16289         echo "You can use union semun for semctl IPC_STAT." >&4
16290         also='also'
16291         ;;
16292     *)  echo "You cannot use union semun for semctl IPC_STAT." >&4
16293         also=''
16294         ;;
16295     esac
16296
16297     : see whether semctl IPC_STAT can use struct semid_ds pointer
16298     case "$d_semctl_semid_ds" in
16299     '')
16300       val="$undef"
16301       $cat > try.c <<'END'
16302 #include <sys/types.h>
16303 #include <sys/ipc.h>
16304 #include <sys/sem.h>
16305 #include <sys/stat.h>
16306 #include "try.h"
16307 #include <stdio.h>
16308 #include <errno.h>
16309 #ifndef errno
16310 extern int errno;
16311 #endif
16312 int main() {
16313     struct semid_ds arg;
16314     int sem, st;
16315
16316 #if defined(IPC_PRIVATE) && defined(S_IRWXU) && defined(S_IRWXG) &&  defined(S_IRWXO) && defined(IPC_CREAT)
16317     sem = semget(IPC_PRIVATE, 1, S_IRWXU|S_IRWXG|S_IRWXO|IPC_CREAT);
16318     if (sem > -1) {
16319 #       ifdef IPC_STAT
16320         st = semctl(sem, 0, IPC_STAT, &arg);
16321         if (st == 0)
16322             printf("semid_ds\n");
16323         else
16324 #       endif /* IPC_STAT */
16325             printf("semctl IPC_STAT failed: errno = %d\n", errno);
16326 #       ifdef IPC_RMID
16327         if (semctl(sem, 0, IPC_RMID, &arg) != 0)
16328 #       endif /* IPC_RMID */
16329             printf("semctl IPC_RMID failed: errno = %d\n", errno);
16330     } else
16331 #endif /* IPC_PRIVATE && ... */
16332         printf("semget failed: errno = %d\n", errno);
16333
16334     return 0;
16335 }
16336 END
16337       set try
16338       if eval $compile; then
16339           xxx=`$run ./try`
16340           case "$xxx" in
16341           semid_ds) val="$define" ;;
16342           esac
16343       fi
16344       $rm -f try try.c
16345       set d_semctl_semid_ds
16346       eval $setvar
16347       ;;
16348     esac
16349     case "$d_semctl_semid_ds" in
16350     $define)
16351         echo "You can $also use struct semid_ds* for semctl IPC_STAT." >&4
16352         ;;
16353     *)  echo "You cannot use struct semid_ds* for semctl IPC_STAT." >&4
16354         ;;
16355     esac
16356     $rm -f try.h
16357     ;;
16358 *)  val="$undef"
16359
16360     # We do not have the full sem*(2) library, so assume we can not
16361     # use either.
16362
16363     set d_semctl_semun
16364     eval $setvar
16365
16366     set d_semctl_semid_ds
16367     eval $setvar
16368     ;;
16369 esac
16370
16371 : see if sendmsg exists
16372 set sendmsg d_sendmsg
16373 eval $inlibc
16374
16375 : see if setegid exists
16376 set setegid d_setegid
16377 eval $inlibc
16378
16379 : see if seteuid exists
16380 set seteuid d_seteuid
16381 eval $inlibc
16382
16383 : see if setgrent exists
16384 set setgrent d_setgrent
16385 eval $inlibc
16386
16387 : see if setgrent_r exists
16388 set setgrent_r d_setgrent_r
16389 eval $inlibc
16390 case "$d_setgrent_r" in
16391 "$define")
16392         hdrs="$i_systypes sys/types.h define stdio.h $i_grp grp.h"
16393         case "$d_setgrent_r_proto:$usethreads" in
16394         ":define")      d_setgrent_r_proto=define
16395                 set d_setgrent_r_proto setgrent_r $hdrs
16396                 eval $hasproto ;;
16397         *)      ;;
16398         esac
16399         case "$d_setgrent_r_proto" in
16400         define)
16401         case "$setgrent_r_proto" in
16402         ''|0) try='int setgrent_r(FILE**);'
16403         ./protochk "extern $try" $hdrs && setgrent_r_proto=I_H ;;
16404         esac
16405         case "$setgrent_r_proto" in
16406         ''|0) try='void setgrent_r(FILE**);'
16407         ./protochk "extern $try" $hdrs && setgrent_r_proto=V_H ;;
16408         esac
16409         case "$setgrent_r_proto" in
16410         ''|0)   d_setgrent_r=undef
16411                 setgrent_r_proto=0
16412                 echo "Disabling setgrent_r, cannot determine prototype." >&4 ;;
16413         * )     case "$setgrent_r_proto" in
16414                 REENTRANT_PROTO*) ;;
16415                 *) setgrent_r_proto="REENTRANT_PROTO_$setgrent_r_proto" ;;
16416                 esac
16417                 echo "Prototype: $try" ;;
16418         esac
16419         ;;
16420         *)      case "$usethreads" in
16421                 define) echo "setgrent_r has no prototype, not using it." >&4 ;;
16422                 esac
16423                 d_setgrent_r=undef
16424                 setgrent_r_proto=0
16425                 ;;
16426         esac
16427         ;;
16428 *)      setgrent_r_proto=0
16429         ;;
16430 esac
16431
16432 : see if sethostent exists
16433 set sethostent d_sethent
16434 eval $inlibc
16435
16436 : see if sethostent_r exists
16437 set sethostent_r d_sethostent_r
16438 eval $inlibc
16439 case "$d_sethostent_r" in
16440 "$define")
16441         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16442         case "$d_sethostent_r_proto:$usethreads" in
16443         ":define")      d_sethostent_r_proto=define
16444                 set d_sethostent_r_proto sethostent_r $hdrs
16445                 eval $hasproto ;;
16446         *)      ;;
16447         esac
16448         case "$d_sethostent_r_proto" in
16449         define)
16450         case "$sethostent_r_proto" in
16451         ''|0) try='int sethostent_r(int, struct hostent_data*);'
16452         ./protochk "extern $try" $hdrs && sethostent_r_proto=I_ID ;;
16453         esac
16454         case "$sethostent_r_proto" in
16455         ''|0) try='void sethostent_r(int, struct hostent_data*);'
16456         ./protochk "extern $try" $hdrs && sethostent_r_proto=V_ID ;;
16457         esac
16458         case "$sethostent_r_proto" in
16459         ''|0)   d_sethostent_r=undef
16460                 sethostent_r_proto=0
16461                 echo "Disabling sethostent_r, cannot determine prototype." >&4 ;;
16462         * )     case "$sethostent_r_proto" in
16463                 REENTRANT_PROTO*) ;;
16464                 *) sethostent_r_proto="REENTRANT_PROTO_$sethostent_r_proto" ;;
16465                 esac
16466                 echo "Prototype: $try" ;;
16467         esac
16468         ;;
16469         *)      case "$usethreads" in
16470                 define) echo "sethostent_r has no prototype, not using it." >&4 ;;
16471                 esac
16472                 d_sethostent_r=undef
16473                 sethostent_r_proto=0
16474                 ;;
16475         esac
16476         ;;
16477 *)      sethostent_r_proto=0
16478         ;;
16479 esac
16480
16481 : see if setitimer exists
16482 set setitimer d_setitimer
16483 eval $inlibc
16484
16485 : see if setlinebuf exists
16486 set setlinebuf d_setlinebuf
16487 eval $inlibc
16488
16489 : see if setlocale exists
16490 set setlocale d_setlocale
16491 eval $inlibc
16492
16493 : see if locale.h is available
16494 set locale.h i_locale
16495 eval $inhdr
16496
16497 : see if setlocale_r exists
16498 set setlocale_r d_setlocale_r
16499 eval $inlibc
16500 case "$d_setlocale_r" in
16501 "$define")
16502         hdrs="$i_systypes sys/types.h define stdio.h $i_locale locale.h"
16503         case "$d_setlocale_r_proto:$usethreads" in
16504         ":define")      d_setlocale_r_proto=define
16505                 set d_setlocale_r_proto setlocale_r $hdrs
16506                 eval $hasproto ;;
16507         *)      ;;
16508         esac
16509         case "$d_setlocale_r_proto" in
16510         define)
16511         case "$setlocale_r_proto" in
16512         ''|0) try='int setlocale_r(int, const char*, char*, int);'
16513         ./protochk "extern $try" $hdrs && setlocale_r_proto=I_ICBI ;;
16514         esac
16515         case "$setlocale_r_proto" in
16516         ''|0)   d_setlocale_r=undef
16517                 setlocale_r_proto=0
16518                 echo "Disabling setlocale_r, cannot determine prototype." >&4 ;;
16519         * )     case "$setlocale_r_proto" in
16520                 REENTRANT_PROTO*) ;;
16521                 *) setlocale_r_proto="REENTRANT_PROTO_$setlocale_r_proto" ;;
16522                 esac
16523                 echo "Prototype: $try" ;;
16524         esac
16525         ;;
16526         *)      case "$usethreads" in
16527                 define) echo "setlocale_r has no prototype, not using it." >&4 ;;
16528                 esac
16529                 d_setlocale_r=undef
16530                 setlocale_r_proto=0
16531                 ;;
16532         esac
16533         ;;
16534 *)      setlocale_r_proto=0
16535         ;;
16536 esac
16537
16538 : see if setnetent exists
16539 set setnetent d_setnent
16540 eval $inlibc
16541
16542 : see if setnetent_r exists
16543 set setnetent_r d_setnetent_r
16544 eval $inlibc
16545 case "$d_setnetent_r" in
16546 "$define")
16547         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16548         case "$d_setnetent_r_proto:$usethreads" in
16549         ":define")      d_setnetent_r_proto=define
16550                 set d_setnetent_r_proto setnetent_r $hdrs
16551                 eval $hasproto ;;
16552         *)      ;;
16553         esac
16554         case "$d_setnetent_r_proto" in
16555         define)
16556         case "$setnetent_r_proto" in
16557         ''|0) try='int setnetent_r(int, struct netent_data*);'
16558         ./protochk "extern $try" $hdrs && setnetent_r_proto=I_ID ;;
16559         esac
16560         case "$setnetent_r_proto" in
16561         ''|0) try='void setnetent_r(int, struct netent_data*);'
16562         ./protochk "extern $try" $hdrs && setnetent_r_proto=V_ID ;;
16563         esac
16564         case "$setnetent_r_proto" in
16565         ''|0)   d_setnetent_r=undef
16566                 setnetent_r_proto=0
16567                 echo "Disabling setnetent_r, cannot determine prototype." >&4 ;;
16568         * )     case "$setnetent_r_proto" in
16569                 REENTRANT_PROTO*) ;;
16570                 *) setnetent_r_proto="REENTRANT_PROTO_$setnetent_r_proto" ;;
16571                 esac
16572                 echo "Prototype: $try" ;;
16573         esac
16574         ;;
16575         *)      case "$usethreads" in
16576                 define) echo "setnetent_r has no prototype, not using it." >&4 ;;
16577                 esac
16578                 d_setnetent_r=undef
16579                 setnetent_r_proto=0
16580                 ;;
16581         esac
16582         ;;
16583 *)      setnetent_r_proto=0
16584         ;;
16585 esac
16586
16587 : see if setprotoent exists
16588 set setprotoent d_setpent
16589 eval $inlibc
16590
16591 : see if setpgid exists
16592 set setpgid d_setpgid
16593 eval $inlibc
16594
16595 : see if setpgrp2 exists
16596 set setpgrp2 d_setpgrp2
16597 eval $inlibc
16598
16599 : see if setpriority exists
16600 set setpriority d_setprior
16601 eval $inlibc
16602
16603 : see if setproctitle exists
16604 set setproctitle d_setproctitle
16605 eval $inlibc
16606
16607 : see if setprotoent_r exists
16608 set setprotoent_r d_setprotoent_r
16609 eval $inlibc
16610 case "$d_setprotoent_r" in
16611 "$define")
16612         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16613         case "$d_setprotoent_r_proto:$usethreads" in
16614         ":define")      d_setprotoent_r_proto=define
16615                 set d_setprotoent_r_proto setprotoent_r $hdrs
16616                 eval $hasproto ;;
16617         *)      ;;
16618         esac
16619         case "$d_setprotoent_r_proto" in
16620         define)
16621         case "$setprotoent_r_proto" in
16622         ''|0) try='int setprotoent_r(int, struct protoent_data*);'
16623         ./protochk "extern $try" $hdrs && setprotoent_r_proto=I_ID ;;
16624         esac
16625         case "$setprotoent_r_proto" in
16626         ''|0) try='void setprotoent_r(int, struct protoent_data*);'
16627         ./protochk "extern $try" $hdrs && setprotoent_r_proto=V_ID ;;
16628         esac
16629         case "$setprotoent_r_proto" in
16630         ''|0)   d_setprotoent_r=undef
16631                 setprotoent_r_proto=0
16632                 echo "Disabling setprotoent_r, cannot determine prototype." >&4 ;;
16633         * )     case "$setprotoent_r_proto" in
16634                 REENTRANT_PROTO*) ;;
16635                 *) setprotoent_r_proto="REENTRANT_PROTO_$setprotoent_r_proto" ;;
16636                 esac
16637                 echo "Prototype: $try" ;;
16638         esac
16639         ;;
16640         *)      case "$usethreads" in
16641                 define) echo "setprotoent_r has no prototype, not using it." >&4 ;;
16642                 esac
16643                 d_setprotoent_r=undef
16644                 setprotoent_r_proto=0
16645                 ;;
16646         esac
16647         ;;
16648 *)      setprotoent_r_proto=0
16649         ;;
16650 esac
16651
16652 : see if setpwent exists
16653 set setpwent d_setpwent
16654 eval $inlibc
16655
16656 : see if setpwent_r exists
16657 set setpwent_r d_setpwent_r
16658 eval $inlibc
16659 case "$d_setpwent_r" in
16660 "$define")
16661         hdrs="$i_systypes sys/types.h define stdio.h $i_pwd pwd.h"
16662         case "$d_setpwent_r_proto:$usethreads" in
16663         ":define")      d_setpwent_r_proto=define
16664                 set d_setpwent_r_proto setpwent_r $hdrs
16665                 eval $hasproto ;;
16666         *)      ;;
16667         esac
16668         case "$d_setpwent_r_proto" in
16669         define)
16670         case "$setpwent_r_proto" in
16671         ''|0) try='int setpwent_r(FILE**);'
16672         ./protochk "extern $try" $hdrs && setpwent_r_proto=I_H ;;
16673         esac
16674         case "$setpwent_r_proto" in
16675         ''|0) try='void setpwent_r(FILE**);'
16676         ./protochk "extern $try" $hdrs && setpwent_r_proto=V_H ;;
16677         esac
16678         case "$setpwent_r_proto" in
16679         ''|0)   d_setpwent_r=undef
16680                 setpwent_r_proto=0
16681                 echo "Disabling setpwent_r, cannot determine prototype." >&4 ;;
16682         * )     case "$setpwent_r_proto" in
16683                 REENTRANT_PROTO*) ;;
16684                 *) setpwent_r_proto="REENTRANT_PROTO_$setpwent_r_proto" ;;
16685                 esac
16686                 echo "Prototype: $try" ;;
16687         esac
16688         ;;
16689         *)      case "$usethreads" in
16690                 define) echo "setpwent_r has no prototype, not using it." >&4 ;;
16691                 esac
16692                 d_setpwent_r=undef
16693                 setpwent_r_proto=0
16694                 ;;
16695         esac
16696         ;;
16697 *)      setpwent_r_proto=0
16698         ;;
16699 esac
16700
16701 : see if setregid exists
16702 set setregid d_setregid
16703 eval $inlibc
16704 set setresgid d_setresgid
16705 eval $inlibc
16706
16707 : see if setreuid exists
16708 set setreuid d_setreuid
16709 eval $inlibc
16710 set setresuid d_setresuid
16711 eval $inlibc
16712
16713 : see if setrgid exists
16714 set setrgid d_setrgid
16715 eval $inlibc
16716
16717 : see if setruid exists
16718 set setruid d_setruid
16719 eval $inlibc
16720
16721 : see if setservent exists
16722 set setservent d_setsent
16723 eval $inlibc
16724
16725 : see if setservent_r exists
16726 set setservent_r d_setservent_r
16727 eval $inlibc
16728 case "$d_setservent_r" in
16729 "$define")
16730         hdrs="$i_systypes sys/types.h define stdio.h $i_netdb netdb.h"
16731         case "$d_setservent_r_proto:$usethreads" in
16732         ":define")      d_setservent_r_proto=define
16733                 set d_setservent_r_proto setservent_r $hdrs
16734                 eval $hasproto ;;
16735         *)      ;;
16736         esac
16737         case "$d_setservent_r_proto" in
16738         define)
16739         case "$setservent_r_proto" in
16740         ''|0) try='int setservent_r(int, struct servent_data*);'
16741         ./protochk "extern $try" $hdrs && setservent_r_proto=I_ID ;;
16742         esac
16743         case "$setservent_r_proto" in
16744         ''|0) try='void setservent_r(int, struct servent_data*);'
16745         ./protochk "extern $try" $hdrs && setservent_r_proto=V_ID ;;
16746         esac
16747         case "$setservent_r_proto" in
16748         ''|0)   d_setservent_r=undef
16749                 setservent_r_proto=0
16750                 echo "Disabling setservent_r, cannot determine prototype." >&4 ;;
16751         * )     case "$setservent_r_proto" in
16752                 REENTRANT_PROTO*) ;;
16753                 *) setservent_r_proto="REENTRANT_PROTO_$setservent_r_proto" ;;
16754                 esac
16755                 echo "Prototype: $try" ;;
16756         esac
16757         ;;
16758         *)      case "$usethreads" in
16759                 define) echo "setservent_r has no prototype, not using it." >&4 ;;
16760                 esac
16761                 d_setservent_r=undef
16762                 setservent_r_proto=0
16763                 ;;
16764         esac
16765         ;;
16766 *)      setservent_r_proto=0
16767         ;;
16768 esac
16769
16770 : see if setsid exists
16771 set setsid d_setsid
16772 eval $inlibc
16773
16774 : see if setvbuf exists
16775 set setvbuf d_setvbuf
16776 eval $inlibc
16777
16778 : see if sfio.h is available
16779 set sfio.h i_sfio
16780 eval $inhdr
16781
16782
16783 : see if sfio library is available
16784 case "$i_sfio" in
16785 $define)
16786         val=''
16787         set sfreserve val
16788         eval $inlibc
16789         ;;
16790 *)
16791         val="$undef"
16792         ;;
16793 esac
16794 : Ok, but do we want to use it.
16795 case "$val" in
16796 $define)
16797         case "$usesfio" in
16798         true|$define|[yY]*) dflt='y';;
16799         *) dflt='n';;
16800         esac
16801         echo "$package can use the sfio library, but it is experimental."
16802         case "$useperlio" in
16803         "$undef")
16804             echo "For sfio also the PerlIO abstraction layer is needed."
16805             echo "Earlier you said you wouldn't want that."
16806             ;;
16807         esac
16808         rp="You seem to have sfio available, do you want to try using it?"
16809         . ./myread
16810         case "$ans" in
16811         y|Y)    echo "Ok, turning on both sfio and PerlIO, then."
16812                 useperlio="$define"
16813                 val="$define"
16814                 ;;
16815         *)      echo "Ok, avoiding sfio this time.  I'll use stdio instead."
16816                 val="$undef"
16817                 ;;
16818         esac
16819         ;;
16820 *)      case "$usesfio" in
16821         true|$define|[yY]*)
16822                 echo "Sorry, cannot find sfio on this machine." >&4
16823                 echo "Ignoring your setting of usesfio=$usesfio." >&4
16824                 val="$undef"
16825                 ;;
16826         esac
16827         ;;
16828 esac
16829 set d_sfio
16830 eval $setvar
16831 case "$d_sfio" in
16832 $define) usesfio='true';;
16833 *) usesfio='false';;
16834 esac
16835 case "$d_sfio" in
16836 $define) ;;
16837 *)      : Remove sfio from list of libraries to use
16838         case "$libs" in
16839         *-lsfio*)
16840                 echo "Removing unneeded -lsfio from library list" >&4
16841                 set `echo X $libs | $sed -e 's/-lsfio / /' -e 's/-lsfio$//'`
16842                 shift
16843                 libs="$*"
16844                 echo "libs = $libs" >&4
16845                 ;;
16846         esac
16847 ;;
16848 esac
16849
16850
16851 : see if shmctl exists
16852 set shmctl d_shmctl
16853 eval $inlibc
16854
16855 : see if shmget exists
16856 set shmget d_shmget
16857 eval $inlibc
16858
16859 : see if shmat exists
16860 set shmat d_shmat
16861 eval $inlibc
16862 : see what shmat returns
16863 case "$d_shmat" in
16864 "$define")
16865         $cat >shmat.c <<'END'
16866 #include <sys/shm.h>
16867 void *shmat();
16868 END
16869         if $cc $ccflags -c shmat.c >/dev/null 2>&1; then
16870                 shmattype='void *'
16871         else
16872                 shmattype='char *'
16873         fi
16874         echo "and it returns ($shmattype)." >&4
16875         : see if a prototype for shmat is available
16876         xxx=`./findhdr sys/shm.h`
16877         $cppstdin $cppflags $cppminus < $xxx > shmat.c 2>/dev/null
16878         if $contains 'shmat.*(' shmat.c >/dev/null 2>&1; then
16879                 val="$define"
16880         else
16881                 val="$undef"
16882         fi
16883         $rm -f shmat.[co]
16884         ;;
16885 *)
16886         val="$undef"
16887         ;;
16888 esac
16889 set d_shmatprototype
16890 eval $setvar
16891
16892 : see if shmdt exists
16893 set shmdt d_shmdt
16894 eval $inlibc
16895
16896 : see how much of the 'shm*(2)' library is present.
16897 h_shm=true
16898 echo " "
16899 case "$d_shmctl$d_shmget$d_shmat$d_shmdt" in
16900 *"$undef"*) h_shm=false;;
16901 esac
16902 case "$osname" in
16903 freebsd)
16904     case "`ipcs 2>&1`" in
16905     "SVID shared memory"*"not configured"*)
16906         echo "Your $osname does not have the shm*(2) configured." >&4
16907         h_shm=false
16908         val="$undef"
16909         set shmctl d_shmctl
16910         evat $setvar
16911         set shmget d_shmget
16912         evat $setvar
16913         set shmat d_shmat
16914         evat $setvar
16915         set shmdt d_shmdt
16916         evat $setvar
16917         ;;
16918     esac
16919     ;;
16920 esac
16921 : we could also check for sys/ipc.h ...
16922 if $h_shm && $test `./findhdr sys/shm.h`; then
16923         echo "You have the full shm*(2) library." >&4
16924         val="$define"
16925 else
16926         echo "You don't have the full shm*(2) library." >&4
16927         val="$undef"
16928 fi
16929 set d_shm
16930 eval $setvar
16931
16932 echo " "
16933 : see if we have sigaction
16934 if set sigaction val -f d_sigaction; eval $csym; $val; then
16935         echo 'sigaction() found.' >&4
16936         $cat > try.c <<EOP
16937 #include <stdio.h>
16938 #include <sys/types.h>
16939 #include <signal.h>
16940 #$i_stdlib I_STDLIB
16941 #ifdef I_STDLIB
16942 #include <stdlib.h>
16943 #endif
16944 int main()
16945 {
16946     struct sigaction act, oact;
16947     act.sa_flags = 0;
16948     oact.sa_handler = 0;
16949     /* so that act and oact are used */
16950     exit(act.sa_flags == 0 &&  oact.sa_handler == 0);
16951 }
16952 EOP
16953         set try
16954         if eval $compile_ok; then
16955                 val="$define"
16956         else
16957                 echo "But you don't seem to have a useable struct sigaction." >&4
16958                 val="$undef"
16959         fi
16960 else
16961         echo 'sigaction NOT found.' >&4
16962         val="$undef"
16963 fi
16964 set d_sigaction; eval $setvar
16965 $rm -f try try$_o try.c
16966
16967 : see if sigprocmask exists
16968 set sigprocmask d_sigprocmask
16969 eval $inlibc
16970
16971 : see if sigsetjmp exists
16972 echo " "
16973 case "$d_sigsetjmp" in
16974 '')
16975         $cat >try.c <<EOP
16976 #include <setjmp.h>
16977 #$i_stdlib I_STDLIB
16978 #ifdef I_STDLIB
16979 #include <stdlib.h>
16980 #endif
16981 sigjmp_buf env;
16982 int set = 1;
16983 int main()
16984 {
16985         if (sigsetjmp(env,1))
16986                 exit(set);
16987         set = 0;
16988         siglongjmp(env, 1);
16989         exit(1);
16990 }
16991 EOP
16992         set try
16993         if eval $compile; then
16994                 if $run ./try >/dev/null 2>&1; then
16995                         echo "POSIX sigsetjmp found." >&4
16996                         val="$define"
16997                 else
16998                         $cat >&4 <<EOM
16999 Uh-Oh! You have POSIX sigsetjmp and siglongjmp, but they do not work properly!!
17000 I'll ignore them.
17001 EOM
17002                         val="$undef"
17003                 fi
17004         else
17005                 echo "sigsetjmp not found." >&4
17006                 val="$undef"
17007         fi
17008         ;;
17009 *) val="$d_sigsetjmp"
17010         case "$d_sigsetjmp" in
17011         $define) echo "POSIX sigsetjmp found." >&4;;
17012         $undef) echo "sigsetjmp not found." >&4;;
17013         esac
17014         ;;
17015 esac
17016 set d_sigsetjmp
17017 eval $setvar
17018 $rm -f try.c try
17019
17020 : see if snprintf exists
17021 set snprintf d_snprintf
17022 eval $inlibc
17023
17024 : see if vsnprintf exists
17025 set vsnprintf d_vsnprintf
17026 eval $inlibc
17027
17028 case "$d_snprintf-$d_vsnprintf" in
17029 "$define-$define")
17030     $cat <<EOM
17031 Checking whether your snprintf() and vsnprintf() work okay...
17032 EOM
17033     $cat >try.c <<'EOCP'
17034 /* v?snprintf testing logic courtesy of Russ Allbery.
17035  * According to C99:
17036  * - if the buffer is too short it still must be \0-terminated
17037  * - if the buffer is too short the potentially required length
17038  *   must be returned and not -1
17039  * - if the buffer is NULL the potentially required length
17040  *   must be returned and not -1 or core dump
17041  */
17042 #include <stdio.h>
17043 #include <stdarg.h>
17044
17045 char buf[2];
17046
17047 int test (char *format, ...)
17048 {
17049     va_list args;
17050     int count;
17051
17052     va_start (args, format);
17053     count = vsnprintf (buf, sizeof buf, format, args);
17054     va_end (args);
17055     return count;
17056 }
17057
17058 int main ()
17059 {
17060     return ((test ("%s", "abcd") == 4 && buf[0] == 'a' && buf[1] == '\0'
17061              && snprintf (NULL, 0, "%s", "abcd") == 4) ? 0 : 1);
17062 }
17063 EOCP
17064     set try
17065     if eval $compile; then
17066         `$run ./try`
17067         case "$?" in
17068         0) echo "Your snprintf() and vsnprintf() seem to be working okay." ;;
17069         *) cat <<EOM >&4
17070 Your snprintf() and snprintf() don't seem to be working okay.
17071 EOM
17072            d_snprintf="$undef"
17073            d_vsnprintf="$undef"
17074            ;;
17075         esac
17076     else
17077         echo "(I can't seem to compile the test program--assuming they don't)"
17078         d_snprintf="$undef"
17079         d_vsnprintf="$undef"
17080     fi
17081     $rm -f try.* try core core.try.*
17082     ;;
17083 esac
17084
17085 : see if sockatmark exists
17086 set sockatmark d_sockatmark
17087 eval $inlibc
17088
17089 : see if prototype for sockatmark is available
17090 echo " "
17091 set d_sockatmarkproto sockatmark $d_socket sys/socket.h
17092 eval $hasproto
17093
17094 : see if socks5_init exists
17095 set socks5_init d_socks5_init
17096 eval $inlibc
17097
17098 : see if sprintf returns the length of the string in the buffer as per ANSI
17099 $echo "Checking whether sprintf returns the length of the string..." >&4
17100 $cat <<EOP >try.c
17101 #include <stdio.h>
17102 #$i_stdlib I_STDLIB
17103 #ifdef I_STDLIB
17104 #include <stdlib.h>
17105 #endif
17106 #$i_string I_STRING
17107 #ifdef I_STRING
17108 #  include <string.h>
17109 #else
17110 #  include <strings.h>
17111 #endif
17112 #$i_math I_MATH
17113 #ifdef I_MATH
17114 #include <math.h>
17115 #endif
17116
17117 char buffer[256];
17118
17119 int check (size_t expect, int test) {
17120   size_t got = strlen(buffer);
17121   if (expect == got)
17122     return 0;
17123
17124   printf("expected %ld, got %ld in test %d '%s'\n", (long) expect, (long) got,
17125        test, buffer);
17126   exit (test);
17127 }
17128
17129 int main(int argc, char **argv) {
17130   int test = 0;
17131
17132   check(sprintf(buffer, ""), ++test);
17133   check(sprintf(buffer, "%s %s", "perl", "rules"), ++test);
17134   check(sprintf(buffer, "I like %g", atan2(0,-1)), ++test);
17135
17136   return 0;
17137 }
17138 EOP
17139 set try
17140
17141 d_sprintf_returns_strlen="$undef"
17142 if eval $compile; then
17143     xxx="`$run ./try`"
17144     case "$?" in
17145         0) cat >&4 <<EOM
17146 sprintf returns the length of the string (as ANSI says it should)
17147 EOM
17148         d_sprintf_returns_strlen="$define"
17149         ;;
17150         *) cat >&4 <<EOM
17151 sprintf does not return the length of the string (how old is this system?)
17152 EOM
17153         d_sprintf_returns_strlen="$undef"
17154         ;;
17155     esac
17156 fi
17157
17158 $rm -f try.* try
17159
17160 : see if srand48_r exists
17161 set srand48_r d_srand48_r
17162 eval $inlibc
17163 case "$d_srand48_r" in
17164 "$define")
17165         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17166         case "$d_srand48_r_proto:$usethreads" in
17167         ":define")      d_srand48_r_proto=define
17168                 set d_srand48_r_proto srand48_r $hdrs
17169                 eval $hasproto ;;
17170         *)      ;;
17171         esac
17172         case "$d_srand48_r_proto" in
17173         define)
17174         case "$srand48_r_proto" in
17175         ''|0) try='int srand48_r(long, struct drand48_data*);'
17176         ./protochk "extern $try" $hdrs && srand48_r_proto=I_LS ;;
17177         esac
17178         case "$srand48_r_proto" in
17179         ''|0)   d_srand48_r=undef
17180                 srand48_r_proto=0
17181                 echo "Disabling srand48_r, cannot determine prototype." >&4 ;;
17182         * )     case "$srand48_r_proto" in
17183                 REENTRANT_PROTO*) ;;
17184                 *) srand48_r_proto="REENTRANT_PROTO_$srand48_r_proto" ;;
17185                 esac
17186                 echo "Prototype: $try" ;;
17187         esac
17188         ;;
17189         *)      case "$usethreads" in
17190                 define) echo "srand48_r has no prototype, not using it." >&4 ;;
17191                 esac
17192                 d_srand48_r=undef
17193                 srand48_r_proto=0
17194                 ;;
17195         esac
17196         ;;
17197 *)      srand48_r_proto=0
17198         ;;
17199 esac
17200
17201 : see if srandom_r exists
17202 set srandom_r d_srandom_r
17203 eval $inlibc
17204 case "$d_srandom_r" in
17205 "$define")
17206         hdrs="$i_systypes sys/types.h define stdio.h $i_stdlib stdlib.h"
17207         case "$d_srandom_r_proto:$usethreads" in
17208         ":define")      d_srandom_r_proto=define
17209                 set d_srandom_r_proto srandom_r $hdrs
17210                 eval $hasproto ;;
17211         *)      ;;
17212         esac
17213         case "$d_srandom_r_proto" in
17214         define)
17215         case "$srandom_r_proto" in
17216         ''|0) try='int srandom_r(unsigned int, struct random_data*);'
17217         ./protochk "extern $try" $hdrs && srandom_r_proto=I_TS ;;
17218         esac
17219         case "$srandom_r_proto" in
17220         ''|0)   d_srandom_r=undef
17221                 srandom_r_proto=0
17222                 echo "Disabling srandom_r, cannot determine prototype." >&4 ;;
17223         * )     case "$srandom_r_proto" in
17224                 REENTRANT_PROTO*) ;;
17225                 *) srandom_r_proto="REENTRANT_PROTO_$srandom_r_proto" ;;
17226                 esac
17227                 echo "Prototype: $try" ;;
17228         esac
17229         ;;
17230         *)      case "$usethreads" in
17231                 define) echo "srandom_r has no prototype, not using it." >&4 ;;
17232                 esac
17233                 d_srandom_r=undef
17234                 srandom_r_proto=0
17235                 ;;
17236         esac
17237         ;;
17238 *)      srandom_r_proto=0
17239         ;;
17240 esac
17241
17242 : see if prototype for setresgid is available
17243 echo " "
17244 set d_sresgproto setresgid $i_unistd unistd.h
17245 eval $hasproto
17246
17247 : see if prototype for setresuid is available
17248 echo " "
17249 set d_sresuproto setresuid $i_unistd unistd.h
17250 eval $hasproto
17251
17252 : see if sys/stat.h is available
17253 set sys/stat.h i_sysstat
17254 eval $inhdr
17255
17256
17257 : see if stat knows about block sizes
17258 echo " "
17259 echo "Checking to see if your struct stat has st_blocks field..." >&4
17260 set d_statblks stat st_blocks $i_sysstat sys/stat.h
17261 eval $hasfield
17262
17263
17264 : see if this is a sys/vfs.h system
17265 set sys/vfs.h i_sysvfs
17266 eval $inhdr
17267
17268
17269 : see if this is a sys/statfs.h system
17270 set sys/statfs.h i_sysstatfs
17271 eval $inhdr
17272
17273
17274 echo " "
17275 echo "Checking to see if your system supports struct statfs..." >&4
17276 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
17277 eval $hasstruct
17278 case "$d_statfs_s" in
17279 "$define")      echo "Yes, it does."   ;;
17280 *)              echo "No, it doesn't." ;;
17281 esac
17282
17283
17284
17285 : see if struct statfs knows about f_flags
17286 case "$d_statfs_s" in
17287 define) 
17288         echo " "
17289         echo "Checking to see if your struct statfs has f_flags field..." >&4
17290         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
17291         eval $hasfield
17292         ;;
17293 *)      val="$undef"
17294         set d_statfs_f_flags
17295         eval $setvar
17296         ;;
17297 esac
17298 case "$d_statfs_f_flags" in
17299 "$define")      echo "Yes, it does."   ;;
17300 *)              echo "No, it doesn't." ;;
17301 esac
17302
17303 $cat >&4 <<EOM
17304 Checking how to access stdio streams by file descriptor number...
17305 EOM
17306 case "$stdio_stream_array" in
17307 '')     $cat >try.c <<EOCP
17308 #include <stdio.h>
17309 int main() {
17310   if (&STDIO_STREAM_ARRAY[fileno(stdin)] == stdin)
17311     printf("yes\n");
17312 }
17313 EOCP
17314         for s in _iob __iob __sF
17315         do
17316                 set try -DSTDIO_STREAM_ARRAY=$s
17317                 if eval $compile; then
17318                         case "`$run ./try`" in
17319                         yes)    stdio_stream_array=$s; break ;;
17320                         esac
17321                 fi
17322         done
17323         $rm -f try.* try$exe_ext
17324 esac
17325 case "$stdio_stream_array" in
17326 '')     $cat >&4 <<EOM
17327 I can't figure out how to access stdio streams by file descriptor number.
17328 EOM
17329         d_stdio_stream_array="$undef"
17330         ;;
17331 *)      $cat >&4 <<EOM
17332 You can access stdio streams by file descriptor number by the $stdio_stream_array array.
17333 EOM
17334         d_stdio_stream_array="$define"
17335         ;;
17336 esac
17337
17338 : see if strcoll exists
17339 set strcoll d_strcoll
17340 eval $inlibc
17341
17342 : check for structure copying
17343 echo " "
17344 echo "Checking to see if your C compiler can copy structs..." >&4
17345 $cat >try.c <<'EOCP'
17346 int main()
17347 {
17348         struct blurfl {
17349                 int dyick;
17350         } foo, bar;
17351
17352         foo = bar;
17353 }
17354 EOCP
17355 if $cc -c try.c >/dev/null 2>&1 ; then
17356         val="$define"
17357         echo "Yup, it can."
17358 else
17359         val="$undef"
17360         echo "Nope, it can't."
17361 fi
17362 set d_strctcpy
17363 eval $setvar
17364 $rm -f try.*
17365
17366 : see if strerror and/or sys_errlist[] exist
17367 echo " "
17368 if test "X$d_strerror" = X -o "X$d_syserrlst" = X; then
17369     if set strerror val -f d_strerror; eval $csym; $val; then
17370                 echo 'strerror() found.' >&4
17371                 d_strerror="$define"
17372                 d_strerrm='strerror(e)'
17373                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17374                         echo "(You also have sys_errlist[], so we could roll our own strerror.)" 
17375                         d_syserrlst="$define"
17376                 else
17377                         echo "(Since you don't have sys_errlist[], sterror() is welcome.)"
17378                         d_syserrlst="$undef"
17379                 fi
17380     elif xxx=`./findhdr string.h`; test "$xxx" || xxx=`./findhdr strings.h`; \
17381                         $contains '#[   ]*define.*strerror' "$xxx" >/dev/null 2>&1; then
17382                 echo 'strerror() found in string header.' >&4
17383                 d_strerror="$define"
17384                 d_strerrm='strerror(e)'
17385                 if set sys_errlist val -a d_syserrlst; eval $csym; $val; then   
17386                         echo "(Most probably, strerror() uses sys_errlist[] for descriptions.)"
17387                                 d_syserrlst="$define"
17388                 else
17389                         echo "(You don't appear to have any sys_errlist[], how can this be?)"
17390                         d_syserrlst="$undef"
17391                 fi
17392     elif set sys_errlist val -a d_syserrlst; eval $csym; $val; then
17393                 echo "strerror() not found, but you have sys_errlist[] so we'll use that." >&4
17394                 d_strerror="$undef"
17395                 d_syserrlst="$define"
17396                 d_strerrm='((e)<0||(e)>=sys_nerr?"unknown":sys_errlist[e])'
17397     else
17398                 echo 'strerror() and sys_errlist[] NOT found.' >&4
17399                 d_strerror="$undef"
17400                 d_syserrlst="$undef"
17401                 d_strerrm='"unknown"'
17402     fi
17403 fi
17404
17405 : see if strerror_r exists
17406 set strerror_r d_strerror_r
17407 eval $inlibc
17408 case "$d_strerror_r" in
17409 "$define")
17410         hdrs="$i_systypes sys/types.h define stdio.h $i_string string.h"
17411         case "$d_strerror_r_proto:$usethreads" in
17412         ":define")      d_strerror_r_proto=define
17413                 set d_strerror_r_proto strerror_r $hdrs
17414                 eval $hasproto ;;
17415         *)      ;;
17416         esac
17417         case "$d_strerror_r_proto" in
17418         define)
17419         case "$strerror_r_proto" in
17420         ''|0) try='int strerror_r(int, char*, size_t);'
17421         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBW ;;
17422         esac
17423         case "$strerror_r_proto" in
17424         ''|0) try='int strerror_r(int, char*, int);'
17425         ./protochk "extern $try" $hdrs && strerror_r_proto=I_IBI ;;
17426         esac
17427         case "$strerror_r_proto" in
17428         ''|0) try='char* strerror_r(int, char*, size_t);'
17429         ./protochk "extern $try" $hdrs && strerror_r_proto=B_IBW ;;
17430         esac
17431         case "$strerror_r_proto" in
17432         ''|0)   d_strerror_r=undef
17433                 strerror_r_proto=0
17434                 echo "Disabling strerror_r, cannot determine prototype." >&4 ;;
17435         * )     case "$strerror_r_proto" in
17436                 REENTRANT_PROTO*) ;;
17437                 *) strerror_r_proto="REENTRANT_PROTO_$strerror_r_proto" ;;
17438                 esac
17439                 echo "Prototype: $try" ;;
17440         esac
17441         ;;
17442         *)      case "$usethreads" in
17443                 define) echo "strerror_r has no prototype, not using it." >&4 ;;
17444                 esac
17445                 d_strerror_r=undef
17446                 strerror_r_proto=0
17447                 ;;
17448         esac
17449         ;;
17450 *)      strerror_r_proto=0
17451         ;;
17452 esac
17453
17454 : see if strftime exists
17455 set strftime d_strftime
17456 eval $inlibc
17457
17458 : see if strlcat exists
17459 set strlcat d_strlcat
17460 eval $inlibc
17461
17462 : see if strlcpy exists
17463 set strlcpy d_strlcpy
17464 eval $inlibc
17465
17466 : see if strtod exists
17467 set strtod d_strtod
17468 eval $inlibc
17469
17470 : see if strtol exists
17471 set strtol d_strtol
17472 eval $inlibc
17473
17474 : see if strtold exists
17475 set strtold d_strtold
17476 eval $inlibc
17477
17478 : see if strtoll exists
17479 set strtoll d_strtoll
17480 eval $inlibc
17481
17482 case "$d_longlong-$d_strtoll" in
17483 "$define-$define")
17484         $cat <<EOM
17485 Checking whether your strtoll() works okay...
17486 EOM
17487         $cat >try.c <<'EOCP'
17488 #include <errno.h>
17489 #ifdef __hpux
17490 #define strtoll __strtoll
17491 #endif
17492 #ifdef __EMX__
17493 #define strtoll _strtoll
17494 #endif
17495 #include <stdio.h>
17496 extern long long int strtoll(char *s, char **, int); 
17497 static int bad = 0;
17498 int check(char *s, long long ell, int een) {
17499         long long gll;
17500         errno = 0;
17501         gll = strtoll(s, 0, 10);
17502         if (!((gll == ell) && (errno == een)))
17503                 bad++;
17504 }
17505 int main() {
17506         check(" 1",                                      1LL, 0);
17507         check(" 0",                                      0LL, 0);
17508         check("-1",                                     -1LL, 0);
17509         check("-9223372036854775808", -9223372036854775808LL, 0);
17510         check("-9223372036854775808", -9223372036854775808LL, 0);
17511         check(" 9223372036854775807",  9223372036854775807LL, 0);
17512         check("-9223372036854775808", -9223372036854775808LL, 0);
17513         check(" 9223372036854775808",  9223372036854775807LL, ERANGE);
17514         check("-9223372036854775809", -9223372036854775808LL, ERANGE);
17515         if (!bad)
17516                 printf("ok\n");
17517 }
17518 EOCP
17519         set try
17520         if eval $compile; then
17521                 yyy=`$run ./try`
17522                 case "$yyy" in
17523                 ok) echo "Your strtoll() seems to be working okay." ;;
17524                 *) cat <<EOM >&4
17525 Your strtoll() doesn't seem to be working okay.
17526 EOM
17527                    d_strtoll="$undef"
17528                    ;;
17529                 esac
17530         else
17531                 echo "(I can't seem to compile the test program--assuming it doesn't)"
17532                 d_strtoll="$undef"
17533         fi
17534         ;;
17535 esac
17536
17537 : see if strtoq exists
17538 set strtoq d_strtoq
17539 eval $inlibc
17540
17541 : see if strtoul exists
17542 set strtoul d_strtoul
17543 eval $inlibc
17544
17545 case "$d_strtoul" in
17546 "$define")
17547         $cat <<EOM
17548 Checking whether your strtoul() works okay...
17549 EOM
17550         $cat >try.c <<'EOCP'
17551 #include <errno.h>
17552 #include <stdio.h>
17553 extern unsigned long int strtoul(char *s, char **, int); 
17554 static int bad = 0;
17555 void check(char *s, unsigned long eul, int een) {
17556         unsigned long gul;
17557         errno = 0;
17558         gul = strtoul(s, 0, 10);
17559         if (!((gul == eul) && (errno == een)))
17560                 bad++;
17561 }
17562 int main() {
17563         check(" 1", 1L, 0);
17564         check(" 0", 0L, 0);
17565 EOCP
17566         case "$longsize" in
17567         8)
17568             $cat >>try.c <<'EOCP'
17569         check("18446744073709551615", 18446744073709551615UL, 0);
17570         check("18446744073709551616", 18446744073709551615UL, ERANGE);
17571 #if 0 /* strtoul() for /^-/ strings is undefined. */
17572         check("-1", 18446744073709551615UL, 0);
17573         check("-18446744073709551614", 2, 0);
17574         check("-18446744073709551615", 1, 0);
17575         check("-18446744073709551616", 18446744073709551615UL, ERANGE);
17576         check("-18446744073709551617", 18446744073709551615UL, ERANGE);
17577 #endif
17578 EOCP
17579                 ;;
17580         4)
17581                     $cat >>try.c <<'EOCP'
17582         check("4294967295", 4294967295UL, 0);
17583         check("4294967296", 4294967295UL, ERANGE);
17584 #if 0 /* strtoul() for /^-/ strings is undefined. */
17585         check("-1", 4294967295UL, 0);
17586         check("-4294967294", 2, 0);
17587         check("-4294967295", 1, 0);
17588         check("-4294967296", 4294967295UL, ERANGE);
17589         check("-4294967297", 4294967295UL, ERANGE);
17590 #endif
17591 EOCP
17592                 ;;
17593         *)
17594 : Should we write these tests to be more portable by sprintf-ing
17595 : ~0 and then manipulating that char string as input for strtol?
17596                 ;;
17597         esac
17598         $cat >>try.c <<'EOCP'
17599         if (!bad)
17600                 printf("ok\n");
17601         return 0;
17602 }
17603 EOCP
17604         set try
17605         if eval $compile; then
17606                 case "`$run ./try`" in
17607                 ok) echo "Your strtoul() seems to be working okay." ;;
17608                 *) cat <<EOM >&4
17609 Your strtoul() doesn't seem to be working okay.
17610 EOM
17611                    d_strtoul="$undef"
17612                    ;;
17613                 esac
17614         fi
17615         ;;
17616 esac
17617
17618 : see if strtoull exists
17619 set strtoull d_strtoull
17620 eval $inlibc
17621
17622 case "$d_longlong-$d_strtoull" in
17623 "$define-$define")
17624         $cat <<EOM
17625 Checking whether your strtoull() works okay...
17626 EOM
17627         $cat >try.c <<'EOCP'
17628 #include <errno.h>
17629 #ifdef __hpux
17630 #define strtoull __strtoull
17631 #endif
17632 #include <stdio.h>
17633 extern unsigned long long int strtoull(char *s, char **, int); 
17634 static int bad = 0;
17635 int check(char *s, long long eull, int een) {
17636         long long gull;
17637         errno = 0;
17638         gull = strtoull(s, 0, 10);
17639         if (!((gull == eull) && (errno == een)))
17640                 bad++;
17641 }
17642 int main() {
17643         check(" 1",                                        1LL, 0);
17644         check(" 0",                                        0LL, 0);
17645         check("18446744073709551615",  18446744073709551615ULL, 0);
17646         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17647 #if 0 /* strtoull() for /^-/ strings is undefined. */
17648         check("-1",                    18446744073709551615ULL, 0);
17649         check("-18446744073709551614",                     2LL, 0);
17650         check("-18446744073709551615",                     1LL, 0);
17651         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17652         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17653 #endif
17654         if (!bad)
17655                 printf("ok\n");
17656 }
17657 EOCP
17658         set try
17659         if eval $compile; then
17660                 case "`$run ./try`" in
17661                 ok) echo "Your strtoull() seems to be working okay." ;;
17662                 *) cat <<EOM >&4
17663 Your strtoull() doesn't seem to be working okay.
17664 EOM
17665                    d_strtoull="$undef"
17666                    ;;
17667                 esac
17668         fi
17669         ;;
17670 esac
17671
17672 : see if strtouq exists
17673 set strtouq d_strtouq
17674 eval $inlibc
17675
17676 case "$d_strtouq" in
17677 "$define")
17678         $cat <<EOM
17679 Checking whether your strtouq() works okay...
17680 EOM
17681         $cat >try.c <<'EOCP'
17682 #include <errno.h>
17683 #include <stdio.h>
17684 extern unsigned long long int strtouq(char *s, char **, int); 
17685 static int bad = 0;
17686 void check(char *s, unsigned long long eull, int een) {
17687         unsigned long long gull;
17688         errno = 0;
17689         gull = strtouq(s, 0, 10);
17690         if (!((gull == eull) && (errno == een)))
17691                 bad++;
17692 }
17693 int main() {
17694         check(" 1",                                        1LL, 0);
17695         check(" 0",                                        0LL, 0);
17696         check("18446744073709551615",  18446744073709551615ULL, 0);
17697         check("18446744073709551616",  18446744073709551615ULL, ERANGE);
17698 #if 0 /* strtouq() for /^-/ strings is undefined. */
17699         check("-1",                    18446744073709551615ULL, 0);
17700         check("-18446744073709551614",                     2LL, 0);
17701         check("-18446744073709551615",                     1LL, 0);
17702         check("-18446744073709551616", 18446744073709551615ULL, ERANGE);
17703         check("-18446744073709551617", 18446744073709551615ULL, ERANGE);
17704 #endif
17705         if (!bad)
17706                 printf("ok\n");
17707         return 0;
17708 }
17709 EOCP
17710         set try
17711         if eval $compile; then
17712                 case "`$run ./try`" in
17713                 ok) echo "Your strtouq() seems to be working okay." ;;
17714                 *) cat <<EOM >&4
17715 Your strtouq() doesn't seem to be working okay.
17716 EOM
17717                    d_strtouq="$undef"
17718                    ;;
17719                 esac
17720         fi
17721         ;;
17722 esac
17723
17724 : see if strxfrm exists
17725 set strxfrm d_strxfrm
17726 eval $inlibc
17727
17728 : see if symlink exists
17729 set symlink d_symlink
17730 eval $inlibc
17731
17732 : see if syscall exists
17733 set syscall d_syscall
17734 eval $inlibc
17735
17736 : see if prototype for syscall is available
17737 echo " "
17738 set d_syscallproto syscall $i_unistd unistd.h
17739 eval $hasproto
17740
17741 : see if sysconf exists
17742 set sysconf d_sysconf
17743 eval $inlibc
17744
17745 : see if system exists
17746 set system d_system
17747 eval $inlibc
17748
17749 : see if tcgetpgrp exists
17750 set tcgetpgrp d_tcgetpgrp
17751 eval $inlibc
17752
17753 : see if tcsetpgrp exists
17754 set tcsetpgrp d_tcsetpgrp
17755 eval $inlibc
17756
17757 : see if prototype for telldir is available
17758 echo " "
17759 set d_telldirproto telldir $i_systypes sys/types.h $i_dirent dirent.h
17760 eval $hasproto
17761
17762 : see if time exists
17763 echo " "
17764 if test "X$d_time" = X -o X"$timetype" = X; then
17765     if set time val -f d_time; eval $csym; $val; then
17766                 echo 'time() found.' >&4
17767                 val="$define"
17768                 rp="What is the type returned by time() on this system?"
17769                 set time_t timetype long stdio.h sys/types.h
17770                 eval $typedef_ask
17771     else
17772                 echo 'time() not found, hope that will do.' >&4
17773                 val="$undef"
17774                 timetype='int';
17775     fi
17776     set d_time
17777     eval $setvar
17778 fi
17779
17780 : see if this is a sys/times.h system
17781 set sys/times.h i_systimes
17782 eval $inhdr
17783
17784 : see if times exists
17785 echo " "
17786 if set times val -f d_times; eval $csym; $val; then
17787         echo 'times() found.' >&4
17788         d_times="$define"
17789         inc=''
17790         case "$i_systimes" in
17791         "$define") inc='sys/times.h';;
17792         esac
17793         rp="What is the type returned by times() on this system?"
17794         set clock_t clocktype long stdio.h sys/types.h $inc
17795         eval $typedef_ask
17796 else
17797         echo 'times() NOT found, hope that will do.' >&4
17798         d_times="$undef"
17799         clocktype='int'
17800 fi
17801
17802 : see if tmpnam_r exists
17803 set tmpnam_r d_tmpnam_r
17804 eval $inlibc
17805 case "$d_tmpnam_r" in
17806 "$define")
17807         hdrs="$i_systypes sys/types.h define stdio.h "
17808         case "$d_tmpnam_r_proto:$usethreads" in
17809         ":define")      d_tmpnam_r_proto=define
17810                 set d_tmpnam_r_proto tmpnam_r $hdrs
17811                 eval $hasproto ;;
17812         *)      ;;
17813         esac
17814         case "$d_tmpnam_r_proto" in
17815         define)
17816         case "$tmpnam_r_proto" in
17817         ''|0) try='char* tmpnam_r(char*);'
17818         ./protochk "extern $try" $hdrs && tmpnam_r_proto=B_B ;;
17819         esac
17820         case "$tmpnam_r_proto" in
17821         ''|0)   d_tmpnam_r=undef
17822                 tmpnam_r_proto=0
17823                 echo "Disabling tmpnam_r, cannot determine prototype." >&4 ;;
17824         * )     case "$tmpnam_r_proto" in
17825                 REENTRANT_PROTO*) ;;
17826                 *) tmpnam_r_proto="REENTRANT_PROTO_$tmpnam_r_proto" ;;
17827                 esac
17828                 echo "Prototype: $try" ;;
17829         esac
17830         ;;
17831         *)      case "$usethreads" in
17832                 define) echo "tmpnam_r has no prototype, not using it." >&4 ;;
17833                 esac
17834                 d_tmpnam_r=undef
17835                 tmpnam_r_proto=0
17836                 ;;
17837         esac
17838         ;;
17839 *)      tmpnam_r_proto=0
17840         ;;
17841 esac
17842
17843 : see if truncate exists
17844 set truncate d_truncate
17845 eval $inlibc
17846
17847 : see if ttyname_r exists
17848 set ttyname_r d_ttyname_r
17849 eval $inlibc
17850 case "$d_ttyname_r" in
17851 "$define")
17852         hdrs="$i_systypes sys/types.h define stdio.h $i_unistd unistd.h"
17853         case "$d_ttyname_r_proto:$usethreads" in
17854         ":define")      d_ttyname_r_proto=define
17855                 set d_ttyname_r_proto ttyname_r $hdrs
17856                 eval $hasproto ;;
17857         *)      ;;
17858         esac
17859         case "$d_ttyname_r_proto" in
17860         define)
17861         case "$ttyname_r_proto" in
17862         ''|0) try='int ttyname_r(int, char*, size_t);'
17863         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBW ;;
17864         esac
17865         case "$ttyname_r_proto" in
17866         ''|0) try='int ttyname_r(int, char*, int);'
17867         ./protochk "extern $try" $hdrs && ttyname_r_proto=I_IBI ;;
17868         esac
17869         case "$ttyname_r_proto" in
17870         ''|0) try='char* ttyname_r(int, char*, int);'
17871         ./protochk "extern $try" $hdrs && ttyname_r_proto=B_IBI ;;
17872         esac
17873         case "$ttyname_r_proto" in
17874         ''|0)   d_ttyname_r=undef
17875                 ttyname_r_proto=0
17876                 echo "Disabling ttyname_r, cannot determine prototype." >&4 ;;
17877         * )     case "$ttyname_r_proto" in
17878                 REENTRANT_PROTO*) ;;
17879                 *) ttyname_r_proto="REENTRANT_PROTO_$ttyname_r_proto" ;;
17880                 esac
17881                 echo "Prototype: $try" ;;
17882         esac
17883         ;;
17884         *)      case "$usethreads" in
17885                 define) echo "ttyname_r has no prototype, not using it." >&4 ;;
17886                 esac
17887                 d_ttyname_r=undef
17888                 ttyname_r_proto=0
17889                 ;;
17890         esac
17891         ;;
17892 *)      ttyname_r_proto=0
17893         ;;
17894 esac
17895
17896 : see if tzname[] exists
17897 echo " "
17898 if set tzname val -a d_tzname; eval $csym; $val; then
17899         val="$define"
17900         echo 'tzname[] found.' >&4
17901 else
17902         val="$undef"
17903         echo 'tzname[] NOT found.' >&4
17904 fi
17905 set d_tzname
17906 eval $setvar
17907
17908 case "$osname" in
17909 next|rhapsody|darwin) multiarch="$define" ;;
17910 esac
17911 case "$multiarch" in
17912 ''|[nN]*) multiarch="$undef" ;;
17913 esac
17914
17915 : check for ordering of bytes in a UV
17916 echo " "
17917 case "$usecrosscompile$multiarch" in
17918 *$define*)
17919         $cat <<EOM
17920 You seem to be either cross-compiling or doing a multiarchitecture build,
17921 skipping the byteorder check.
17922
17923 EOM
17924         byteorder='ffff'
17925         ;;
17926 *)
17927         case "$byteorder" in
17928         '')
17929                 $cat <<'EOM'
17930 In the following, larger digits indicate more significance.  A big-endian
17931 machine like a Pyramid or a Motorola 680?0 chip will come out to 4321. A
17932 little-endian machine like a Vax or an Intel 80?86 chip would be 1234. Other
17933 machines may have weird orders like 3412.  A Cray will report 87654321,
17934 an Alpha will report 12345678. If the test program works the default is
17935 probably right.
17936 I'm now running the test program...
17937 EOM
17938                 $cat >try.c <<EOCP
17939 #include <stdio.h>
17940 #$i_stdlib I_STDLIB
17941 #ifdef I_STDLIB
17942 #include <stdlib.h>
17943 #endif
17944 #include <sys/types.h>
17945 typedef $uvtype UV;
17946 int main()
17947 {
17948         int i;
17949         union {
17950                 UV l;
17951                 char c[$uvsize];
17952         } u;
17953
17954         if ($uvsize > 4)
17955                 u.l = (((UV)0x08070605) << 32) | (UV)0x04030201;
17956         else
17957                 u.l = (UV)0x04030201;
17958         for (i = 0; i < $uvsize; i++)
17959                 printf("%c", u.c[i]+'0');
17960         printf("\n");
17961         exit(0);
17962 }
17963 EOCP
17964                 xxx_prompt=y
17965                 set try
17966                 if eval $compile && ./try > /dev/null; then
17967                         dflt=`$run ./try`
17968                         case "$dflt" in
17969                         [1-4][1-4][1-4][1-4]|12345678|87654321)
17970                                 echo "(The test program ran ok.)"
17971                                 echo "byteorder=$dflt"
17972                                 xxx_prompt=n
17973                         ;;
17974                         ????|????????) echo "(The test program ran ok.)" ;;
17975                         *) echo "(The test program didn't run right for some reason.)" ;;
17976                         esac
17977                 else
17978                         dflt='4321'
17979                         cat <<'EOM'
17980 (I can't seem to compile the test program.  Guessing big-endian...)
17981 EOM
17982                 fi
17983                 case "$xxx_prompt" in
17984                 y)
17985                         rp="What is the order of bytes in $uvtype?"
17986                         . ./myread
17987                         byteorder="$ans"
17988                         ;;
17989                 *)      byteorder=$dflt
17990                         ;;
17991                 esac
17992                 ;;
17993         esac
17994         $rm -f try.c try
17995         ;;
17996 esac
17997
17998
17999 $cat <<EOM
18000
18001 Checking to see whether you can access character data unalignedly...
18002 EOM
18003 case "$d_u32align" in
18004 '')   $cat >try.c <<EOCP
18005 #include <stdio.h>
18006 #$i_stdlib I_STDLIB
18007 #ifdef I_STDLIB
18008 #include <stdlib.h>
18009 #endif
18010 #define U32 $u32type
18011 #define BYTEORDER 0x$byteorder
18012 #define U8 $u8type
18013 #include <signal.h>
18014 #ifdef SIGBUS
18015 $signal_t bletch(int s) { exit(4); }
18016 #endif
18017 int main() {
18018 #if BYTEORDER == 0x1234 || BYTEORDER == 0x4321
18019     U8 buf[8];
18020     U32 *up;
18021     int i;
18022
18023     if (sizeof(U32) != 4) {
18024         printf("sizeof(U32) is not 4, but %d\n", sizeof(U32));
18025         exit(1);
18026     }
18027
18028     fflush(stdout);
18029
18030 #ifdef SIGBUS
18031     signal(SIGBUS, bletch);
18032 #endif
18033
18034     buf[0] = 0;
18035     buf[1] = 0;
18036     buf[2] = 0;
18037     buf[3] = 1;
18038     buf[4] = 0;
18039     buf[5] = 0;
18040     buf[6] = 0;
18041     buf[7] = 1;
18042
18043     for (i = 0; i < 4; i++) {
18044         up = (U32*)(buf + i);
18045         if (! ((*up == 1 << (8*i)) ||   /* big-endian */
18046                (*up == 1 << (8*(3-i)))  /* little-endian */
18047               )
18048            )
18049         {
18050             printf("read failed (%x)\n", *up);
18051             exit(2);
18052         }
18053     }
18054
18055     /* write test */
18056     for (i = 0; i < 4; i++) {
18057         up = (U32*)(buf + i);
18058         *up = 0xBeef;
18059         if (*up != 0xBeef) {
18060             printf("write failed (%x)\n", *up);
18061             exit(3);
18062         }
18063     }
18064
18065     exit(0);
18066 #else
18067     printf("1\n");
18068     exit(1);
18069 #endif
18070     return 0;
18071 }
18072 EOCP
18073 set try
18074 if eval $compile_ok; then
18075         echo "(Testing for character data alignment may crash the test.  That's okay.)" >&4
18076         $run ./try 2>&1 >/dev/null
18077         case "$?" in
18078         0)      cat >&4 <<EOM
18079 You can access character data pretty unalignedly.
18080 EOM
18081                 d_u32align="$undef"
18082                 ;;
18083         *)      cat >&4 <<EOM
18084 It seems that you must access character data in an aligned manner.
18085 EOM
18086                 d_u32align="$define"
18087                 ;;
18088         esac
18089 else
18090         rp='Can you access character data at unaligned addresses?'
18091         dflt='n'
18092         . ./myread
18093         case "$ans" in
18094         [yY]*)  d_u32align="$undef"  ;;
18095         *)      d_u32align="$define" ;;
18096         esac
18097 fi
18098 $rm -f core core.try.* try.core
18099 ;;
18100 esac
18101
18102 : see if ualarm exists
18103 set ualarm d_ualarm
18104 eval $inlibc
18105
18106 : see if umask exists
18107 set umask d_umask
18108 eval $inlibc
18109
18110 : see if unordered exists
18111 set unordered d_unordered
18112 eval $inlibc
18113
18114 : see if unsetenv exists
18115 set unsetenv d_unsetenv
18116 eval $inlibc
18117
18118 : see if usleep exists
18119 set usleep d_usleep
18120 eval $inlibc
18121
18122 : see if prototype for usleep is available
18123 echo " "
18124 set d_usleepproto usleep $i_unistd unistd.h
18125 eval $hasproto
18126
18127 : see if ustat exists
18128 set ustat d_ustat
18129 eval $inlibc
18130
18131 : see if closedir exists
18132 set closedir d_closedir
18133 eval $inlibc
18134
18135 case "$d_closedir" in
18136 "$define")
18137         echo " "
18138         echo "Checking whether closedir() returns a status..." >&4
18139         cat > try.c <<EOM
18140 #$i_dirent I_DIRENT             /**/
18141 #$i_sysdir I_SYS_DIR            /**/
18142 #$i_sysndir I_SYS_NDIR          /**/
18143 #$i_systypes I_SYS_TYPES        /**/
18144
18145 #if defined(I_SYS_TYPES)
18146 #include <sys/types.h>
18147 #endif
18148 #if defined(I_DIRENT)
18149 #include <dirent.h>
18150 #if defined(NeXT) && defined(I_SYS_DIR) /* NeXT needs dirent + sys/dir.h */
18151 #include <sys/dir.h>
18152 #endif
18153 #else
18154 #ifdef I_SYS_NDIR
18155 #include <sys/ndir.h>
18156 #else
18157 #ifdef I_SYS_DIR
18158 #ifdef hp9000s500
18159 #include <ndir.h>       /* may be wrong in the future */
18160 #else
18161 #include <sys/dir.h>
18162 #endif
18163 #endif
18164 #endif
18165 #endif 
18166 int main() { return closedir(opendir(".")); }
18167 EOM
18168         set try
18169         if eval $compile_ok; then
18170                 if $run ./try > /dev/null 2>&1 ; then
18171                         echo "Yes, it does."
18172                         val="$undef"
18173                 else
18174                         echo "No, it doesn't."
18175                         val="$define"
18176                 fi
18177         else
18178                 echo "(I can't seem to compile the test program--assuming it doesn't)"
18179                 val="$define"
18180         fi
18181         ;;
18182 *)
18183         val="$undef";
18184         ;;
18185 esac
18186 set d_void_closedir
18187 eval $setvar
18188 $rm -f try try.*
18189 : see if there is a wait4
18190 set wait4 d_wait4
18191 eval $inlibc
18192
18193 : see if waitpid exists
18194 set waitpid d_waitpid
18195 eval $inlibc
18196
18197 : see if wcstombs exists
18198 set wcstombs d_wcstombs
18199 eval $inlibc
18200
18201 : see if wctomb exists
18202 set wctomb d_wctomb
18203 eval $inlibc
18204
18205 : see if writev exists
18206 set writev d_writev
18207 eval $inlibc
18208
18209 : preserve RCS keywords in files with variable substitution, grrr
18210 Date='$Date'
18211 Id='$Id'
18212 Log='$Log'
18213 RCSfile='$RCSfile'
18214 Revision='$Revision'
18215
18216 : check for alignment requirements
18217 echo " "
18218 case "$usecrosscompile$multiarch" in
18219 *$define*)
18220         $cat <<EOM
18221 You seem to be either cross-compiling or doing a multiarchitecture build,
18222 skipping the memory alignment check.
18223
18224 EOM
18225         case "$alignbytes" in
18226         '') alignbytes=8 ;;
18227         esac
18228         ;;
18229 *)
18230         case "$alignbytes" in
18231         '') echo "Checking alignment constraints..." >&4
18232                 if $test "X$uselongdouble" = Xdefine -a "X$d_longdbl" = Xdefine; then
18233                         $cat >try.c <<'EOCP'
18234 typedef long double NV;
18235 EOCP
18236                 else
18237                         $cat >try.c <<'EOCP'
18238 typedef double NV;
18239 EOCP
18240                 fi
18241                 $cat >>try.c <<'EOCP'
18242 #include <stdio.h>
18243 struct foobar {
18244         char foo;
18245         NV bar;
18246 } try_algn;
18247 int main()
18248 {
18249     printf("%d\n", (int)((char *)&try_algn.bar - (char *)&try_algn.foo));
18250     return(0);
18251 }
18252 EOCP
18253                 set try
18254                 if eval $compile_ok; then
18255                         dflt=`$run ./try`
18256                 else
18257                         dflt='8'
18258                         echo "(I can't seem to compile the test program...)"
18259                 fi
18260                 ;;
18261         *) dflt="$alignbytes"
18262                 ;;
18263         esac
18264         rp="Doubles must be aligned on a how-many-byte boundary?"
18265         . ./myread
18266         alignbytes="$ans"
18267         $rm -f try.c try
18268         ;;
18269 esac
18270
18271
18272 : set the base revision
18273 baserev=5.0
18274
18275 : how do we concatenate cpp tokens here?
18276 echo " "
18277 echo "Checking to see how your cpp does stuff like concatenate tokens..." >&4
18278 $cat >cpp_stuff.c <<'EOCP'
18279 #define RCAT(a,b)a/**/b
18280 #define ACAT(a,b)a ## b
18281 RCAT(Rei,ser)
18282 ACAT(Cir,cus)
18283 EOCP
18284 $cppstdin $cppflags $cppminus <cpp_stuff.c >cpp_stuff.out 2>&1
18285 if $contains 'Circus' cpp_stuff.out >/dev/null 2>&1; then
18286         echo "Oh!  Smells like ANSI's been here." >&4
18287         echo "We can catify or stringify, separately or together!"
18288         cpp_stuff=42
18289 elif $contains 'Reiser' cpp_stuff.out >/dev/null 2>&1; then
18290         echo "Ah, yes!  The good old days!" >&4
18291         echo "However, in the good old days we don't know how to stringify and"
18292         echo "catify at the same time."
18293         cpp_stuff=1
18294 else
18295         $cat >&4 <<EOM
18296 Hmm, I don't seem to be able to concatenate tokens with your cpp.
18297 You're going to have to edit the values of CAT[2-5] in config.h...
18298 EOM
18299         cpp_stuff="/* Help! How do we handle cpp_stuff? */*/"
18300 fi
18301 $rm -f cpp_stuff.*
18302
18303 : see if this is a db.h system
18304 set db.h i_db
18305 eval $inhdr
18306
18307 case "$i_db" in
18308 $define)
18309         : Check db version.
18310         echo " "
18311         echo "Checking Berkeley DB version ..." >&4
18312         $cat >try.c <<EOCP
18313 #$d_const HASCONST
18314 #ifndef HASCONST
18315 #define const
18316 #endif
18317 #include <sys/types.h>
18318 #include <stdio.h>
18319 #$i_stdlib I_STDLIB
18320 #ifdef I_STDLIB
18321 #include <stdlib.h>
18322 #endif
18323 #include <db.h>
18324 int main(int argc, char *argv[])
18325 {
18326 #ifdef DB_VERSION_MAJOR /* DB version >= 2 */
18327     int Major, Minor, Patch ;
18328     unsigned long Version ;
18329     (void)db_version(&Major, &Minor, &Patch) ;
18330     if (argc == 2) {
18331         printf("%d %d %d %d %d %d\n",
18332                DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH,
18333                Major, Minor, Patch);
18334         exit(0);
18335     }
18336     printf("You have Berkeley DB Version 2 or greater.\n");
18337
18338     printf("db.h is from Berkeley DB Version %d.%d.%d\n",
18339                 DB_VERSION_MAJOR, DB_VERSION_MINOR, DB_VERSION_PATCH);
18340     printf("libdb is from Berkeley DB Version %d.%d.%d\n",
18341                 Major, Minor, Patch) ;
18342
18343     /* check that db.h & libdb are compatible */
18344     if (DB_VERSION_MAJOR != Major || DB_VERSION_MINOR != Minor || DB_VERSION_PATCH != Patch) {
18345         printf("db.h and libdb are incompatible.\n") ;
18346         exit(3);        
18347     }
18348
18349     printf("db.h and libdb are compatible.\n") ;
18350
18351     Version = DB_VERSION_MAJOR * 1000000 + DB_VERSION_MINOR * 1000
18352                 + DB_VERSION_PATCH ;
18353
18354     /* needs to be >= 2.3.4 */
18355     if (Version < 2003004) {
18356     /* if (DB_VERSION_MAJOR == 2 && DB_VERSION_MINOR == 0 && DB_VERSION_PATCH < 5) { */
18357         printf("Perl needs Berkeley DB 2.3.4 or greater.\n") ;
18358         exit(2);        
18359     }
18360
18361     exit(0);
18362 #else
18363 #if defined(_DB_H_) && defined(BTREEMAGIC) && defined(HASHMAGIC)
18364     if (argc == 2) {
18365         printf("1 0 0\n");
18366         exit(0);
18367     }
18368     printf("You have Berkeley DB Version 1.\n");
18369     exit(0);    /* DB version < 2: the coast is clear. */
18370 #else
18371     exit(1);    /* <db.h> not Berkeley DB? */
18372 #endif
18373 #endif
18374 }
18375 EOCP
18376         set try
18377         if eval $compile_ok && $run ./try; then
18378                 echo 'Looks OK.' >&4
18379                 set `$run ./try 1`
18380                 db_version_major=$1
18381                 db_version_minor=$2
18382                 db_version_patch=$3
18383         else
18384                 echo "I can't use Berkeley DB with your <db.h>.  I'll disable Berkeley DB." >&4
18385                 i_db=$undef
18386                 case " $libs " in
18387                 *"-ldb "*)
18388                         : Remove db from list of libraries to use
18389                         echo "Removing unusable -ldb from library list" >&4
18390                         set `echo X $libs | $sed -e 's/-ldb / /' -e 's/-ldb$//'`
18391                         shift
18392                         libs="$*"
18393                         echo "libs = $libs" >&4
18394                         ;;
18395                 esac
18396         fi
18397         $rm -f try.*
18398         ;;
18399 esac
18400
18401 case "$i_db" in
18402 define)
18403         : Check the return type needed for hash 
18404         echo " "
18405         echo "Checking return type needed for hash for Berkeley DB ..." >&4
18406         $cat >try.c <<EOCP
18407 #$d_const HASCONST
18408 #ifndef HASCONST
18409 #define const
18410 #endif
18411 #include <sys/types.h>
18412 #include <db.h>
18413
18414 #ifndef DB_VERSION_MAJOR
18415 u_int32_t hash_cb (ptr, size)
18416 const void *ptr;
18417 size_t size;
18418 {
18419 }
18420 HASHINFO info;
18421 int main()
18422 {
18423         info.hash = hash_cb;
18424 }
18425 #endif
18426 EOCP
18427         if $cc $ccflags -c try.c >try.out 2>&1 ; then
18428                 if $contains warning try.out >>/dev/null 2>&1 ; then
18429                         db_hashtype='int'
18430                 else
18431                         db_hashtype='u_int32_t'
18432                 fi
18433         else
18434                 : XXX Maybe we should just give up here.
18435                 db_hashtype=u_int32_t
18436                 $cat try.out >&4
18437                 echo "Help:  I can't seem to compile the db test program." >&4
18438                 echo "Something's wrong, but I'll assume you use $db_hashtype." >&4
18439         fi
18440         $rm -f try.*
18441         echo "Your version of Berkeley DB uses $db_hashtype for hash."
18442         ;;
18443 *)      db_hashtype=u_int32_t
18444         ;;
18445 esac
18446 case "$i_db" in
18447 define)
18448         : Check the return type needed for prefix 
18449         echo " "
18450         echo "Checking return type needed for prefix for Berkeley DB ..." >&4
18451         cat >try.c <<EOCP
18452 #$d_const HASCONST
18453 #ifndef HASCONST
18454 #define const
18455 #endif
18456 #include <sys/types.h>
18457 #include <db.h>
18458
18459 #ifndef DB_VERSION_MAJOR
18460 size_t prefix_cb (key1, key2)
18461 const DBT *key1;
18462 const DBT *key2;
18463 {
18464 }
18465 BTREEINFO info;
18466 int main()
18467 {
18468         info.prefix = prefix_cb;
18469 }
18470 #endif
18471 EOCP
18472         if $cc $ccflags -c try.c  >try.out 2>&1 ; then
18473                 if $contains warning try.out >>/dev/null 2>&1 ; then
18474                         db_prefixtype='int'
18475                 else
18476                         db_prefixtype='size_t'
18477                 fi
18478         else
18479                 db_prefixtype='size_t'
18480                 : XXX Maybe we should just give up here.
18481                 $cat try.out >&4
18482                 echo "Help:  I can't seem to compile the db test program." >&4
18483                 echo "Something's wrong, but I'll assume you use $db_prefixtype." >&4
18484         fi
18485         $rm -f try.*
18486         echo "Your version of Berkeley DB uses $db_prefixtype for prefix."
18487         ;;
18488 *)      db_prefixtype='size_t'
18489         ;;
18490 esac
18491
18492
18493 : How can we generate normalized random numbers ?
18494 echo " "
18495 echo "Looking for a random number function..." >&4
18496 case "$randfunc" in
18497 '')
18498         if set drand48 val -f; eval $csym; $val; then
18499                 dflt="drand48"
18500                 echo "Good, found drand48()." >&4
18501         elif set random val -f; eval $csym; $val; then
18502                 dflt="random"
18503                 echo "OK, found random()." >&4
18504         else
18505                 dflt="rand"
18506                 echo "Yick, looks like I have to use rand()." >&4
18507         fi
18508         echo " "
18509         ;;
18510 *)
18511         dflt="$randfunc"
18512         ;;
18513 esac
18514 cont=true
18515
18516 case "$ccflags" in
18517 *-Dmy_rand=*|*-Dmy_srand=*)
18518         echo "Removing obsolete -Dmy_rand, -Dmy_srand, and -Drandbits from ccflags." >&4
18519         ccflags="`echo $ccflags | sed -e 's/-Dmy_rand=random/ /'`"
18520         ccflags="`echo $ccflags | sed -e 's/-Dmy_srand=srandom/ /'`"
18521         ccflags="`echo $ccflags | sed -e 's/-Drandbits=[0-9][0-9]*/ /'`"
18522         ;;
18523 esac
18524
18525 while $test "$cont"; do
18526         rp="Use which function to generate random numbers?"
18527         . ./myread
18528         if $test "$ans" = "$dflt"; then
18529                 : null
18530         else
18531                 randbits=''
18532         fi
18533         randfunc="$ans"
18534         if set $ans val -f; eval $csym; $val; then
18535                 cont=''
18536         else
18537                 dflt=y
18538                 rp="I cannot find function $ans. Use that name anyway?"
18539                 . ./myread
18540                 dflt=rand
18541                 case "$ans" in
18542                         [yY]*) cont='';;
18543                 esac
18544         fi
18545         case "$cont" in
18546         '')
18547                 case "$randfunc" in
18548                 drand48)
18549                         drand01="drand48()"
18550                         seedfunc="srand48"
18551                         randbits=48
18552                         randseedtype=long
18553                         ;;
18554                 rand|random)
18555                         case "$randbits" in
18556                         '')
18557 echo "Checking to see how many bits your $randfunc() function produces..." >&4
18558                                 $cat >try.c <<EOCP
18559 #$i_unistd I_UNISTD
18560 #$i_stdlib I_STDLIB
18561 #include <stdio.h>
18562 #ifdef I_UNISTD
18563 #  include <unistd.h>
18564 #endif
18565 #ifdef I_STDLIB
18566 #  include <stdlib.h>
18567 #endif
18568 int main()
18569 {
18570         register int i;
18571         register unsigned long tmp;
18572         register unsigned long max = 0L;
18573
18574         for (i = 1000; i; i--) {
18575                 tmp = (unsigned long) $randfunc();
18576                 if (tmp > max) max = tmp;
18577         }
18578         for (i = 0; max; i++)
18579                 max /= 2;
18580         printf("%d\n",i);
18581 }
18582 EOCP
18583                                 set try
18584                                 if eval $compile_ok; then
18585                                         dflt=`try`
18586                                 else
18587                                         dflt='?'
18588                                         echo "(I can't seem to compile the test program...)"
18589                                 fi
18590                                 ;;
18591                         *)
18592                                 dflt="$randbits"
18593                                 ;;
18594                         esac
18595                         rp="How many bits does your $randfunc() function produce?"
18596                         . ./myread
18597                         randbits="$ans"
18598                         $rm -f try.c try
18599                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18600                         seedfunc="s$randfunc"
18601                         randseedtype=unsigned
18602                         ;;
18603                 *)
18604                         dflt="31"
18605                         rp="How many bits does your $randfunc() function produce?"
18606                         . ./myread
18607                         randbits="$ans"
18608                         seedfunc="s$randfunc"
18609                         drand01="($randfunc() / (double) ((unsigned long)1 << $randbits))"
18610                         if set $seedfunc val -f; eval $csym; $val; then
18611                                 echo "(Using $seedfunc() to seed random generator)"
18612                         else
18613                                 echo "(Warning: no $seedfunc() to seed random generator)"
18614                                 seedfunc=rand
18615                         fi
18616                         randseedtype=unsigned
18617                         ;;
18618                 esac
18619                 ;;
18620         esac
18621 done
18622
18623 echo " "
18624 echo "Determining whether or not we are on an EBCDIC system..." >&4
18625 $cat >try.c <<'EOM'
18626 int main()
18627 {
18628   if ('M'==0xd4) return 0;
18629   return 1;
18630 }
18631 EOM
18632
18633 val=$undef
18634 set try
18635 if eval $compile_ok; then
18636         if $run ./try; then
18637                 echo "You seem to speak EBCDIC." >&4
18638                 val="$define"
18639         else
18640                 echo "Nope, no EBCDIC, probably ASCII or some ISO Latin. Or UTF-8." >&4
18641         fi
18642 else
18643         echo "I'm unable to compile the test program." >&4
18644         echo "I'll assume ASCII or some ISO Latin. Or UTF8." >&4
18645 fi
18646 $rm -f try try.*
18647 set ebcdic
18648 eval $setvar
18649
18650 echo " "
18651 $cat >&4 <<EOM
18652 Checking how to flush all pending stdio output...
18653 EOM
18654 # I only know how to find the first 32 possibly open files on SunOS.
18655 # See also hints/sunos_4_1.sh and util.c  --AD
18656 case "$osname" in
18657 sunos) $echo '#define PERL_FFLUSH_ALL_FOPEN_MAX 32' > try.c ;;
18658 esac
18659 $cat >>try.c <<EOCP
18660 #include <stdio.h>
18661 #$i_stdlib I_STDLIB
18662 #ifdef I_STDLIB
18663 #include <stdlib.h>
18664 #endif
18665 #$i_unistd I_UNISTD
18666 #ifdef I_UNISTD
18667 # include <unistd.h>
18668 #endif
18669 #$d_sysconf HAS_SYSCONF
18670 #$d_stdio_stream_array HAS_STDIO_STREAM_ARRAY
18671 #ifdef HAS_STDIO_STREAM_ARRAY
18672 # define STDIO_STREAM_ARRAY $stdio_stream_array
18673 #endif
18674 int main() {
18675   FILE* p;
18676   unlink("try.out");
18677   p = fopen("try.out", "w");
18678 #ifdef TRY_FPUTC
18679   fputc('x', p);
18680 #else
18681 # ifdef TRY_FPRINTF
18682   fprintf(p, "x");
18683 # endif
18684 #endif
18685 #ifdef TRY_FFLUSH_NULL
18686   fflush(NULL);
18687 #endif
18688 #ifdef TRY_FFLUSH_ALL
18689   {
18690     long open_max = -1;
18691 # ifdef PERL_FFLUSH_ALL_FOPEN_MAX
18692     open_max = PERL_FFLUSH_ALL_FOPEN_MAX;
18693 # else
18694 #  if defined(HAS_SYSCONF) && defined(_SC_OPEN_MAX)
18695     open_max = sysconf(_SC_OPEN_MAX);
18696 #  else
18697 #   ifdef FOPEN_MAX
18698     open_max = FOPEN_MAX;
18699 #   else
18700 #    ifdef OPEN_MAX
18701     open_max = OPEN_MAX;
18702 #    else
18703 #     ifdef _NFILE
18704     open_max = _NFILE;
18705 #     endif
18706 #    endif
18707 #   endif
18708 #  endif
18709 # endif 
18710 # ifdef HAS_STDIO_STREAM_ARRAY
18711     if (open_max > 0) {
18712       long i;
18713       for (i = 0; i < open_max; i++)
18714             if (STDIO_STREAM_ARRAY[i]._file >= 0 &&
18715                 STDIO_STREAM_ARRAY[i]._file < open_max &&
18716                 STDIO_STREAM_ARRAY[i]._flag)
18717                 fflush(&STDIO_STREAM_ARRAY[i]);
18718     }   
18719   }
18720 # endif
18721 #endif
18722   _exit(42);
18723 }
18724 EOCP
18725 : first we have to find out how _not_ to flush
18726 $to try.c
18727 if $test "X$fflushNULL" = X -o "X$fflushall" = X; then
18728     output=''
18729     set try -DTRY_FPUTC
18730     if eval $compile; then
18731             $run ./try 2>/dev/null
18732             code="$?"
18733             $from try.out
18734             if $test ! -s try.out -a "X$code" = X42; then
18735                 output=-DTRY_FPUTC
18736             fi
18737     fi
18738     case "$output" in
18739     '')
18740             set try -DTRY_FPRINTF
18741             if eval $compile; then
18742                     $run ./try 2>/dev/null
18743                     code="$?"
18744                     $from try.out
18745                     if $test ! -s try.out -a "X$code" = X42; then
18746                         output=-DTRY_FPRINTF
18747                     fi
18748             fi
18749         ;;
18750     esac
18751 fi
18752 : check for fflush NULL behaviour
18753 case "$fflushNULL" in
18754 '')     set try -DTRY_FFLUSH_NULL $output
18755         if eval $compile; then
18756                 $run ./try 2>/dev/null
18757                 code="$?"
18758                 $from try.out
18759                 if $test -s try.out -a "X$code" = X42; then
18760                         fflushNULL="`$cat try.out`"
18761                 else
18762                         if $test "X$code" != X42; then
18763                                 $cat >&4 <<EOM
18764 (If this test failed, don't worry, we'll try another method shortly.)
18765 EOM
18766                         fi
18767                 fi
18768         fi
18769         $rm -f core try.core core.try.*
18770         case "$fflushNULL" in
18771         x)      $cat >&4 <<EOM
18772 Your fflush(NULL) works okay for output streams.
18773 Let's see if it clobbers input pipes...
18774 EOM
18775 # As of mid-March 2000 all versions of Solaris appear to have a stdio
18776 # bug that improperly flushes the input end of pipes.  So we avoid the
18777 # autoflush on fork/system/exec support for now. :-(
18778 $cat >tryp.c <<EOCP
18779 #include <stdio.h>
18780 int
18781 main(int argc, char **argv)
18782 {
18783     char buf[1024];
18784     int i;
18785     char *bp = buf;
18786     while (1) {
18787         while ((i = getc(stdin)) != -1
18788                && (*bp++ = i) != '\n'
18789                && bp < &buf[1024])
18790         /* DO NOTHING */ ;
18791         *bp = '\0';
18792         fprintf(stdout, "%s", buf);
18793         fflush(NULL);
18794         if (i == -1)
18795             return 0;
18796         bp = buf;
18797     }
18798 }
18799 EOCP
18800                 fflushNULL="$define"
18801                 set tryp
18802                 if eval $compile; then
18803                     $rm -f tryp.out
18804                     $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18805                     if cmp tryp.c tryp.out >/dev/null 2>&1; then
18806                        $cat >&4 <<EOM
18807 fflush(NULL) seems to behave okay with input streams.
18808 EOM
18809                         fflushNULL="$define"
18810                     else
18811                         $cat >&4 <<EOM
18812 Ouch, fflush(NULL) clobbers input pipes!  We will not use it.
18813 EOM
18814                         fflushNULL="$undef"
18815                     fi
18816                 fi
18817                 $rm -f core tryp.c tryp.core core.tryp.*
18818                 ;;
18819         '')     $cat >&4 <<EOM
18820 Your fflush(NULL) isn't working (contrary to ANSI C).
18821 EOM
18822                 fflushNULL="$undef"
18823                 ;;
18824         *)      $cat >&4 <<EOM
18825 Cannot figure out whether your fflush(NULL) works or not.
18826 I'm assuming it doesn't (contrary to ANSI C).
18827 EOM
18828                 fflushNULL="$undef"
18829                 ;;
18830         esac
18831         ;;
18832 $define|true|[yY]*)
18833         fflushNULL="$define"
18834         ;;
18835 *)
18836         fflushNULL="$undef"
18837         ;;
18838 esac
18839 : check explicit looping only if NULL did not work, and if the pipe
18840 : bug does not show up on an explicit flush too
18841 case "$fflushNULL" in
18842 "$undef")
18843         $cat >tryp.c <<EOCP
18844 #include <stdio.h>
18845 int
18846 main(int argc, char **argv)
18847 {
18848     char buf[1024];
18849     int i;
18850     char *bp = buf;
18851     while (1) {
18852         while ((i = getc(stdin)) != -1
18853                && (*bp++ = i) != '\n'
18854                && bp < &buf[1024])
18855         /* DO NOTHING */ ;
18856         *bp = '\0';
18857         fprintf(stdout, "%s", buf);
18858         fflush(stdin);
18859         if (i == -1)
18860             return 0;
18861         bp = buf;
18862     }
18863 }
18864 EOCP
18865         set tryp
18866         if eval $compile; then
18867             $rm -f tryp.out
18868             $cat tryp.c | $run ./tryp 2>/dev/null > tryp.out
18869             if cmp tryp.c tryp.out >/dev/null 2>&1; then
18870                $cat >&4 <<EOM
18871 Good, at least fflush(stdin) seems to behave okay when stdin is a pipe.
18872 EOM
18873                 : now check for fflushall behaviour
18874                 case "$fflushall" in
18875                 '')     set try -DTRY_FFLUSH_ALL $output
18876                         if eval $compile; then
18877                                 $cat >&4 <<EOM
18878 (Now testing the other method--but note that this also may fail.)
18879 EOM
18880                                 $run ./try 2>/dev/null
18881                                 code=$?
18882                                 $from try.out
18883                                 if $test -s try.out -a "X$code" = X42; then
18884                                         fflushall="`$cat try.out`"
18885                                 fi
18886                         fi
18887                         $rm -f core try.core core.try.*
18888                         case "$fflushall" in
18889                         x)      $cat >&4 <<EOM
18890 Whew. Flushing explicitly all the stdio streams works.
18891 EOM
18892                                 fflushall="$define"
18893                                 ;;
18894                         '')     $cat >&4 <<EOM
18895 Sigh. Flushing explicitly all the stdio streams doesn't work.
18896 EOM
18897                                 fflushall="$undef"
18898                                 ;;
18899                         *)      $cat >&4 <<EOM
18900 Cannot figure out whether flushing stdio streams explicitly works or not.
18901 I'm assuming it doesn't.
18902 EOM
18903                                 fflushall="$undef"
18904                                 ;;
18905                         esac
18906                         ;;
18907                 "$define"|true|[yY]*)
18908                         fflushall="$define"
18909                         ;;
18910                 *)
18911                         fflushall="$undef"
18912                         ;;
18913                 esac
18914             else
18915                 $cat >&4 <<EOM
18916 All is futile.  Even fflush(stdin) clobbers input pipes!
18917 EOM
18918                 fflushall="$undef"
18919             fi
18920         else
18921             fflushall="$undef"
18922         fi
18923         $rm -f core tryp.c tryp.core core.tryp.*
18924         ;;
18925 *)      fflushall="$undef"
18926         ;;
18927 esac
18928
18929 case "$fflushNULL$fflushall" in
18930 undefundef)
18931         $cat <<EOM
18932 OK, I give up.  I cannot figure out how to flush pending stdio output.
18933 We won't be flushing handles at all before fork/exec/popen.
18934 EOM
18935         ;;
18936 esac
18937 $rm -f try.* try$exe_ext
18938
18939 : Store the full pathname to the ar program for use in the C program
18940 : Respect a hint or command line value for full_ar.
18941 case "$full_ar" in
18942 '') full_ar=$ar ;;
18943 esac
18944
18945 : Store the full pathname to the sed program for use in the C program
18946 full_sed=$sed
18947
18948 : see what type gids are declared as in the kernel
18949 echo " "
18950 echo "Looking for the type for group ids returned by getgid()."
18951 set gid_t gidtype xxx stdio.h sys/types.h
18952 eval $typedef
18953 case "$gidtype" in
18954 xxx)
18955         xxx=`./findhdr sys/user.h`
18956         set `grep 'groups\[NGROUPS\];' "$xxx" 2>/dev/null` unsigned short
18957         case $1 in
18958         unsigned) dflt="$1 $2" ;;
18959         *) dflt="$1" ;;
18960         esac
18961         ;;
18962 *) dflt="$gidtype";;
18963 esac
18964 case "$gidtype" in
18965 gid_t) echo "gid_t found." ;;
18966 *)      rp="What is the type for group ids returned by getgid()?"
18967         . ./myread
18968         gidtype="$ans"
18969         ;;
18970 esac
18971
18972 echo " "
18973 case "$gidtype" in
18974 *_t) zzz="$gidtype"     ;;
18975 *)   zzz="gid"          ;;
18976 esac
18977 echo "Checking the size of $zzz..." >&4 
18978 cat > try.c <<EOCP
18979 #include <sys/types.h>
18980 #include <stdio.h>
18981 #$i_stdlib I_STDLIB
18982 #ifdef I_STDLIB
18983 #include <stdlib.h>
18984 #endif
18985 int main() {
18986     printf("%d\n", (int)sizeof($gidtype));
18987     exit(0);
18988 }
18989 EOCP
18990 set try
18991 if eval $compile_ok; then
18992         yyy=`$run ./try`
18993         case "$yyy" in
18994         '')     gidsize=4
18995                 echo "(I can't execute the test program--guessing $gidsize.)" >&4
18996                 ;;
18997         *)      gidsize=$yyy
18998                 echo "Your $zzz is $gidsize bytes long."
18999                 ;;
19000         esac
19001 else
19002         gidsize=4
19003         echo "(I can't compile the test program--guessing $gidsize.)" >&4
19004 fi
19005
19006
19007 echo " "
19008 case "$gidtype" in
19009 *_t) zzz="$gidtype"     ;;
19010 *)   zzz="gid"          ;;
19011 esac
19012 echo "Checking the sign of $zzz..." >&4 
19013 cat > try.c <<EOCP
19014 #include <sys/types.h>
19015 #include <stdio.h>
19016 int main() {
19017         $gidtype foo = -1;
19018         if (foo < 0)
19019                 printf("-1\n");
19020         else
19021                 printf("1\n");
19022 }
19023 EOCP
19024 set try
19025 if eval $compile; then
19026         yyy=`$run ./try`
19027         case "$yyy" in
19028         '')     gidsign=1
19029                 echo "(I can't execute the test program--guessing unsigned.)" >&4
19030                 ;;
19031         *)      gidsign=$yyy
19032                 case "$gidsign" in
19033                  1) echo "Your $zzz is unsigned." ;;
19034                 -1) echo "Your $zzz is signed."   ;;
19035                 esac
19036                 ;;
19037         esac
19038 else
19039         gidsign=1
19040         echo "(I can't compile the test program--guessing unsigned.)" >&4
19041 fi
19042
19043
19044 echo " "
19045
19046 if $test X"$quadtype" != X; then
19047
19048 echo "Checking how to print 64-bit integers..." >&4
19049
19050 if $test X"$sPRId64" = X -a X"$quadtype" = Xint; then
19051         $cat >try.c <<'EOCP'
19052 #include <sys/types.h>
19053 #include <stdio.h>
19054 int main() {
19055   int q = 12345678901;
19056   printf("%ld\n", q);
19057 }
19058 EOCP
19059         set try
19060         if eval $compile; then
19061                 yyy=`$run ./try`
19062                 case "$yyy" in
19063                 12345678901)
19064                         sPRId64='"d"'; sPRIi64='"i"'; sPRIu64='"u"';
19065                         sPRIo64='"o"'; sPRIx64='"x"'; sPRIXU64='"X"';
19066                         echo "We will use %d."
19067                         ;;
19068                 esac
19069         fi
19070 fi
19071
19072 if $test X"$sPRId64" = X -a X"$quadtype" = Xlong; then
19073         $cat >try.c <<'EOCP'
19074 #include <sys/types.h>
19075 #include <stdio.h>
19076 int main() {
19077   long q = 12345678901;
19078   printf("%ld\n", q);
19079 }
19080 EOCP
19081         set try
19082         if eval $compile; then
19083                 yyy=`$run ./try`
19084                 case "$yyy" in
19085                 12345678901)
19086                         sPRId64='"ld"'; sPRIi64='"li"'; sPRIu64='"lu"';
19087                         sPRIo64='"lo"'; sPRIx64='"lx"'; sPRIXU64='"lX"';
19088                         echo "We will use %ld."
19089                         ;;
19090                 esac
19091         fi
19092 fi
19093
19094 if $test X"$sPRId64" = X -a X"$i_inttypes" = X"$define" -a X"$quadtype" = Xint64_t; then
19095         $cat >try.c <<'EOCP'
19096 #include <sys/types.h>
19097 #include <inttypes.h>
19098 #include <stdio.h>
19099 int main() {
19100   int64_t q = 12345678901;
19101   printf("%" PRId64 "\n", q);
19102 }
19103 EOCP
19104         set try
19105         if eval $compile; then
19106                 yyy=`$run ./try`
19107                 case "$yyy" in
19108                 12345678901)
19109                         sPRId64=PRId64; sPRIi64=PRIi64; sPRIu64=PRIu64;
19110                         sPRIo64=PRIo64; sPRIx64=PRIx64; sPRIXU64=PRIXU64;
19111                         echo "We will use the C9X style."
19112                         ;;
19113                 esac
19114         fi
19115 fi
19116
19117 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19118         $cat >try.c <<EOCP
19119 #include <sys/types.h>
19120 #include <stdio.h>
19121 int main() {
19122   $quadtype q = 12345678901;
19123   printf("%Ld\n", q);
19124 }
19125 EOCP
19126         set try
19127         if eval $compile; then
19128                 yyy=`$run ./try`
19129                 case "$yyy" in
19130                 12345678901)
19131                         sPRId64='"Ld"'; sPRIi64='"Li"'; sPRIu64='"Lu"';
19132                         sPRIo64='"Lo"'; sPRIx64='"Lx"'; sPRIXU64='"LX"';
19133                         echo "We will use %Ld."
19134                         ;;
19135                 esac
19136         fi
19137 fi
19138
19139 if $test X"$sPRId64" = X -a X"$quadtype" = X"long long"; then
19140         $cat >try.c <<'EOCP'
19141 #include <sys/types.h>
19142 #include <stdio.h>
19143 int main() {
19144   long long q = 12345678901LL; /* AIX cc requires the LL suffix. */
19145   printf("%lld\n", q);
19146 }
19147 EOCP
19148         set try
19149         if eval $compile; then
19150                 yyy=`$run ./try`
19151                 case "$yyy" in
19152                 12345678901)
19153                         sPRId64='"lld"'; sPRIi64='"lli"'; sPRIu64='"llu"';
19154                         sPRIo64='"llo"'; sPRIx64='"llx"'; sPRIXU64='"llX"';
19155                         echo "We will use the %lld style."
19156                         ;;
19157                 esac
19158         fi
19159 fi
19160
19161 if $test X"$sPRId64" = X -a X"$quadtype" != X; then
19162         $cat >try.c <<EOCP
19163 #include <sys/types.h>
19164 #include <stdio.h>
19165 int main() {
19166   $quadtype q = 12345678901;
19167   printf("%qd\n", q);
19168 }
19169 EOCP
19170         set try
19171         if eval $compile; then
19172                 yyy=`$run ./try`
19173                 case "$yyy" in
19174                 12345678901)
19175                         sPRId64='"qd"'; sPRIi64='"qi"'; sPRIu64='"qu"';
19176                         sPRIo64='"qo"'; sPRIx64='"qx"'; sPRIXU64='"qX"';
19177                         echo "We will use %qd."
19178                         ;;
19179                 esac
19180         fi
19181 fi
19182
19183 if $test X"$sPRId64" = X; then
19184         echo "Cannot figure out how to print 64-bit integers." >&4
19185 fi
19186
19187 $rm -f try try.*
19188
19189 fi
19190
19191 case "$sPRId64" in
19192 '')     d_PRId64="$undef"; d_PRIi64="$undef"; d_PRIu64="$undef"; 
19193         d_PRIo64="$undef"; d_PRIx64="$undef"; d_PRIXU64="$undef"; 
19194         ;;
19195 *)      d_PRId64="$define"; d_PRIi64="$define"; d_PRIu64="$define"; 
19196         d_PRIo64="$define"; d_PRIx64="$define"; d_PRIXU64="$define"; 
19197         ;;
19198 esac
19199
19200
19201 echo " "
19202 $echo "Checking the format strings to be used for Perl's internal types..." >&4
19203
19204 if $test X"$ivsize" = X8; then
19205         ivdformat="$sPRId64"
19206         uvuformat="$sPRIu64"
19207         uvoformat="$sPRIo64"
19208         uvxformat="$sPRIx64"
19209         uvXUformat="$sPRIXU64"
19210 else
19211         if $test X"$ivsize" = X"$longsize"; then
19212                 ivdformat='"ld"'
19213                 uvuformat='"lu"'
19214                 uvoformat='"lo"'
19215                 uvxformat='"lx"'
19216                 uvXUformat='"lX"'
19217         else
19218                 if $test X"$ivsize" = X"$intsize"; then
19219                         ivdformat='"d"'
19220                         uvuformat='"u"'
19221                         uvoformat='"o"'
19222                         uvxformat='"x"'
19223                         uvXUformat='"X"'
19224                 else
19225                         : far out
19226                         if $test X"$ivsize" = X"$shortsize"; then
19227                                 ivdformat='"hd"'
19228                                 uvuformat='"hu"'
19229                                 uvoformat='"ho"'
19230                                 uvxformat='"hx"'
19231                                 uvXUformat='"hX"'
19232                         fi
19233                 fi
19234         fi
19235 fi
19236
19237 if $test X"$uselongdouble" = X"$define" -a X"$d_longdbl" = X"$define" -a X"$d_PRIgldbl" = X"$define"; then
19238         nveformat="$sPRIeldbl"
19239         nvfformat="$sPRIfldbl"
19240         nvgformat="$sPRIgldbl"
19241         nvEUformat="$sPRIEUldbl"
19242         nvFUformat="$sPRIFUldbl"
19243         nvGUformat="$sPRIGUldbl"
19244 else
19245         nveformat='"e"'
19246         nvfformat='"f"'
19247         nvgformat='"g"'
19248         nvEUformat='"E"'
19249         nvFUformat='"F"'
19250         nvGUformat='"G"'
19251 fi
19252
19253 case "$ivdformat" in
19254 '') echo "$0: Fatal: failed to find format strings, cannot continue." >&4
19255     exit 1
19256     ;;
19257 esac
19258
19259
19260 echo " "
19261 $echo "Checking the format string to be used for gids..." >&4
19262
19263 case "$gidsign" in
19264 -1)     if $test X"$gidsize" = X"$ivsize"; then
19265                 gidformat="$ivdformat"
19266         else
19267                 if $test X"$gidsize" = X"$longsize"; then
19268                         gidformat='"ld"'
19269                 else
19270                         if $test X"$gidsize" = X"$intsize"; then
19271                                 gidformat='"d"'
19272                         else
19273                                 if $test X"$gidsize" = X"$shortsize"; then
19274                                         gidformat='"hd"'
19275                                 fi
19276                         fi
19277                 fi
19278         fi
19279         ;;
19280 *)      if $test X"$gidsize" = X"$uvsize"; then
19281                 gidformat="$uvuformat"
19282         else
19283                 if $test X"$gidsize" = X"$longsize"; then
19284                         gidformat='"lu"'
19285                 else
19286                         if $test X"$gidsize" = X"$intsize"; then
19287                                 gidformat='"u"'
19288                         else
19289                                 if $test X"$gidsize" = X"$shortsize"; then
19290                                         gidformat='"hu"'
19291                                 fi
19292                         fi
19293                 fi
19294         fi
19295         ;;
19296 esac
19297
19298 : see if getgroups exists
19299 set getgroups d_getgrps
19300 eval $inlibc
19301
19302 : see if setgroups exists
19303 set setgroups d_setgrps
19304 eval $inlibc
19305
19306
19307 : Find type of 2nd arg to 'getgroups()' and 'setgroups()'
19308 echo " "
19309 case "$d_getgrps$d_setgrps" in
19310 *define*)
19311         case "$groupstype" in
19312         '') dflt="$gidtype" ;;
19313         *)  dflt="$groupstype" ;;
19314         esac
19315         $cat <<EOM
19316 What type of pointer is the second argument to getgroups() and setgroups()?
19317 Usually this is the same as group ids, $gidtype, but not always.
19318
19319 EOM
19320         rp='What type pointer is the second argument to getgroups() and setgroups()?'
19321         . ./myread
19322         groupstype="$ans"
19323         ;;
19324 *)  groupstype="$gidtype";;
19325 esac
19326
19327
19328 if $test $patchlevel -lt 9; then
19329 : MAD is not available in 5.8.x or earlier.
19330     ans=n;
19331 else
19332     case "$mad" in
19333     $define|true|[yY]*) dflt='y' ;;
19334     *)                  dflt='n' ;;
19335     esac
19336     cat <<EOM
19337
19338 Would you like to build with Misc Attribute Decoration? This is development
19339 work leading to a Perl 5 to Perl 6 convertor, which imposes a space and speed
19340 overhead on the interpreter.
19341
19342 If this doesn't make any sense to you, just accept the default '$dflt'.
19343 EOM
19344     rp='Build Perl with MAD?'
19345     . ./myread
19346 fi
19347 case "$ans" in
19348 y|Y)    val="$define"
19349         madlyh='madly.h madly.act madly.tab'
19350         madlysrc='madly.c'
19351         madlyobj="madly$_o" ;;
19352 *)      val="$undef"
19353         madlyh=''
19354         madlysrc=''
19355         madlyobj='' ;;
19356 esac
19357 set mad
19358 eval $setvar
19359
19360 echo " "
19361 echo "Checking if your $make program sets \$(MAKE)..." >&4
19362 case "$make_set_make" in
19363 '')
19364         $sed 's/^X //' > testmake.mak << 'EOF'
19365 Xall:
19366 X       @echo 'maketemp="$(MAKE)"'
19367 EOF
19368         case "`$make -f testmake.mak 2>/dev/null`" in
19369         *maketemp=*) make_set_make='#' ;;
19370         *)      make_set_make="MAKE=$make" ;;
19371         esac
19372         $rm -f testmake.mak
19373         ;;
19374 esac
19375 case "$make_set_make" in
19376 '#') echo "Yup, it does.";;
19377 *) echo "Nope, it doesn't.";;
19378 esac
19379
19380 : see what type is used for mode_t
19381 rp="What is the type used for file modes for system calls (e.g. fchmod())?"
19382 set mode_t modetype int stdio.h sys/types.h
19383 eval $typedef_ask
19384
19385 : see if we need va_copy
19386 echo " "
19387 case "$i_stdarg" in
19388 "$define")
19389         $cat >try.c <<EOCP
19390 #include <stdarg.h>
19391 #include <stdio.h>
19392 #$i_stdlib I_STDLIB
19393 #ifdef I_STDLIB
19394 #include <stdlib.h>
19395 #endif
19396 #include <signal.h>
19397
19398 int
19399 ivfprintf(FILE *f, const char *fmt, va_list *valp)
19400 {
19401   return vfprintf(f, fmt, *valp);
19402 }
19403  
19404 int    
19405 myvfprintf(FILE *f, const  char *fmt, va_list val)
19406 {
19407   return ivfprintf(f, fmt, &val);
19408 }
19409       
19410 int
19411 myprintf(char *fmt, ...) 
19412 {
19413   va_list val;
19414   va_start(val, fmt);
19415   return myvfprintf(stdout, fmt, val); 
19416 }         
19417
19418 int
19419 main(int ac, char **av)
19420 {
19421   signal(SIGSEGV, exit);
19422
19423   myprintf("%s%cs all right, then\n", "that", '\'');                            
19424   exit(0);      
19425 }
19426 EOCP
19427         set try
19428         if eval $compile && $run ./try 2>&1 >/dev/null; then
19429                 case "`$run ./try`" in
19430                 "that's all right, then")
19431                         okay=yes
19432                         ;;
19433                 esac
19434         fi
19435         case "$okay" in
19436         yes)    echo "It seems that you don't need va_copy()." >&4
19437                 need_va_copy="$undef"
19438                 ;;
19439         *)      echo "It seems that va_copy() or similar will be needed." >&4
19440                 need_va_copy="$define"
19441                 ;;
19442         esac
19443         $rm -f try.* core core.* *.core *.core.*
19444         ;;
19445 *)      echo "You don't have <stdarg.h>, not checking for va_copy()." >&4
19446         ;;
19447 esac
19448
19449 : see what type is used for size_t
19450 rp="What is the type used for the length parameter for string functions?"
19451 set size_t sizetype 'unsigned int' stdio.h sys/types.h
19452 eval $typedef_ask
19453
19454 : check for type of arguments to gethostbyaddr. 
19455 if test "X$netdb_host_type" = X -o "X$netdb_hlen_type" = X; then
19456         case "$d_gethbyaddr" in
19457         $define)
19458                 $cat <<EOM
19459
19460 Checking to see what type of arguments are accepted by gethostbyaddr().
19461 EOM
19462                 hdrs="$define sys/types.h
19463                         $d_socket sys/socket.h 
19464                         $i_niin netinet/in.h 
19465                         $i_netdb netdb.h
19466                         $i_unistd unistd.h"
19467                 : The first arg can 'char *' or 'void *'
19468                 : The second arg is some of integral type
19469                 for xxx in in_addr_t 'const void *' 'const char *' 'void *' 'char *'; do
19470                         for yyy in size_t long int; do
19471                                 case "$netdb_host_type" in
19472                                 '')     try="extern struct hostent *gethostbyaddr($xxx, $yyy, int);"
19473                                         if ./protochk "$try" $hdrs; then
19474                                                 echo "Your system accepts $xxx for the first arg."
19475                                                 echo "...and $yyy for the second arg."
19476                                                 netdb_host_type="$xxx"
19477                                                 netdb_hlen_type="$yyy"
19478                                         fi
19479                                         ;;
19480                                 esac
19481                         done
19482                 done
19483                 : In case none of those worked, prompt the user.
19484                 case "$netdb_host_type" in
19485                 '')     rp='What is the type for the 1st argument to gethostbyaddr?'
19486                         dflt='char *'
19487                         . ./myread
19488                         netdb_host_type=$ans
19489                         rp='What is the type for the 2nd argument to gethostbyaddr?'
19490                         dflt="$sizetype"
19491                         . ./myread
19492                         netdb_hlen_type=$ans
19493                         ;;
19494                 esac
19495                 ;;
19496         *)      : no gethostbyaddr, so pick harmless defaults
19497                 netdb_host_type='char *'
19498                 netdb_hlen_type="$sizetype"
19499                 ;;
19500         esac
19501         # Remove the "const" if needed. -- but then we'll have a 
19502         # prototype clash!
19503         # netdb_host_type=`echo "$netdb_host_type" | sed 's/^const //'`
19504 fi
19505
19506 : check for type of argument to gethostbyname. 
19507 if test "X$netdb_name_type" = X ; then
19508         case "$d_gethbyname" in
19509         $define)
19510                 $cat <<EOM
19511
19512 Checking to see what type of argument is accepted by gethostbyname().
19513 EOM
19514                 hdrs="$define sys/types.h
19515                         $d_socket sys/socket.h 
19516                         $i_niin netinet/in.h 
19517                         $i_netdb netdb.h
19518                         $i_unistd unistd.h"
19519                 for xxx in "const char *" "char *"; do
19520                         case "$netdb_name_type" in
19521                         '')     try="extern struct hostent *gethostbyname($xxx);"
19522                                 if ./protochk "$try" $hdrs; then
19523                                         echo "Your system accepts $xxx."
19524                                         netdb_name_type="$xxx"
19525                                 fi
19526                                 ;;
19527                         esac
19528                 done
19529                 : In case none of those worked, prompt the user.
19530                 case "$netdb_name_type" in
19531                 '')     rp='What is the type for the 1st argument to gethostbyname?'
19532                         dflt='char *'
19533                         . ./myread
19534                         netdb_name_type=$ans
19535                         ;;
19536                 esac
19537                 ;;
19538         *)      : no gethostbyname, so pick harmless default
19539                 netdb_name_type='char *'
19540                 ;;
19541         esac
19542 fi
19543
19544 : check for type of 1st argument to getnetbyaddr. 
19545 if test "X$netdb_net_type" = X ; then
19546         case "$d_getnbyaddr" in
19547         $define)
19548                 $cat <<EOM
19549
19550 Checking to see what type of 1st argument is accepted by getnetbyaddr().
19551 EOM
19552                 hdrs="$define sys/types.h
19553                         $d_socket sys/socket.h 
19554                         $i_niin netinet/in.h 
19555                         $i_netdb netdb.h
19556                         $i_unistd unistd.h"
19557                 for xxx in in_addr_t "unsigned long" long "unsigned int" int; do
19558                         case "$netdb_net_type" in
19559                         '')     try="extern struct netent *getnetbyaddr($xxx, int);"
19560                                 if ./protochk "$try" $hdrs; then
19561                                         echo "Your system accepts $xxx."
19562                                         netdb_net_type="$xxx"
19563                                 fi
19564                                 ;;
19565                         esac
19566                 done
19567                 : In case none of those worked, prompt the user.
19568                 case "$netdb_net_type" in
19569                 '')     rp='What is the type for the 1st argument to getnetbyaddr?'
19570                         dflt='long'
19571                         . ./myread
19572                         netdb_net_type=$ans
19573                         ;;
19574                 esac
19575                 ;;
19576         *)      : no getnetbyaddr, so pick harmless default
19577                 netdb_net_type='long'
19578                 ;;
19579         esac
19580 fi
19581 : locate the preferred pager for this system
19582 fn=f/
19583 case "$pager" in
19584 '')
19585         dflt=''
19586         case "$pg" in
19587         /*) dflt=$pg;;
19588         [a-zA-Z]:/*) dflt=$pg;;
19589         esac
19590         case "$more" in
19591         /*) dflt=$more;;
19592         [a-zA-Z]:/*) dflt=$more;;
19593         esac
19594         case "$less" in
19595         /*) dflt=$less;;
19596         [a-zA-Z]:/*) dflt=$less;;
19597         esac
19598         case "$dflt" in
19599         '') dflt=/usr/ucb/more;;
19600         esac
19601         ;;
19602 *)      dflt="$pager"
19603         : Instruct ./getfile to trust the hinted or previous pager value,
19604         : even if it does not begin with a slash.  For example, on os2,
19605         : pager might be cmd /c more.  See comments in UU/getfile.
19606         fn="f/($pager)"
19607         ;;
19608 esac
19609 echo " "
19610 rp='What pager is used on your system?'
19611 . ./getfile
19612 pager="$ans"
19613
19614 : see what type pids are declared as in the kernel
19615 rp="What is the type of process ids on this system?"
19616 set pid_t pidtype int stdio.h sys/types.h
19617 eval $typedef_ask
19618
19619 : see if ar generates random libraries by itself
19620 echo " "
19621 echo "Checking how to generate random libraries on your machine..." >&4
19622 echo 'int bar1() { return bar2(); }' > bar1.c
19623 echo 'int bar2() { return 2; }' > bar2.c
19624 $cat > foo.c <<EOP
19625 #$i_stdlib I_STDLIB
19626 #ifdef I_STDLIB
19627 #include <stdlib.h>
19628 #endif
19629 int main() { printf("%d\n", bar1()); exit(0); }
19630 EOP
19631 $cc $ccflags -c bar1.c >/dev/null 2>&1
19632 $cc $ccflags -c bar2.c >/dev/null 2>&1
19633 $cc $ccflags -c foo.c >/dev/null 2>&1
19634 $ar rc bar$_a bar2$_o bar1$_o >/dev/null 2>&1
19635 if $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19636         $run ./foobar >/dev/null 2>&1; then
19637         echo "$ar appears to generate random libraries itself."
19638         orderlib=false
19639         if [ "X$ranlib" = "X" ]; then
19640             ranlib=":"
19641         fi
19642 elif $ar s bar$_a >/dev/null 2>&1 &&
19643         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19644         $run ./foobar >/dev/null 2>&1; then
19645                 echo "a table of contents needs to be added with '$ar s'."
19646                 orderlib=false
19647                 ranlib="$ar s"
19648 elif $ar ts bar$_a >/dev/null 2>&1 &&
19649         $cc -o foobar $ccflags $ldflags foo$_o bar$_a $libs > /dev/null 2>&1 &&
19650         $run ./foobar >/dev/null 2>&1; then
19651                 echo "a table of contents needs to be added with '$ar ts'."
19652                 orderlib=false
19653                 ranlib="$ar ts"
19654 else
19655         case "$ranlib" in
19656         :) ranlib='';;
19657         '')
19658                 ranlib=`./loc ranlib X /usr/bin /bin /usr/local/bin`
19659                 $test -f $ranlib || ranlib=''
19660                 ;;
19661         esac
19662         if $test -n "$ranlib"; then
19663                 echo "your system has '$ranlib'; we'll use that."
19664                 orderlib=false
19665         else
19666                 echo "your system doesn't seem to support random libraries"
19667                 echo "so we'll use lorder and tsort to order the libraries."
19668                 orderlib=true
19669                 ranlib=":"
19670         fi
19671 fi
19672 $rm -f foo* bar*
19673
19674 : check for type of arguments to select. 
19675 case "$selecttype" in
19676 '') case "$d_select" in
19677         $define)
19678                 echo " "
19679                 $cat <<EOM
19680 Checking to see what type of arguments are accepted by select().
19681 EOM
19682                 hdrs="$define sys/types.h
19683                         $i_systime sys/time.h 
19684                         $i_sysselct sys/select.h
19685                         $d_socket sys/socket.h"
19686                 : The first arg can be int, unsigned, or size_t
19687                 : The last arg may or may not be 'const'
19688                 val=''
19689                 : void pointer has been seen but using that
19690                 : breaks the selectminbits test
19691                 for xxx in 'fd_set *' 'int *'; do
19692                         for nfd in 'int' 'size_t' 'unsigned long' 'unsigned' ; do
19693                                 for tmo in 'struct timeval *' 'const struct timeval *'; do
19694                                         case "$val" in
19695                                         '')     try="extern select _(($nfd, $xxx, $xxx, $xxx, $tmo));"
19696                                                 if ./protochk "$try" $hdrs; then
19697                                                         echo "Your system accepts $xxx."
19698                                                         val="$xxx"
19699                                                 fi
19700                                                 ;;
19701                                         esac
19702                                 done
19703                         done
19704                 done
19705                 case "$val" in
19706                 '')     rp='What is the type for the 2nd, 3rd, and 4th arguments to select?'
19707                         case "$d_fd_set" in
19708                                 $define) dflt="fd_set *" ;;
19709                                 *)              dflt="int *" ;;
19710                         esac
19711                         . ./myread
19712                         val=$ans
19713                         ;;
19714                 esac
19715                 selecttype="$val"
19716                 ;;
19717         *)      : no select, so pick a harmless default
19718                 selecttype='int *'
19719                 ;;
19720         esac
19721         ;;
19722 esac
19723
19724 : check for the select 'width'
19725 case "$selectminbits" in
19726 '') safebits=`expr $ptrsize \* 8`
19727     case "$d_select" in
19728         $define)
19729                 $cat <<EOM
19730
19731 Checking to see on how many bits at a time your select() operates...
19732 EOM
19733                 $cat >try.c <<EOCP
19734 #include <sys/types.h>
19735 #$i_time I_TIME
19736 #$i_systime I_SYS_TIME
19737 #$i_systimek I_SYS_TIME_KERNEL
19738 #ifdef I_TIME
19739 #   include <time.h>
19740 #endif
19741 #ifdef I_SYS_TIME
19742 #   ifdef I_SYS_TIME_KERNEL
19743 #       define KERNEL
19744 #   endif
19745 #   include <sys/time.h>
19746 #   ifdef I_SYS_TIME_KERNEL
19747 #       undef KERNEL
19748 #   endif
19749 #endif
19750 #$i_sysselct I_SYS_SELECT
19751 #ifdef I_SYS_SELECT
19752 #include <sys/select.h>
19753 #endif
19754 #$d_socket HAS_SOCKET
19755 #ifdef HAS_SOCKET
19756 #   include <sys/socket.h> /* Might include <sys/bsdtypes.h> */
19757 #endif
19758 #include <stdio.h>
19759 #$i_stdlib I_STDLIB
19760 #ifdef I_STDLIB
19761 #include <stdlib.h>
19762 #endif
19763 $selecttype b;
19764 #define S sizeof(*(b))
19765 #define MINBITS 64
19766 #define NBYTES (S * 8 > MINBITS ? S : MINBITS/8)
19767 #define NBITS  (NBYTES * 8)
19768 int main() {
19769     char *s = (char *)malloc(NBYTES);
19770     struct timeval t;
19771     int i;
19772     FILE* fp;
19773     int fd;
19774
19775     if (!s)
19776         exit(1);
19777     fclose(stdin);
19778     fp = fopen("try.c", "r");
19779     if (fp == 0)
19780       exit(2);
19781     fd = fileno(fp);
19782     if (fd < 0)
19783       exit(3);
19784     b = ($selecttype)s;
19785     for (i = 0; i < NBITS; i++)
19786         FD_SET(i, b);
19787     t.tv_sec  = 0;
19788     t.tv_usec = 0;
19789     select(fd + 1, b, 0, 0, &t);
19790     for (i = NBITS - 1; i > fd && FD_ISSET(i, b); i--);
19791     free(s);
19792     printf("%d\n", i + 1);
19793     return 0;
19794 }
19795 EOCP
19796                 set try
19797                 if eval $compile_ok; then
19798                         selectminbits=`$run ./try`
19799                         case "$selectminbits" in
19800                         '')     cat >&4 <<EOM
19801 Cannot figure out on how many bits at a time your select() operates.
19802 I'll play safe and guess it is $safebits bits.
19803 EOM
19804                                 selectminbits=$safebits
19805                                 bits="$safebits bits"
19806                                 ;;
19807                         1)      bits="1 bit" ;;
19808                         *)      bits="$selectminbits bits" ;;
19809                         esac
19810                         echo "Your select() operates on $bits at a time." >&4
19811                 else
19812                         rp='What is the minimum number of bits your select() operates on?'
19813                         case "$byteorder" in
19814                         12345678)       dflt=64 ;;
19815                         1234)           dflt=32 ;;
19816                         *)              dflt=1  ;;
19817                         esac
19818                         . ./myread
19819                         val=$ans
19820                         selectminbits="$val"
19821                 fi
19822                 $rm -f try.* try
19823                 ;;
19824         *)      : no select, so pick a harmless default
19825                 selectminbits=$safebits
19826                 ;;
19827         esac
19828         ;;
19829 esac
19830
19831 : Trace out the files included by signal.h, then look for SIGxxx names.
19832 : Remove SIGARRAYSIZE used by HPUX.
19833 : Remove SIGSTKSIZE used by Linux.
19834 : Remove SIGSTKSZ used by Posix.
19835 : Remove SIGTYP void lines used by OS2.
19836 : Some cpps, like os390, dont give the file name anywhere
19837 if [ "X$fieldn" = X ]; then
19838         : Just make some guesses.  We check them later.
19839         xxx='/usr/include/signal.h /usr/include/sys/signal.h'
19840 else
19841         xxx=`echo '#include <signal.h>' |
19842         $cppstdin $cppminus $cppflags 2>/dev/null |
19843         $grep '^[       ]*#.*include' | 
19844         $awk "{print \\$$fieldn}" | $sed 's!"!!g' | $sed 's!\\\\\\\\!/!g' | $sort | $uniq`
19845 fi
19846 : Check this list of files to be sure we have parsed the cpp output ok.
19847 : This will also avoid potentially non-existent files, such 
19848 : as ../foo/bar.h
19849 xxxfiles=''
19850 for xx in $xxx /dev/null ; do
19851         $test -f "$xx" && xxxfiles="$xxxfiles $xx"
19852 done
19853 : If we have found no files, at least try signal.h
19854 case "$xxxfiles" in
19855 '')     xxxfiles=`./findhdr signal.h` ;;
19856 esac
19857 xxx=`awk '
19858 $1 ~ /^#define$/ && $2 ~ /^SIG[A-Z0-9]*$/ && $2 !~ /SIGARRAYSIZE/ && $2 !~ /SIGSTKSIZE/ && $2 !~ /SIGSTKSZ/ && $3 !~ /void/ {
19859         print substr($2, 4, 20)
19860 }
19861 $1 == "#" && $2 ~ /^define$/ && $3 ~ /^SIG[A-Z0-9]*$/ && $3 !~ /SIGARRAYSIZE/ && $4 !~ /void/ {
19862         print substr($3, 4, 20)
19863 }' $xxxfiles`
19864 : Append some common names just in case the awk scan failed.
19865 xxx="$xxx ABRT ALRM BUS CANCEL CHLD CLD CONT DIL EMT FPE"
19866 xxx="$xxx FREEZE HUP ILL INT IO IOT KILL LOST LWP PHONE"
19867 xxx="$xxx PIPE POLL PROF PWR QUIT RTMAX RTMIN SEGV STKFLT STOP"
19868 xxx="$xxx SYS TERM THAW TRAP TSTP TTIN TTOU URG USR1 USR2"
19869 xxx="$xxx USR3 USR4 VTALRM WAITING WINCH WIND WINDOW XCPU XFSZ"
19870
19871 : generate a few handy files for later
19872 $cat > signal.c <<EOCP
19873 #include <sys/types.h>
19874 #include <signal.h>
19875 #$i_stdlib I_STDLIB
19876 #ifdef I_STDLIB
19877 #include <stdlib.h>
19878 #endif
19879 #include <stdio.h>
19880 int main() {
19881
19882 /* Strange style to avoid deeply-nested #if/#else/#endif */
19883 #ifndef NSIG
19884 #  ifdef _NSIG
19885 #    define NSIG (_NSIG)
19886 #  endif
19887 #endif
19888
19889 #ifndef NSIG
19890 #  ifdef SIGMAX
19891 #    define NSIG (SIGMAX+1)
19892 #  endif
19893 #endif
19894
19895 #ifndef NSIG
19896 #  ifdef SIG_MAX
19897 #    define NSIG (SIG_MAX+1)
19898 #  endif
19899 #endif
19900
19901 #ifndef NSIG
19902 #  ifdef _SIG_MAX
19903 #    define NSIG (_SIG_MAX+1)
19904 #  endif
19905 #endif
19906
19907 #ifndef NSIG
19908 #  ifdef MAXSIG
19909 #    define NSIG (MAXSIG+1)
19910 #  endif
19911 #endif
19912
19913 #ifndef NSIG
19914 #  ifdef MAX_SIG
19915 #    define NSIG (MAX_SIG+1)
19916 #  endif
19917 #endif
19918
19919 #ifndef NSIG
19920 #  ifdef SIGARRAYSIZE
19921 #    define NSIG SIGARRAYSIZE /* Assume ary[SIGARRAYSIZE] */
19922 #  endif
19923 #endif
19924
19925 #ifndef NSIG
19926 #  ifdef _sys_nsig
19927 #    define NSIG (_sys_nsig) /* Solaris 2.5 */
19928 #  endif
19929 #endif
19930
19931 /* Default to some arbitrary number that's big enough to get most
19932    of the common signals.
19933 */
19934 #ifndef NSIG
19935 #    define NSIG 50
19936 #endif
19937
19938 printf("NSIG %d\n", NSIG);
19939
19940 #ifndef JUST_NSIG
19941
19942 EOCP
19943
19944 echo $xxx | $tr ' ' $trnl | $sort | $uniq | $awk '
19945 {
19946         printf "#ifdef SIG"; printf $1; printf "\n"
19947         printf "printf(\""; printf $1; printf " %%d\\n\",SIG";
19948         printf $1; printf ");\n"
19949         printf "#endif\n"
19950 }
19951 END {
19952         printf "#endif /* JUST_NSIG */\n";
19953         printf "exit(0);\n}\n";
19954 }
19955 ' >>signal.c
19956 $cat >signal.awk <<'EOP'
19957 BEGIN { ndups = 0 }
19958 $1 ~ /^NSIG$/ { nsig = $2 }
19959 ($1 !~ /^NSIG$/) && (NF == 2) && ($2 ~ /^[0-9][0-9]*$/) {
19960     if ($2 > maxsig) { maxsig = $2 }
19961     if (sig_name[$2]) {
19962         dup_name[ndups] = $1
19963         dup_num[ndups] = $2
19964         ndups++ 
19965     }
19966     else {
19967         sig_name[$2] = $1
19968         sig_num[$2] = $2
19969     }
19970 }
19971 END { 
19972     if (nsig == 0) {
19973         nsig = maxsig + 1
19974     }
19975     printf("NSIG %d\n", nsig);
19976     for (n = 1; n < nsig; n++) {
19977         if (sig_name[n]) {
19978             printf("%s %d\n", sig_name[n], sig_num[n])
19979         }
19980         else {
19981             printf("NUM%d %d\n", n, n) 
19982         }
19983     }
19984     for (n = 0; n < ndups; n++) {
19985         printf("%s %d\n", dup_name[n], dup_num[n])
19986     }
19987 }
19988 EOP
19989 $cat >signal_cmd <<EOS
19990 $startsh
19991 if $test -s signal.lst; then
19992     echo "Using your existing signal.lst file"
19993         exit 0
19994 fi
19995 xxx="$xxx"
19996 EOS
19997 $cat >>signal_cmd <<'EOS'
19998
19999 set signal
20000 if eval $compile_ok; then
20001         $run ./signal$_exe | ($sort -n -k 2 2>/dev/null || $sort -n +1) | $uniq | $awk -f signal.awk >signal.lst
20002 else
20003         echo "(I can't seem be able to compile the whole test program)" >&4
20004         echo "(I'll try it in little pieces.)" >&4
20005         set signal -DJUST_NSIG
20006         if eval $compile_ok; then
20007                 $run ./signal$_exe > signal.nsg
20008                 $cat signal.nsg
20009         else
20010                 echo "I can't seem to figure out how many signals you have." >&4
20011                 echo "Guessing 50." >&4
20012                 echo 'NSIG 50' > signal.nsg
20013         fi
20014         : Now look at all the signal names, one at a time.
20015         for xx in `echo $xxx | $tr ' ' $trnl | $sort | $uniq`; do
20016                 $cat > signal.c <<EOCP
20017 #include <sys/types.h>
20018 #include <signal.h>
20019 #include <stdio.h>
20020 int main() {
20021 printf("$xx %d\n", SIG${xx});
20022 return 0;
20023 }
20024 EOCP
20025                 set signal
20026                 if eval $compile; then
20027                         echo "SIG${xx} found."
20028                         $run ./signal$_exe  >> signal.ls1
20029                 else
20030                         echo "SIG${xx} NOT found."
20031                 fi
20032         done
20033         if $test -s signal.ls1; then
20034                 $cat signal.nsg signal.ls1 |
20035                         $sort -n | $uniq | $awk -f signal.awk >signal.lst
20036         fi
20037
20038 fi
20039 if $test -s signal.lst; then
20040         :
20041 else
20042         echo "(AAK! I can't compile the test programs -- Guessing)" >&4
20043         echo 'kill -l' >signal
20044         set X `csh -f <signal`
20045         $rm -f signal
20046         shift
20047         case $# in
20048         0) set HUP INT QUIT ILL TRAP ABRT EMT FPE KILL BUS SEGV SYS PIPE ALRM TERM;;
20049         esac
20050         echo $@ | $tr ' ' $trnl | \
20051             $awk '{ printf "%s %d\n", $1, ++s; }
20052                   END { printf "NSIG %d\n", ++s }' >signal.lst
20053 fi
20054 $rm -f signal.c signal$_exe signal$_o signal.nsg signal.ls1
20055 EOS
20056 chmod a+x signal_cmd
20057 $eunicefix signal_cmd
20058
20059 : generate list of signal names
20060 echo " "
20061 case "$sig_name_init" in
20062 '') doinit=yes ;;
20063 *)  case "$sig_num_init" in
20064     ''|*,*) doinit=yes ;;
20065     esac ;;
20066 esac
20067 case "$doinit" in
20068 yes)
20069         echo "Generating a list of signal names and numbers..." >&4
20070         . ./signal_cmd
20071         sig_count=`$awk '/^NSIG/ { printf "%d", $2 }' signal.lst`
20072         sig_name=`$awk 'BEGIN { printf "ZERO " }
20073                         !/^NSIG/ { printf "%s ", $1 }' signal.lst`
20074         sig_num=`$awk  'BEGIN { printf "0 " }
20075                         !/^NSIG/ { printf "%d ", $2 }' signal.lst`
20076         sig_name_init=`$awk 'BEGIN      { printf "\"ZERO\", " }
20077                              !/^NSIG/   { printf "\"%s\", ", $1 }
20078                              END        { printf "0\n" }' signal.lst`
20079         sig_num_init=`$awk  'BEGIN      { printf "0, " }
20080                              !/^NSIG/   { printf "%d, ", $2}
20081                              END        { printf "0\n"}' signal.lst`
20082         ;;
20083 esac
20084 echo "The following $sig_count signals are available:"
20085 echo " "
20086 echo $sig_name | $awk \
20087 'BEGIN { linelen = 0 }
20088 {
20089         for (i = 1; i <= NF; i++) {
20090                 name = "SIG" $i " "
20091                 linelen = linelen + length(name)
20092                 if (linelen > 70) {
20093                         printf "\n"
20094                         linelen = length(name)
20095                 }
20096                 printf "%s", name
20097         }
20098         printf "\n"
20099 }'
20100 sig_size=`echo $sig_name | awk '{print NF}'`
20101 $rm -f signal signal.c signal.awk signal.lst signal_cmd 
20102
20103 echo " "
20104 case "$sizetype" in
20105 *_t) zzz="$sizetype"    ;;
20106 *)   zzz="filesize"     ;;
20107 esac
20108 echo "Checking the size of $zzz..." >&4 
20109 cat > try.c <<EOCP
20110 #include <sys/types.h>
20111 #include <stdio.h>
20112 #$i_stdlib I_STDLIB
20113 #ifdef I_STDLIB
20114 #include <stdlib.h>
20115 #endif
20116 int main() {
20117     printf("%d\n", (int)sizeof($sizetype));
20118     exit(0);
20119 }
20120 EOCP
20121 set try
20122 if eval $compile_ok; then
20123         yyy=`$run ./try`
20124         case "$yyy" in
20125         '')     sizesize=4
20126                 echo "(I can't execute the test program--guessing $sizesize.)" >&4
20127                 ;;
20128         *)      sizesize=$yyy
20129                 echo "Your $zzz size is $sizesize bytes."
20130                 ;;
20131         esac
20132 else
20133         sizesize=4
20134         echo "(I can't compile the test program--guessing $sizesize.)" >&4
20135 fi
20136
20137
20138 : check for socklen_t
20139 echo " "
20140 echo "Checking to see if you have socklen_t..." >&4
20141 $cat >try.c <<EOCP
20142 #include <sys/types.h>
20143 #$d_socket HAS_SOCKET
20144 #ifdef HAS_SOCKET
20145 #include <sys/socket.h>
20146 #endif
20147 int main() { socklen_t x = 16; }
20148 EOCP
20149 set try
20150 if eval $compile; then
20151         val="$define"
20152         echo "You have socklen_t."
20153 else
20154         val="$undef"
20155         echo "You do not have socklen_t."
20156         case "$sizetype" in
20157         size_t) echo "(You do have size_t, that might work. Some people are happy with just an int.)" ;;
20158         esac
20159 fi
20160 $rm -f try try.*
20161 set d_socklen_t
20162 eval $setvar
20163
20164 : see if this is a socks.h system
20165 set socks.h i_socks
20166 eval $inhdr
20167
20168 : check for type of the size argument to socket calls
20169 case "$d_socket" in
20170 "$define")
20171         $cat <<EOM
20172
20173 Checking to see what type is the last argument of accept().
20174 EOM
20175         yyy=''
20176         case "$d_socklen_t" in
20177         "$define") yyy="$yyy socklen_t"
20178         esac
20179         yyy="$yyy $sizetype int long unsigned"
20180         for xxx in $yyy; do
20181                 case "$socksizetype" in
20182                 '')     try="extern int accept(int, struct sockaddr *, $xxx *);"
20183                         case "$usesocks" in
20184                         "$define")
20185                                 if ./protochk "$try" $i_systypes sys/types.h $d_socket sys/socket.h literal '#define INCLUDE_PROTOTYPES' $i_socks socks.h.; then
20186                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20187                                         socksizetype="$xxx"
20188                                 fi
20189                                 ;;
20190                         *)      if ./protochk "$try"  $i_systypes sys/types.h $d_socket sys/socket.h; then
20191                                         echo "Your system accepts '$xxx *' for the last argument of accept()."
20192                                         socksizetype="$xxx"
20193                                 fi
20194                                 ;;
20195                         esac
20196                         ;;
20197                 esac
20198         done
20199 : In case none of those worked, prompt the user.
20200         case "$socksizetype" in
20201         '')     rp='What is the type for socket address structure sizes?'
20202                 dflt='int'
20203                 . ./myread
20204                 socksizetype=$ans
20205                 ;;
20206         esac
20207         ;;
20208 *)      : no sockets, so pick relatively harmless default
20209         socksizetype='int'
20210         ;;
20211 esac
20212
20213 : see what type is used for signed size_t
20214 set ssize_t ssizetype int stdio.h sys/types.h
20215 eval $typedef
20216 dflt="$ssizetype"
20217 $cat > try.c <<EOM
20218 #include <stdio.h>
20219 #$i_stdlib I_STDLIB
20220 #ifdef I_STDLIB
20221 #include <stdlib.h>
20222 #endif
20223 #include <sys/types.h>
20224 #define Size_t $sizetype
20225 #define SSize_t $dflt
20226 int main()
20227 {
20228         if (sizeof(Size_t) == sizeof(SSize_t))
20229                 printf("$dflt\n");
20230         else if (sizeof(Size_t) == sizeof(int))
20231                 printf("int\n");
20232         else 
20233                 printf("long\n");
20234         exit(0);
20235 }
20236 EOM
20237 echo " "
20238 set try
20239 if eval $compile_ok && $run ./try > /dev/null; then
20240         ssizetype=`$run ./try`
20241         echo "I'll be using $ssizetype for functions returning a byte count." >&4
20242 else
20243         $cat >&4 <<EOM
20244 Help! I can't compile and run the ssize_t test program: please enlighten me!
20245 (This is probably a misconfiguration in your system or libraries, and
20246 you really ought to fix it.  Still, I'll try anyway.)
20247
20248 I need a type that is the same size as $sizetype, but is guaranteed to
20249 be signed.  Common values are ssize_t, int and long.
20250
20251 EOM
20252         rp="What signed type is the same size as $sizetype?"
20253         . ./myread
20254         ssizetype="$ans"
20255 fi
20256 $rm -f try try.*
20257
20258 : see what type of char stdio uses.
20259 echo " "
20260 echo '#include <stdio.h>' > stdio.c
20261 $cppstdin $cppminus < stdio.c > stdioh
20262 if $contains 'unsigned.*char.*_ptr;' stdioh >/dev/null 2>&1 ; then
20263         echo "Your stdio uses unsigned chars." >&4
20264         stdchar="unsigned char"
20265 else
20266         echo "Your stdio uses signed chars." >&4
20267         stdchar="char"
20268 fi
20269 $rm -f stdio.* stdioh
20270
20271 : see what type uids are declared as in the kernel
20272 echo " "
20273 echo "Looking for the type for user ids returned by getuid()."
20274 set uid_t uidtype xxx stdio.h sys/types.h
20275 eval $typedef
20276 case "$uidtype" in
20277 xxx)
20278         xxx=`./findhdr sys/user.h`
20279         set `grep '_ruid;' "$xxx" 2>/dev/null` unsigned short
20280         case $1 in
20281         unsigned) dflt="$1 $2" ;;
20282         *) dflt="$1" ;;
20283         esac
20284         ;;
20285 *) dflt="$uidtype";;
20286 esac
20287 case "$uidtype" in
20288 uid_t)  echo "uid_t found." ;;
20289 *)      rp="What is the type for user ids returned by getuid()?"
20290         . ./myread
20291         uidtype="$ans"
20292         ;;
20293 esac
20294
20295 echo " "
20296 case "$uidtype" in
20297 *_t) zzz="$uidtype"     ;;
20298 *)   zzz="uid"          ;;
20299 esac
20300 echo "Checking the size of $zzz..." >&4 
20301 cat > try.c <<EOCP
20302 #include <sys/types.h>
20303 #include <stdio.h>
20304 #$i_stdlib I_STDLIB
20305 #ifdef I_STDLIB
20306 #include <stdlib.h>
20307 #endif
20308 int main() {
20309     printf("%d\n", (int)sizeof($uidtype));
20310     exit(0);
20311 }
20312 EOCP
20313 set try
20314 if eval $compile_ok; then
20315         yyy=`$run ./try`
20316         case "$yyy" in
20317         '')     uidsize=4
20318                 echo "(I can't execute the test program--guessing $uidsize.)" >&4
20319                 ;;
20320         *)      uidsize=$yyy
20321                 echo "Your $zzz is $uidsize bytes long."
20322                 ;;
20323         esac
20324 else
20325         uidsize=4
20326         echo "(I can't compile the test program--guessing $uidsize.)" >&4
20327 fi
20328
20329 echo " "
20330 case "$uidtype" in
20331 *_t) zzz="$uidtype"     ;;
20332 *)   zzz="uid"          ;;
20333 esac
20334 echo "Checking the sign of $zzz..." >&4
20335 cat > try.c <<EOCP
20336 #include <sys/types.h>
20337 #include <stdio.h>
20338 int main() {
20339         $uidtype foo = -1;
20340         if (foo < 0)
20341                 printf("-1\n");
20342         else
20343                 printf("1\n");
20344 }
20345 EOCP
20346 set try
20347 if eval $compile; then
20348         yyy=`$run ./try`
20349         case "$yyy" in
20350         '')     uidsign=1
20351                 echo "(I can't execute the test program--guessing unsigned.)" >&4
20352                 ;;
20353         *)      uidsign=$yyy
20354                 case "$uidsign" in
20355                  1) echo "Your $zzz is unsigned." ;;
20356                 -1) echo "Your $zzz is signed."   ;;
20357                 esac
20358                 ;;
20359         esac
20360 else
20361         uidsign=1
20362         echo "(I can't compile the test program--guessing unsigned.)" >&4
20363 fi
20364
20365
20366
20367 echo " "
20368 $echo "Checking the format string to be used for uids..." >&4
20369
20370 case "$uidsign" in
20371 -1)     if $test X"$uidsize" = X"$ivsize"; then
20372                 uidformat="$ivdformat"
20373         else
20374                 if $test X"$uidsize" = X"$longsize"; then
20375                         uidformat='"ld"'
20376                 else
20377                         if $test X"$uidsize" = X"$intsize"; then
20378                                 uidformat='"d"'
20379                         else
20380                                 if $test X"$uidsize" = X"$shortsize"; then
20381                                         uidformat='"hd"'
20382                                 fi
20383                         fi
20384                 fi
20385         fi
20386         ;;
20387 *)      if $test X"$uidsize" = X"$uvsize"; then
20388                 uidformat="$uvuformat"
20389         else
20390                 if $test X"$uidsize" = X"$longsize"; then
20391                         uidformat='"lu"'
20392                 else
20393                         if $test X"$uidsize" = X"$intsize"; then
20394                                 uidformat='"u"'
20395                         else
20396                                 if $test X"$uidsize" = X"$shortsize"; then
20397                                         uidformat='"hu"'
20398                                 fi
20399                         fi
20400                 fi
20401         fi
20402         ;;
20403 esac
20404
20405
20406 case "$usesitecustomize" in
20407     $define|true|[Yy]*)
20408         usesitecustomize="$define"
20409         ;;
20410     *)
20411         usesitecustomize="$undef"
20412         ;;
20413     esac
20414
20415 : determine compiler compiler
20416 case "$yacc" in
20417 '')
20418         dflt=yacc;;
20419 *)
20420         dflt="$yacc";;
20421 esac
20422 echo " "
20423 comp='yacc'
20424 if $test -f "$byacc$_exe"; then
20425         dflt="$byacc"
20426         comp="byacc or $comp"
20427 fi
20428 if $test -f "$bison$_exe"; then
20429         comp="$comp or bison -y"
20430 fi
20431 rp="Which compiler compiler ($comp) shall I use?"
20432 . ./myread
20433 yacc="$ans"
20434 case "$yacc" in
20435 *bis*)
20436         case "$yacc" in
20437         *-y*) ;;
20438         *)
20439                 yacc="$yacc -y"
20440                 echo "(Adding -y option to bison to get yacc-compatible behaviour.)"
20441                 ;;
20442         esac
20443         ;;
20444 esac
20445
20446 : see if this is a fp.h system
20447 set fp.h i_fp
20448 eval $inhdr
20449
20450 : see if this is a fp_class.h system
20451 set fp_class.h i_fp_class
20452 eval $inhdr
20453
20454 : see if gdbm.h is available
20455 set gdbm.h t_gdbm
20456 eval $inhdr
20457 case "$t_gdbm" in
20458 $define)
20459         : see if gdbm_open exists
20460         set gdbm_open d_gdbm_open
20461         eval $inlibc
20462         case "$d_gdbm_open" in
20463         $undef)
20464                 t_gdbm="$undef"
20465                 echo "We won't be including <gdbm.h>"
20466                 ;;
20467         esac
20468         ;;
20469 esac
20470 val="$t_gdbm"
20471 set i_gdbm
20472 eval $setvar
20473
20474 : see if this is a ieeefp.h system
20475 case "$i_ieeefp" in
20476 '' ) set ieeefp.h i_ieeefp
20477      eval $inhdr
20478      ;;
20479 esac
20480
20481 : see if this is a libutil.h system
20482 set libutil.h i_libutil
20483 eval $inhdr
20484
20485 : see if mach cthreads are available
20486 if test "X$usethreads" = "X$define"; then
20487         set mach/cthreads.h i_machcthr
20488         eval $inhdr
20489 else
20490         i_machcthr="$undef"
20491 fi
20492
20493
20494
20495 : see if this is a mntent.h system
20496 set mntent.h i_mntent
20497 eval $inhdr
20498
20499 : see if ndbm.h is available
20500 set ndbm.h t_ndbm
20501 eval $inhdr
20502
20503 case "$t_ndbm" in
20504 $undef)
20505     # Some Linux distributions such as RedHat 7.1 put the
20506     # ndbm.h header in /usr/include/gdbm/ndbm.h.
20507     if $test -f /usr/include/gdbm/ndbm.h; then
20508         echo '<gdbm/ndbm.h> found.'
20509         ccflags="$ccflags -I/usr/include/gdbm"
20510         cppflags="$cppflags -I/usr/include/gdbm"
20511         t_ndbm=$define
20512     fi
20513     ;;
20514 esac
20515
20516 case "$t_ndbm" in
20517 $define)
20518         : see if dbm_open exists
20519         set dbm_open d_dbm_open
20520         eval $inlibc
20521         case "$d_dbm_open" in
20522         $undef)
20523                 t_ndbm="$undef"
20524                 echo "We won't be including <ndbm.h>"
20525                 ;;
20526         esac
20527         ;;
20528 esac
20529 val="$t_ndbm"
20530 set i_ndbm
20531 eval $setvar
20532
20533 : see if net/errno.h is available
20534 val=''
20535 set net/errno.h val
20536 eval $inhdr
20537
20538 : Unfortunately, it causes problems on some systems.  Arrgh.
20539 case "$val" in
20540 $define)
20541         cat > try.c <<'EOM'
20542 #include <stdio.h>
20543 #include <errno.h>
20544 #include <net/errno.h>
20545 int func()
20546 {
20547         return ENOTSOCK;
20548 }
20549 EOM
20550         if $cc $ccflags -c try.c >/dev/null 2>&1; then
20551                 echo "We'll be including <net/errno.h>." >&4
20552         else
20553                 echo "We won't be including <net/errno.h>." >&4
20554                 val="$undef"
20555         fi
20556         $rm -f try.* try
20557         ;;
20558 esac
20559 set i_neterrno
20560 eval $setvar
20561
20562 : see if netinet/tcp.h is available
20563 set netinet/tcp.h i_netinettcp
20564 eval $inhdr
20565
20566 : see if this is a poll.h system
20567 set poll.h i_poll
20568 eval $inhdr
20569
20570 : see if this is a prot.h system
20571 set prot.h i_prot
20572 eval $inhdr
20573
20574 echo " "
20575 $echo "Guessing which symbols your C compiler and preprocessor define..." >&4
20576 $cat <<'EOSH' > Cppsym.know
20577 a29k ABI64 aegis AES_SOURCE AIX AIX32 AIX370
20578 AIX41 AIX42 AIX43 AIX_SOURCE aixpc ALL_SOURCE
20579 alliant alpha am29000 AM29000 AMD64 amd64 amiga AMIGAOS AMIX
20580 ansi ANSI_C_SOURCE apollo ardent ARM32 atarist att386 att3b
20581 BeOS BIG_ENDIAN BIT_MSF bsd BSD bsd43 bsd4_2 bsd4_3 BSD4_3 bsd4_4
20582 BSD_4_3 BSD_4_4 BSD_NET2 BSD_TIME BSD_TYPES BSDCOMPAT bsdi
20583 bull c cadmus clipper CMU COFF COMPILER_VERSION
20584 concurrent convex cpu cray CRAY CRAYMPP ctix CX_UX
20585 CYGWIN DECC DGUX DGUX_SOURCE DJGPP dmert DOLPHIN DPX2 DSO
20586 Dynix DynixPTX ELF encore EPI EXTENSIONS FAVOR_BSD
20587 FILE_OFFSET_BITS FreeBSD GCC_NEW_VARARGS gcos gcx gimpel
20588 GLIBC GLIBC_MINOR
20589 GNU_SOURCE GNUC GNUC_MINOR GNU_LIBRARY GO32 gould GOULD_PN
20590 H3050R H3050RX hbullx20 hcx host_mips
20591 hp200 hp300 hp700 HP700 hp800 hp9000
20592 hp9000s200 hp9000s300 hp9000s400 hp9000s500
20593 hp9000s700 hp9000s800 hp9k8 hp_osf hppa hpux HPUX_SOURCE
20594 i186 i286 i386 i486 i586 i686 i8086 i80960 i860 I960
20595 IA64 iAPX286 ibm ibm032 ibmesa IBMR2 ibmrt ILP32 ILP64
20596 INLINE_INTRINSICS INTRINSICS INT64 interdata is68k ksr1
20597 LANGUAGE_C LARGE_FILE_API LARGEFILE64_SOURCE
20598 LARGEFILE_SOURCE LFS64_LARGEFILE LFS_LARGEFILE
20599 Linux LITTLE_ENDIAN LONG64 LONG_DOUBLE LONG_LONG
20600 LONGDOUBLE LONGLONG LP64 luna luna88k Lynx
20601 M68000 m68k m88100 m88k M88KBCS_TARGET M_COFF
20602 M_I186 M_I286 M_I386 M_I8086 M_I86 M_I86SM M_SYS3
20603 M_SYS5 M_SYSIII M_SYSV M_UNIX M_XENIX MACH machine MachTen
20604 MATH_HAS_NO_SIDE_EFFECTS
20605 mc300 mc500 mc68000 mc68010 mc68020 mc68030 mc68040
20606 mc68060 mc68k mc68k32 mc700 mc88000 mc88100 merlin
20607 mert MiNT mips MIPS_FPSET MIPS_ISA MIPS_SIM MIPS_SZINT
20608 MIPS_SZLONG MIPS_SZPTR MIPSEB MIPSEL MODERN_C motorola
20609 mpeix MSDOS MTXINU MULTIMAX mvs MVS n16 ncl_el ncl_mr
20610 NetBSD news1500 news1700 news1800 news1900 news3700
20611 news700 news800 news900 NeXT NLS nonstopux ns16000 ns32000
20612 ns32016 ns32332 ns32k nsc32000
20613 OCS88 OEMVS OpenBSD os OS2 OS390 osf OSF1 OSF_SOURCE
20614 pa_risc PA_RISC1_1 PA_RISC2_0 PARAGON parisc
20615 pc532 pdp11 PGC PIC plexus PORTAR posix
20616 POSIX1B_SOURCE POSIX2_SOURCE POSIX4_SOURCE
20617 POSIX_C_SOURCE POSIX_SOURCE POWER
20618 PROTOTYPES PWB pyr QNX R3000 REENTRANT RES Rhapsody RISC6000
20619 riscix riscos RT S390 SA110 scs SCO sequent sgi SGI_SOURCE SH3 sinix
20620 SIZE_INT SIZE_LONG SIZE_PTR SOCKET_SOURCE SOCKETS_SOURCE
20621 sony sony_news sonyrisc sparc sparclite spectrum
20622 stardent stdc STDC_EXT stratos sun sun3 sun386
20623 Sun386i svr3 svr4 SVR4_2 SVR4_SOURCE svr5
20624 SX system SYSTYPE_BSD SYSTYPE_BSD43 SYSTYPE_BSD44
20625 SYSTYPE_SVR4 SYSTYPE_SVR5 SYSTYPE_SYSV SYSV SYSV3 SYSV4 SYSV5
20626 sysV68 sysV88 Tek4132 Tek4300 titan
20627 TM3200 TM5400 TM5600
20628 tower tower32 tower32_200 tower32_600 tower32_700
20629 tower32_800 tower32_850 tss
20630 u370 u3b u3b2 u3b20 u3b200 u3b20d u3b5
20631 ultrix UMAXV UnicomPBB UnicomPBD UNICOS UNICOSMK
20632 unix UNIX95 UNIX99 unixpc unos
20633 USE_BSD USE_FILE_OFFSET64 USE_GNU USE_ISOC9X USE_LARGEFILE USE_LARGEFILE64
20634 USE_MISC USE_POSIX USE_POSIX199309 USE_POSIX199506 USE_POSIX2
20635 USE_REENTRANT USE_SVID USE_UNIX98 USE_XOPEN USE_XOPEN_EXTENDED
20636 USGr4 USGr4_2
20637 Utek UTek UTS UWIN uxpm uxps vax venix VMESA vms x86_64 xenix Xenix286
20638 XOPEN_SOURCE XOPEN_SOURCE_EXTENDED XPG2 XPG2_EXTENDED
20639 XPG3 XPG3_EXTENDED XPG4 XPG4_EXTENDED
20640 z8000
20641 EOSH
20642 # Maybe put other stuff here too.
20643 cat <<EOSH >>Cppsym.know
20644 $osname
20645 EOSH
20646 ./tr '[a-z]' '[A-Z]' < Cppsym.know > Cppsym.a
20647 ./tr '[A-Z]' '[a-z]' < Cppsym.know > Cppsym.b
20648 $cat Cppsym.know > Cppsym.c
20649 $cat Cppsym.a Cppsym.b Cppsym.c | $tr ' ' $trnl | $sort | $uniq > Cppsym.know
20650 $rm -f Cppsym.a Cppsym.b Cppsym.c
20651 cat <<EOSH > Cppsym
20652 $startsh
20653 if $test \$# -gt 0; then
20654     echo \$* | $tr " " "$trnl" | ./Cppsym.try > Cppsym.got
20655     if $test -s Cppsym.got; then
20656         $rm -f Cppsym.got
20657         exit 0
20658     fi
20659     $rm -f Cppsym.got
20660     exit 1
20661 else
20662     $tr " " "$trnl" | ./Cppsym.try
20663     exit 0
20664 fi
20665 EOSH
20666 chmod +x Cppsym
20667 $eunicefix Cppsym
20668 cat <<EOSH > Cppsym.try
20669 $startsh
20670 cat <<'EOCP' > try.c
20671 #include <stdio.h>
20672 #if cpp_stuff == 1
20673 #define STRINGIFY(a)    "a"
20674 #endif
20675 #if cpp_stuff == 42
20676 #define StGiFy(a)  #a
20677 #define STRINGIFY(a)    StGiFy(a)
20678 #endif
20679 #if $cpp_stuff != 1 && $cpp_stuff != 42
20680 #   include "Bletch: How does this C preprocessor stringify macros?"
20681 #endif
20682 int main() {
20683 EOCP
20684 $awk \\
20685 EOSH
20686 cat <<'EOSH' >> Cppsym.try
20687 'length($1) > 0 {
20688     printf "#ifdef %s\nprintf(\"%s=%%s\\n\", STRINGIFY(%s));\n#endif\n", $1, $1, $1
20689     printf "#ifdef _%s\nprintf(\"_%s=%%s\\n\", STRINGIFY(_%s));\n#endif\n", $1, $1, $1
20690     printf "#ifdef __%s\nprintf(\"__%s=%%s\\n\", STRINGIFY(__%s));\n#endif\n", $1, $1, $1
20691     printf "#ifdef __%s__\nprintf(\"__%s__=%%s\\n\", STRINGIFY(__%s__));\n#endif\n", $1, $1, $1
20692 }'       >> try.c
20693 echo 'return 0;}' >> try.c
20694 EOSH
20695 cat <<EOSH >> Cppsym.try
20696 ccflags="$ccflags"
20697 case "$osname-$gccversion" in
20698 irix-) ccflags="\$ccflags -woff 1178" ;;
20699 os2-*) ccflags="\$ccflags -Zlinker /PM:VIO" ;;
20700 esac
20701 $cc -o try -Dcpp_stuff=$cpp_stuff $optimize \$ccflags $ldflags try.c $libs && $run ./try | $sed 's/ /\\\\ /g'
20702 EOSH
20703 chmod +x Cppsym.try
20704 $eunicefix Cppsym.try
20705 ./Cppsym < Cppsym.know > Cppsym.true
20706 : Add in any linux cpp "predefined macros":
20707 case "$osname::$gccversion" in
20708   *linux*::*.*)
20709     tHdrH=_tmpHdr
20710     rm -f $tHdrH'.h' $tHdrH
20711     touch $tHdrH'.h'
20712     if cpp -dM $tHdrH'.h' > $tHdrH'_cppsym.h' && [ -s $tHdrH'_cppsym.h' ]; then
20713        sed 's/#define[\ \  ]*//;s/[\ \     ].*$//' <$tHdrH'_cppsym.h' >$tHdrH'_cppsym.real'
20714        if [ -s $tHdrH'_cppsym.real' ]; then
20715           cat $tHdrH'_cppsym.real' Cppsym.know | sort | uniq | ./Cppsym | sort | uniq > Cppsym.true
20716        fi
20717     fi
20718     rm -f $tHdrH'.h' $tHdrH'_cppsym.h' $tHdrH'_cppsym.real'
20719   ;;
20720 esac
20721 : now check the C compiler for additional symbols
20722 postprocess_cc_v=''
20723 case "$osname" in
20724 aix) postprocess_cc_v="|$tr , ' '" ;;
20725 esac
20726 $cat >ccsym <<EOS
20727 $startsh
20728 $cat >tmp.c <<EOF
20729 extern int foo;
20730 EOF
20731 for i in \`$cc -v -c tmp.c 2>&1 $postprocess_cc_v\`
20732 do
20733         case "\$i" in
20734         -D*) echo "\$i" | $sed 's/^-D//';;
20735         -A*) $test "$gccversion" && echo "\$i" | $sed 's/^-A//' | $sed 's/\(.*\)(\(.*\))/\1=\2/';;
20736         esac
20737 done
20738 $rm -f try.c
20739 EOS
20740 postprocess_cc_v=''
20741 chmod +x ccsym
20742 $eunicefix ccsym
20743 ./ccsym > ccsym1.raw
20744 if $test -s ccsym1.raw; then
20745        $sort ccsym1.raw | $uniq >ccsym.raw
20746 else
20747        mv ccsym1.raw ccsym.raw
20748 fi
20749
20750 $awk '/\=/ { print $0; next }
20751         { print $0"=1" }' ccsym.raw >ccsym.list
20752 $comm -13 Cppsym.true ccsym.list >ccsym.own
20753 $comm -12 Cppsym.true ccsym.list >ccsym.com
20754 $comm -23 Cppsym.true ccsym.list >ccsym.cpp
20755 also=''
20756 if $test -z ccsym.raw; then
20757         echo "Your C compiler doesn't seem to define any symbols!" >&4
20758         echo " "
20759         echo "However, your C preprocessor defines the following symbols:"
20760         $cat Cppsym.true
20761         ccsymbols=''
20762         cppsymbols=`$cat Cppsym.true`
20763         cppsymbols=`echo $cppsymbols`
20764         cppccsymbols="$cppsymbols"
20765 else
20766         if $test -s ccsym.com; then
20767                 echo "Your C compiler and pre-processor define these symbols:"
20768                 $sed -e 's/\(..*\)=.*/\1/' ccsym.com
20769                 also='also '
20770                 symbols='ones'
20771                 cppccsymbols=`$cat ccsym.com`
20772                 cppccsymbols=`echo $cppccsymbols`
20773                 $test "$silent" || sleep 1
20774         fi
20775         if $test -s ccsym.cpp; then
20776                 $test "$also" && echo " "
20777                 echo "Your C pre-processor ${also}defines the following symbols:"
20778                 $sed -e 's/\(..*\)=.*/\1/' ccsym.cpp
20779                 also='further '
20780                 cppsymbols=`$cat ccsym.cpp`
20781                 cppsymbols=`echo $cppsymbols`
20782                 $test "$silent" || sleep 1
20783         fi
20784         if $test -s ccsym.own; then
20785                 $test "$also" && echo " "
20786                 echo "Your C compiler ${also}defines the following cpp symbols:"
20787                 $sed -e 's/\(..*\)=1/\1/' ccsym.own
20788                 $sed -e 's/\(..*\)=.*/\1/' ccsym.own | $uniq >>Cppsym.true
20789                 ccsymbols=`$cat ccsym.own`
20790                 ccsymbols=`echo $ccsymbols`
20791                 $test "$silent" || sleep 1
20792         fi
20793 fi
20794
20795 : see if this is a termio system
20796 val="$undef"
20797 val2="$undef"
20798 val3="$undef"
20799 if $test `./findhdr termios.h`; then
20800         set tcsetattr i_termios
20801         eval $inlibc
20802         val3="$i_termios"
20803 fi
20804 echo " "
20805 case "$val3" in
20806 "$define") echo "You have POSIX termios.h... good!" >&4;;
20807 *) if ./Cppsym pyr; then
20808                 case "`/bin/universe`" in
20809                 ucb) if $test `./findhdr sgtty.h`; then
20810                                 val2="$define"
20811                                 echo "<sgtty.h> found." >&4
20812                         else
20813                                 echo "System is pyramid with BSD universe."
20814                                 echo "<sgtty.h> not found--you could have problems." >&4
20815                         fi;;
20816                 *) if $test `./findhdr termio.h`; then
20817                                 val="$define"
20818                                 echo "<termio.h> found." >&4
20819                         else
20820                                 echo "System is pyramid with USG universe."
20821                                 echo "<termio.h> not found--you could have problems." >&4
20822                         fi;;
20823                 esac
20824         elif ./usg; then
20825                 if $test `./findhdr termio.h`; then
20826                         echo "<termio.h> found." >&4
20827                         val="$define"
20828                 elif $test `./findhdr sgtty.h`; then
20829                         echo "<sgtty.h> found." >&4
20830                         val2="$define"
20831                 else
20832 echo "Neither <termio.h> nor <sgtty.h> found--you could have problems." >&4
20833                 fi
20834         else
20835                 if $test `./findhdr sgtty.h`; then
20836                         echo "<sgtty.h> found." >&4
20837                         val2="$define"
20838                 elif $test `./findhdr termio.h`; then
20839                         echo "<termio.h> found." >&4
20840                         val="$define"
20841                 else
20842 echo "Neither <sgtty.h> nor <termio.h> found--you could have problems." >&4
20843                 fi
20844         fi;;
20845 esac
20846 set i_termio; eval $setvar
20847 val=$val2; set i_sgtty; eval $setvar
20848 val=$val3; set i_termios; eval $setvar
20849
20850 : see if stddef is available
20851 set stddef.h i_stddef
20852 eval $inhdr
20853
20854 : see if this is a sunmath.h system
20855 set sunmath.h i_sunmath
20856 eval $inhdr
20857
20858 : see if sys/access.h is available
20859 set sys/access.h i_sysaccess
20860 eval $inhdr
20861
20862 : see if ioctl defs are in sgtty, termio, sys/filio or sys/ioctl
20863 set sys/filio.h i_sysfilio
20864 eval $inhdr
20865 echo " "
20866 if $test `./findhdr sys/ioctl.h`; then
20867         val="$define"
20868         echo '<sys/ioctl.h> found.' >&4
20869 else
20870         val="$undef"
20871         if $test $i_sysfilio = "$define"; then
20872             echo '<sys/ioctl.h> NOT found.' >&4
20873         else
20874                 $test $i_sgtty = "$define" && xxx="sgtty.h"
20875                 $test $i_termio = "$define" && xxx="termio.h"
20876                 $test $i_termios = "$define" && xxx="termios.h"
20877 echo "No <sys/ioctl.h> found, assuming ioctl args are defined in <$xxx>." >&4
20878         fi
20879 fi
20880 set i_sysioctl
20881 eval $setvar
20882
20883 : see if socket ioctl defs are in sys/sockio.h
20884 echo " "
20885 xxx=`./findhdr sys/sockio.h`
20886 if $test "$xxx"; then
20887         if $contains SIOCATMARK $xxx >/dev/null 2>&1; then
20888                 val="$define"
20889                 echo "You have socket ioctls defined in <sys/sockio.h>." >&4
20890         else
20891                 val="$undef"
20892                 echo "No socket ioctls found in <sys/sockio.h>." >&4
20893         fi
20894 else
20895         val="$undef"
20896         $cat <<EOM
20897 <sys/sockio.h> not found, assuming socket ioctls are in <sys/ioctl.h>.
20898 EOM
20899 fi
20900 set i_syssockio
20901 eval $setvar
20902
20903
20904 : see if this is a syslog.h system
20905 set syslog.h i_syslog
20906 eval $inhdr
20907
20908
20909 : see if this is a sys/mode.h system
20910 set sys/mode.h i_sysmode
20911 eval $inhdr
20912
20913 : see if sys/resource.h has to be included
20914 set sys/resource.h i_sysresrc
20915 eval $inhdr
20916
20917 : see if sys/security.h is available
20918 set sys/security.h i_syssecrt
20919 eval $inhdr
20920
20921 : see if this is a sys/statvfs.h system
20922 set sys/statvfs.h i_sysstatvfs
20923 eval $inhdr
20924
20925 : see if this is a sys/un.h system
20926 set sys/un.h i_sysun
20927 eval $inhdr
20928
20929
20930 : see if this is a sys/utsname.h system
20931 set sys/utsname.h i_sysutsname
20932 eval $inhdr
20933
20934 : see if this is a syswait system
20935 set sys/wait.h i_syswait
20936 eval $inhdr
20937
20938 : see if this is a ustat.h system
20939 set ustat.h i_ustat
20940 eval $inhdr
20941
20942 : see if this is an utime system
20943 set utime.h i_utime
20944 eval $inhdr
20945
20946 : see if this is a values.h system
20947 set values.h i_values
20948 eval $inhdr
20949
20950 : see if this is a vfork system
20951 case "$d_vfork" in
20952 "$define")
20953         set vfork.h i_vfork
20954         eval $inhdr
20955         ;;
20956 *)
20957         i_vfork="$undef"
20958         ;;
20959 esac
20960
20961 echo " "
20962 echo "Looking for extensions..." >&4
20963 : If we are using the old config.sh, known_extensions may contain
20964 : old or inaccurate or duplicate values.
20965 known_extensions=''
20966 nonxs_extensions=''
20967 : We do not use find because it might not be available.
20968 : We do not just use MANIFEST because the user may have dropped
20969 : some additional extensions into the source tree and expect them
20970 : to be built.
20971
20972 : Function to recursively find available extensions, ignoring DynaLoader
20973 : NOTE: recursion limit of 10 to prevent runaway in case of symlink madness
20974 find_extensions='
20975     for xxx in *; do
20976         case "$xxx" in
20977             DynaLoader|dynaload) ;;
20978             *)
20979             if $test -f $xxx/$xxx.xs; then
20980                 known_extensions="$known_extensions $1$xxx";
20981             elif $test -f $xxx/Makefile.PL; then
20982                 nonxs_extensions="$nonxs_extensions $1$xxx";
20983             else
20984                 if $test -d $xxx -a $# -lt 10; then
20985                     set $1$xxx/ $*;
20986                     cd "$xxx";
20987                     eval $find_extensions;
20988                     cd ..;
20989                     shift;
20990                 fi;
20991             fi
20992             ;;
20993         esac;
20994     done'
20995 tdir=`pwd`
20996 cd "$rsrc/ext"
20997 set X
20998 shift
20999 eval $find_extensions
21000 # Special case:  Add in threads/shared since it is not picked up by the
21001 # recursive find above (and adding in general recursive finding breaks
21002 # SDBM_File/sdbm).  A.D.  10/25/2001.
21003 # Ditto for IO/Compress/Base and IO/Compress/Zlib
21004 known_extensions="$known_extensions threads/shared"
21005 nonxs_extensions="$nonxs_extensions IO/Compress/Base IO/Compress/Zlib"
21006 set X $nonxs_extensions
21007 shift
21008 nonxs_extensions="$*"
21009 set X $known_extensions
21010 shift
21011 known_extensions="$*"
21012 cd "$tdir"
21013
21014 : Now see which are supported on this system.
21015 avail_ext=''
21016 for xxx in $known_extensions ; do
21017         case "$xxx" in
21018         DB_File|db_file)
21019                 case "$i_db" in
21020                 $define) avail_ext="$avail_ext $xxx" ;;
21021                 esac
21022                 ;;
21023         GDBM_File|gdbm_fil)
21024                 case "$i_gdbm" in
21025                 $define) avail_ext="$avail_ext $xxx" ;;
21026                 esac
21027                 ;;
21028         I18N/Langinfo|i18n_lan)
21029                 case "$i_langinfo$d_nl_langinfo" in
21030                 $define$define) avail_ext="$avail_ext $xxx" ;;
21031                 esac
21032                 ;;
21033         NDBM_File|ndbm_fil)
21034                 case "$i_ndbm" in
21035                 $define)
21036                     case "$osname-$use64bitint" in
21037                     hpux-define)
21038                         case "$libs" in
21039                         *-lndbm*) avail_ext="$avail_ext $xxx" ;;
21040                         esac
21041                         ;;
21042                     *) avail_ext="$avail_ext $xxx" ;;
21043                     esac
21044                     ;;
21045                 esac
21046                 ;;
21047         ODBM_File|odbm_fil)
21048                 case "${i_dbm}${i_rpcsvcdbm}" in
21049                 *"${define}"*)
21050                     case "$osname-$use64bitint" in
21051                     hpux-define)
21052                         case "$libs" in
21053                         *-ldbm*) avail_ext="$avail_ext $xxx" ;;
21054                         esac
21055                         ;;
21056                     *) avail_ext="$avail_ext $xxx" ;;
21057                     esac
21058                     ;;
21059                 esac
21060                 ;;
21061         POSIX|posix)
21062                 case "$useposix" in
21063                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21064                 esac
21065                 ;;
21066         Opcode|opcode)
21067                 case "$useopcode" in
21068                 true|define|y) avail_ext="$avail_ext $xxx" ;;
21069                 esac
21070                 ;;
21071         Socket|socket)
21072                 case "$d_socket" in
21073                 true|$define|y)
21074                     case "$osname" in
21075                     beos) ;; # not unless BONE
21076                     *) avail_ext="$avail_ext $xxx" ;;
21077                     esac
21078                     ;;
21079                 esac
21080                 ;;
21081         Sys/Syslog|sys/syslog)
21082                 : XXX syslog requires socket
21083                 case "$d_socket" in
21084                 true|$define|y) avail_ext="$avail_ext $xxx" ;;
21085                 esac
21086                 ;;
21087         Thread|thread)
21088                 case "$usethreads" in
21089                 true|$define|y)
21090                         case "$useithreads" in
21091                         $undef|false|[nN]*) avail_ext="$avail_ext $xxx" ;;
21092                         esac
21093                 esac
21094                 ;;
21095         Win32)
21096                 case "$osname" in
21097                 cygwin) avail_ext="$avail_ext $xxx" ;;
21098                 esac
21099                 ;;
21100         XS/APItest|xs/apitest)
21101                 # This is just for testing.  Skip it unless we have dynamic loading.
21102
21103                 case "$usedl" in
21104                 $define) avail_ext="$avail_ext $xxx" ;;
21105                 esac
21106                 ;;
21107         XS/Typemap|xs/typemap)
21108                 # This is just for testing.  Skip it unless we have dynamic loading.
21109                 case "$usedl" in
21110                 $define) avail_ext="$avail_ext $xxx" ;;
21111                 esac
21112                 ;;
21113         threads|threads/shared)
21114                 # threads and threads::shared are special cases.
21115                 # To stop people from asking "Perl 5.8.0 was supposed
21116                 # to have this new fancy threads implementation but my
21117                 # perl doesn't have it" and from people trying to
21118                 # (re)install the threads module using CPAN.pm and
21119                 # CPAN.pm then offering to reinstall Perl 5.8.0,
21120                 # the threads.pm and threads/shared.pm will always be
21121                 # there, croaking informatively ("you need to rebuild
21122                 # all of Perl with threads, sorry") when threads haven't
21123                 # been compiled in.
21124                 # --jhi
21125                 avail_ext="$avail_ext $xxx"
21126                 ;;
21127         IPC/SysV|ipc/sysv)
21128                 : XXX Do we need a useipcsysv variable here
21129                 case "${d_msg}${d_sem}${d_shm}" in
21130                 *"${define}"*) avail_ext="$avail_ext $xxx" ;;
21131                 esac
21132                 ;;
21133         *)      avail_ext="$avail_ext $xxx"
21134                 ;;
21135         esac
21136 done
21137
21138 set X $avail_ext
21139 shift
21140 avail_ext="$*"
21141
21142 case "$onlyextensions" in
21143 '') ;;
21144 *)  keepextensions=''
21145     echo "You have requested that only certains extensions be included..." >&4
21146     for i in $onlyextensions; do
21147         case " $avail_ext " in
21148         *" $i "*)
21149             echo "Keeping extension $i."
21150             keepextensions="$keepextensions $i"
21151             ;;
21152         *) echo "Ignoring extension $i." ;;
21153         esac
21154     done
21155     avail_ext="$keepextensions"
21156     ;;
21157 esac
21158
21159 case "$noextensions" in
21160 '') ;;
21161 *)  keepextensions=''
21162     echo "You have requested that certain extensions be ignored..." >&4
21163     for i in $avail_ext; do
21164         case " $noextensions " in
21165         *" $i "*) echo "Ignoring extension $i." ;;
21166         *) echo "Keeping extension $i.";
21167            keepextensions="$keepextensions $i"
21168            ;;
21169         esac
21170     done
21171     avail_ext="$keepextensions"
21172     ;;
21173 esac
21174
21175 : Now see which nonxs extensions are supported on this system.
21176 : For now assume all are.
21177 nonxs_ext=''
21178 for xxx in $nonxs_extensions ; do
21179         case "$xxx" in
21180         *)      nonxs_ext="$nonxs_ext $xxx"
21181                 ;;
21182         esac
21183 done
21184
21185 set X $nonxs_ext
21186 shift
21187 nonxs_ext="$*"
21188
21189 case $usedl in
21190 $define)
21191         $cat <<EOM
21192 A number of extensions are supplied with $package.  You may choose to
21193 compile these extensions for dynamic loading (the default), compile
21194 them into the $package executable (static loading), or not include
21195 them at all.  Answer "none" to include no extensions.
21196 Note that DynaLoader is always built and need not be mentioned here.
21197
21198 EOM
21199         case "$dynamic_ext" in
21200         '')
21201                 : Exclude those listed in static_ext
21202                 dflt=''
21203                 for xxx in $avail_ext; do
21204                         case " $static_ext " in
21205                         *" $xxx "*) ;;
21206                         *) dflt="$dflt $xxx" ;;
21207                         esac
21208                 done
21209                 set X $dflt
21210                 shift
21211                 dflt="$*"
21212                 ;;
21213         *)      dflt="$dynamic_ext"
21214                 # Perhaps we are reusing an old out-of-date config.sh.
21215                 case "$hint" in
21216                 previous)
21217                         if test X"$dynamic_ext" != X"$avail_ext"; then
21218                                 $cat <<EOM
21219 NOTICE:  Your previous config.sh list may be incorrect.
21220 The extensions now available to you are
21221         ${avail_ext}
21222 but the default list from your previous config.sh is
21223         ${dynamic_ext}
21224
21225 EOM
21226                         fi
21227                         ;;
21228                 esac
21229                 ;;
21230         esac
21231         case "$dflt" in
21232         '')     dflt=none;;
21233         esac
21234         rp="What extensions do you wish to load dynamically?"
21235         . ./myread
21236         case "$ans" in
21237         none) dynamic_ext=' ' ;;
21238         *) dynamic_ext="$ans" ;;
21239         esac
21240
21241         case "$static_ext" in
21242         '')
21243                 : Exclude those already listed in dynamic linking
21244                 dflt=''
21245                 for xxx in $avail_ext; do
21246                         case " $dynamic_ext " in
21247                         *" $xxx "*) ;;
21248                         *) dflt="$dflt $xxx" ;;
21249                         esac
21250                 done
21251                 set X $dflt
21252                 shift
21253                 dflt="$*"
21254                 ;;
21255         *)  dflt="$static_ext"
21256                 ;;
21257         esac
21258
21259         case "$dflt" in
21260         '')     dflt=none;;
21261         esac
21262         rp="What extensions do you wish to load statically?"
21263         . ./myread
21264         case "$ans" in
21265         none) static_ext=' ' ;;
21266         *) static_ext="$ans" ;;
21267         esac
21268         ;;
21269 *)
21270         $cat <<EOM
21271 A number of extensions are supplied with $package.  Answer "none"
21272 to include no extensions.
21273 Note that DynaLoader is always built and need not be mentioned here.
21274
21275 EOM
21276         case "$static_ext" in
21277         '') dflt="$avail_ext" ;;
21278         *)      dflt="$static_ext"
21279                 # Perhaps we are reusing an old out-of-date config.sh.
21280                 case "$hint" in
21281                 previous)
21282                         if test X"$static_ext" != X"$avail_ext"; then
21283                                 $cat <<EOM
21284 NOTICE:  Your previous config.sh list may be incorrect.
21285 The extensions now available to you are
21286         ${avail_ext}
21287 but the default list from your previous config.sh is
21288         ${static_ext}
21289
21290 EOM
21291                         fi
21292                         ;;
21293                 esac
21294                 ;;
21295         esac
21296         : Exclude those that are not xs extensions
21297         case "$dflt" in
21298         '')     dflt=none;;
21299         esac
21300         rp="What extensions do you wish to include?"
21301         . ./myread
21302         case "$ans" in
21303         none) static_ext=' ' ;;
21304         *) static_ext="$ans" ;;
21305         esac
21306         ;;
21307 esac
21308 #
21309 # Encode is a special case.  If we are building Encode as a static
21310 # extension, we need to explicitly list its subextensions as well.
21311 # For other nested extensions, this is handled automatically by
21312 # the appropriate Makefile.PL.
21313 case " $static_ext " in
21314         *" Encode "*) # Add the subextensions of Encode
21315         cd "$rsrc/ext"
21316         for xxx in `ls Encode/*/Makefile.PL|awk -F/ '{print $2}'`; do
21317                 static_ext="$static_ext Encode/$xxx"
21318         done
21319         cd "$tdir"
21320         ;;
21321 esac
21322
21323 set X $dynamic_ext $static_ext $nonxs_ext
21324 shift
21325 extensions="$*"
21326
21327 # Sanity check:  We require an extension suitable for use with
21328 # AnyDBM_File, as well as Fcntl and IO.  (Failure to have these
21329 # should show up as failures in the test suite, but it's helpful to
21330 # catch them now.) The 'extensions' list is normally sorted
21331 # alphabetically, so we need to accept either
21332 #    DB_File ... Fcntl ... IO  ....
21333 # or something like
21334 #    Fcntl ... NDBM_File ... IO  ....
21335 case " $extensions"  in
21336 *"_File "*" Fcntl "*" IO "*) ;; # DB_File
21337 *" Fcntl "*"_File "*" IO "*) ;; # GDBM_File
21338 *" Fcntl "*" IO "*"_File "*) ;; # NDBM_File
21339 *) echo "WARNING: Extensions DB_File or *DBM_File, Fcntl, and IO not configured." >&4
21340    echo "WARNING: The Perl you are building will be quite crippled." >& 4
21341    ;;
21342 esac
21343
21344 : Remove libraries needed only for extensions
21345 : The appropriate ext/Foo/Makefile.PL will add them back in, if necessary.
21346 : The exception is SunOS 4.x, which needs them.
21347 case "${osname}X${osvers}" in
21348 sunos*X4*)
21349     perllibs="$libs"
21350     ;;
21351 *) case "$usedl" in
21352     $define|true|[yY]*)
21353             set X `echo " $libs " | sed -e 's@ -lndbm @ @' -e 's@ -lgdbm @ @' -e 's@ -ldbm @ @' -e 's@ -ldb @ @'` 
21354             shift
21355             perllibs="$*"
21356             ;;
21357     *)  perllibs="$libs"
21358             ;;
21359     esac
21360     ;;
21361 esac
21362
21363 : Remove build directory name from cppstdin so it can be used from
21364 : either the present location or the final installed location.
21365 echo " "
21366 : Get out of the UU directory to get correct path name.
21367 cd ..
21368 case "$cppstdin" in
21369 `pwd`/cppstdin)
21370         echo "Stripping down cppstdin path name"
21371         cppstdin=cppstdin
21372         ;;
21373 esac
21374 cd UU
21375
21376 : end of configuration questions
21377 echo " "
21378 echo "End of configuration questions."
21379 echo " "
21380
21381 : back to where it started
21382 if test -d ../UU; then
21383         cd ..
21384 fi
21385
21386 : configuration may be patched via a 'config.arch' file
21387 if $test -f config.arch; then
21388         echo "I see a config.arch file, loading it."
21389         . ./config.arch
21390 fi
21391
21392 : configuration may be patched via a 'config.over' file
21393 if $test -f config.over; then
21394         echo " "
21395         dflt=y
21396         rp='I see a config.over file.  Do you wish to load it?'
21397         . UU/myread
21398         case "$ans" in
21399         n*) echo "OK, I'll ignore it.";;
21400         *)      . ./config.over
21401                 echo "Configuration override changes have been loaded."
21402                 ;;
21403         esac
21404 fi
21405
21406 : in case they want portability, strip down executable paths
21407 case "$d_portable" in
21408 "$define")
21409         echo " "
21410         echo "Stripping down executable paths..." >&4
21411         for file in $loclist $trylist; do
21412                 eval temp=\$$file
21413                 eval $file=`basename $temp`
21414         done
21415         ;;
21416 esac
21417
21418 : create config.sh file
21419 echo " "
21420 echo "Creating config.sh..." >&4
21421 $spitshell <<EOT >config.sh
21422 $startsh
21423 #
21424 # This file was produced by running the Configure script. It holds all the
21425 # definitions figured out by Configure. Should you modify one of these values,
21426 # do not forget to propagate your changes by running "Configure -der". You may
21427 # instead choose to run each of the .SH files by yourself, or "Configure -S".
21428 #
21429
21430 # Package name      : $package
21431 # Source directory  : $src
21432 # Configuration time: $cf_time
21433 # Configured by     : $cf_by
21434 # Target system     : $myuname
21435
21436 Author='$Author'
21437 Date='$Date'
21438 Header='$Header'
21439 Id='$Id'
21440 Locker='$Locker'
21441 Log='$Log'
21442 Mcc='$Mcc'
21443 RCSfile='$RCSfile'
21444 Revision='$Revision'
21445 Source='$Source'
21446 State='$State'
21447 _a='$_a'
21448 _exe='$_exe'
21449 _o='$_o'
21450 afs='$afs'
21451 afsroot='$afsroot'
21452 alignbytes='$alignbytes'
21453 ansi2knr='$ansi2knr'
21454 aphostname='$aphostname'
21455 api_revision='$api_revision'
21456 api_subversion='$api_subversion'
21457 api_version='$api_version'
21458 api_versionstring='$api_versionstring'
21459 ar='$ar'
21460 archlib='$archlib'
21461 archlibexp='$archlibexp'
21462 archname64='$archname64'
21463 archname='$archname'
21464 archobjs='$archobjs'
21465 asctime_r_proto='$asctime_r_proto'
21466 awk='$awk'
21467 baserev='$baserev'
21468 bash='$bash'
21469 bin='$bin'
21470 binexp='$binexp'
21471 bison='$bison'
21472 byacc='$byacc'
21473 byteorder='$byteorder'
21474 c='$c'
21475 castflags='$castflags'
21476 cat='$cat'
21477 cc='$cc'
21478 cccdlflags='$cccdlflags'
21479 ccdlflags='$ccdlflags'
21480 ccflags='$ccflags'
21481 ccflags_uselargefiles='$ccflags_uselargefiles'
21482 ccname='$ccname'
21483 ccsymbols='$ccsymbols'
21484 ccversion='$ccversion'
21485 cf_by='$cf_by'
21486 cf_email='$cf_email'
21487 cf_time='$cf_time'
21488 charsize='$charsize'
21489 chgrp='$chgrp'
21490 chmod='$chmod'
21491 chown='$chown'
21492 clocktype='$clocktype'
21493 comm='$comm'
21494 compress='$compress'
21495 contains='$contains'
21496 cp='$cp'
21497 cpio='$cpio'
21498 cpp='$cpp'
21499 cpp_stuff='$cpp_stuff'
21500 cppccsymbols='$cppccsymbols'
21501 cppflags='$cppflags'
21502 cpplast='$cpplast'
21503 cppminus='$cppminus'
21504 cpprun='$cpprun'
21505 cppstdin='$cppstdin'
21506 cppsymbols='$cppsymbols'
21507 crypt_r_proto='$crypt_r_proto'
21508 cryptlib='$cryptlib'
21509 csh='$csh'
21510 ctermid_r_proto='$ctermid_r_proto'
21511 ctime_r_proto='$ctime_r_proto'
21512 d_Gconvert='$d_Gconvert'
21513 d_PRIEUldbl='$d_PRIEUldbl'
21514 d_PRIFUldbl='$d_PRIFUldbl'
21515 d_PRIGUldbl='$d_PRIGUldbl'
21516 d_PRIXU64='$d_PRIXU64'
21517 d_PRId64='$d_PRId64'
21518 d_PRIeldbl='$d_PRIeldbl'
21519 d_PRIfldbl='$d_PRIfldbl'
21520 d_PRIgldbl='$d_PRIgldbl'
21521 d_PRIi64='$d_PRIi64'
21522 d_PRIo64='$d_PRIo64'
21523 d_PRIu64='$d_PRIu64'
21524 d_PRIx64='$d_PRIx64'
21525 d_SCNfldbl='$d_SCNfldbl'
21526 d__fwalk='$d__fwalk'
21527 d_access='$d_access'
21528 d_accessx='$d_accessx'
21529 d_aintl='$d_aintl'
21530 d_alarm='$d_alarm'
21531 d_archlib='$d_archlib'
21532 d_asctime_r='$d_asctime_r'
21533 d_atolf='$d_atolf'
21534 d_atoll='$d_atoll'
21535 d_attribute_format='$d_attribute_format'
21536 d_attribute_malloc='$d_attribute_malloc'
21537 d_attribute_nonnull='$d_attribute_nonnull'
21538 d_attribute_noreturn='$d_attribute_noreturn'
21539 d_attribute_pure='$d_attribute_pure'
21540 d_attribute_unused='$d_attribute_unused'
21541 d_attribute_warn_unused_result='$d_attribute_warn_unused_result'
21542 d_bcmp='$d_bcmp'
21543 d_bcopy='$d_bcopy'
21544 d_bsd='$d_bsd'
21545 d_bsdgetpgrp='$d_bsdgetpgrp'
21546 d_bsdsetpgrp='$d_bsdsetpgrp'
21547 d_builtin_choose_expr='$d_builtin_choose_expr'
21548 d_builtin_expect='$d_builtin_expect'
21549 d_bzero='$d_bzero'
21550 d_c99_variadic_macros='$d_c99_variadic_macros'
21551 d_casti32='$d_casti32'
21552 d_castneg='$d_castneg'
21553 d_charvspr='$d_charvspr'
21554 d_chown='$d_chown'
21555 d_chroot='$d_chroot'
21556 d_chsize='$d_chsize'
21557 d_class='$d_class'
21558 d_clearenv='$d_clearenv'
21559 d_closedir='$d_closedir'
21560 d_cmsghdr_s='$d_cmsghdr_s'
21561 d_const='$d_const'
21562 d_copysignl='$d_copysignl'
21563 d_cplusplus='$d_cplusplus'
21564 d_crypt='$d_crypt'
21565 d_crypt_r='$d_crypt_r'
21566 d_csh='$d_csh'
21567 d_ctermid='$d_ctermid'
21568 d_ctermid_r='$d_ctermid_r'
21569 d_ctime_r='$d_ctime_r'
21570 d_cuserid='$d_cuserid'
21571 d_dbl_dig='$d_dbl_dig'
21572 d_dbminitproto='$d_dbminitproto'
21573 d_difftime='$d_difftime'
21574 d_dir_dd_fd='$d_dir_dd_fd'
21575 d_dirfd='$d_dirfd'
21576 d_dirnamlen='$d_dirnamlen'
21577 d_dlerror='$d_dlerror'
21578 d_dlopen='$d_dlopen'
21579 d_dlsymun='$d_dlsymun'
21580 d_dosuid='$d_dosuid'
21581 d_drand48_r='$d_drand48_r'
21582 d_drand48proto='$d_drand48proto'
21583 d_dup2='$d_dup2'
21584 d_eaccess='$d_eaccess'
21585 d_endgrent='$d_endgrent'
21586 d_endgrent_r='$d_endgrent_r'
21587 d_endhent='$d_endhent'
21588 d_endhostent_r='$d_endhostent_r'
21589 d_endnent='$d_endnent'
21590 d_endnetent_r='$d_endnetent_r'
21591 d_endpent='$d_endpent'
21592 d_endprotoent_r='$d_endprotoent_r'
21593 d_endpwent='$d_endpwent'
21594 d_endpwent_r='$d_endpwent_r'
21595 d_endsent='$d_endsent'
21596 d_endservent_r='$d_endservent_r'
21597 d_eofnblk='$d_eofnblk'
21598 d_eunice='$d_eunice'
21599 d_faststdio='$d_faststdio'
21600 d_fchdir='$d_fchdir'
21601 d_fchmod='$d_fchmod'
21602 d_fchown='$d_fchown'
21603 d_fcntl='$d_fcntl'
21604 d_fcntl_can_lock='$d_fcntl_can_lock'
21605 d_fd_macros='$d_fd_macros'
21606 d_fd_set='$d_fd_set'
21607 d_fds_bits='$d_fds_bits'
21608 d_fgetpos='$d_fgetpos'
21609 d_finite='$d_finite'
21610 d_finitel='$d_finitel'
21611 d_flexfnam='$d_flexfnam'
21612 d_flock='$d_flock'
21613 d_flockproto='$d_flockproto'
21614 d_fork='$d_fork'
21615 d_fp_class='$d_fp_class'
21616 d_fpathconf='$d_fpathconf'
21617 d_fpclass='$d_fpclass'
21618 d_fpclassify='$d_fpclassify'
21619 d_fpclassl='$d_fpclassl'
21620 d_fpos64_t='$d_fpos64_t'
21621 d_frexpl='$d_frexpl'
21622 d_fs_data_s='$d_fs_data_s'
21623 d_fseeko='$d_fseeko'
21624 d_fsetpos='$d_fsetpos'
21625 d_fstatfs='$d_fstatfs'
21626 d_fstatvfs='$d_fstatvfs'
21627 d_fsync='$d_fsync'
21628 d_ftello='$d_ftello'
21629 d_ftime='$d_ftime'
21630 d_futimes='$d_futimes'
21631 d_getcwd='$d_getcwd'
21632 d_getespwnam='$d_getespwnam'
21633 d_getfsstat='$d_getfsstat'
21634 d_getgrent='$d_getgrent'
21635 d_getgrent_r='$d_getgrent_r'
21636 d_getgrgid_r='$d_getgrgid_r'
21637 d_getgrnam_r='$d_getgrnam_r'
21638 d_getgrps='$d_getgrps'
21639 d_gethbyaddr='$d_gethbyaddr'
21640 d_gethbyname='$d_gethbyname'
21641 d_gethent='$d_gethent'
21642 d_gethname='$d_gethname'
21643 d_gethostbyaddr_r='$d_gethostbyaddr_r'
21644 d_gethostbyname_r='$d_gethostbyname_r'
21645 d_gethostent_r='$d_gethostent_r'
21646 d_gethostprotos='$d_gethostprotos'
21647 d_getitimer='$d_getitimer'
21648 d_getlogin='$d_getlogin'
21649 d_getlogin_r='$d_getlogin_r'
21650 d_getmnt='$d_getmnt'
21651 d_getmntent='$d_getmntent'
21652 d_getnbyaddr='$d_getnbyaddr'
21653 d_getnbyname='$d_getnbyname'
21654 d_getnent='$d_getnent'
21655 d_getnetbyaddr_r='$d_getnetbyaddr_r'
21656 d_getnetbyname_r='$d_getnetbyname_r'
21657 d_getnetent_r='$d_getnetent_r'
21658 d_getnetprotos='$d_getnetprotos'
21659 d_getpagsz='$d_getpagsz'
21660 d_getpbyname='$d_getpbyname'
21661 d_getpbynumber='$d_getpbynumber'
21662 d_getpent='$d_getpent'
21663 d_getpgid='$d_getpgid'
21664 d_getpgrp2='$d_getpgrp2'
21665 d_getpgrp='$d_getpgrp'
21666 d_getppid='$d_getppid'
21667 d_getprior='$d_getprior'
21668 d_getprotobyname_r='$d_getprotobyname_r'
21669 d_getprotobynumber_r='$d_getprotobynumber_r'
21670 d_getprotoent_r='$d_getprotoent_r'
21671 d_getprotoprotos='$d_getprotoprotos'
21672 d_getprpwnam='$d_getprpwnam'
21673 d_getpwent='$d_getpwent'
21674 d_getpwent_r='$d_getpwent_r'
21675 d_getpwnam_r='$d_getpwnam_r'
21676 d_getpwuid_r='$d_getpwuid_r'
21677 d_getsbyname='$d_getsbyname'
21678 d_getsbyport='$d_getsbyport'
21679 d_getsent='$d_getsent'
21680 d_getservbyname_r='$d_getservbyname_r'
21681 d_getservbyport_r='$d_getservbyport_r'
21682 d_getservent_r='$d_getservent_r'
21683 d_getservprotos='$d_getservprotos'
21684 d_getspnam='$d_getspnam'
21685 d_getspnam_r='$d_getspnam_r'
21686 d_gettimeod='$d_gettimeod'
21687 d_gmtime_r='$d_gmtime_r'
21688 d_gnulibc='$d_gnulibc'
21689 d_grpasswd='$d_grpasswd'
21690 d_hasmntopt='$d_hasmntopt'
21691 d_htonl='$d_htonl'
21692 d_ilogbl='$d_ilogbl'
21693 d_inc_version_list='$d_inc_version_list'
21694 d_index='$d_index'
21695 d_inetaton='$d_inetaton'
21696 d_int64_t='$d_int64_t'
21697 d_isascii='$d_isascii'
21698 d_isfinite='$d_isfinite'
21699 d_isinf='$d_isinf'
21700 d_isnan='$d_isnan'
21701 d_isnanl='$d_isnanl'
21702 d_killpg='$d_killpg'
21703 d_lchown='$d_lchown'
21704 d_ldbl_dig='$d_ldbl_dig'
21705 d_libm_lib_version='$d_libm_lib_version'
21706 d_link='$d_link'
21707 d_localtime_r='$d_localtime_r'
21708 d_localtime_r_needs_tzset='$d_localtime_r_needs_tzset'
21709 d_locconv='$d_locconv'
21710 d_lockf='$d_lockf'
21711 d_longdbl='$d_longdbl'
21712 d_longlong='$d_longlong'
21713 d_lseekproto='$d_lseekproto'
21714 d_lstat='$d_lstat'
21715 d_madvise='$d_madvise'
21716 d_malloc_good_size='$d_malloc_good_size'
21717 d_malloc_size='$d_malloc_size'
21718 d_mblen='$d_mblen'
21719 d_mbstowcs='$d_mbstowcs'
21720 d_mbtowc='$d_mbtowc'
21721 d_memchr='$d_memchr'
21722 d_memcmp='$d_memcmp'
21723 d_memcpy='$d_memcpy'
21724 d_memmove='$d_memmove'
21725 d_memset='$d_memset'
21726 d_mkdir='$d_mkdir'
21727 d_mkdtemp='$d_mkdtemp'
21728 d_mkfifo='$d_mkfifo'
21729 d_mkstemp='$d_mkstemp'
21730 d_mkstemps='$d_mkstemps'
21731 d_mktime='$d_mktime'
21732 d_mmap='$d_mmap'
21733 d_modfl='$d_modfl'
21734 d_modfl_pow32_bug='$d_modfl_pow32_bug'
21735 d_modflproto='$d_modflproto'
21736 d_mprotect='$d_mprotect'
21737 d_msg='$d_msg'
21738 d_msg_ctrunc='$d_msg_ctrunc'
21739 d_msg_dontroute='$d_msg_dontroute'
21740 d_msg_oob='$d_msg_oob'
21741 d_msg_peek='$d_msg_peek'
21742 d_msg_proxy='$d_msg_proxy'
21743 d_msgctl='$d_msgctl'
21744 d_msgget='$d_msgget'
21745 d_msghdr_s='$d_msghdr_s'
21746 d_msgrcv='$d_msgrcv'
21747 d_msgsnd='$d_msgsnd'
21748 d_msync='$d_msync'
21749 d_munmap='$d_munmap'
21750 d_mymalloc='$d_mymalloc'
21751 d_nice='$d_nice'
21752 d_nl_langinfo='$d_nl_langinfo'
21753 d_nv_preserves_uv='$d_nv_preserves_uv'
21754 d_nv_zero_is_allbits_zero='$d_nv_zero_is_allbits_zero'
21755 d_off64_t='$d_off64_t'
21756 d_old_pthread_create_joinable='$d_old_pthread_create_joinable'
21757 d_oldpthreads='$d_oldpthreads'
21758 d_oldsock='$d_oldsock'
21759 d_open3='$d_open3'
21760 d_pathconf='$d_pathconf'
21761 d_pause='$d_pause'
21762 d_perl_otherlibdirs='$d_perl_otherlibdirs'
21763 d_phostname='$d_phostname'
21764 d_pipe='$d_pipe'
21765 d_poll='$d_poll'
21766 d_portable='$d_portable'
21767 d_printf_format_null='$d_printf_format_null'
21768 d_procselfexe='$d_procselfexe'
21769 d_pseudofork='$d_pseudofork'
21770 d_pthread_atfork='$d_pthread_atfork'
21771 d_pthread_attr_setscope='$d_pthread_attr_setscope'
21772 d_pthread_yield='$d_pthread_yield'
21773 d_pwage='$d_pwage'
21774 d_pwchange='$d_pwchange'
21775 d_pwclass='$d_pwclass'
21776 d_pwcomment='$d_pwcomment'
21777 d_pwexpire='$d_pwexpire'
21778 d_pwgecos='$d_pwgecos'
21779 d_pwpasswd='$d_pwpasswd'
21780 d_pwquota='$d_pwquota'
21781 d_qgcvt='$d_qgcvt'
21782 d_quad='$d_quad'
21783 d_random_r='$d_random_r'
21784 d_readdir64_r='$d_readdir64_r'
21785 d_readdir='$d_readdir'
21786 d_readdir_r='$d_readdir_r'
21787 d_readlink='$d_readlink'
21788 d_readv='$d_readv'
21789 d_recvmsg='$d_recvmsg'
21790 d_rename='$d_rename'
21791 d_rewinddir='$d_rewinddir'
21792 d_rmdir='$d_rmdir'
21793 d_safebcpy='$d_safebcpy'
21794 d_safemcpy='$d_safemcpy'
21795 d_sanemcmp='$d_sanemcmp'
21796 d_sbrkproto='$d_sbrkproto'
21797 d_scalbnl='$d_scalbnl'
21798 d_sched_yield='$d_sched_yield'
21799 d_scm_rights='$d_scm_rights'
21800 d_seekdir='$d_seekdir'
21801 d_select='$d_select'
21802 d_sem='$d_sem'
21803 d_semctl='$d_semctl'
21804 d_semctl_semid_ds='$d_semctl_semid_ds'
21805 d_semctl_semun='$d_semctl_semun'
21806 d_semget='$d_semget'
21807 d_semop='$d_semop'
21808 d_sendmsg='$d_sendmsg'
21809 d_setegid='$d_setegid'
21810 d_seteuid='$d_seteuid'
21811 d_setgrent='$d_setgrent'
21812 d_setgrent_r='$d_setgrent_r'
21813 d_setgrps='$d_setgrps'
21814 d_sethent='$d_sethent'
21815 d_sethostent_r='$d_sethostent_r'
21816 d_setitimer='$d_setitimer'
21817 d_setlinebuf='$d_setlinebuf'
21818 d_setlocale='$d_setlocale'
21819 d_setlocale_r='$d_setlocale_r'
21820 d_setnent='$d_setnent'
21821 d_setnetent_r='$d_setnetent_r'
21822 d_setpent='$d_setpent'
21823 d_setpgid='$d_setpgid'
21824 d_setpgrp2='$d_setpgrp2'
21825 d_setpgrp='$d_setpgrp'
21826 d_setprior='$d_setprior'
21827 d_setproctitle='$d_setproctitle'
21828 d_setprotoent_r='$d_setprotoent_r'
21829 d_setpwent='$d_setpwent'
21830 d_setpwent_r='$d_setpwent_r'
21831 d_setregid='$d_setregid'
21832 d_setresgid='$d_setresgid'
21833 d_setresuid='$d_setresuid'
21834 d_setreuid='$d_setreuid'
21835 d_setrgid='$d_setrgid'
21836 d_setruid='$d_setruid'
21837 d_setsent='$d_setsent'
21838 d_setservent_r='$d_setservent_r'
21839 d_setsid='$d_setsid'
21840 d_setvbuf='$d_setvbuf'
21841 d_sfio='$d_sfio'
21842 d_shm='$d_shm'
21843 d_shmat='$d_shmat'
21844 d_shmatprototype='$d_shmatprototype'
21845 d_shmctl='$d_shmctl'
21846 d_shmdt='$d_shmdt'
21847 d_shmget='$d_shmget'
21848 d_sigaction='$d_sigaction'
21849 d_sigprocmask='$d_sigprocmask'
21850 d_sigsetjmp='$d_sigsetjmp'
21851 d_sitearch='$d_sitearch'
21852 d_snprintf='$d_snprintf'
21853 d_sockatmark='$d_sockatmark'
21854 d_sockatmarkproto='$d_sockatmarkproto'
21855 d_socket='$d_socket'
21856 d_socklen_t='$d_socklen_t'
21857 d_sockpair='$d_sockpair'
21858 d_socks5_init='$d_socks5_init'
21859 d_sprintf_returns_strlen='$d_sprintf_returns_strlen'
21860 d_sqrtl='$d_sqrtl'
21861 d_srand48_r='$d_srand48_r'
21862 d_srandom_r='$d_srandom_r'
21863 d_sresgproto='$d_sresgproto'
21864 d_sresuproto='$d_sresuproto'
21865 d_statblks='$d_statblks'
21866 d_statfs_f_flags='$d_statfs_f_flags'
21867 d_statfs_s='$d_statfs_s'
21868 d_statvfs='$d_statvfs'
21869 d_stdio_cnt_lval='$d_stdio_cnt_lval'
21870 d_stdio_ptr_lval='$d_stdio_ptr_lval'
21871 d_stdio_ptr_lval_nochange_cnt='$d_stdio_ptr_lval_nochange_cnt'
21872 d_stdio_ptr_lval_sets_cnt='$d_stdio_ptr_lval_sets_cnt'
21873 d_stdio_stream_array='$d_stdio_stream_array'
21874 d_stdiobase='$d_stdiobase'
21875 d_stdstdio='$d_stdstdio'
21876 d_strchr='$d_strchr'
21877 d_strcoll='$d_strcoll'
21878 d_strctcpy='$d_strctcpy'
21879 d_strerrm='$d_strerrm'
21880 d_strerror='$d_strerror'
21881 d_strerror_r='$d_strerror_r'
21882 d_strftime='$d_strftime'
21883 d_strlcat='$d_strlcat'
21884 d_strlcpy='$d_strlcpy'
21885 d_strtod='$d_strtod'
21886 d_strtol='$d_strtol'
21887 d_strtold='$d_strtold'
21888 d_strtoll='$d_strtoll'
21889 d_strtoq='$d_strtoq'
21890 d_strtoul='$d_strtoul'
21891 d_strtoull='$d_strtoull'
21892 d_strtouq='$d_strtouq'
21893 d_strxfrm='$d_strxfrm'
21894 d_suidsafe='$d_suidsafe'
21895 d_symlink='$d_symlink'
21896 d_syscall='$d_syscall'
21897 d_syscallproto='$d_syscallproto'
21898 d_sysconf='$d_sysconf'
21899 d_sysernlst='$d_sysernlst'
21900 d_syserrlst='$d_syserrlst'
21901 d_system='$d_system'
21902 d_tcgetpgrp='$d_tcgetpgrp'
21903 d_tcsetpgrp='$d_tcsetpgrp'
21904 d_telldir='$d_telldir'
21905 d_telldirproto='$d_telldirproto'
21906 d_time='$d_time'
21907 d_times='$d_times'
21908 d_tm_tm_gmtoff='$d_tm_tm_gmtoff'
21909 d_tm_tm_zone='$d_tm_tm_zone'
21910 d_tmpnam_r='$d_tmpnam_r'
21911 d_truncate='$d_truncate'
21912 d_ttyname_r='$d_ttyname_r'
21913 d_tzname='$d_tzname'
21914 d_u32align='$d_u32align'
21915 d_ualarm='$d_ualarm'
21916 d_umask='$d_umask'
21917 d_uname='$d_uname'
21918 d_union_semun='$d_union_semun'
21919 d_unordered='$d_unordered'
21920 d_unsetenv='$d_unsetenv'
21921 d_usleep='$d_usleep'
21922 d_usleepproto='$d_usleepproto'
21923 d_ustat='$d_ustat'
21924 d_vendorarch='$d_vendorarch'
21925 d_vendorbin='$d_vendorbin'
21926 d_vendorlib='$d_vendorlib'
21927 d_vendorscript='$d_vendorscript'
21928 d_vfork='$d_vfork'
21929 d_void_closedir='$d_void_closedir'
21930 d_voidsig='$d_voidsig'
21931 d_voidtty='$d_voidtty'
21932 d_volatile='$d_volatile'
21933 d_vprintf='$d_vprintf'
21934 d_vsnprintf='$d_vsnprintf'
21935 d_wait4='$d_wait4'
21936 d_waitpid='$d_waitpid'
21937 d_wcstombs='$d_wcstombs'
21938 d_wctomb='$d_wctomb'
21939 d_writev='$d_writev'
21940 d_xenix='$d_xenix'
21941 date='$date'
21942 db_hashtype='$db_hashtype'
21943 db_prefixtype='$db_prefixtype'
21944 db_version_major='$db_version_major'
21945 db_version_minor='$db_version_minor'
21946 db_version_patch='$db_version_patch'
21947 defvoidused='$defvoidused'
21948 direntrytype='$direntrytype'
21949 dlext='$dlext'
21950 dlsrc='$dlsrc'
21951 doublesize='$doublesize'
21952 drand01='$drand01'
21953 drand48_r_proto='$drand48_r_proto'
21954 dynamic_ext='$dynamic_ext'
21955 eagain='$eagain'
21956 ebcdic='$ebcdic'
21957 echo='$echo'
21958 egrep='$egrep'
21959 emacs='$emacs'
21960 endgrent_r_proto='$endgrent_r_proto'
21961 endhostent_r_proto='$endhostent_r_proto'
21962 endnetent_r_proto='$endnetent_r_proto'
21963 endprotoent_r_proto='$endprotoent_r_proto'
21964 endpwent_r_proto='$endpwent_r_proto'
21965 endservent_r_proto='$endservent_r_proto'
21966 eunicefix='$eunicefix'
21967 exe_ext='$exe_ext'
21968 expr='$expr'
21969 extensions='$extensions'
21970 extras='$extras'
21971 fflushNULL='$fflushNULL'
21972 fflushall='$fflushall'
21973 find='$find'
21974 firstmakefile='$firstmakefile'
21975 flex='$flex'
21976 fpossize='$fpossize'
21977 fpostype='$fpostype'
21978 freetype='$freetype'
21979 from='$from'
21980 full_ar='$full_ar'
21981 full_csh='$full_csh'
21982 full_sed='$full_sed'
21983 gccansipedantic='$gccansipedantic'
21984 gccosandvers='$gccosandvers'
21985 gccversion='$gccversion'
21986 getgrent_r_proto='$getgrent_r_proto'
21987 getgrgid_r_proto='$getgrgid_r_proto'
21988 getgrnam_r_proto='$getgrnam_r_proto'
21989 gethostbyaddr_r_proto='$gethostbyaddr_r_proto'
21990 gethostbyname_r_proto='$gethostbyname_r_proto'
21991 gethostent_r_proto='$gethostent_r_proto'
21992 getlogin_r_proto='$getlogin_r_proto'
21993 getnetbyaddr_r_proto='$getnetbyaddr_r_proto'
21994 getnetbyname_r_proto='$getnetbyname_r_proto'
21995 getnetent_r_proto='$getnetent_r_proto'
21996 getprotobyname_r_proto='$getprotobyname_r_proto'
21997 getprotobynumber_r_proto='$getprotobynumber_r_proto'
21998 getprotoent_r_proto='$getprotoent_r_proto'
21999 getpwent_r_proto='$getpwent_r_proto'
22000 getpwnam_r_proto='$getpwnam_r_proto'
22001 getpwuid_r_proto='$getpwuid_r_proto'
22002 getservbyname_r_proto='$getservbyname_r_proto'
22003 getservbyport_r_proto='$getservbyport_r_proto'
22004 getservent_r_proto='$getservent_r_proto'
22005 getspnam_r_proto='$getspnam_r_proto'
22006 gidformat='$gidformat'
22007 gidsign='$gidsign'
22008 gidsize='$gidsize'
22009 gidtype='$gidtype'
22010 glibpth='$glibpth'
22011 gmake='$gmake'
22012 gmtime_r_proto='$gmtime_r_proto'
22013 gnulibc_version='$gnulibc_version'
22014 grep='$grep'
22015 groupcat='$groupcat'
22016 groupstype='$groupstype'
22017 gzip='$gzip'
22018 h_fcntl='$h_fcntl'
22019 h_sysfile='$h_sysfile'
22020 hint='$hint'
22021 hostcat='$hostcat'
22022 html1dir='$html1dir'
22023 html1direxp='$html1direxp'
22024 html3dir='$html3dir'
22025 html3direxp='$html3direxp'
22026 i16size='$i16size'
22027 i16type='$i16type'
22028 i32size='$i32size'
22029 i32type='$i32type'
22030 i64size='$i64size'
22031 i64type='$i64type'
22032 i8size='$i8size'
22033 i8type='$i8type'
22034 i_arpainet='$i_arpainet'
22035 i_bsdioctl='$i_bsdioctl'
22036 i_crypt='$i_crypt'
22037 i_db='$i_db'
22038 i_dbm='$i_dbm'
22039 i_dirent='$i_dirent'
22040 i_dld='$i_dld'
22041 i_dlfcn='$i_dlfcn'
22042 i_fcntl='$i_fcntl'
22043 i_float='$i_float'
22044 i_fp='$i_fp'
22045 i_fp_class='$i_fp_class'
22046 i_gdbm='$i_gdbm'
22047 i_grp='$i_grp'
22048 i_ieeefp='$i_ieeefp'
22049 i_inttypes='$i_inttypes'
22050 i_langinfo='$i_langinfo'
22051 i_libutil='$i_libutil'
22052 i_limits='$i_limits'
22053 i_locale='$i_locale'
22054 i_machcthr='$i_machcthr'
22055 i_malloc='$i_malloc'
22056 i_math='$i_math'
22057 i_memory='$i_memory'
22058 i_mntent='$i_mntent'
22059 i_ndbm='$i_ndbm'
22060 i_netdb='$i_netdb'
22061 i_neterrno='$i_neterrno'
22062 i_netinettcp='$i_netinettcp'
22063 i_niin='$i_niin'
22064 i_poll='$i_poll'
22065 i_prot='$i_prot'
22066 i_pthread='$i_pthread'
22067 i_pwd='$i_pwd'
22068 i_rpcsvcdbm='$i_rpcsvcdbm'
22069 i_sfio='$i_sfio'
22070 i_sgtty='$i_sgtty'
22071 i_shadow='$i_shadow'
22072 i_socks='$i_socks'
22073 i_stdarg='$i_stdarg'
22074 i_stddef='$i_stddef'
22075 i_stdlib='$i_stdlib'
22076 i_string='$i_string'
22077 i_sunmath='$i_sunmath'
22078 i_sysaccess='$i_sysaccess'
22079 i_sysdir='$i_sysdir'
22080 i_sysfile='$i_sysfile'
22081 i_sysfilio='$i_sysfilio'
22082 i_sysin='$i_sysin'
22083 i_sysioctl='$i_sysioctl'
22084 i_syslog='$i_syslog'
22085 i_sysmman='$i_sysmman'
22086 i_sysmode='$i_sysmode'
22087 i_sysmount='$i_sysmount'
22088 i_sysndir='$i_sysndir'
22089 i_sysparam='$i_sysparam'
22090 i_sysresrc='$i_sysresrc'
22091 i_syssecrt='$i_syssecrt'
22092 i_sysselct='$i_sysselct'
22093 i_syssockio='$i_syssockio'
22094 i_sysstat='$i_sysstat'
22095 i_sysstatfs='$i_sysstatfs'
22096 i_sysstatvfs='$i_sysstatvfs'
22097 i_systime='$i_systime'
22098 i_systimek='$i_systimek'
22099 i_systimes='$i_systimes'
22100 i_systypes='$i_systypes'
22101 i_sysuio='$i_sysuio'
22102 i_sysun='$i_sysun'
22103 i_sysutsname='$i_sysutsname'
22104 i_sysvfs='$i_sysvfs'
22105 i_syswait='$i_syswait'
22106 i_termio='$i_termio'
22107 i_termios='$i_termios'
22108 i_time='$i_time'
22109 i_unistd='$i_unistd'
22110 i_ustat='$i_ustat'
22111 i_utime='$i_utime'
22112 i_values='$i_values'
22113 i_varargs='$i_varargs'
22114 i_varhdr='$i_varhdr'
22115 i_vfork='$i_vfork'
22116 ignore_versioned_solibs='$ignore_versioned_solibs'
22117 inc_version_list='$inc_version_list'
22118 inc_version_list_init='$inc_version_list_init'
22119 incpath='$incpath'
22120 inews='$inews'
22121 initialinstalllocation='$initialinstalllocation'
22122 installarchlib='$installarchlib'
22123 installbin='$installbin'
22124 installhtml1dir='$installhtml1dir'
22125 installhtml3dir='$installhtml3dir'
22126 installman1dir='$installman1dir'
22127 installman3dir='$installman3dir'
22128 installprefix='$installprefix'
22129 installprefixexp='$installprefixexp'
22130 installprivlib='$installprivlib'
22131 installscript='$installscript'
22132 installsitearch='$installsitearch'
22133 installsitebin='$installsitebin'
22134 installsitehtml1dir='$installsitehtml1dir'
22135 installsitehtml3dir='$installsitehtml3dir'
22136 installsitelib='$installsitelib'
22137 installsiteman1dir='$installsiteman1dir'
22138 installsiteman3dir='$installsiteman3dir'
22139 installsitescript='$installsitescript'
22140 installstyle='$installstyle'
22141 installusrbinperl='$installusrbinperl'
22142 installvendorarch='$installvendorarch'
22143 installvendorbin='$installvendorbin'
22144 installvendorhtml1dir='$installvendorhtml1dir'
22145 installvendorhtml3dir='$installvendorhtml3dir'
22146 installvendorlib='$installvendorlib'
22147 installvendorman1dir='$installvendorman1dir'
22148 installvendorman3dir='$installvendorman3dir'
22149 installvendorscript='$installvendorscript'
22150 intsize='$intsize'
22151 issymlink='$issymlink'
22152 ivdformat='$ivdformat'
22153 ivsize='$ivsize'
22154 ivtype='$ivtype'
22155 known_extensions='$known_extensions'
22156 ksh='$ksh'
22157 ld='$ld'
22158 lddlflags='$lddlflags'
22159 ldflags='$ldflags'
22160 ldflags_uselargefiles='$ldflags_uselargefiles'
22161 ldlibpthname='$ldlibpthname'
22162 less='$less'
22163 lib_ext='$lib_ext'
22164 libc='$libc'
22165 libperl='$libperl'
22166 libpth='$libpth'
22167 libs='$libs'
22168 libsdirs='$libsdirs'
22169 libsfiles='$libsfiles'
22170 libsfound='$libsfound'
22171 libspath='$libspath'
22172 libswanted='$libswanted'
22173 libswanted_uselargefiles='$libswanted_uselargefiles'
22174 line='$line'
22175 lint='$lint'
22176 lkflags='$lkflags'
22177 ln='$ln'
22178 lns='$lns'
22179 localtime_r_proto='$localtime_r_proto'
22180 locincpth='$locincpth'
22181 loclibpth='$loclibpth'
22182 longdblsize='$longdblsize'
22183 longlongsize='$longlongsize'
22184 longsize='$longsize'
22185 lp='$lp'
22186 lpr='$lpr'
22187 ls='$ls'
22188 lseeksize='$lseeksize'
22189 lseektype='$lseektype'
22190 mad='$mad'
22191 madlyh='$madlyh'
22192 madlyobj='$madlyobj'
22193 madlysrc='$madlysrc'
22194 mail='$mail'
22195 mailx='$mailx'
22196 make='$make'
22197 make_set_make='$make_set_make'
22198 mallocobj='$mallocobj'
22199 mallocsrc='$mallocsrc'
22200 malloctype='$malloctype'
22201 man1dir='$man1dir'
22202 man1direxp='$man1direxp'
22203 man1ext='$man1ext'
22204 man3dir='$man3dir'
22205 man3direxp='$man3direxp'
22206 man3ext='$man3ext'
22207 mips_type='$mips_type'
22208 mistrustnm='$mistrustnm'
22209 mkdir='$mkdir'
22210 mmaptype='$mmaptype'
22211 modetype='$modetype'
22212 more='$more'
22213 multiarch='$multiarch'
22214 mv='$mv'
22215 myarchname='$myarchname'
22216 mydomain='$mydomain'
22217 myhostname='$myhostname'
22218 myuname='$myuname'
22219 n='$n'
22220 need_va_copy='$need_va_copy'
22221 netdb_hlen_type='$netdb_hlen_type'
22222 netdb_host_type='$netdb_host_type'
22223 netdb_name_type='$netdb_name_type'
22224 netdb_net_type='$netdb_net_type'
22225 nm='$nm'
22226 nm_opt='$nm_opt'
22227 nm_so_opt='$nm_so_opt'
22228 nonxs_ext='$nonxs_ext'
22229 nroff='$nroff'
22230 nvEUformat='$nvEUformat'
22231 nvFUformat='$nvFUformat'
22232 nvGUformat='$nvGUformat'
22233 nv_preserves_uv_bits='$nv_preserves_uv_bits'
22234 nveformat='$nveformat'
22235 nvfformat='$nvfformat'
22236 nvgformat='$nvgformat'
22237 nvsize='$nvsize'
22238 nvtype='$nvtype'
22239 o_nonblock='$o_nonblock'
22240 obj_ext='$obj_ext'
22241 old_pthread_create_joinable='$old_pthread_create_joinable'
22242 optimize='$optimize'
22243 orderlib='$orderlib'
22244 osname='$osname'
22245 osvers='$osvers'
22246 otherlibdirs='$otherlibdirs'
22247 package='$package'
22248 pager='$pager'
22249 passcat='$passcat'
22250 patchlevel='$patchlevel'
22251 path_sep='$path_sep'
22252 perl5='$perl5'
22253 perl='$perl'
22254 perl_patchlevel='$perl_patchlevel'
22255 perladmin='$perladmin'
22256 perllibs='$perllibs'
22257 perlpath='$perlpath'
22258 pg='$pg'
22259 phostname='$phostname'
22260 pidtype='$pidtype'
22261 plibpth='$plibpth'
22262 pmake='$pmake'
22263 pr='$pr'
22264 prefix='$prefix'
22265 prefixexp='$prefixexp'
22266 privlib='$privlib'
22267 privlibexp='$privlibexp'
22268 procselfexe='$procselfexe'
22269 prototype='$prototype'
22270 ptrsize='$ptrsize'
22271 quadkind='$quadkind'
22272 quadtype='$quadtype'
22273 randbits='$randbits'
22274 randfunc='$randfunc'
22275 random_r_proto='$random_r_proto'
22276 randseedtype='$randseedtype'
22277 ranlib='$ranlib'
22278 rd_nodata='$rd_nodata'
22279 readdir64_r_proto='$readdir64_r_proto'
22280 readdir_r_proto='$readdir_r_proto'
22281 revision='$revision'
22282 rm='$rm'
22283 rmail='$rmail'
22284 run='$run'
22285 runnm='$runnm'
22286 sPRIEUldbl='$sPRIEUldbl'
22287 sPRIFUldbl='$sPRIFUldbl'
22288 sPRIGUldbl='$sPRIGUldbl'
22289 sPRIXU64='$sPRIXU64'
22290 sPRId64='$sPRId64'
22291 sPRIeldbl='$sPRIeldbl'
22292 sPRIfldbl='$sPRIfldbl'
22293 sPRIgldbl='$sPRIgldbl'
22294 sPRIi64='$sPRIi64'
22295 sPRIo64='$sPRIo64'
22296 sPRIu64='$sPRIu64'
22297 sPRIx64='$sPRIx64'
22298 sSCNfldbl='$sSCNfldbl'
22299 sched_yield='$sched_yield'
22300 scriptdir='$scriptdir'
22301 scriptdirexp='$scriptdirexp'
22302 sed='$sed'
22303 seedfunc='$seedfunc'
22304 selectminbits='$selectminbits'
22305 selecttype='$selecttype'
22306 sendmail='$sendmail'
22307 setgrent_r_proto='$setgrent_r_proto'
22308 sethostent_r_proto='$sethostent_r_proto'
22309 setlocale_r_proto='$setlocale_r_proto'
22310 setnetent_r_proto='$setnetent_r_proto'
22311 setprotoent_r_proto='$setprotoent_r_proto'
22312 setpwent_r_proto='$setpwent_r_proto'
22313 setservent_r_proto='$setservent_r_proto'
22314 sh='$sh'
22315 shar='$shar'
22316 sharpbang='$sharpbang'
22317 shmattype='$shmattype'
22318 shortsize='$shortsize'
22319 shrpenv='$shrpenv'
22320 shsharp='$shsharp'
22321 sig_count='$sig_count'
22322 sig_name='$sig_name'
22323 sig_name_init='$sig_name_init'
22324 sig_num='$sig_num'
22325 sig_num_init='$sig_num_init'
22326 sig_size='$sig_size'
22327 signal_t='$signal_t'
22328 sitearch='$sitearch'
22329 sitearchexp='$sitearchexp'
22330 sitebin='$sitebin'
22331 sitebinexp='$sitebinexp'
22332 sitehtml1dir='$sitehtml1dir'
22333 sitehtml1direxp='$sitehtml1direxp'
22334 sitehtml3dir='$sitehtml3dir'
22335 sitehtml3direxp='$sitehtml3direxp'
22336 sitelib='$sitelib'
22337 sitelib_stem='$sitelib_stem'
22338 sitelibexp='$sitelibexp'
22339 siteman1dir='$siteman1dir'
22340 siteman1direxp='$siteman1direxp'
22341 siteman3dir='$siteman3dir'
22342 siteman3direxp='$siteman3direxp'
22343 siteprefix='$siteprefix'
22344 siteprefixexp='$siteprefixexp'
22345 sitescript='$sitescript'
22346 sitescriptexp='$sitescriptexp'
22347 sizesize='$sizesize'
22348 sizetype='$sizetype'
22349 sleep='$sleep'
22350 smail='$smail'
22351 so='$so'
22352 sockethdr='$sockethdr'
22353 socketlib='$socketlib'
22354 socksizetype='$socksizetype'
22355 sort='$sort'
22356 spackage='$spackage'
22357 spitshell='$spitshell'
22358 srand48_r_proto='$srand48_r_proto'
22359 srandom_r_proto='$srandom_r_proto'
22360 src='$src'
22361 ssizetype='$ssizetype'
22362 startperl='$startperl'
22363 startsh='$startsh'
22364 static_ext='$static_ext'
22365 stdchar='$stdchar'
22366 stdio_base='$stdio_base'
22367 stdio_bufsiz='$stdio_bufsiz'
22368 stdio_cnt='$stdio_cnt'
22369 stdio_filbuf='$stdio_filbuf'
22370 stdio_ptr='$stdio_ptr'
22371 stdio_stream_array='$stdio_stream_array'
22372 strerror_r_proto='$strerror_r_proto'
22373 strings='$strings'
22374 submit='$submit'
22375 subversion='$subversion'
22376 sysman='$sysman'
22377 tail='$tail'
22378 tar='$tar'
22379 targetarch='$targetarch'
22380 tbl='$tbl'
22381 tee='$tee'
22382 test='$test'
22383 timeincl='$timeincl'
22384 timetype='$timetype'
22385 tmpnam_r_proto='$tmpnam_r_proto'
22386 to='$to'
22387 touch='$touch'
22388 tr='$tr'
22389 trnl='$trnl'
22390 troff='$troff'
22391 ttyname_r_proto='$ttyname_r_proto'
22392 u16size='$u16size'
22393 u16type='$u16type'
22394 u32size='$u32size'
22395 u32type='$u32type'
22396 u64size='$u64size'
22397 u64type='$u64type'
22398 u8size='$u8size'
22399 u8type='$u8type'
22400 uidformat='$uidformat'
22401 uidsign='$uidsign'
22402 uidsize='$uidsize'
22403 uidtype='$uidtype'
22404 uname='$uname'
22405 uniq='$uniq'
22406 uquadtype='$uquadtype'
22407 use5005threads='$use5005threads'
22408 use64bitall='$use64bitall'
22409 use64bitint='$use64bitint'
22410 usecrosscompile='$usecrosscompile'
22411 usedl='$usedl'
22412 usefaststdio='$usefaststdio'
22413 useithreads='$useithreads'
22414 uselargefiles='$uselargefiles'
22415 uselongdouble='$uselongdouble'
22416 usemallocwrap='$usemallocwrap'
22417 usemorebits='$usemorebits'
22418 usemultiplicity='$usemultiplicity'
22419 usemymalloc='$usemymalloc'
22420 usenm='$usenm'
22421 useopcode='$useopcode'
22422 useperlio='$useperlio'
22423 useposix='$useposix'
22424 usereentrant='$usereentrant'
22425 userelocatableinc='$userelocatableinc'
22426 usesfio='$usesfio'
22427 useshrplib='$useshrplib'
22428 usesitecustomize='$usesitecustomize'
22429 usesocks='$usesocks'
22430 usethreads='$usethreads'
22431 usevendorprefix='$usevendorprefix'
22432 usevfork='$usevfork'
22433 usrinc='$usrinc'
22434 uuname='$uuname'
22435 uvXUformat='$uvXUformat'
22436 uvoformat='$uvoformat'
22437 uvsize='$uvsize'
22438 uvtype='$uvtype'
22439 uvuformat='$uvuformat'
22440 uvxformat='$uvxformat'
22441 vendorarch='$vendorarch'
22442 vendorarchexp='$vendorarchexp'
22443 vendorbin='$vendorbin'
22444 vendorbinexp='$vendorbinexp'
22445 vendorhtml1dir='$vendorhtml1dir'
22446 vendorhtml1direxp='$vendorhtml1direxp'
22447 vendorhtml3dir='$vendorhtml3dir'
22448 vendorhtml3direxp='$vendorhtml3direxp'
22449 vendorlib='$vendorlib'
22450 vendorlib_stem='$vendorlib_stem'
22451 vendorlibexp='$vendorlibexp'
22452 vendorman1dir='$vendorman1dir'
22453 vendorman1direxp='$vendorman1direxp'
22454 vendorman3dir='$vendorman3dir'
22455 vendorman3direxp='$vendorman3direxp'
22456 vendorprefix='$vendorprefix'
22457 vendorprefixexp='$vendorprefixexp'
22458 vendorscript='$vendorscript'
22459 vendorscriptexp='$vendorscriptexp'
22460 version='$version'
22461 version_patchlevel_string='$version_patchlevel_string'
22462 versiononly='$versiononly'
22463 vi='$vi'
22464 voidflags='$voidflags'
22465 xlibpth='$xlibpth'
22466 yacc='$yacc'
22467 yaccflags='$yaccflags'
22468 zcat='$zcat'
22469 zip='$zip'
22470 EOT
22471
22472 : Add in command line options if available
22473 $test -f UU/cmdline.opt && $cat UU/cmdline.opt >> config.sh
22474
22475 : add special variables
22476 $test -f $src/patchlevel.h && \
22477 awk '/^#define[         ]+PERL_/ {printf "%s=%s\n",$2,$3}' $src/patchlevel.h >>config.sh
22478 echo "PERL_PATCHLEVEL=$perl_patchlevel" >>config.sh
22479 echo "PERL_CONFIG_SH=true" >>config.sh
22480
22481 : propagate old symbols
22482 if $test -f UU/config.sh; then
22483         <UU/config.sh $sort | $uniq >UU/oldconfig.sh
22484         sed -n 's/^\([a-zA-Z_0-9]*\)=.*/\1/p' config.sh config.sh UU/oldconfig.sh |\
22485         $sort | $uniq -u >UU/oldsyms
22486         set X `cat UU/oldsyms`
22487         shift
22488         case $# in
22489         0) ;;
22490         *)
22491                 cat <<EOM
22492 Hmm...You had some extra variables I don't know about...I'll try to keep 'em...
22493 EOM
22494                 echo "# Variables propagated from previous config.sh file." >>config.sh
22495                 for sym in `cat UU/oldsyms`; do
22496                         echo "    Propagating $hint variable "'$'"$sym..."
22497                         eval 'tmp="$'"${sym}"'"'
22498                         echo "$tmp" | \
22499                                 sed -e "s/'/'\"'\"'/g" -e "s/^/$sym='/" -e "s/$/'/" >>config.sh
22500                 done
22501                 ;;
22502         esac
22503 fi
22504
22505 : Finish up by extracting the .SH files
22506 case "$alldone" in
22507 exit)
22508         $rm -rf UU
22509         echo "Extraction done."
22510         exit 0
22511         ;;
22512 cont)
22513         ;;
22514 '')
22515         dflt=''
22516         nostick=true
22517         $cat <<EOM
22518
22519 If you'd like to make any changes to the config.sh file before I begin
22520 to configure things, do it as a shell escape now (e.g. !vi config.sh).
22521
22522 EOM
22523         rp="Press return or use a shell escape to edit config.sh:"
22524         . UU/myread
22525         nostick=''
22526         case "$ans" in
22527         '') ;;
22528         *) : in case they cannot read
22529                 sh 1>&4 -c "$ans";;
22530         esac
22531         ;;
22532 esac
22533
22534 : if this fails, just run all the .SH files by hand
22535 . ./config.sh
22536
22537 echo " "
22538 exec 1>&4
22539 pwd=`pwd`
22540 . ./UU/extract
22541 cd "$pwd"
22542
22543 if $contains '^depend:' [Mm]akefile >/dev/null 2>&1; then
22544         dflt=y
22545         case "$silent" in
22546         true) ;;
22547         *)
22548                 $cat <<EOM
22549
22550 Now you need to generate make dependencies by running "$make depend".
22551 You might prefer to run it in background: "$make depend > makedepend.out &"
22552 It can take a while, so you might not want to run it right now.
22553
22554 EOM
22555                 ;;
22556         esac
22557         rp="Run $make depend now?"
22558         . UU/myread
22559         case "$ans" in
22560         y*)
22561                 $make depend && echo "Now you must run '$make'."
22562                 ;;
22563         *)
22564                 echo "You must run '$make depend' then '$make'."
22565                 ;;
22566         esac
22567 elif test -f [Mm]akefile; then
22568         echo " "
22569         echo "Now you must run a $make."
22570 else
22571         echo "Configure done."
22572 fi
22573
22574 if $test -f Policy.sh; then
22575     $cat <<EOM
22576
22577 If you compile $package on a different machine or from a different object
22578 directory, copy the Policy.sh file from this object directory to the
22579 new one before you run Configure -- this will help you with most of
22580 the policy defaults.
22581
22582 EOM
22583 fi
22584 if $test -f config.msg; then
22585     echo "Hmm.  I also noted the following information while running:"
22586     echo " "
22587     $cat config.msg >&4
22588     $rm -f config.msg
22589 fi
22590 $rm -f kit*isdone ark*isdone
22591 $rm -rf UU
22592
22593 : End of Configure
22594